Add failure messages and bump version
This commit is contained in:
parent
1df152f41b
commit
f6855e6f5b
3 changed files with 21 additions and 4 deletions
|
@ -14,8 +14,8 @@ android {
|
|||
applicationId = "dev.beefers.vendetta.manager"
|
||||
minSdk = 24
|
||||
targetSdk = 33
|
||||
versionCode = 1050
|
||||
versionName = "1.0.5"
|
||||
versionCode = 1060
|
||||
versionName = "1.0.6"
|
||||
|
||||
buildConfigField("String", "GIT_BRANCH", "\"${getCurrentBranch()}\"")
|
||||
buildConfigField("String", "GIT_COMMIT", "\"${getLatestCommit()}\"")
|
||||
|
|
|
@ -9,6 +9,16 @@ import dev.beefers.vendetta.manager.utils.showToast
|
|||
|
||||
class InstallService : Service() {
|
||||
|
||||
private val messages = mapOf(
|
||||
PackageInstaller.STATUS_FAILURE to R.string.install_fail_generic,
|
||||
PackageInstaller.STATUS_FAILURE_BLOCKED to R.string.install_fail_blocked,
|
||||
PackageInstaller.STATUS_FAILURE_INVALID to R.string.install_fail_invalid,
|
||||
PackageInstaller.STATUS_FAILURE_CONFLICT to R.string.install_fail_conflict,
|
||||
PackageInstaller.STATUS_FAILURE_STORAGE to R.string.install_fail_storage,
|
||||
PackageInstaller.STATUS_FAILURE_INCOMPATIBLE to R.string.install_fail_incompatible,
|
||||
8 /* STATUS_FAILURE_TIMEOUT (Added in Android 14) */ to R.string.install_fail_timeout
|
||||
)
|
||||
|
||||
override fun onStartCommand(intent: Intent, flags: Int, startId: Int): Int {
|
||||
val isInstall = intent.action == "vendetta.actions.ACTION_INSTALL"
|
||||
when (val statusCode = intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -999)) {
|
||||
|
@ -25,7 +35,7 @@ class InstallService : Service() {
|
|||
PackageInstaller.STATUS_FAILURE_ABORTED -> if (isInstall) showToast(R.string.installer_aborted)
|
||||
|
||||
else -> {
|
||||
if (isInstall) showToast(R.string.installer_failed, statusCode)
|
||||
if (isInstall) messages[statusCode]?.let(::showToast)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,14 @@
|
|||
|
||||
<string name="installer_success">Installed successfully</string>
|
||||
<string name="installer_aborted">Install canceled</string>
|
||||
<string name="installer_failed">Failed to install: %d</string>
|
||||
|
||||
<string name="install_fail_generic">Failed to install: Unknown reason</string>
|
||||
<string name="install_fail_blocked">Installation was blocked</string>
|
||||
<string name="install_fail_invalid">One or more APKs were invalid or corrupt</string>
|
||||
<string name="install_fail_conflict">Conflicts with an existing app, usually due to mismatched signatures</string>
|
||||
<string name="install_fail_storage">Not enough available storage to install</string>
|
||||
<string name="install_fail_incompatible">Application is incompatible with this device</string>
|
||||
<string name="install_fail_timeout">Installation timed out</string>
|
||||
|
||||
<string name="status_ongoing">Ongoing</string>
|
||||
<string name="status_successful">Successful</string>
|
||||
|
|
Loading…
Reference in a new issue