0
0
Fork 0
mirror of https://github.com/YTVanced/VancedManager synced 2024-12-03 16:27:25 +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 package com.vanced.manager.core
import android.app.Application import android.app.Application
import android.util.Log
import com.crowdin.platform.Crowdin import com.crowdin.platform.Crowdin
import com.crowdin.platform.CrowdinConfig import com.crowdin.platform.CrowdinConfig
import com.crowdin.platform.data.remote.NetworkType import com.crowdin.platform.data.remote.NetworkType
@ -12,11 +13,16 @@ class App: Application() {
super.onCreate() super.onCreate()
PRDownloader.initialize(this) PRDownloader.initialize(this)
try {
Crowdin.init(this, Crowdin.init(this,
CrowdinConfig.Builder() CrowdinConfig.Builder()
.withDistributionHash("36c51aed3180a4f43073d28j4s6") .withDistributionHash("36c51aed3180a4f43073d28j4s6")
.withNetworkType(NetworkType.WIFI) .withNetworkType(NetworkType.WIFI)
.build()) .build()
)
} catch (e: Exception) {
Log.d("VMLocalisation", "Failed to initialize Crowdin")
}
} }
/* /*

View file

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