|
@@ -51,10 +51,16 @@ class SplashVm(application: Application) : BaseViewModel(application) {
|
|
|
fun getApiDomain() {
|
|
|
requestData2(false) {
|
|
|
requestData {
|
|
|
- val data = ApiManager.configApi.getApiDomain()
|
|
|
- setBaseUrl(data.host)
|
|
|
+ val domainData = ApiManager.configApi.getApiDomain()
|
|
|
+ setBaseUrl(domainData.host)
|
|
|
RetrofitManager.resetUrl()
|
|
|
- getAppConfig()
|
|
|
+
|
|
|
+ val data = ApiManager.configApi.getAppConfig()
|
|
|
+ SpUtil.putString("configModel", gson.toJson(data))
|
|
|
+ UrlConstant.setAgoraId(data.agoral_app_id)
|
|
|
+ UrlConstant.setImId(data.im_app_id)
|
|
|
+ UrlConstant.lottieDownloadUrl = data.special_zip_url
|
|
|
+
|
|
|
if (UserInfo.getLoginModel() == null) {
|
|
|
jumpToLoginLiveData.value = false
|
|
|
} else {
|
|
@@ -116,12 +122,6 @@ class SplashVm(application: Application) : BaseViewModel(application) {
|
|
|
|
|
|
fun loginByAuto() {
|
|
|
requestData {
|
|
|
- val configModel = ApiManager.configApi.getAppConfig()
|
|
|
- SpUtil.putString("configModel", gson.toJson(configModel))
|
|
|
- UrlConstant.setAgoraId(configModel.agoral_app_id)
|
|
|
- UrlConstant.setImId(configModel.im_app_id)
|
|
|
- UrlConstant.lottieDownloadUrl = configModel.special_zip_url
|
|
|
-
|
|
|
val data = ApiManager.loginApi.loginByAuto()
|
|
|
UserInfo.setLoginInfo(data)
|
|
|
SpUtil.putString("login_info", Gson().toJson(data))
|
|
@@ -131,17 +131,4 @@ class SplashVm(application: Application) : BaseViewModel(application) {
|
|
|
.navigation()
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取配置
|
|
|
- */
|
|
|
- private fun getAppConfig(){
|
|
|
- requestData {
|
|
|
- val data = ApiManager.configApi.getAppConfig()
|
|
|
- SpUtil.putString("configModel", gson.toJson(data))
|
|
|
- UrlConstant.setAgoraId(data.agoral_app_id)
|
|
|
- UrlConstant.setImId(data.im_app_id)
|
|
|
- UrlConstant.lottieDownloadUrl = data.special_zip_url
|
|
|
- }
|
|
|
- }
|
|
|
}
|