Skip to content

Commit 4a5f15a

Browse files
author
wicked-tc130
authored
Merge pull request #664 from jpush/dev
更新readme和example
2 parents 178c41e + b9b8c56 commit 4a5f15a

File tree

16 files changed

+477
-368
lines changed

16 files changed

+477
-368
lines changed

README.md

+11-5
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ npm install jpush-react-native --save
6565

6666
```
6767
Add Files to "your project name"
68-
node_modules/jcore-react-native/ios/RCTJCoreModule/
69-
node_modules/jpush-react-native/ios/RCTJPushModule/
68+
node_modules/jcore-react-native/ios/RCTJCoreModule.xcodeproj
69+
node_modules/jpush-react-native/ios/RCTJPushModule.xcodeproj
7070
```
7171

7272
* Capabilities
@@ -89,22 +89,28 @@ npm install jpush-react-native --save
8989
libz.tbd
9090
libresolv.tbd
9191
UserNotifications.framework
92-
92+
libRCTJCoreModule.a
93+
libRCTJPushModule.a
9394
```
9495

9596
## 3. 引用
9697

9798
### 3.1 Android
9899

99-
参考:[MainApplication.java](https://github.com/jpush/jpush-react-native/tree/master/example/android/app/src/main/java/com/example/MainApplication)
100+
参考:[MainApplication.java](https://github.com/jpush/jpush-react-native/tree/master/example/android/app/src/main/java/com/example/MainApplication.java)
100101

101102
### 3.2 iOS
102103

103-
参考:[AppDelegate.m](https://github.com/jpush/jpush-react-native/tree/master/example/ios/PushDemo/AppDelegate.m)
104+
参考:[AppDelegate.m](https://github.com/jpush/jpush-react-native/tree/master/example/ios/example/AppDelegate.m)
104105

105106
## 4. API
106107

107108
详见:[index.js](https://github.com/jpush/jpush-react-native/blob/master/index.js)
108109

110+
## 5. 其他
109111

112+
* 集成前务必将example工程跑通
113+
* JPush3.5.5&&JCore1.3.5属于重构版本,API主要缺少本地通知,如有紧急需求请前往[极光社区](https://community.jiguang.cn/c/question)
114+
* 目前react-native link和pod install还不完善,待下个版本完成
110115

116+

example/ios/PushDemo.xcodeproj/project.pbxproj renamed to example/ios/example.xcodeproj/project.pbxproj

+408-298
Large diffs are not rendered by default.

example/ios/PushDemo.xcodeproj/xcshareddata/xcschemes/PushDemo-tvOS.xcscheme renamed to example/ios/example.xcodeproj/xcshareddata/xcschemes/example-tvOS.xcscheme

+18-18
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
<BuildableReference
3030
BuildableIdentifier = "primary"
3131
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
32-
BuildableName = "PushDemo-tvOS.app"
33-
BlueprintName = "PushDemo-tvOS"
34-
ReferencedContainer = "container:PushDemo.xcodeproj">
32+
BuildableName = "example-tvOS.app"
33+
BlueprintName = "example-tvOS"
34+
ReferencedContainer = "container:example.xcodeproj">
3535
</BuildableReference>
3636
</BuildActionEntry>
3737
<BuildActionEntry
@@ -43,9 +43,9 @@
4343
<BuildableReference
4444
BuildableIdentifier = "primary"
4545
BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
46-
BuildableName = "PushDemo-tvOSTests.xctest"
47-
BlueprintName = "PushDemo-tvOSTests"
48-
ReferencedContainer = "container:PushDemo.xcodeproj">
46+
BuildableName = "example-tvOSTests.xctest"
47+
BlueprintName = "example-tvOSTests"
48+
ReferencedContainer = "container:example.xcodeproj">
4949
</BuildableReference>
5050
</BuildActionEntry>
5151
</BuildActionEntries>
@@ -61,19 +61,19 @@
6161
<BuildableReference
6262
BuildableIdentifier = "primary"
6363
BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
64-
BuildableName = "PushDemo-tvOSTests.xctest"
65-
BlueprintName = "PushDemo-tvOSTests"
66-
ReferencedContainer = "container:PushDemo.xcodeproj">
64+
BuildableName = "example-tvOSTests.xctest"
65+
BlueprintName = "example-tvOSTests"
66+
ReferencedContainer = "container:example.xcodeproj">
6767
</BuildableReference>
6868
</TestableReference>
6969
</Testables>
7070
<MacroExpansion>
7171
<BuildableReference
7272
BuildableIdentifier = "primary"
7373
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
74-
BuildableName = "PushDemo-tvOS.app"
75-
BlueprintName = "PushDemo-tvOS"
76-
ReferencedContainer = "container:PushDemo.xcodeproj">
74+
BuildableName = "example-tvOS.app"
75+
BlueprintName = "example-tvOS"
76+
ReferencedContainer = "container:example.xcodeproj">
7777
</BuildableReference>
7878
</MacroExpansion>
7979
<AdditionalOptions>
@@ -94,9 +94,9 @@
9494
<BuildableReference
9595
BuildableIdentifier = "primary"
9696
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
97-
BuildableName = "PushDemo-tvOS.app"
98-
BlueprintName = "PushDemo-tvOS"
99-
ReferencedContainer = "container:PushDemo.xcodeproj">
97+
BuildableName = "example-tvOS.app"
98+
BlueprintName = "example-tvOS"
99+
ReferencedContainer = "container:example.xcodeproj">
100100
</BuildableReference>
101101
</BuildableProductRunnable>
102102
<AdditionalOptions>
@@ -113,9 +113,9 @@
113113
<BuildableReference
114114
BuildableIdentifier = "primary"
115115
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
116-
BuildableName = "PushDemo-tvOS.app"
117-
BlueprintName = "PushDemo-tvOS"
118-
ReferencedContainer = "container:PushDemo.xcodeproj">
116+
BuildableName = "example-tvOS.app"
117+
BlueprintName = "example-tvOS"
118+
ReferencedContainer = "container:example.xcodeproj">
119119
</BuildableReference>
120120
</BuildableProductRunnable>
121121
</ProfileAction>

example/ios/PushDemo.xcodeproj/xcshareddata/xcschemes/PushDemo.xcscheme renamed to example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme

+18-18
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
<BuildableReference
3030
BuildableIdentifier = "primary"
3131
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
32-
BuildableName = "PushDemo.app"
33-
BlueprintName = "PushDemo"
34-
ReferencedContainer = "container:PushDemo.xcodeproj">
32+
BuildableName = "example.app"
33+
BlueprintName = "example"
34+
ReferencedContainer = "container:example.xcodeproj">
3535
</BuildableReference>
3636
</BuildActionEntry>
3737
<BuildActionEntry
@@ -43,9 +43,9 @@
4343
<BuildableReference
4444
BuildableIdentifier = "primary"
4545
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
46-
BuildableName = "PushDemoTests.xctest"
47-
BlueprintName = "PushDemoTests"
48-
ReferencedContainer = "container:PushDemo.xcodeproj">
46+
BuildableName = "exampleTests.xctest"
47+
BlueprintName = "exampleTests"
48+
ReferencedContainer = "container:example.xcodeproj">
4949
</BuildableReference>
5050
</BuildActionEntry>
5151
</BuildActionEntries>
@@ -61,19 +61,19 @@
6161
<BuildableReference
6262
BuildableIdentifier = "primary"
6363
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
64-
BuildableName = "PushDemoTests.xctest"
65-
BlueprintName = "PushDemoTests"
66-
ReferencedContainer = "container:PushDemo.xcodeproj">
64+
BuildableName = "exampleTests.xctest"
65+
BlueprintName = "exampleTests"
66+
ReferencedContainer = "container:example.xcodeproj">
6767
</BuildableReference>
6868
</TestableReference>
6969
</Testables>
7070
<MacroExpansion>
7171
<BuildableReference
7272
BuildableIdentifier = "primary"
7373
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
74-
BuildableName = "PushDemo.app"
75-
BlueprintName = "PushDemo"
76-
ReferencedContainer = "container:PushDemo.xcodeproj">
74+
BuildableName = "example.app"
75+
BlueprintName = "example"
76+
ReferencedContainer = "container:example.xcodeproj">
7777
</BuildableReference>
7878
</MacroExpansion>
7979
<AdditionalOptions>
@@ -94,9 +94,9 @@
9494
<BuildableReference
9595
BuildableIdentifier = "primary"
9696
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
97-
BuildableName = "PushDemo.app"
98-
BlueprintName = "PushDemo"
99-
ReferencedContainer = "container:PushDemo.xcodeproj">
97+
BuildableName = "example.app"
98+
BlueprintName = "example"
99+
ReferencedContainer = "container:example.xcodeproj">
100100
</BuildableReference>
101101
</BuildableProductRunnable>
102102
<AdditionalOptions>
@@ -113,9 +113,9 @@
113113
<BuildableReference
114114
BuildableIdentifier = "primary"
115115
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
116-
BuildableName = "PushDemo.app"
117-
BlueprintName = "PushDemo"
118-
ReferencedContainer = "container:PushDemo.xcodeproj">
116+
BuildableName = "example.app"
117+
BlueprintName = "example"
118+
ReferencedContainer = "container:example.xcodeproj">
119119
</BuildableReference>
120120
</BuildableProductRunnable>
121121
</ProfileAction>

example/ios/PushDemo/AppDelegate.m renamed to example/ios/example/AppDelegate.m

+3-7
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@
1818

1919
@implementation AppDelegate
2020

21-
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
22-
23-
[JPUSHService setDebugMode];
24-
25-
// JPush初始化配置
21+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
22+
// JPush初始化配置
2623
[JPUSHService setupWithOption:launchOptions appKey:@"129c21dc4cb5e6f6de194003"
2724
channel:@"dev" apsForProduction:YES];
2825
// Apns
@@ -35,7 +32,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
3532
[defaultCenter addObserver:self selector:@selector(networkDidReceiveMessage:) name:kJPFNetworkDidReceiveMessageNotification object:nil];
3633
// 地理围栏
3734
[JPUSHService registerLbsGeofenceDelegate:self withLaunchOptions:launchOptions];
38-
3935
// ReactNative环境配置
4036
NSURL *jsCodeLocation = [NSURL URLWithString:@"http://10.224.36.16:8081/index.bundle?platform=ios&dev=true"];
4137
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
@@ -71,7 +67,7 @@ - (void)application:(UIApplication *)application didReceiveRemoteNotification:
7167
//ios 4 本地通知 todo
7268
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification{
7369
NSDictionary *userInfo = notification.userInfo;
74-
NSLog(@"iOS 4 本地通知");
70+
NSLog(@"iOS 4 本地通知");
7571
[[NSNotificationCenter defaultCenter] postNotificationName:J_LOCAL_NOTIFICATION_EVENT object:userInfo];
7672
}
7773

example/ios/PushDemo/Base.lproj/LaunchScreen.xib renamed to example/ios/example/Base.lproj/LaunchScreen.xib

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
1919
<nil key="highlightedColor"/>
2020
</label>
21-
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="PushDemo" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
21+
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="example" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
2222
<rect key="frame" x="20" y="140" width="441" height="43"/>
2323
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
2424
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>

example/ios/PushDemo/Images.xcassets/AppIcon.appiconset/Contents.json renamed to example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json

-15
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
{
22
"images" : [
3-
{
4-
"idiom" : "iphone",
5-
"size" : "20x20",
6-
"scale" : "2x"
7-
},
8-
{
9-
"idiom" : "iphone",
10-
"size" : "20x20",
11-
"scale" : "3x"
12-
},
133
{
144
"idiom" : "iphone",
155
"size" : "29x29",
@@ -39,11 +29,6 @@
3929
"idiom" : "iphone",
4030
"size" : "60x60",
4131
"scale" : "3x"
42-
},
43-
{
44-
"idiom" : "ios-marketing",
45-
"size" : "1024x1024",
46-
"scale" : "1x"
4732
}
4833
],
4934
"info" : {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"version" : 1,
4+
"author" : "xcode"
5+
}
6+
}

example/ios/PushDemo/Info.plist renamed to example/ios/example/Info.plist

+9-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<key>CFBundleDevelopmentRegion</key>
66
<string>en</string>
77
<key>CFBundleDisplayName</key>
8-
<string>PushDemo</string>
8+
<string>example</string>
99
<key>CFBundleExecutable</key>
1010
<string>$(EXECUTABLE_NAME)</string>
1111
<key>CFBundleIdentifier</key>
@@ -26,8 +26,14 @@
2626
<true/>
2727
<key>NSAppTransportSecurity</key>
2828
<dict>
29-
<key>NSAllowsArbitraryLoads</key>
30-
<true/>
29+
<key>NSExceptionDomains</key>
30+
<dict>
31+
<key>localhost</key>
32+
<dict>
33+
<key>NSExceptionAllowsInsecureHTTPLoads</key>
34+
<true/>
35+
</dict>
36+
</dict>
3137
</dict>
3238
<key>NSLocationWhenInUseUsageDescription</key>
3339
<string></string>
File renamed without changes.

example/ios/PushDemoTests/PushDemoTests.m renamed to example/ios/exampleTests/exampleTests.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
#define TIMEOUT_SECONDS 600
1717
#define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
1818

19-
@interface PushDemoTests : XCTestCase
19+
@interface exampleTests : XCTestCase
2020

2121
@end
2222

23-
@implementation PushDemoTests
23+
@implementation exampleTests
2424

2525
- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
2626
{
@@ -37,7 +37,7 @@ - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
3737

3838
- (void)testRendersWelcomeScreen
3939
{
40-
UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
40+
UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
4141
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
4242
BOOL foundElement = NO;
4343

0 commit comments

Comments
 (0)