mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-04-29 21:44:26 +02:00
cleanup strings and translate toasts
This commit is contained in:
parent
783c74712f
commit
b60bdb4685
@ -138,7 +138,7 @@ fun SelectedAppInfoScreen(
|
|||||||
activeSearchJob = vm.activePluginAction,
|
activeSearchJob = vm.activePluginAction,
|
||||||
hasRoot = vm.hasRoot,
|
hasRoot = vm.hasRoot,
|
||||||
onDismissRequest = vm::dismissSourceSelector,
|
onDismissRequest = vm::dismissSourceSelector,
|
||||||
onSelectPlugin = vm::searchInPlugin,
|
onSelectPlugin = vm::searchUsingPlugin,
|
||||||
requiredVersion = requiredVersion,
|
requiredVersion = requiredVersion,
|
||||||
onSelect = {
|
onSelect = {
|
||||||
vm.selectedApp = it
|
vm.selectedApp = it
|
||||||
|
@ -5,6 +5,7 @@ import android.app.Application
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.pm.PackageInfo
|
import android.content.pm.PackageInfo
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
|
import android.util.Log
|
||||||
import androidx.activity.result.ActivityResult
|
import androidx.activity.result.ActivityResult
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import androidx.compose.runtime.MutableState
|
import androidx.compose.runtime.MutableState
|
||||||
@ -37,7 +38,10 @@ import app.revanced.manager.ui.model.SelectedApp
|
|||||||
import app.revanced.manager.util.Options
|
import app.revanced.manager.util.Options
|
||||||
import app.revanced.manager.util.PM
|
import app.revanced.manager.util.PM
|
||||||
import app.revanced.manager.util.PatchSelection
|
import app.revanced.manager.util.PatchSelection
|
||||||
|
import app.revanced.manager.util.simpleMessage
|
||||||
|
import app.revanced.manager.util.tag
|
||||||
import app.revanced.manager.util.toast
|
import app.revanced.manager.util.toast
|
||||||
|
import kotlinx.coroutines.CancellationException
|
||||||
import kotlinx.coroutines.CompletableDeferred
|
import kotlinx.coroutines.CompletableDeferred
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
@ -178,7 +182,7 @@ class SelectedAppInfoViewModel(input: Params) : ViewModel(), KoinComponent {
|
|||||||
showSourceSelector = false
|
showSourceSelector = false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun searchInPlugin(plugin: LoadedDownloaderPlugin) {
|
fun searchUsingPlugin(plugin: LoadedDownloaderPlugin) {
|
||||||
cancelPluginAction()
|
cancelPluginAction()
|
||||||
pluginAction = plugin to viewModelScope.launch {
|
pluginAction = plugin to viewModelScope.launch {
|
||||||
try {
|
try {
|
||||||
@ -212,7 +216,7 @@ class SelectedAppInfoViewModel(input: Params) : ViewModel(), KoinComponent {
|
|||||||
plugin.get(scope, packageName, desiredVersion)
|
plugin.get(scope, packageName, desiredVersion)
|
||||||
}?.let { (data, version) ->
|
}?.let { (data, version) ->
|
||||||
if (desiredVersion != null && version != desiredVersion) {
|
if (desiredVersion != null && version != desiredVersion) {
|
||||||
app.toast("Plugin returned a package with the wrong version")
|
app.toast(app.getString(R.string.downloader_invalid_version))
|
||||||
return@launch
|
return@launch
|
||||||
}
|
}
|
||||||
selectedApp = SelectedApp.Download(
|
selectedApp = SelectedApp.Download(
|
||||||
@ -220,9 +224,14 @@ class SelectedAppInfoViewModel(input: Params) : ViewModel(), KoinComponent {
|
|||||||
version,
|
version,
|
||||||
ParceledDownloaderData(plugin, data)
|
ParceledDownloaderData(plugin, data)
|
||||||
)
|
)
|
||||||
} ?: app.toast("App was not found")
|
} ?: app.toast(app.getString(R.string.downloader_app_not_found))
|
||||||
} catch (e: UserInteractionException.Activity) {
|
} catch (e: UserInteractionException.Activity) {
|
||||||
app.toast(e.message!!)
|
app.toast(e.message!!)
|
||||||
|
} catch (e: CancellationException) {
|
||||||
|
throw e
|
||||||
|
} catch (e: Exception) {
|
||||||
|
app.toast(app.getString(R.string.downloader_error, e.simpleMessage()))
|
||||||
|
Log.e(tag, "Downloader.get threw an exception", e)
|
||||||
} finally {
|
} finally {
|
||||||
pluginAction = null
|
pluginAction = null
|
||||||
dismissSourceSelector()
|
dismissSourceSelector()
|
||||||
|
@ -244,14 +244,9 @@
|
|||||||
<string name="unpatch_app">Unpatch app?</string>
|
<string name="unpatch_app">Unpatch app?</string>
|
||||||
<string name="unpatch_description">Are you sure you want to unpatch this app?</string>
|
<string name="unpatch_description">Are you sure you want to unpatch this app?</string>
|
||||||
|
|
||||||
<string name="error_occurred">An error occurred</string>
|
<string name="downloader_invalid_version">Downloader did not fetch the correct version</string>
|
||||||
<string name="already_downloaded">Already downloaded</string>
|
<string name="downloader_app_not_found">Downloader did not find the app</string>
|
||||||
<string name="select_version">Select version</string>
|
<string name="downloader_error">Downloader error: %s</string>
|
||||||
<string name="downloadable_versions">Downloadable versions</string>
|
|
||||||
<string name="downloaded_versions">Downloaded versions</string>
|
|
||||||
<string name="downloader_select">Select downloader</string>
|
|
||||||
<string name="downloader_not_selected">No downloader selected</string>
|
|
||||||
<string name="downloader_no_versions">No downloadable versions found</string>
|
|
||||||
<string name="downloader_no_plugins_installed">No plugins installed.</string>
|
<string name="downloader_no_plugins_installed">No plugins installed.</string>
|
||||||
<string name="downloader_no_plugins_available">No trusted plugins available for use. Check your settings.</string>
|
<string name="downloader_no_plugins_available">No trusted plugins available for use. Check your settings.</string>
|
||||||
<string name="already_patched">Already patched</string>
|
<string name="already_patched">Already patched</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user