diff options
Diffstat (limited to 'android')
4 files changed, 33 insertions, 10 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 5933093223..1e6ad7b08e 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -37,13 +37,6 @@ android { versionName = generateVersionName(localProperties) testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - val alwaysShowChangelog = localProperties.getProperty("ALWAYS_SHOW_CHANGELOG") ?: "false" - buildConfigField( - type = "boolean", - name = "ALWAYS_SHOW_CHANGELOG", - value = alwaysShowChangelog - ) - lint { lintConfig = file("${rootProject.projectDir}/config/lint.xml") baseline = file("lint-baseline.xml") @@ -158,6 +151,26 @@ android { } } + applicationVariants.configureEach { + val alwaysShowChangelog = gradleLocalProperties(rootProject.projectDir) + .getProperty("ALWAYS_SHOW_CHANGELOG") ?: "false" + + buildConfigField( + "boolean", + "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) { |
