diff options
| author | Albin <albin@mullvad.net> | 2024-07-04 11:48:19 +0200 |
|---|---|---|
| committer | Albin <albin@mullvad.net> | 2024-07-04 11:48:19 +0200 |
| commit | 73bba2cfb78b789241db09ff5e39f638ecfad5ac (patch) | |
| tree | e91b65a9f91d81c353dc30cfe7be9d2eb29dcb7c /android/app/src/main | |
| parent | 6fcf6e0c507a90fa95e9f86bc88060629d7cc674 (diff) | |
| parent | a6d23d483fd16a8be34a6cc24cd8222f9757eef2 (diff) | |
| download | mullvadvpn-73bba2cfb78b789241db09ff5e39f638ecfad5ac.tar.xz mullvadvpn-73bba2cfb78b789241db09ff5e39f638ecfad5ac.zip | |
Merge branch 'only-show-unsupported-version-in-settings-droid-1103'
Diffstat (limited to 'android/app/src/main')
10 files changed, 13 insertions, 63 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/NavigationComposeCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/NavigationComposeCell.kt index fdc01ab62d..a0dfe44f09 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/NavigationComposeCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/NavigationComposeCell.kt @@ -14,7 +14,6 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource -import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import net.mullvad.mullvadvpn.R @@ -95,7 +94,7 @@ internal fun NavigationTitleView( Image( painter = painterResource(id = R.drawable.icon_alert), modifier = Modifier.padding(end = Dimens.smallPadding), - contentDescription = stringResource(id = R.string.update_available) + contentDescription = null ) } Text( diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationBanner.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationBanner.kt index c5600b92a2..5a10e005a5 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationBanner.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationBanner.kt @@ -50,12 +50,7 @@ private fun PreviewNotificationBanner() { val bannerDataList = listOf( InAppNotification.UnsupportedVersion( - versionInfo = - VersionInfo( - currentVersion = "1.0", - isSupported = false, - suggestedUpgradeVersion = null - ), + versionInfo = VersionInfo(currentVersion = "1.0", isSupported = false), ), InAppNotification.AccountExpiry(expiry = DateTime.now()), InAppNotification.TunnelStateBlocked, diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationData.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationData.kt index b8ea96fc72..28efcee9c4 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationData.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationData.kt @@ -93,19 +93,6 @@ fun InAppNotification.toNotificationData( if (isPlayBuild) null else NotificationAction(R.drawable.icon_extlink, onClickUpdateVersion) ) - is InAppNotification.UpdateAvailable -> - NotificationData( - title = stringResource(id = R.string.update_available), - message = - stringResource( - id = R.string.update_available_description, - versionInfo.suggestedUpgradeVersion ?: "" - ), - statusLevel = StatusLevel.Warning, - action = - if (isPlayBuild) null - else NotificationAction(R.drawable.icon_extlink, onClickUpdateVersion) - ) } @Composable diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SettingsScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SettingsScreen.kt index 15852560c1..c602d731f2 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SettingsScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SettingsScreen.kt @@ -54,7 +54,7 @@ private fun PreviewSettings() { SettingsUiState( appVersion = "2222.22", isLoggedIn = true, - isUpdateAvailable = true, + isSupportedVersion = true, isPlayBuild = false ), ) @@ -172,13 +172,13 @@ private fun AppVersion(context: Context, state: SettingsUiState) { ) } }, - showWarning = state.isUpdateAvailable, + showWarning = !state.isSupportedVersion, isRowEnabled = !state.isPlayBuild ) - if (state.isUpdateAvailable) { + if (!state.isSupportedVersion) { Text( - text = stringResource(id = R.string.update_available_footer), + text = stringResource(id = R.string.unsupported_version_description), style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSecondary, modifier = diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SettingsUiState.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SettingsUiState.kt index b325ed2ce7..8f5ce2d8a2 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SettingsUiState.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SettingsUiState.kt @@ -3,6 +3,6 @@ package net.mullvad.mullvadvpn.compose.state data class SettingsUiState( val appVersion: String, val isLoggedIn: Boolean, - val isUpdateAvailable: Boolean, + val isSupportedVersion: Boolean, val isPlayBuild: Boolean ) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/InAppNotificationController.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/InAppNotificationController.kt index 79db20d390..6686621f7b 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/InAppNotificationController.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/InAppNotificationController.kt @@ -47,11 +47,6 @@ sealed class InAppNotification { override val statusLevel = StatusLevel.Info override val priority: Long = 1001 } - - data class UpdateAvailable(val versionInfo: VersionInfo) : InAppNotification() { - override val statusLevel = StatusLevel.Info - override val priority: Long = 1000 - } } class InAppNotificationController( diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/VersionInfo.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/VersionInfo.kt index c0ab7dd0ed..7e2550974d 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/VersionInfo.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/VersionInfo.kt @@ -1,9 +1,3 @@ package net.mullvad.mullvadvpn.ui -data class VersionInfo( - val currentVersion: String, - val isSupported: Boolean, - val suggestedUpgradeVersion: String? -) { - val isUpdateAvailable: Boolean = suggestedUpgradeVersion != null -} +data class VersionInfo(val currentVersion: String, val isSupported: Boolean) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/serviceconnection/AppVersionInfoRepository.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/serviceconnection/AppVersionInfoRepository.kt index 74b67348b3..63ce64cd06 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/serviceconnection/AppVersionInfoRepository.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/serviceconnection/AppVersionInfoRepository.kt @@ -12,10 +12,6 @@ class AppVersionInfoRepository( ) { fun versionInfo(): Flow<VersionInfo> = managementService.versionInfo.map { appVersionInfo -> - VersionInfo( - currentVersion = buildVersion.name, - isSupported = appVersionInfo.supported, - suggestedUpgradeVersion = appVersionInfo.suggestedUpgrade, - ) + VersionInfo(currentVersion = buildVersion.name, isSupported = appVersionInfo.supported) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/VersionNotificationUseCase.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/VersionNotificationUseCase.kt index 43f1fdac77..18d4e2fc3e 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/VersionNotificationUseCase.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/VersionNotificationUseCase.kt @@ -14,24 +14,9 @@ class VersionNotificationUseCase( operator fun invoke() = appVersionInfoRepository .versionInfo() - .map { versionInfo -> - listOfNotNull( - unsupportedVersionNotification(versionInfo), - updateAvailableNotification(versionInfo) - ) - } + .map { versionInfo -> listOfNotNull(unsupportedVersionNotification(versionInfo)) } .distinctUntilChanged() - private fun updateAvailableNotification(versionInfo: VersionInfo): InAppNotification? { - if (!isVersionInfoNotificationEnabled) { - return null - } - - return if (versionInfo.isUpdateAvailable) { - InAppNotification.UpdateAvailable(versionInfo) - } else null - } - private fun unsupportedVersionNotification(versionInfo: VersionInfo): InAppNotification? { if (!isVersionInfoNotificationEnabled) { return null diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SettingsViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SettingsViewModel.kt index 5150af2747..21870d99b2 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SettingsViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SettingsViewModel.kt @@ -24,8 +24,7 @@ class SettingsViewModel( SettingsUiState( isLoggedIn = deviceState is DeviceState.LoggedIn, appVersion = versionInfo.currentVersion, - isUpdateAvailable = - versionInfo.let { it.isSupported.not() || it.isUpdateAvailable }, + isSupportedVersion = versionInfo.isSupported, isPlayBuild = isPlayBuild ) } @@ -35,7 +34,7 @@ class SettingsViewModel( SettingsUiState( appVersion = "", isLoggedIn = false, - isUpdateAvailable = false, + isSupportedVersion = true, isPlayBuild ) ) @@ -47,7 +46,7 @@ class SettingsViewModel( SettingsUiState( appVersion = "", isLoggedIn = false, - isUpdateAvailable = false, + isSupportedVersion = true, isPlayBuild ) ) |
