diff options
| author | David Göransson <david.goransson@mullvad.net> | 2025-10-02 11:27:53 +0200 |
|---|---|---|
| committer | Jonatan Rhodin <jonatan.rhodin@mullvad.net> | 2025-10-06 11:43:15 +0200 |
| commit | d229d24b508f97c24fcc0a4a2db4f845141fd931 (patch) | |
| tree | 19241200a1830c7c5b8703714d2055b8d87619e7 /android/lib/ui/component/src | |
| parent | f82099962e5160b4577038b794170fa2f70ed546 (diff) | |
| download | mullvadvpn-d229d24b508f97c24fcc0a4a2db4f845141fd931.tar.xz mullvadvpn-d229d24b508f97c24fcc0a4a2db4f845141fd931.zip | |
Warn users about android 16 upgrade issue
Diffstat (limited to 'android/lib/ui/component/src')
3 files changed, 52 insertions, 2 deletions
diff --git a/android/lib/ui/component/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/component/AnimatedNotificationBanner.kt b/android/lib/ui/component/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/component/AnimatedNotificationBanner.kt index 94a935db74..b9799fab33 100644 --- a/android/lib/ui/component/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/component/AnimatedNotificationBanner.kt +++ b/android/lib/ui/component/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/component/AnimatedNotificationBanner.kt @@ -49,9 +49,11 @@ fun AnimatedNotificationBanner( contentFocusRequester: FocusRequester, onClickShowAccount: () -> Unit, onClickShowChangelog: () -> Unit, + onClickShowAndroid16UpgradeInfo: () -> Unit, onClickDismissChangelog: () -> Unit, onClickDismissNewDevice: () -> Unit, onClickShowWireguardPortSettings: () -> Unit, + onClickDismissAndroid16UpgradeWarning: () -> Unit, ) { // Fix for animating to invisible state val previous = rememberPrevious(current = notification, shouldUpdate = { _, _ -> true }) @@ -81,9 +83,11 @@ fun AnimatedNotificationBanner( openAppListing, onClickShowAccount, onClickShowChangelog, + onClickShowAndroid16UpgradeInfo, onClickDismissChangelog, onClickDismissNewDevice, onClickShowWireguardPortSettings, + onClickDismissAndroid16UpgradeWarning, ), ) } diff --git a/android/lib/ui/component/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/component/NotificationData.kt b/android/lib/ui/component/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/component/NotificationData.kt index 3af3b8b4ae..9f4c17dbd9 100644 --- a/android/lib/ui/component/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/component/NotificationData.kt +++ b/android/lib/ui/component/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/component/NotificationData.kt @@ -25,6 +25,8 @@ import net.mullvad.mullvadvpn.lib.model.ErrorStateCause import net.mullvad.mullvadvpn.lib.model.InAppNotification import net.mullvad.mullvadvpn.lib.model.ParameterGenerationError import net.mullvad.mullvadvpn.lib.model.StatusLevel +import net.mullvad.mullvadvpn.lib.ui.component.NotificationMessage.ClickableText +import net.mullvad.mullvadvpn.lib.ui.component.NotificationMessage.Text data class NotificationData( val title: AnnotatedString, @@ -70,15 +72,18 @@ data class NotificationAction( val contentDescription: String, ) +@Suppress("LongMethod") @Composable fun InAppNotification.toNotificationData( isPlayBuild: Boolean, openAppListing: () -> Unit, onClickShowAccount: () -> Unit, onClickShowChangelog: () -> Unit, + onClickShowAndroid16UpgradeInfo: () -> Unit, onClickDismissChangelog: () -> Unit, onClickDismissNewDevice: () -> Unit, onClickShowWireguardPortSettings: () -> Unit, + onClickDismissAndroid16UpgradeWarning: () -> Unit, ) = when (this) { is InAppNotification.NewDevice -> @@ -86,7 +91,7 @@ fun InAppNotification.toNotificationData( title = AnnotatedString(stringResource(id = R.string.new_device_notification_title)), message = - NotificationMessage.Text( + Text( stringResource(id = R.string.new_device_notification_message, deviceName) .formatWithHtml() ), @@ -135,7 +140,7 @@ fun InAppNotification.toNotificationData( NotificationData( title = stringResource(id = R.string.new_changelog_notification_title), message = - NotificationMessage.ClickableText( + ClickableText( text = buildAnnotatedString { withStyle(SpanStyle(textDecoration = TextDecoration.Underline)) { @@ -158,6 +163,40 @@ fun InAppNotification.toNotificationData( stringResource(id = R.string.dismiss), ), ) + + InAppNotification.Android16UpgradeWarning -> + NotificationData( + title = stringResource(id = R.string.android_16_upgrade_warning_title), + message = + ClickableText( + text = + buildAnnotatedString { + append( + stringResource(id = R.string.android_16_upgrade_warning_message) + ) + append(SPACE_CHAR) + withStyle( + SpanStyle( + textDecoration = TextDecoration.Underline, + color = MaterialTheme.colorScheme.onSurface, + ) + ) { + append(stringResource(R.string.click_here)) + } + append(DOT_CHAR) + }, + onClick = onClickShowAndroid16UpgradeInfo, + contentDescription = + stringResource(id = R.string.new_changelog_notification_message), + ), + statusLevel = statusLevel, + action = + NotificationAction( + Icons.Default.Clear, + onClickDismissAndroid16UpgradeWarning, + stringResource(id = R.string.dismiss), + ), + ) } @Composable diff --git a/android/lib/ui/component/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/component/StringConstant.kt b/android/lib/ui/component/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/component/StringConstant.kt new file mode 100644 index 0000000000..3198dc8101 --- /dev/null +++ b/android/lib/ui/component/src/main/kotlin/net/mullvad/mullvadvpn/lib/ui/component/StringConstant.kt @@ -0,0 +1,7 @@ +package net.mullvad.mullvadvpn.lib.ui.component + +const val EMPTY_STRING = "" +const val SPACE_CHAR = ' ' +const val NEWLINE_STRING = "\n" +const val HTML_NEWLINE_STRING = "<br/>" +const val DOT_CHAR = '.' |
