From a11d7f07e9d8338a600e78c3ba4b8d637bc59561 Mon Sep 17 00:00:00 2001 From: 18142669586 <1669783059@qq.com> Date: Sat, 13 Jul 2024 11:26:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E6=92=ADim=E6=9C=AA=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=20=E4=BC=9A=E5=9C=A8=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E4=B8=80=E6=AC=A1=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/main/activity/MainActivity.java | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index 5764d71db..e1655c875 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -1,6 +1,7 @@ package com.yunbao.main.activity; import static com.yunbao.common.CommonAppContext.isReady; +import static com.yunbao.common.manager.imrongcloud.RongcloudIMManager.connectIM; import android.Manifest; import android.animation.Animator; @@ -52,6 +53,7 @@ import com.tencent.imsdk.v2.V2TIMSDKListener; import com.tencent.imsdk.v2.V2TIMUserFullInfo; import com.yunbao.common.bean.QiniuLog; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.utils.AppManager; import com.yunbao.common.utils.LogUtil; import com.yunbao.common.utils.MobclickAgent; import com.yunbao.common.CommonAppConfig; @@ -375,7 +377,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene RouteUtil.forwardLoginInvalid("登錄失效"); return; } - RongcloudIMManager.connectIM(mContext.getApplication()); + connectIM(mContext.getApplication()); position = 0; mTabButtonGroup.setCurPosition(0); } @@ -852,13 +854,30 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene } private void showStartDialog() { - if (isReady == true) { MainStartDialogFragment dialogFragment = new MainStartDialogFragment(); dialogFragment.setMainStartChooseCallback(true, this); dialogFragment.show(getSupportFragmentManager(), "MainStartDialogFragment"); } else { - ToastUtil.show("正在初始化,請稍等...."); + connectIM(AppManager.getInstance().getMainActivity(), new RongIMClient.ConnectCallback() { + @Override + public void onSuccess(String t) { + MainStartDialogFragment dialogFragment = new MainStartDialogFragment(); + dialogFragment.setMainStartChooseCallback(true, MainActivity.this); + dialogFragment.show(getSupportFragmentManager(), "MainStartDialogFragment"); + } + + @Override + public void onError(RongIMClient.ConnectionErrorCode e) { + ToastUtil.show(R.string.net_error+""+e.toString()); + } + + @Override + public void onDatabaseOpened(RongIMClient.DatabaseOpenStatus code) { + ToastUtil.show(R.string.net_error+""+code); + } + }); + } }