Skip to content

Commit

Permalink
Merge pull request #664 from jpush/dev
Browse files Browse the repository at this point in the history
更新readme和example
  • Loading branch information
wicked-tc130 authored Sep 11, 2019
2 parents 178c41e + b9b8c56 commit 4a5f15a
Show file tree
Hide file tree
Showing 16 changed files with 477 additions and 368 deletions.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ npm install jpush-react-native --save

```
Add Files to "your project name"
node_modules/jcore-react-native/ios/RCTJCoreModule/
node_modules/jpush-react-native/ios/RCTJPushModule/
node_modules/jcore-react-native/ios/RCTJCoreModule.xcodeproj
node_modules/jpush-react-native/ios/RCTJPushModule.xcodeproj
```

* Capabilities
Expand All @@ -89,22 +89,28 @@ npm install jpush-react-native --save
libz.tbd
libresolv.tbd
UserNotifications.framework
libRCTJCoreModule.a
libRCTJPushModule.a
```

## 3. 引用

### 3.1 Android

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

### 3.2 iOS

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

## 4. API

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

## 5. 其他

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


File renamed without changes.
File renamed without changes.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
BuildableName = "PushDemo-tvOS.app"
BlueprintName = "PushDemo-tvOS"
ReferencedContainer = "container:PushDemo.xcodeproj">
BuildableName = "example-tvOS.app"
BlueprintName = "example-tvOS"
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
Expand All @@ -43,9 +43,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
BuildableName = "PushDemo-tvOSTests.xctest"
BlueprintName = "PushDemo-tvOSTests"
ReferencedContainer = "container:PushDemo.xcodeproj">
BuildableName = "example-tvOSTests.xctest"
BlueprintName = "example-tvOSTests"
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
Expand All @@ -61,19 +61,19 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E48F1E0B4A5D006451C7"
BuildableName = "PushDemo-tvOSTests.xctest"
BlueprintName = "PushDemo-tvOSTests"
ReferencedContainer = "container:PushDemo.xcodeproj">
BuildableName = "example-tvOSTests.xctest"
BlueprintName = "example-tvOSTests"
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
BuildableName = "PushDemo-tvOS.app"
BlueprintName = "PushDemo-tvOS"
ReferencedContainer = "container:PushDemo.xcodeproj">
BuildableName = "example-tvOS.app"
BlueprintName = "example-tvOS"
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
Expand All @@ -94,9 +94,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
BuildableName = "PushDemo-tvOS.app"
BlueprintName = "PushDemo-tvOS"
ReferencedContainer = "container:PushDemo.xcodeproj">
BuildableName = "example-tvOS.app"
BlueprintName = "example-tvOS"
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
Expand All @@ -113,9 +113,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2D02E47A1E0B4A5D006451C7"
BuildableName = "PushDemo-tvOS.app"
BlueprintName = "PushDemo-tvOS"
ReferencedContainer = "container:PushDemo.xcodeproj">
BuildableName = "example-tvOS.app"
BlueprintName = "example-tvOS"
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "PushDemo.app"
BlueprintName = "PushDemo"
ReferencedContainer = "container:PushDemo.xcodeproj">
BuildableName = "example.app"
BlueprintName = "example"
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
Expand All @@ -43,9 +43,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
BuildableName = "PushDemoTests.xctest"
BlueprintName = "PushDemoTests"
ReferencedContainer = "container:PushDemo.xcodeproj">
BuildableName = "exampleTests.xctest"
BlueprintName = "exampleTests"
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
Expand All @@ -61,19 +61,19 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
BuildableName = "PushDemoTests.xctest"
BlueprintName = "PushDemoTests"
ReferencedContainer = "container:PushDemo.xcodeproj">
BuildableName = "exampleTests.xctest"
BlueprintName = "exampleTests"
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "PushDemo.app"
BlueprintName = "PushDemo"
ReferencedContainer = "container:PushDemo.xcodeproj">
BuildableName = "example.app"
BlueprintName = "example"
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
Expand All @@ -94,9 +94,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "PushDemo.app"
BlueprintName = "PushDemo"
ReferencedContainer = "container:PushDemo.xcodeproj">
BuildableName = "example.app"
BlueprintName = "example"
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
Expand All @@ -113,9 +113,9 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "PushDemo.app"
BlueprintName = "PushDemo"
ReferencedContainer = "container:PushDemo.xcodeproj">
BuildableName = "example.app"
BlueprintName = "example"
ReferencedContainer = "container:example.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

[JPUSHService setDebugMode];

// JPush初始化配置
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
// JPush初始化配置
[JPUSHService setupWithOption:launchOptions appKey:@"129c21dc4cb5e6f6de194003"
channel:@"dev" apsForProduction:YES];
// Apns
Expand All @@ -35,7 +32,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[defaultCenter addObserver:self selector:@selector(networkDidReceiveMessage:) name:kJPFNetworkDidReceiveMessageNotification object:nil];
// 地理围栏
[JPUSHService registerLbsGeofenceDelegate:self withLaunchOptions:launchOptions];

// ReactNative环境配置
NSURL *jsCodeLocation = [NSURL URLWithString:@"http://10.224.36.16:8081/index.bundle?platform=ios&dev=true"];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
Expand Down Expand Up @@ -71,7 +67,7 @@ - (void)application:(UIApplication *)application didReceiveRemoteNotification:
//ios 4 本地通知 todo
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification{
NSDictionary *userInfo = notification.userInfo;
NSLog(@"iOS 4 本地通知");
NSLog(@"iOS 4 本地通知");
[[NSNotificationCenter defaultCenter] postNotificationName:J_LOCAL_NOTIFICATION_EVENT object:userInfo];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<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">
<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">
<rect key="frame" x="20" y="140" width="441" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
Expand Down Expand Up @@ -39,11 +29,6 @@
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
Expand Down
6 changes: 6 additions & 0 deletions example/ios/example/Images.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>PushDemo</string>
<string>example</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand All @@ -26,8 +26,14 @@
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
#define TIMEOUT_SECONDS 600
#define TEXT_TO_LOOK_FOR @"Welcome to React Native!"

@interface PushDemoTests : XCTestCase
@interface exampleTests : XCTestCase

@end

@implementation PushDemoTests
@implementation exampleTests

- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
{
Expand All @@ -37,7 +37,7 @@ - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test

- (void)testRendersWelcomeScreen
{
UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
BOOL foundElement = NO;

Expand Down

0 comments on commit 4a5f15a

Please sign in to comment.