diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2023-07-07 05:00:22 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2023-07-07 05:06:04 +0200 |
commit | 434534ac593760538bf30c47ae6fed1fad0e4402 (patch) | |
tree | 4fb0a48cf23b3c29c0658aa230da6256a2ecbdbf | |
parent | 0f77af85d3236f706589fbb1064512af7466368f (diff) |
ui: hide corrupted message if no installer
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | ui/src/main/java/com/wireguard/android/updater/Updater.kt | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/ui/src/main/java/com/wireguard/android/updater/Updater.kt b/ui/src/main/java/com/wireguard/android/updater/Updater.kt index dbdbacfe..651e3cd7 100644 --- a/ui/src/main/java/com/wireguard/android/updater/Updater.kt +++ b/ui/src/main/java/com/wireguard/android/updater/Updater.kt @@ -383,13 +383,15 @@ object Updater { context.packageManager.getPackageInfo(context.packageName, PackageManager.PackageInfoFlags.of(PackageManager.GET_PERMISSIONS.toLong())) }.requestedPermissions.contains(Manifest.permission.REQUEST_INSTALL_PACKAGES) ) { - updaterScope.launch { - val update = try { - checkForUpdates() - } catch (_: Throwable) { - null + if (installer(context).isNotEmpty()) { + updaterScope.launch { + val update = try { + checkForUpdates() + } catch (_: Throwable) { + null + } + emitProgress(Progress.Corrupt(update?.fileName)) } - emitProgress(Progress.Corrupt(update?.fileName)) } return } |