Sfoglia il codice sorgente

New: ENV_DEV tag to switch debug and release host

liweihao 5 anni fa
parent
commit
1991e34fa4

+ 4 - 0
src/main/java/com/example/kdan_data_center/KdanCloud.kt

@@ -7,6 +7,10 @@ import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
 import retrofit2.converter.gson.GsonConverterFactory
 
 class KdanCloud {
+    companion object {
+          var ENV_DEV = false
+    }
+
     val dataCenter = DataCenter(this)
 
     fun getRetrofit(baseUrl: String): Retrofit =

+ 1 - 1
src/main/java/com/example/kdan_data_center/datacenter/DataCenter.kt

@@ -13,7 +13,7 @@ class DataCenter(private val kdanCloud: KdanCloud) {
         const val RELEASE_HOST = "https://data-center-rails.kdanmobile.com/"
     }
 
-    private val host = if (BuildConfig.DEBUG) DEBUG_HOST else RELEASE_HOST
+    private val host = if (KdanCloud.ENV_DEV) DEBUG_HOST else RELEASE_HOST
 
     val userService: UserService = buildUserService()
     val fileService: FileService = buildFileService()