diff options
| author | Albin <albin@mullvad.net> | 2022-12-14 11:47:48 +0100 |
|---|---|---|
| committer | Albin <albin@mullvad.net> | 2023-06-14 10:56:19 +0200 |
| commit | f523cdd4e2c7b23f79c9dab3882cb345f851b0c6 (patch) | |
| tree | 94dfadb6a3b424dc72ee0f6628339a08f309c4eb /android | |
| parent | 3b55040731942ec083e62bddc09b1670a66f9a47 (diff) | |
| download | mullvadvpn-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')
4 files changed, 22 insertions, 3 deletions
diff --git a/android/BuildInstructions.md b/android/BuildInstructions.md index c07c4ef438..177b6937a5 100644 --- a/android/BuildInstructions.md +++ b/android/BuildInstructions.md @@ -242,3 +242,10 @@ To avoid or override the rust based version generation, the `OVERRIDE_VERSION_CO OVERRIDE_VERSION_CODE=123 OVERRIDE_VERSION_NAME=1.2.3 ``` + +### Disable version in-app notifications +To disable in-app notifications related to the app version during development or testing, +the `ENABLE_IN_APP_VERSION_NOTIFICATIONS` property can be set in `local.properties`: +``` +ENABLE_IN_APP_VERSION_NOTIFICATIONS=false +``` diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index a36860891f..1e6ad7b08e 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -160,6 +160,15 @@ android { "ALWAYS_SHOW_CHANGELOG", alwaysShowChangelog ) + + val enableInAppVersionNotifications = gradleLocalProperties(rootProject.projectDir) + .getProperty("ENABLE_IN_APP_VERSION_NOTIFICATIONS") ?: "true" + + buildConfigField( + "boolean", + "ENABLE_IN_APP_VERSION_NOTIFICATIONS", + enableInAppVersionNotifications + ) } project.tasks.preBuild.dependsOn("ensureJniDirectoryExist") 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) { |
