|
@@ -17,6 +17,7 @@ import androidx.fragment.app.Fragment;
|
|
|
|
|
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
|
import com.common.im.ui.MessageFragment;
|
|
import com.common.im.ui.MessageFragment;
|
|
|
|
+import com.cooleshow.base.common.BaseApplication;
|
|
import com.cooleshow.base.constanst.LoginStatusConstants;
|
|
import com.cooleshow.base.constanst.LoginStatusConstants;
|
|
import com.cooleshow.base.event.LoginStatusEvent;
|
|
import com.cooleshow.base.event.LoginStatusEvent;
|
|
import com.cooleshow.base.router.RouterPath;
|
|
import com.cooleshow.base.router.RouterPath;
|
|
@@ -44,6 +45,7 @@ import org.greenrobot.eventbus.ThreadMode;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
+import cn.jpush.android.api.JPushInterface;
|
|
import io.rong.imkit.manager.UnReadMessageManager;
|
|
import io.rong.imkit.manager.UnReadMessageManager;
|
|
import io.rong.imlib.RongIMClient;
|
|
import io.rong.imlib.RongIMClient;
|
|
|
|
|
|
@@ -65,6 +67,7 @@ public class MainActivity extends BaseMVPActivity<ActivityMainBinding, MainPrese
|
|
private TextView tvMsgCount;
|
|
private TextView tvMsgCount;
|
|
private static final int EXIT_APP_DELAY = 1000;
|
|
private static final int EXIT_APP_DELAY = 1000;
|
|
private long lastTime = 0;
|
|
private long lastTime = 0;
|
|
|
|
+ private boolean isNeedSetPushId = true;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 打开首页并选中指定tab
|
|
* 打开首页并选中指定tab
|
|
@@ -236,6 +239,7 @@ public class MainActivity extends BaseMVPActivity<ActivityMainBinding, MainPrese
|
|
public void loadEventBus(LoginStatusEvent event) {
|
|
public void loadEventBus(LoginStatusEvent event) {
|
|
if (event != null && event.eventCode == LoginStatusConstants.LOGIN_OUT) {
|
|
if (event != null && event.eventCode == LoginStatusConstants.LOGIN_OUT) {
|
|
IMManager.getInstance().logout();
|
|
IMManager.getInstance().logout();
|
|
|
|
+ isNeedSetPushId = true;
|
|
LogUtils.i("pq", "LoginStatusEvent:logout");
|
|
LogUtils.i("pq", "LoginStatusEvent:logout");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -248,6 +252,16 @@ public class MainActivity extends BaseMVPActivity<ActivityMainBinding, MainPrese
|
|
//存储userInfo信息
|
|
//存储userInfo信息
|
|
UserHelper.saveUserInfo(userInfo);
|
|
UserHelper.saveUserInfo(userInfo);
|
|
connectIM();
|
|
connectIM();
|
|
|
|
+ bindPushId();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void bindPushId() {
|
|
|
|
+ if (isNeedSetPushId && UserHelper.isLogin() && !TextUtils.isEmpty(UserHelper.getUserId())) {
|
|
|
|
+ String userId = UserHelper.getUserId();
|
|
|
|
+ LogUtils.i("pq", "registrationId:" + BaseApplication.registrationId);
|
|
|
|
+ JPushInterface.setAlias(getApplicationContext(), 1, userId);
|
|
|
|
+ isNeedSetPushId = false;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|