summaryrefslogtreecommitdiffhomepage
path: root/android/app
diff options
context:
space:
mode:
authorDavid Göransson <david.goransson@mullvad.net>2025-05-01 15:57:23 +0200
committerDavid Göransson <david.goransson@mullvad.net>2025-05-07 09:27:54 +0200
commit7dedc5637619fe88ae6c1ec7134304cd623fcdd6 (patch)
treef3b16b92bf65b06d7cbefef2fff033e5ba476e4d /android/app
parent32f38f104d5d33f5afc328b09b7555c7212ac4cb (diff)
downloadmullvadvpn-7dedc5637619fe88ae6c1ec7134304cd623fcdd6.tar.xz
mullvadvpn-7dedc5637619fe88ae6c1ec7134304cd623fcdd6.zip
Fix warnings
Diffstat (limited to 'android/app')
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/connectioninfo/FeatureIndicatorsPanel.kt1
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ConnectScreen.kt8
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/Clipboard.kt22
3 files changed, 17 insertions, 14 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/connectioninfo/FeatureIndicatorsPanel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/connectioninfo/FeatureIndicatorsPanel.kt
index afd13a7382..a485dbe9d9 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/connectioninfo/FeatureIndicatorsPanel.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/connectioninfo/FeatureIndicatorsPanel.kt
@@ -1,4 +1,5 @@
@file:OptIn(ExperimentalSharedTransitionApi::class)
+@file:Suppress("DEPRECATION")
package net.mullvad.mullvadvpn.compose.component.connectioninfo
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ConnectScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ConnectScreen.kt
index 45e9bdee52..17aad41efc 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ConnectScreen.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ConnectScreen.kt
@@ -53,6 +53,7 @@ import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.platform.LocalUriHandler
+import androidx.compose.ui.platform.LocalWindowInfo
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
@@ -354,7 +355,7 @@ fun ConnectScreen(
Scaffold(
modifier =
Modifier.focusProperties {
- enter = { focusDirection ->
+ onEnter = {
// When we return to this screen from SelectLocationScreen the focus is
// sometimes put on the TV navigation drawer, which causes it expand
// (when it was previously not expanded). When returning from
@@ -362,7 +363,7 @@ fun ConnectScreen(
// on the switch location composable.
// When on TV and we return from account or settings we get a
// FocusDirection.Enter event, so focus remains on the navigation drawer.
- if (focusDirection == FocusDirection.Down) contentFocusRequester
+ if (requestedFocusDirection == FocusDirection.Down) contentFocusRequester
else FocusRequester.Default
}
},
@@ -414,8 +415,7 @@ private fun Content(
onDismissNewDeviceClick: () -> Unit,
onNavigateToFeature: (FeatureIndicator) -> Unit,
) {
- val configuration = LocalConfiguration.current
- val screenHeight = configuration.screenHeightDp.dp
+ val screenHeight = LocalWindowInfo.current.containerSize.height.dp
val indicatorPercentOffset =
if (screenHeight < SCREEN_HEIGHT_THRESHOLD) SHORT_SCREEN_INDICATOR_BIAS
else TALL_SCREEN_INDICATOR_BIAS
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/Clipboard.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/Clipboard.kt
index 55bc1855d3..5c2c449037 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/Clipboard.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/Clipboard.kt
@@ -7,7 +7,7 @@ import androidx.compose.material3.SnackbarDuration
import androidx.compose.material3.SnackbarHostState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
-import androidx.compose.ui.platform.ClipboardManager
+import androidx.compose.ui.platform.LocalClipboard
import androidx.compose.ui.platform.LocalClipboardManager
import androidx.compose.ui.platform.toClipEntry
import kotlinx.coroutines.launch
@@ -22,7 +22,7 @@ fun createCopyToClipboardHandle(
isSensitive: Boolean,
): CopyToClipboardHandle {
val scope = rememberCoroutineScope()
- val clipboardManager: ClipboardManager = LocalClipboardManager.current
+ val clipboardManager = LocalClipboard.current
return { textToCopy: String, toastMessage: String? ->
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU && toastMessage != null) {
@@ -34,14 +34,16 @@ fun createCopyToClipboardHandle(
}
}
- val clip =
- ClipData.newPlainText("", textToCopy)
- .apply {
- description.extras =
- PersistableBundle().apply { putBoolean(IS_SENSITIVE_FLAG, isSensitive) }
- }
- .toClipEntry()
+ scope.launch {
+ val clip =
+ ClipData.newPlainText("", textToCopy)
+ .apply {
+ description.extras =
+ PersistableBundle().apply { putBoolean(IS_SENSITIVE_FLAG, isSensitive) }
+ }
+ .toClipEntry()
- clipboardManager.setClip(clip)
+ clipboardManager.setClipEntry(clip)
+ }
}
}