summaryrefslogtreecommitdiffhomepage
path: root/android/app/src/main
diff options
context:
space:
mode:
authorDavid Göransson <david.goransson90@gmail.com>2024-02-26 16:58:36 +0100
committerAlbin <albin@mullvad.net>2024-02-27 09:33:31 +0100
commit81ca0ca0ef00e7d6907d2c9a4ce98211f4dd7eff (patch)
treedf3c3c9a259857225554a3ce79c9302c5d769278 /android/app/src/main
parentb04a45035cb42501ac81fd4e9202c2cb4abcb162 (diff)
downloadmullvadvpn-81ca0ca0ef00e7d6907d2c9a4ce98211f4dd7eff.tar.xz
mullvadvpn-81ca0ca0ef00e7d6907d2c9a4ce98211f4dd7eff.zip
Implement sentence naming of tests
Diffstat (limited to 'android/app/src/main')
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/RedeemVoucherDialog.kt26
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/VoucherDialogUiState.kt2
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/PaymentAvailabilityExtensions.kt2
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VoucherDialogViewModel.kt2
4 files changed, 13 insertions, 19 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/RedeemVoucherDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/RedeemVoucherDialog.kt
index 339de8f3a9..a9029a3758 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/RedeemVoucherDialog.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/RedeemVoucherDialog.kt
@@ -119,14 +119,14 @@ fun RedeemVoucherDialog(
) {
AlertDialog(
title = {
- if (uiState.voucherViewModelState !is VoucherDialogState.Success)
+ if (uiState.voucherState !is VoucherDialogState.Success)
Text(
text = stringResource(id = R.string.enter_voucher_code),
)
},
confirmButton = {
Column {
- if (uiState.voucherViewModelState !is VoucherDialogState.Success) {
+ if (uiState.voucherState !is VoucherDialogState.Success) {
VariantButton(
text = stringResource(id = R.string.redeem),
onClick = { onRedeem(uiState.voucherInput) },
@@ -138,13 +138,11 @@ fun RedeemVoucherDialog(
text =
stringResource(
id =
- if (uiState.voucherViewModelState is VoucherDialogState.Success)
+ if (uiState.voucherState is VoucherDialogState.Success)
R.string.got_it
else R.string.cancel
),
- onClick = {
- onDismiss(uiState.voucherViewModelState is VoucherDialogState.Success)
- }
+ onClick = { onDismiss(uiState.voucherState is VoucherDialogState.Success) }
)
}
},
@@ -153,11 +151,9 @@ fun RedeemVoucherDialog(
modifier = Modifier.fillMaxWidth(),
horizontalAlignment = Alignment.CenterHorizontally
) {
- if (uiState.voucherViewModelState is VoucherDialogState.Success) {
+ if (uiState.voucherState is VoucherDialogState.Success) {
val days: Int =
- (uiState.voucherViewModelState.addedTime /
- DateTimeConstants.SECONDS_PER_DAY)
- .toInt()
+ (uiState.voucherState.addedTime / DateTimeConstants.SECONDS_PER_DAY).toInt()
val message =
stringResource(
R.string.added_to_your_account,
@@ -190,9 +186,7 @@ fun RedeemVoucherDialog(
},
containerColor = MaterialTheme.colorScheme.background,
titleContentColor = MaterialTheme.colorScheme.onBackground,
- onDismissRequest = {
- onDismiss(uiState.voucherViewModelState is VoucherDialogState.Success)
- },
+ onDismissRequest = { onDismiss(uiState.voucherState is VoucherDialogState.Success) },
properties =
DialogProperties(
securePolicy =
@@ -257,7 +251,7 @@ private fun EnterVoucherBody(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.height(Dimens.listIconSize).fillMaxWidth()
) {
- if (uiState.voucherViewModelState is VoucherDialogState.Verifying) {
+ if (uiState.voucherState is VoucherDialogState.Verifying) {
MullvadCircularProgressIndicatorSmall()
Text(
text = stringResource(id = R.string.verifying_voucher),
@@ -265,9 +259,9 @@ private fun EnterVoucherBody(
color = MaterialTheme.colorScheme.onPrimary,
style = MaterialTheme.typography.bodySmall
)
- } else if (uiState.voucherViewModelState is VoucherDialogState.Error) {
+ } else if (uiState.voucherState is VoucherDialogState.Error) {
Text(
- text = uiState.voucherViewModelState.errorMessage,
+ text = uiState.voucherState.errorMessage,
color = MaterialTheme.colorScheme.error,
style = MaterialTheme.typography.bodySmall
)
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/VoucherDialogUiState.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/VoucherDialogUiState.kt
index e719bda529..c143dda0e8 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/VoucherDialogUiState.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/VoucherDialogUiState.kt
@@ -2,7 +2,7 @@ package net.mullvad.mullvadvpn.compose.state
data class VoucherDialogUiState(
val voucherInput: String = "",
- val voucherViewModelState: VoucherDialogState = VoucherDialogState.Default
+ val voucherState: VoucherDialogState = VoucherDialogState.Default
) {
companion object {
val INITIAL = VoucherDialogUiState()
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/PaymentAvailabilityExtensions.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/PaymentAvailabilityExtensions.kt
index 6a69a807f1..aa75c2403a 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/PaymentAvailabilityExtensions.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/PaymentAvailabilityExtensions.kt
@@ -10,7 +10,7 @@ fun PaymentAvailability.toPaymentState(): PaymentState =
is PaymentAvailability.Error.Other -> PaymentState.Error.Generic
is PaymentAvailability.ProductsAvailable -> PaymentState.PaymentAvailable(products)
PaymentAvailability.ProductsUnavailable -> PaymentState.NoPayment
- PaymentAvailability.NoProductsFounds -> PaymentState.NoProductsFounds
+ PaymentAvailability.NoProductsFound -> PaymentState.NoProductsFounds
PaymentAvailability.Loading -> PaymentState.Loading
// Unrecoverable error states
PaymentAvailability.Error.DeveloperError,
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VoucherDialogViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VoucherDialogViewModel.kt
index b26429f18b..8022332650 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VoucherDialogViewModel.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VoucherDialogViewModel.kt
@@ -49,7 +49,7 @@ class VoucherDialogViewModel(
_shared
.flatMapLatest {
combine(vmState, voucherInput) { state, input ->
- VoucherDialogUiState(voucherInput = input, voucherViewModelState = state)
+ VoucherDialogUiState(voucherInput = input, voucherState = state)
}
}
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), VoucherDialogUiState.INITIAL)