|
@@ -51,10 +51,16 @@ class SplashVm(application: Application) : BaseViewModel(application) {
|
|
fun getApiDomain() {
|
|
fun getApiDomain() {
|
|
requestData2(false) {
|
|
requestData2(false) {
|
|
requestData {
|
|
requestData {
|
|
- val data = ApiManager.configApi.getApiDomain()
|
|
|
|
- setBaseUrl(data.host)
|
|
|
|
|
|
+ val domainUrl = ApiManager.configApi.getApiDomain()
|
|
|
|
+ setBaseUrl(domainUrl.host)
|
|
RetrofitManager.resetUrl()
|
|
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) {
|
|
if (UserInfo.getLoginModel() == null) {
|
|
jumpToLoginLiveData.value = false
|
|
jumpToLoginLiveData.value = false
|
|
} else {
|
|
} else {
|
|
@@ -107,8 +113,8 @@ class SplashVm(application: Application) : BaseViewModel(application) {
|
|
private fun setBaseUrl(baseUrl: String) {
|
|
private fun setBaseUrl(baseUrl: String) {
|
|
if (BuildConfig.DEBUG) {
|
|
if (BuildConfig.DEBUG) {
|
|
// UrlConstant.BASE_URL = "http:test-api.swago.cn"
|
|
// 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 {
|
|
} else {
|
|
UrlConstant.BASE_URL = baseUrl
|
|
UrlConstant.BASE_URL = baseUrl
|
|
}
|
|
}
|
|
@@ -116,12 +122,6 @@ class SplashVm(application: Application) : BaseViewModel(application) {
|
|
|
|
|
|
fun loginByAuto() {
|
|
fun loginByAuto() {
|
|
requestData {
|
|
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()
|
|
val data = ApiManager.loginApi.loginByAuto()
|
|
UserInfo.setLoginInfo(data)
|
|
UserInfo.setLoginInfo(data)
|
|
SpUtil.putString("login_info", Gson().toJson(data))
|
|
SpUtil.putString("login_info", Gson().toJson(data))
|
|
@@ -137,11 +137,7 @@ class SplashVm(application: Application) : BaseViewModel(application) {
|
|
*/
|
|
*/
|
|
private fun getAppConfig(){
|
|
private fun getAppConfig(){
|
|
requestData {
|
|
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
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|