├── example ├── app.json ├── ios │ ├── res6.gif │ ├── jiguang.mp4 │ ├── wechat@3x.png │ ├── EventEmiter.h │ ├── jshare │ │ ├── main.m │ │ ├── AppDelegate.h │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ └── Info.plist │ ├── jshareTests │ │ ├── Info.plist │ │ └── jshareTests.m │ ├── jshare-tvOSTests │ │ └── Info.plist │ ├── RCTJShareConfig.plist │ ├── jshare-tvOS │ │ └── Info.plist │ ├── EventEmiter.m │ └── jshare.xcodeproj │ │ └── xcshareddata │ │ └── xcschemes │ │ ├── jshare.xcscheme │ │ └── jshare-tvOS.xcscheme ├── android │ ├── .settings │ │ └── org.eclipse.buildship.core.prefs │ ├── app │ │ ├── .settings │ │ │ └── org.eclipse.buildship.core.prefs │ │ ├── assets │ │ │ ├── jiguang_test_img.png │ │ │ └── JGShareSDK.xml │ │ ├── src │ │ │ └── main │ │ │ │ ├── res │ │ │ │ ├── values │ │ │ │ │ ├── colors.xml │ │ │ │ │ ├── strings.xml │ │ │ │ │ ├── jpush_style.xml │ │ │ │ │ └── styles.xml │ │ │ │ ├── drawable-hdpi │ │ │ │ │ ├── stripes.png │ │ │ │ │ ├── top_bg.9.png │ │ │ │ │ ├── border_bg.9.png │ │ │ │ │ ├── bottom_bg.9.png │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── jpush_notification_icon.png │ │ │ │ │ ├── ic_richpush_actionbar_back.png │ │ │ │ │ ├── ic_richpush_actionbar_divider.png │ │ │ │ │ ├── tiledstripes.xml │ │ │ │ │ ├── corners_bg.xml │ │ │ │ │ └── richpush_btn_selector.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── drawable-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── drawable-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── drawable-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ └── layout │ │ │ │ │ ├── jpush_popwin_layout.xml │ │ │ │ │ ├── customer_notitfication_layout.xml │ │ │ │ │ ├── customer_notitfication_layout_one.xml │ │ │ │ │ ├── jpush_webview_layout.xml │ │ │ │ │ ├── main.xml │ │ │ │ │ ├── push_set_dialog.xml │ │ │ │ │ └── set_push_time.xml │ │ │ │ ├── java │ │ │ │ └── cn │ │ │ │ │ └── jiguang │ │ │ │ │ └── share │ │ │ │ │ └── demo │ │ │ │ │ ├── wxapi │ │ │ │ │ └── WXEntryActivity.java │ │ │ │ │ ├── plugin │ │ │ │ │ └── JChatProCallbackActivity.java │ │ │ │ │ ├── MainApplication.java │ │ │ │ │ └── MainActivity.java │ │ │ │ └── AndroidManifest.xml │ │ ├── .classpath │ │ ├── .project │ │ ├── BUCK │ │ ├── proguard-rules.pro │ │ └── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── keystores │ │ ├── debug.keystore.properties │ │ └── BUCK │ ├── settings.gradle │ ├── .project │ ├── local.properties │ ├── build.gradle │ ├── gradlew.bat │ └── gradlew ├── index.ios.js ├── index.android.js ├── package.json ├── .gitignore ├── react-native-android │ └── main_activity.js └── react-native-ios │ └── main_activity.js ├── android ├── libs │ ├── jshare-android-2.0.0.jar │ ├── jshare-qq-android-2.0.0.jar │ ├── jshare-sina-android-2.0.0.jar │ ├── jshare-facebook-android-2.0.0.jar │ ├── jshare-jchatpro-android-2.0.0.jar │ ├── jshare-twitter-android-2.0.0.jar │ └── jshare-wechat-android-2.0.0.jar ├── src │ └── main │ │ ├── res │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ └── values │ │ │ └── strings.xml │ │ ├── java │ │ └── cn │ │ │ └── jiguang │ │ │ └── share │ │ │ └── reactnative │ │ │ ├── Logger.java │ │ │ └── JSharePackage.java │ │ └── AndroidManifest.xml ├── build.gradle ├── gradlew.bat └── gradlew ├── ios ├── RCTJShareModule │ ├── libjshare-ios-1.9.2.a │ ├── RCTJShareModule.h │ └── JSHAREService.h └── RCTJShareModule.xcodeproj │ └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── docs ├── WXEntryActivity.md ├── JChatProCallbackActivity.md ├── JGShareSDK.md ├── JSharePackage.md ├── AndroidConfig.md ├── AndroidManifest.md ├── iOSConfig.md └── API.md ├── .npmignore ├── RCTJShareConfig.plist ├── JShareRN.podspec ├── LICENSE ├── package.json ├── README.md ├── .gitignore └── index.js /example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "JShareDemo", 3 | "displayName": "JShareDemo" 4 | } -------------------------------------------------------------------------------- /example/ios/res6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/example/ios/res6.gif -------------------------------------------------------------------------------- /example/ios/jiguang.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/example/ios/jiguang.mp4 -------------------------------------------------------------------------------- /example/ios/wechat@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/example/ios/wechat@3x.png -------------------------------------------------------------------------------- /example/android/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | connection.project.dir= 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /example/android/app/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | connection.project.dir=.. 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /android/libs/jshare-android-2.0.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/android/libs/jshare-android-2.0.0.jar -------------------------------------------------------------------------------- /android/libs/jshare-qq-android-2.0.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/android/libs/jshare-qq-android-2.0.0.jar -------------------------------------------------------------------------------- /ios/RCTJShareModule/libjshare-ios-1.9.2.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/ios/RCTJShareModule/libjshare-ios-1.9.2.a -------------------------------------------------------------------------------- /android/libs/jshare-sina-android-2.0.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/android/libs/jshare-sina-android-2.0.0.jar -------------------------------------------------------------------------------- /android/libs/jshare-facebook-android-2.0.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/android/libs/jshare-facebook-android-2.0.0.jar -------------------------------------------------------------------------------- /android/libs/jshare-jchatpro-android-2.0.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/android/libs/jshare-jchatpro-android-2.0.0.jar -------------------------------------------------------------------------------- /android/libs/jshare-twitter-android-2.0.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/android/libs/jshare-twitter-android-2.0.0.jar -------------------------------------------------------------------------------- /android/libs/jshare-wechat-android-2.0.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/android/libs/jshare-wechat-android-2.0.0.jar -------------------------------------------------------------------------------- /android/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/android/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/android/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/assets/jiguang_test_img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/example/android/app/assets/jiguang_test_img.png -------------------------------------------------------------------------------- /android/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/android/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/android/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ffffff 4 | -------------------------------------------------------------------------------- /example/android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-hdpi/stripes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/example/android/app/src/main/res/drawable-hdpi/stripes.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-hdpi/top_bg.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/example/android/app/src/main/res/drawable-hdpi/top_bg.9.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-hdpi/border_bg.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/example/android/app/src/main/res/drawable-hdpi/border_bg.9.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-hdpi/bottom_bg.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/example/android/app/src/main/res/drawable-hdpi/bottom_bg.9.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/example/android/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/example/android/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/example/android/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/example/android/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-hdpi/jpush_notification_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/example/android/app/src/main/res/drawable-hdpi/jpush_notification_icon.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-hdpi/ic_richpush_actionbar_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/example/android/app/src/main/res/drawable-hdpi/ic_richpush_actionbar_back.png -------------------------------------------------------------------------------- /example/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-hdpi/ic_richpush_actionbar_divider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jshare-react-native/HEAD/example/android/app/src/main/res/drawable-hdpi/ic_richpush_actionbar_divider.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-hdpi/tiledstripes.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /ios/RCTJShareModule.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/cn/jiguang/share/demo/wxapi/WXEntryActivity.java: -------------------------------------------------------------------------------- 1 | package cn.jiguang.share.demo.wxapi; 2 | 3 | 4 | import cn.jiguang.share.wechat.WeChatHandleActivity; 5 | 6 | 7 | public class WXEntryActivity extends WeChatHandleActivity { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/cn/jiguang/share/demo/plugin/JChatProCallbackActivity.java: -------------------------------------------------------------------------------- 1 | package cn.jiguang.share.demo.plugin; 2 | 3 | import cn.jiguang.share.jchatpro.JChatProHandleActivity; 4 | 5 | 6 | public class JChatProCallbackActivity extends JChatProHandleActivity { 7 | } 8 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Jan 04 15:21:09 CST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 7 | -------------------------------------------------------------------------------- /ios/RCTJShareModule.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'JShareDemo' 2 | include ':app', ':jshare-react-native', ':jcore-react-native' 3 | project(':jshare-react-native').projectDir = new File(rootProject.projectDir, '../../android') 4 | project(':jcore-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/jcore-react-native/android') 5 | -------------------------------------------------------------------------------- /docs/WXEntryActivity.md: -------------------------------------------------------------------------------- 1 | # Add WXEntryActivity 2 | 3 | >your project/android/app/src…/wxapi 4 | 5 | Create `WXEntryActivity.java` in your `wxapi` package: 6 | 7 | ``` 8 | package yourPackageName.wxapi; 9 | 10 | 11 | import cn.jiguang.share.wechat.WeChatHandleActivity; 12 | 13 | 14 | public class WXEntryActivity extends WeChatHandleActivity { 15 | 16 | } 17 | 18 | ``` 19 | 20 | -------------------------------------------------------------------------------- /example/android/app/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/JChatProCallbackActivity.md: -------------------------------------------------------------------------------- 1 | # Add JChatProCallbackActivity 2 | 3 | >your project/android/app/src…/plugin 4 | 5 | Create `JChatProCallbackActivity.java` in your `plugin` package: 6 | 7 | ``` 8 | package yourPackageName.plugin; 9 | 10 | import cn.jiguang.share.jchatpro.JChatProHandleActivity; 11 | 12 | 13 | public class JChatProCallbackActivity extends JChatProHandleActivity { 14 | } 15 | 16 | 17 | ``` 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-hdpi/corners_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /example/index.ios.js: -------------------------------------------------------------------------------- 1 | `use strict`; 2 | 3 | import React from 'react'; 4 | import { 5 | AppRegistry, 6 | } from 'react-native'; 7 | import { 8 | StackNavigator 9 | } from 'react-navigation'; 10 | import MainActivity from './react-native-ios/main_activity.js'; 11 | 12 | 13 | const jshare = StackNavigator({ 14 | Home: { 15 | screen: MainActivity 16 | }, 17 | }); 18 | 19 | AppRegistry.registerComponent('jshare', () => jshare); -------------------------------------------------------------------------------- /example/index.android.js: -------------------------------------------------------------------------------- 1 | `use strict`; 2 | 3 | import React from 'react'; 4 | import { 5 | AppRegistry, 6 | } from 'react-native'; 7 | import { 8 | StackNavigator 9 | } from 'react-navigation'; 10 | import MainActivity from './react-native-android/main_activity.js'; 11 | 12 | 13 | const JShareDemo = StackNavigator({ 14 | Home: { 15 | screen: MainActivity 16 | }, 17 | }); 18 | 19 | AppRegistry.registerComponent('JShareDemoApp', () => JShareDemo); -------------------------------------------------------------------------------- /example/android/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | JShareDemo 4 | Project JShareDemo created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.buildship.core.gradleprojectbuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.buildship.core.gradleprojectnature 16 | 17 | 18 | -------------------------------------------------------------------------------- /example/android/local.properties: -------------------------------------------------------------------------------- 1 | ## This file is automatically generated by Android Studio. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must *NOT* be checked into Version Control Systems, 5 | # as it contains information specific to your local configuration. 6 | # 7 | # Location of the SDK. This is only used by Gradle. 8 | # For customization when using a Version Control System, please read the 9 | # header note. 10 | #Thu May 31 16:17:54 CST 2018 11 | sdk.dir=/Users/josh/Library/Android/sdk 12 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | SX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | android/build/ 9 | *.pbxuser 10 | !default.pbxuser 11 | *.mode1v3 12 | !default.mode1v3 13 | *.mode2v3 14 | !default.mode2v3 15 | *.perspectivev3 16 | !default.perspectivev3 17 | xcuserdata 18 | *.xccheckout 19 | *.moved-aside 20 | DerivedData 21 | *.hmap 22 | *.ipa 23 | *.xcuserstate 24 | 25 | # node.js 26 | # 27 | node_modules/ 28 | npm-debug.log 29 | 30 | # Don't publish example apps 31 | example/ 32 | # .idea 33 | RCTJShareConfig.plist 34 | .idea/ 35 | .gradle/ 36 | 37 | -------------------------------------------------------------------------------- /example/ios/EventEmiter.h: -------------------------------------------------------------------------------- 1 | // 2 | // EventEmiter.h 3 | // jshare 4 | // 5 | // Created by oshumini on 2017/7/28. 6 | // Copyright © 2017年 Facebook. All rights reserved. 7 | // 8 | 9 | #import 10 | #if __has_include() 11 | #import 12 | #elif __has_include("RCTBridgeModule.h") 13 | #import "RCTBridgeModule.h" 14 | #elif __has_include("React/RCTBridgeModule.h") 15 | #import "React/RCTBridgeModule.h" 16 | #endif 17 | 18 | @interface EventEmiter : NSObject 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/layout/jpush_popwin_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | -------------------------------------------------------------------------------- /example/ios/jshare/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ios/RCTJShareModule/RCTJShareModule.h: -------------------------------------------------------------------------------- 1 | // 2 | // RCTJShareModule.h 3 | // jshare 4 | // 5 | // Created by oshumini on 2017/7/18. 6 | // Copyright © 2017年 Facebook. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #if __has_include() 12 | #import 13 | #elif __has_include("RCTBridgeModule.h") 14 | #import "RCTBridgeModule.h" 15 | #elif __has_include("React/RCTBridgeModule.h") 16 | #import "React/RCTBridgeModule.h" 17 | #endif 18 | 19 | #import "JSHAREService.h" 20 | 21 | @interface RCTJShareModule : NSObject 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /example/ios/jshare/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | 14 | #import 15 | #import 16 | 17 | @interface AppDelegate : UIResponder 18 | 19 | @property (nonatomic, strong) UIWindow *window; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /example/android/app/assets/JGShareSDK.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 11 | 12 | 15 | 16 | 19 | 20 | 24 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "JShareDemo", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node node_modules/react-native/local-cli/cli.js start" 7 | }, 8 | "dependencies": { 9 | "jcore-react-native": "^1.3.0", 10 | "jshare-react-native": "^1.3.2", 11 | "react": "^16.2.0", 12 | "react-native": "^0.52.0", 13 | "react-navigation": "^1.0.0-beta.11" 14 | }, 15 | "devDependencies": { 16 | "babel-jest": "20.0.3", 17 | "babel-preset-react-native": "1.9.2", 18 | "jest": "20.0.4", 19 | "react-test-renderer": "16.0.0-alpha.6" 20 | }, 21 | "jest": { 22 | "preset": "react-native" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /example/android/app/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | app 4 | Project app created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.buildship.core.gradleprojectbuilder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.buildship.core.gradleprojectnature 22 | 23 | 24 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | JShareDemo 3 | Tag为大小写字母,数字,下划线,中文, 多个用以逗号分隔 4 | Alias为大小写字母,数字,下划线 5 | style为数字 6 | style不能为空 7 | alias不能为空 8 | tag不能为空 9 | 格式不对 10 | 网络连接异常,初始化失败 请检查网络! 11 | 程序在后台执行, 请查看日志! 12 | 设置成功 13 | 14 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.0.1' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | mavenLocal() 18 | jcenter() 19 | maven { 20 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 21 | url "$rootDir/../node_modules/react-native/android" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/jpush_style.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 13 | 17 | 21 | 22 | -------------------------------------------------------------------------------- /android/src/main/java/cn/jiguang/share/reactnative/Logger.java: -------------------------------------------------------------------------------- 1 | package cn.jiguang.share.reactnative; 2 | 3 | import android.content.Context; 4 | import android.util.Log; 5 | import android.widget.Toast; 6 | 7 | public class Logger { 8 | 9 | public static boolean SHUTDOWNLOG; 10 | public static boolean SHUTDOWNTOAST; 11 | 12 | public static void i(String tag, String msg) { 13 | if (!SHUTDOWNLOG) { 14 | Log.i(tag, msg); 15 | } 16 | } 17 | 18 | public static void d(String tag, String msg) { 19 | if (!SHUTDOWNLOG) { 20 | Log.d(tag, msg); 21 | } 22 | } 23 | 24 | public static void toast(Context context, String msg) { 25 | if (!SHUTDOWNTOAST) { 26 | Toast.makeText(context, msg, Toast.LENGTH_SHORT).show(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /example/ios/jshareTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /example/ios/jshare-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-hdpi/richpush_btn_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 14 | 15 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /RCTJShareConfig.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | appKey 6 | 7 | channel 8 | 9 | advertisingId 10 | 11 | isProduction 12 | 13 | wechatAppId 14 | 15 | wechatAppSecret 16 | 17 | qqAppId 18 | 19 | qqAppKey 20 | 21 | sinaWeiboAppKey 22 | 23 | sinaWeiboAppSecret 24 | 25 | sinaRedirectUri 26 | 27 | facebookAppId 28 | 29 | facebookDisplayName 30 | 31 | isSupportWebSina 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | def safeExtGet(prop, fallback) { 4 | rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback 5 | } 6 | 7 | android { 8 | compileSdkVersion safeExtGet('compileSdkVersion', 27) 9 | buildToolsVersion safeExtGet('buildToolsVersion', '26.0.2') 10 | 11 | defaultConfig { 12 | minSdkVersion safeExtGet('minSdkVersion', 16) 13 | targetSdkVersion safeExtGet('targetSdkVersion', 27) 14 | versionCode 1 15 | versionName "1.0" 16 | } 17 | lintOptions { 18 | abortOnError false 19 | warning 'InvalidPackage' 20 | } 21 | sourceSets.main { 22 | jniLibs.srcDirs = ['libs'] 23 | assets.srcDirs = ['assets'] 24 | } 25 | } 26 | 27 | repositories { 28 | mavenCentral() 29 | } 30 | 31 | dependencies { 32 | api fileTree(include: ['*.jar'], dir: 'libs') 33 | implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}" 34 | } 35 | -------------------------------------------------------------------------------- /JShareRN.podspec: -------------------------------------------------------------------------------- 1 | require 'json' 2 | pjson = JSON.parse(File.read('package.json')) 3 | 4 | Pod::Spec.new do |s| 5 | 6 | s.name = "JShareRN" 7 | s.version = pjson["version"] 8 | s.homepage = "https://github.com/jpush/jshare-react-native" 9 | s.summary = pjson["description"] 10 | s.license = pjson["license"] 11 | s.author = { "huminios" => "380108184@qq.com" } 12 | 13 | s.ios.deployment_target = '7.0' 14 | 15 | s.source = { :git => "https://github.com/jpush/jshare-react-native.git", :tag => "#{s.version}" } 16 | s.source_files = 'ios/RCTJShareModule/*.{h,m}' 17 | s.preserve_paths = "*.js" 18 | s.frameworks = 'UIKit','CFNetwork','CoreFoundation','CoreTelephony','SystemConfiguration','CoreGraphics','Foundation','Security','CoreLocation','AssetsLibrary' 19 | s.weak_frameworks = 'UserNotifications' 20 | s.libraries = 'z','resolv' 21 | s.vendored_libraries = "ios/RCTJShareModule/*.a" 22 | 23 | s.dependency 'React' 24 | end -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | 44 | # fastlane 45 | # 46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 47 | # screenshots whenever they are needed. 48 | # For more information about the recommended setup visit: 49 | # https://docs.fastlane.tools/best-practices/source-control/ 50 | 51 | */fastlane/report.xml 52 | */fastlane/Preview.html 53 | */fastlane/screenshots 54 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 极光开发者 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /example/ios/jshare/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "size" : "1024x1024", 46 | "scale" : "1x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /example/ios/RCTJShareConfig.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | appKey 6 | a1703c14b186a68a66ef86c1 7 | channel 8 | 9 | advertisingId 10 | 11 | isProduction 12 | 13 | wechatAppId 14 | wxc40e16f3ba6ebabc 15 | wechatAppSecret 16 | dcad950cd0633a27e353477c4ec12e7a 17 | qqAppId 18 | 1105864531 19 | qqAppKey 20 | glFYjkHQGSOCJHMC 21 | sinaWeiboAppKey 22 | 374535501 23 | sinaWeiboAppSecret 24 | baccd12c166f1df96736b51ffbf600a2 25 | sinaRedirectUri 26 | https://www.jiguang.cn 27 | facebookAppId 28 | 177776412817787 29 | facebookDisplayName 30 | HuminiOS 31 | isSupportWebSina 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /docs/JGShareSDK.md: -------------------------------------------------------------------------------- 1 | ## 配置 JGShareSDK.xml 2 | 3 | 无论是使用自动集成还是手动集成方式,都需要配置 JGShareSDK.xml。 主要步骤为: 4 | 5 | 复制或者新建 JGShareSDK.xml 到工程目录的 asset 目录下(注意不是android/app/src/main/assets,应该放到android/app/assets中)。 6 | 7 | 把 JGShareSDK.xml 中相关的 AppKey、AppSecret 替换成自己在第三方平台创建的应用得到的信息。 8 | 根据需要配置各个平台,不需要的平台可以删除。 9 | 10 | JGShareSDK.xml示例 11 | ``` 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | 25 | 26 | 29 | 30 | 34 | 35 | 39 | 40 | 41 | 44 | 45 | 46 | ``` 47 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jshare-react-native", 3 | "version": "1.4.3", 4 | "description": "JShare SDK for react native application", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "peerDependencies": { 10 | "jcore-react-native": ">= 1.3.0" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/jpush/jshare-react-native.git" 15 | }, 16 | "keywords": [ 17 | "JShare", 18 | "React", 19 | "Native" 20 | ], 21 | "author": "KenChoi,HuminiOS", 22 | "license": "MIT", 23 | "bugs": { 24 | "url": "https://github.com/jpush/jshare-react-native/issues" 25 | }, 26 | "homepage": "https://github.com/jpush/jshare-react-native#readme", 27 | "rnpm": { 28 | "ios": { 29 | "sharedLibraries": [ 30 | "libz", 31 | "CoreTelephony", 32 | "Security", 33 | "CFNetwork", 34 | "CoreFoundation", 35 | "SystemConfiguration", 36 | "Foundation", 37 | "UIKit", 38 | "libresolv", 39 | "CoreGraphics", 40 | "CoreLocation" 41 | ] 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /example/android/app/src/main/res/layout/customer_notitfication_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 10 | 15 | 21 | 22 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/layout/customer_notitfication_layout_one.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 10 | 15 | 21 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /android/src/main/java/cn/jiguang/share/reactnative/JSharePackage.java: -------------------------------------------------------------------------------- 1 | package cn.jiguang.share.reactnative; 2 | 3 | import com.facebook.react.ReactPackage; 4 | import com.facebook.react.bridge.JavaScriptModule; 5 | import com.facebook.react.bridge.NativeModule; 6 | import com.facebook.react.bridge.ReactApplicationContext; 7 | import com.facebook.react.uimanager.ViewManager; 8 | 9 | import java.util.Arrays; 10 | import java.util.Collections; 11 | import java.util.List; 12 | 13 | public class JSharePackage implements ReactPackage { 14 | 15 | public JSharePackage(boolean toastFlag, boolean logFlag) { 16 | Logger.SHUTDOWNTOAST = toastFlag; 17 | Logger.SHUTDOWNLOG = logFlag; 18 | } 19 | 20 | @Override 21 | public List createNativeModules(ReactApplicationContext reactContext) { 22 | return Arrays.asList(new NativeModule[]{ 23 | new JShareModule(reactContext) 24 | }); 25 | } 26 | 27 | public List> createJSModules() { 28 | return Collections.emptyList(); 29 | } 30 | 31 | @Override 32 | public List createViewManagers(ReactApplicationContext reactContext) { 33 | return Collections.emptyList(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # jshare-react-native 2 | 3 | ## Install 4 | 5 | ``` 6 | npm install jshare-react-native --save 7 | npm install jcore-react-native --save 8 | react-native link 9 | ``` 10 | 11 | ##### Add with CocoaPods(if you integrated react-native to native iOS project) 12 | 13 | Add the JShareRN pod to your list of application pods in your Podfile, using the path from the Podfile to the installed module: 14 | 15 | ``` 16 | pod 'JShareRN', :path => '../node_modules/jshare-react-native' 17 | pod 'JCoreRN', :path => '../node_modules/jcore-react-native' 18 | ``` 19 | 20 | Install pods as usual:: 21 | 22 | ``` 23 | pod install 24 | ``` 25 | 26 | ## Manually Configure Part 27 | 28 | ### Android 29 | 30 | - [Checkout configuration](./docs/AndroidConfig.md) 31 | - [Add JSharePackage, Don't forget the parameters !](./docs/JSharePackage.md) 32 | - [Checkout AndroidManifest](./docs/AndroidManifest.md) 33 | - [Add JGShareSDK.xml](./docs/JGShareSDK.md) 34 | - [Add WXEntryActivity](./docs/WXEntryActivity.md) 35 | - [Add JChatProCallbackActivity](./docs/JChatProCallbackActivity.md) 36 | 37 | That's it. 38 | 39 | ### iOS 40 | 41 | - [configure iOS](./docs/iOSConfig.md) 42 | 43 | ## Usage 44 | 45 | - Import JShareModule: 46 | 47 | > your component.js 48 | 49 | ```javascript 50 | ... 51 | import JShareModule from 'jshare-react-native'; 52 | JShareModule.setup(param) // iOS 调用该方法才能正常使用, param 参考 API 文档 53 | ``` 54 | 55 | 56 | 57 | - Use JShareModule call APIs, [API Document](./docs/API.md) 58 | 59 | -------------------------------------------------------------------------------- /docs/JSharePackage.md: -------------------------------------------------------------------------------- 1 | # Add JSharePackage 2 | 3 | > your project/android/app/src…/MainApplication.java 4 | 5 | ``` 6 | 7 | import cn.jiguang.share.android.api.JShareInterface; // <-- Import JShareInterface 8 | import cn.jiguang.share.reactnative.JSharePackage; // <-- Import JSharePackage 9 | 10 | public class MainApplication extends Application implements ReactApplication { 11 | 12 | // 是否关闭 Log,默认不关闭 13 | private static boolean SHUTDOWN_LOG = false; 14 | // 是否关闭 toast,默认不关闭 15 | private static boolean SHUTDOWN_TOAST = false; 16 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 17 | 18 | @Override 19 | public boolean getUseDeveloperSupport() { 20 | return BuildConfig.DEBUG; 21 | } 22 | 23 | 24 | @Override 25 | protected List getPackages() { 26 | return Arrays.asList( 27 | new MainReactPackage(), 28 | new JSharePackage(SHUTDOWN_TOAST, SHUTDOWN_LOG) // <-- Add JSharePackage 29 | ); 30 | } 31 | }; 32 | 33 | @Override 34 | public ReactNativeHost getReactNativeHost() { 35 | return mReactNativeHost; 36 | } 37 | 38 | @Override 39 | public void onCreate() { 40 | super.onCreate(); 41 | SoLoader.init(this, false); 42 | // 在 Init 之前调用,设置为 true,则会打印 debug 级别日志,否则只会打印 warning 级别以上的日志 43 | // JShareInterface.setDebugMode(true); 44 | JShareInterface.init(this); // <-- Init here 45 | } 46 | } 47 | ``` 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/cn/jiguang/share/demo/MainApplication.java: -------------------------------------------------------------------------------- 1 | package cn.jiguang.share.demo; 2 | 3 | import android.app.Application; 4 | 5 | import com.facebook.react.ReactApplication; 6 | import com.facebook.react.ReactNativeHost; 7 | import com.facebook.react.ReactPackage; 8 | import com.facebook.react.shell.MainReactPackage; 9 | import com.facebook.soloader.SoLoader; 10 | 11 | import java.util.Arrays; 12 | import java.util.List; 13 | 14 | import cn.jiguang.share.android.api.JShareInterface; 15 | import cn.jiguang.share.reactnative.JSharePackage; 16 | 17 | 18 | public class MainApplication extends Application implements ReactApplication { 19 | 20 | // 是否关闭 Log,默认不关闭 21 | private static boolean SHUTDOWN_LOG = false; 22 | // 是否关闭 toast,默认不关闭 23 | private static boolean SHUTDOWN_TOAST = false; 24 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 25 | 26 | @Override 27 | public boolean getUseDeveloperSupport() { 28 | return BuildConfig.DEBUG; 29 | } 30 | 31 | 32 | @Override 33 | protected List getPackages() { 34 | return Arrays.asList( 35 | new MainReactPackage(), 36 | new JSharePackage(SHUTDOWN_TOAST, SHUTDOWN_LOG) 37 | ); 38 | } 39 | }; 40 | 41 | @Override 42 | public ReactNativeHost getReactNativeHost() { 43 | return mReactNativeHost; 44 | } 45 | 46 | @Override 47 | public void onCreate() { 48 | super.onCreate(); 49 | SoLoader.init(this, false); 50 | // 在 Init 之前调用,设置为 true,则会打印 debug 级别日志,否则只会打印 warning 级别以上的日志 51 | JShareInterface.setDebugMode(true); 52 | JShareInterface.init(this); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /example/ios/jshare-tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSExceptionDomains 45 | 46 | localhost 47 | 48 | NSExceptionAllowsInsecureHTTPLoads 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /example/android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | lib_deps = [] 12 | 13 | for jarfile in glob(['libs/*.jar']): 14 | name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')] 15 | lib_deps.append(':' + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | 21 | for aarfile in glob(['libs/*.aar']): 22 | name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')] 23 | lib_deps.append(':' + name) 24 | android_prebuilt_aar( 25 | name = name, 26 | aar = aarfile, 27 | ) 28 | 29 | android_library( 30 | name = "all-libs", 31 | exported_deps = lib_deps, 32 | ) 33 | 34 | android_library( 35 | name = "app-code", 36 | srcs = glob([ 37 | "src/main/java/**/*.java", 38 | ]), 39 | deps = [ 40 | ":all-libs", 41 | ":build_config", 42 | ":res", 43 | ], 44 | ) 45 | 46 | android_build_config( 47 | name = "build_config", 48 | package = "com.jsharedemo", 49 | ) 50 | 51 | android_resource( 52 | name = "res", 53 | package = "com.jsharedemo", 54 | res = "src/main/res", 55 | ) 56 | 57 | android_binary( 58 | name = "app", 59 | keystore = "//android/keystores:debug", 60 | manifest = "src/main/AndroidManifest.xml", 61 | package_type = "debug", 62 | deps = [ 63 | ":app-code", 64 | ], 65 | ) 66 | -------------------------------------------------------------------------------- /example/ios/EventEmiter.m: -------------------------------------------------------------------------------- 1 | // 2 | // EventEmiter.m 3 | // jshare 4 | // 5 | // Created by oshumini on 2017/7/28. 6 | // Copyright © 2017年 Facebook. All rights reserved. 7 | // 8 | 9 | #import "EventEmiter.h" 10 | #import 11 | #import 12 | 13 | #if __has_include() 14 | #import 15 | #import 16 | #import 17 | #elif __has_include("RCTBridge.h") 18 | #import "RCTEventDispatcher.h" 19 | #import "RCTRootView.h" 20 | #import "RCTBridge.h" 21 | #elif __has_include("React/RCTBridge.h") 22 | #import "React/RCTEventDispatcher.h" 23 | #import "React/RCTRootView.h" 24 | #import "React/RCTBridge.h" 25 | #endif 26 | 27 | @implementation EventEmiter 28 | 29 | RCT_EXPORT_MODULE(); 30 | 31 | @synthesize bridge = _bridge; 32 | 33 | + (id)allocWithZone:(NSZone *)zone { 34 | static EventEmiter *emiter = nil; 35 | static dispatch_once_t onceToken; 36 | dispatch_once(&onceToken, ^{ 37 | emiter = [super allocWithZone:zone]; 38 | }); 39 | return emiter; 40 | } 41 | 42 | - (id)init { 43 | self = [super init]; 44 | NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"wechat@3x" ofType:@"png"]; 45 | NSString *videoPath = [[NSBundle mainBundle] pathForResource:@"jiguang" ofType:@"mp4"]; 46 | 47 | NSString *emotionPath = [[NSBundle mainBundle] pathForResource:@"res6" ofType:@"gif"]; 48 | 49 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 50 | [self.bridge.eventDispatcher sendAppEventWithName:@"finishGetResource" body:@{@"imagePath": imagePath, 51 | @"videoPath": videoPath, 52 | @"emotionPath": emotionPath}]; 53 | NSLog(@"++++++++++++++++++"); 54 | }); 55 | return self; 56 | 57 | 58 | } 59 | @end 60 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/layout/jpush_webview_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 20 | 21 | 29 | 30 | 40 | 41 | 42 | 47 | 48 | -------------------------------------------------------------------------------- /docs/AndroidConfig.md: -------------------------------------------------------------------------------- 1 | # Android Configure Part 2 | 3 | ## Checkout settings.gradle 4 | 5 | > your project/android/settings.gradle 6 | 7 | ``` 8 | include ':app', ':jshare-react-native', ':jcore-react-native' 9 | project(':jshare-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/jshare-react-native/android') 10 | project(':jcore-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/jcore-react-native/android') 11 | ``` 12 | 13 | ## Checkout module's build.gradle, add configuration 14 | 15 | > your project/android/app/build.gradle 16 | 17 | ``` 18 | android { 19 | ... 20 | defaultConfig { 21 |    applicationId "your application id"   // <-- 包名、应用的签名、第三方平台注册的 AppID 及 Appkey 三者要一一对应,否则会无法分享 22 |    ... 23 | manifestPlaceholders = [ 24 | JPUSH_APPKEY: "your app key", // <-- 在此替换你的APPKey 25 | JPUSH_CHANNEL: "developer-default", // <-- 应用渠道号, 默认即可 26 | ] 27 | } 28 |  sourceSets { // <-- 必须添加 sourceSet 这段。因为 JGShareSDK.xml 放在 assets 下,不加上会报错。 29 | main { 30 | assets.srcDirs = ['assets'] 31 | } 32 | } 33 | ... 34 | signingConfigs { 35 | debug { 36 | storeFile file("jshare.jks") //签名文件路径 37 | storePassword "sdkteam" 38 | keyAlias "jshare" 39 | keyPassword "sdkteam" //签名密码 40 | } 41 | release { 42 | storeFile file("jshare.jks") //签名文件路径 43 | storePassword "sdkteam" 44 | keyAlias "jshare" 45 | keyPassword "sdkteam" //签名密码 46 | } 47 | } 48 | buildTypes { 49 | release { 50 | minifyEnabled enableProguardInReleaseBuilds 51 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 52 | signingConfig signingConfigs.debug 53 | } 54 | debug { 55 | signingConfig signingConfigs.debug 56 | } 57 | } 58 | ... 59 | dependencies { 60 |     implementation project(':jshare-react-native')     // <-- JShare 依赖 61 |     implementation project(':jcore-react-native')     // <-- JCore 依赖 62 |   } 63 | } 64 | ``` 65 | 66 | ​ 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /example/ios/jshareTests/jshareTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | #import 14 | #import 15 | 16 | #define TIMEOUT_SECONDS 600 17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 18 | 19 | @interface jshareTests : XCTestCase 20 | 21 | @end 22 | 23 | @implementation jshareTests 24 | 25 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 26 | { 27 | if (test(view)) { 28 | return YES; 29 | } 30 | for (UIView *subview in [view subviews]) { 31 | if ([self findSubviewInView:subview matching:test]) { 32 | return YES; 33 | } 34 | } 35 | return NO; 36 | } 37 | 38 | - (void)testRendersWelcomeScreen 39 | { 40 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 41 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 42 | BOOL foundElement = NO; 43 | 44 | __block NSString *redboxError = nil; 45 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 46 | if (level >= RCTLogLevelError) { 47 | redboxError = message; 48 | } 49 | }); 50 | 51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 54 | 55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 57 | return YES; 58 | } 59 | return NO; 60 | }]; 61 | } 62 | 63 | RCTSetLogFunction(RCTDefaultLogFunction); 64 | 65 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 66 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 67 | } 68 | 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /android/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 缺失 appid 参数 4 | 缺失 appkey 参数 5 | 缺失 secret 参数 6 | 缺失 mediaType 参数 7 | 不合法的 mediaType 8 | 缺失 platform 参数 9 | 不合法的 platform 10 | 没安装客户端 11 | 未完成初始化 12 | 缺少 ShareParams 13 | platform 没配置 14 | 文本参数长度超过限制 15 | 图片链接字段长度超过限制 16 | 图片大小超过限制 17 | url 长度超过限制 18 | 音频 url 长度超过限制 19 | 视频 url 长度超过限制 20 | 文件大小超过限制 21 | emotion 大小超过限制 22 | title 参数超过限制 23 | description 参数超过限制 24 | 缩略图参数超过限制 25 | 图片参数为空 26 | 音频 url 参数为空 27 | 视频 url 参数为空 28 | emotion 参数为空 29 | 文件参数为空 30 | url 参数为空 31 | 文本参数为空 32 | title 为空 33 | 非法 url 34 | 文件不存在 35 | 文本和 url 长度超过限制 36 | 不能同时分享图片和视频 37 | 不合法的调用凭证 38 | 获取 access token 错误 39 | 分享失败 40 | 获取用户信息失败 41 | 授权失败 42 | 平台不支持授权 43 | 无效或过期的 token 44 | 无法验证你的凭证 45 | 发生未知的内部错误 46 | 该状态的内容已经过验证的账户发布 47 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/cn/jiguang/share/demo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package cn.jiguang.share.demo; 2 | 3 | import android.os.Bundle; 4 | import android.util.Log; 5 | 6 | import com.facebook.react.*; 7 | import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; 8 | 9 | import java.lang.Override; 10 | 11 | 12 | public class MainActivity extends ReactActivity implements DefaultHardwareBackBtnHandler { 13 | 14 | /** 15 | * rn 0.29.0 以下版本,请使用此方法,并去掉 MainApplication 文件, 0.29.0 以上版本请去掉这些注释代码 16 | * 注意改变其中的 JSMainModuleName 的路径(因为此版本适配了 rn 0.30.0, index.android.js 放在了项目目录下) 17 | * 相应地,index.android.js 中 push_activity.js,set_activity.js的引用路径也要改变(参考 index.android.js) 18 | */ 19 | // private ReactRootView mReactRootView; 20 | // private ReactInstanceManager mReactInstanceManager; 21 | // private boolean SHUTDOWN_TOAST = false; 22 | // private boolean SHUTDOWN_LOG = false; 23 | 24 | // @Override 25 | // protected void onCreate(Bundle savedInstanceState) { 26 | // super.onCreate(savedInstanceState); 27 | // mReactRootView = new ReactRootView(this); 28 | // mReactInstanceManager = ReactInstanceManager.builder() 29 | // .setApplication(getApplication()) 30 | // .setBundleAssetName("index.android.bundle") 31 | // .setJSMainModuleName("react-native-android/index.android") 32 | // .addPackage(new MainReactPackage()) 33 | // .addPackage(new JSharePackage(SHUTDOWN_TOAST, SHUTDOWN_LOG)) 34 | // .setUseDeveloperSupport(BuildConfig.DEBUG) 35 | // .setInitialLifecycleState(LifecycleState.RESUMED) 36 | // .build(); 37 | // mReactRootView.startReactApplication(mReactInstanceManager, "PushDemoApp", null); 38 | // 39 | // setContentView(mReactRootView); 40 | // } 41 | @Override 42 | protected void onCreate(Bundle savedInstanceState) { 43 | super.onCreate(savedInstanceState); 44 | Log.i("MainActivity", "onCreate executed!"); 45 | } 46 | 47 | @Override 48 | protected String getMainComponentName() { 49 | return "JShareDemoApp"; 50 | } 51 | 52 | @Override 53 | protected void onPause() { 54 | super.onPause(); 55 | } 56 | 57 | @Override 58 | protected void onResume() { 59 | super.onResume(); 60 | } 61 | 62 | @Override 63 | protected void onDestroy() { 64 | super.onDestroy(); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /example/ios/jshare/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "AppDelegate.h" 11 | #import 12 | #import 13 | #import 14 | 15 | 16 | @implementation AppDelegate 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 19 | { 20 | NSURL *jsCodeLocation; 21 | 22 | 23 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; 24 | 25 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 26 | moduleName:@"jshare" 27 | initialProperties:nil 28 | launchOptions:launchOptions]; 29 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 30 | 31 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 32 | UIViewController *rootViewController = [UIViewController new]; 33 | rootViewController.view = rootView; 34 | self.window.rootViewController = rootViewController; 35 | [self.window makeKeyAndVisible]; 36 | return YES; 37 | } 38 | 39 | -(NSString *)getFilePath:(NSString *)fileName{ 40 | NSArray *paths = NSSearchPathForDirectoriesInDomains 41 | (NSDocumentDirectory, NSUserDomainMask, YES); 42 | NSString *documentsDirectory = [paths objectAtIndex:0]; 43 | NSString *filePath = [NSString stringWithFormat:@"%@/%@", 44 | documentsDirectory,fileName]; 45 | return filePath; 46 | } 47 | 48 | // work in iOS(8.0) 49 | - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { 50 | [JSHAREService handleOpenUrl:url]; 51 | return YES; 52 | } 53 | // work in iOS(9_0) 54 | - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{ 55 | [JSHAREService handleOpenUrl:url]; 56 | return YES; 57 | } 58 | // work in iOS(9_0,++) 59 | - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options { 60 | [JSHAREService handleOpenUrl:url]; 61 | return YES; 62 | } 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 9 | 10 | 11 | 12 | 13 | 19 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 45 | 46 | 50 | 51 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /example/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /docs/AndroidManifest.md: -------------------------------------------------------------------------------- 1 | # AndroidManifest Configuration 2 | 3 | > your project/android/app/AndroidManifest.xml 4 | 5 | ``` 6 | 9 | 10 | 14 | 15 | 16 | 17 | 18 | 24 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 52 | 53 | 57 | 58 | 62 | 63 | 64 | 65 | 66 | ``` 67 | 68 | -------------------------------------------------------------------------------- /example/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Disabling obfuscation is useful if you collect stack traces from production crashes 20 | # (unless you are using a system that supports de-obfuscate the stack traces). 21 | -dontobfuscate 22 | 23 | # React Native 24 | 25 | # Keep our interfaces so they can be used by other ProGuard rules. 26 | # See http://sourceforge.net/p/proguard/bugs/466/ 27 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip 28 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters 29 | -keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip 30 | 31 | # Do not strip any method/class that is annotated with @DoNotStrip 32 | -keep @com.facebook.proguard.annotations.DoNotStrip class * 33 | -keep @com.facebook.common.internal.DoNotStrip class * 34 | -keepclassmembers class * { 35 | @com.facebook.proguard.annotations.DoNotStrip *; 36 | @com.facebook.common.internal.DoNotStrip *; 37 | } 38 | 39 | -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { 40 | void set*(***); 41 | *** get*(); 42 | } 43 | 44 | -keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } 45 | -keep class * extends com.facebook.react.bridge.NativeModule { *; } 46 | -keepclassmembers,includedescriptorclasses class * { native ; } 47 | -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } 48 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; } 49 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; } 50 | 51 | -dontwarn com.facebook.react.** 52 | 53 | # TextLayoutBuilder uses a non-public Android constructor within StaticLayout. 54 | # See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details. 55 | -dontwarn android.text.StaticLayout 56 | 57 | # okhttp 58 | 59 | -keepattributes Signature 60 | -keepattributes *Annotation* 61 | -keep class okhttp3.** { *; } 62 | -keep interface okhttp3.** { *; } 63 | -dontwarn okhttp3.** 64 | 65 | # okio 66 | 67 | -keep class sun.misc.Unsafe { *; } 68 | -dontwarn java.nio.file.* 69 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 70 | -dontwarn okio.** 71 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | 16 | 22 | 28 | 34 | 39 | 40 | 46 | 47 |