summaryrefslogtreecommitdiffhomepage
path: root/android/app/src
diff options
context:
space:
mode:
authorAlbin <albin@mullvad.net>2022-12-14 11:47:48 +0100
committerAlbin <albin@mullvad.net>2023-06-14 10:56:19 +0200
commitf523cdd4e2c7b23f79c9dab3882cb345f851b0c6 (patch)
tree94dfadb6a3b424dc72ee0f6628339a08f309c4eb /android/app/src
parent3b55040731942ec083e62bddc09b1670a66f9a47 (diff)
downloadmullvadvpn-f523cdd4e2c7b23f79c9dab3882cb345f851b0c6.tar.xz
mullvadvpn-f523cdd4e2c7b23f79c9dab3882cb345f851b0c6.zip
Add option to disable version notifications
For example, set the following in local.properties: ENABLE_IN_APP_VERSION_NOTIFICATIONS=false
Diffstat (limited to 'android/app/src')
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/di/UiModule.kt2
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/notification/VersionInfoNotification.kt7
2 files changed, 6 insertions, 3 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/di/UiModule.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/di/UiModule.kt
index 01ce12085f..bbe632f9d5 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/di/UiModule.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/di/UiModule.kt
@@ -63,7 +63,7 @@ val uiModule = module {
single { AccountExpiryNotification(get()) }
single { TunnelStateNotification(get()) }
- single { VersionInfoNotification(get()) }
+ single { VersionInfoNotification(BuildConfig.ENABLE_IN_APP_VERSION_NOTIFICATIONS, get()) }
single { AccountRepository(get()) }
single { DeviceRepository(get()) }
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/notification/VersionInfoNotification.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/notification/VersionInfoNotification.kt
index 05ff56f1fe..3407684831 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/notification/VersionInfoNotification.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/notification/VersionInfoNotification.kt
@@ -4,13 +4,16 @@ import android.content.Context
import net.mullvad.mullvadvpn.R
import net.mullvad.mullvadvpn.ui.VersionInfo
-class VersionInfoNotification(context: Context) :
+class VersionInfoNotification(val isEnabled: Boolean, context: Context) :
NotificationWithUrl(context, R.string.download_url) {
private val unsupportedVersion = context.getString(R.string.unsupported_version)
private val updateAvailable = context.getString(R.string.update_available)
fun updateVersionInfo(versionInfo: VersionInfo) {
- if (versionInfo.isOutdated || !versionInfo.isSupported) {
+ val shouldShowNotification =
+ isEnabled && (versionInfo.isOutdated || !versionInfo.isSupported)
+
+ if (shouldShowNotification) {
if (versionInfo.upgradeVersion != null) {
message =
if (versionInfo.isSupported) {