11111
This commit is contained in:
parent
1219b77e2d
commit
18aabb85a7
@ -6,10 +6,6 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
@ -20,6 +16,9 @@ import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.adjust.sdk.Adjust;
|
||||
import com.adjust.sdk.AdjustEvent;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
@ -37,6 +36,7 @@ import com.yunbao.common.bean.ConfigBean;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.custom.CircleProgress;
|
||||
import com.yunbao.common.event.DataUserInfoEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.CommonHttpConsts;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
@ -56,6 +56,10 @@ import com.yunbao.main.activity.MainActivity;
|
||||
import com.yunbao.main.http.MainHttpConsts;
|
||||
import com.yunbao.main.http.MainHttpUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -98,6 +102,7 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
EventBus.getDefault().register(this);
|
||||
setStatusBar();
|
||||
setContentView(R.layout.activity_launcher);
|
||||
//开屏
|
||||
@ -236,11 +241,17 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
||||
//融云连接服务器
|
||||
RongcloudIMManager.connectIM(this);
|
||||
forwardMainActivity();
|
||||
} else {
|
||||
//兼容老版本
|
||||
if (IMLoginManager.get(this).checkOLd()) {
|
||||
IMLoginManager.get(this).upDataUserInfo();
|
||||
} else {
|
||||
releaseVideo();
|
||||
this.startActivity(new Intent(this, EntryActivity.class));
|
||||
this.finish();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -256,6 +267,7 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
EventBus.getDefault().unregister(this);
|
||||
if (mHandler != null) {
|
||||
mHandler.removeCallbacksAndMessages(null);
|
||||
mHandler = null;
|
||||
@ -512,4 +524,17 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
||||
});
|
||||
mPlayer.startPlay(videoFile.getAbsolutePath(), TXLivePlayer.PLAY_TYPE_LOCAL_VIDEO);
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onDataUserInfoEvent(DataUserInfoEvent event) {
|
||||
if (event.isUpDataSuccess()) {
|
||||
//融云连接服务器
|
||||
RongcloudIMManager.connectIM(this);
|
||||
forwardMainActivity();
|
||||
} else {
|
||||
releaseVideo();
|
||||
this.startActivity(new Intent(this, EntryActivity.class));
|
||||
this.finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
/**
|
||||
* 更新用戶信息 成功
|
||||
*/
|
||||
public class DataUserInfoEvent extends BaseModel {
|
||||
private boolean upDataSuccess = false;
|
||||
|
||||
public boolean isUpDataSuccess() {
|
||||
return upDataSuccess;
|
||||
}
|
||||
|
||||
public DataUserInfoEvent setUpDataSuccess(boolean upDataSuccess) {
|
||||
this.upDataSuccess = upDataSuccess;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -2,21 +2,21 @@ package com.yunbao.common.manager;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.google.gson.Gson;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.event.DataUserInfoEvent;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.manager.base.BaseCacheManager;
|
||||
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
|
||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
|
||||
import java.util.Map;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
/**
|
||||
* 登录者信息管理
|
||||
@ -112,4 +112,39 @@ public class IMLoginManager extends BaseCacheManager {
|
||||
MessageIMManager.get(context).logout();
|
||||
}
|
||||
|
||||
/**
|
||||
* 檢查老版本信息是否純在
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean checkOLd() {
|
||||
String[] uidAndToken = SpUtil.getInstance().getMultiStringValue(new String[]{SpUtil.UID, SpUtil.TOKEN});
|
||||
String uid = uidAndToken[0];
|
||||
String token = uidAndToken[1];
|
||||
return (!TextUtils.isEmpty(uid) && !TextUtils.isEmpty(token));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用戶信息
|
||||
*/
|
||||
public void upDataUserInfo() {
|
||||
String[] uidAndToken = SpUtil.getInstance().getMultiStringValue(new String[]{SpUtil.UID, SpUtil.TOKEN});
|
||||
String uid = uidAndToken[0];
|
||||
String token = uidAndToken[1];
|
||||
HttpClient.getInstance().get("User.getBaseInfos", "getBaseInfo")
|
||||
.params("uid", uid)
|
||||
.params("token", token)
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
userInfo = new Gson().fromJson(info[0], IMLoginModel.class);
|
||||
EventBus.getDefault().post(new DataUserInfoEvent().setUpDataSuccess(true));
|
||||
} else {
|
||||
EventBus.getDefault().post(new DataUserInfoEvent().setUpDataSuccess(false));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,9 +9,9 @@ ext {
|
||||
]
|
||||
manifestPlaceholders = [
|
||||
//正式
|
||||
// serverHost : "https://napi.yaoulive.com",
|
||||
serverHost : "https://napi.yaoulive.com",
|
||||
//測試
|
||||
serverHost : "https://ceshi.yaoulive.com",
|
||||
// serverHost : "https://ceshi.yaoulive.com",
|
||||
|
||||
//腾讯地图
|
||||
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
|
||||
|
@ -275,6 +275,12 @@ public class MainHttpUtil {
|
||||
});
|
||||
}
|
||||
|
||||
public static void getBaseInfos(String uid, String token, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("User.getBaseInfos", MainHttpConsts.GET_BASE_INFO)
|
||||
.params("uid", uid)
|
||||
.params("token", token)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
|
Loading…
Reference in New Issue
Block a user