Skip to content

Commit

Permalink
Merge pull request jpush#48 from jpush/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
KenChoi1992 authored Jan 19, 2018
2 parents 2f7650f + 961eccc commit f47f40b
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ public void onError(Platform platform, int action, int errorCode, Throwable thro
@Override
public void onCancel(Platform platform, int i) {
Logger.i(JSHARE_NAME, "share has been canceled");
succeedCallback.invoke(i);
}
});
}
Expand Down Expand Up @@ -248,6 +249,7 @@ public void onError(Platform platform, int action, int errorCode, Throwable thro
@Override
public void onCancel(Platform platform, int i) {
Logger.i(JSHARE_NAME, "authorize has been canceled");
succeedCallback.invoke(i);
}
});
}
Expand Down Expand Up @@ -286,6 +288,7 @@ public void onError(Platform platform, int action, int errorCode, Throwable thro
@Override
public void onCancel(Platform platform, int i) {
Logger.i(JSHARE_NAME, "remove auth has been canceled");
callback.invoke(i);
}
});
}
Expand Down Expand Up @@ -332,6 +335,7 @@ public void onError(Platform platform, int action, int errorCode, Throwable thro
@Override
public void onCancel(Platform platform, int i) {
Logger.i(JSHARE_NAME, "Get userInfo has been canceled");
successCallback.invoke(i);
}
});
}
Expand Down
19 changes: 8 additions & 11 deletions docs/AndroidConfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@ project(':jcore-react-native').projectDir = new File(rootProject.projectDir, '..
android {
...
defaultConfig {
applicationId "your application id"
...
   applicationId "your application id"   // <-- 包名、应用的签名、第三方平台注册的 AppID 及 Appkey 三者要一一对应,否则会无法分享
   ...
manifestPlaceholders = [
JSHARE_PKGNAME: "your application id",
JPUSH_APPKEY: "your app key", //在此替换你的APPKey
JPUSH_CHANNEL: "developer-default", //应用渠道号, 默认即可
TENCENT_APPID: "your tencent app id"
JPUSH_APPKEY: "your app key", // <-- 在此替换你的APPKey
JPUSH_CHANNEL: "developer-default", // <-- 应用渠道号, 默认即可
]
}
 // 必须添加 sourceSet 这段。因为 JGShareSDK.xml 放在 assets 下,不加上会报错。
 sourceSets {
 sourceSets { // <-- 必须添加 sourceSet 这段。因为 JGShareSDK.xml 放在 assets 下,不加上会报错。
main {
assets.srcDirs = ['assets']
}
Expand Down Expand Up @@ -60,9 +57,9 @@ android {
}
...
dependencies {
compile project(':jshare-react-native')
compile project(':jcore-react-native')
}
     compile project(':jshare-react-native')     // <-- JShare 依赖
     compile project(':jcore-react-native')     // <-- JCore 依赖
  }
}
```

Expand Down
8 changes: 6 additions & 2 deletions docs/JSharePackage.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
> your project/android/app/src…/MainApplication.java
```
import cn.jiguang.share.android.api.JShareInterface; // <-- Import JShareInterface
import cn.jiguang.share.reactnative.JSharePackage; // <-- Import JSharePackage
public class MainApplication extends Application implements ReactApplication {
// 是否关闭 Log,默认不关闭
Expand All @@ -21,7 +25,7 @@ public class MainApplication extends Application implements ReactApplication {
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new JSharePackage(SHUTDOWN_TOAST, SHUTDOWN_LOG)
new JSharePackage(SHUTDOWN_TOAST, SHUTDOWN_LOG) // <-- Add JSharePackage
);
}
};
Expand All @@ -37,7 +41,7 @@ public class MainApplication extends Application implements ReactApplication {
SoLoader.init(this, false);
// 在 Init 之前调用,设置为 true,则会打印 debug 级别日志,否则只会打印 warning 级别以上的日志
// JShareInterface.setDebugMode(true);
JShareInterface.init(this);
JShareInterface.init(this); // <-- Init here
}
}
```
Expand Down
18 changes: 10 additions & 8 deletions ios/RCTJShareModule/RCTJShareModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -405,14 +405,16 @@ - (JSHAREPlatform)getPlatformFromDic:(NSDictionary *)param {
message.mediaType = JSHARELink;
}

[JSHAREService share:message handler:^(JSHAREState state, NSError *error) {
if (error) {
failCallBack(@[@{@"code":@(error.code), @"description": [error description]}]);
return;
}
NSString *stateString = [self stateToString:state];
successCallBack(@[@{@"state": stateString}]);
}];
dispatch_async(dispatch_get_main_queue(), ^{
[JSHAREService share:message handler:^(JSHAREState state, NSError *error) {
if (error) {
failCallBack(@[@{@"code":@(error.code), @"description": [error description]}]);
return;
}
NSString *stateString = [self stateToString:state];
successCallBack(@[@{@"state": stateString}]);
}];
});
}

- (NSUInteger)getPlatformFromString:(NSString *)platformStr {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jshare-react-native",
"version": "1.1.5",
"version": "1.1.6",
"description": "JShare SDK for react native",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit f47f40b

Please sign in to comment.