exception test

This commit is contained in:
X1nto 2020-07-01 15:59:32 +04:00
parent 536fd2065d
commit 55bd10d6f5
5 changed files with 9 additions and 8 deletions

View File

@ -19,6 +19,7 @@ import com.vanced.manager.utils.InternetTools.getFileNameFromUrl
import com.vanced.manager.utils.NotificationHelper
import com.vanced.manager.utils.NotificationHelper.cancelNotif
import com.vanced.manager.utils.NotificationHelper.createBasicNotif
import java.lang.IllegalStateException
import java.util.concurrent.ExecutionException
class MicrogDownloadService: Service() {
@ -28,7 +29,7 @@ class MicrogDownloadService: Service() {
downloadMicrog()
} catch (e: Exception) {
when (e) {
is ExecutionException, is InterruptedException -> Toast.makeText(this, "Unable to download Vanced", Toast.LENGTH_SHORT).show()
is ExecutionException, is InterruptedException, is IllegalStateException -> Toast.makeText(this, "Unable to download MicroG", Toast.LENGTH_SHORT).show()
else -> throw e
}
}

View File

@ -22,6 +22,7 @@ import com.vanced.manager.utils.InternetTools.getFileNameFromUrl
import com.vanced.manager.utils.NotificationHelper.cancelNotif
import com.vanced.manager.utils.NotificationHelper.createBasicNotif
import com.vanced.manager.utils.NotificationHelper.displayDownloadNotif
import java.lang.IllegalStateException
import java.util.concurrent.ExecutionException
class VancedDownloadService: Service() {
@ -31,7 +32,7 @@ class VancedDownloadService: Service() {
downloadSplits()
} catch (e: Exception) {
when (e) {
is ExecutionException, is InterruptedException -> Toast.makeText(this, "Unable to download Vanced", Toast.LENGTH_SHORT).show()
is ExecutionException, is InterruptedException, is IllegalStateException -> Toast.makeText(this, "Unable to download Vanced", Toast.LENGTH_SHORT).show()
else -> throw e
}

View File

@ -53,7 +53,6 @@ open class Home : BaseFragment(), View.OnClickListener {
override fun onClick(v: View?) {
val prefs = activity?.getSharedPreferences("installPrefs", Context.MODE_PRIVATE)
val defPrefs = getDefaultSharedPreferences(activity)
val isVancedDownloading: Boolean? = prefs?.getBoolean("isVancedDownloading", false)
val isMicrogDownloading: Boolean? = prefs?.getBoolean("isMicrogDownloading", false)
val variant = getDefaultSharedPreferences(activity).getString("vanced_variant", "nonroot")

View File

@ -131,8 +131,8 @@ class HomeViewModel(application: Application): AndroidViewModel(application) {
}
init {
vancedVersion.value = displayJsonString("vanced.json","version", application)
microgVersion.value = displayJsonString("microg.json","version", application)
vancedVersion.value = displayJsonString("vanced.json", "version", application)
microgVersion.value = displayJsonString("microg.json", "version", application)
vancedInstalledVersion.value = getPkgInfo(vancedInstalled, vancedPkgName, application)
microgInstalledVersion.value = getPkgInfo(microgInstalled, "com.mgoogle.android.gms", application)
vancedInstallButtonIcon.value =

View File

@ -37,7 +37,7 @@
<string name="microg_installed">MicroG successfully installed</string>
<string name="successfully_installed">Successfully installed %1$s</string>
<string name="network_error">Network connection unavailable</string>
<string name="no_microg">No Microg!</string>
<string name="no_microg">No MicroG!</string>
<string name="unavailable">Unavailable</string>
<string name="update">Update</string>
<string name="useful_links">Useful Links</string>
@ -75,8 +75,8 @@
<!-- Dialogs -->
<string name="guide">Guide</string>
<string name="hold_on">Hold on!</string>
<string name="miui_one_title">Detected MiUI user!</string>
<string name="miui_one">Hey! Looks like you\'re a MiUI user. in order to properly use Vanced Manager, you will have to disable MiUI optimisations in developer settings\n However, if you are on 20.2.20 ROM that\'s based on xiaomi.eu, you can safely ignore this warning.</string>
<string name="miui_one_title">Detected MIUI user!</string>
<string name="miui_one">Hey! Looks like you\'re an MiUI user. in order to properly use Vanced Manager, you will have to disable MiUI optimisations in developer settings.\n However, if you are on 20.2.20 ROM that\'s based on xiaomi.eu, you can safely ignore this warning.</string>
<string name="miui_two_title">I\'m gonna stop you right there!</string>
<string name="miui_two">Looks like you did NOT disable MiUI optimisations. Please disable it. However, if you are on 20.2.20 ROM that\'s based on xiaomi.eu, you can safely ignore this warning.</string>
<string name="error">Error</string>