wennjie преди 6 години
родител
ревизия
c6f06d218c

+ 7 - 2
huiliaoJmessage/android/app/build.gradle

@@ -95,9 +95,13 @@ def enableProguardInReleaseBuilds = false
 
 android {
     compileSdkVersion rootProject.ext.compileSdkVersion
-
+//    sourceSets {
+//        main {
+//            jniLibs.srcDirs = ['libs']
+//        }
+//    }
     defaultConfig {
-        applicationId "com.zhch.huiliao"
+        applicationId "com.zhcy.huiliao"
         minSdkVersion rootProject.ext.minSdkVersion
         targetSdkVersion rootProject.ext.targetSdkVersion
         versionCode 1
@@ -151,6 +155,7 @@ dependencies {
     compile project(':react-native-audio')
     compile project(':jmessage-react-plugin')
     compile project(':aurora-imui-react-native')
+    compile project(':jcore-react-native')
     compile fileTree(dir: "libs", include: ["*.jar"])
     compile "com.android.support:appcompat-v7:27.1.0"
     compile "com.facebook.react:react-native:+"  // From node_modules

+ 18 - 10
huiliaoJmessage/android/app/src/main/java/com/huiliaojmessage/MainApplication.java

@@ -1,32 +1,36 @@
 package com.huiliaojmessage;
 
 import android.app.Application;
+import android.util.Log;
 
 import com.facebook.react.ReactApplication;
-import com.lynxit.contactswrapper.ContactsWrapperPackage;
-import com.xb.contactpicker.ReactNativeContacts;
-import com.reactnative.ivpusic.imagepicker.PickerPackage;
-import com.rnfs.RNFSPackage;
-import org.reactnative.camera.RNCameraPackage;
-import com.rnim.rn.audio.ReactNativeAudioPackage;
-import io.jchat.android.JMessageReactPackage;
-import cn.jiguang.imui.messagelist.ReactIMUIPackage;
 import com.facebook.react.ReactNativeHost;
 import com.facebook.react.ReactPackage;
 import com.facebook.react.shell.MainReactPackage;
 import com.facebook.soloader.SoLoader;
+import com.lynxit.contactswrapper.ContactsWrapperPackage;
+import com.reactnative.ivpusic.imagepicker.PickerPackage;
+import com.rnfs.RNFSPackage;
+import com.rnim.rn.audio.ReactNativeAudioPackage;
+import com.xb.contactpicker.ReactNativeContacts;
+
+import org.reactnative.camera.RNCameraPackage;
 
 import java.util.Arrays;
 import java.util.List;
 
-public class MainApplication extends Application implements ReactApplication {
+import cn.jiguang.imui.messagelist.ReactIMUIPackage;
+import cn.jpush.im.android.api.JMessageClient;
+import io.jchat.android.JMessageReactPackage;
 
+public class MainApplication extends Application implements ReactApplication {
+  private boolean shutdownToast = false;
   private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
     @Override
     public boolean getUseDeveloperSupport() {
       return BuildConfig.DEBUG;
     }
-    private boolean shutdownToast = false;
+
     @Override
     protected List<ReactPackage> getPackages() {
       return Arrays.<ReactPackage>asList(
@@ -58,5 +62,9 @@ public class MainApplication extends Application implements ReactApplication {
   public void onCreate() {
     super.onCreate();
     SoLoader.init(this, /* native exopackage */ false);
+    Log.i("MainApplication", "Init JMessageClient");
+    JMessageClient.setDebugMode(true);
+    // JMessage SDK 2.5.0 后必须在 MainApplication 中初始化
+    JMessageClient.init(this, true);
   }
 }

+ 3 - 0
huiliaoJmessage/android/settings.gradle

@@ -16,3 +16,6 @@ project(':jmessage-react-plugin').projectDir = new File(rootProject.projectDir,
 include ':app', ':aurora-imui-react-native'
 project(':aurora-imui-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/aurora-imui-react-native/ReactNative/android')
 include ':app'
+include ':jcore-react-native'
+project(':jcore-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/jcore-react-native/android')
+

+ 2 - 1
package.json

@@ -1,5 +1,6 @@
 {
   "dependencies": {
-    "aurora-imui-react-native": "^0.10.12"
+    "aurora-imui-react-native": "^0.10.12",
+    "jcore-react-native": "^1.2.9"
   }
 }

+ 4 - 0
yarn.lock

@@ -5,3 +5,7 @@
 aurora-imui-react-native@^0.10.12:
   version "0.10.12"
   resolved "http://registry.npm.taobao.org/aurora-imui-react-native/download/aurora-imui-react-native-0.10.12.tgz#505c6da19cd99bb6c88c9ccccdf2a1ca7781361e"
+
+jcore-react-native@^1.2.9:
+  version "1.2.9"
+  resolved "http://registry.npm.taobao.org/jcore-react-native/download/jcore-react-native-1.2.9.tgz#eacd99a4e0d09dde5da8c78bf050c1a7bbd235b4"