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.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
@ -20,6 +16,9 @@ import android.view.WindowManager;
|
|||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import com.adjust.sdk.Adjust;
|
import com.adjust.sdk.Adjust;
|
||||||
import com.adjust.sdk.AdjustEvent;
|
import com.adjust.sdk.AdjustEvent;
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
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.IMLoginModel;
|
||||||
import com.yunbao.common.bean.UserBean;
|
import com.yunbao.common.bean.UserBean;
|
||||||
import com.yunbao.common.custom.CircleProgress;
|
import com.yunbao.common.custom.CircleProgress;
|
||||||
|
import com.yunbao.common.event.DataUserInfoEvent;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
import com.yunbao.common.http.CommonHttpConsts;
|
import com.yunbao.common.http.CommonHttpConsts;
|
||||||
import com.yunbao.common.http.CommonHttpUtil;
|
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.MainHttpConsts;
|
||||||
import com.yunbao.main.http.MainHttpUtil;
|
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.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -98,6 +102,7 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
EventBus.getDefault().register(this);
|
||||||
setStatusBar();
|
setStatusBar();
|
||||||
setContentView(R.layout.activity_launcher);
|
setContentView(R.layout.activity_launcher);
|
||||||
//开屏
|
//开屏
|
||||||
@ -236,11 +241,17 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
|||||||
//融云连接服务器
|
//融云连接服务器
|
||||||
RongcloudIMManager.connectIM(this);
|
RongcloudIMManager.connectIM(this);
|
||||||
forwardMainActivity();
|
forwardMainActivity();
|
||||||
|
} else {
|
||||||
|
//兼容老版本
|
||||||
|
if (IMLoginManager.get(this).checkOLd()) {
|
||||||
|
IMLoginManager.get(this).upDataUserInfo();
|
||||||
} else {
|
} else {
|
||||||
releaseVideo();
|
releaseVideo();
|
||||||
this.startActivity(new Intent(this, EntryActivity.class));
|
this.startActivity(new Intent(this, EntryActivity.class));
|
||||||
this.finish();
|
this.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -256,6 +267,7 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
|
EventBus.getDefault().unregister(this);
|
||||||
if (mHandler != null) {
|
if (mHandler != null) {
|
||||||
mHandler.removeCallbacksAndMessages(null);
|
mHandler.removeCallbacksAndMessages(null);
|
||||||
mHandler = null;
|
mHandler = null;
|
||||||
@ -512,4 +524,17 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
|
|||||||
});
|
});
|
||||||
mPlayer.startPlay(videoFile.getAbsolutePath(), TXLivePlayer.PLAY_TYPE_LOCAL_VIDEO);
|
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.content.Context;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.util.Log;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.TypeReference;
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.yunbao.common.bean.IMLoginModel;
|
import com.yunbao.common.bean.IMLoginModel;
|
||||||
|
import com.yunbao.common.event.DataUserInfoEvent;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.http.HttpClient;
|
import com.yunbao.common.http.HttpClient;
|
||||||
import com.yunbao.common.manager.base.BaseCacheManager;
|
import com.yunbao.common.manager.base.BaseCacheManager;
|
||||||
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
|
import com.yunbao.common.manager.imrongcloud.MessageIMManager;
|
||||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
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();
|
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 = [
|
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",
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户信息
|
* 获取用户信息
|
||||||
@ -289,7 +295,7 @@ public class MainHttpUtil {
|
|||||||
* 获取用户钱
|
* 获取用户钱
|
||||||
*/
|
*/
|
||||||
public static void getBalance(HttpCallback callback) {
|
public static void getBalance(HttpCallback callback) {
|
||||||
HttpClient.getInstance().get("User.getUserBalance","User.getUserBalance")
|
HttpClient.getInstance().get("User.getUserBalance", "User.getUserBalance")
|
||||||
.params("uid", CommonAppConfig.getInstance().getUid())
|
.params("uid", CommonAppConfig.getInstance().getUid())
|
||||||
.params("token", CommonAppConfig.getInstance().getToken())
|
.params("token", CommonAppConfig.getInstance().getToken())
|
||||||
.execute(callback);
|
.execute(callback);
|
||||||
@ -576,7 +582,7 @@ public class MainHttpUtil {
|
|||||||
/**
|
/**
|
||||||
* 手机注册接口---增加参数:推广码,手机唯一标识,国家代码
|
* 手机注册接口---增加参数:推广码,手机唯一标识,国家代码
|
||||||
*/
|
*/
|
||||||
public static void register(String invitecode,String user_login, String promo_code, String uuidDevice, int countryCode, String pass, String pass2, String code, HttpCallback callback) {
|
public static void register(String invitecode, String user_login, String promo_code, String uuidDevice, int countryCode, String pass, String pass2, String code, HttpCallback callback) {
|
||||||
HttpClient.getInstance().get("Login.userReg", MainHttpConsts.REGISTER)
|
HttpClient.getInstance().get("Login.userReg", MainHttpConsts.REGISTER)
|
||||||
.params("user_login", user_login)
|
.params("user_login", user_login)
|
||||||
//增加参数:推广码
|
//增加参数:推广码
|
||||||
@ -590,7 +596,7 @@ public class MainHttpUtil {
|
|||||||
.params("user_pass2", pass2)
|
.params("user_pass2", pass2)
|
||||||
.params("code", code)
|
.params("code", code)
|
||||||
.params("source", DEVICE)
|
.params("source", DEVICE)
|
||||||
.params("invitation_code",invitecode)
|
.params("invitation_code", invitecode)
|
||||||
.execute(callback);
|
.execute(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user