0
0
Fork 0
mirror of https://github.com/YTVanced/VancedManager synced 2024-11-23 11:45:11 +00:00

exception handling for crowdin

This commit is contained in:
X1nto 2020-08-12 17:40:13 +04:00
parent 6069553f4a
commit 4b45a2acd6
2 changed files with 16 additions and 13 deletions

View file

@ -1,6 +1,7 @@
package com.vanced.manager.core
import android.app.Application
import android.util.Log
import com.crowdin.platform.Crowdin
import com.crowdin.platform.CrowdinConfig
import com.crowdin.platform.data.remote.NetworkType
@ -12,11 +13,16 @@ class App: Application() {
super.onCreate()
PRDownloader.initialize(this)
Crowdin.init(this,
CrowdinConfig.Builder()
.withDistributionHash("36c51aed3180a4f43073d28j4s6")
.withNetworkType(NetworkType.WIFI)
.build())
try {
Crowdin.init(this,
CrowdinConfig.Builder()
.withDistributionHash("36c51aed3180a4f43073d28j4s6")
.withNetworkType(NetworkType.WIFI)
.build()
)
} catch (e: Exception) {
Log.d("VMLocalisation", "Failed to initialize Crowdin")
}
}
/*
@ -26,4 +32,4 @@ class App: Application() {
}
*/
}
}

View file

@ -65,13 +65,10 @@ open class HomeViewModel(application: Application): AndroidViewModel(application
fun fetchData() {
CoroutineScope(Dispatchers.IO).launch {
fetching.set(true)
//Crowdin has problems with R, skip fetching
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R)
try {
Crowdin.forceUpdate(getApplication())
} catch (e: Exception) {
Log.d("VMLocalisation", "Error: ", e)
}
try {
Crowdin.forceUpdate(getApplication())
} catch (e: Exception) {
Log.d("VMLocalisation", "Error: ", e)
vancedVersion.set(getJsonString("vanced.json", "version", getApplication()))
microgVersion.set(getJsonString("microg.json", "version", getApplication()))
microgInstalled.set(isPackageInstalled("com.mgoogle.android.gms", pm))