Ver Fonte

修改腾讯IM推送流程

Pq há 1 ano atrás
pai
commit
21c4619c92

+ 1 - 1
TUIKit/TUIChat/tuichat/src/main/java/com/tencent/qcloud/tuikit/tuichat/model/ChatProvider.java

@@ -313,7 +313,7 @@ public class ChatProvider {
         v2TIMOfflinePushInfo.setExt(new Gson().toJson(containerBean).getBytes());
         // OPPO必须设置ChannelID才可以收到推送消息,这个channelID需要和控制台一致
         // OPPO must set a ChannelID to receive push messages. This channelID needs to be the same as the console.
-        v2TIMOfflinePushInfo.setAndroidOPPOChannelID("gyt_im");
+        v2TIMOfflinePushInfo.setAndroidOPPOChannelID("klx_im");
         if (TUIChatConfigs.getConfigs().getGeneralConfig().isAndroidPrivateRing()) {
             v2TIMOfflinePushInfo.setAndroidSound(OfflinePushInfoUtils.PRIVATE_RING_NAME);
             v2TIMOfflinePushInfo.setAndroidFCMChannelID(OfflinePushInfoUtils.FCM_PUSH_CHANNEL_ID);

+ 1 - 1
TUIKit/TUIOfflinePush/tuiofflinepush/src/main/AndroidManifest.xml

@@ -55,7 +55,7 @@
                 <data
                     android:host="com.tencent.qcloud.uniapp"
                     android:path="/detail"
-                    android:scheme="pushscheme" />
+                    android:scheme="ttpushscheme" />
             </intent-filter>
         </activity>
 

+ 5 - 3
student/src/main/java/com/cooleshow/student/App.java

@@ -16,6 +16,7 @@ import com.cooleshow.base.utils.FileUtils;
 import com.cooleshow.base.utils.ProcessUtils;
 import com.cooleshow.base.utils.Utils;
 import com.cooleshow.base.widgets.CustomRefreshHeader;
+import com.cooleshow.student.helper.InitHelper;
 import com.cooleshow.usercenter.helper.UserHelper;
 import com.scwang.smart.refresh.footer.ClassicsFooter;
 import com.scwang.smart.refresh.layout.SmartRefreshLayout;
@@ -81,7 +82,7 @@ public class App extends BaseApplication {
         JPushInterface.setBadgeNumber(this,0);
         registrationId = JPushInterface.getRegistrationID(this);
         initBugly();
-        initRong();
+        initIM();
         initUmeng();
         //二维码扫描
         ZXingLibrary.initDisplayOpinion(this);
@@ -98,7 +99,7 @@ public class App extends BaseApplication {
             UMConfigure.init(this, "5f2b6f03b4b08b653e91a49e", "app", UMConfigure.DEVICE_TYPE_PHONE, null);
             //QQ官方sdk授权
             Tencent.setIsPermissionGranted(true);
-            String FileProvider = "com.cooleshow.student.fileprovider";
+            String FileProvider = this.getPackageName()+".fileprovider";
             PlatformConfig.setWeixin("wx97408cd22c879ff7", "665a1608a16631dee40d737b4d1a0ad1");
             PlatformConfig.setWXFileProvider(FileProvider);
             PlatformConfig.setSinaWeibo("3712190405", "e77924e0125dbd751bab61063d8338fb", "http://sns.whalecloud.com");
@@ -110,7 +111,8 @@ public class App extends BaseApplication {
         }
     }
 
-    private void initRong() {
+    private void initIM() {
+        InitHelper.initIM();
         EmojiManager.install(new IosEmojiProvider());
         /**
          * liveClass 相关开始

+ 17 - 1
student/src/main/java/com/cooleshow/student/helper/InitHelper.java

@@ -2,7 +2,9 @@ package com.cooleshow.student.helper;
 
 import com.cooleshow.base.common.BaseApplication;
 import com.cooleshow.base.utils.Utils;
+import com.cooleshow.usercenter.helper.UserHelper;
 import com.tencent.bugly.crashreport.CrashReport;
+import com.tencent.qcloud.tim.tuiofflinepush.PrivateConstants;
 import com.tencent.tauth.Tencent;
 import com.umeng.commonsdk.UMConfigure;
 import com.umeng.socialize.PlatformConfig;
@@ -17,6 +19,7 @@ public class InitHelper {
     public static void initSdK() {
         //bugly
         CrashReport.initCrashReport(Utils.getApp(), "b51fd73164", false);
+        initIM();
         //友盟
         UMConfigure.init(
                 Utils.getApp(),
@@ -26,7 +29,7 @@ public class InitHelper {
                 null
         );
         Tencent.setIsPermissionGranted(true);
-        String FileProvider = "com.cooleshow.student.fileprovider";
+        String FileProvider = Utils.getApp().getPackageName()+".fileprovider";
         PlatformConfig.setWeixin("wx97408cd22c879ff7", "665a1608a16631dee40d737b4d1a0ad1");
         PlatformConfig.setWXFileProvider(FileProvider);
         PlatformConfig.setSinaWeibo("3712190405", "e77924e0125dbd751bab61063d8338fb", "http://sns.whalecloud.com");
@@ -38,4 +41,17 @@ public class InitHelper {
         JCollectionAuth.setAuth(Utils.getApp(), true);
         BaseApplication.registrationId = JPushInterface.getRegistrationID(Utils.getApp());
     }
+
+    public static void initIM() {
+        if (UserHelper.isAgreePrivacy()) {
+            //todo 学生端已配置小米 其余需要验证
+            PrivateConstants.xiaomiPushBussinessId=31483;
+            PrivateConstants.xiaomiPushAppId = "2882303761520172242";
+            PrivateConstants.xiaomiPushAppKey = "5692017221242";
+            PrivateConstants.oppoPushBussinessId=31484;
+            PrivateConstants.oppoPushAppKey="72945e3136e4483ab8f512332fb5ddc5";
+            PrivateConstants.oppoPushAppSecret="9c1ad86dc42d4d62a1f7f763bcc3fc87";
+            PrivateConstants.vivoPushBussinessId=30512;
+        }
+    }
 }

+ 6 - 0
student/埋点事件模板.txt

@@ -22,3 +22,9 @@ klx_goodDetail,商品详情,0
 klx_payment,购买支付,0
 klx_cancelPayment,取消支付,0
 
+
+腾讯IM推送配置
+跳转Intent:intent://com.tencent.qcloud.uniapp/detail#Intent;scheme=ttpushscheme;launchFlags=0x4000000;component=com.cooleshow.student/com.cooleshow.student.ui.main.MainActivity;end
+PrivateConstants.xiaomiPushBussinessId=31483;
+PrivateConstants.xiaomiPushAppId = "2882303761520172242";
+PrivateConstants.xiaomiPushAppKey = "5692017221242";

+ 2 - 0
teacher/src/main/java/com/cooleshow/teacher/App.java

@@ -13,6 +13,7 @@ import com.cooleshow.base.utils.FileUtils;
 import com.cooleshow.base.utils.ProcessUtils;
 import com.cooleshow.base.utils.Utils;
 import com.cooleshow.base.widgets.CustomRefreshHeader;
+import com.cooleshow.teacher.helper.InitHelper;
 import com.cooleshow.usercenter.helper.UserHelper;
 import com.scwang.smart.refresh.footer.ClassicsFooter;
 import com.scwang.smart.refresh.layout.SmartRefreshLayout;
@@ -109,6 +110,7 @@ public class App extends BaseApplication {
     }
 
     private void initRong() {
+        InitHelper.initIM();
         EmojiManager.install(new IosEmojiProvider());
 
         /**

+ 16 - 0
teacher/src/main/java/com/cooleshow/teacher/helper/InitHelper.java

@@ -2,7 +2,9 @@ package com.cooleshow.teacher.helper;
 
 import com.cooleshow.base.common.BaseApplication;
 import com.cooleshow.base.utils.Utils;
+import com.cooleshow.usercenter.helper.UserHelper;
 import com.tencent.bugly.crashreport.CrashReport;
+import com.tencent.qcloud.tim.tuiofflinepush.PrivateConstants;
 import com.tencent.tauth.Tencent;
 import com.umeng.commonsdk.UMConfigure;
 import com.umeng.socialize.PlatformConfig;
@@ -16,6 +18,7 @@ import cn.jpush.android.api.JPushInterface;
 public class InitHelper {
     public static void initSdK() {
         CrashReport.initCrashReport(Utils.getApp(), "c4d163184a", false);
+        initIM();
         UMConfigure.submitPolicyGrantResult(Utils.getApp(),true);
         UMConfigure.preInit(Utils.getApp(), "62a8394605844627b5b0554b", "app");
         UMConfigure.init(
@@ -39,4 +42,17 @@ public class InitHelper {
         JCollectionAuth.setAuth(Utils.getApp(), true);
         BaseApplication.registrationId = JPushInterface.getRegistrationID(Utils.getApp());
     }
+
+
+    public static void initIM() {
+        if (UserHelper.isAgreePrivacy()) {
+//            PrivateConstants.xiaomiPushBussinessId=31483;
+//            PrivateConstants.xiaomiPushAppId = "2882303761520172242";
+//            PrivateConstants.xiaomiPushAppKey = "5692017221242";
+//            PrivateConstants.oppoPushBussinessId=31484;
+//            PrivateConstants.oppoPushAppKey="72945e3136e4483ab8f512332fb5ddc5";
+//            PrivateConstants.oppoPushAppSecret="9c1ad86dc42d4d62a1f7f763bcc3fc87";
+//            PrivateConstants.vivoPushBussinessId=30512;
+        }
+    }
 }