honghengqiang před 1 rokem
rodič
revize
ff97527df1

+ 9 - 22
app/src/main/java/com/swago/app/SplashVm.kt

@@ -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
-        }
-    }
 }

+ 1 - 2
baseswago/src/main/java/com/swago/baseswago/baseroom/ui/AbsUserActivity.kt

@@ -50,14 +50,13 @@ abstract class AbsUserActivity<T: ActivityAbsRoomUserBinding,E: IRoomInfo> : Bas
 
         SwagoRoomManager.roleType = roleType
         SwagoRoomManager.addListener(this)
+        initUserRoomView()
         binding.rv.layoutManager = pagerLayoutManager
         binding.rv.animation = null
         binding.rv.adapter = adapter
         adapter.setNewData(iRoomInfos)
         binding.rv.scrollToPosition(mCurrentPosition)
         pagerLayoutManager.scrollToPositionWithOffset(mCurrentPosition,0)
-
-        initUserRoomView()
         initLiveData()
     }