|
@@ -51,10 +51,16 @@ class SplashVm(application: Application) : BaseViewModel(application) {
|
|
|
fun getApiDomain() {
|
|
|
requestData2(false) {
|
|
|
requestData {
|
|
|
- val data = ApiManager.configApi.getApiDomain()
|
|
|
- setBaseUrl(data.host)
|
|
|
+ val domainUrl = ApiManager.configApi.getApiDomain()
|
|
|
+ setBaseUrl(domainUrl.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 {
|
|
@@ -107,8 +113,8 @@ class SplashVm(application: Application) : BaseViewModel(application) {
|
|
|
private fun setBaseUrl(baseUrl: String) {
|
|
|
if (BuildConfig.DEBUG) {
|
|
|
// UrlConstant.BASE_URL = "http:test-api.swago.cn"
|
|
|
-// UrlConstant.BASE_URL = "http:huawei.swago.cn"
|
|
|
- UrlConstant.BASE_URL = "https://pro-api.swago.cn"
|
|
|
+ UrlConstant.BASE_URL = "http:huawei.swago.cn"
|
|
|
+// UrlConstant.BASE_URL = "https://pro-api.swago.cn"
|
|
|
} else {
|
|
|
UrlConstant.BASE_URL = baseUrl
|
|
|
}
|
|
@@ -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))
|
|
@@ -137,11 +137,7 @@ class SplashVm(application: Application) : BaseViewModel(application) {
|
|
|
*/
|
|
|
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
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|