├── 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 |
53 |
54 |
60 |
66 |
67 |
73 |
74 |
75 |
76 |
83 |
84 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/example/ios/jshare/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
21 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4 |
5 | ## Build generated
6 | build/
7 | DerivedData/
8 |
9 | ## Various settings
10 | *.pbxuser
11 | !default.pbxuser
12 | *.mode1v3
13 | !default.mode1v3
14 | *.mode2v3
15 | !default.mode2v3
16 | *.perspectivev3
17 | !default.perspectivev3
18 | xcuserdata/
19 |
20 | ## Other
21 | *.moved-aside
22 | *.xccheckout
23 | *.xcscmblueprint
24 |
25 | ## Obj-C/Swift specific
26 | *.hmap
27 | *.ipa
28 | *.dSYM.zip
29 | *.dSYM
30 |
31 | # CocoaPods
32 | #
33 | # We recommend against adding the Pods directory to your .gitignore. However
34 | # you should judge for yourself, the pros and cons are mentioned at:
35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
36 | #
37 | # Pods/
38 |
39 | # Carthage
40 | #
41 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
42 | # Carthage/Checkouts
43 |
44 | Carthage/Build
45 |
46 | # fastlane
47 | #
48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
49 | # screenshots whenever they are needed.
50 | # For more information about the recommended setup visit:
51 | # https://docs.fastlane.tools/best-practices/source-control/#source-control
52 |
53 | fastlane/report.xml
54 | fastlane/Preview.html
55 | fastlane/screenshots
56 | fastlane/test_output
57 |
58 | # Code Injection
59 | #
60 | # After new code Injection tools there's a generated folder /iOSInjectionProject
61 | # https://github.com/johnno1962/injectionforxcode
62 |
63 | iOSInjectionProject/
64 |
65 |
66 |
67 |
68 | # Built application files
69 | *.apk
70 | *.ap_
71 |
72 | # Files for the ART/Dalvik VM
73 | *.dex
74 |
75 | # Java class files
76 | *.class
77 |
78 | # Generated files
79 | bin/
80 | gen/
81 | out/
82 |
83 | # Gradle files
84 | .gradle/
85 | build/
86 |
87 | # Local configuration file (sdk path, etc)
88 | local.properties
89 |
90 | # Proguard folder generated by Eclipse
91 | proguard/
92 |
93 | # Log Files
94 | *.log
95 |
96 | # Android Studio Navigation editor temp files
97 | .navigation/
98 |
99 | # Android Studio captures folder
100 | captures/
101 |
102 | # Intellij
103 | *.iml
104 | .idea/workspace.xml
105 | .idea/tasks.xml
106 | .idea/gradle.xml
107 | .idea/dictionaries
108 | .idea/libraries
109 |
110 | # Keystore files
111 | *.jks
112 |
113 | # External native build folder generated in Android Studio 2.2 and later
114 | .externalNativeBuild
115 |
116 | # Google Services (e.g. APIs or Firebase)
117 | google-services.json
118 |
119 | # Freeline
120 | freeline.py
121 | freeline/
122 | freeline_project_description.json
123 |
124 |
125 | # Logs
126 | logs
127 | *.log
128 | npm-debug.log*
129 | yarn-debug.log*
130 | yarn-error.log*
131 |
132 | # Runtime data
133 | pids
134 | *.pid
135 | *.seed
136 | *.pid.lock
137 |
138 | # Directory for instrumented libs generated by jscoverage/JSCover
139 | lib-cov
140 |
141 | # Coverage directory used by tools like istanbul
142 | coverage
143 |
144 | # nyc test coverage
145 | .nyc_output
146 |
147 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
148 | .grunt
149 |
150 | # Bower dependency directory (https://bower.io/)
151 | bower_components
152 |
153 | # node-waf configuration
154 | .lock-wscript
155 |
156 | # Compiled binary addons (http://nodejs.org/api/addons.html)
157 | build/Release
158 |
159 | # Dependency directories
160 | node_modules/
161 | jspm_packages/
162 |
163 | # Typescript v1 declaration files
164 | typings/
165 |
166 | # Optional npm cache directory
167 | .npm
168 |
169 | # Optional eslint cache
170 | .eslintcache
171 |
172 | # Optional REPL history
173 | .node_repl_history
174 |
175 | # Output of 'npm pack'
176 | *.tgz
177 |
178 | # Yarn Integrity file
179 | .yarn-integrity
180 |
181 | # dotenv environment variables file
182 | .env
183 |
184 |
185 | .qshell
186 | *.qshel
187 | *.DS_Store
188 | example/node_modules/
189 | *.gradle/
190 | gradle.properties
191 | build/
192 | build-res/
193 | /*/build/
194 | *.iml
195 | *.idea/
196 | *.DS_Store
197 | *.log
198 | .qshell
199 | *.qshell
200 | example/node_modules/*
201 |
--------------------------------------------------------------------------------
/example/ios/jshare.xcodeproj/xcshareddata/xcschemes/jshare.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
43 |
49 |
50 |
51 |
52 |
53 |
58 |
59 |
61 |
67 |
68 |
69 |
70 |
71 |
77 |
78 |
79 |
80 |
81 |
82 |
92 |
94 |
100 |
101 |
102 |
103 |
104 |
105 |
111 |
113 |
119 |
120 |
121 |
122 |
124 |
125 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/example/ios/jshare.xcodeproj/xcshareddata/xcschemes/jshare-tvOS.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
43 |
49 |
50 |
51 |
52 |
53 |
58 |
59 |
61 |
67 |
68 |
69 |
70 |
71 |
77 |
78 |
79 |
80 |
81 |
82 |
92 |
94 |
100 |
101 |
102 |
103 |
104 |
105 |
111 |
113 |
119 |
120 |
121 |
122 |
124 |
125 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/example/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/example/ios/jshare/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSPhotoLibraryUsageDescription
6 |
7 | CFBundleDevelopmentRegion
8 | en
9 | CFBundleDisplayName
10 | jshare
11 | CFBundleExecutable
12 | $(EXECUTABLE_NAME)
13 | CFBundleIdentifier
14 | $(PRODUCT_BUNDLE_IDENTIFIER)
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | $(PRODUCT_NAME)
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | ????
25 | CFBundleURLTypes
26 |
27 |
28 | CFBundleTypeRole
29 | Editor
30 | CFBundleURLName
31 | com.sina
32 | CFBundleURLSchemes
33 |
34 | wb374535501
35 |
36 |
37 |
38 | CFBundleTypeRole
39 | Editor
40 | CFBundleURLName
41 | weixin
42 | CFBundleURLSchemes
43 |
44 | wxc40e16f3ba6ebabc
45 |
46 |
47 |
48 | CFBundleTypeRole
49 | Editor
50 | CFBundleURLName
51 | QQ
52 | CFBundleURLSchemes
53 |
54 | tencent1105864531
55 |
56 |
57 |
58 | CFBundleTypeRole
59 | Editor
60 | CFBundleURLName
61 | facebook
62 | CFBundleURLSchemes
63 |
64 | fb177776412817787
65 |
66 |
67 |
68 | CFBundleVersion
69 | 1
70 | LSApplicationQueriesSchemes
71 |
72 | wechat
73 | weixin
74 | mqqapi
75 | mqq
76 | mqqOpensdkSSoLogin
77 | mqqconnect
78 | mqqopensdkdataline
79 | mqqopensdkgrouptribeshare
80 | mqqopensdkfriend
81 | mqqopensdkapi
82 | mqqopensdkapiV2
83 | mqqopensdkapiV3
84 | mqqopensdkapiV4
85 | mqzoneopensdk
86 | wtloginmqq
87 | wtloginmqq2
88 | mqqwpa
89 | mqzone
90 | mqzonev2
91 | mqzoneshare
92 | wtloginqzone
93 | mqzonewx
94 | mqzoneopensdkapiV2
95 | mqzoneopensdkapi19
96 | mqzoneopensdkapi
97 | mqqbrowser
98 | mttbrowser
99 | sinaweibohd
100 | sinaweibo
101 | sinaweibosso
102 | weibosdk
103 | weibosdk2.5
104 | fbapi
105 | fb-messenger-api
106 | fbauth2
107 | fbshareextension
108 |
109 | LSRequiresIPhoneOS
110 |
111 | NSAppTransportSecurity
112 |
113 | NSExceptionDomains
114 |
115 | localhost
116 |
117 | NSExceptionAllowsInsecureHTTPLoads
118 |
119 |
120 | sina.cn
121 |
122 | NSExceptionMinimumTLSVersion
123 | TLSv1.0
124 | NSIncludesSubdomains
125 |
126 | NSThirdPartyExceptionRequiresForwardSecrecy
127 |
128 |
129 | sina.com.cn
130 |
131 | NSIncludesSubdomains
132 |
133 | NSThirdPartyExceptionAllowsInsecureHTTPLoads
134 |
135 | NSThirdPartyExceptionRequiresForwardSecrecy
136 |
137 |
138 | sinaimg.cn
139 |
140 | NSIncludesSubdomains
141 |
142 | NSThirdPartyExceptionAllowsInsecureHTTPLoads
143 |
144 | NSThirdPartyExceptionRequiresForwardSecrecy
145 |
146 |
147 | sinajs.cn
148 |
149 | NSIncludesSubdomains
150 |
151 | NSThirdPartyExceptionAllowsInsecureHTTPLoads
152 |
153 | NSThirdPartyExceptionRequiresForwardSecrecy
154 |
155 |
156 | weibo.cn
157 |
158 | NSExceptionMinimumTLSVersion
159 | TLSv1.0
160 | NSIncludesSubdomains
161 |
162 | NSThirdPartyExceptionRequiresForwardSecrecy
163 |
164 |
165 | weibo.com
166 |
167 | NSExceptionMinimumTLSVersion
168 | TLSv1.0
169 | NSIncludesSubdomains
170 |
171 | NSThirdPartyExceptionAllowsInsecureHTTPLoads
172 |
173 | NSThirdPartyExceptionRequiresForwardSecrecy
174 |
175 |
176 |
177 |
178 | NSLocationWhenInUseUsageDescription
179 |
180 | UILaunchStoryboardName
181 | LaunchScreen
182 | UIRequiredDeviceCapabilities
183 |
184 | armv7
185 |
186 | UISupportedInterfaceOrientations
187 |
188 | UIInterfaceOrientationPortrait
189 | UIInterfaceOrientationLandscapeLeft
190 | UIInterfaceOrientationLandscapeRight
191 |
192 | UIViewControllerBasedStatusBarAppearance
193 |
194 |
195 |
196 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/layout/push_set_dialog.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
13 |
14 |
20 |
21 |
26 |
27 |
28 |
36 |
37 |
41 |
42 |
46 |
47 |
56 |
57 |
63 |
64 |
65 |
69 |
70 |
74 |
75 |
84 |
85 |
91 |
92 |
93 |
94 |
101 |
102 |
107 |
108 |
109 |
117 |
118 |
123 |
124 |
129 |
130 |
131 |
139 |
144 |
145 |
146 |
154 |
160 |
161 |
162 |
163 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.application"
2 |
3 | import com.android.build.OutputFile
4 |
5 | /**
6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7 | * and bundleReleaseJsAndAssets).
8 | * These basically call `react-native bundle` with the correct arguments during the Android build
9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10 | * bundle directly from the development server. Below you can see all the possible configurations
11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the
12 | * `apply from: "../../node_modules/react-native/react.gradle"` line.
13 | *
14 | * project.ext.react = [
15 | * // the name of the generated asset file containing your JS bundle
16 | * bundleAssetName: "index.android.bundle",
17 | *
18 | * // the entry file for bundle generation
19 | * entryFile: "index.android.js",
20 | *
21 | * // whether to bundle JS and assets in debug mode
22 | * bundleInDebug: false,
23 | *
24 | * // whether to bundle JS and assets in release mode
25 | * bundleInRelease: true,
26 | *
27 | * // whether to bundle JS and assets in another build variant (if configured).
28 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
29 | * // The configuration property can be in the following formats
30 | * // 'bundleIn${productFlavor}${buildType}'
31 | * // 'bundleIn${buildType}'
32 | * // bundleInFreeDebug: true,
33 | * // bundleInPaidRelease: true,
34 | * // bundleInBeta: true,
35 | *
36 | * // whether to disable dev mode in custom build variants (by default only disabled in release)
37 | * // for example: to disable dev mode in the staging build type (if configured)
38 | * devDisabledInStaging: true,
39 | * // The configuration property can be in the following formats
40 | * // 'devDisabledIn${productFlavor}${buildType}'
41 | * // 'devDisabledIn${buildType}'
42 | *
43 | * // the root of your project, i.e. where "package.json" lives
44 | * root: "../../",
45 | *
46 | * // where to put the JS bundle asset in debug mode
47 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
48 | *
49 | * // where to put the JS bundle asset in release mode
50 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release",
51 | *
52 | * // where to put drawable resources / React Native assets, e.g. the ones you use via
53 | * // require('./image.png')), in debug mode
54 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
55 | *
56 | * // where to put drawable resources / React Native assets, e.g. the ones you use via
57 | * // require('./image.png')), in release mode
58 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
59 | *
60 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means
61 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
62 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle
63 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
64 | * // for example, you might want to remove it from here.
65 | * inputExcludes: ["android/**", "ios/**"],
66 | *
67 | * // override which node gets called and with what additional arguments
68 | * nodeExecutableAndArgs: ["node"],
69 | *
70 | * // supply additional arguments to the packager
71 | * extraPackagerArgs: []
72 | * ]
73 | */
74 |
75 | project.ext.react = [
76 | entryFile: "index.js"
77 | ]
78 |
79 | apply from: "../../node_modules/react-native/react.gradle"
80 |
81 | /**
82 | * Set this to true to create two separate APKs instead of one:
83 | * - An APK that only works on ARM devices
84 | * - An APK that only works on x86 devices
85 | * The advantage is the size of the APK is reduced by about 4MB.
86 | * Upload all the APKs to the Play Store and people will download
87 | * the correct one based on the CPU architecture of their device.
88 | */
89 | def enableSeparateBuildPerCPUArchitecture = false
90 |
91 | /**
92 | * Run Proguard to shrink the Java bytecode in release builds.
93 | */
94 | def enableProguardInReleaseBuilds = false
95 |
96 | android {
97 | compileSdkVersion 25
98 | buildToolsVersion '26.0.2'
99 |
100 | defaultConfig {
101 | applicationId "cn.jiguang.share.demo"
102 | minSdkVersion 16
103 | targetSdkVersion 22
104 | versionCode 1
105 | versionName "1.0"
106 | ndk {
107 | abiFilters "armeabi-v7a", "x86"
108 | }
109 | manifestPlaceholders = [
110 | JPUSH_APPKEY: "7b4b94cca0d185d611e53cca", //在此替换你的APPKey
111 | JPUSH_CHANNEL: "developer-default", //应用渠道号
112 | ]
113 | }
114 | splits {
115 | abi {
116 | reset()
117 | enable enableSeparateBuildPerCPUArchitecture
118 | universalApk false // If true, also generate a universal APK
119 | include "armeabi-v7a", "x86"
120 | }
121 | }
122 | // signingConfigs {
123 | // debug {
124 | // storeFile file("jshare.jks") //你的签名文件路径
125 | // storePassword "sdkteam" //你的签名文件保存密码
126 | // keyAlias "jshare" // 你的别名
127 | // keyPassword "sdkteam" //你的签名密码
128 | // }
129 | // release {
130 | // storeFile file("jshare.jks") //你的签名文件路径
131 | // storePassword "sdkteam" //你的签名文件保存密码
132 | // keyAlias "jshare" // 你的别名
133 | // keyPassword "sdkteam" //你的签名密码
134 | // }
135 | // }
136 | sourceSets {
137 | main {
138 | assets.srcDirs = ['assets']
139 | }
140 | }
141 | // buildTypes {
142 | // release {
143 | // minifyEnabled enableProguardInReleaseBuilds
144 | // proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
145 | // }
146 | // debug {
147 | // signingConfig signingConfigs.debug
148 | // }
149 | // }
150 | // applicationVariants are e.g. debug, release
151 | applicationVariants.all { variant ->
152 | variant.outputs.each { output ->
153 | // For each separate APK per architecture, set a unique version code as described here:
154 | // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
155 | def versionCodes = ["armeabi-v7a":1, "x86":2]
156 | def abi = output.getFilter(OutputFile.ABI)
157 | if (abi != null) { // null for the universal-debug, universal-release variants
158 | output.versionCodeOverride =
159 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
160 | }
161 | }
162 | }
163 | }
164 |
165 | dependencies {
166 | implementation fileTree(dir: "libs", include: ["*.jar"])
167 | implementation project(':jshare-react-native')
168 | implementation project(':jcore-react-native')
169 | implementation "com.android.support:appcompat-v7:25.3.1"
170 | implementation "com.facebook.react:react-native:+" // From node_modules
171 | }
172 |
173 | // Run this once to be able to run the application with BUCK
174 | // puts all compile dependencies into folder libs for BUCK to use
175 | task copyDownloadableDepsToLibs(type: Copy) {
176 | from configurations.compile
177 | into 'libs'
178 | }
179 |
--------------------------------------------------------------------------------
/docs/iOSConfig.md:
--------------------------------------------------------------------------------
1 | ## iOS Configuration Part
2 |
3 | ### 在 Appdelegate.m 中插入代码
4 |
5 | 加入头文件 `RCTJShareModule.h`
6 |
7 | ```objective-c
8 | #import
9 | ```
10 |
11 | 添加 `handleOpenURL`
12 |
13 | ```objective-c
14 | // work in iOS(8.0)
15 | - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
16 | [JSHAREService handleOpenUrl:url];
17 | return YES;
18 | }
19 | // work in iOS(9_0)
20 | - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{
21 | [JSHAREService handleOpenUrl:url];
22 | return YES;
23 | }
24 | // work in iOS(9_0,++)
25 | - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options {
26 | [JSHAREService handleOpenUrl:url];
27 | return YES;
28 | }
29 | ```
30 |
31 | ### 添加搜索路径
32 |
33 | TARGET -> Build Settings -> Header Search Paths 添加搜索路径
34 |
35 | ```
36 | $(SRCROOT)/../node_modules/jshare-react-native/ios/RCTJShareModule
37 | ```
38 |
39 | ### 添加 RCTJShareConfig.plist 文件到 XCode 中
40 |
41 | > 1.3.0 及以后版将不再 setup 中传入相关配置参数,将使用 [RCTJShareConfig.plist](../RCTJShareConfig.plist) 文件进行传递参数。
42 |
43 | 将 [RCTJShareConfig.plist](../RCTJShareConfig.plist) 文件添加到 XCode 工程中,并替换自己的 value。具体可以参考 [demo](../example/ios/RCTJShareConfig.plist) 。
44 |
45 |
46 | - 参数说明:
47 | - `appKey`: String // appKey 一个 JIGUANG 应用必须的,唯一的标识. 请参考 JIGUANG 相关说明文档来获取这个标识。
48 | - `channel`: String // channel 发布渠道. 可选。
49 | - `advertisingId`: String // advertisingIdentifier 广告标识符(IDFA). 可选,IDFA能帮助您更准确的统计。
50 | - `isProduction`: Boolean // isProduction 是否生产环境. 如果为开发状态,设置为NO; 如果为生产状态,应改为 YES.默认为NO。
51 | - `wechatAppId`: String // 微信的应用标识。
52 | - `wechatAppSecret`: String // 微信的应用密匙。
53 | - `qqAppId`: String // QQ 的应用密匙。
54 | - `qqAppKey`: String // QQ 应用Key。
55 | - `sinaWeiboAppKey`: String // 新浪微博应用标识。
56 | - `sinaWeiboAppSecret`: String // 新浪微博应用密匙。
57 | - `sinaRedirectUri`: String // 新浪微博应用回调地址。
58 | - `isSupportWebSina`: Boolean // 不存在新浪客户端的情况下,是否支持新浪网页版分享,默认不支持值为NO,若需支持将此值设置为YES,具体参考官方文档。
59 | - `facebookAppId`: string // facebook 注册的应用 id(必须使用自己的,测试时需要添加自己的用户才能正常分享)。
60 | - `facebookDisplayName`: string // facebook 注册的应用名,必须要匹配,否则会分享失败。
61 |
62 |
63 |
64 | ### 配置 Info.plist
65 |
66 | 在 info.plist 文件中添加如下键值对
67 |
68 | ```xml
69 | LSApplicationQueriesSchemes
70 |
71 |
72 | wechat
73 | weixin
74 |
75 |
76 | sinaweibohd
77 | sinaweibo
78 | sinaweibosso
79 | weibosdk
80 | weibosdk2.5
81 |
82 |
83 | mqqapi
84 | mqq
85 | mqqOpensdkSSoLogin
86 | mqqconnect
87 | mqqopensdkdataline
88 | mqqopensdkgrouptribeshare
89 | mqqopensdkfriend
90 | mqqopensdkapi
91 | mqqopensdkapiV2
92 | mqqopensdkapiV3
93 | mqqopensdkapiV4
94 | mqzoneopensdk
95 | wtloginmqq
96 | wtloginmqq2
97 | mqqwpa
98 | mqzone
99 | mqzonev2
100 | mqzoneshare
101 | wtloginqzone
102 | mqzonewx
103 | mqzoneopensdkapiV2
104 | mqzoneopensdkapi19
105 | mqzoneopensdkapi
106 | mqqbrowser
107 | mttbrowser
108 |
109 |
110 | fbapi
111 | fb-messenger-api
112 | fbauth2
113 | fbshareextension
114 |
115 | ```
116 |
117 | ### 添加 URL Types
118 | #### 各个平台的 URL Schemes 格式说明:
119 |
120 | | 平台 | 格式 | 举例 |
121 | | ---- | -------------------------------- | ---------------------------------------- |
122 | | 微信 | 微信 appKey | wxa2ea563906227379 |
123 | | QQ | 需添加:“tencent” + 腾讯 QQ 互联应用 appID | 如 appID 为:1105864531
URL Schemes 值为:tencent1105864531 |
124 | | 新浪微博 | “wb”+新浪 appKey | 如 appKey 为:727232518
URL Schemes 值为: wb727232518 |
125 |
126 | #### URL Types 设置
127 | Xcode 工程目录中的 [TARGETS] -> [Info] 中设置:
128 | 
129 |
130 | ### HTTPS 设置
131 | > Apple 将从2017年开始执行 ATS(App Transport Security),所有进行审核的应用中网络请求全部支持 HTTPS,届时以下配置将会失效,请提前做好准备。
132 |
133 | 目前 JSHARE 支持不存在新浪微博客户端情况下的网页分享,但是由于新浪微博的 api 尚未针对 https 做优化所以需要针对新浪的做对应的 https 设置。在 JSHARE 中是默认关闭新浪微博的网页端分享的,如需使用这个功能则需要在 JSHARELaunchConfig 类的实例中将 **isSupportWebSina** 属性设置为 YES。
134 |
135 | 以iOS10 SDK 编译的工程会默认以 SSL 安全协议进行网络传输,即 HTTPS,如果依然使用 HTTP 协议请求网络会报系统异常并中断请求。目前可用如下这种方式保持用 HTTP 进行网络连接:
136 |
137 | 在 info.plist 中加入安全域名白名单(右键 info.plist 用 source code 打开)
138 |
139 | ```
140 | NSAppTransportSecurity
141 |
142 |
143 | NSExceptionDomains
144 |
145 |
146 | sina.com.cn
147 |
148 | NSIncludesSubdomains
149 |
150 | NSThirdPartyExceptionAllowsInsecureHTTPLoads
151 |
152 | NSThirdPartyExceptionRequiresForwardSecrecy
153 |
154 |
155 | sinaimg.cn
156 |
157 | NSIncludesSubdomains
158 |
159 | NSThirdPartyExceptionAllowsInsecureHTTPLoads
160 |
161 | NSThirdPartyExceptionRequiresForwardSecrecy
162 |
163 |
164 | sinajs.cn
165 |
166 | NSIncludesSubdomains
167 |
168 | NSThirdPartyExceptionAllowsInsecureHTTPLoads
169 |
170 | NSThirdPartyExceptionRequiresForwardSecrecy
171 |
172 |
173 | sina.cn
174 |
175 |
176 | NSExceptionMinimumTLSVersion
177 | TLSv1.0
178 | NSIncludesSubdomains
179 |
180 | NSThirdPartyExceptionRequiresForwardSecrecy
181 |
182 |
183 | weibo.cn
184 |
185 |
186 | NSExceptionMinimumTLSVersion
187 | TLSv1.0
188 | NSIncludesSubdomains
189 |
190 | NSThirdPartyExceptionRequiresForwardSecrecy
191 |
192 |
193 | weibo.com
194 |
195 |
196 | NSExceptionMinimumTLSVersion
197 | TLSv1.0
198 | NSIncludesSubdomains
199 |
200 | NSThirdPartyExceptionAllowsInsecureHTTPLoads
201 |
202 | NSThirdPartyExceptionRequiresForwardSecrecy
203 |
204 |
205 |
206 |
207 |
208 | ```
--------------------------------------------------------------------------------
/example/react-native-android/main_activity.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import React from 'react';
4 | import ReactNative from 'react-native';
5 | import JShareModule from 'jshare-react-native';
6 |
7 | const {
8 | View,
9 | Text,
10 | TouchableHighlight,
11 | StyleSheet,
12 | ScrollView,
13 | } = ReactNative;
14 |
15 |
16 |
17 | export default class MainActivity extends React.Component {
18 | constructor(props) {
19 | super(props);
20 | }
21 |
22 | componentDidMount() {
23 | JShareModule.setDebug({ enable: true })
24 | }
25 |
26 | onGetPlatformList = () => {
27 | JShareModule.getPlatformList((list) => {
28 | console.log("list: " + list);
29 | });
30 | }
31 |
32 | /**
33 | * Get user information of platform
34 | */
35 | onGetPlatformUserInfo = () => {
36 | var param = {
37 | // name can be platform name:
38 | // 'wechat_session' / 'wechat_timeLine' / 'wechat_favourite' / 'qq' / 'qzone' / 'sina_weibo' / 'sina_weibo_contact' / 'facebook' / 'facebook_messenger'
39 | platform: "wechat_session"
40 | };
41 | JShareModule.getSocialUserInfo(param, (map) => {
42 | console.log(JSON.stringify(map));
43 | }, (errorCode) => {
44 | console.log("errorCode: " + errorCode);
45 | });
46 | }
47 |
48 | /**
49 | * Check if platform is authorized or not.
50 | */
51 | onPlatformAuth = () => {
52 | var param = {
53 | platform: "wechat_session"
54 | };
55 | JShareModule.isPlatformAuth(param, (result) => {
56 | console.log(param.platform + "is Auth: " + result);
57 | });
58 | }
59 |
60 | /**
61 | * Check if platform is installed or not.
62 | */
63 | onClientValid = () => {
64 | var param = {
65 | platform: "wechat_session"
66 | };
67 | JShareModule.isClientValid(param, (result) => {
68 | console.log(param.platform + "is valid: " + result);
69 | });
70 | }
71 |
72 | onAuthorize = () => {
73 | var param = {
74 | platform: "wechat_session"
75 | };
76 | JShareModule.authorize(param, (map) => {
77 | console.log("Authorize succeed " + JSON.stringify(map));
78 | }, (errorCode) => {
79 | console.log("Authorize failed, errorCode : " + errorCode);
80 | });
81 | }
82 |
83 | onRemoveAuthorize = () => {
84 | var param = {
85 | platform: "wechat_session"
86 | };
87 | JShareModule.cancelAuthWithPlatform(param, (code) => {
88 | if (code === 0) {
89 | console.log("remove authorize succeed");
90 | } else {
91 | console.log("remove authorize failed, errorCode: " + code);
92 | }
93 | });
94 | }
95 |
96 | onSharePress = () => {
97 | var shareParam = {
98 | platform: "facebook",
99 | type: "image",
100 | text: "JShare test text",
101 | imagePath: "/storage/emulated/0/DCIM/Camera/IMG20170707202330.jpg"
102 | };
103 | JShareModule.share(shareParam, (map) => {
104 | console.log("share result: " + JSON.stringify(map));
105 | }, (map) => {
106 | console.log("share failed, map: " + map);
107 | });
108 | }
109 |
110 | onShareLinkToFacebook = () => {
111 | console.log("Share to facebook");
112 | var shareParam = {
113 | platform: "facebook",
114 | type: "link",
115 | url: "https://jiguang.cn",
116 | text: "JShare test text",
117 | };
118 | JShareModule.share(shareParam, (map) => {
119 | console.log("Share to facebook succeed " + JSON.stringify(map));
120 | }, (error) => {
121 | console.log("Share to facebook failed, error: " + JSON.stringify(error));
122 | })
123 | }
124 |
125 | onShareImageToFacebook = () => {
126 | console.log("Share image to facebook")
127 | var shareParam = {
128 | platform: "facebook",
129 | type: "image",
130 | text: "test",
131 | // 必须是本地图片
132 | imagePath: "/storage/emulated/0/DCIM/Camera/IMG20170707202330.jpg",
133 | };
134 | JShareModule.share(shareParam, (map) => {
135 | console.log("Share image to facebook succeed: " + JSON.stringify(map));
136 | }, (error) => {
137 | console.log("Share failed, error: " + JSON.stringify(error));
138 | });
139 | }
140 |
141 | onShareVideoToFacebook = () => {
142 | console.log("Share video to facebook");
143 | var shareParam = {
144 | platform: "facebook",
145 | type: "video",
146 | // 必须是本地视频
147 | videoUrl: "/storage/emulated/0/videos/jiguang.mp4"
148 | };
149 | JShareModule.share(shareParam, (map) => {
150 | console.log("Share video to facebook succeed: " + JSON.stringify(map));
151 | }, (error) => {
152 | console.log("Share failed; error: " + JSON.stringify(error));
153 | });
154 | }
155 |
156 | render() {
157 | return (
158 |
159 |
160 | style={styles.welcome}>
161 | Welcome !
162 |
163 |
168 |
169 | Get Platform List
170 |
171 |
172 |
177 |
178 | Get Platform userInfo
179 |
180 |
181 |
186 |
187 | Is Platform auth
188 |
189 |
190 |
195 |
196 | Is client valid
197 |
198 |
199 |
204 |
205 | Authorize
206 |
207 |
208 |
213 |
214 | Remove authorize
215 |
216 |
217 |
222 |
223 | Share
224 |
225 |
226 |
231 |
232 | Share Link to Facebook
233 |
234 |
235 |
240 |
241 | Share Photo to Facebook
242 |
243 |
244 |
249 |
250 | Share Video to Facebook
251 |
252 |
253 |
254 | );
255 | }
256 | }
257 |
258 | var styles = StyleSheet.create({
259 | container: {
260 | flex: 1,
261 | padding: 10,
262 | },
263 | welcome: {
264 | textAlign: 'center',
265 | margin: 10,
266 | },
267 | btnStyle: {
268 | marginTop: 10,
269 | borderWidth: 1,
270 | borderColor: '#3e83d7',
271 | borderRadius: 8,
272 | backgroundColor: '#3e83d7',
273 | alignSelf: 'center',
274 | justifyContent: 'center'
275 | },
276 | btnTextStyle: {
277 | textAlign: 'center',
278 | fontSize: 25,
279 | color: '#ffffff'
280 | },
281 | });
--------------------------------------------------------------------------------
/example/android/app/src/main/res/layout/set_push_time.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
14 |
15 |
23 |
24 |
29 |
30 |
31 |
39 |
40 |
44 |
45 |
50 |
51 |
52 |
53 |
57 |
58 |
62 |
63 |
67 |
68 |
73 |
74 |
79 |
80 |
81 |
85 |
86 |
91 |
92 |
97 |
98 |
99 |
103 |
104 |
110 |
111 |
116 |
117 |
118 |
122 |
123 |
128 |
129 |
134 |
135 |
136 |
137 |
141 |
142 |
146 |
147 |
152 |
153 |
158 |
159 |
160 |
164 |
165 |
170 |
171 |
176 |
177 |
178 |
182 |
183 |
188 |
189 |
194 |
195 |
196 |
197 |
198 |
202 |
203 |
208 |
209 |
210 |
215 |
216 |
220 |
221 |
226 |
227 |
231 |
232 |
238 |
239 |
240 |
241 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | import {
2 | NativeModules,
3 | Platform,
4 | DeviceEventEmitter
5 | } from 'react-native';
6 |
7 | const JShareModule = NativeModules.JShareModule;
8 |
9 | export default class JShare {
10 | /**
11 | * iOS Only
12 | */
13 | static setup() {
14 | if (arguments[0] !== undefined) {
15 | console.warn('当前版本已经不需要在 setup 方法中传入参数。请复制 RCTJShareConfig.plist 文件到 XCode 工程中进行相关参数配置,详情请参考 iOS 配置文档。')
16 | } else {
17 | }
18 | JShareModule.setup();
19 | }
20 |
21 | /**
22 | * 获取SDK所有能用的平台名称,如要使用某个平台,必须在JGShareSDK.xml中配置。
23 | * Android only
24 | * @param {*} callback 返回值 list 是一个数组
25 | */
26 | static getPlatformList(cb) {
27 | JShareModule.getPlatformList((list) => {
28 | cb(list);
29 | });
30 | }
31 |
32 | /**
33 | * 分享
34 | * @param {object} message = {
35 | *
36 | * platformString 必填,用于分享置不同的平台 //可以是 'wechat_session' / 'wechat_timeLine' / 'wechat_favourite' / 'qq' / 'qzone' / 'sina_weibo' / 'sina_weibo_contact' / 'facebook' /'facebook_messenger' /'twitter' /'jchat_pro'
37 | * type 必填
38 | *
39 | * {
40 | * type: 'text'
41 | * platform: platformString // 分享到指定平台
42 | * text: String
43 | * imagePath: // 选填,本地图片地址,新浪微博(iOS 不支持这个字段)
44 | * appName: // 选填,应用名称,趣聊
45 | * targetPkg: // 选填,点击消息时跳转应用的包名,趣聊
46 | * targetClass: // 选填,点击消息时跳转应用的类名,趣聊
47 | * extra: // 选填,点击消息跳转到第三方应用时带的extra信息,趣聊
48 | * url: // 选填,点击消息时跳转应用的url,趣聊
49 | * callBackUrl: // 选填,点击消息跳转第三方应用失败时,回调的url,趣聊
50 | * }
51 | *
52 | * {
53 | * type: 'image'
54 | * platform: platformString // 分享到指定平台
55 | * imagePath: String // 本地图片路径 imagePath, imageUrl imageArray 必须三选一
56 | * text: String // 选填
57 | * imageUrl: String // 网络图片地址,必须以 http 或 https 开头,imagePath, imageUrl imageArray 必须三选一
58 | * imageArray: [String] // (选填: 分享到 Qzone 才提供这个字段) 如果需要分享多张图片需要这个参数,数组中问题图片路径 imagePath, imageUrl imageArray 必须三选一
59 | * appName: // 选填,应用名称,趣聊
60 | * targetPkg: // 选填,点击消息时跳转应用的包名,趣聊
61 | * targetClass: // 选填,点击消息时跳转应用的类名,趣聊
62 | * extra: // 选填,点击消息跳转到第三方应用时带的extra信息,趣聊
63 | * url: // 选填,点击消息时跳转应用的url,趣聊
64 | * callBackUrl: // 选填,点击消息跳转第三方应用失败时,回调的url,趣聊
65 | * }
66 | *
67 | * {
68 | * type: 'image_text'
69 | * platform: platformString // 分享到指定平台,目前只支持趣聊
70 | * appName: String // 选填,应用名称,趣聊
71 | * title: String // 选填,消息标题,趣聊
72 | * text: String // 消息内容,趣聊
73 | * imageUrl: String // 选填,缩略图网络图片地址,趣聊
74 | * targetPkg: String // 选填,点击消息时跳转应用的包名,趣聊
75 | * targetClass: String // 选填,点击消息时跳转应用的类名,趣聊
76 | * extra: String // 选填,点击消息跳转到第三方应用时带的extra信息,趣聊
77 | * url: String // 选填,点击消息时跳转应用的url,趣聊
78 | * callBackUrl: String // 选填,点击消息跳转第三方应用失败时,回调的url,趣聊
79 | * }
80 | *
81 | * {
82 | * type: 'video'
83 | * platform: platformString // 分享到指定平台
84 | * title: String // 选填
85 | * url: String // 视频跳转页面 url
86 | * text: String // 选填
87 | * imagePath: String // 选填,缩略图,本地图片路径
88 |
89 | * videoAssetURL: string // videoAssetURL:系统相册视频文件的 url(videoAssetURL 正确格式: assets-library://asset/asset.MOV?id=872C1D2F-97FD-4B0B-9C21-A619E4F23293&ext=MOV) (iOS only),facebook 只支持使用 videoAssetURL 来发送本地视频(不支持 url)。
90 | * videoUrl: String // QQ 空间本地视频 (iOS 不支持这个字段)
91 | * }
92 | *
93 | * {
94 | * type: 'audio'
95 | * platform: platformString // 分享到指定平台
96 | * musicUrl: String //必填 点击直接播放的 urlurl
97 | * url: String //选填,点击跳转的 url
98 | * imagePath: String //选填,缩略图,本地图片路径,imagePath,imageUrl 必须二选一
99 | * imageUrl: String // 选填,网络图片路径,imagePath, imageUrl 必须二选一
100 | * title: String // 选填
101 | * text: String // 选填
102 | * }
103 | *
104 | * {
105 | * type: 'file'
106 | * platform: platformString // 分享到指定平台
107 | * path: String // 必填,文件路径
108 | * fileExt: String // 必填,文件类型后缀
109 | * tile: String
110 | * }
111 | *
112 | * {
113 | * type: 'emoticon'
114 | * platform: platformString // 分享到指定平台
115 | * imagePath: String // 必填,本地图片路径
116 | * }
117 | *
118 | * {
119 | * type: 'app' // wechat_favourite 不支持
120 | * platform: platformString // 分享到指定平台
121 | * url: String // 点击跳转 url
122 | * extInfo: String // 选填 第三方应用自定义数据
123 | * path: String // 选填 对应 app 数据文件
124 | * title: String // 选填
125 | * text: String // 选填
126 | * }
127 | *
128 | * {
129 | * type: 'link'
130 | * platform: platformString // 分享到指定平台
131 | * url: String // 必填,网页 url
132 | * imagePath: String // 选填,本地图片路径 imagePath,imageUrl 必须二选一
133 | * imageUrl: String // 选填,网络图片地址 imagePath imageUrl 必须二选一
134 | * title: String // 选填
135 | * text: String // 选填
136 | * }
137 | *
138 | * {
139 | * type: 'undefined'
140 | * platform: platformString // 分享到指定平台
141 | * }
142 | *
143 | * @param {Function} success = function (state) {} ##
144 | * state = {state: String} state = 'success' / 'fail' / 'cancel' / 'unknow'
145 | *
146 | * @param {Function} fail = function (error) {} ##
147 | * error = {code: number, descript: String}
148 | */
149 | static share(message, success, fail) {
150 | JShareModule.share(message, (map) => {
151 | success(map);
152 | }, (map) => {
153 | fail(map);
154 | });
155 | }
156 |
157 | /**
158 | * 获取社交平台用户信息
159 | * @param {Object} param = {
160 | * platform: String //可以是 'wechat_session' / 'wechat_timeLine' / 'wechat_favourite' / 'qq' / 'qzone' / 'sina_weibo' / 'sina_weibo_contact' / 'facebook' / 'twitter' / 'jchat_pro'
161 | * }
162 | * @param {Function} success function (userInfo) {}
163 | * userInfo = {
164 | * name: String
165 | * iconUrl: String // 社交平台头像链接
166 | * gender: String // 'female' / 'male'
167 | * response: String // 社交平台上的原始数据,为 json 格式字符串。
168 | * }
169 | *
170 | * @param {Function} fail = function (error) {} ##
171 | * error = {code: number, descript: String}
172 | */
173 | static getSocialUserInfo(param, success, fail) {
174 | JShareModule.getSocialUserInfo(param, (map) => {
175 | success(map);
176 | }, (error) => {
177 | fail(error);
178 | });
179 | }
180 |
181 | /**
182 | * 判断某平台是否已经授权
183 | *
184 | * @param {Object} param = {
185 | * platform: String //可以是 'wechat_session' / 'qq' / 'sina_weibo' / 'facebook' /'facebook_messenger' / 'twitter' / 'jchat_pro'
186 | * }
187 | * @param {Function} callback = (Boolean) => {}
188 | */
189 | static isPlatformAuth(param, cb) {
190 | JShareModule.isPlatformAuth(param, (result) => {
191 | cb(result);
192 | });
193 | }
194 |
195 | /**
196 | * Android Only
197 | * 判断平台是否支持授权
198 | * @param {Object} param = {
199 | * platform: String //可以是 'wechat_session' / 'wechat_timeLine' / 'wechat_favourite' / 'qq' / 'qzone' / 'sina_weibo' / 'sina_weibo_contact' / 'facebook' / 'facebook_messenger' / 'twitter' / 'jchat_pro'
200 | * }
201 | * @param {Function} cb = (boolean) => {}
202 | */
203 | static isSupportAuthorize(param, cb) {
204 | JShareModule.isSupportAuthorize(param, (result) => {
205 | cb(result);
206 | })
207 | }
208 |
209 | /**
210 | * 判断该平台的分享是否有效
211 | * Android only
212 | * @param {Object} param = {
213 | * platform: String //可以是 'wechat_session' / 'wechat_timeLine' / 'wechat_favourite' / 'qq' / 'qzone' / 'sina_weibo' / 'sina_weibo_contact' / 'facebook' / 'facebook_messenger' / 'twitter' / 'jchat_pro'
214 | * }
215 | * @param {Function} callback = (Boolean) => {}
216 | */
217 | static isClientValid(param, cb) {
218 | JShareModule.isClientValid(param, (result) => {
219 | cb(result);
220 | })
221 | }
222 |
223 | /**
224 | * 授权接口
225 | * @param {Object} param = {
226 | * platform: String //可以是 'wechat' / 'qq' / 'weibo' / 'facebook' / 'twitter' / 'jchat_pro'
227 | * }
228 | * @param {Function} success = {
229 | * token: string,
230 | * expiration: number,
231 | * refreshToken: string,
232 | * openId: string,
233 | * originData: string // 授权登录返回的原始数据,为 json 格式字符串。
234 | * }
235 | * @param {Function} fail = {
236 | * code: number,
237 | * description: string,
238 | * platform: string
239 | * }
240 | */
241 | static authorize(param, success, fail) {
242 | JShareModule.authorize(param, (map) => {
243 | success(map);
244 | }, (errorCode) => {
245 | fail(errorCode);
246 | });
247 | }
248 |
249 | /**
250 | * 删除用户授权本地数据
251 | *
252 | * @param {Object} param = {
253 | * platform: String //可以是 'wechat_session' /
254 | * 'wechat_timeLine' /
255 | * 'wechat_favourite' /
256 | * 'qq' /
257 | * 'qzone' /
258 | * 'sina_weibo' /
259 | * 'sina_weibo_contact'
260 | * 'twitter'/
261 | * 'jchat_pro'/
262 | * }
263 | * @param {Function} callback = (Int) => {}
264 | * @code 返回码,0 表示成功删除
265 | */
266 | static cancelAuthWithPlatform(param, cb) {
267 | JShareModule.cancelAuthWithPlatform(param, (code) => {
268 | cb(code);
269 | });
270 | }
271 |
272 | /**
273 | * 检查不存在新浪客户端情况下的网页端是否登陆
274 | *
275 | * iOS Only
276 | * @param {Function} success = (Boolean) => {}
277 | */
278 | static isSinaWeiboWebLogined(success) {
279 | JShareModule.isSinaWeiboWebLogined(success)
280 | }
281 |
282 | /**
283 | * 登出新浪网页端最新帐号
284 | *
285 | * iOS Only
286 | * @param {Function} success = (Boolean) => {}
287 | */
288 | static sinaWeiboWebLogOut(success) {
289 | JShareModule.sinaWeiboWebLogOut(success)
290 | }
291 |
292 | /**
293 | * 检查是否安装微信客户端
294 | *
295 | * @param {Function} success = (Boolean) => {}
296 | */
297 | static isWeChatInstalled(success) {
298 | if (Platform.OS === 'android') {
299 | JShareModule.isClientValid({ platform: "wechat_session"},success)
300 | } else {
301 | JShareModule.isWeChatInstalled(success)
302 | }
303 | }
304 |
305 | /**
306 | * 检查是否存在 QQ 客户端
307 | *
308 | * @param {Function} success = (Boolean) => {}
309 | */
310 | static isQQInstalled(success) {
311 | if (Platform.OS === 'android') {
312 | JShareModule.isClientValid({ platform: "qq"},success)
313 | } else {
314 | JShareModule.isQQInstalled(success)
315 | }
316 | }
317 |
318 | /**
319 | * 检查是否存在 Facebook 客户端
320 | *
321 | * @param {Function} success = (Boolean) => {}
322 | */
323 | static isFacebookInstalled(success) {
324 | if (Platform.OS === 'android') {
325 | JShareModule.isClientValid({ platform: "facebook"},success)
326 | } else {
327 | JShareModule.isFacebookInstalled(success)
328 | }
329 | }
330 |
331 |
332 | /**
333 | * 检查是否存在新浪微博客户端
334 | *
335 | * @param {Function} success = (Boolean) => {}
336 | */
337 | static isSinaWeiBoInstalled(success) {
338 | if (Platform.OS === 'android') {
339 | JShareModule.isClientValid({ platform: "sina_weibo"},success)
340 | } else {
341 | JShareModule.isSinaWeiBoInstalled(success)
342 | }
343 | }
344 |
345 | /**
346 | * 检查是否存在twitter客户端
347 | *
348 | * @param {Function} success = (Boolean) => {}
349 | */
350 | static isTwitterInstalled(success) {
351 | if (Platform.OS === 'android') {
352 | JShareModule.isClientValid({ platform: "twitter" }, success);
353 | } else {
354 | JShareModule.isTwitterInstalled(success)
355 | }
356 | }
357 |
358 | /**
359 | * 检查是否存在趣聊客户端
360 | *
361 | * @param {Function} success = (Boolean) => {}
362 | */
363 | static isJchatProInstalled(success) {
364 | if (Platform.OS === 'android') {
365 | JShareModule.isClientValid({ platform: "jchat_pro" }, success);
366 | } else {
367 |
368 | }
369 | }
370 |
371 | /**
372 | *
373 | * @param {Object} param = {
374 | * enable: Boolean
375 | * }
376 | */
377 | static setDebug(param) {
378 | JShareModule.setDebug(param)
379 | }
380 |
381 | }
382 |
--------------------------------------------------------------------------------
/ios/RCTJShareModule/JSHAREService.h:
--------------------------------------------------------------------------------
1 | /*
2 | * | | | | \ \ / / | | | | / _______|
3 | * | |____| | \ \/ / | |____| | / /
4 | * | |____| | \ / | |____| | | | _____
5 | * | | | | / \ | | | | | | |____ |
6 | * | | | | / /\ \ | | | | \ \______| |
7 | * | | | | /_/ \_\ | | | | \_________|
8 | *
9 | * Copyright (c) 2011 ~ 2017 Shenzhen HXHG. All rights reserved.
10 | */
11 |
12 |
13 |
14 | #define JSHARE_VERSION_NUMBER 1.9.2
15 |
16 | #import
17 |
18 | typedef NS_ENUM(NSUInteger, JSHAREPlatform) {
19 | JSHAREPlatformWechatSession = 1,
20 | JSHAREPlatformWechatTimeLine = 2,
21 | JSHAREPlatformWechatFavourite = 3,
22 |
23 | JSHAREPlatformQQ = 4,
24 | JSHAREPlatformQzone = 5,
25 |
26 | JSHAREPlatformSinaWeibo = 6,
27 | JSHAREPlatformSinaWeiboContact = 7,
28 |
29 | JSHAREPlatformFacebook = 8,
30 | JSHAREPlatformFacebookMessenger = 9,
31 |
32 |
33 | JSHAREPlatformTwitter = 10,
34 |
35 | JSHAREPlatformJChatPro = 11,
36 | };
37 |
38 | typedef NS_ENUM(NSUInteger,JSHAREState){
39 | JSHAREStateSuccess = 1,
40 | JSHAREStateFail = 2,
41 | JSHAREStateCancel = 3,
42 | JSHAREStateUnknown = 4,
43 | };
44 |
45 | typedef NS_ENUM(NSUInteger,JSHAREMediaType){
46 | JSHAREText = 1,
47 | JSHAREImage = 2,
48 | JSHARELink = 3,
49 | JSHAREAudio = 4,
50 | JSHAREVideo = 5,
51 | JSHAREApp = 6,
52 | JSHAREFile = 7,
53 | JSHAREEmoticon = 8,
54 | JSHAREGraphic = 9, //图文类型,仅用于JChatPro
55 | JSHAREMiniProgram = 10, //小程序
56 | JSHAREUndefined = 100,
57 | };
58 |
59 | @class JSHARESocialUserInfo;
60 | typedef void(^JSHAREStateHandler)(JSHAREState state,NSError *error);
61 | typedef void(^JSHARECompletionHandler)(JSHAREState state,NSError *error, id responseObject);
62 | typedef void(^JSHARESocialHandler)(JSHARESocialUserInfo *userInfo,NSError *error);
63 |
64 | @interface JSHARELaunchConfig : NSObject
65 |
66 | /**
67 | appKey 一个 JIGUANG 应用必须的,唯一的标识. 请参考 JIGUANG 相关说明文档来获取这个标识。
68 | */
69 | @property (nonatomic, copy) NSString *appKey;
70 |
71 | /**
72 | channel 发布渠道. 可选。
73 | */
74 | @property (nonatomic, copy) NSString *channel;
75 |
76 | /**
77 | advertisingIdentifier 广告标识符(IDFA). 可选,IDFA能帮助您更准确的统计。
78 | */
79 | @property (nonatomic, copy) NSString *advertisingId;
80 |
81 | /**
82 | isProduction 是否生产环境. 如果为开发状态,设置为NO; 如果为生产状态,应改为 YES.默认为NO。
83 | */
84 | @property (nonatomic, assign) BOOL isProduction;
85 |
86 | /**
87 | 设置微信的应用标识。
88 | */
89 | @property (nonatomic, copy) NSString *WeChatAppId;
90 |
91 | /**
92 | 设置微信的应用密匙。
93 | */
94 | @property (nonatomic, copy) NSString *WeChatAppSecret;
95 |
96 | /**
97 | 设置QQ应用标识。
98 | */
99 | @property (nonatomic, copy) NSString *QQAppId;
100 |
101 | /**
102 | 设置QQ应用Key。
103 | */
104 | @property (nonatomic, copy) NSString *QQAppKey;
105 |
106 | /**
107 | 设置新浪微博应用标识。
108 | */
109 | @property (nonatomic, copy) NSString *SinaWeiboAppKey;
110 |
111 | /**
112 | 设置新浪微博应用密匙。
113 | */
114 | @property (nonatomic, copy) NSString *SinaWeiboAppSecret;
115 |
116 | /**
117 | 设置新浪微博应用回调地址。
118 | */
119 | @property (nonatomic, copy) NSString *SinaRedirectUri;
120 |
121 |
122 | /**
123 | 设置Facebook应用标识
124 | */
125 | @property (nonatomic,copy) NSString *FacebookAppID;
126 |
127 | /**
128 | 设置Facebook应用名称
129 | */
130 | @property (nonatomic,copy) NSString *FacebookDisplayName;
131 |
132 | /**
133 | 不存在新浪客户端的情况下,是否支持新浪网页版分享,默认不支持值为NO,若需支持将此值设置为YES,具体参考官方文档。
134 | */
135 | @property (nonatomic, assign) BOOL isSupportWebSina;
136 |
137 | /**
138 | * Twitter consumer key
139 | */
140 | @property (nonatomic, copy) NSString *TwitterConsumerKey;
141 | /**
142 | * Twitter consumer secret
143 | */
144 | @property (nonatomic, copy) NSString *TwitterConsumerSecret;
145 | /**
146 | * JChatPro Auth
147 | */
148 | @property (nonatomic, copy) NSString *JChatProAuth;
149 | /*
150 | * 应用的 Universal link
151 | */
152 | @property (nonatomic, copy) NSString *universalLink;
153 |
154 | @end
155 |
156 | @interface JSHAREMessage : NSObject
157 |
158 | /**
159 | 标题:长度每个平台的限制而不同。
160 | 微信好友:最大 512 字符。
161 | 微信朋友圈:最大 512 字符。
162 | 微信收藏:最大 512 字符。
163 | QQ:最大 128 字符。
164 | QQ空间:最大 128 字符。
165 | 新浪微博:分享链接类型,最大 1 K字符。
166 | JChatPro:消息标题。
167 | 微信小程序:小程序title。长度不超过512字节
168 | */
169 | @property (nonatomic,strong) NSString *title;
170 |
171 | /**
172 | 文本:文本内容,长度每个平台的限制而不同。
173 | 在分享非文本类型时,此字段作为分享内容的描述使用。
174 |
175 | 微信好友:分享文本类型时,最大 10 K字符。分享非文本类型,最大 1 K字符。
176 | 微信朋友圈:分享文本类型时,最大 10 K字符。分享非文本类型,最大 1 K字符。
177 | 微信收藏:分享文本类型时,最大 10 K字符。分享非文本类型,最大 1 K字符。
178 | QQ:分享文本类型时,最大 1536 字符。分享非文本类型,最大 512 字符。
179 | QQ空间:分享文本类型时,最大 128 字符。分享非文本类型,最大 512 字符。
180 | 新浪微博:最大 140 汉字。
181 | 网页分享必须包含至少一个第三方分享到微博的网页URL(安全域名下的链接),不能包含#话题词#。
182 | Twitter:最大 140 汉字
183 | JChatPro:消息内容。不超过4k字节
184 | 微信小程序:描述内容。长度不能超过1k
185 | */
186 | @property (nonatomic,strong) NSString *text;
187 |
188 |
189 |
190 | /**
191 | 链接:根据媒体类型填入链接,长度每个平台的限制不同。分享非文本及非图片类型时,必要!
192 | 微信好友:最大 10 K字符。
193 | 微信朋友圈:最大 10 K字符。
194 | 微信收藏:最大 10 K字符。
195 | QQ:最大 512 字符。
196 | QQ空间:最大 512 字符。
197 | 新浪微博:最大 512 字符。
198 | Twitter:以Twitter返回结果为准。分享链接时必要,其它情况可选。
199 | 微信小程序:兼容微信低版本网页地址。
200 | */
201 | @property (nonatomic,strong) NSString *url;
202 |
203 |
204 | /**
205 | 本地视频AssetURL:分享本地视频到 QQ 空间的必填参数,可传ALAsset的ALAssetPropertyAssetURL,或者PHAsset的localIdentifier。分享到视频类型至 facebook 、facebookMessenger 只能识别 ALAsset 的ALAssetPropertyAssetURL。
206 | */
207 | @property (nonatomic,strong) NSString *videoAssetURL;
208 |
209 | /**
210 | 缩略图:大小限制根据平台不同而不同。
211 | 微信好友:最大 32 K。
212 | 微信朋友圈:最大 32 K。
213 | 微信收藏:最大 32 K。
214 | QQ:最大 1 M。
215 | QQ空间:最大 1 M。
216 | 新浪微博:最大 32 K。
217 | */
218 | @property (nonatomic,strong) NSData *thumbnail;
219 |
220 | /**
221 | JChatPro 网络缩略图地址
222 | */
223 | @property (nonatomic,copy) NSString *thumbUrl;
224 |
225 | /**
226 | 图片:分享JSHAREImage类型,大小限制根据平台不同而不同,当分享JSHARELink类型时没有提供缩略图时,若此参数不为空,JSHARE将会裁剪此参数提供的图片去适配缩略图。
227 | 微信好友:最大 10 M。
228 | 微信朋友圈:最大 10 M。
229 | 微信收藏:最大 10 M。
230 | QQ:最大 5 M。
231 | QQ空间:最大 5 M。
232 | 新浪微博:最大 10 M。
233 | Twitter:最大 5 M。
234 | JChatPro :分享单张图片。暂无限制
235 | 微信小程序: 小程序新版本的预览图 最大128k
236 | */
237 | @property (nonatomic,strong) NSData *image;
238 |
239 | /**
240 | 图片数组:分享到 QQ 空间 或 Facebook/Messenger 或 Twitter支持多张图片。图片数组的元素需要为 NSData 类型。
241 | 1.QQ 空间图片数量限制为20张。若只分享单张图片使用 image 字段即可。
242 | 2.Facebook/Messenger 图片数量限制为6张。如果分享单张图片,图片大小建议不要超过12M;如果分享多张图片,图片大小建议不要超过700K,否则可能出现重启手机或者不能分享。
243 | 3、Twitter 图片数量限制为4张。单张图片大小不超过5mb。
244 | 4、JChatPro图片限制为9张。若分享单张图片使用image字段即可。
245 | */
246 | @property (nonatomic,strong) NSArray *images;
247 |
248 | /**
249 | 分享的媒体类型。必要!
250 | */
251 | @property (nonatomic,assign) JSHAREMediaType mediaType;
252 |
253 | /**
254 | 分享的目标平台。必要!
255 | */
256 | @property (nonatomic,assign) JSHAREPlatform platform;
257 |
258 | /**
259 | 分享JSHAREAudio类型至微信平台或QQ平台时,音乐数据url地址。
260 | 微信好友:最大 10 K字符。
261 | 微信朋友圈:最大 10 K字符。
262 | 微信收藏:最大 10 K字符。
263 | QQ:最大 512 字符。
264 | QQ空间:最大 512 字符。
265 | 新浪微博:最大 512 字符。
266 | */
267 | @property (nonatomic,strong) NSString *mediaDataUrl;
268 |
269 | /**
270 | 微信 分享JSHAREApp类型至微信平台时,第三方程序自定义的简单数据。
271 | JChatPro 点击消息跳转到第三方应用时带的extra信息
272 | */
273 | @property (nonatomic,strong) NSString *extInfo;
274 |
275 | /**
276 | 分享JSHAREFile类型或者JSHAREApp类型至微信平台时,对应的File数据以及App数据,最大 10 M。
277 | */
278 | @property (nonatomic,strong) NSData *fileData;
279 |
280 | /**
281 | 分享JSHAREFile类型至微信平台时,对应的文件后缀名,分享文件必填,否则会导致分享到微信平台出现不一致的文件类型,最大 64 字符。
282 | */
283 | @property (nonatomic,strong) NSString *fileExt;
284 |
285 | /**
286 | 分享JSHAREEmoticon类型至微信平台时,对应的表情数据,最大 10 M。
287 | */
288 | @property (nonatomic,strong) NSData *emoticonData;
289 |
290 | /**
291 | 分享至新浪微博平台时,分享参数的一个标识符,默认为 “objectId”。最大 255 字符。
292 | */
293 | @property (nonatomic,strong) NSString *sinaObjectID;
294 |
295 | /**
296 | 分享的视频,目前支持平台有Twitter
297 | 上传至Twitter视频有几个要求:
298 | - 持续时间应该在0.5秒到30秒之间
299 | - 文件大小不应超过15 mb
300 | - 尺寸应该在32x32和1280x1024之间
301 | - 长宽比应在1:3和3:1之间
302 | - 帧率应该是40fps或更少
303 | */
304 | @property (nonatomic,strong) NSData *videoData;
305 |
306 | /*
307 | JChatPro 当应用内的分享消息被点击时,如果启动的客户端不存在时,回调的url。开发者可以通过这个配置实现本地应用不存在时跳转到他们的官网之类的操作
308 | */
309 | @property (nonatomic,strong) NSString *callbackUrl ;
310 |
311 | /**
312 | JChatPro 点击消息时跳转第三方android客户端的包名
313 | */
314 | @property (nonatomic,strong) NSString *pkgName;
315 |
316 | /**
317 | JChatPro 点击消息时跳转第三方android客户端的类名
318 | */
319 | @property (nonatomic,strong) NSString *className;
320 |
321 | /**
322 | JChatPro 第三方客户端应用名称
323 | */
324 | @property (nonatomic, copy) NSString *appName;
325 |
326 | /**
327 | JChatPro 点击消息跳转第三方iOS客户端的Scheme
328 | */
329 | @property (nonatomic, copy) NSString *fromScheme __attribute__((deprecated("已废弃,设置无效")));
330 |
331 | /**
332 | JChatPro 图片网络地址
333 | */
334 | @property (nonatomic, copy) NSString *imageURL;
335 |
336 | /**
337 | 微信小程序: 小程序username,如"gh_d43f693ca31f"
338 | */
339 | @property (nonatomic, copy) NSString *userName;
340 |
341 | /**
342 | 微信小程序: 小程序页面路径,如"pages/page10000/page10000"
343 | */
344 | @property (nonatomic, copy) NSString *path;
345 |
346 | /**
347 | 微信小程序: 小程序版本类型。 0正式版,1开发版,2体验版。默认0,正式版
348 | */
349 | @property (nonatomic, assign) int miniProgramType;
350 |
351 | /**
352 | 微信小程序: 是否使用带 shareTicket 的转发。默认false,不使用带 shareTicket 的转发。
353 | */
354 | @property (nonatomic, assign) BOOL withShareTicket;
355 |
356 | /**
357 | 返回一个 JShareMessage 实例
358 |
359 | @return 返回一个 JShareMessage 实例
360 | */
361 | + (JSHAREMessage *)message;
362 | @end
363 |
364 |
365 | @interface JSHAREService : NSObject
366 |
367 | /**
368 | 启动SDK,必要!
369 |
370 | @param config SDK启动参数模型,不可为nil。
371 | */
372 | + (void)setupWithConfig:(JSHARELaunchConfig *)config;
373 |
374 |
375 | /**
376 | 处理平台回调,必要!
377 |
378 | @param url 回调的url,在 Appdelegate 的 application:handleOpenURL: 中调用。不调用此接口 JSHARE 将无法提供分享回调。
379 | @return 处理结果 YES为处理成功,NO为不处理。
380 | */
381 | + (BOOL)handleOpenUrl:(NSURL *)url;
382 |
383 | /**
384 | 分享
385 |
386 | @param message 分享参数
387 | @param handler 分享之后的回调
388 | */
389 | + (void)share:(JSHAREMessage *)message
390 | handler:(JSHAREStateHandler)handler;
391 |
392 | /**
393 | 分享 仅支持JChatPro
394 | @param message 分享参数
395 | @param handler 分享之后的回调
396 | */
397 | + (void)share:(JSHAREMessage *)message
398 | completionHandler:(JSHARECompletionHandler)handler;
399 |
400 |
401 |
402 | /**
403 | 获取社交平台用户信息
404 |
405 | @param platform 社交平台参数,JSHAREPlatformWechatSession表示微信平台,JSHAREPlatformQQ表示 QQ 平台,JSHAREPlatformSinaWeibo,表示新浪微博平台。
406 | @param handler 获取社交平台用户信息的回调
407 | */
408 | + (void)getSocialUserInfo:(JSHAREPlatform)platform
409 | handler:(JSHARESocialHandler)handler;
410 |
411 |
412 | /**
413 | 检查用户授权之后信息是否过期。
414 |
415 | @param platform 社交平台。
416 | @return 结果,YES 表示该社交平台已授权。NO 表示未授权或授权信息已过期。
417 | */
418 | + (BOOL)isPlatformAuth:(JSHAREPlatform)platform;
419 |
420 |
421 | /**
422 | 删除用户授权本地数据
423 |
424 | @param platfrom 社交平台。
425 | @return 取消结果,YES 表示已取消。
426 | */
427 | + (BOOL)cancelAuthWithPlatform:(JSHAREPlatform)platfrom;
428 |
429 |
430 | /**
431 | 检查不存在新浪客户端情况下的网页端是否登陆
432 |
433 | @return 返回结果
434 | */
435 | + (BOOL)isSinaWeiboWebLogined;
436 |
437 |
438 | /**
439 | 登出新浪网页端最新帐号
440 |
441 | @return 返回结果
442 | */
443 | + (BOOL)sinaWeiboWebLogOut;
444 |
445 |
446 | /**
447 | 检查是否安装微信客户端
448 |
449 | @return 返回结果
450 | */
451 | + (BOOL)isWeChatInstalled;
452 |
453 | /**
454 | 检查是否存在QQ客户端
455 |
456 | @return 返回结果
457 | */
458 | + (BOOL)isQQInstalled;
459 |
460 |
461 | /**
462 | 检查是否存在 facebook 客户端
463 |
464 | @return 返回结果
465 | */
466 | + (BOOL)isFacebookInstalled;
467 |
468 |
469 | /**
470 | 检查是否存在 facebookMessenger 客户端
471 |
472 | @return 返回结果
473 | */
474 | + (BOOL)isFacebookMessengerInstalled;
475 |
476 | /**
477 | 检查是否存在新浪微博客户端
478 |
479 | @return 返回结果
480 | */
481 | + (BOOL)isSinaWeiBoInstalled;
482 |
483 | /**
484 | 检查是否存在Twitter客户端
485 |
486 | @return 返回结果
487 | */
488 | + (BOOL)isTwitterInstalled;
489 |
490 | /**
491 | 检查是否存在JChatPro客户端
492 |
493 | @return 返回结果
494 | */
495 | + (BOOL)isJChatProInstalled;
496 |
497 |
498 |
499 | /**
500 | @abstract 设置是否打印sdk产生的Debug级log信息, 默认为NO(不打印log)
501 |
502 | SDK 默认开启的日志级别为: Info. 只显示必要的信息, 不打印调试日志.
503 |
504 | 请在SDK启动后调用本接口,调用本接口可打开日志级别为: Debug, 打印调试日志.
505 | 请在发布产品时改为NO,避免产生不必要的IO
506 |
507 | 此接口必须在"setupWithConfig:"之后调用才会生效.
508 | @param enable 是否打印
509 | */
510 | + (void)setDebug:(BOOL)enable;
511 |
512 |
513 | @end
514 |
515 |
516 | /**
517 | 社交平台授权信息。
518 | */
519 | @interface JSHARESocial : NSObject
520 |
521 | /**
522 | 对应新浪微博平台的uid,以及QQ与微信平台可能会存在的unionid,Twitter平台对应的userID
523 | */
524 | @property (nonatomic, copy) NSString *uid;
525 |
526 | /**
527 | 对应QQ与微信平台授权提供的openId。
528 | */
529 | @property (nonatomic, copy) NSString *openid;
530 |
531 | /**
532 | accessToken 用户允许授权获取的 accessToken
533 | */
534 | @property (nonatomic, copy) NSString *accessToken;
535 |
536 | /**
537 | accessToken有效期的时间戳,单位为秒。
538 | Twitter平台为空
539 | */
540 | @property (nonatomic, assign) long expiration;
541 |
542 | /**
543 | refreshToken 用来刷新 accessToken 的有效期。
544 | Twitter平台为空
545 | */
546 | @property (nonatomic, copy) NSString *refreshToken;
547 |
548 |
549 | /**
550 | 对应的社交平台。
551 | */
552 | @property (nonatomic, assign) JSHAREPlatform platform;
553 |
554 | /**
555 | 社交平台提供的授权原始数据。
556 | */
557 | @property (nonatomic,strong) NSDictionary *oauthOriginalResponse;
558 |
559 | @end
560 |
561 |
562 | @interface JSHARESocialUserInfo : JSHARESocial
563 |
564 | /**
565 | 社交平台的用户昵称。
566 | */
567 | @property (nonatomic, copy) NSString *name;
568 |
569 | /**
570 | 社交平台的用户头像链接。
571 | */
572 | @property (nonatomic, copy) NSString *iconurl;
573 |
574 | /**
575 | 社交平台的用户性别,数值1表示男,数值2表示女。
576 | Twitter平台为空
577 | */
578 | @property (nonatomic, assign) NSInteger gender;
579 |
580 | /**
581 | 社交平台提供的用户信息原始数据。
582 | */
583 | @property (nonatomic, strong) NSDictionary *userOriginalResponse;
584 |
585 | @end
586 |
587 |
--------------------------------------------------------------------------------
/example/react-native-ios/main_activity.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import React from 'react';
4 | var {
5 | Component,
6 | } = React;
7 |
8 | import PropTypes from 'prop-types';
9 | import ReactNative from 'react-native';
10 | import JShareModule from 'jshare-react-native';
11 |
12 | const {
13 | View,
14 | Text,
15 | TouchableHighlight,
16 | StyleSheet,
17 | TextInput,
18 | Keyboard,
19 | Alert,
20 | TouchableWithoutFeedback,
21 | NativeAppEventEmitter,
22 | ScrollView,
23 | CameraRoll
24 | } = ReactNative;
25 |
26 | export default class MainActivity extends React.Component {
27 | constructor(props) {
28 | super(props);
29 | this.state = {
30 | imagePath: "",
31 | videoPath: "",
32 | emotionPath: ""
33 | }
34 |
35 | JShareModule.setup()
36 | }
37 |
38 | componentWillMount() {
39 |
40 | NativeAppEventEmitter.addListener('finishGetResource', (result) => {
41 | Alert.alert('das','fads')
42 | this.setState({
43 | imagePath: result.imagePath ,
44 | videoPath: result.videoPath,
45 | emotionPath: result.emotionPath,
46 | });
47 | console.log(this.state)
48 | });
49 | }
50 |
51 | onGetUserInfo = () => {
52 | var param = {
53 | platform: "wechat"
54 | };
55 |
56 | JShareModule.authorize(param, (map) => {
57 | // console.log(map);
58 | Alert.alert("getSocialUserInfo", JSON.stringify(map));
59 | }, (err) => {
60 | Alert.alert("errorCode: ", JSON.stringify(err));
61 | });
62 | }
63 |
64 | onPlatformAuth = () => {
65 | var param = {
66 | platform: "twitter"
67 | };
68 | JShareModule.isPlatformAuth(param, (result) => {
69 | console.log(param.platform + "is Auth: " + result);
70 | });
71 | }
72 |
73 | onRemoveAuthorize = () => {
74 | var param = {
75 | platform: "wechat_session"
76 | };
77 | JShareModule.cancelAuthWithPlatform(param, (code) => {
78 | if (code === 0) {
79 | console.log("remove authorize succeed" + code);
80 | } else {
81 | console.log("remove authorize failed, errorCode: " + code);
82 | }
83 | });
84 | }
85 |
86 | onShareTextPress = () => {
87 | var shareParam = {
88 | platform: "twitter",
89 | type: "text",
90 | text: "JShare test text",
91 | imagePath: ""
92 | };
93 | shareParam.imagePath = this.state.imagePath
94 | JShareModule.share(shareParam, (map) => {
95 | console.log("share succeed, map: " + map);
96 | }, (map) => {
97 | console.log("share failed, map: " + map);
98 | });
99 | }
100 |
101 | onShareImagePress = () => {
102 | /* {
103 | * type: 'image'
104 | * platform: platformString //
105 | * imagePath: String // 本地图片路径 imagePath, imageUrl imageArray 必须三选一
106 | * imageUrl: String // 网络图片地址,必须以 http 或 https 开头,imagePath, imageUrl imageArray 必须三选一
107 | * imageArray: [String] // (选填: 分享到 Qzone 才提供这个字段) 如果需要分享多张图片需要这个参数,数组中问题图片路径 imagePath, imageUrl imageArray 必须三选一
108 | * }
109 | */
110 | // Done
111 | console.log(this.state.path)
112 |
113 | var shareParam = {
114 | platform: "twitter",
115 | type: "image",
116 | text: "JShare test text",
117 | imageUrl: "",
118 | imagePath: ""
119 | }
120 | shareParam.imagePath = this.state.imagePath
121 | JShareModule.share(shareParam, (map) => {
122 | console.log("share succeed, map: " + map);
123 | }, (map) => {
124 | console.log("share failed, map: " + map);
125 | });
126 | }
127 |
128 | onShareVideoPress = () => {
129 | /* {
130 | * type: 'video'
131 | * platform: platformString //
132 | * title: String // 选填
133 | * url: String // 视频 url
134 | * text: String // 选填
135 | * imagePath: String // 选填,缩略图,本地图片路径
136 | *
137 | * videoUrl: String // QQ 空间本地视频 或者
138 | * !! iOS 相册视频,可传ALAsset的ALAssetPropertyAssetURL,或者 PHAsset 的 localIdentifier。
139 | * }
140 | */
141 | var shareParam = {
142 | platform: "twitter",
143 | type: "video",
144 | title: "the video",
145 | text: "JShare test text",
146 | url: "http://v.youku.com/v_show/id_XMjkwNzMzMjgzNg==.html?spm=a2hww.20023042.m_224239.5~5!2~5~5!3~5~5~A",
147 | imagePath: "",
148 | videoUrl: "",
149 | };
150 | shareParam.imagePath = this.state.imagePath
151 |
152 | JShareModule.share(shareParam, (map) => {
153 | console.log("share succeed, map: " + map);
154 | }, (map) => {
155 | console.log("share failed, map: " + map);
156 | });
157 | }
158 |
159 | onShareAudioPress = () => {
160 |
161 | /* {
162 | * type: 'audio'
163 | * platform: platformString //
164 | * musicUrl: String //必填 点击直接播放的 url
165 | * url: String //选填,点击跳转的 url
166 | * imagePath: String //选填,缩略图,本地图片路径,imagePath,imageUrl 必须二选一
167 | * imageUrl: String // 选填,网络图片路径,imagePath, imageUrl 必须二选一
168 | * title: String // 选填
169 | * text: String // 选填
170 | * }
171 | */
172 | var shareParam = {
173 | platform: "twitter",
174 | type: "audio",
175 | musicUrl: "",
176 | text: "JShare test text",
177 | url: "www.jiguang.cn",
178 | title: "audio",
179 | imagePath: "",
180 | };
181 | shareParam.imagePath = this.state.imagePath
182 |
183 | JShareModule.share(shareParam, (map) => {
184 | console.log("share succeed, map: " + map);
185 | }, (map) => {
186 | console.log("share failed, map: " + map);
187 | });
188 | }
189 |
190 | onShareFilePress = () => {
191 | var shareParam = {
192 | platform: "wechat_session",
193 | type: "file",
194 | path: "",
195 | fileExt: "to share file type"
196 | };
197 | shareParam.path = this.state.videoPath
198 | JShareModule.share(shareParam, (map) => {
199 | console.log("share succeed, map: " + map);
200 | }, (map) => {
201 | console.log("share failed, map: " + map);
202 | });
203 | }
204 |
205 | onShareEmoticonPress = () => {
206 | var shareParam = {
207 | platform: "twitter",
208 | type: "emoticon",
209 | imagePath: ""
210 | };
211 | shareParam.imagePath = this.state.emotionPath
212 | JShareModule.share(shareParam, (map) => {
213 | console.log("share succeed, map: " + map);
214 | }, (map) => {
215 | console.log("share failed, map: " + map);
216 | });
217 | }
218 |
219 | onShareAppPress = () => {
220 | // Done
221 | var shareParam = {
222 | platform: "twitter",
223 | type: "app",
224 | text: "JShare test text",
225 | title: "my app",
226 | url: "www.jiguang.cn",
227 | extInfo: "ext info string",
228 | path: ""
229 | };
230 | shareParam.path = this.state.imagePath
231 |
232 | JShareModule.share(shareParam, (map) => {
233 | console.log("share succeed, map: " + map);
234 | }, (map) => {
235 | console.log("share failed, map: " + map);
236 | });
237 | }
238 |
239 | onShareLinkPress = () => {
240 |
241 | /* {
242 | * type: 'link'
243 | * platform: platformString //
244 | * url: String // 必填,网页 url
245 | * imagePath: String // 选填,本地图片路径 imagePath,imageUrl 必须二选一
246 | * imageUrl: String // 选填,网络图片地址 imagePath imageUrl 必须二选一
247 | * title: String // 选填
248 | * text: String // 选填
249 | * }
250 | */
251 | // Done
252 | var shareParam = {
253 | platform: "twitter",
254 | type: "link",
255 | url: "www.baidu.com",
256 | imagePath: "",
257 | imageUrl: "",
258 | title: " shared link",
259 | text: "the web link",
260 | };
261 | shareParam.imagePath = this.state.imagePath
262 |
263 | JShareModule.share(shareParam, (map) => {
264 | console.log("share succeed, map: " + map);
265 | }, (map) => {
266 | console.log("share failed, map: " + map);
267 | });
268 | }
269 |
270 | onShareLocalVideoPress = () => {
271 |
272 |
273 | CameraRoll.getPhotos({
274 | first: 20,
275 | assetType: 'Videos',
276 | })
277 | .then(r => {
278 | // this.setState({ photos: r.edges });
279 | if (r.edges.length < 1) {
280 | Alert.alert("alert", "系统相册视频数量少于 1 个分享失败")
281 | return
282 | }
283 |
284 | var shareParam = {
285 | platform: "twitter",
286 | type: "video",
287 | title: "the video",
288 | text: "JShare test text",
289 | };
290 | shareParam.videoAssetURL = r.edges[0]['node']['image']['uri']
291 |
292 | JShareModule.share(shareParam, (map) => {
293 | console.log("share succeed, map: " + map);
294 | }, (map) => {
295 | console.log("share failed, map: " + map);
296 | });
297 | })
298 | .catch((err) => {
299 | //Error Loading Images
300 | });
301 | }
302 |
303 | render() {
304 | return (
305 |
306 |
307 | { this.setState({path: e})} }>
312 |
313 |
318 |
319 | Get userInfo
320 |
321 |
322 |
327 |
328 | Is Platform auth
329 |
330 |
331 |
336 |
337 | Remove authorize
338 |
339 |
340 |
345 |
346 | Share Text
347 |
348 |
349 |
354 |
355 | Share Image
356 |
357 |
358 |
363 |
364 | Share Video
365 |
366 |
367 |
372 |
373 | Share Audio
374 |
375 |
376 |
381 |
382 | Share File
383 |
384 |
385 |
390 |
391 | Share Emoticon
392 |
393 |
394 |
399 |
400 | Share App
401 |
402 |
403 |
408 |
409 | Share Link
410 |
411 |
412 |
417 |
418 | share local video to facebook
419 |
420 |
421 | {
424 | JShareModule.getSocialUserInfo({platform:'qq'}, (success) => {
425 | Alert.alert(JSON.stringify(success))
426 | }, (error) => {})
427 |
428 | }}
429 | />
430 |
431 |
432 | );
433 | }
434 | }
435 |
436 | class FormButton extends Component {
437 | static propTypes = {
438 | title: PropTypes.string,
439 | onPress: PropTypes.func
440 | }
441 |
442 | constructor(props) {
443 | super(props);
444 | this.title = props.title
445 | this.onPress = this.onPress.bind(this);
446 | }
447 |
448 | onPress() {
449 | if (!this.props.onPress) {
450 | return;
451 | }
452 | this.props.onPress();
453 | }
454 |
455 | render () {
456 | return (
457 |
462 |
463 | {this.props.title}
464 |
465 |
466 |
467 | )
468 | }
469 | }
470 | var styles = StyleSheet.create({
471 | welcome: {
472 | textAlign: 'center',
473 | margin: 10,
474 | },
475 | btnStyle: {
476 | marginTop: 10,
477 | borderWidth: 1,
478 | borderColor: '#3e83d7',
479 | borderRadius: 8,
480 | backgroundColor: '#3e83d7',
481 | alignSelf: 'center',
482 | justifyContent: 'center'
483 | },
484 | btnTextStyle: {
485 | textAlign: 'center',
486 | fontSize: 25,
487 | color: '#ffffff'
488 | },
489 | tagInput: {
490 | flex: 1,
491 | marginTop: 10,
492 | fontSize: 15,
493 | marginLeft: 5,
494 | marginRight: 5,
495 | height: 20,
496 | color: '#000000'
497 | },
498 | });
--------------------------------------------------------------------------------
/docs/API.md:
--------------------------------------------------------------------------------
1 | # API List
2 |
3 | JShare plugin's APIs list.
4 |
5 | ## Usage
6 |
7 | ```javascript
8 | // xxx means function name, some have callbacks.
9 | JShareModule.xxx();
10 | ```
11 |
12 | - **setup()** : 1.3.0 之后版本将不再需要填写平台参数。
13 | ```javascript
14 | /**
15 | * iOS Only
16 | */
17 | JShareModule.setup()
18 | ```
19 |
20 | - **getPlatformList(cb)**
21 |
22 | ```javascript
23 | /**
24 | * 获取SDK所有能用的平台名称,如要使用某个平台,必须在JGShareSDK.xml中配置。
25 | * Android only
26 | * @param {Function} callback 返回值 list 是一个数组
27 | */
28 | ```
29 |
30 | usage:
31 | ```javascript
32 | JShareModule.getPlatformList((list) => {
33 | console.log(list);
34 | });
35 | ```
36 |
37 | - **share(message, successCallback, failCallback)**
38 |
39 | ```javascript
40 | /**
41 | * 分享
42 | * @param {object} message = {
43 | *
44 | * platformString 必填,用于分享置不同的平台 //可以是 'wechat_session' /
45 | * 'wechat_timeLine' /
46 | * 'wechat_favourite' /
47 | * 'qq' /
48 | * 'qzone' /
49 | * 'sina_weibo' /
50 | * 'sina_weibo_contact' /
51 | * 'facebook' /
52 | * 'facebook_messenger' /
53 | * 'twitter' /
54 | * 'jchat_pro'
55 | * type 必填
56 | *
57 | * {
58 | * type: 'text'
59 | * platform: platformString // 分享到指定平台
60 | * text: String
61 | * imagePath: // 选填,本地图片地址,新浪微博(iOS 不支持这个字段)
62 | * appName: // 选填,应用名称,趣聊
63 | * targetPkg: // 选填,点击消息时跳转应用的包名,趣聊
64 | * targetClass: // 选填,点击消息时跳转应用的类名,趣聊
65 | * extra: // 选填,点击消息跳转到第三方应用时带的extra信息,趣聊
66 | * url: // 选填,点击消息时跳转应用的url,趣聊
67 | * callBackUrl: // 选填,点击消息跳转第三方应用失败时,回调的url,趣聊
68 | * }
69 | *
70 | * {
71 | * type: 'image'
72 | * platform: platformString // 分享到指定平台
73 | * imagePath: String // 本地图片路径 imagePath, imageUrl imageArray 必须三选一
74 | * text: String // 选填
75 | * imageUrl: String // 网络图片地址,必须以 http 或 https 开头,imagePath, imageUrl imageArray 必须三选一
76 | * imageArray: [String] // (选填: 分享到 Qzone 才提供这个字段) 如果需要分享多张图片需要这个参数,数组中问题图片路径 imagePath, imageUrl imageArray 必须三选一
77 | * appName: // 选填,应用名称,趣聊
78 | * targetPkg: // 选填,点击消息时跳转应用的包名,趣聊
79 | * targetClass: // 选填,点击消息时跳转应用的类名,趣聊
80 | * extra: // 选填,点击消息跳转到第三方应用时带的extra信息,趣聊
81 | * url: // 选填,点击消息时跳转应用的url,趣聊
82 | * callBackUrl: // 选填,点击消息跳转第三方应用失败时,回调的url,趣聊
83 | * }
84 | *
85 | * {
86 | * type: 'image_text'
87 | * platform: platformString // 分享到指定平台,目前只支持趣聊
88 | * appName: String // 选填,应用名称,趣聊
89 | * title: String // 选填,消息标题,趣聊
90 | * text: String // 消息内容,趣聊
91 | * imageUrl: String // 选填,缩略图网络图片地址,趣聊
92 | * targetPkg: String // 选填,点击消息时跳转应用的包名,趣聊
93 | * targetClass: String // 选填,点击消息时跳转应用的类名,趣聊
94 | * extra: String // 选填,点击消息跳转到第三方应用时带的extra信息,趣聊
95 | * url: String // 选填,点击消息时跳转应用的url,趣聊
96 | * callBackUrl: String // 选填,点击消息跳转第三方应用失败时,回调的url,趣聊
97 | * }
98 | *
99 | * {
100 | * type: 'video'
101 | * platform: platformString // 分享到指定平台
102 | * title: String // 选填
103 | * url: String // 视频跳转页面 url
104 | * text: String // 选填
105 | * imagePath: String // 选填,缩略图,本地图片路径
106 |
107 | * videoAssetURL: string // videoAssetURL:系统相册视频文件的 url(videoAssetURL 正确格式: assets-library://asset/asset.MOV?id=872C1D2F-97FD-4B0B-9C21-A619E4F23293&ext=MOV) (iOS only),facebook 只支持使用 videoAssetURL 来发送本地视频(不支持 url)。
108 | * videoUrl: String // QQ 空间本地视频 (iOS 不支持这个字段)
109 | * }
110 | *
111 | * {
112 | * type: 'audio'
113 | * platform: platformString // 分享到指定平台
114 | * musicUrl: String //必填 点击直接播放的 urlurl
115 | * url: String //选填,点击跳转的 url
116 | * imagePath: String //选填,缩略图,本地图片路径,imagePath,imageUrl 必须二选一
117 | * imageUrl: String // 选填,网络图片路径,imagePath, imageUrl 必须二选一
118 | * title: String // 选填
119 | * text: String // 选填
120 | * }
121 | *
122 | * {
123 | * type: 'file'
124 | * platform: platformString // 分享到指定平台
125 | * path: String // 必填,文件路径
126 | * fileExt: String // 必填,文件类型后缀
127 | * tile: String
128 | * }
129 | *
130 | * {
131 | * type: 'emoticon'
132 | * platform: platformString // 分享到指定平台
133 | * imagePath: String // 必填,本地图片路径
134 | * }
135 | *
136 | * {
137 | * type: 'app' // wechat_favourite 不支持
138 | * platform: platformString // 分享到指定平台
139 | * url: String // 点击跳转 url
140 | * extInfo: String // 选填 第三方应用自定义数据
141 | * path: String // 选填 对应 app 数据文件
142 | * title: String // 选填
143 | * text: String // 选填
144 | * }
145 | *
146 | * {
147 | * type: 'link'
148 | * platform: platformString // 分享到指定平台
149 | * url: String // 必填,网页 url
150 | * imagePath: String // 选填,本地图片路径 imagePath,imageUrl 必须二选一
151 | * imageUrl: String // 选填,网络图片地址 imagePath imageUrl 必须二选一,不支持Android wechat
152 | * title: String // 选填
153 | * text: String // 选填
154 | * }
155 | *
156 | * {
157 | * type: 'undefined'
158 | * platform: platformString // 分享到指定平台
159 | * }
160 | *
161 | * @param {Function} success = function (state) {} ##
162 | * state = {state: String} state = 'success' / 'fail' / 'cancel' / 'unknow'
163 | *
164 | * @param {Function} fail = function (error) {} ##
165 | * error = {code: number, descript: String}
166 | */
167 | ```
168 |
169 | usage:
170 |
171 | ```javascript
172 | var message = {
173 | platform: "wechat_session",
174 | type: "image",
175 | text: "JShare test text",
176 | imagePath: "/storage/emulated/0/DCIM/Camera/xx.jpg"
177 | };
178 | JShareModule.share(message, (map) => {
179 | console.log("share succeed, map: " + map);
180 | }, (map) => {
181 | console.log("share failed, map: " + map);
182 | })
183 | ```
184 |
185 |
186 |
187 |
188 | - **getSocialUserInfo(param, successCallback, failCallback)**
189 |
190 | ```javascript
191 | /**
192 | * 获取社交平台用户信息
193 | * @param {Object} param = {
194 | * platform: String //可以是 'wechat_session' /
195 | * 'wechat_timeLine' /
196 | * 'wechat_favourite' /
197 | * 'qq' /
198 | * 'qzone' /
199 | * 'sina_weibo' /
200 | * 'sina_weibo_contact' /
201 | * 'facebook' /
202 | * 'twitter' /
203 | * 'jchat_pro'
204 | * }
205 | * @param {Function} success function (userInfo) {}
206 | * userInfo = {
207 | * name: String
208 | * iconUrl: String // 社交平台头像链接
209 | * gender: String // 'female' / 'male'
210 | * response: String // 社交平台上的原始数据, 返回 JSON 字符串
211 | * }
212 | *
213 | * @param {Function} fail = function (error) {} ##
214 | * error = {code: number, descript: String}
215 | */
216 | ```
217 |
218 | usage:
219 |
220 | ```javascript
221 | var param = {
222 | platform: "wechat_session"
223 | };
224 | JShareModule.getSocialUserInfo(param, (map) => {
225 | console.log(map);
226 | }, (errorCode) => {
227 | console.log("errorCode: " + errorCode);
228 | });
229 | ```
230 |
231 | - **isPlatformAuth(param, callback)**
232 |
233 | ```javascript
234 | /**
235 | * 判断某平台是否已经授权
236 | *
237 | * @param {Object} param = {
238 | * platform: String //可以是 'wechat_session' /
239 | * 'wechat_timeLine' /
240 | * 'wechat_favourite' /
241 | * 'qq' /
242 | * 'qzone' /
243 | * 'sina_weibo' /
244 | * 'sina_weibo_contact' /
245 | * 'facebook' /
246 | * 'facebook_messenger' /
247 | * 'twitter' /
248 | * 'jchat_pro'
249 | * }
250 | * @param {Function} callback = (Boolean) => {}
251 | */
252 | ```
253 |
254 | usage:
255 |
256 | ```javascript
257 | var param = {
258 | platform: "wechat_session"
259 | };
260 | JShareModule.isPlatformAuth(param, (result) => {
261 | console.log(param.platform + "is Auth: " + result);
262 | });
263 | ```
264 |
265 | - **isClientValid(param, callback)**
266 | ```javascript
267 | /**
268 | * 判断该平台的分享是否有效
269 | * Android only
270 | * @param {Object} param = {
271 | * platform: String //可以是 'wechat_session' /
272 | * 'wechat_timeLine' /
273 | * 'wechat_favourite' /
274 | * 'qq' /
275 | * 'qzone' /
276 | * 'sina_weibo' /
277 | * 'sina_weibo_contact' /
278 | * 'facebook' /
279 | * 'facebook_messenger'/
280 | * 'twitter' /
281 | * 'jchat_pro'
282 | * }
283 | * @param {Function} callback = (Boolean) => {}
284 | */
285 | ```
286 |
287 | usage:
288 |
289 | ```javascript
290 | var param = {
291 | platform: "wechat_session"
292 | };
293 | JShareModule.isClientValid(param, (result) => {
294 | console.log(param.platform + "is valid: " + result);
295 | });
296 | ```
297 |
298 | - **authorize(param, successCallback, failCallback)**
299 |
300 | ```javascript
301 | /**
302 | * 授权接口
303 | * @param {Object} param = {
304 | * platform: String //可以是 'wechat' /
305 | * 'qq' /
306 | * 'weibo' /
307 | * 'facebook'/
308 | * 'twitter' /
309 | * 'jchat_pro'
310 | * }
311 | * @param {Function} success
312 | * @param {Function} fail
313 | */
314 | ```
315 |
316 | usage:
317 |
318 | ```javascript
319 | var param = {
320 | platform: "wechat_session"
321 | };
322 | JShareModule.authorize(param, (map) => {
323 | console.log("Authorize succeed " + map);
324 | }, (errorCode) => {
325 | console.log("Authorize failed, errorCode : " + errorCode);
326 | });
327 | ```
328 |
329 | - **isSupportAuthorize(param, callback) Android Only**
330 | ```javascript
331 | /**
332 | * 判断平台是否支持授权接口, NOTE:Android Only
333 | * @param {Object} param = {
334 | * platform: String //可以是 'wechat_session' /
335 | * 'wechat_timeLine' /
336 | * 'wechat_favourite' /
337 | * 'qq' /
338 | * 'qzone' /
339 | * 'sina_weibo' /
340 | * 'sina_weibo_contact' /
341 | * 'facebook' /
342 | * 'facebook_messenger'/
343 | * 'twitter' /
344 | * 'jchat_pro'
345 | * }
346 | * @param {Function} callback = (Boolean) => {}
347 | */
348 | ```
349 |
350 | usage:
351 |
352 | ```javascript
353 | var param = {
354 | platform: "wechat_session"
355 | };
356 | JShareModule.isSupportAuthorize(param, (result) => {
357 | console.log("param is Authorize: " + result);
358 | });
359 | ```
360 |
361 | - **cancelAuthWithPlatform(param, callback)**
362 |
363 | ```javascript
364 | /**
365 | * 删除用户授权本地数据
366 | *
367 | * @param {Object} param = {
368 | * platform: String //可以是 'wechat_session' /
369 | * 'wechat_timeLine' /
370 | * 'wechat_favourite' /
371 | * 'qq' /
372 | * 'qzone' /
373 | * 'sina_weibo' /
374 | * 'sina_weibo_contact'/
375 | * 'twitter'/
376 | * 'jchat_pro'/
377 | * }
378 | * @param {Function} callback = (Int) => {}
379 | * @code 返回码,0 表示成功删除
380 | */
381 | ```
382 |
383 | usage:
384 |
385 | ```javascript
386 | var param = {
387 | platform: "wechat_session"
388 | };
389 | JShareModule.cancelAuthWithPlatform(param, (code) => {
390 | if (code === 0) {
391 | console.log("remove authorize succeed");
392 | } else {
393 | console.log("remove authorize failed, errorCode: " + code);
394 | }
395 | });
396 | ```
397 |
398 |
399 | - **isSinaWeiboWebLogined(callback)**
400 |
401 | ```javascript
402 | /**
403 | * 检查不存在新浪客户端情况下的网页端是否登陆
404 | *
405 | * iOS Only
406 | * @param {Function} success = (Boolean) => {}
407 | */
408 | ```
409 |
410 | usage:
411 |
412 | ```javascript
413 | JShareModule.isSinaWeiboWebLogined((isLogin) => {
414 | if (isLogin === true) {
415 | console.log("sina weibo is login");
416 | } else {
417 | console.log("sina weibo is not login");
418 | }
419 | });
420 | ```
421 |
422 | - **sinaWeiboWebLogOut(callback)**
423 |
424 | ```javascript
425 | /**
426 | * 登出新浪网页端最新帐号
427 | *
428 | * iOS Only
429 | * @param {Function} success = (Boolean) => {}
430 | */
431 | ```
432 |
433 | usage:
434 |
435 | ```javascript
436 | JShareModule.sinaWeiboWebLogOut((success) => {
437 | if (success === true) {
438 | console.log("sina weibo logout success");
439 | } else {
440 | console.log("sina weibo logout fail");
441 | }
442 | });
443 | ```
444 |
445 | - **isWeChatInstalled(callback)**
446 |
447 | ```javascript
448 | /**
449 | * 检查是否安装微信客户端
450 | *
451 | * @param {Function} success = (Boolean) => {}
452 | */
453 | ```
454 |
455 | usage:
456 |
457 | ```javascript
458 | JShareModule.isWeChatInstalled((isInstalled) => {
459 | if (isInstalled === true) {
460 | console.log("wechat is intalled");
461 | } else {
462 | console.log("wechat is not installed");
463 | }
464 | });
465 | ```
466 |
467 | - **isQQInstalled(callback)**
468 |
469 | ```javascript
470 | /**
471 | * 检查是否存在QQ客户端
472 | *
473 | * @param {Function} success = (Boolean) => {}
474 | */
475 | ```
476 |
477 | usage:
478 |
479 | ```javascript
480 | JShareModule.isQQInstalled((isInstalled) => {
481 | if (isInstalled === true) {
482 | console.log("QQ is intalled");
483 | } else {
484 | console.log("QQ is not installed");
485 | }
486 | });
487 | ```
488 |
489 | - **isSinaWeiBoInstalled(callback)**
490 |
491 | ```javascript
492 | /**
493 | * 检查是否存在新浪微博客户端
494 | *
495 | * @param {Function} success = (Boolean) => {}
496 | */
497 | ```
498 |
499 | usage:
500 |
501 | ```javascript
502 | JShareModule.isSinaWeiBoInstalled((isInstalled) => {
503 | if (isInstalled === true) {
504 | console.log("sina weibo is intalled");
505 | } else {
506 | console.log("sina weibo is not installed");
507 | }
508 | });
509 | ```
510 |
511 | - **isFacebookInstalled(callback)**
512 |
513 | ```javascript
514 | /**
515 | * 检查是否存在 facebook 户端
516 | *
517 | * @param {Function} success = (Boolean) => {}
518 | */
519 | ```
520 |
521 | usage:
522 |
523 | ```javascript
524 | JShareModule.isFacebookInstalled((isInstalled) => {
525 | if (isInstalled === true) {
526 | console.log("sina weibo is intalled");
527 | } else {
528 | console.log("sina weibo is not installed");
529 | }
530 | });
531 | ```
532 |
533 | - **setDebug(param, callback),Android 建议在 MainApplication 中调用,[参考 demo](./../example/android/app/src/main/java/cn/jiguang/share/demo/MainApplication.java)**
534 |
535 | ```javascript
536 | /**
537 | *
538 | * @param {Object} param = {
539 | * enable: Boolean
540 | * }
541 | */
542 | ```
543 |
544 | usage:
545 |
546 | ```javascript
547 | JShareModule.setDebug({enable: true});
548 | ```
549 |
--------------------------------------------------------------------------------