diff --git a/CHANGELOG.md b/CHANGELOG.md index 0765da1fb..caf98f0b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # 2021-10-?? Version 74.4.7 (86) * Fix "Permission Denial" bug on Android devices (Tobiwan/ffupdater#86) + * Speed-up app installation/update by not requiring to press a button # 2021-10-25 Version 74.4.6 (85) * Download only "Firefox Focus/Klar" and not "Firefox Focus/Klar Beta" (Tobi823/ffupdater#89) diff --git a/ffupdater/src/main/java/de/marmaro/krt/ffupdater/InstallActivity.kt b/ffupdater/src/main/java/de/marmaro/krt/ffupdater/InstallActivity.kt index a661d8302..c6500bd9d 100644 --- a/ffupdater/src/main/java/de/marmaro/krt/ffupdater/InstallActivity.kt +++ b/ffupdater/src/main/java/de/marmaro/krt/ffupdater/InstallActivity.kt @@ -96,8 +96,8 @@ class InstallActivity : AppCompatActivity() { restartStateMachine(FAILURE_APP_INSTALLATION) }) apkCache = ApkCache(app, this) - findViewById(R.id.installConfirmationButton).setOnClickListener { - restartStateMachine(USER_TRIGGERS_INSTALLATION_PROCESS) + findViewById(R.id.install_activity__retrigger_installation__button).setOnClickListener { + restartStateMachine(TRIGGER_INSTALLATION_PROCESS) } //make sure that the ViewModel is correct for the current app @@ -191,7 +191,7 @@ class InstallActivity : AppCompatActivity() { DOWNLOAD_WAS_SUCCESSFUL(InstallActivity::downloadWasSuccessful), USE_CACHED_DOWNLOADED_APK(InstallActivity::useCachedDownloadedApk), FINGERPRINT_OF_DOWNLOADED_FILE_OK(InstallActivity::fingerprintOfDownloadedFileOk), - USER_TRIGGERS_INSTALLATION_PROCESS(InstallActivity::userTriggersInstallationProcess), + TRIGGER_INSTALLATION_PROCESS(InstallActivity::triggerInstallationProcess), USER_HAS_INSTALLED_APP_SUCCESSFUL(InstallActivity::userHasInstalledAppSuccessful), APP_INSTALLATION_HAS_BEEN_REGISTERED(InstallActivity::appInstallationHasBeenRegistered), FINGERPRINT_OF_INSTALLED_APP_OK(InstallActivity::fingerprintOfInstalledAppOk), @@ -381,16 +381,16 @@ class InstallActivity : AppCompatActivity() { fun fingerprintOfDownloadedFileOk(ia: InstallActivity): State { ia.hide(R.id.verifyDownloadFingerprint) ia.show(R.id.fingerprintDownloadGood) - ia.show(R.id.installConfirmation) + ia.show(R.id.install_activity__retrigger_installation) ia.setText(R.id.fingerprintDownloadGoodHash, ia.fileFingerprint.hexString) - return SUCCESS_PAUSE + return TRIGGER_INSTALLATION_PROCESS } @MainThread - fun userTriggersInstallationProcess(ia: InstallActivity): State { + fun triggerInstallationProcess(ia: InstallActivity): State { ia.show(R.id.installingApplication) val installationFile = ia.apkCache.getCacheFile() - require(installationFile.exists()) + require(installationFile.exists()) { "Cached file does not exists" } ia.appInstaller.install(ia, installationFile) return SUCCESS_PAUSE } @@ -398,7 +398,7 @@ class InstallActivity : AppCompatActivity() { @MainThread fun userHasInstalledAppSuccessful(ia: InstallActivity): State { ia.hide(R.id.installingApplication) - ia.hide(R.id.installConfirmation) + ia.hide(R.id.install_activity__retrigger_installation) ia.show(R.id.installerSuccess) ia.viewModel.downloadId?.let { ia.downloadManager.remove(it) } return APP_INSTALLATION_HAS_BEEN_REGISTERED @@ -474,7 +474,7 @@ class InstallActivity : AppCompatActivity() { @MainThread fun failureAppInstallation(ia: InstallActivity): State { ia.hide(R.id.installingApplication) - ia.hide(R.id.installConfirmation) + ia.hide(R.id.install_activity__retrigger_installation) ia.show(R.id.installerFailed) var error = ia.appInstallationFailedErrorMessage if (error != null) { diff --git a/ffupdater/src/main/java/de/marmaro/krt/ffupdater/dialog/InstallNewAppDialog.kt b/ffupdater/src/main/java/de/marmaro/krt/ffupdater/dialog/InstallNewAppDialog.kt index 26b2a948f..ccca1bc8c 100644 --- a/ffupdater/src/main/java/de/marmaro/krt/ffupdater/dialog/InstallNewAppDialog.kt +++ b/ffupdater/src/main/java/de/marmaro/krt/ffupdater/dialog/InstallNewAppDialog.kt @@ -25,7 +25,7 @@ class InstallNewAppDialog : DialogFragment() { } val names = apps.map { context.getString(it.detail.displayTitle) }.toTypedArray() return AlertDialog.Builder(activity) - .setTitle(R.string.install_new_app_dialog__title) + .setTitle(R.string.install_activity__retrigger_installation__button_title) .setItems(names) { _: DialogInterface, which: Int -> triggerAppInstallation(apps[which]) } diff --git a/ffupdater/src/main/res/layout/install_activity.xml b/ffupdater/src/main/res/layout/install_activity.xml index df6515a21..90b828e3d 100644 --- a/ffupdater/src/main/res/layout/install_activity.xml +++ b/ffupdater/src/main/res/layout/install_activity.xml @@ -206,17 +206,6 @@ - - -