summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
authorKalle Lindström <karl.lindstrom@mullvad.net>2024-10-22 17:01:27 +0200
committerDavid Göransson <david.goransson@mullvad.net>2024-10-24 09:34:51 +0200
commit13f2951d45dd5ebe343e89a7d058ff3ec83fe12f (patch)
tree3adae20c82f160a77320619b519cebfc1f631bac /android
parent9fe50f7e9a860e7c34fdd50173368f179c6e86f7 (diff)
downloadmullvadvpn-13f2951d45dd5ebe343e89a7d058ff3ec83fe12f.tar.xz
mullvadvpn-13f2951d45dd5ebe343e89a7d058ff3ec83fe12f.zip
Use KeyboardType.Number on Amazon FireStick
Diffstat (limited to 'android')
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/LoginScreen.kt3
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/Keyboard.kt15
2 files changed, 17 insertions, 1 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/LoginScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/LoginScreen.kt
index a0829b79d5..ba799d55c1 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/LoginScreen.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/LoginScreen.kt
@@ -81,6 +81,7 @@ import net.mullvad.mullvadvpn.compose.textfield.mullvadWhiteTextFieldColors
import net.mullvad.mullvadvpn.compose.transitions.LoginTransition
import net.mullvad.mullvadvpn.compose.util.CollectSideEffectWithLifecycle
import net.mullvad.mullvadvpn.compose.util.OnNavResultValue
+import net.mullvad.mullvadvpn.compose.util.accountNumberKeyboardType
import net.mullvad.mullvadvpn.compose.util.accountNumberVisualTransformation
import net.mullvad.mullvadvpn.compose.util.showSnackbarImmediately
import net.mullvad.mullvadvpn.lib.theme.AppTheme
@@ -285,7 +286,7 @@ private fun ColumnScope.LoginInput(
keyboardOptions =
KeyboardOptions(
imeAction = if (state.loginButtonEnabled) ImeAction.Done else ImeAction.None,
- keyboardType = KeyboardType.NumberPassword,
+ keyboardType = KeyboardType.accountNumberKeyboardType(LocalContext.current),
),
onValueChange = onAccountNumberChange,
singleLine = true,
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/Keyboard.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/Keyboard.kt
new file mode 100644
index 0000000000..ce2e9206cc
--- /dev/null
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/Keyboard.kt
@@ -0,0 +1,15 @@
+package net.mullvad.mullvadvpn.compose.util
+
+import android.content.Context
+import androidx.compose.ui.text.input.KeyboardType
+
+fun KeyboardType.Companion.accountNumberKeyboardType(context: Context): KeyboardType =
+ if (isFireStick(context)) {
+ Number
+ } else {
+ NumberPassword
+ }
+
+// See: https://developer.amazon.com/docs/fire-tv/identify-amazon-fire-tv-devices.html
+private fun isFireStick(context: Context): Boolean =
+ context.packageManager.hasSystemFeature("amazon.hardware.fire_tv")