diff options
| author | saber safavi <saber.safavi@codic.se> | 2023-12-01 09:20:49 +0100 |
|---|---|---|
| committer | Jonatan Rhodin <jonatan.rhodin@mullvad.net> | 2023-12-04 16:11:36 +0100 |
| commit | 5ff263804031b674924a6f80a73bc93a708a41e9 (patch) | |
| tree | 951fede4047138f3b4e669fa0a642c718690e748 /android | |
| parent | 12dc1935f4da9c081dc5bc8732efe62ba6c6d27b (diff) | |
| download | mullvadvpn-5ff263804031b674924a6f80a73bc93a708a41e9.tar.xz mullvadvpn-5ff263804031b674924a6f80a73bc93a708a41e9.zip | |
Remove unnecessary else block within when statement
Diffstat (limited to 'android')
2 files changed, 4 insertions, 8 deletions
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 802245bb1d..3691fc79b5 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 @@ -60,9 +60,7 @@ class VoucherDialogViewModel( when (val result = serviceConnectionManager.voucherRedeemer()?.submit(voucherCode)) { is VoucherSubmissionResult.Ok -> handleAddedTime(result.submission.timeAdded) is VoucherSubmissionResult.Error -> setError(result.error) - else -> { - vmState.update { VoucherDialogState.Default } - } + null -> vmState.update { VoucherDialogState.Default } } } } @@ -88,7 +86,8 @@ class VoucherDialogViewModel( when (error) { VoucherSubmissionError.InvalidVoucher -> R.string.invalid_voucher VoucherSubmissionError.VoucherAlreadyUsed -> R.string.voucher_already_used - else -> R.string.error_occurred + VoucherSubmissionError.RpcError, + VoucherSubmissionError.OtherError -> R.string.error_occurred } ) vmState.update { VoucherDialogState.Error(message) } diff --git a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/persistence/SplitTunnelingPersistence.kt b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/persistence/SplitTunnelingPersistence.kt index 264304ab3f..055c9f8777 100644 --- a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/persistence/SplitTunnelingPersistence.kt +++ b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/persistence/SplitTunnelingPersistence.kt @@ -29,9 +29,6 @@ class SplitTunnelingPersistence(context: Context) { } private fun loadExcludedApps(): Set<String> { - return when { - appListFile.exists() -> appListFile.readLines().toSet() - else -> emptySet() - } + return if (appListFile.exists()) appListFile.readLines().toSet() else emptySet() } } |
