From 38b242efcd0af55c3affa8c64e4f7fe456847245 Mon Sep 17 00:00:00 2001 From: Albin Date: Wed, 28 Aug 2024 20:29:07 +0200 Subject: [PATCH 1/4] Bump ktfmt plugin to 0.20.1 --- android/gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/gradle/libs.versions.toml b/android/gradle/libs.versions.toml index 90a53d5c6d95..72feb3124537 100644 --- a/android/gradle/libs.versions.toml +++ b/android/gradle/libs.versions.toml @@ -57,7 +57,7 @@ detekt = "1.23.6" jodatime = "2.12.7" kermit = "2.0.4" konsist = "0.15.1" -ktfmt = "0.17.0" +ktfmt = "0.20.1" leakcanary = "2.13" mockk = "1.13.12" mockwebserver = "4.12.0" From a71f1e7a6888bc6af5a9df355afd26d3f56d0e5c Mon Sep 17 00:00:00 2001 From: Albin Date: Wed, 28 Aug 2024 20:29:32 +0200 Subject: [PATCH 2/4] Update gradle lockfile --- android/gradle/verification-metadata.xml | 35 +++++++++++++----------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/android/gradle/verification-metadata.xml b/android/gradle/verification-metadata.xml index 590aa4030739..70fa2b89098e 100644 --- a/android/gradle/verification-metadata.xml +++ b/android/gradle/verification-metadata.xml @@ -2790,9 +2790,9 @@ - - - + + + @@ -3053,6 +3053,11 @@ + + + + + @@ -3083,9 +3088,9 @@ - - - + + + @@ -3103,11 +3108,6 @@ - - - - - @@ -3130,6 +3130,9 @@ + + + @@ -3312,12 +3315,12 @@ - - - + + + - - + + From b52c423d777213d5bb92430bccec880c6367a70b Mon Sep 17 00:00:00 2001 From: Albin Date: Wed, 28 Aug 2024 20:33:46 +0200 Subject: [PATCH 3/4] Reformat kotlin code using updated ktfmt plugin This commit mostly adds trailing commas throughout the project, but also includes a few other formatting changes. --- .../kotlin/net/mullvad/mullvadvpn/Actions.kt | 3 +- .../kotlin/net/mullvad/mullvadvpn/Finders.kt | 2 +- .../compose/data/DummyApiAccessMethods.kt | 6 +- .../compose/data/DummyRelayItems.kt | 37 ++--- .../compose/dialog/CustomPortDialogTest.kt | 2 +- .../DeleteCustomListConfirmationDialogTest.kt | 6 +- .../compose/dialog/DnsDialogTest.kt | 4 +- .../compose/dialog/MtuDialogTest.kt | 24 +--- ...ServerIPOverridesConfirmationDialogTest.kt | 4 +- .../dialog/SaveApiAccessMethodDialogTest.kt | 14 +- .../compose/screen/AccountScreenTest.kt | 32 ++--- .../compose/screen/ApiAccessListScreenTest.kt | 6 +- .../ApiAccessMethodDetailsScreenTest.kt | 26 ++-- .../compose/screen/ChangelogDialogTest.kt | 7 +- .../compose/screen/ConnectScreenTest.kt | 84 ++++++------ .../screen/CustomListLocationsScreenTest.kt | 25 ++-- .../compose/screen/CustomListsScreenTest.kt | 8 +- .../screen/EditApiAccessMethodScreenTest.kt | 32 ++--- .../screen/EditCustomListScreenTest.kt | 16 +-- .../compose/screen/FilterScreenTest.kt | 26 ++-- .../compose/screen/OutOfTimeScreenTest.kt | 32 ++--- .../compose/screen/RedeemVoucherDialogTest.kt | 12 +- .../screen/SelectLocationScreenTest.kt | 28 ++-- .../screen/ServerIpOverridesScreenTest.kt | 10 +- .../compose/screen/SettingsScreenTest.kt | 8 +- .../screen/SplitTunnelingScreenTest.kt | 34 ++--- .../compose/screen/VpnSettingsScreenTest.kt | 76 +++++------ .../compose/screen/WelcomeScreenTest.kt | 26 ++-- .../net/mullvad/mullvadvpn/applist/AppData.kt | 2 +- .../applist/ApplicationsProvider.kt | 4 +- .../compose/button/AnimatedIconButton.kt | 4 +- .../mullvadvpn/compose/button/ApplyButton.kt | 2 +- .../compose/button/ConnectionButton.kt | 26 ++-- .../compose/button/ExternalActionButton.kt | 2 +- .../compose/button/InfoIconButton.kt | 4 +- .../compose/button/MullvadButton.kt | 20 +-- .../compose/button/RedeemVoucherButton.kt | 2 +- .../compose/button/SitePaymentButton.kt | 10 +- .../compose/button/SwitchLocationButton.kt | 6 +- .../mullvadvpn/compose/cell/BaseCell.kt | 22 +-- .../mullvadvpn/compose/cell/CheckboxCell.kt | 6 +- .../mullvadvpn/compose/cell/CustomPortCell.kt | 12 +- .../mullvadvpn/compose/cell/DnsCell.kt | 8 +- .../compose/cell/DropdownMenuCell.kt | 14 +- .../compose/cell/ExpandableComposeCell.kt | 26 ++-- .../mullvadvpn/compose/cell/FilterRow.kt | 16 +-- .../mullvadvpn/compose/cell/HeaderCell.kt | 10 +- .../mullvadvpn/compose/cell/IconCell.kt | 6 +- .../compose/cell/InformationComposeCell.kt | 12 +- .../mullvadvpn/compose/cell/MtuComposeCell.kt | 13 +- .../compose/cell/NavigationComposeCell.kt | 28 ++-- .../compose/cell/RelayLocationCell.kt | 24 ++-- .../mullvadvpn/compose/cell/SelectableCell.kt | 8 +- .../compose/cell/ServerIpOverridesCell.kt | 8 +- .../compose/cell/SplitTunnelingCell.kt | 14 +- .../compose/cell/SwitchComposeCell.kt | 34 ++--- .../mullvadvpn/compose/cell/TwoRowCell.kt | 8 +- .../compose/communication/CustomListAction.kt | 2 +- .../CustomListActionResultData.kt | 12 +- .../communication/CustomListSuccess.kt | 2 +- .../compose/component/AccountNumberView.kt | 4 +- .../mullvadvpn/compose/component/Chevron.kt | 4 +- .../component/CircularProgressIndicator.kt | 8 +- .../compose/component/ConnectionStatusText.kt | 8 +- .../component/CopyableObfuscationView.kt | 8 +- .../compose/component/FilterChip.kt | 12 +- .../mullvadvpn/compose/component/HtmlText.kt | 2 +- .../compose/component/InformationView.kt | 10 +- .../compose/component/LocationInfo.kt | 14 +- .../compose/component/LocationsEmptyText.kt | 7 +- .../compose/component/MullvadCheckbox.kt | 6 +- .../MullvadExposedDropdownMenuBox.kt | 10 +- .../component/MullvadModalBottomSheet.kt | 15 +- .../compose/component/NavigateButton.kt | 2 +- .../compose/component/PlayPayment.kt | 26 ++-- .../compose/component/Scaffolding.kt | 48 +++---- .../mullvadvpn/compose/component/Scrollbar.kt | 52 +++---- .../compose/component/SpacedColumn.kt | 4 +- .../mullvadvpn/compose/component/Switch.kt | 6 +- .../mullvadvpn/compose/component/Text.kt | 2 +- .../mullvadvpn/compose/component/TopBar.kt | 66 ++++----- .../notificationbanner/NotificationBanner.kt | 28 ++-- .../notificationbanner/NotificationData.kt | 37 ++--- .../dialog/ApiAccessMethodInfoDialog.kt | 2 +- .../compose/dialog/ChangelogDialog.kt | 20 +-- .../dialog/ContentBlockersInfoDialog.kt | 2 +- .../compose/dialog/CreateCustomListDialog.kt | 20 ++- .../compose/dialog/CustomDnsInfoDialog.kt | 2 +- ...DeleteApiAccessMethodConfirmationDialog.kt | 17 +-- .../dialog/DeleteConfirmationDialog.kt | 17 +-- .../DeleteCustomListConfirmationDialog.kt | 14 +- .../compose/dialog/DeviceNameInfoDialog.kt | 2 +- .../compose/dialog/DiscardChangesDialog.kt | 6 +- .../mullvadvpn/compose/dialog/DnsDialog.kt | 21 ++- .../dialog/EditCustomListNameDialog.kt | 22 ++- .../mullvadvpn/compose/dialog/InfoDialog.kt | 16 +-- .../dialog/LocalNetworkSharingInfoDialog.kt | 2 +- .../compose/dialog/MalwareInfoDialog.kt | 2 +- .../mullvadvpn/compose/dialog/MtuDialog.kt | 14 +- .../compose/dialog/ObfuscationInfoDialog.kt | 2 +- .../dialog/QuantumResistanceInfoDialog.kt | 2 +- .../compose/dialog/RedeemVoucherDialog.kt | 55 ++++---- .../dialog/RemoveDeviceConfirmationDialog.kt | 10 +- .../dialog/ReportProblemNoEmailDialog.kt | 10 +- ...esetServerIpOverridesConfirmationDialog.kt | 12 +- .../dialog/SaveApiAccessMethodDialog.kt | 20 ++- .../dialog/ServerIpOverridesInfoDialog.kt | 2 +- .../dialog/UdpOverTcpPortInfoDialog.kt | 2 +- .../dialog/WireguardCustomPortDialog.kt | 24 ++-- .../compose/dialog/WireguardPortInfoDialog.kt | 6 +- .../compose/dialog/payment/PaymentDialog.kt | 38 +++--- .../dialog/payment/PaymentDialogData.kt | 4 +- .../payment/VerificationPendingDialog.kt | 6 +- .../compose/extensions/LazyListExtensions.kt | 6 +- .../compose/extensions/LifecycleExtensions.kt | 6 +- .../compose/extensions/ResourcesExtensions.kt | 2 +- .../ApiAccessListUiStateParameterProvider.kt | 6 +- ...dDetailsUiStatePreviewParameterProvider.kt | 6 +- .../compose/preview/ApiAccessPreviewData.kt | 14 +- .../DeviceListPreviewParameterProvider.kt | 2 +- .../compose/preview/DevicePreviewData.kt | 8 +- ...ApiAccessMethodUiStateParameterProvider.kt | 16 +-- ...OutOfTimeScreenPreviewParameterProvider.kt | 8 +- ...emCheckableCellPreviewParameterProvider.kt | 4 +- .../compose/preview/RelayItemPreviewData.kt | 8 +- ...yItemStatusCellPreviewParameterProvider.kt | 6 +- ...ssMethodUiStatePreviewParameterProvider.kt | 8 +- .../compose/preview/TunnelStatePreviewData.kt | 8 +- .../TunnelStatePreviewParameterProvider.kt | 2 +- .../compose/screen/AccountScreen.kt | 51 ++++--- .../compose/screen/ApiAccessListScreen.kt | 30 ++-- .../screen/ApiAccessMethodDetailsScreen.kt | 30 ++-- .../AutoConnectAndLockdownModeScreen.kt | 48 +++---- .../compose/screen/ConnectScreen.kt | 53 +++----- .../screen/CustomListLocationsScreen.kt | 29 ++-- .../compose/screen/CustomListsScreen.kt | 35 ++--- .../compose/screen/DeviceListScreen.kt | 55 ++++---- .../compose/screen/DeviceRevokedScreen.kt | 16 +-- .../screen/EditApiAccessMethodScreen.kt | 84 ++++++------ .../compose/screen/EditCustomListScreen.kt | 34 +++-- .../mullvadvpn/compose/screen/FilterScreen.kt | 38 +++--- .../screen/ImportOverridesByTextScreen.kt | 23 ++-- .../mullvadvpn/compose/screen/LoginScreen.kt | 36 ++--- .../compose/screen/NoDaemonScreen.kt | 12 +- .../compose/screen/OutOfTimeScreen.kt | 44 +++--- .../compose/screen/PrivacyDisclaimerScreen.kt | 24 ++-- .../compose/screen/ReportProblemScreen.kt | 46 +++---- .../compose/screen/SelectLocationScreen.kt | 128 +++++++++--------- .../compose/screen/ServerIpOverridesScreen.kt | 55 ++++---- .../compose/screen/SettingsScreen.kt | 30 ++-- .../mullvadvpn/compose/screen/SplashScreen.kt | 12 +- .../compose/screen/SplitTunnelingScreen.kt | 22 +-- .../compose/screen/ViewLogsScreen.kt | 31 ++--- .../compose/screen/VpnSettingsScreen.kt | 68 +++++----- .../compose/screen/WelcomeScreen.kt | 59 ++++---- .../compose/state/ApiAccessListUiState.kt | 2 +- .../state/CustomListLocationsUiState.kt | 4 +- .../compose/state/DeviceListUiState.kt | 4 +- .../compose/state/DeviceRevokedUiState.kt | 2 +- .../state/EditApiAccessMethodUiState.kt | 6 +- .../compose/state/EditCustomListState.kt | 2 +- .../mullvadvpn/compose/state/LoginUiState.kt | 2 +- .../compose/state/RelayFilterState.kt | 2 +- .../state/SaveApiAccessMethodUiState.kt | 2 +- .../compose/state/SelectLocationUiState.kt | 4 +- .../compose/state/SplitTunnelingUiState.kt | 2 +- .../compose/state/VoucherDialogUiState.kt | 2 +- .../compose/state/VpnSettingsUiState.kt | 2 +- .../textfield/ApiAccessMethodTextField.kt | 10 +- .../textfield/CustomListNameTextField.kt | 6 +- .../compose/textfield/CustomPortTextField.kt | 4 +- .../compose/textfield/CustomTextField.kt | 2 +- .../compose/textfield/DnsTextField.kt | 4 +- .../compose/textfield/MtuTextField.kt | 4 +- .../compose/textfield/SearchTextField.kt | 6 +- .../compose/textfield/TextFieldColors.kt | 10 +- .../util/AccountNumberVisualTransformation.kt | 2 +- .../mullvadvpn/compose/util/Clipboard.kt | 6 +- .../mullvad/mullvadvpn/compose/util/Effect.kt | 4 +- .../mullvadvpn/compose/util/Snackbar.kt | 2 +- .../util/VoucherVisualTransformation.kt | 4 +- .../dataproxy/MullvadProblemReport.kt | 4 +- .../net/mullvad/mullvadvpn/di/UiModule.kt | 4 +- .../provider/MullvadFileProvider.kt | 5 +- .../relaylist/RelayItemExtensions.kt | 8 +- .../repository/ApiAccessRepository.kt | 8 +- .../repository/ChangelogRepository.kt | 2 +- .../repository/CustomListsRepository.kt | 4 +- .../repository/InAppNotificationController.kt | 2 +- .../repository/RelayListFilterRepository.kt | 4 +- .../repository/RelayListRepository.kt | 4 +- .../repository/SettingsRepository.kt | 12 +- .../repository/SplitTunnelingRepository.kt | 2 +- .../AppVersionInfoRepository.kt | 6 +- .../ServiceConnectionManager.kt | 2 +- .../AccountExpiryNotificationUseCase.kt | 4 +- .../usecase/FilteredRelayListUseCase.kt | 9 +- .../usecase/NewDeviceNotificationUseCase.kt | 4 +- .../mullvadvpn/usecase/OutOfTimeUseCase.kt | 2 +- .../mullvadvpn/usecase/PaymentUseCase.kt | 2 +- .../usecase/SelectedLocationTitleUseCase.kt | 6 +- .../customlists/CustomListActionUseCase.kt | 4 +- .../CustomListRelayItemsUseCase.kt | 4 +- .../FilterCustomListsRelayItemUseCase.kt | 4 +- .../net/mullvad/mullvadvpn/util/FlowUtils.kt | 2 +- .../util/PurchaseResultExtensions.kt | 8 +- .../mullvadvpn/viewmodel/AccountViewModel.kt | 6 +- .../viewmodel/ApiAccessListViewModel.kt | 2 +- .../ApiAccessMethodDetailsViewModel.kt | 8 +- .../viewmodel/ChangelogViewModel.kt | 2 +- .../mullvadvpn/viewmodel/ConnectViewModel.kt | 4 +- .../CreateCustomListDialogViewModel.kt | 8 +- .../viewmodel/CustomListLocationsViewModel.kt | 31 ++--- .../viewmodel/CustomListsViewModel.kt | 4 +- ...eteApiAccessMethodConfirmationViewModel.kt | 6 +- .../DeleteCustomListConfirmationViewModel.kt | 8 +- .../viewmodel/DeviceListViewModel.kt | 4 +- .../viewmodel/DeviceRevokedViewModel.kt | 4 +- .../viewmodel/DnsDialogViewModel.kt | 14 +- .../viewmodel/EditApiAccessMethodViewModel.kt | 31 ++--- .../EditCustomListNameDialogViewModel.kt | 10 +- .../viewmodel/EditCustomListViewModel.kt | 4 +- .../mullvadvpn/viewmodel/FilterViewModel.kt | 22 ++- .../mullvadvpn/viewmodel/LoginViewModel.kt | 17 ++- .../viewmodel/MtuDialogViewModel.kt | 12 +- .../mullvadvpn/viewmodel/NoDaemonViewModel.kt | 4 +- .../viewmodel/OutOfTimeViewModel.kt | 2 +- .../mullvadvpn/viewmodel/PaymentViewModel.kt | 4 +- .../viewmodel/PrivacyDisclaimerViewModel.kt | 2 +- .../viewmodel/ReportProblemViewModel.kt | 7 +- ...tServerIpOverridesConfirmationViewModel.kt | 4 +- .../viewmodel/SaveApiAccessMethodViewModel.kt | 16 +-- .../viewmodel/SelectLocationViewModel.kt | 44 +++--- .../viewmodel/ServerIpOverridesViewModel.kt | 4 +- .../mullvadvpn/viewmodel/SettingsViewModel.kt | 13 +- .../mullvadvpn/viewmodel/SplashViewModel.kt | 2 +- .../viewmodel/SplitTunnelingViewModel.kt | 2 +- .../viewmodel/SplitTunnelingViewModelState.kt | 4 +- .../mullvadvpn/viewmodel/ViewLogsViewModel.kt | 2 +- .../viewmodel/VoucherDialogViewModel.kt | 2 +- .../viewmodel/VpnPermissionViewModel.kt | 2 +- .../viewmodel/VpnSettingsViewModel.kt | 21 ++- .../viewmodel/VpnSettingsViewModelState.kt | 4 +- .../mullvadvpn/viewmodel/WelcomeViewModel.kt | 2 +- .../InAppNotificationControllerTest.kt | 4 +- .../applist/ApplicationsProviderTest.kt | 23 ++-- .../repository/ApiAccessRepositoryTest.kt | 8 +- .../repository/ChangelogRepositoryTest.kt | 2 +- .../repository/CustomListsRepositoryTest.kt | 14 +- .../RelayListFilterRepositoryTest.kt | 6 +- .../AccountExpiryNotificationUseCaseTest.kt | 2 +- .../usecase/CustomListActionUseCaseTest.kt | 6 +- .../NewDeviceNotificationUseCaseTest.kt | 6 +- .../usecase/VersionNotificationUseCaseTest.kt | 10 +- .../VoucherRegexHelperParameterizedTest.kt | 2 +- .../viewmodel/AccountViewModelTest.kt | 7 +- .../ApiAccessMethodDetailsViewModelTest.kt | 4 +- .../viewmodel/ConnectViewModelTest.kt | 4 +- .../CreateCustomListDialogViewModelTest.kt | 9 +- .../CustomListLocationsViewModelTest.kt | 27 ++-- .../viewmodel/CustomListsViewModelTest.kt | 2 +- ...piAccessMethodConfirmationViewModelTest.kt | 2 +- ...leteCustomListConfirmationViewModelTest.kt | 4 +- .../viewmodel/DeviceRevokedViewModelTest.kt | 2 +- .../EditCustomListNameDialogViewModelTest.kt | 2 +- .../viewmodel/EditCustomListViewModelTest.kt | 2 +- .../viewmodel/FilterViewModelTest.kt | 12 +- .../viewmodel/LoginViewModelTest.kt | 10 +- .../viewmodel/OutOfTimeViewModelTest.kt | 2 +- .../viewmodel/ReportProblemViewModelTest.kt | 30 ++-- ...verIpOverridesConfirmationViewModelTest.kt | 4 +- .../SaveApiAccessMethodViewModelTest.kt | 42 +++--- .../viewmodel/SelectLocationViewModelTest.kt | 24 ++-- .../ServerIpOverridesViewModelTest.kt | 2 +- .../viewmodel/SettingsViewModelTest.kt | 2 +- .../viewmodel/SplitTunnelingViewModelTest.kt | 14 +- .../viewmodel/VpnSettingsViewModelTest.kt | 6 +- .../viewmodel/WelcomeViewModelTest.kt | 2 +- .../lib/billing/BillingRepositoryTest.kt | 8 +- .../lib/billing/BillingPaymentRepository.kt | 12 +- .../lib/billing/BillingRepository.kt | 6 +- .../ProductDetailsToPaymentProduct.kt | 2 +- .../billing/BillingPaymentRepositoryTest.kt | 12 +- .../mullvadvpn/lib/common/test/TestUtils.kt | 2 +- .../common/util/ErrorNotificationMessage.kt | 2 +- .../lib/common/util/ErrorStateExtension.kt | 6 +- .../lib/daemon/grpc/ManagementService.kt | 10 +- .../lib/daemon/grpc/mapper/ToDomain.kt | 60 ++++---- .../lib/daemon/grpc/util/LogInterceptor.kt | 2 +- .../daemon/grpc/RelayNameComparatorTest.kt | 78 +++++------ .../mullvadvpn/lib/endpoint/ApiEndpoint.kt | 2 +- .../CustomApiEndpointConfiguration.kt | 4 +- .../mullvadvpn/lib/map/CameraAnimation.kt | 6 +- .../net/mullvad/mullvadvpn/lib/map/Map.kt | 6 +- .../lib/map/data/LocationMarkerColors.kt | 2 +- .../mullvadvpn/lib/map/data/MapViewState.kt | 2 +- .../mullvad/mullvadvpn/lib/map/data/Marker.kt | 2 +- .../mullvadvpn/lib/map/internal/GLHelper.kt | 6 +- .../lib/map/internal/MapGLRenderer.kt | 4 +- .../lib/map/internal/shapes/Globe.kt | 12 +- .../lib/map/internal/shapes/LocationMarker.kt | 6 +- .../mullvadvpn/lib/model/AccountData.kt | 5 +- .../lib/model/ActionAfterDisconnect.kt | 2 +- .../mullvadvpn/lib/model/ApiAccessMethod.kt | 2 +- .../lib/model/ApiAccessMethodSetting.kt | 2 +- .../mullvadvpn/lib/model/CustomList.kt | 2 +- .../mullvadvpn/lib/model/DnsOptions.kt | 2 +- .../mullvad/mullvadvpn/lib/model/DnsState.kt | 2 +- .../lib/model/NewAccessMethodSetting.kt | 2 +- .../mullvadvpn/lib/model/Notification.kt | 2 +- .../lib/model/ObfuscationSettings.kt | 2 +- .../mullvadvpn/lib/model/ObfuscationType.kt | 2 +- .../mullvad/mullvadvpn/lib/model/Ownership.kt | 2 +- .../lib/model/ParameterGenerationError.kt | 2 +- .../lib/model/QuantumResistantState.kt | 2 +- .../mullvad/mullvadvpn/lib/model/RelayItem.kt | 10 +- .../mullvad/mullvadvpn/lib/model/RelayList.kt | 2 +- .../mullvadvpn/lib/model/RelayOverride.kt | 2 +- .../lib/model/SelectedObfuscation.kt | 2 +- .../mullvad/mullvadvpn/lib/model/Settings.kt | 2 +- .../mullvadvpn/lib/model/TransportProtocol.kt | 2 +- .../mullvadvpn/lib/model/TunnelEndpoint.kt | 2 +- .../mullvadvpn/lib/model/TunnelState.kt | 6 +- .../lib/payment/PaymentRepository.kt | 2 +- .../lib/payment/model/PaymentProduct.kt | 2 +- .../lib/payment/model/PaymentStatus.kt | 2 +- .../lib/shared/AccountRepository.kt | 4 +- .../mullvadvpn/lib/shared/ConnectionProxy.kt | 2 +- .../mullvadvpn/lib/shared/DeviceRepository.kt | 6 +- .../RelayLocationTranslationRepository.kt | 2 +- .../lib/shared/VoucherRepository.kt | 2 +- .../lib/shared/ConnectionProxyTest.kt | 2 +- .../net/mullvad/talpid/model/TunConfig.kt | 2 +- .../net/mullvad/mullvadvpn/lib/theme/Theme.kt | 10 +- .../net/mullvad/mullvadvpn/lib/theme/Type.kt | 4 +- .../mullvadvpn/lib/theme/typeface/Typeface.kt | 6 +- .../mullvadvpn/service/MullvadDaemon.kt | 2 +- .../mullvadvpn/service/MullvadVpnService.kt | 2 +- .../mullvadvpn/service/di/VpnServiceModule.kt | 16 +-- .../ForegroundNotificationManager.kt | 4 +- .../NotificationChannelFactory.kt | 12 +- .../notifications/NotificationManager.kt | 4 +- .../AccountExpiryAndroidNotification.kt | 4 +- .../AccountExpiryNotificationProvider.kt | 2 +- .../TunnelStateNotificationAction.kt | 2 +- .../TunnelStateNotificationProvider.kt | 16 +-- .../mullvad/mullvadvpn/test/arch/NameTest.kt | 6 +- .../common/extension/UiAutomatorExtensions.kt | 4 +- .../test/common/interactor/AppInteractor.kt | 6 +- .../rule/CaptureScreenshotOnFailedTestRule.kt | 8 +- .../mullvadvpn/test/e2e/EndToEndTest.kt | 2 +- .../mullvadvpn/test/e2e/WebLinkTest.kt | 2 +- .../interactor/MullvadAccountInteractor.kt | 2 +- .../test/e2e/misc/AccountTestRule.kt | 2 +- .../test/e2e/misc/SimpleMullvadHttpClient.kt | 16 +-- .../test/mockapi/MockApiDispatcher.kt | 10 +- .../mullvadvpn/test/mockapi/MockApiTest.kt | 2 +- .../test/mockapi/TooManyDevicesMockApiTest.kt | 2 +- .../test/mockapi/constant/Constants.kt | 2 +- .../mullvadvpn/tile/MullvadTileService.kt | 10 +- 360 files changed, 1981 insertions(+), 2277 deletions(-) diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/Actions.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/Actions.kt index ebd570252a49..c87672108f67 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/Actions.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/Actions.kt @@ -7,7 +7,8 @@ import androidx.compose.ui.test.longClick import androidx.compose.ui.test.performTouchInput fun SemanticsNodeInteraction.performLongClick(): SemanticsNodeInteraction { - @OptIn(ExperimentalTestApi::class) return this.invokeGlobalAssertions().performLongClickImpl() + @OptIn(ExperimentalTestApi::class) + return this.invokeGlobalAssertions().performLongClickImpl() } private fun SemanticsNodeInteraction.performLongClickImpl(): SemanticsNodeInteraction { diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/Finders.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/Finders.kt index 384f365e5e54..1dbbe1e4813e 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/Finders.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/Finders.kt @@ -10,6 +10,6 @@ fun SemanticsNodeInteractionsProvider.onNodeWithTagAndText( text: String, substring: Boolean = false, ignoreCase: Boolean = false, - useUnmergedTree: Boolean = false + useUnmergedTree: Boolean = false, ): SemanticsNodeInteraction = onNode(hasTestTag(testTag).and(hasText(text, substring, ignoreCase)), useUnmergedTree) diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/data/DummyApiAccessMethods.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/data/DummyApiAccessMethods.kt index a644449a911b..046360cf4d28 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/data/DummyApiAccessMethods.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/data/DummyApiAccessMethods.kt @@ -15,7 +15,7 @@ val DIRECT_ACCESS_METHOD = id = ApiAccessMethodId.fromString(UUID1), name = ApiAccessMethodName.fromString("Direct"), enabled = true, - apiAccessMethod = ApiAccessMethod.Direct + apiAccessMethod = ApiAccessMethod.Direct, ) val CUSTOM_ACCESS_METHOD = @@ -28,6 +28,6 @@ val CUSTOM_ACCESS_METHOD = ip = "1.1.1.1", port = Port(123), password = "Password", - cipher = Cipher.RC4 - ) + cipher = Cipher.RC4, + ), ) diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/data/DummyRelayItems.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/data/DummyRelayItems.kt index 052f2d897aa2..3cea5e5c681b 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/data/DummyRelayItems.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/data/DummyRelayItems.kt @@ -17,25 +17,22 @@ private val DUMMY_RELAY_1 = id = GeoLocationId.Hostname( city = GeoLocationId.City(GeoLocationId.Country("RCo1"), "Relay City 1"), - "Relay host 1" + "Relay host 1", ), active = true, provider = - Provider( - providerId = ProviderId("PROVIDER RENTED"), - ownership = Ownership.Rented, - ) + Provider(providerId = ProviderId("PROVIDER RENTED"), ownership = Ownership.Rented), ) private val DUMMY_RELAY_2 = RelayItem.Location.Relay( id = GeoLocationId.Hostname( city = GeoLocationId.City(GeoLocationId.Country("RCo2"), "Relay City 2"), - "Relay host 2" + "Relay host 2", ), active = true, provider = - Provider(providerId = ProviderId("PROVIDER OWNED"), ownership = Ownership.MullvadOwned) + Provider(providerId = ProviderId("PROVIDER OWNED"), ownership = Ownership.MullvadOwned), ) private val DUMMY_RELAY_CITY_1 = RelayItem.Location.City( @@ -53,13 +50,13 @@ private val DUMMY_RELAY_COUNTRY_1 = RelayItem.Location.Country( name = "Relay Country 1", id = GeoLocationId.Country("RCo1"), - cities = listOf(DUMMY_RELAY_CITY_1) + cities = listOf(DUMMY_RELAY_CITY_1), ) private val DUMMY_RELAY_COUNTRY_2 = RelayItem.Location.Country( name = "Relay Country 2", id = GeoLocationId.Country("RCo2"), - cities = listOf(DUMMY_RELAY_CITY_2) + cities = listOf(DUMMY_RELAY_CITY_2), ) private val DUMMY_WIREGUARD_PORT_RANGES = ArrayList() @@ -67,11 +64,7 @@ private val DUMMY_WIREGUARD_ENDPOINT_DATA = WireguardEndpointData(DUMMY_WIREGUAR val DUMMY_RELAY_COUNTRIES = listOf(DUMMY_RELAY_COUNTRY_1, DUMMY_RELAY_COUNTRY_2) -val DUMMY_RELAY_LIST = - RelayList( - DUMMY_RELAY_COUNTRIES, - DUMMY_WIREGUARD_ENDPOINT_DATA, - ) +val DUMMY_RELAY_LIST = RelayList(DUMMY_RELAY_COUNTRIES, DUMMY_WIREGUARD_ENDPOINT_DATA) val DUMMY_RELAY_ITEM_CUSTOM_LISTS = listOf( @@ -80,19 +73,19 @@ val DUMMY_RELAY_ITEM_CUSTOM_LISTS = CustomList( name = CustomListName.fromString("First list"), id = CustomListId("1"), - locations = emptyList() + locations = emptyList(), ), - locations = DUMMY_RELAY_COUNTRIES + locations = DUMMY_RELAY_COUNTRIES, ), RelayItem.CustomList( customList = CustomList( name = CustomListName.fromString("Empty list"), id = CustomListId("2"), - locations = emptyList() + locations = emptyList(), ), - locations = emptyList() - ) + locations = emptyList(), + ), ) val DUMMY_CUSTOM_LISTS = @@ -100,11 +93,11 @@ val DUMMY_CUSTOM_LISTS = CustomList( name = CustomListName.fromString("First list"), id = CustomListId("1"), - locations = DUMMY_RELAY_COUNTRIES.map { it.id } + locations = DUMMY_RELAY_COUNTRIES.map { it.id }, ), CustomList( name = CustomListName.fromString("Empty list"), id = CustomListId("2"), - locations = emptyList() - ) + locations = emptyList(), + ), ) diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/CustomPortDialogTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/CustomPortDialogTest.kt index bcb3908faed3..930e5f5201e6 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/CustomPortDialogTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/CustomPortDialogTest.kt @@ -40,7 +40,7 @@ class CustomPortDialogTest { initialPort = initialPort, allowedPortRanges = allowedPortRanges, onSave = onSave, - onDismiss = onDismiss + onDismiss = onDismiss, ) } diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeleteCustomListConfirmationDialogTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeleteCustomListConfirmationDialogTest.kt index 184cd7defe5e..abe7abfbcfb6 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeleteCustomListConfirmationDialogTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeleteCustomListConfirmationDialogTest.kt @@ -32,7 +32,7 @@ class DeleteCustomListConfirmationDialogTest { val name = CustomListName.fromString("List should be deleted") setContentWithTheme { DeleteCustomListConfirmationDialog( - state = DeleteCustomListUiState(name = name, deleteError = null), + state = DeleteCustomListUiState(name = name, deleteError = null) ) } @@ -49,7 +49,7 @@ class DeleteCustomListConfirmationDialogTest { setContentWithTheme { DeleteCustomListConfirmationDialog( state = DeleteCustomListUiState(name = name, deleteError = null), - onDelete = mockedOnDelete + onDelete = mockedOnDelete, ) } @@ -69,7 +69,7 @@ class DeleteCustomListConfirmationDialogTest { setContentWithTheme { DeleteCustomListConfirmationDialog( state = DeleteCustomListUiState(name = name, deleteError = null), - onBack = mockedOnBack + onBack = mockedOnBack, ) } diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialogTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialogTest.kt index 0882c1dd4263..20cf2357db09 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialogTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialogTest.kt @@ -24,7 +24,7 @@ class DnsDialogTest { validationError = null, isLocal = false, isAllowLanEnabled = false, - index = null + index = null, ) @SuppressLint("ComposableNaming") @@ -34,7 +34,7 @@ class DnsDialogTest { onDnsInputChange: (String) -> Unit = { _ -> }, onSaveDnsClick: () -> Unit = {}, onRemoveDnsClick: (Int) -> Unit = {}, - onDismiss: () -> Unit = {} + onDismiss: () -> Unit = {}, ) { DnsDialog(state, onDnsInputChange, onSaveDnsClick, onRemoveDnsClick, onDismiss) } diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/MtuDialogTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/MtuDialogTest.kt index 5fe812cd4427..9d6b09fe2d7b 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/MtuDialogTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/MtuDialogTest.kt @@ -44,7 +44,7 @@ class MtuDialogTest { onInputChanged = onInputChanged, onSaveMtu = onSaveMtu, onResetMtu = onResetMtu, - onDismiss = onDismiss + onDismiss = onDismiss, ) } @@ -62,11 +62,7 @@ class MtuDialogTest { fun testMtuDialogWithEditValue() = composeExtension.use { // Arrange - setContentWithTheme { - testMtuDialog( - mtuInput = VALID_DUMMY_MTU_VALUE, - ) - } + setContentWithTheme { testMtuDialog(mtuInput = VALID_DUMMY_MTU_VALUE) } // Assert onNodeWithText(VALID_DUMMY_MTU_VALUE).assertExists() @@ -78,10 +74,7 @@ class MtuDialogTest { // Arrange val mockedSubmitHandler: (String) -> Unit = mockk(relaxed = true) setContentWithTheme { - testMtuDialog( - VALID_DUMMY_MTU_VALUE, - onSaveMtu = mockedSubmitHandler, - ) + testMtuDialog(VALID_DUMMY_MTU_VALUE, onSaveMtu = mockedSubmitHandler) } // Act @@ -107,10 +100,7 @@ class MtuDialogTest { // Arrange val mockedClickHandler: () -> Unit = mockk(relaxed = true) setContentWithTheme { - testMtuDialog( - mtuInput = VALID_DUMMY_MTU_VALUE, - onResetMtu = mockedClickHandler, - ) + testMtuDialog(mtuInput = VALID_DUMMY_MTU_VALUE, onResetMtu = mockedClickHandler) } // Act @@ -125,11 +115,7 @@ class MtuDialogTest { composeExtension.use { // Arrange val mockedClickHandler: () -> Unit = mockk(relaxed = true) - setContentWithTheme { - testMtuDialog( - onDismiss = mockedClickHandler, - ) - } + setContentWithTheme { testMtuDialog(onDismiss = mockedClickHandler) } // Assert onNodeWithText("Cancel").performClick() diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/ResetServerIPOverridesConfirmationDialogTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/ResetServerIPOverridesConfirmationDialogTest.kt index df06f00fc7af..107c03f1d6ce 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/ResetServerIPOverridesConfirmationDialogTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/ResetServerIPOverridesConfirmationDialogTest.kt @@ -34,7 +34,7 @@ class ResetServerIPOverridesConfirmationDialogTest { setContentWithTheme { ResetServerIpOverridesConfirmationDialog( onNavigateBack = clickHandler, - onClearAllOverrides = {} + onClearAllOverrides = {}, ) } @@ -54,7 +54,7 @@ class ResetServerIPOverridesConfirmationDialogTest { setContentWithTheme { ResetServerIpOverridesConfirmationDialog( onNavigateBack = {}, - onClearAllOverrides = clickHandler + onClearAllOverrides = clickHandler, ) } diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/SaveApiAccessMethodDialogTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/SaveApiAccessMethodDialogTest.kt index 07f8b039eb1b..afd6d0e15d1a 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/SaveApiAccessMethodDialogTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/dialog/SaveApiAccessMethodDialogTest.kt @@ -29,7 +29,7 @@ class SaveApiAccessMethodDialogTest { state = SaveApiAccessMethodUiState( testingState = TestApiAccessMethodState.Testing, - isSaving = false + isSaving = false, ) ) } @@ -48,7 +48,7 @@ class SaveApiAccessMethodDialogTest { state = SaveApiAccessMethodUiState( testingState = TestApiAccessMethodState.Result.Failure, - isSaving = false + isSaving = false, ) ) } @@ -67,7 +67,7 @@ class SaveApiAccessMethodDialogTest { state = SaveApiAccessMethodUiState( testingState = TestApiAccessMethodState.Result.Successful, - isSaving = true + isSaving = true, ) ) } @@ -87,9 +87,9 @@ class SaveApiAccessMethodDialogTest { state = SaveApiAccessMethodUiState( testingState = TestApiAccessMethodState.Testing, - isSaving = false + isSaving = false, ), - onCancel = onCancelClick + onCancel = onCancelClick, ) } @@ -110,9 +110,9 @@ class SaveApiAccessMethodDialogTest { state = SaveApiAccessMethodUiState( testingState = TestApiAccessMethodState.Result.Failure, - isSaving = false + isSaving = false, ), - onSave = onSaveClick + onSave = onSaveClick, ) } diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreenTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreenTest.kt index 48ce7590a285..3a55dfb9fd51 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreenTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreenTest.kt @@ -47,10 +47,9 @@ class AccountScreenTest { deviceName = DUMMY_DEVICE_NAME, accountNumber = DUMMY_ACCOUNT_NUMBER, accountExpiry = null, - showSitePayment = false + showSitePayment = false, ), - uiSideEffect = - MutableSharedFlow().asSharedFlow(), + uiSideEffect = MutableSharedFlow().asSharedFlow(), ) } @@ -75,7 +74,7 @@ class AccountScreenTest { ), uiSideEffect = MutableSharedFlow().asSharedFlow(), - onManageAccountClick = mockedClickHandler + onManageAccountClick = mockedClickHandler, ) } @@ -98,11 +97,11 @@ class AccountScreenTest { deviceName = DUMMY_DEVICE_NAME, accountNumber = DUMMY_ACCOUNT_NUMBER, accountExpiry = null, - showSitePayment = false + showSitePayment = false, ), uiSideEffect = MutableSharedFlow().asSharedFlow(), - onRedeemVoucherClick = mockedClickHandler + onRedeemVoucherClick = mockedClickHandler, ) } @@ -125,11 +124,11 @@ class AccountScreenTest { deviceName = DUMMY_DEVICE_NAME, accountNumber = DUMMY_ACCOUNT_NUMBER, accountExpiry = null, - showSitePayment = false + showSitePayment = false, ), uiSideEffect = MutableSharedFlow().asSharedFlow(), - onLogoutClick = mockedClickHandler + onLogoutClick = mockedClickHandler, ) } @@ -149,8 +148,7 @@ class AccountScreenTest { state = AccountUiState.default() .copy(billingPaymentState = PaymentState.Error.Billing), - uiSideEffect = - MutableSharedFlow().asSharedFlow(), + uiSideEffect = MutableSharedFlow().asSharedFlow(), ) } @@ -173,8 +171,7 @@ class AccountScreenTest { billingPaymentState = PaymentState.PaymentAvailable(listOf(mockPaymentProduct)) ), - uiSideEffect = - MutableSharedFlow().asSharedFlow(), + uiSideEffect = MutableSharedFlow().asSharedFlow(), ) } @@ -197,8 +194,7 @@ class AccountScreenTest { billingPaymentState = PaymentState.PaymentAvailable(listOf(mockPaymentProduct)) ), - uiSideEffect = - MutableSharedFlow().asSharedFlow(), + uiSideEffect = MutableSharedFlow().asSharedFlow(), ) } @@ -224,7 +220,7 @@ class AccountScreenTest { ), uiSideEffect = MutableSharedFlow().asSharedFlow(), - navigateToVerificationPendingDialog = mockNavigateToVerificationPending + navigateToVerificationPendingDialog = mockNavigateToVerificationPending, ) } @@ -250,8 +246,7 @@ class AccountScreenTest { billingPaymentState = PaymentState.PaymentAvailable(listOf(mockPaymentProduct)) ), - uiSideEffect = - MutableSharedFlow().asSharedFlow(), + uiSideEffect = MutableSharedFlow().asSharedFlow(), ) } @@ -277,8 +272,7 @@ class AccountScreenTest { PaymentState.PaymentAvailable(listOf(mockPaymentProduct)) ), onPurchaseBillingProductClick = clickHandler, - uiSideEffect = - MutableSharedFlow().asSharedFlow(), + uiSideEffect = MutableSharedFlow().asSharedFlow(), ) } diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessListScreenTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessListScreenTest.kt index 97eed92d9137..e08d46d9d3e7 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessListScreenTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessListScreenTest.kt @@ -59,7 +59,7 @@ class ApiAccessListScreenTest { setContentWithTheme { ApiAccessListScreen( state = ApiAccessListUiState(), - onAddMethodClick = onAddMethodClick + onAddMethodClick = onAddMethodClick, ) } @@ -78,7 +78,7 @@ class ApiAccessListScreenTest { setContentWithTheme { ApiAccessListScreen( state = ApiAccessListUiState(), - onApiAccessInfoClick = onApiAccessInfoClick + onApiAccessInfoClick = onApiAccessInfoClick, ) } @@ -98,7 +98,7 @@ class ApiAccessListScreenTest { setContentWithTheme { ApiAccessListScreen( state = ApiAccessListUiState(apiAccessMethodSettings = listOf(apiAccessMethod)), - onApiAccessMethodClick = onApiAccessMethodClick + onApiAccessMethodClick = onApiAccessMethodClick, ) } diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessMethodDetailsScreenTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessMethodDetailsScreenTest.kt index 8dbd8f983264..e895c45f6379 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessMethodDetailsScreenTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessMethodDetailsScreenTest.kt @@ -38,7 +38,7 @@ class ApiAccessMethodDetailsScreenTest { isEditable = false, isDisableable = true, isCurrentMethod = true, - isTestingAccessMethod = false + isTestingAccessMethod = false, ) ) } @@ -64,9 +64,9 @@ class ApiAccessMethodDetailsScreenTest { isEditable = false, isDisableable = false, isCurrentMethod = true, - isTestingAccessMethod = false + isTestingAccessMethod = false, ), - onEnableClicked = onEnableClicked + onEnableClicked = onEnableClicked, ) } @@ -94,9 +94,9 @@ class ApiAccessMethodDetailsScreenTest { isEditable = true, isDisableable = false, isCurrentMethod = true, - isTestingAccessMethod = false + isTestingAccessMethod = false, ), - onDeleteApiAccessMethodClicked = onDeleteApiAccessMethodClicked + onDeleteApiAccessMethodClicked = onDeleteApiAccessMethodClicked, ) } @@ -124,9 +124,9 @@ class ApiAccessMethodDetailsScreenTest { isEditable = true, isDisableable = false, isCurrentMethod = true, - isTestingAccessMethod = false + isTestingAccessMethod = false, ), - onEditMethodClicked = onEditMethodClicked + onEditMethodClicked = onEditMethodClicked, ) } @@ -153,9 +153,9 @@ class ApiAccessMethodDetailsScreenTest { isEditable = false, isDisableable = true, isCurrentMethod = true, - isTestingAccessMethod = false + isTestingAccessMethod = false, ), - onEnableClicked = onEnableClicked + onEnableClicked = onEnableClicked, ) } @@ -182,9 +182,9 @@ class ApiAccessMethodDetailsScreenTest { isEditable = false, isDisableable = true, isCurrentMethod = true, - isTestingAccessMethod = false + isTestingAccessMethod = false, ), - onTestMethodClicked = onTestMethodClicked + onTestMethodClicked = onTestMethodClicked, ) } @@ -211,9 +211,9 @@ class ApiAccessMethodDetailsScreenTest { isEditable = false, isDisableable = true, isCurrentMethod = false, - isTestingAccessMethod = false + isTestingAccessMethod = false, ), - onUseMethodClicked = onUseMethodClicked + onUseMethodClicked = onUseMethodClicked, ) } diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/ChangelogDialogTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/ChangelogDialogTest.kt index f4003d1f07c1..48161a469050 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/ChangelogDialogTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/ChangelogDialogTest.kt @@ -38,11 +38,8 @@ class ChangelogDialogTest { setContentWithTheme { ChangelogDialog( - Changelog( - changes = listOf(CHANGELOG_ITEM), - version = CHANGELOG_VERSION, - ), - onDismiss = { mockedViewModel.markChangelogAsRead() } + Changelog(changes = listOf(CHANGELOG_ITEM), version = CHANGELOG_VERSION), + onDismiss = { mockedViewModel.markChangelogAsRead() }, ) } diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/ConnectScreenTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/ConnectScreenTest.kt index 435bbeab00de..c9cd30e4396b 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/ConnectScreenTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/ConnectScreenTest.kt @@ -56,11 +56,7 @@ class ConnectScreenTest { fun testDefaultState() { composeExtension.use { // Arrange - setContentWithTheme { - ConnectScreen( - state = ConnectUiState.INITIAL, - ) - } + setContentWithTheme { ConnectScreen(state = ConnectUiState.INITIAL) } // Assert onNodeWithTag(SCROLLABLE_COLUMN_TEST_TAG).assertExists() @@ -86,8 +82,8 @@ class ConnectScreenTest { deviceName = "", daysLeftUntilExpiry = null, inAppNotification = InAppNotification.TunnelStateBlocked, - isPlayBuild = false - ), + isPlayBuild = false, + ) ) } @@ -116,7 +112,7 @@ class ConnectScreenTest { TunnelState.Connecting( endpoint = mockTunnelEndpoint, null, - emptyList() + emptyList(), ), inAddress = null, outAddress = "", @@ -124,8 +120,8 @@ class ConnectScreenTest { deviceName = "", daysLeftUntilExpiry = null, inAppNotification = InAppNotification.TunnelStateBlocked, - isPlayBuild = false - ), + isPlayBuild = false, + ) ) } @@ -157,8 +153,8 @@ class ConnectScreenTest { deviceName = "", daysLeftUntilExpiry = null, inAppNotification = null, - isPlayBuild = false - ), + isPlayBuild = false, + ) ) } @@ -189,8 +185,8 @@ class ConnectScreenTest { deviceName = "", daysLeftUntilExpiry = null, inAppNotification = null, - isPlayBuild = false - ), + isPlayBuild = false, + ) ) } @@ -219,8 +215,8 @@ class ConnectScreenTest { deviceName = "", daysLeftUntilExpiry = null, inAppNotification = null, - isPlayBuild = false - ), + isPlayBuild = false, + ) ) } @@ -249,8 +245,8 @@ class ConnectScreenTest { deviceName = "", daysLeftUntilExpiry = null, inAppNotification = null, - isPlayBuild = false - ), + isPlayBuild = false, + ) ) } @@ -285,8 +281,8 @@ class ConnectScreenTest { InAppNotification.TunnelStateError( ErrorState(ErrorStateCause.StartTunnelError, true) ), - isPlayBuild = false - ), + isPlayBuild = false, + ) ) } @@ -322,8 +318,8 @@ class ConnectScreenTest { InAppNotification.TunnelStateError( ErrorState(ErrorStateCause.StartTunnelError, false) ), - isPlayBuild = false - ), + isPlayBuild = false, + ) ) } @@ -354,8 +350,8 @@ class ConnectScreenTest { deviceName = "", daysLeftUntilExpiry = null, inAppNotification = InAppNotification.TunnelStateBlocked, - isPlayBuild = false - ), + isPlayBuild = false, + ) ) } @@ -386,8 +382,8 @@ class ConnectScreenTest { deviceName = "", daysLeftUntilExpiry = null, inAppNotification = InAppNotification.TunnelStateBlocked, - isPlayBuild = false - ), + isPlayBuild = false, + ) ) } @@ -418,9 +414,9 @@ class ConnectScreenTest { deviceName = "", daysLeftUntilExpiry = null, inAppNotification = null, - isPlayBuild = false + isPlayBuild = false, ), - onSwitchLocationClick = mockedClickHandler + onSwitchLocationClick = mockedClickHandler, ) } @@ -452,9 +448,9 @@ class ConnectScreenTest { deviceName = "", daysLeftUntilExpiry = null, inAppNotification = null, - isPlayBuild = false + isPlayBuild = false, ), - onDisconnectClick = mockedClickHandler + onDisconnectClick = mockedClickHandler, ) } @@ -486,9 +482,9 @@ class ConnectScreenTest { deviceName = "", daysLeftUntilExpiry = null, inAppNotification = null, - isPlayBuild = false + isPlayBuild = false, ), - onReconnectClick = mockedClickHandler + onReconnectClick = mockedClickHandler, ) } @@ -518,9 +514,9 @@ class ConnectScreenTest { deviceName = "", daysLeftUntilExpiry = null, inAppNotification = null, - isPlayBuild = false + isPlayBuild = false, ), - onConnectClick = mockedClickHandler + onConnectClick = mockedClickHandler, ) } @@ -550,9 +546,9 @@ class ConnectScreenTest { deviceName = "", daysLeftUntilExpiry = null, inAppNotification = null, - isPlayBuild = false + isPlayBuild = false, ), - onCancelClick = mockedClickHandler + onCancelClick = mockedClickHandler, ) } @@ -591,8 +587,8 @@ class ConnectScreenTest { deviceName = "", daysLeftUntilExpiry = null, inAppNotification = null, - isPlayBuild = false - ), + isPlayBuild = false, + ) ) } @@ -625,8 +621,8 @@ class ConnectScreenTest { deviceName = "", daysLeftUntilExpiry = null, inAppNotification = InAppNotification.UnsupportedVersion(versionInfo), - isPlayBuild = false - ), + isPlayBuild = false, + ) ) } @@ -657,8 +653,8 @@ class ConnectScreenTest { deviceName = "", daysLeftUntilExpiry = null, inAppNotification = InAppNotification.AccountExpiry(expiryDate), - isPlayBuild = false - ), + isPlayBuild = false, + ) ) } @@ -688,7 +684,7 @@ class ConnectScreenTest { deviceName = "", daysLeftUntilExpiry = null, inAppNotification = InAppNotification.UnsupportedVersion(versionInfo), - isPlayBuild = false + isPlayBuild = false, ), ) } @@ -721,7 +717,7 @@ class ConnectScreenTest { deviceName = "", daysLeftUntilExpiry = null, inAppNotification = InAppNotification.AccountExpiry(expiryDate), - isPlayBuild = false + isPlayBuild = false, ), ) } diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/CustomListLocationsScreenTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/CustomListLocationsScreenTest.kt index 1a8d35a5a907..444bbd2c5b07 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/CustomListLocationsScreenTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/CustomListLocationsScreenTest.kt @@ -84,13 +84,10 @@ class CustomListLocationsScreenTest { locations = listOf( RelayLocationListItem(DUMMY_RELAY_COUNTRIES[0], checked = true), - RelayLocationListItem( - DUMMY_RELAY_COUNTRIES[1], - checked = false - ), + RelayLocationListItem(DUMMY_RELAY_COUNTRIES[1], checked = false), ), - searchTerm = "" - ), + searchTerm = "", + ) ) } @@ -111,9 +108,9 @@ class CustomListLocationsScreenTest { CustomListLocationsUiState.Content.Data( newList = false, locations = - listOf(RelayLocationListItem(selectedCountry, checked = true)) + listOf(RelayLocationListItem(selectedCountry, checked = true)), ), - onRelaySelectionClick = mockedOnRelaySelectionClicked + onRelaySelectionClick = mockedOnRelaySelectionClicked, ) } @@ -136,7 +133,7 @@ class CustomListLocationsScreenTest { newList = false, locations = emptyList(), ), - onSearchTermInput = mockedSearchTermInput + onSearchTermInput = mockedSearchTermInput, ) } val mockSearchString = "SEARCH" @@ -159,9 +156,9 @@ class CustomListLocationsScreenTest { state = CustomListLocationsUiState.Content.Empty( newList = false, - searchTerm = mockSearchString + searchTerm = mockSearchString, ), - onSearchTermInput = mockedSearchTermInput + onSearchTermInput = mockedSearchTermInput, ) } @@ -181,7 +178,7 @@ class CustomListLocationsScreenTest { state = CustomListLocationsUiState.Content.Empty( newList = false, - searchTerm = emptySearchString + searchTerm = emptySearchString, ) ) } @@ -203,7 +200,7 @@ class CustomListLocationsScreenTest { locations = emptyList(), saveEnabled = true, ), - onSaveClick = mockOnSaveClick + onSaveClick = mockOnSaveClick, ) } @@ -227,7 +224,7 @@ class CustomListLocationsScreenTest { locations = emptyList(), saveEnabled = false, ), - onSaveClick = mockOnSaveClick + onSaveClick = mockOnSaveClick, ) } diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/CustomListsScreenTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/CustomListsScreenTest.kt index bdcb7969978a..47e88bb52f54 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/CustomListsScreenTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/CustomListsScreenTest.kt @@ -35,7 +35,7 @@ class CustomListsScreenTest { setContentWithTheme { CustomListsScreen( state = CustomListsUiState.Loading, - snackbarHostState = SnackbarHostState() + snackbarHostState = SnackbarHostState(), ) } @@ -51,7 +51,7 @@ class CustomListsScreenTest { setContentWithTheme { CustomListsScreen( state = CustomListsUiState.Content(customLists = customLists), - snackbarHostState = SnackbarHostState() + snackbarHostState = SnackbarHostState(), ) } @@ -70,7 +70,7 @@ class CustomListsScreenTest { CustomListsScreen( state = CustomListsUiState.Content(customLists = customLists), snackbarHostState = SnackbarHostState(), - addCustomList = mockedAddCustomList + addCustomList = mockedAddCustomList, ) } @@ -92,7 +92,7 @@ class CustomListsScreenTest { CustomListsScreen( state = CustomListsUiState.Content(customLists = customLists), snackbarHostState = SnackbarHostState(), - openCustomList = mockedOpenCustomList + openCustomList = mockedOpenCustomList, ) } diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/EditApiAccessMethodScreenTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/EditApiAccessMethodScreenTest.kt index 584be7e0747b..d737f5459f00 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/EditApiAccessMethodScreenTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/EditApiAccessMethodScreenTest.kt @@ -33,7 +33,7 @@ class EditApiAccessMethodScreenTest { editMode = true, formData = EditApiAccessFormData.empty(), hasChanges = false, - isTestingApiAccessMethod = false + isTestingApiAccessMethod = false, ) ) } @@ -53,7 +53,7 @@ class EditApiAccessMethodScreenTest { editMode = false, formData = EditApiAccessFormData.empty(), hasChanges = false, - isTestingApiAccessMethod = false + isTestingApiAccessMethod = false, ) ) } @@ -78,10 +78,10 @@ class EditApiAccessMethodScreenTest { serverIp = "", username = "", password = "", - port = "" + port = "", ), hasChanges = false, - isTestingApiAccessMethod = false + isTestingApiAccessMethod = false, ) ) } @@ -106,10 +106,10 @@ class EditApiAccessMethodScreenTest { serverIpError = InvalidDataError.ServerIpError.Invalid, username = "", password = "", - port = "" + port = "", ), hasChanges = false, - isTestingApiAccessMethod = false + isTestingApiAccessMethod = false, ) ) } @@ -137,10 +137,10 @@ class EditApiAccessMethodScreenTest { portError = InvalidDataError.PortError.Invalid( ParsePortError.OutOfRange(1111111111) - ) + ), ), hasChanges = false, - isTestingApiAccessMethod = false + isTestingApiAccessMethod = false, ) ) } @@ -162,9 +162,9 @@ class EditApiAccessMethodScreenTest { editMode = false, formData = EditApiAccessFormData.empty(), hasChanges = false, - isTestingApiAccessMethod = false + isTestingApiAccessMethod = false, ), - onNameChanged = onNameChanged + onNameChanged = onNameChanged, ) } @@ -192,10 +192,10 @@ class EditApiAccessMethodScreenTest { password = "", port = "", enableAuthentication = true, - apiAccessMethodTypes = ApiAccessMethodTypes.SOCKS5_REMOTE + apiAccessMethodTypes = ApiAccessMethodTypes.SOCKS5_REMOTE, ), hasChanges = false, - isTestingApiAccessMethod = false + isTestingApiAccessMethod = false, ) ) } @@ -217,9 +217,9 @@ class EditApiAccessMethodScreenTest { editMode = false, formData = EditApiAccessFormData.empty(), hasChanges = false, - isTestingApiAccessMethod = false + isTestingApiAccessMethod = false, ), - onTestMethod = onTestMethod + onTestMethod = onTestMethod, ) } @@ -242,9 +242,9 @@ class EditApiAccessMethodScreenTest { editMode = false, formData = EditApiAccessFormData.empty(), hasChanges = false, - isTestingApiAccessMethod = false + isTestingApiAccessMethod = false, ), - onAddMethod = onAddMethod + onAddMethod = onAddMethod, ) } diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/EditCustomListScreenTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/EditCustomListScreenTest.kt index 2bc53013ca40..7284a3294dff 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/EditCustomListScreenTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/EditCustomListScreenTest.kt @@ -60,7 +60,7 @@ class EditCustomListScreenTest { EditCustomListState.Content( id = customList.id, name = customList.name, - locations = customList.locations + locations = customList.locations, ) ) } @@ -80,7 +80,7 @@ class EditCustomListScreenTest { EditCustomListState.Content( id = customList.id, name = customList.name, - locations = customList.locations + locations = customList.locations, ) ) } @@ -101,9 +101,9 @@ class EditCustomListScreenTest { EditCustomListState.Content( id = customList.id, name = customList.name, - locations = customList.locations + locations = customList.locations, ), - onDeleteList = mockedOnDelete + onDeleteList = mockedOnDelete, ) } @@ -127,9 +127,9 @@ class EditCustomListScreenTest { EditCustomListState.Content( id = customList.id, name = customList.name, - locations = customList.locations + locations = customList.locations, ), - onNameClicked = mockedOnNameClicked + onNameClicked = mockedOnNameClicked, ) } @@ -152,9 +152,9 @@ class EditCustomListScreenTest { EditCustomListState.Content( id = customList.id, name = customList.name, - locations = customList.locations + locations = customList.locations, ), - onLocationsClicked = mockedOnLocationsClicked + onLocationsClicked = mockedOnLocationsClicked, ) } diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreenTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreenTest.kt index b3cfd7972f70..b978fc49a0cf 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreenTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreenTest.kt @@ -34,7 +34,7 @@ class FilterScreenTest { selectedOwnership = null, selectedProviders = DUMMY_SELECTED_PROVIDERS, ), - onSelectedProvider = { _, _ -> } + onSelectedProvider = { _, _ -> }, ) } onNodeWithText("Ownership").assertExists() @@ -50,9 +50,9 @@ class FilterScreenTest { RelayFilterState( allProviders = DUMMY_RELAY_ALL_PROVIDERS, selectedOwnership = null, - selectedProviders = DUMMY_SELECTED_PROVIDERS + selectedProviders = DUMMY_SELECTED_PROVIDERS, ), - onSelectedProvider = { _, _ -> } + onSelectedProvider = { _, _ -> }, ) } onNodeWithText("Ownership").performClick() @@ -68,9 +68,9 @@ class FilterScreenTest { RelayFilterState( allProviders = DUMMY_RELAY_ALL_PROVIDERS, selectedOwnership = Ownership.MullvadOwned, - selectedProviders = DUMMY_SELECTED_PROVIDERS + selectedProviders = DUMMY_SELECTED_PROVIDERS, ), - onSelectedProvider = { _, _ -> } + onSelectedProvider = { _, _ -> }, ) } onNodeWithText("Ownership").performClick() @@ -86,9 +86,9 @@ class FilterScreenTest { RelayFilterState( allProviders = DUMMY_RELAY_ALL_PROVIDERS, selectedOwnership = Ownership.Rented, - selectedProviders = DUMMY_SELECTED_PROVIDERS + selectedProviders = DUMMY_SELECTED_PROVIDERS, ), - onSelectedProvider = { _, _ -> } + onSelectedProvider = { _, _ -> }, ) } onNodeWithText("Ownership").performClick() @@ -104,9 +104,9 @@ class FilterScreenTest { RelayFilterState( allProviders = DUMMY_RELAY_ALL_PROVIDERS, selectedOwnership = null, - selectedProviders = DUMMY_SELECTED_PROVIDERS + selectedProviders = DUMMY_SELECTED_PROVIDERS, ), - onSelectedProvider = { _, _ -> } + onSelectedProvider = { _, _ -> }, ) } @@ -126,10 +126,10 @@ class FilterScreenTest { allProviders = listOf(), selectedOwnership = null, selectedProviders = - listOf(Provider(ProviderId("31173"), Ownership.MullvadOwned)) + listOf(Provider(ProviderId("31173"), Ownership.MullvadOwned)), ), onSelectedProvider = { _, _ -> }, - onApplyClick = mockClickListener + onApplyClick = mockClickListener, ) } onNodeWithText("Apply").performClick() @@ -155,7 +155,7 @@ class FilterScreenTest { Provider(ProviderId("Quadranet"), Ownership.Rented), Provider(ProviderId("techfutures"), Ownership.Rented), Provider(ProviderId("Tzulo"), Ownership.Rented), - Provider(ProviderId("xtom"), Ownership.Rented) + Provider(ProviderId("xtom"), Ownership.Rented), ) private val DUMMY_SELECTED_PROVIDERS = @@ -176,7 +176,7 @@ class FilterScreenTest { Provider(ProviderId("Quadranet"), Ownership.Rented), Provider(ProviderId("techfutures"), Ownership.Rented), Provider(ProviderId("Tzulo"), Ownership.Rented), - Provider(ProviderId("xtom"), Ownership.Rented) + Provider(ProviderId("xtom"), Ownership.Rented), ) } } diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/OutOfTimeScreenTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/OutOfTimeScreenTest.kt index 3ead3828d304..4294577836f8 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/OutOfTimeScreenTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/OutOfTimeScreenTest.kt @@ -42,14 +42,14 @@ class OutOfTimeScreenTest { onRedeemVoucherClick = {}, onSettingsClick = {}, onAccountClick = {}, - onDisconnectClick = {} + onDisconnectClick = {}, ) } // Assert onNodeWithText( "Either buy credit on our website or redeem a voucher.", - substring = true + substring = true, ) .assertDoesNotExist() onNodeWithText("Buy credit").assertDoesNotExist() @@ -66,7 +66,7 @@ class OutOfTimeScreenTest { onRedeemVoucherClick = {}, onSettingsClick = {}, onAccountClick = {}, - onDisconnectClick = {} + onDisconnectClick = {}, ) } @@ -86,7 +86,7 @@ class OutOfTimeScreenTest { onRedeemVoucherClick = {}, onSettingsClick = {}, onAccountClick = {}, - onDisconnectClick = {} + onDisconnectClick = {}, ) } @@ -109,7 +109,7 @@ class OutOfTimeScreenTest { onRedeemVoucherClick = mockClickListener, onSettingsClick = {}, onAccountClick = {}, - onDisconnectClick = {} + onDisconnectClick = {}, ) } @@ -131,13 +131,13 @@ class OutOfTimeScreenTest { OutOfTimeUiState( tunnelState = TunnelState.Connecting(null, null, emptyList()), deviceName = "", - showSitePayment = true + showSitePayment = true, ), onSitePaymentClick = {}, onRedeemVoucherClick = {}, onSettingsClick = {}, onAccountClick = {}, - onDisconnectClick = mockClickListener + onDisconnectClick = mockClickListener, ) } @@ -157,13 +157,13 @@ class OutOfTimeScreenTest { state = OutOfTimeUiState( showSitePayment = true, - billingPaymentState = PaymentState.Error.Billing + billingPaymentState = PaymentState.Error.Billing, ), onSitePaymentClick = {}, onRedeemVoucherClick = {}, onSettingsClick = {}, onAccountClick = {}, - onPurchaseBillingProductClick = { _ -> } + onPurchaseBillingProductClick = { _ -> }, ) } @@ -184,13 +184,13 @@ class OutOfTimeScreenTest { OutOfTimeUiState( showSitePayment = true, billingPaymentState = - PaymentState.PaymentAvailable(listOf(mockPaymentProduct)) + PaymentState.PaymentAvailable(listOf(mockPaymentProduct)), ), onSitePaymentClick = {}, onRedeemVoucherClick = {}, onSettingsClick = {}, onAccountClick = {}, - onPurchaseBillingProductClick = { _ -> } + onPurchaseBillingProductClick = { _ -> }, ) } @@ -211,8 +211,8 @@ class OutOfTimeScreenTest { OutOfTimeUiState( showSitePayment = true, billingPaymentState = - PaymentState.PaymentAvailable(listOf(mockPaymentProduct)) - ), + PaymentState.PaymentAvailable(listOf(mockPaymentProduct)), + ) ) } @@ -234,9 +234,9 @@ class OutOfTimeScreenTest { OutOfTimeUiState( showSitePayment = true, billingPaymentState = - PaymentState.PaymentAvailable(listOf(mockPaymentProduct)) + PaymentState.PaymentAvailable(listOf(mockPaymentProduct)), ), - navigateToVerificationPendingDialog = mockNavigateToVerificationPending + navigateToVerificationPendingDialog = mockNavigateToVerificationPending, ) } @@ -291,7 +291,7 @@ class OutOfTimeScreenTest { onRedeemVoucherClick = {}, onSettingsClick = {}, onAccountClick = {}, - onPurchaseBillingProductClick = clickHandler + onPurchaseBillingProductClick = clickHandler, ) } diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/RedeemVoucherDialogTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/RedeemVoucherDialogTest.kt index d8159dafd042..10e7af7923e9 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/RedeemVoucherDialogTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/RedeemVoucherDialogTest.kt @@ -39,7 +39,7 @@ class RedeemVoucherDialogTest { state = VoucherDialogUiState.INITIAL, onVoucherInputChange = {}, onRedeem = {}, - onDismiss = mockedClickHandler + onDismiss = mockedClickHandler, ) } @@ -60,7 +60,7 @@ class RedeemVoucherDialogTest { state = VoucherDialogUiState(voucherState = VoucherDialogState.Success(0)), onVoucherInputChange = {}, onRedeem = {}, - onDismiss = mockedClickHandler + onDismiss = mockedClickHandler, ) } @@ -81,7 +81,7 @@ class RedeemVoucherDialogTest { state = VoucherDialogUiState(), onVoucherInputChange = mockedClickHandler, onRedeem = {}, - onDismiss = {} + onDismiss = {}, ) } @@ -101,7 +101,7 @@ class RedeemVoucherDialogTest { state = VoucherDialogUiState(voucherState = VoucherDialogState.Verifying), onVoucherInputChange = {}, onRedeem = {}, - onDismiss = {} + onDismiss = {}, ) } @@ -118,7 +118,7 @@ class RedeemVoucherDialogTest { state = VoucherDialogUiState(voucherState = VoucherDialogState.Success(0)), onVoucherInputChange = {}, onRedeem = {}, - onDismiss = {} + onDismiss = {}, ) } @@ -139,7 +139,7 @@ class RedeemVoucherDialogTest { ), onVoucherInputChange = {}, onRedeem = {}, - onDismiss = {} + onDismiss = {}, ) } diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreenTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreenTest.kt index 4f3bac57e266..31097725db1c 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreenTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreenTest.kt @@ -37,11 +37,7 @@ class SelectLocationScreenTest { fun testDefaultState() = composeExtension.use { // Arrange - setContentWithTheme { - SelectLocationScreen( - state = SelectLocationUiState.Loading, - ) - } + setContentWithTheme { SelectLocationScreen(state = SelectLocationUiState.Loading) } // Assert onNodeWithTag(CIRCULAR_PROGRESS_INDICATOR).assertExists() @@ -62,7 +58,7 @@ class SelectLocationScreenTest { RelayListItem.GeoLocationItem(item = it) }, customLists = emptyList(), - ), + ) ) } @@ -87,9 +83,9 @@ class SelectLocationScreenTest { searchTerm = "", filterChips = emptyList(), relayListItems = emptyList(), - customLists = emptyList() + customLists = emptyList(), ), - onSearchTermInput = mockedSearchTermInput + onSearchTermInput = mockedSearchTermInput, ) } val mockSearchString = "SEARCH" @@ -117,7 +113,7 @@ class SelectLocationScreenTest { listOf(RelayListItem.LocationsEmptyText(mockSearchString)), customLists = emptyList(), ), - onSearchTermInput = mockedSearchTermInput + onSearchTermInput = mockedSearchTermInput, ) } @@ -139,7 +135,7 @@ class SelectLocationScreenTest { filterChips = emptyList(), relayListItems = listOf(RelayListItem.CustomListFooter(false)), customLists = emptyList(), - ), + ) ) } @@ -160,7 +156,7 @@ class SelectLocationScreenTest { filterChips = emptyList(), relayListItems = emptyList(), customLists = DUMMY_RELAY_ITEM_CUSTOM_LISTS, - ), + ) ) } @@ -182,9 +178,9 @@ class SelectLocationScreenTest { searchTerm = "", filterChips = emptyList(), relayListItems = listOf(RelayListItem.CustomListItem(customList)), - customLists = DUMMY_RELAY_ITEM_CUSTOM_LISTS + customLists = DUMMY_RELAY_ITEM_CUSTOM_LISTS, ), - onSelectRelay = mockedOnSelectRelay + onSelectRelay = mockedOnSelectRelay, ) } @@ -209,9 +205,9 @@ class SelectLocationScreenTest { filterChips = emptyList(), relayListItems = listOf(RelayListItem.CustomListItem(item = customList)), - customLists = DUMMY_RELAY_ITEM_CUSTOM_LISTS + customLists = DUMMY_RELAY_ITEM_CUSTOM_LISTS, ), - onSelectRelay = mockedOnSelectRelay + onSelectRelay = mockedOnSelectRelay, ) } @@ -237,7 +233,7 @@ class SelectLocationScreenTest { relayListItems = listOf(RelayListItem.GeoLocationItem(relayItem)), customLists = emptyList(), ), - onSelectRelay = mockedOnSelectRelay + onSelectRelay = mockedOnSelectRelay, ) } diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/ServerIpOverridesScreenTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/ServerIpOverridesScreenTest.kt index 32bab72de21e..2cd3163e7843 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/ServerIpOverridesScreenTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/ServerIpOverridesScreenTest.kt @@ -46,7 +46,7 @@ class ServerIpOverridesScreenTest { onInfoClick = onInfoClick, onResetOverridesClick = onResetOverridesClick, onImportByFile = onImportByFile, - onImportByText = onImportByText + onImportByText = onImportByText, ) } @@ -100,7 +100,7 @@ class ServerIpOverridesScreenTest { setContentWithTheme { ScreenWithDefault( state = ServerIpOverridesViewState.Loaded(false), - onInfoClick = clickHandler + onInfoClick = clickHandler, ) } @@ -119,7 +119,7 @@ class ServerIpOverridesScreenTest { setContentWithTheme { ScreenWithDefault( state = ServerIpOverridesViewState.Loaded(true), - onResetOverridesClick = clickHandler + onResetOverridesClick = clickHandler, ) } @@ -139,7 +139,7 @@ class ServerIpOverridesScreenTest { setContentWithTheme { ScreenWithDefault( state = ServerIpOverridesViewState.Loaded(false), - onImportByFile = clickHandler + onImportByFile = clickHandler, ) } @@ -159,7 +159,7 @@ class ServerIpOverridesScreenTest { setContentWithTheme { ScreenWithDefault( state = ServerIpOverridesViewState.Loaded(false), - onImportByText = clickHandler + onImportByText = clickHandler, ) } diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/SettingsScreenTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/SettingsScreenTest.kt index 469fb629a4b7..f108efab8e73 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/SettingsScreenTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/SettingsScreenTest.kt @@ -32,8 +32,8 @@ class SettingsScreenTest { appVersion = "", isLoggedIn = true, isSupportedVersion = true, - isPlayBuild = false - ), + isPlayBuild = false, + ) ) } // Assert @@ -55,8 +55,8 @@ class SettingsScreenTest { appVersion = "", isLoggedIn = false, isSupportedVersion = true, - isPlayBuild = false - ), + isPlayBuild = false, + ) ) } // Assert diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/SplitTunnelingScreenTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/SplitTunnelingScreenTest.kt index 04b88ce3b540..500349c861d8 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/SplitTunnelingScreenTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/SplitTunnelingScreenTest.kt @@ -54,13 +54,13 @@ class SplitTunnelingScreenTest { AppData( packageName = EXCLUDED_APP_PACKAGE_NAME, iconRes = 0, - name = EXCLUDED_APP_NAME + name = EXCLUDED_APP_NAME, ) val includedApp = AppData( packageName = INCLUDED_APP_PACKAGE_NAME, iconRes = 0, - name = INCLUDED_APP_NAME + name = INCLUDED_APP_NAME, ) setContentWithTheme { SplitTunnelingScreen( @@ -69,7 +69,7 @@ class SplitTunnelingScreenTest { enabled = true, excludedApps = listOf(excludedApp), includedApps = listOf(includedApp), - showSystemApps = false + showSystemApps = false, ) ) } @@ -92,7 +92,7 @@ class SplitTunnelingScreenTest { AppData( packageName = INCLUDED_APP_PACKAGE_NAME, iconRes = 0, - name = INCLUDED_APP_NAME + name = INCLUDED_APP_NAME, ) setContentWithTheme { SplitTunnelingScreen( @@ -101,7 +101,7 @@ class SplitTunnelingScreenTest { enabled = true, excludedApps = emptyList(), includedApps = listOf(includedApp), - showSystemApps = false + showSystemApps = false, ) ) } @@ -124,13 +124,13 @@ class SplitTunnelingScreenTest { AppData( packageName = EXCLUDED_APP_PACKAGE_NAME, iconRes = 0, - name = EXCLUDED_APP_NAME + name = EXCLUDED_APP_NAME, ) val includedApp = AppData( packageName = INCLUDED_APP_PACKAGE_NAME, iconRes = 0, - name = INCLUDED_APP_NAME + name = INCLUDED_APP_NAME, ) val mockedClickHandler: (String) -> Unit = mockk(relaxed = true) setContentWithTheme { @@ -140,9 +140,9 @@ class SplitTunnelingScreenTest { enabled = true, excludedApps = listOf(excludedApp), includedApps = listOf(includedApp), - showSystemApps = false + showSystemApps = false, ), - onExcludeAppClick = mockedClickHandler + onExcludeAppClick = mockedClickHandler, ) } @@ -161,13 +161,13 @@ class SplitTunnelingScreenTest { AppData( packageName = EXCLUDED_APP_PACKAGE_NAME, iconRes = 0, - name = EXCLUDED_APP_NAME + name = EXCLUDED_APP_NAME, ) val includedApp = AppData( packageName = INCLUDED_APP_PACKAGE_NAME, iconRes = 0, - name = INCLUDED_APP_NAME + name = INCLUDED_APP_NAME, ) val mockedClickHandler: (String) -> Unit = mockk(relaxed = true) setContentWithTheme { @@ -177,9 +177,9 @@ class SplitTunnelingScreenTest { enabled = true, excludedApps = listOf(excludedApp), includedApps = listOf(includedApp), - showSystemApps = false + showSystemApps = false, ), - onIncludeAppClick = mockedClickHandler + onIncludeAppClick = mockedClickHandler, ) } @@ -198,13 +198,13 @@ class SplitTunnelingScreenTest { AppData( packageName = EXCLUDED_APP_PACKAGE_NAME, iconRes = 0, - name = EXCLUDED_APP_NAME + name = EXCLUDED_APP_NAME, ) val includedApp = AppData( packageName = INCLUDED_APP_PACKAGE_NAME, iconRes = 0, - name = INCLUDED_APP_NAME + name = INCLUDED_APP_NAME, ) val mockedClickHandler: (Boolean) -> Unit = mockk(relaxed = true) setContentWithTheme { @@ -214,9 +214,9 @@ class SplitTunnelingScreenTest { enabled = true, excludedApps = listOf(excludedApp), includedApps = listOf(includedApp), - showSystemApps = false + showSystemApps = false, ), - onShowSystemAppsClick = mockedClickHandler + onShowSystemAppsClick = mockedClickHandler, ) } diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/VpnSettingsScreenTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/VpnSettingsScreenTest.kt index 2a3031ececdf..b2079e0e782e 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/VpnSettingsScreenTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/VpnSettingsScreenTest.kt @@ -48,11 +48,7 @@ class VpnSettingsScreenTest { fun testDefaultState() = composeExtension.use { // Arrange - setContentWithTheme { - VpnSettingsScreen( - state = VpnSettingsUiState.createDefault(), - ) - } + setContentWithTheme { VpnSettingsScreen(state = VpnSettingsUiState.createDefault()) } onNodeWithText("Auto-connect (legacy)").assertExists() @@ -75,7 +71,7 @@ class VpnSettingsScreenTest { state = VpnSettingsUiState.createDefault( mtu = Mtu.fromString(VALID_DUMMY_MTU_VALUE).getOrNull()!! - ), + ) ) } @@ -99,9 +95,9 @@ class VpnSettingsScreenTest { listOf( CustomDnsItem(address = DUMMY_DNS_ADDRESS, false), CustomDnsItem(address = DUMMY_DNS_ADDRESS_2, false), - CustomDnsItem(address = DUMMY_DNS_ADDRESS_3, false) - ) - ), + CustomDnsItem(address = DUMMY_DNS_ADDRESS_3, false), + ), + ) ) } @@ -122,8 +118,8 @@ class VpnSettingsScreenTest { VpnSettingsUiState.createDefault( isCustomDnsEnabled = false, customDnsItems = - listOf(CustomDnsItem(address = DUMMY_DNS_ADDRESS, false)) - ), + listOf(CustomDnsItem(address = DUMMY_DNS_ADDRESS, false)), + ) ) } onNodeWithTag(LAZY_LIST_TEST_TAG) @@ -144,8 +140,8 @@ class VpnSettingsScreenTest { isCustomDnsEnabled = true, isLocalNetworkSharingEnabled = true, customDnsItems = - listOf(CustomDnsItem(address = DUMMY_DNS_ADDRESS, isLocal = true)) - ), + listOf(CustomDnsItem(address = DUMMY_DNS_ADDRESS, isLocal = true)), + ) ) } @@ -163,8 +159,8 @@ class VpnSettingsScreenTest { VpnSettingsUiState.createDefault( isCustomDnsEnabled = true, customDnsItems = - listOf(CustomDnsItem(address = DUMMY_DNS_ADDRESS, isLocal = false)) - ), + listOf(CustomDnsItem(address = DUMMY_DNS_ADDRESS, isLocal = false)), + ) ) } @@ -182,8 +178,8 @@ class VpnSettingsScreenTest { VpnSettingsUiState.createDefault( isCustomDnsEnabled = true, customDnsItems = - listOf(CustomDnsItem(address = DUMMY_DNS_ADDRESS, isLocal = false)) - ), + listOf(CustomDnsItem(address = DUMMY_DNS_ADDRESS, isLocal = false)), + ) ) } @@ -201,8 +197,8 @@ class VpnSettingsScreenTest { VpnSettingsUiState.createDefault( isCustomDnsEnabled = true, customDnsItems = - listOf(CustomDnsItem(address = DUMMY_DNS_ADDRESS, isLocal = true)) - ), + listOf(CustomDnsItem(address = DUMMY_DNS_ADDRESS, isLocal = true)), + ) ) } @@ -220,9 +216,9 @@ class VpnSettingsScreenTest { state = VpnSettingsUiState.createDefault( selectedObfuscation = SelectedObfuscation.Udp2Tcp, - selectedObfuscationPort = Constraint.Only(Port(5001)) + selectedObfuscationPort = Constraint.Only(Port(5001)), ), - onObfuscationPortSelected = onObfuscationPortSelected + onObfuscationPortSelected = onObfuscationPortSelected, ) } @@ -238,7 +234,7 @@ class VpnSettingsScreenTest { // Assert onNodeWithTagAndText( testTag = String.format(LAZY_LIST_UDP_OVER_TCP_PORT_ITEM_X_TEST_TAG, 5001), - text = "5001" + text = "5001", ) .assertExists() .performClick() @@ -255,9 +251,9 @@ class VpnSettingsScreenTest { VpnSettingsScreen( state = VpnSettingsUiState.createDefault( - selectedObfuscation = SelectedObfuscation.Off, + selectedObfuscation = SelectedObfuscation.Off ), - onObfuscationPortSelected = onObfuscationPortSelected + onObfuscationPortSelected = onObfuscationPortSelected, ) } @@ -287,7 +283,7 @@ class VpnSettingsScreenTest { state = VpnSettingsUiState.createDefault( quantumResistant = QuantumResistantState.On - ), + ) ) } onNodeWithTag(LAZY_LIST_TEST_TAG) @@ -308,7 +304,7 @@ class VpnSettingsScreenTest { VpnSettingsScreen( state = VpnSettingsUiState.createDefault( - quantumResistant = QuantumResistantState.Auto, + quantumResistant = QuantumResistantState.Auto ), onSelectQuantumResistanceSetting = mockSelectQuantumResistantSettingListener, ) @@ -333,7 +329,7 @@ class VpnSettingsScreenTest { state = VpnSettingsUiState.createDefault( selectedWireguardPort = Constraint.Only(Port(53)) - ), + ) ) } @@ -346,7 +342,7 @@ class VpnSettingsScreenTest { // Assert onNodeWithTagAndText( testTag = String.format(LAZY_LIST_WIREGUARD_PORT_ITEM_X_TEST_TAG, 51820), - text = "51820" + text = "51820", ) .assertExists() } @@ -374,7 +370,7 @@ class VpnSettingsScreenTest { ) onNodeWithTagAndText( testTag = String.format(LAZY_LIST_WIREGUARD_PORT_ITEM_X_TEST_TAG, 51820), - text = "51820" + text = "51820", ) .performClick() @@ -393,7 +389,7 @@ class VpnSettingsScreenTest { state = VpnSettingsUiState.createDefault( customWireguardPort = Constraint.Only(Port(4000)) - ), + ) ) } @@ -415,9 +411,9 @@ class VpnSettingsScreenTest { state = VpnSettingsUiState.createDefault( selectedWireguardPort = Constraint.Only(Port(4000)), - customWireguardPort = Constraint.Only(Port(4000)) + customWireguardPort = Constraint.Only(Port(4000)), ), - onWireguardPortSelected = onWireguardPortSelected + onWireguardPortSelected = onWireguardPortSelected, ) } @@ -440,7 +436,7 @@ class VpnSettingsScreenTest { setContentWithTheme { VpnSettingsScreen( state = VpnSettingsUiState.createDefault(), - navigateToMtuDialog = mockedClickHandler + navigateToMtuDialog = mockedClickHandler, ) } @@ -462,7 +458,7 @@ class VpnSettingsScreenTest { setContentWithTheme { VpnSettingsScreen( state = VpnSettingsUiState.createDefault(isCustomDnsEnabled = true), - navigateToDns = mockedClickHandler + navigateToDns = mockedClickHandler, ) } @@ -482,7 +478,7 @@ class VpnSettingsScreenTest { setContentWithTheme { VpnSettingsScreen( state = VpnSettingsUiState.createDefault(), - navigateToObfuscationInfo = mockedNavigateToObfuscationInfo + navigateToObfuscationInfo = mockedNavigateToObfuscationInfo, ) } @@ -505,7 +501,7 @@ class VpnSettingsScreenTest { setContentWithTheme { VpnSettingsScreen( state = VpnSettingsUiState.createDefault(), - navigateToQuantumResistanceInfo = mockedShowTunnelQuantumInfoClick + navigateToQuantumResistanceInfo = mockedShowTunnelQuantumInfoClick, ) } @@ -528,7 +524,7 @@ class VpnSettingsScreenTest { setContentWithTheme { VpnSettingsScreen( state = VpnSettingsUiState.createDefault(), - navigateToWireguardPortInfo = mockedClickHandler + navigateToWireguardPortInfo = mockedClickHandler, ) } @@ -546,7 +542,7 @@ class VpnSettingsScreenTest { setContentWithTheme { VpnSettingsScreen( state = VpnSettingsUiState.createDefault(), - navigateToWireguardPortDialog = mockedClickHandler + navigateToWireguardPortDialog = mockedClickHandler, ) } @@ -566,7 +562,7 @@ class VpnSettingsScreenTest { setContentWithTheme { VpnSettingsScreen( state = VpnSettingsUiState.createDefault(), - navigateToWireguardPortDialog = mockOnShowCustomPortDialog + navigateToWireguardPortDialog = mockOnShowCustomPortDialog, ) } @@ -590,7 +586,7 @@ class VpnSettingsScreenTest { VpnSettingsUiState.createDefault( selectedWireguardPort = Constraint.Only(Port(4000)) ), - navigateToWireguardPortDialog = mockOnShowCustomPortDialog + navigateToWireguardPortDialog = mockOnShowCustomPortDialog, ) } diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/WelcomeScreenTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/WelcomeScreenTest.kt index cd5afa18fcf8..a9f1658308a3 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/WelcomeScreenTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/WelcomeScreenTest.kt @@ -46,7 +46,7 @@ class WelcomeScreenTest { onPurchaseBillingProductClick = { _ -> }, navigateToDeviceInfoDialog = {}, navigateToVerificationPendingDialog = {}, - onDisconnectClick = {} + onDisconnectClick = {}, ) } @@ -69,14 +69,14 @@ class WelcomeScreenTest { onPurchaseBillingProductClick = { _ -> }, navigateToDeviceInfoDialog = {}, navigateToVerificationPendingDialog = {}, - onDisconnectClick = {} + onDisconnectClick = {}, ) } // Assert onNodeWithText( "Either buy credit on our website or redeem a voucher.", - substring = true + substring = true, ) .assertDoesNotExist() onNodeWithText("Buy credit").assertDoesNotExist() @@ -98,7 +98,7 @@ class WelcomeScreenTest { onPurchaseBillingProductClick = { _ -> }, navigateToDeviceInfoDialog = {}, navigateToVerificationPendingDialog = {}, - onDisconnectClick = {} + onDisconnectClick = {}, ) } @@ -121,7 +121,7 @@ class WelcomeScreenTest { onPurchaseBillingProductClick = { _ -> }, navigateToDeviceInfoDialog = {}, navigateToVerificationPendingDialog = {}, - onDisconnectClick = {} + onDisconnectClick = {}, ) } @@ -147,7 +147,7 @@ class WelcomeScreenTest { onPurchaseBillingProductClick = { _ -> }, navigateToDeviceInfoDialog = {}, navigateToVerificationPendingDialog = {}, - onDisconnectClick = {} + onDisconnectClick = {}, ) } @@ -172,7 +172,7 @@ class WelcomeScreenTest { onPurchaseBillingProductClick = { _ -> }, navigateToDeviceInfoDialog = {}, navigateToVerificationPendingDialog = {}, - onDisconnectClick = {} + onDisconnectClick = {}, ) } @@ -201,7 +201,7 @@ class WelcomeScreenTest { onPurchaseBillingProductClick = { _ -> }, navigateToDeviceInfoDialog = {}, navigateToVerificationPendingDialog = {}, - onDisconnectClick = {} + onDisconnectClick = {}, ) } @@ -231,7 +231,7 @@ class WelcomeScreenTest { onPurchaseBillingProductClick = { _ -> }, navigateToDeviceInfoDialog = {}, navigateToVerificationPendingDialog = {}, - onDisconnectClick = {} + onDisconnectClick = {}, ) } @@ -262,7 +262,7 @@ class WelcomeScreenTest { onPurchaseBillingProductClick = { _ -> }, navigateToVerificationPendingDialog = mockShowPendingInfo, navigateToDeviceInfoDialog = {}, - onDisconnectClick = {} + onDisconnectClick = {}, ) } @@ -295,7 +295,7 @@ class WelcomeScreenTest { onPurchaseBillingProductClick = { _ -> }, navigateToDeviceInfoDialog = {}, navigateToVerificationPendingDialog = {}, - onDisconnectClick = {} + onDisconnectClick = {}, ) } @@ -326,7 +326,7 @@ class WelcomeScreenTest { onPurchaseBillingProductClick = clickHandler, navigateToDeviceInfoDialog = {}, navigateToVerificationPendingDialog = {}, - onDisconnectClick = {} + onDisconnectClick = {}, ) } @@ -354,7 +354,7 @@ class WelcomeScreenTest { onPurchaseBillingProductClick = {}, navigateToDeviceInfoDialog = {}, navigateToVerificationPendingDialog = {}, - onDisconnectClick = clickHandler + onDisconnectClick = clickHandler, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/applist/AppData.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/applist/AppData.kt index ec5912c24434..16b6ce70c37f 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/applist/AppData.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/applist/AppData.kt @@ -4,5 +4,5 @@ data class AppData( val packageName: String, val iconRes: Int, val name: String, - val isSystemApp: Boolean = false + val isSystemApp: Boolean = false, ) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/applist/ApplicationsProvider.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/applist/ApplicationsProvider.kt index 1220e71f077b..e38bd77409e2 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/applist/ApplicationsProvider.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/applist/ApplicationsProvider.kt @@ -6,7 +6,7 @@ import android.content.pm.PackageManager class ApplicationsProvider( private val packageManager: PackageManager, - private val thisPackageName: String + private val thisPackageName: String, ) { private val applicationFilterPredicate: (ApplicationInfo) -> Boolean = { appInfo -> hasInternetPermission(appInfo.packageName) && !isSelfApplication(appInfo.packageName) @@ -22,7 +22,7 @@ class ApplicationsProvider( info.packageName, info.icon, info.loadLabel(packageManager).toString(), - !isLaunchable(info.packageName) + !isLaunchable(info.packageName), ) } .toList() diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/AnimatedIconButton.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/AnimatedIconButton.kt index d197a1c62a74..090dc287c625 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/AnimatedIconButton.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/AnimatedIconButton.kt @@ -24,7 +24,7 @@ fun AnimatedIconButton( secondaryIconTint: Color, contentDescription: String, isToggleButton: Boolean = false, - onClick: () -> Unit + onClick: () -> Unit, ) { var state by remember { mutableStateOf(ButtonState.IDLE) } if (state == ButtonState.PRESSED) { @@ -75,5 +75,5 @@ fun AnimatedIconButton( enum class ButtonState { IDLE, TOGGLED, - PRESSED + PRESSED, } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/ApplyButton.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/ApplyButton.kt index 18feb8e3e2db..28b528213aba 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/ApplyButton.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/ApplyButton.kt @@ -26,7 +26,7 @@ fun ApplyButton( modifier: Modifier = Modifier, background: Color = MaterialTheme.colorScheme.tertiary, onClick: () -> Unit, - isEnabled: Boolean + isEnabled: Boolean, ) { VariantButton( background = background, diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/ConnectionButton.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/ConnectionButton.kt index dd8eec57d23f..9494542ba621 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/ConnectionButton.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/ConnectionButton.kt @@ -51,7 +51,7 @@ private fun PreviewConnectionButton( disconnectClick = {}, reconnectClick = {}, cancelClick = {}, - connectClick = {} + connectClick = {}, ) } } @@ -64,7 +64,7 @@ fun ConnectionButton( disconnectClick: () -> Unit, reconnectClick: () -> Unit, cancelClick: () -> Unit, - connectClick: () -> Unit + connectClick: () -> Unit, ) { val containerColor = if (state is TunnelState.Disconnected) { @@ -120,7 +120,7 @@ fun ConnectionButton( mainClick = onMainClick, reconnectClick = reconnectClick, reconnectButtonTestTag = reconnectButtonTestTag, - isReconnectButtonEnabled = (state is TunnelState.Disconnected).not() + isReconnectButtonEnabled = (state is TunnelState.Disconnected).not(), ) } @@ -134,7 +134,7 @@ private fun ConnectionButton( containerColor: Color, contentColor: Color, modifier: Modifier = Modifier, - reconnectButtonTestTag: String = "" + reconnectButtonTestTag: String = "", ) { ConstraintLayout( modifier = modifier.padding(vertical = Dimens.connectButtonExtraPadding).fillMaxWidth() @@ -148,7 +148,7 @@ private fun ConnectionButton( val (connectionButton, reconnectButton) = createRefs() CompositionLocalProvider( LocalMinimumInteractiveComponentSize provides - Dimens.reconnectButtonMinInteractiveComponentSize, + Dimens.reconnectButtonMinInteractiveComponentSize ) { val dividerSize = Dimens.listItemDivider @@ -158,7 +158,7 @@ private fun ConnectionButton( if (isReconnectButtonEnabled) { MaterialTheme.shapes.small.copy( topEnd = CornerSize(percent = 0), - bottomEnd = CornerSize(percent = 0) + bottomEnd = CornerSize(percent = 0), ) } else { MaterialTheme.shapes.small @@ -166,7 +166,7 @@ private fun ConnectionButton( colors = ButtonDefaults.buttonColors( containerColor = containerColor, - contentColor = contentColor + contentColor = contentColor, ), modifier = Modifier.constrainAs(connectionButton) { @@ -181,7 +181,7 @@ private fun ConnectionButton( } .onGloballyPositioned { componentHeight = with(density) { it.size.height.toDp() } - } + }, ) { // Offset to compensate for the reconnect button. Text( @@ -195,7 +195,7 @@ private fun ConnectionButton( Modifier.padding(start = componentHeight + Dimens.listItemDivider) } else { Modifier - } + }, ) } @@ -204,12 +204,12 @@ private fun ConnectionButton( shape = MaterialTheme.shapes.small.copy( topStart = CornerSize(percent = 0), - bottomStart = CornerSize(percent = 0) + bottomStart = CornerSize(percent = 0), ), colors = IconButtonDefaults.filledIconButtonColors( containerColor = containerColor, - contentColor = contentColor + contentColor = contentColor, ), onClick = reconnectClick, modifier = @@ -221,11 +221,11 @@ private fun ConnectionButton( end.linkTo(parent.end) height = Dimension.fillToConstraints } - .aspectRatio(1f, true) + .aspectRatio(1f, true), ) { Icon( painter = painterResource(id = R.drawable.icon_reload), - contentDescription = null + contentDescription = null, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/ExternalActionButton.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/ExternalActionButton.kt index 376172e63208..f4c309bd0704 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/ExternalActionButton.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/ExternalActionButton.kt @@ -27,7 +27,7 @@ private fun PreviewExternalButtonLongText() { ExternalButton( onClick = {}, text = "Button text is long and is trying to take up space that is large", - isEnabled = true + isEnabled = true, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/InfoIconButton.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/InfoIconButton.kt index 5c28069c52fe..61d0db68b345 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/InfoIconButton.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/InfoIconButton.kt @@ -14,13 +14,13 @@ fun InfoIconButton( onClick: () -> Unit, modifier: Modifier = Modifier, contentDescription: String? = null, - iconTint: Color = MaterialTheme.colorScheme.onPrimary + iconTint: Color = MaterialTheme.colorScheme.onPrimary, ) { IconButton(modifier = modifier, onClick = onClick) { Icon( painter = painterResource(id = R.drawable.icon_info), contentDescription = contentDescription, - tint = iconTint + tint = iconTint, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/MullvadButton.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/MullvadButton.kt index 77f6ecc6cb24..6aa17cefed9b 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/MullvadButton.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/MullvadButton.kt @@ -72,10 +72,10 @@ fun NegativeButton( containerColor = MaterialTheme.colorScheme.error, contentColor = MaterialTheme.colorScheme.onError, disabledContentColor = MaterialTheme.colorScheme.onError.copy(alpha = Alpha20), - disabledContainerColor = MaterialTheme.colorScheme.errorDisabled + disabledContainerColor = MaterialTheme.colorScheme.errorDisabled, ), isEnabled: Boolean = true, - icon: @Composable (() -> Unit)? = null + icon: @Composable (() -> Unit)? = null, ) { BaseButton( onClick = onClick, @@ -83,7 +83,7 @@ fun NegativeButton( text = text, modifier = modifier, isEnabled = isEnabled, - trailingIcon = icon + trailingIcon = icon, ) } @@ -101,7 +101,7 @@ fun VariantButton( disabledContainerColor = MaterialTheme.colorScheme.tertiaryDisabled, ), isEnabled: Boolean = true, - icon: @Composable (() -> Unit)? = null + icon: @Composable (() -> Unit)? = null, ) { BaseButton( onClick = onClick, @@ -109,7 +109,7 @@ fun VariantButton( text = text, modifier = modifier, isEnabled = isEnabled, - trailingIcon = icon + trailingIcon = icon, ) } @@ -127,7 +127,7 @@ fun PrimaryButton( ), isEnabled: Boolean = true, leadingIcon: @Composable (() -> Unit)? = null, - trailingIcon: @Composable (() -> Unit)? = null + trailingIcon: @Composable (() -> Unit)? = null, ) { BaseButton( onClick = onClick, @@ -136,7 +136,7 @@ fun PrimaryButton( modifier = modifier, isEnabled = isEnabled, leadingIcon = leadingIcon, - trailingIcon = trailingIcon + trailingIcon = trailingIcon, ) } @@ -148,7 +148,7 @@ private fun BaseButton( modifier: Modifier = Modifier, isEnabled: Boolean = true, leadingIcon: @Composable (() -> Unit)? = null, - trailingIcon: @Composable (() -> Unit)? = null + trailingIcon: @Composable (() -> Unit)? = null, ) { val hasIcon = leadingIcon != null || trailingIcon != null Button( @@ -162,7 +162,7 @@ private fun BaseButton( ButtonDefaults.ContentPadding }, modifier = modifier.wrapContentHeight().fillMaxWidth(), - shape = MaterialTheme.shapes.small + shape = MaterialTheme.shapes.small, ) { // Used to center the text when { @@ -183,7 +183,7 @@ private fun BaseButton( style = MaterialTheme.typography.bodyMedium, maxLines = 1, overflow = TextOverflow.Ellipsis, - modifier = Modifier.weight(1f) + modifier = Modifier.weight(1f), ) when { trailingIcon != null -> diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/RedeemVoucherButton.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/RedeemVoucherButton.kt index 0ee867cca995..4a8708aea425 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/RedeemVoucherButton.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/RedeemVoucherButton.kt @@ -25,6 +25,6 @@ fun RedeemVoucherButton(modifier: Modifier = Modifier, onClick: () -> Unit, isEn text = stringResource(id = R.string.redeem_voucher), onClick = onClick, modifier = modifier, - isEnabled = isEnabled + isEnabled = isEnabled, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/SitePaymentButton.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/SitePaymentButton.kt index a67d6d1db256..0a14272afd2e 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/SitePaymentButton.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/SitePaymentButton.kt @@ -17,7 +17,7 @@ private fun PreviewSitePaymentButton() { AppTheme { SpacedColumn( spacing = Dimens.cellVerticalSpacing, - modifier = Modifier.background(color = MaterialTheme.colorScheme.surface) + modifier = Modifier.background(color = MaterialTheme.colorScheme.surface), ) { SitePaymentButton(onClick = {}, isEnabled = true) SitePaymentButton(onClick = {}, isEnabled = false) @@ -26,15 +26,11 @@ private fun PreviewSitePaymentButton() { } @Composable -fun SitePaymentButton( - onClick: () -> Unit, - isEnabled: Boolean, - modifier: Modifier = Modifier, -) { +fun SitePaymentButton(onClick: () -> Unit, isEnabled: Boolean, modifier: Modifier = Modifier) { ExternalButton( onClick = onClick, modifier = modifier, isEnabled = isEnabled, - text = stringResource(id = R.string.buy_credit) + text = stringResource(id = R.string.buy_credit), ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/SwitchLocationButton.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/SwitchLocationButton.kt index 27d4e2c5023a..531cf685c455 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/SwitchLocationButton.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/SwitchLocationButton.kt @@ -35,7 +35,7 @@ fun SwitchLocationButton( colors = ButtonDefaults.buttonColors( containerColor = MaterialTheme.colorScheme.onPrimary.copy(alpha = Alpha20), - contentColor = MaterialTheme.colorScheme.onPrimary + contentColor = MaterialTheme.colorScheme.onPrimary, ), modifier = modifier, text = text, @@ -44,9 +44,9 @@ fun SwitchLocationButton( { Icon( painter = painterResource(id = R.drawable.icon_chevron), - contentDescription = null + contentDescription = null, ) } - } else null + } else null, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/BaseCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/BaseCell.kt index 66c73e33ca3f..7eb6f48569a6 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/BaseCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/BaseCell.kt @@ -38,7 +38,7 @@ private fun PreviewBaseCell() { headlineContent = { BaseCellTitle( title = "Header title", - style = MaterialTheme.typography.titleMedium + style = MaterialTheme.typography.titleMedium, ) } ) @@ -46,7 +46,7 @@ private fun PreviewBaseCell() { headlineContent = { BaseCellTitle( title = "Normal title", - style = MaterialTheme.typography.labelLarge + style = MaterialTheme.typography.labelLarge, ) } ) @@ -66,7 +66,7 @@ internal fun BaseCell( startPadding: Dp = Dimens.cellStartPadding, endPadding: Dp = Dimens.cellEndPadding, minHeight: Dp = Dimens.cellHeight, - testTag: String = "" + testTag: String = "", ) { Row( verticalAlignment = Alignment.CenterVertically, @@ -87,7 +87,7 @@ internal fun BaseCell( .fillMaxWidth() .background(background) .testTag(testTag) - .padding(start = startPadding, end = endPadding) + .padding(start = startPadding, end = endPadding), ) { iconView() @@ -103,7 +103,7 @@ internal fun BaseCellTitle( style: TextStyle, modifier: Modifier = Modifier, textAlign: TextAlign = TextAlign.Start, - textColor: Color = MaterialTheme.colorScheme.onPrimary + textColor: Color = MaterialTheme.colorScheme.onPrimary, ) { Text( text = title, @@ -112,7 +112,7 @@ internal fun BaseCellTitle( color = textColor, overflow = TextOverflow.Ellipsis, maxLines = 1, - modifier = modifier + modifier = modifier, ) } @@ -121,13 +121,13 @@ fun BaseSubtitleCell( text: String, modifier: Modifier = Modifier, style: TextStyle = MaterialTheme.typography.labelMedium, - color: Color + color: Color, ) { BaseSubtitleCell( text = AnnotatedString(text), modifier = modifier, style = style, - color = color + color = color, ) } @@ -136,7 +136,7 @@ fun BaseSubtitleCell( text: AnnotatedString, modifier: Modifier = Modifier, style: TextStyle = MaterialTheme.typography.labelMedium, - color: Color + color: Color, ) { Text( text = text, @@ -148,9 +148,9 @@ fun BaseSubtitleCell( start = Dimens.cellStartPadding, top = Dimens.cellFooterTopPadding, end = Dimens.cellEndPadding, - bottom = Dimens.cellLabelVerticalPadding + bottom = Dimens.cellLabelVerticalPadding, ) .fillMaxWidth() - .wrapContentHeight() + .wrapContentHeight(), ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/CheckboxCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/CheckboxCell.kt index 9faff445ee62..13c237d6f482 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/CheckboxCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/CheckboxCell.kt @@ -35,7 +35,7 @@ internal fun CheckboxCell( background: Color = MaterialTheme.colorScheme.surfaceContainerLow, startPadding: Dp = Dimens.mediumPadding, endPadding: Dp = Dimens.cellEndPadding, - minHeight: Dp = Dimens.cellHeight + minHeight: Dp = Dimens.cellHeight, ) { Row( verticalAlignment = Alignment.CenterVertically, @@ -45,7 +45,7 @@ internal fun CheckboxCell( .defaultMinSize(minHeight = minHeight) .fillMaxWidth() .background(background) - .padding(start = startPadding, end = endPadding) + .padding(start = startPadding, end = endPadding), ) { MullvadCheckbox(checked = checked, onCheckedChange = onCheckedChange) @@ -57,7 +57,7 @@ internal fun CheckboxCell( color = MaterialTheme.colorScheme.onSurface, modifier = Modifier.weight(1f) - .padding(top = Dimens.mediumPadding, bottom = Dimens.mediumPadding) + .padding(top = Dimens.mediumPadding, bottom = Dimens.mediumPadding), ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/CustomPortCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/CustomPortCell.kt index 139f6adeed15..c73054f772a1 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/CustomPortCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/CustomPortCell.kt @@ -53,12 +53,12 @@ fun CustomPortCell( mainTestTag: String = "", numberTestTag: String = "", onMainCellClicked: () -> Unit = {}, - onPortCellClicked: () -> Unit = {} + onPortCellClicked: () -> Unit = {}, ) { Row( verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start, - modifier = Modifier.height(Dimens.cellHeight).fillMaxWidth() + modifier = Modifier.height(Dimens.cellHeight).fillMaxWidth(), ) { Row( verticalAlignment = Alignment.CenterVertically, @@ -75,7 +75,7 @@ fun CustomPortCell( } ) .padding(start = Dimens.cellStartPadding) - .testTag(mainTestTag) + .testTag(mainTestTag), ) { Icon( painter = painterResource(id = R.drawable.icon_tick), @@ -83,7 +83,7 @@ fun CustomPortCell( tint = MaterialTheme.colorScheme.onSelected, modifier = Modifier.padding(end = Dimens.selectableCellTextMargin) - .alpha(if (isSelected) AlphaVisible else AlphaInvisible) + .alpha(if (isSelected) AlphaVisible else AlphaInvisible), ) BaseCellTitle( title = title, @@ -94,7 +94,7 @@ fun CustomPortCell( MaterialTheme.colorScheme.onSelected } else { MaterialTheme.colorScheme.onSurface - } + }, ) } Spacer(modifier = Modifier.width(Dimens.verticalSpacer)) @@ -110,7 +110,7 @@ fun CustomPortCell( Text( text = port?.value?.toString() ?: stringResource(id = R.string.port), color = MaterialTheme.colorScheme.onPrimary, - modifier = Modifier.align(Alignment.Center) + modifier = Modifier.align(Alignment.Center), ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/DnsCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/DnsCell.kt index 84dd8003d06e..a420534780e5 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/DnsCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/DnsCell.kt @@ -28,7 +28,7 @@ fun DnsCell( address: String, isUnreachableLocalDnsWarningVisible: Boolean, onClick: () -> Unit, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, ) { val titleModifier = Modifier val startPadding = 54.dp @@ -40,14 +40,14 @@ fun DnsCell( Icon( painter = painterResource(id = R.drawable.icon_alert), contentDescription = stringResource(id = R.string.confirm_local_dns), - tint = MaterialTheme.colorScheme.warning + tint = MaterialTheme.colorScheme.warning, ) } }, onCellClicked = { onClick.invoke() }, background = MaterialTheme.colorScheme.surfaceContainerLow, startPadding = startPadding, - modifier = modifier + modifier = modifier, ) } @@ -58,6 +58,6 @@ private fun RowScope.DnsTitle(address: String, modifier: Modifier = Modifier) { color = MaterialTheme.colorScheme.onSurface, style = MaterialTheme.typography.labelLarge, textAlign = TextAlign.Start, - modifier = modifier.weight(1f) + modifier = modifier.weight(1f), ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/DropdownMenuCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/DropdownMenuCell.kt index afd9e1c21c9d..4ab25d6078af 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/DropdownMenuCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/DropdownMenuCell.kt @@ -16,11 +16,7 @@ import net.mullvad.mullvadvpn.lib.theme.Dimens @Preview @Composable private fun PreviewThreeDotCell() { - AppTheme { - ThreeDotCell( - text = "Three dots", - ) - } + AppTheme { ThreeDotCell(text = "Three dots") } } @Composable @@ -30,7 +26,7 @@ fun ThreeDotCell( onClickDots: () -> Unit = {}, textStyle: TextStyle = MaterialTheme.typography.titleMedium, textColor: Color = MaterialTheme.colorScheme.onPrimary, - background: Color = MaterialTheme.colorScheme.primary + background: Color = MaterialTheme.colorScheme.primary, ) { BaseCell( headlineContent = { @@ -38,7 +34,7 @@ fun ThreeDotCell( title = text, style = textStyle, textColor = textColor, - modifier = Modifier.weight(1f, true) + modifier = Modifier.weight(1f, true), ) }, modifier = modifier, @@ -48,11 +44,11 @@ fun ThreeDotCell( Icon( painter = painterResource(id = R.drawable.icon_more_vert), contentDescription = null, - tint = textColor + tint = textColor, ) } }, isRowEnabled = false, - endPadding = Dimens.smallPadding + endPadding = Dimens.smallPadding, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/ExpandableComposeCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/ExpandableComposeCell.kt index 0132c3c8f838..71c3ffc18ee0 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/ExpandableComposeCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/ExpandableComposeCell.kt @@ -38,7 +38,7 @@ private fun PreviewExpandedEnabledExpandableComposeCell() { isExpanded = true, isEnabled = true, onCellClicked = {}, - onInfoClicked = {} + onInfoClicked = {}, ) } } @@ -53,7 +53,7 @@ fun ExpandableComposeCell( textColor: Color = MaterialTheme.colorScheme.onPrimary, background: Color = MaterialTheme.colorScheme.primary, onCellClicked: (Boolean) -> Unit = {}, - onInfoClicked: (() -> Unit)? = null + onInfoClicked: (() -> Unit)? = null, ) { val titleModifier = Modifier.alpha(if (isEnabled) AlphaVisible else AlphaInactive) val bodyViewModifier = Modifier @@ -65,7 +65,7 @@ fun ExpandableComposeCell( title = title, style = MaterialTheme.typography.titleMedium, textColor = textColor, - modifier = titleModifier.weight(1f, fill = true) + modifier = titleModifier.weight(1f, fill = true), ) }, bodyView = { @@ -73,11 +73,11 @@ fun ExpandableComposeCell( isExpanded = isExpanded, modifier = bodyViewModifier, onExpand = onCellClicked, - onInfoClicked = onInfoClicked + onInfoClicked = onInfoClicked, ) }, background = background, - onCellClicked = { onCellClicked(!isExpanded) } + onCellClicked = { onCellClicked(!isExpanded) }, ) } @@ -86,23 +86,23 @@ private fun ExpandableComposeCellBody( isExpanded: Boolean, modifier: Modifier, onExpand: ((Boolean) -> Unit), - onInfoClicked: (() -> Unit)? = null + onInfoClicked: (() -> Unit)? = null, ) { Row( modifier = modifier.wrapContentWidth().wrapContentHeight(), - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { if (onInfoClicked != null) { IconButton( modifier = Modifier.padding(horizontal = Dimens.miniPadding) .align(Alignment.CenterVertically), - onClick = onInfoClicked + onClick = onInfoClicked, ) { Icon( painter = painterResource(id = R.drawable.icon_info), contentDescription = null, - tint = MaterialTheme.colorScheme.onPrimary + tint = MaterialTheme.colorScheme.onPrimary, ) } } @@ -110,7 +110,7 @@ private fun ExpandableComposeCellBody( ChevronButton( isExpanded = isExpanded, onExpand = onExpand, - color = MaterialTheme.colorScheme.onPrimary + color = MaterialTheme.colorScheme.onPrimary, ) } } @@ -121,14 +121,14 @@ fun ContentBlockersDisableModeCellSubtitle(modifier: Modifier) { HtmlCompat.fromHtml( textResource( id = R.string.dns_content_blockers_subtitle, - stringResource(id = R.string.enable_custom_dns) + stringResource(id = R.string.enable_custom_dns), ), - HtmlCompat.FROM_HTML_MODE_COMPACT + HtmlCompat.FROM_HTML_MODE_COMPACT, ) Text( text = spanned.toAnnotatedString(boldFontWeight = FontWeight.ExtraBold), style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant, - modifier = modifier + modifier = modifier, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/FilterRow.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/FilterRow.kt index 39f639613227..a94846dacff1 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/FilterRow.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/FilterRow.kt @@ -27,7 +27,7 @@ private fun PreviewFilterCell() { FilterRow( listOf(FilterChip.Ownership(Ownership.MullvadOwned), FilterChip.Provider(2)), {}, - {} + {}, ) } } @@ -36,23 +36,21 @@ private fun PreviewFilterCell() { fun FilterRow( filters: List, onRemoveOwnershipFilter: () -> Unit, - onRemoveProviderFilter: () -> Unit + onRemoveProviderFilter: () -> Unit, ) { val scrollState = rememberScrollState() Row( verticalAlignment = Alignment.CenterVertically, modifier = Modifier.horizontalScroll(scrollState) - .padding( - horizontal = Dimens.searchFieldHorizontalPadding, - ) + .padding(horizontal = Dimens.searchFieldHorizontalPadding) .fillMaxWidth(), - horizontalArrangement = Arrangement.spacedBy(Dimens.chipSpace) + horizontalArrangement = Arrangement.spacedBy(Dimens.chipSpace), ) { Text( text = stringResource(id = R.string.filtered), color = MaterialTheme.colorScheme.onPrimary, - style = MaterialTheme.typography.labelMedium + style = MaterialTheme.typography.labelMedium, ) filters.forEach { when (it) { @@ -68,7 +66,7 @@ fun FilterRow( fun ProviderFilterChip(providers: Int, onRemoveClick: () -> Unit) { MullvadFilterChip( text = stringResource(id = R.string.number_of_providers, providers), - onRemoveClick = onRemoveClick + onRemoveClick = onRemoveClick, ) } @@ -76,7 +74,7 @@ fun ProviderFilterChip(providers: Int, onRemoveClick: () -> Unit) { fun OwnershipFilterChip(ownership: Ownership, onRemoveClick: () -> Unit) { MullvadFilterChip( text = stringResource(ownership.stringResources()), - onRemoveClick = onRemoveClick + onRemoveClick = onRemoveClick, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/HeaderCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/HeaderCell.kt index 5f5eda0b4e4f..a21472560c6e 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/HeaderCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/HeaderCell.kt @@ -15,15 +15,9 @@ fun HeaderCell( background: Color = MaterialTheme.colorScheme.primary, ) { BaseCell( - headlineContent = { - BaseCellTitle( - title = text, - style = textStyle, - textColor = textColor, - ) - }, + headlineContent = { BaseCellTitle(title = text, style = textStyle, textColor = textColor) }, modifier = modifier, background = background, - isRowEnabled = false + isRowEnabled = false, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/IconCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/IconCell.kt index 32ab1a9e4b7b..1823d1576573 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/IconCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/IconCell.kt @@ -32,7 +32,7 @@ fun IconCell( titleColor: Color = MaterialTheme.colorScheme.onPrimary, onClick: () -> Unit = {}, background: Color = MaterialTheme.colorScheme.primary, - enabled: Boolean = true + enabled: Boolean = true, ) { BaseCell( headlineContent = { @@ -41,7 +41,7 @@ fun IconCell( Icon( painter = painterResource(id = iconId), contentDescription = contentDescription, - tint = titleColor + tint = titleColor, ) Spacer(modifier = Modifier.width(Dimens.mediumPadding)) } @@ -51,6 +51,6 @@ fun IconCell( onCellClicked = onClick, background = background, isRowEnabled = enabled, - modifier = modifier + modifier = modifier, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/InformationComposeCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/InformationComposeCell.kt index 7b674382cdc5..230f28a1944f 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/InformationComposeCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/InformationComposeCell.kt @@ -29,7 +29,7 @@ private fun PreviewInformationComposeCell() { title = "Information row title", isEnabled = true, onCellClicked = {}, - onInfoClicked = {} + onInfoClicked = {}, ) } } @@ -40,7 +40,7 @@ fun InformationComposeCell( isEnabled: Boolean = true, background: Color = MaterialTheme.colorScheme.primary, onCellClicked: () -> Unit = {}, - onInfoClicked: (() -> Unit)? = null + onInfoClicked: (() -> Unit)? = null, ) { val titleModifier = Modifier.alpha(if (isEnabled) AlphaVisible else AlphaInactive) val bodyViewModifier = Modifier @@ -52,14 +52,14 @@ fun InformationComposeCell( title = title, style = MaterialTheme.typography.titleMedium, textColor = MaterialTheme.colorScheme.onPrimary, - modifier = titleModifier.weight(1f, true) + modifier = titleModifier.weight(1f, true), ) }, background = background, bodyView = { InformationComposeCellBody(modifier = bodyViewModifier, onInfoClicked = onInfoClicked) }, - onCellClicked = onCellClicked + onCellClicked = onCellClicked, ) } @@ -67,7 +67,7 @@ fun InformationComposeCell( private fun InformationComposeCellBody(modifier: Modifier, onInfoClicked: (() -> Unit)? = null) { Row( modifier = modifier.wrapContentWidth().wrapContentHeight(), - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { if (onInfoClicked != null) { IconButton( @@ -79,7 +79,7 @@ private fun InformationComposeCellBody(modifier: Modifier, onInfoClicked: (() -> Icon( painter = painterResource(id = R.drawable.icon_info), contentDescription = null, - tint = MaterialTheme.colorScheme.onPrimary + tint = MaterialTheme.colorScheme.onPrimary, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/MtuComposeCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/MtuComposeCell.kt index 36df885a5b7b..ca864f66b3dd 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/MtuComposeCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/MtuComposeCell.kt @@ -20,16 +20,13 @@ private fun PreviewMtuComposeCell() { } @Composable -fun MtuComposeCell( - mtuValue: Mtu?, - onEditMtu: () -> Unit, -) { +fun MtuComposeCell(mtuValue: Mtu?, onEditMtu: () -> Unit) { val titleModifier = Modifier BaseCell( headlineContent = { MtuTitle(modifier = titleModifier.weight(1f, true)) }, bodyView = { MtuBodyView(mtuValue = mtuValue, modifier = titleModifier) }, - onCellClicked = { onEditMtu.invoke() } + onCellClicked = { onEditMtu.invoke() }, ) } @@ -39,7 +36,7 @@ private fun MtuTitle(modifier: Modifier) { text = stringResource(R.string.wireguard_mtu), style = MaterialTheme.typography.titleMedium, color = MaterialTheme.colorScheme.onPrimary, - modifier = modifier + modifier = modifier, ) } @@ -48,7 +45,7 @@ private fun MtuBodyView(mtuValue: Mtu?, modifier: Modifier) { Row(modifier = modifier) { Text( text = mtuValue?.value?.toString() ?: stringResource(id = R.string.hint_default), - color = MaterialTheme.colorScheme.onPrimary + color = MaterialTheme.colorScheme.onPrimary, ) } } @@ -59,6 +56,6 @@ fun MtuSubtitle(modifier: Modifier = Modifier) { text = stringResource(R.string.wireguard_mtu_footer, MTU_MIN_VALUE, MTU_MAX_VALUE), style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant, - modifier = modifier + modifier = modifier, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/NavigationComposeCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/NavigationComposeCell.kt index 926b6bf4b9ab..a4233cc3b112 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/NavigationComposeCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/NavigationComposeCell.kt @@ -34,7 +34,7 @@ private fun PreviewNavigationCell() { ) }, onClick = {}, - showWarning = true + showWarning = true, ) } } @@ -50,11 +50,11 @@ private fun PreviewExternalLinkComposeCell() { contentBodyDescription = "content body", content = "content body", contentColor = MaterialTheme.colorScheme.onPrimary, - isExternalLink = true + isExternalLink = true, ) }, onClick = {}, - showWarning = false + showWarning = false, ) } } @@ -70,7 +70,7 @@ fun NavigationComposeCell( }, isRowEnabled: Boolean = true, onClick: () -> Unit, - testTag: String = "" + testTag: String = "", ) { BaseCell( onCellClicked = onClick, @@ -78,12 +78,12 @@ fun NavigationComposeCell( NavigationTitleView( title = title, modifier = modifier.weight(1f, true), - showWarning = showWarning + showWarning = showWarning, ) }, bodyView = { bodyView() }, isRowEnabled = isRowEnabled, - testTag = testTag + testTag = testTag, ) } @@ -91,14 +91,14 @@ fun NavigationComposeCell( internal fun NavigationTitleView( title: String, modifier: Modifier = Modifier, - showWarning: Boolean = false + showWarning: Boolean = false, ) { if (showWarning) { Icon( painter = painterResource(id = R.drawable.icon_alert), modifier = Modifier.padding(end = Dimens.smallPadding), contentDescription = null, - tint = MaterialTheme.colorScheme.error + tint = MaterialTheme.colorScheme.error, ) } Text( @@ -107,7 +107,7 @@ internal fun NavigationTitleView( color = MaterialTheme.colorScheme.onPrimary, modifier = modifier, maxLines = 1, - overflow = TextOverflow.Ellipsis + overflow = TextOverflow.Ellipsis, ) } @@ -116,7 +116,7 @@ internal fun DefaultNavigationView(chevronContentDescription: String, tint: Colo Icon( painter = painterResource(id = R.drawable.icon_chevron), contentDescription = chevronContentDescription, - tint = tint + tint = tint, ) } @@ -125,7 +125,7 @@ internal fun DefaultExternalLinkView(chevronContentDescription: String, tint: Co Icon( painter = painterResource(id = R.drawable.icon_extlink), contentDescription = chevronContentDescription, - tint = tint + tint = tint, ) } @@ -136,11 +136,11 @@ internal fun NavigationCellBody( modifier: Modifier = Modifier, contentColor: Color = MaterialTheme.colorScheme.onPrimary, textColor: Color = MaterialTheme.colorScheme.onPrimary, - isExternalLink: Boolean = false + isExternalLink: Boolean = false, ) { Row( verticalAlignment = Alignment.CenterVertically, - modifier = modifier.wrapContentWidth().wrapContentHeight() + modifier = modifier.wrapContentWidth().wrapContentHeight(), ) { Text(text = content, style = MaterialTheme.typography.labelMedium, color = textColor) Spacer(modifier = Modifier.width(Dimens.sideMargin)) @@ -149,7 +149,7 @@ internal fun NavigationCellBody( } else { DefaultNavigationView( chevronContentDescription = contentBodyDescription, - tint = contentColor + tint = contentColor, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/RelayLocationCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/RelayLocationCell.kt index 822d6118cba4..24e368a20156 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/RelayLocationCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/RelayLocationCell.kt @@ -54,7 +54,7 @@ private fun PreviewCheckableRelayLocationCell( checked = false, expanded = false, depth = 0, - onExpand = {} + onExpand = {}, ) } } @@ -85,7 +85,7 @@ fun StatusRelayItemCell( if (isSelected) { Icon( painter = painterResource(id = R.drawable.icon_tick), - contentDescription = null + contentDescription = null, ) } else { Box( @@ -100,7 +100,7 @@ fun StatusRelayItemCell( item.active -> activeColor else -> inactiveColor }, - shape = CircleShape + shape = CircleShape, ) ) } @@ -147,7 +147,7 @@ fun RelayItemCell( onLongClick = onLongClick, ) .padding(start = startPadding), - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { if (leadingContent != null) { leadingContent() @@ -158,7 +158,7 @@ fun RelayItemCell( ExpandButton( color = MaterialTheme.colorScheme.onSurface, isExpanded = isExpanded, - onClick = { onToggleExpand(!isExpanded) } + onClick = { onToggleExpand(!isExpanded) }, ) } } @@ -172,7 +172,7 @@ fun CheckableRelayLocationCell( onRelayCheckedChange: (isChecked: Boolean) -> Unit = { _ -> }, expanded: Boolean, onExpand: (Boolean) -> Unit, - depth: Int + depth: Int, ) { RelayItemCell( modifier = modifier, @@ -181,13 +181,13 @@ fun CheckableRelayLocationCell( leadingContent = { MullvadCheckbox( checked = checked, - onCheckedChange = { isChecked -> onRelayCheckedChange(isChecked) } + onCheckedChange = { isChecked -> onRelayCheckedChange(isChecked) }, ) }, onClick = { onRelayCheckedChange(!checked) }, onToggleExpand = onExpand, isExpanded = expanded, - depth = depth + depth = depth, ) } @@ -207,7 +207,7 @@ private fun Name(modifier: Modifier = Modifier, relay: RelayItem) { ) .padding(horizontal = Dimens.smallPadding, vertical = Dimens.mediumPadding), maxLines = 1, - overflow = TextOverflow.Ellipsis + overflow = TextOverflow.Ellipsis, ) } @@ -215,11 +215,11 @@ private fun Name(modifier: Modifier = Modifier, relay: RelayItem) { private fun RowScope.ExpandButton( color: Color, isExpanded: Boolean, - onClick: (expand: Boolean) -> Unit + onClick: (expand: Boolean) -> Unit, ) { VerticalDivider( color = MaterialTheme.colorScheme.surface, - modifier = Modifier.padding(vertical = Dimens.verticalDividerPadding) + modifier = Modifier.padding(vertical = Dimens.verticalDividerPadding), ) Chevron( color = color, @@ -228,7 +228,7 @@ private fun RowScope.ExpandButton( Modifier.fillMaxHeight() .clickable { onClick(!isExpanded) } .padding(horizontal = Dimens.largePadding) - .align(Alignment.CenterVertically) + .align(Alignment.CenterVertically), ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SelectableCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SelectableCell.kt index 1f3a546c10b2..0864f99cb15a 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SelectableCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SelectableCell.kt @@ -51,7 +51,7 @@ fun SelectableCell( .alpha( if (isSelected && !isEnabled) AlphaDisabled else if (isSelected) AlphaVisible else AlphaInvisible - ) + ), ) }, titleStyle: TextStyle = MaterialTheme.typography.labelLarge, @@ -61,7 +61,7 @@ fun SelectableCell( onSelectedColor: Color = MaterialTheme.colorScheme.onSelected, onBackgroundColor: Color = MaterialTheme.colorScheme.onSurface, onCellClicked: () -> Unit = {}, - testTag: String = "" + testTag: String = "", ) { BaseCell( modifier = modifier, @@ -84,7 +84,7 @@ fun SelectableCell( } else { AlphaDisabled } - ) + ), ) }, background = @@ -95,6 +95,6 @@ fun SelectableCell( }, startPadding = startPadding, iconView = selectedIcon, - testTag = testTag + testTag = testTag, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/ServerIpOverridesCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/ServerIpOverridesCell.kt index acd785e1c356..13dc99b8a41d 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/ServerIpOverridesCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/ServerIpOverridesCell.kt @@ -49,7 +49,7 @@ fun ServerIpOverridesCell( active -> activeColor else -> inactiveColor }, - shape = CircleShape + shape = CircleShape, ) ) } @@ -72,11 +72,11 @@ fun ServerIpOverridesCell( ) .padding( horizontal = Dimens.smallPadding, - vertical = Dimens.mediumPadding - ) + vertical = Dimens.mediumPadding, + ), ) } }, - isRowEnabled = false + isRowEnabled = false, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SplitTunnelingCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SplitTunnelingCell.kt index b4899fed238b..6a684edef131 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SplitTunnelingCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SplitTunnelingCell.kt @@ -44,13 +44,13 @@ private fun PreviewTunnelingCell() { title = "Mullvad VPN", packageName = "", isSelected = false, - enabled = true + enabled = true, ) SplitTunnelingCell( title = "Mullvad VPN", packageName = "", isSelected = true, - enabled = true + enabled = true, ) } } @@ -65,7 +65,7 @@ fun SplitTunnelingCell( modifier: Modifier = Modifier, backgroundColor: Color = MaterialTheme.colorScheme.surfaceContainerHigh, onResolveIcon: (String) -> Bitmap? = { null }, - onCellClicked: () -> Unit = {} + onCellClicked: () -> Unit = {}, ) { var icon by remember(packageName) { mutableStateOf(null) } LaunchedEffect(packageName) { @@ -90,7 +90,7 @@ fun SplitTunnelingCell( ColorFilter.tint(MaterialTheme.colorScheme.onSurface) } else { null - } + }, ) }, headlineContent = { @@ -101,7 +101,7 @@ fun SplitTunnelingCell( modifier = Modifier.weight(1f) .padding(horizontal = Dimens.mediumPadding) - .align(Alignment.CenterVertically) + .align(Alignment.CenterVertically), ) }, bodyView = { @@ -117,12 +117,12 @@ fun SplitTunnelingCell( ), contentDescription = null, tint = MaterialTheme.colorScheme.onSurface, - modifier = Modifier.size(size = Dimens.addIconSize) + modifier = Modifier.size(size = Dimens.addIconSize), ) }, onCellClicked = onCellClicked, background = backgroundColor, modifier = modifier, - isRowEnabled = enabled + isRowEnabled = enabled, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SwitchComposeCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SwitchComposeCell.kt index 28dbf8034a63..3ed8887291a8 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SwitchComposeCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SwitchComposeCell.kt @@ -41,14 +41,14 @@ private fun PreviewSwitchComposeCell() { isEnabled = true, isToggled = true, onCellClicked = {}, - onInfoClicked = {} + onInfoClicked = {}, ) NormalSwitchComposeCell( title = "Checkbox Item", isEnabled = true, isToggled = true, onCellClicked = {}, - onInfoClicked = {} + onInfoClicked = {}, ) } } @@ -63,7 +63,7 @@ fun NormalSwitchComposeCell( background: Color = MaterialTheme.colorScheme.surfaceContainerLow, onBackground: Color = MaterialTheme.colorScheme.onSurface, onCellClicked: (Boolean) -> Unit = {}, - onInfoClicked: (() -> Unit)? = null + onInfoClicked: (() -> Unit)? = null, ) { SwitchComposeCell( titleView = { @@ -71,7 +71,7 @@ fun NormalSwitchComposeCell( title = title, style = MaterialTheme.typography.labelLarge, modifier = Modifier.weight(1f, true), - textColor = if (isEnabled) onBackground else onBackground.copy(AlphaDisabled) + textColor = if (isEnabled) onBackground else onBackground.copy(AlphaDisabled), ) }, isToggled = isToggled, @@ -80,7 +80,7 @@ fun NormalSwitchComposeCell( background = background, onBackground = onBackground, onCellClicked = onCellClicked, - onInfoClicked = onInfoClicked + onInfoClicked = onInfoClicked, ) } @@ -102,7 +102,7 @@ fun HeaderSwitchComposeCell( title = title, style = MaterialTheme.typography.titleMedium, modifier = Modifier.weight(1f, fill = true), - textColor = onBackground + textColor = onBackground, ) }, isToggled = isToggled, @@ -138,12 +138,12 @@ private fun SwitchComposeCell( isEnabled = isEnabled, isToggled = isToggled, iconColor = onBackground, - onInfoClicked = onInfoClicked + onInfoClicked = onInfoClicked, ) }, background = background, onCellClicked = { onCellClicked(!isToggled) }, - startPadding = startPadding + startPadding = startPadding, ) } @@ -154,23 +154,23 @@ fun SwitchCellView( iconColor: Color, modifier: Modifier = Modifier, onSwitchClicked: ((Boolean) -> Unit)? = null, - onInfoClicked: (() -> Unit)? = null + onInfoClicked: (() -> Unit)? = null, ) { Row( modifier = modifier.wrapContentWidth().wrapContentHeight(), - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { if (onInfoClicked != null) { IconButton( modifier = Modifier.align(Alignment.CenterVertically) .padding(horizontal = Dimens.miniPadding), - onClick = onInfoClicked + onClick = onInfoClicked, ) { Icon( painter = painterResource(id = R.drawable.icon_info), contentDescription = null, - tint = iconColor + tint = iconColor, ) } } @@ -188,16 +188,16 @@ fun CustomDnsCellSubtitle(isCellClickable: Boolean, modifier: Modifier) { } else { textResource( id = R.string.custom_dns_disable_mode_subtitle, - textResource(id = R.string.dns_content_blockers_title) + textResource(id = R.string.dns_content_blockers_title), ) }, - FROM_HTML_MODE_COMPACT + FROM_HTML_MODE_COMPACT, ) Text( text = spanned.toAnnotatedString(boldFontWeight = FontWeight.ExtraBold), style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant, - modifier = modifier + modifier = modifier, ) } @@ -205,7 +205,7 @@ fun CustomDnsCellSubtitle(isCellClickable: Boolean, modifier: Modifier) { fun SwitchComposeSubtitleCell( text: String, modifier: Modifier = Modifier, - color: Color = MaterialTheme.colorScheme.onSurfaceVariant + color: Color = MaterialTheme.colorScheme.onSurfaceVariant, ) { BaseSubtitleCell(text = text, modifier = modifier, color = color) } @@ -214,7 +214,7 @@ fun SwitchComposeSubtitleCell( fun SwitchComposeSubtitleCell( text: AnnotatedString, modifier: Modifier = Modifier, - color: Color = MaterialTheme.colorScheme.onSurfaceVariant + color: Color = MaterialTheme.colorScheme.onSurfaceVariant, ) { BaseSubtitleCell(text = text, modifier = modifier, color = color) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/TwoRowCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/TwoRowCell.kt index 0e046cdfd827..b14063a1ea92 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/TwoRowCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/TwoRowCell.kt @@ -30,7 +30,7 @@ fun TwoRowCell( subtitleColor: Color = MaterialTheme.colorScheme.onPrimary, titleStyle: TextStyle = MaterialTheme.typography.labelLarge, subtitleStyle: TextStyle = MaterialTheme.typography.labelLarge, - background: Color = MaterialTheme.colorScheme.primary + background: Color = MaterialTheme.colorScheme.primary, ) { BaseCell( headlineContent = { @@ -41,7 +41,7 @@ fun TwoRowCell( style = titleStyle, color = titleColor, maxLines = 1, - overflow = TextOverflow.Ellipsis + overflow = TextOverflow.Ellipsis, ) Text( modifier = Modifier.fillMaxWidth(), @@ -49,13 +49,13 @@ fun TwoRowCell( style = subtitleStyle, color = subtitleColor, maxLines = 1, - overflow = TextOverflow.Ellipsis + overflow = TextOverflow.Ellipsis, ) } }, bodyView = bodyView, onCellClicked = onCellClicked, background = background, - minHeight = Dimens.cellHeightTwoRows + minHeight = Dimens.cellHeightTwoRows, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/communication/CustomListAction.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/communication/CustomListAction.kt index 206c90ab7b9b..9bca1edcac37 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/communication/CustomListAction.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/communication/CustomListAction.kt @@ -27,7 +27,7 @@ sealed interface CustomListAction : Parcelable { @Parcelize data class UpdateLocations( val id: CustomListId, - val locations: List = emptyList() + val locations: List = emptyList(), ) : CustomListAction { fun not(locations: List): UpdateLocations = UpdateLocations(id = id, locations = locations) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/communication/CustomListActionResultData.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/communication/CustomListActionResultData.kt index 441ddf1fc2c4..99791bf457c9 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/communication/CustomListActionResultData.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/communication/CustomListActionResultData.kt @@ -13,39 +13,39 @@ sealed interface CustomListActionResultData : Parcelable { data class CreatedWithLocations( val customListName: CustomListName, val locationNames: List, - override val undo: CustomListAction + override val undo: CustomListAction, ) : Success @Parcelize data class Deleted( val customListName: CustomListName, - override val undo: CustomListAction.Create + override val undo: CustomListAction.Create, ) : Success @Parcelize data class Renamed( val newName: CustomListName, - override val undo: CustomListAction.Rename + override val undo: CustomListAction.Rename, ) : Success @Parcelize data class LocationAdded( val customListName: CustomListName, val locationName: String, - override val undo: CustomListAction + override val undo: CustomListAction, ) : Success @Parcelize data class LocationRemoved( val customListName: CustomListName, val locationName: String, - override val undo: CustomListAction + override val undo: CustomListAction, ) : Success @Parcelize data class LocationChanged( val customListName: CustomListName, - override val undo: CustomListAction + override val undo: CustomListAction, ) : Success } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/communication/CustomListSuccess.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/communication/CustomListSuccess.kt index 3b6a30bf38ca..1bd5cd2ebdbc 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/communication/CustomListSuccess.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/communication/CustomListSuccess.kt @@ -16,7 +16,7 @@ data class Created( val id: CustomListId, val name: CustomListName, val locationNames: List, - override val undo: CustomListAction.Delete + override val undo: CustomListAction.Delete, ) : CustomListSuccess @Parcelize diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/AccountNumberView.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/AccountNumberView.kt index df0ae4d299b9..bb261acb159d 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/AccountNumberView.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/AccountNumberView.kt @@ -9,13 +9,13 @@ import net.mullvad.mullvadvpn.lib.common.util.groupWithSpaces fun AccountNumberView( accountNumber: String, obfuscateWithPasswordDots: Boolean, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, ) { InformationView( content = if (obfuscateWithPasswordDots) accountNumber.groupPasswordModeWithSpaces() else accountNumber.groupWithSpaces(), modifier = modifier, - whenMissing = MissingPolicy.SHOW_SPINNER + whenMissing = MissingPolicy.SHOW_SPINNER, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/Chevron.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/Chevron.kt index b24c9a5fe6a5..15758be10e2a 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/Chevron.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/Chevron.kt @@ -21,7 +21,7 @@ fun Chevron(modifier: Modifier = Modifier, color: Color, isExpanded: Boolean) { animateFloatAsState( targetValue = degree, label = "", - animationSpec = TweenSpec(100, easing = LinearEasing) + animationSpec = TweenSpec(100, easing = LinearEasing), ) Icon( @@ -37,7 +37,7 @@ fun ChevronButton( modifier: Modifier = Modifier, color: Color, onExpand: (Boolean) -> Unit, - isExpanded: Boolean + isExpanded: Boolean, ) { IconButton(modifier = modifier, onClick = { onExpand(!isExpanded) }) { Chevron(isExpanded = isExpanded, color = color) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/CircularProgressIndicator.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/CircularProgressIndicator.kt index 0973167b165b..2e1bf30eab37 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/CircularProgressIndicator.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/CircularProgressIndicator.kt @@ -22,7 +22,7 @@ private fun PreviewMullvadProgressIndicator() { AppTheme { Column( modifier = Modifier.padding(16.dp), - verticalArrangement = Arrangement.spacedBy(16.dp) + verticalArrangement = Arrangement.spacedBy(16.dp), ) { MullvadCircularProgressIndicatorLarge() MullvadCircularProgressIndicatorMedium() @@ -42,7 +42,7 @@ fun MullvadCircularProgressIndicatorLarge( color, Dimens.circularProgressBarLargeStrokeWidth, trackColor, - StrokeCap.Round + StrokeCap.Round, ) } @@ -57,7 +57,7 @@ fun MullvadCircularProgressIndicatorMedium( color, Dimens.circularProgressBarMediumStrokeWidth, trackColor, - StrokeCap.Round + StrokeCap.Round, ) } @@ -72,6 +72,6 @@ fun MullvadCircularProgressIndicatorSmall( color, Dimens.circularProgressBarSmallStrokeWidth, trackColor, - StrokeCap.Round + StrokeCap.Round, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/ConnectionStatusText.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/ConnectionStatusText.kt index 0b155953e337..c736b6709e6b 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/ConnectionStatusText.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/ConnectionStatusText.kt @@ -44,7 +44,7 @@ fun ConnectionStatusText(state: TunnelState, modifier: Modifier = Modifier) { is TunnelState.Connecting -> ConnectingText( isQuantumResistant = state.endpoint?.quantumResistant == true, - modifier = modifier + modifier = modifier, ) is TunnelState.Connected -> ConnectedText(isQuantumResistant = state.endpoint.quantumResistant, modifier = modifier) @@ -61,7 +61,7 @@ private fun DisconnectedText(modifier: Modifier) { style = MaterialTheme.typography.connectionStatus, maxLines = 1, overflow = TextOverflow.Ellipsis, - modifier = modifier + modifier = modifier, ) } @@ -78,7 +78,7 @@ private fun ConnectingText(isQuantumResistant: Boolean, modifier: Modifier) { style = MaterialTheme.typography.connectionStatus, maxLines = 1, overflow = TextOverflow.Ellipsis, - modifier = modifier + modifier = modifier, ) } @@ -95,7 +95,7 @@ private fun ConnectedText(isQuantumResistant: Boolean, modifier: Modifier) { style = MaterialTheme.typography.connectionStatus, maxLines = 1, overflow = TextOverflow.Ellipsis, - modifier = modifier + modifier = modifier, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/CopyableObfuscationView.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/CopyableObfuscationView.kt index bbb6f07ddad8..ac0938756ed8 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/CopyableObfuscationView.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/CopyableObfuscationView.kt @@ -27,7 +27,7 @@ private fun PreviewCopyableObfuscationView() { fun CopyableObfuscationView( content: String, onCopyClicked: (String) -> Unit, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, ) { var obfuscationEnabled by remember { mutableStateOf(true) } @@ -35,7 +35,7 @@ fun CopyableObfuscationView( AccountNumberView( accountNumber = content, obfuscateWithPasswordDots = obfuscationEnabled, - modifier = Modifier.weight(1f) + modifier = Modifier.weight(1f), ) AnimatedIconButton( defaultIcon = painterResource(id = R.drawable.icon_hide), @@ -44,7 +44,7 @@ fun CopyableObfuscationView( secondaryIconTint = MaterialTheme.colorScheme.onSurface, isToggleButton = true, contentDescription = stringResource(id = R.string.hide_account_number), - onClick = { obfuscationEnabled = !obfuscationEnabled } + onClick = { obfuscationEnabled = !obfuscationEnabled }, ) CopyAnimatedIconButton(onClick = { onCopyClicked(content) }) @@ -60,6 +60,6 @@ fun CopyAnimatedIconButton(onClick: () -> Unit) { secondaryIconTint = MaterialTheme.colorScheme.tertiary, isToggleButton = false, contentDescription = stringResource(id = R.string.copy_account_number), - onClick = onClick + onClick = onClick, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/FilterChip.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/FilterChip.kt index 9f835944a72e..4761c15c9df5 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/FilterChip.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/FilterChip.kt @@ -23,7 +23,7 @@ private fun PreviewMullvadFilterChip() { AppTheme { MullvadFilterChip( text = stringResource(id = R.string.number_of_providers), - onRemoveClick = {} + onRemoveClick = {}, ) } } @@ -35,7 +35,7 @@ fun MullvadFilterChip( labelColor: Color = MaterialTheme.colorScheme.onPrimary, iconColor: Color = MaterialTheme.colorScheme.onPrimary, text: String, - onRemoveClick: () -> Unit + onRemoveClick: () -> Unit, ) { InputChip( shape = MaterialTheme.shapes.chipShape, @@ -43,13 +43,13 @@ fun MullvadFilterChip( FilterChipDefaults.filterChipColors( containerColor = containerColor, labelColor = labelColor, - iconColor = iconColor + iconColor = iconColor, ), border = FilterChipDefaults.filterChipBorder( borderColor = borderColor, enabled = true, - selected = false + selected = false, ), selected = false, onClick = onRemoveClick, @@ -58,8 +58,8 @@ fun MullvadFilterChip( Icon( painter = painterResource(id = R.drawable.icon_close), contentDescription = null, - modifier = Modifier.size(Dimens.smallIconSize) + modifier = Modifier.size(Dimens.smallIconSize), ) - } + }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/HtmlText.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/HtmlText.kt index 2042c042785b..1aa374598eea 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/HtmlText.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/HtmlText.kt @@ -26,6 +26,6 @@ fun HtmlText( }, update = { it.text = HtmlCompat.fromHtml(htmlFormattedString, HtmlCompat.FROM_HTML_MODE_COMPACT) - } + }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/InformationView.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/InformationView.kt index 9b1070a6f7da..a4f88a862ad3 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/InformationView.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/InformationView.kt @@ -26,7 +26,7 @@ fun InformationView( content: String, modifier: Modifier = Modifier, whenMissing: MissingPolicy = MissingPolicy.SHOW_VIEW, - maxLines: Int = 1 + maxLines: Int = 1, ) { return if (content.isNotEmpty()) { AutoResizeText( @@ -35,7 +35,7 @@ fun InformationView( minTextSize = MaterialTheme.typography.labelMedium.fontSize, maxTextSize = MaterialTheme.typography.titleSmall.fontSize, maxLines = maxLines, - modifier = modifier.padding(vertical = Dimens.smallPadding) + modifier = modifier.padding(vertical = Dimens.smallPadding), ) } else { when (whenMissing) { @@ -46,14 +46,14 @@ fun InformationView( minTextSize = MaterialTheme.typography.labelMedium.fontSize, maxTextSize = MaterialTheme.typography.titleSmall.fontSize, maxLines = maxLines, - modifier = modifier.padding(vertical = Dimens.smallPadding) + modifier = modifier.padding(vertical = Dimens.smallPadding), ) } MissingPolicy.HIDE_VIEW -> {} MissingPolicy.SHOW_SPINNER -> { Row( verticalAlignment = Alignment.CenterVertically, - modifier = modifier.padding(Dimens.smallPadding) + modifier = modifier.padding(Dimens.smallPadding), ) { MullvadCircularProgressIndicatorSmall() } @@ -65,5 +65,5 @@ fun InformationView( enum class MissingPolicy { SHOW_VIEW, HIDE_VIEW, - SHOW_SPINNER + SHOW_SPINNER, } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/LocationInfo.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/LocationInfo.kt index 158e23e15118..f9c0f26862ea 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/LocationInfo.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/LocationInfo.kt @@ -34,7 +34,7 @@ private fun PreviewLocationInfo() { isExpanded = true, location = null, inAddress = null, - outAddress = "" + outAddress = "", ) } } @@ -49,7 +49,7 @@ fun LocationInfo( isExpanded: Boolean, location: GeoIpLocation?, inAddress: Triple?, - outAddress: String + outAddress: String, ) { Column( modifier = @@ -69,7 +69,7 @@ fun LocationInfo( } else { colorCollapsed }, - style = MaterialTheme.typography.labelLarge.copy(fontWeight = FontWeight.SemiBold) + style = MaterialTheme.typography.labelLarge.copy(fontWeight = FontWeight.SemiBold), ) Chevron( isExpanded = isExpanded, @@ -79,7 +79,7 @@ fun LocationInfo( } else { colorCollapsed }, - modifier = Modifier.padding(horizontal = Dimens.chevronMargin) + modifier = Modifier.padding(horizontal = Dimens.chevronMargin), ) } Text( @@ -90,7 +90,7 @@ fun LocationInfo( "" }, color = colorExpanded, - style = MaterialTheme.typography.labelMedium + style = MaterialTheme.typography.labelMedium, ) val textInAddress = inAddress?.let { @@ -105,7 +105,7 @@ fun LocationInfo( text = "${stringResource(id = R.string.in_address)} $textInAddress", color = colorExpanded, style = MaterialTheme.typography.labelMedium, - modifier = Modifier.alpha(if (isExpanded) AlphaVisible else AlphaInvisible) + modifier = Modifier.alpha(if (isExpanded) AlphaVisible else AlphaInvisible), ) Text( text = "${stringResource(id = R.string.out_address)} $outAddress", @@ -115,7 +115,7 @@ fun LocationInfo( Modifier.testTag(LOCATION_INFO_CONNECTION_OUT_TEST_TAG) .alpha( if (isExpanded && outAddress.isNotEmpty()) AlphaVisible else AlphaInvisible - ) + ), ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/LocationsEmptyText.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/LocationsEmptyText.kt index 665fa6f8ab08..347de1654edb 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/LocationsEmptyText.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/LocationsEmptyText.kt @@ -22,10 +22,7 @@ fun LocationsEmptyText(searchTerm: String) { if (searchTerm.length >= MIN_SEARCH_LENGTH) { val firstRow = HtmlCompat.fromHtml( - textResource( - id = R.string.select_location_empty_text_first_row, - searchTerm, - ), + textResource(id = R.string.select_location_empty_text_first_row, searchTerm), HtmlCompat.FROM_HTML_MODE_COMPACT, ) .toAnnotatedString(boldFontWeight = FontWeight.ExtraBold) @@ -54,7 +51,7 @@ fun LocationsEmptyText(searchTerm: String) { text = stringResource(R.string.no_locations_found), modifier = Modifier.padding(Dimens.screenVerticalMargin), style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant + color = MaterialTheme.colorScheme.onSurfaceVariant, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/MullvadCheckbox.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/MullvadCheckbox.kt index e7f9acfcad43..8ff5ae1df121 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/MullvadCheckbox.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/MullvadCheckbox.kt @@ -28,7 +28,7 @@ fun MullvadCheckbox( uncheckedColor: Color = MaterialTheme.colorScheme.onPrimary, checkmarkColor: Color = MaterialTheme.colorScheme.selected, checked: Boolean, - onCheckedChange: (Boolean) -> Unit + onCheckedChange: (Boolean) -> Unit, ) { Checkbox( checked = checked, @@ -37,7 +37,7 @@ fun MullvadCheckbox( CheckboxDefaults.colors( checkedColor = checkedColor, uncheckedColor = uncheckedColor, - checkmarkColor = checkmarkColor - ) + checkmarkColor = checkmarkColor, + ), ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/MullvadExposedDropdownMenuBox.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/MullvadExposedDropdownMenuBox.kt index 58df0815f099..c558c078e1f9 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/MullvadExposedDropdownMenuBox.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/MullvadExposedDropdownMenuBox.kt @@ -31,19 +31,19 @@ fun MullvadExposedDropdownMenuBox( label: String, title: String, colors: TextFieldColors, - content: @Composable ColumnScope.(onClick: () -> Unit) -> Unit + content: @Composable ColumnScope.(onClick: () -> Unit) -> Unit, ) { var expanded by remember { mutableStateOf(false) } ExposedDropdownMenuBox( expanded = expanded, onExpandedChange = { expanded = it }, - modifier = modifier.clickable { expanded = !expanded } + modifier = modifier.clickable { expanded = !expanded }, ) { TextField( modifier = Modifier.fillMaxWidth().menuAnchor(), readOnly = true, value = title, - onValueChange = { /* Do nothing */}, + onValueChange = { /* Do nothing */ }, label = { Text(text = label) }, trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = expanded) }, colors = colors, @@ -51,7 +51,7 @@ fun MullvadExposedDropdownMenuBox( ExposedDropdownMenu( expanded = expanded, onDismissRequest = { expanded = false }, - modifier = Modifier.background(MaterialTheme.colorScheme.primary) + modifier = Modifier.background(MaterialTheme.colorScheme.primary), ) { content { expanded = false } } @@ -62,7 +62,7 @@ fun MullvadExposedDropdownMenuBox( fun MullvadDropdownMenuItem( leadingIcon: @Composable (() -> Unit)? = null, text: String, - onClick: () -> Unit + onClick: () -> Unit, ) { DropdownMenuItem( leadingIcon = leadingIcon, diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/MullvadModalBottomSheet.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/MullvadModalBottomSheet.kt index 9cbd5df5bee0..12768237928d 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/MullvadModalBottomSheet.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/MullvadModalBottomSheet.kt @@ -28,16 +28,11 @@ private fun PreviewMullvadModalBottomSheet() { AppTheme { MullvadModalBottomSheet( sheetContent = { - HeaderCell( - text = "Title", - ) + HeaderCell(text = "Title") HorizontalDivider() - IconCell( - iconId = null, - title = "Select", - ) + IconCell(iconId = null, title = "Select") }, - onDismissRequest = {} + onDismissRequest = {}, ) } } @@ -50,7 +45,7 @@ fun MullvadModalBottomSheet( backgroundColor: Color = MaterialTheme.colorScheme.surfaceContainer, onBackgroundColor: Color = MaterialTheme.colorScheme.onSurface, onDismissRequest: () -> Unit, - sheetContent: @Composable ColumnScope.() -> Unit + sheetContent: @Composable ColumnScope.() -> Unit, ) { // This is to avoid weird colors in the status bar and the navigation bar val paddingValues = BottomSheetDefaults.windowInsets.asPaddingValues() @@ -60,7 +55,7 @@ fun MullvadModalBottomSheet( containerColor = backgroundColor, modifier = modifier, contentWindowInsets = { WindowInsets(0, 0, 0, 0) }, // No insets - dragHandle = { BottomSheetDefaults.DragHandle(color = onBackgroundColor) } + dragHandle = { BottomSheetDefaults.DragHandle(color = onBackgroundColor) }, ) { sheetContent() Spacer(modifier = Modifier.height(Dimens.smallPadding)) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/NavigateButton.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/NavigateButton.kt index c610a0cd8a0b..c9064e1372fd 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/NavigateButton.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/NavigateButton.kt @@ -21,7 +21,7 @@ fun NavigateBackDownIconButton(onNavigateBack: () -> Unit) { Icon( modifier = Modifier.rotate(-90f), painter = painterResource(id = R.drawable.icon_back), - contentDescription = null + contentDescription = null, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/PlayPayment.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/PlayPayment.kt index ac40da001921..87757167a736 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/PlayPayment.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/PlayPayment.kt @@ -42,13 +42,13 @@ private fun PreviewPlayPaymentPaymentAvailable() { PaymentProduct( productId = ProductId("test"), price = ProductPrice("$10"), - status = null + status = null, ) ) ), onPurchaseBillingProductClick = {}, onInfoClick = {}, - modifier = Modifier.padding(Dimens.screenVerticalMargin) + modifier = Modifier.padding(Dimens.screenVerticalMargin), ) } } @@ -63,7 +63,7 @@ private fun PreviewPlayPaymentLoading() { billingPaymentState = PaymentState.Loading, onPurchaseBillingProductClick = {}, onInfoClick = {}, - modifier = Modifier.padding(Dimens.screenVerticalMargin) + modifier = Modifier.padding(Dimens.screenVerticalMargin), ) } } @@ -82,13 +82,13 @@ private fun PreviewPlayPaymentPaymentPending() { PaymentProduct( productId = ProductId("test"), price = ProductPrice("$10"), - status = PaymentStatus.PENDING + status = PaymentStatus.PENDING, ) ) ), onPurchaseBillingProductClick = {}, onInfoClick = {}, - modifier = Modifier.padding(Dimens.screenVerticalMargin) + modifier = Modifier.padding(Dimens.screenVerticalMargin), ) } } @@ -107,13 +107,13 @@ private fun PreviewPlayPaymentVerificationInProgress() { PaymentProduct( productId = ProductId("test"), price = ProductPrice("$10"), - status = PaymentStatus.VERIFICATION_IN_PROGRESS + status = PaymentStatus.VERIFICATION_IN_PROGRESS, ) ) ), onPurchaseBillingProductClick = {}, onInfoClick = {}, - modifier = Modifier.padding(Dimens.screenVerticalMargin) + modifier = Modifier.padding(Dimens.screenVerticalMargin), ) } } @@ -124,7 +124,7 @@ fun PlayPayment( billingPaymentState: PaymentState, onPurchaseBillingProductClick: (ProductId) -> Unit, onInfoClick: () -> Unit, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, ) { when (billingPaymentState) { PaymentState.Loading -> { @@ -155,16 +155,16 @@ fun PlayPayment( style = MaterialTheme.typography.labelLarge, color = MaterialTheme.colorScheme.onSurface, text = statusMessage, - modifier = Modifier.padding(bottom = Dimens.smallPadding) + modifier = Modifier.padding(bottom = Dimens.smallPadding), ) IconButton( onClick = onInfoClick, - modifier = Modifier.testTag(PLAY_PAYMENT_INFO_ICON_TEST_TAG) + modifier = Modifier.testTag(PLAY_PAYMENT_INFO_ICON_TEST_TAG), ) { Icon( painter = painterResource(id = R.drawable.icon_info), contentDescription = null, - tint = MaterialTheme.colorScheme.onSurface + tint = MaterialTheme.colorScheme.onSurface, ) } } @@ -173,7 +173,7 @@ fun PlayPayment( text = stringResource(id = R.string.add_30_days_time_x, product.price.value), onClick = { onPurchaseBillingProductClick(product.productId) }, - isEnabled = product.status == null + isEnabled = product.status == null, ) } } @@ -183,7 +183,7 @@ fun PlayPayment( Column(modifier = modifier) { VariantButton( text = stringResource(id = R.string.add_30_days_time), - onClick = { onPurchaseBillingProductClick(ProductId(ProductIds.OneMonth)) } + onClick = { onPurchaseBillingProductClick(ProductId(ProductIds.OneMonth)) }, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/Scaffolding.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/Scaffolding.kt index 43ceb6943d54..72ee86678b7d 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/Scaffolding.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/Scaffolding.kt @@ -60,10 +60,10 @@ fun ScaffoldWithTopBar( snackbarHost = { SnackbarHost( snackbarHostState, - snackbar = { snackbarData -> MullvadSnackbar(snackbarData = snackbarData) } + snackbar = { snackbarData -> MullvadSnackbar(snackbarData = snackbarData) }, ) }, - content = content + content = content, ) } @@ -91,17 +91,17 @@ fun ScaffoldWithTopBarAndDeviceName( onAccountClicked = onAccountClicked, isIconAndLogoVisible = isIconAndLogoVisible, deviceName = deviceName, - daysLeftUntilExpiry = timeLeft + daysLeftUntilExpiry = timeLeft, ) } }, snackbarHost = { SnackbarHost( snackbarHostState, - snackbar = { snackbarData -> MullvadSnackbar(snackbarData = snackbarData) } + snackbar = { snackbarData -> MullvadSnackbar(snackbarData = snackbarData) }, ) }, - content = content + content = content, ) } @@ -112,7 +112,7 @@ fun MullvadSnackbar(modifier: Modifier = Modifier, snackbarData: SnackbarData) { snackbarData = snackbarData, containerColor = MaterialTheme.colorScheme.surfaceContainer, contentColor = MaterialTheme.colorScheme.onSurface, - actionColor = MaterialTheme.colorScheme.onSurface + actionColor = MaterialTheme.colorScheme.onSurface, ) } @@ -126,7 +126,7 @@ fun ScaffoldWithMediumTopBar( lazyListState: LazyListState = rememberLazyListState(), scrollbarColor: Color = MaterialTheme.colorScheme.onSurface.copy(alpha = AlphaScrollbar), snackbarHostState: SnackbarHostState = remember { SnackbarHostState() }, - content: @Composable (modifier: Modifier, lazyListState: LazyListState) -> Unit + content: @Composable (modifier: Modifier, lazyListState: LazyListState) -> Unit, ) { val appBarState = rememberTopAppBarState() @@ -140,13 +140,13 @@ fun ScaffoldWithMediumTopBar( title = appBarTitle, navigationIcon = navigationIcon, actions, - scrollBehavior = scrollBehavior + scrollBehavior = scrollBehavior, ) }, snackbarHost = { SnackbarHost( snackbarHostState, - snackbar = { snackbarData -> MullvadSnackbar(snackbarData = snackbarData) } + snackbar = { snackbarData -> MullvadSnackbar(snackbarData = snackbarData) }, ) }, content = { @@ -154,9 +154,9 @@ fun ScaffoldWithMediumTopBar( Modifier.fillMaxSize() .padding(it) .drawVerticalScrollbar(state = lazyListState, color = scrollbarColor), - lazyListState + lazyListState, ) - } + }, ) } @@ -169,7 +169,7 @@ fun ScaffoldWithMediumTopBar( actions: @Composable RowScope.() -> Unit = {}, scrollbarColor: Color = MaterialTheme.colorScheme.onSurface.copy(alpha = AlphaScrollbar), snackbarHostState: SnackbarHostState = remember { SnackbarHostState() }, - content: @Composable (modifier: Modifier) -> Unit + content: @Composable (modifier: Modifier) -> Unit, ) { val appBarState = rememberTopAppBarState() val scrollState = rememberScrollState() @@ -183,13 +183,13 @@ fun ScaffoldWithMediumTopBar( title = appBarTitle, navigationIcon = navigationIcon, actions, - scrollBehavior = scrollBehavior + scrollBehavior = scrollBehavior, ) }, snackbarHost = { SnackbarHost( snackbarHostState, - snackbar = { snackbarData -> MullvadSnackbar(snackbarData = snackbarData) } + snackbar = { snackbarData -> MullvadSnackbar(snackbarData = snackbarData) }, ) }, content = { @@ -199,7 +199,7 @@ fun ScaffoldWithMediumTopBar( .drawVerticalScrollbar(state = scrollState, color = scrollbarColor) .verticalScroll(scrollState) ) - } + }, ) } @@ -213,7 +213,7 @@ fun ScaffoldWithLargeTopBarAndButton( onButtonClick: () -> Unit = {}, // Add button buttonTitle: String, scrollbarColor: Color = MaterialTheme.colorScheme.onSurface.copy(alpha = AlphaScrollbar), - content: @Composable (modifier: Modifier) -> Unit + content: @Composable (modifier: Modifier) -> Unit, ) { val appBarState = rememberTopAppBarState() val scrollState = rememberScrollState() @@ -231,7 +231,7 @@ fun ScaffoldWithLargeTopBarAndButton( title = appBarTitle, navigationIcon = navigationIcon, actions, - scrollBehavior = scrollBehavior + scrollBehavior = scrollBehavior, ) }, bottomBar = { @@ -241,12 +241,12 @@ fun ScaffoldWithLargeTopBarAndButton( modifier = Modifier.padding( horizontal = Dimens.sideMargin, - vertical = Dimens.screenVerticalMargin + vertical = Dimens.screenVerticalMargin, ), trailingIcon = { Icon( painter = painterResource(id = R.drawable.icon_extlink), - contentDescription = null + contentDescription = null, ) }, ) @@ -258,7 +258,7 @@ fun ScaffoldWithLargeTopBarAndButton( .drawVerticalScrollbar(state = scrollState, color = scrollbarColor) .verticalScroll(scrollState) ) - } + }, ) } @@ -269,7 +269,7 @@ fun ScaffoldWithSmallTopBar( navigationIcon: @Composable () -> Unit = {}, actions: @Composable RowScope.() -> Unit = {}, snackbarHostState: SnackbarHostState = remember { SnackbarHostState() }, - content: @Composable (modifier: Modifier) -> Unit + content: @Composable (modifier: Modifier) -> Unit, ) { Scaffold( modifier = modifier.fillMaxSize().imePadding(), @@ -277,15 +277,15 @@ fun ScaffoldWithSmallTopBar( MullvadSmallTopBar( title = appBarTitle, navigationIcon = navigationIcon, - actions = actions + actions = actions, ) }, snackbarHost = { SnackbarHost( snackbarHostState, - snackbar = { snackbarData -> MullvadSnackbar(snackbarData = snackbarData) } + snackbar = { snackbarData -> MullvadSnackbar(snackbarData = snackbarData) }, ) }, - content = { content(Modifier.fillMaxSize().padding(it)) } + content = { content(Modifier.fillMaxSize().padding(it)) }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/Scrollbar.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/Scrollbar.kt index 45592710b941..4c2a7ada2ccd 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/Scrollbar.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/Scrollbar.kt @@ -74,20 +74,20 @@ import net.mullvad.mullvadvpn.lib.theme.color.AlphaScrollbar fun Modifier.drawHorizontalScrollbar( state: ScrollState, color: Color, - reverseScrolling: Boolean = false + reverseScrolling: Boolean = false, ): Modifier = drawScrollbar(state, Orientation.Horizontal, color, reverseScrolling) fun Modifier.drawVerticalScrollbar( state: ScrollState, color: Color, - reverseScrolling: Boolean = false + reverseScrolling: Boolean = false, ): Modifier = drawScrollbar(state, Orientation.Vertical, color, reverseScrolling) private fun Modifier.drawScrollbar( state: ScrollState, orientation: Orientation, color: Color, - reverseScrolling: Boolean + reverseScrolling: Boolean, ): Modifier = drawScrollbar(orientation, color, reverseScrolling) { reverseDirection, atEnd, paintColor, alpha -> @@ -103,7 +103,7 @@ private fun Modifier.drawScrollbar( paintColor, alpha, thumbSize, - startOffset + startOffset, ) } } @@ -111,20 +111,20 @@ private fun Modifier.drawScrollbar( fun Modifier.drawHorizontalScrollbar( state: LazyListState, color: Color, - reverseScrolling: Boolean = false + reverseScrolling: Boolean = false, ): Modifier = drawScrollbar(state, Orientation.Horizontal, color, reverseScrolling) fun Modifier.drawVerticalScrollbar( state: LazyListState, color: Color, - reverseScrolling: Boolean = false + reverseScrolling: Boolean = false, ): Modifier = drawScrollbar(state, Orientation.Vertical, color, reverseScrolling) private fun Modifier.drawScrollbar( state: LazyListState, orientation: Orientation, color: Color, - reverseScrolling: Boolean + reverseScrolling: Boolean, ): Modifier = drawScrollbar(orientation, color, reverseScrolling) { reverseDirection, atEnd, paintColor, alpha -> @@ -150,7 +150,7 @@ private fun Modifier.drawScrollbar( paintColor, alpha, thumbSize, - startOffset + startOffset, ) } } @@ -194,7 +194,7 @@ fun Modifier.drawVerticalScrollbar( paintColor, alpha, thumbSize, - startOffset + startOffset, ) } } @@ -206,7 +206,7 @@ private fun DrawScope.drawScrollbar( color: Color, alpha: () -> Float, thumbSize: Float, - startOffset: Float + startOffset: Float, ) { val thicknessPx = Thickness.toPx() val radiusPx = Radius.toPx() @@ -214,12 +214,12 @@ private fun DrawScope.drawScrollbar( if (orientation == Orientation.Horizontal) { Offset( if (reverseDirection) size.width - startOffset - thumbSize else startOffset, - if (atEnd) size.height - thicknessPx else 0f + if (atEnd) size.height - thicknessPx else 0f, ) } else { Offset( if (atEnd) size.width - thicknessPx else 0f, - if (reverseDirection) size.height - startOffset - thumbSize else startOffset + if (reverseDirection) size.height - startOffset - thumbSize else startOffset, ) } val size = @@ -234,7 +234,7 @@ private fun DrawScope.drawScrollbar( topLeft = topLeft, size = size, alpha = alpha(), - cornerRadius = CornerRadius(radiusPx, radiusPx) + cornerRadius = CornerRadius(radiusPx, radiusPx), ) } @@ -244,13 +244,13 @@ private fun Modifier.drawScrollbar( reverseScrolling: Boolean, onDraw: DrawScope.( - reverseDirection: Boolean, atEnd: Boolean, color: Color, alpha: () -> Float - ) -> Unit + reverseDirection: Boolean, atEnd: Boolean, color: Color, alpha: () -> Float, + ) -> Unit, ): Modifier = composed { val scrolled = remember { MutableSharedFlow( extraBufferCapacity = 1, - onBufferOverflow = BufferOverflow.DROP_OLDEST + onBufferOverflow = BufferOverflow.DROP_OLDEST, ) } val nestedScrollConnection = @@ -259,7 +259,7 @@ private fun Modifier.drawScrollbar( override fun onPostScroll( consumed: Offset, available: Offset, - source: NestedScrollSource + source: NestedScrollSource, ): Offset { val delta = if (orientation == Orientation.Horizontal) consumed.x else consumed.y @@ -305,9 +305,9 @@ private fun PreviewScrollbar() { modifier = Modifier.drawVerticalScrollbar( state = state, - color = MaterialTheme.colorScheme.onSurface.copy(alpha = AlphaScrollbar) + color = MaterialTheme.colorScheme.onSurface.copy(alpha = AlphaScrollbar), ) - .verticalScroll(state), + .verticalScroll(state) ) { repeat(50) { Text(text = "Item ${it + 1}", modifier = Modifier.fillMaxWidth().padding(16.dp)) @@ -324,9 +324,9 @@ private fun PreviewLazyListScrollbar() { modifier = Modifier.drawVerticalScrollbar( state = state, - color = MaterialTheme.colorScheme.onSurface.copy(alpha = AlphaScrollbar) + color = MaterialTheme.colorScheme.onSurface.copy(alpha = AlphaScrollbar), ), - state = state + state = state, ) { items(50) { Text(text = "Item ${it + 1}", modifier = Modifier.fillMaxWidth().padding(16.dp)) @@ -342,14 +342,14 @@ private fun PreviewHorizontalScrollbar() { modifier = Modifier.drawHorizontalScrollbar( state = state, - color = MaterialTheme.colorScheme.onSurface.copy(alpha = AlphaScrollbar) + color = MaterialTheme.colorScheme.onSurface.copy(alpha = AlphaScrollbar), ) .horizontalScroll(state) ) { repeat(50) { Text( text = (it + 1).toString(), - modifier = Modifier.padding(horizontal = 8.dp, vertical = 16.dp) + modifier = Modifier.padding(horizontal = 8.dp, vertical = 16.dp), ) } } @@ -363,14 +363,14 @@ private fun PreviewLazyListHorizontalScrollbar() { modifier = Modifier.drawHorizontalScrollbar( state = state, - color = MaterialTheme.colorScheme.onSurface.copy(alpha = AlphaScrollbar) + color = MaterialTheme.colorScheme.onSurface.copy(alpha = AlphaScrollbar), ), - state = state + state = state, ) { items(50) { Text( text = (it + 1).toString(), - modifier = Modifier.padding(horizontal = 8.dp, vertical = 16.dp) + modifier = Modifier.padding(horizontal = 8.dp, vertical = 16.dp), ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/SpacedColumn.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/SpacedColumn.kt index efc39f926828..003605404d2f 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/SpacedColumn.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/SpacedColumn.kt @@ -14,11 +14,11 @@ fun SpacedColumn( modifier: Modifier = Modifier, spacing: Dp = Dimens.listItemDivider, alignment: Alignment.Vertical = Alignment.Bottom, - content: @Composable ColumnScope.() -> Unit + content: @Composable ColumnScope.() -> Unit, ) { Column( modifier = modifier, verticalArrangement = Arrangement.spacedBy(spacing, alignment), - content = content + content = content, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/Switch.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/Switch.kt index c1acac3b31dd..e56db510e7c7 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/Switch.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/Switch.kt @@ -28,7 +28,7 @@ private fun PreviewMullvadSwitch() { Surface(color = MaterialTheme.colorScheme.surface) { Column( verticalArrangement = Arrangement.spacedBy(Dimens.mediumPadding), - modifier = Modifier.padding(Dimens.sideMargin) + modifier = Modifier.padding(Dimens.sideMargin), ) { MullvadSwitch(checked = true, onCheckedChange = null) MullvadSwitch(checked = false, onCheckedChange = null) @@ -59,7 +59,7 @@ fun MullvadSwitch( thumbContent = thumbContent, enabled = enabled, colors = colors, - interactionSource = interactionSource + interactionSource = interactionSource, ) } @@ -79,5 +79,5 @@ fun mullvadSwitchColors(): SwitchColors = disabledUncheckedThumbColor = MaterialTheme.colorScheme.error.copy(alpha = AlphaDisabled), disabledUncheckedTrackColor = Color.Transparent, disabledUncheckedBorderColor = - MaterialTheme.colorScheme.onPrimary.copy(alpha = AlphaDisabled) + MaterialTheme.colorScheme.onPrimary.copy(alpha = AlphaDisabled), ) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/Text.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/Text.kt index 733816672d99..17fdc39ae1ac 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/Text.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/Text.kt @@ -27,7 +27,7 @@ fun AutoResizeText( textSizeStep: TextUnit = DEFAULT_TEXT_STEP, style: TextStyle = LocalTextStyle.current, maxLines: Int = Int.MAX_VALUE, - color: Color = MaterialTheme.colorScheme.onSurface + color: Color = MaterialTheme.colorScheme.onSurface, ) { var adjustedFontSize by remember { mutableFloatStateOf(maxTextSize.value) } var isReadyToDraw by remember { mutableStateOf(false) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/TopBar.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/TopBar.kt index 137e665157e6..d90be57952ef 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/TopBar.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/TopBar.kt @@ -57,7 +57,7 @@ private fun PreviewTopBar() { containerColor = MaterialTheme.colorScheme.tertiary, iconTintColor = MaterialTheme.colorScheme.onTertiary, onSettingsClicked = null, - onAccountClicked = {} + onAccountClicked = {}, ) } } @@ -70,7 +70,7 @@ private fun PreviewSlimTopBar() { containerColor = MaterialTheme.colorScheme.tertiary, iconTintColor = MaterialTheme.colorScheme.onTertiary, onSettingsClicked = null, - onAccountClicked = {} + onAccountClicked = {}, ) } } @@ -98,7 +98,7 @@ private fun PreviewNothingTopBar() { iconTintColor = MaterialTheme.colorScheme.onTertiary, isIconAndLogoVisible = false, onSettingsClicked = null, - onAccountClicked = null + onAccountClicked = null, ) } } @@ -111,7 +111,7 @@ fun MullvadTopBar( modifier: Modifier = Modifier, enabled: Boolean = true, iconTintColor: Color, - isIconAndLogoVisible: Boolean = true + isIconAndLogoVisible: Boolean = true, ) { TopAppBar( modifier = modifier, @@ -122,7 +122,7 @@ fun MullvadTopBar( painter = painterResource(id = R.drawable.logo_icon), contentDescription = null, // No meaningful user info or action. modifier = Modifier.size(40.dp), - tint = Color.Unspecified // Logo should not be tinted + tint = Color.Unspecified, // Logo should not be tinted ) // Dynamically show Mullvad VPN Text if it fits, to avoid overlapping icons. BoxWithConstraints { @@ -146,7 +146,7 @@ fun MullvadTopBar( contentDescription = null, // No meaningful user info or action. modifier = Modifier.padding(horizontal = Dimens.mediumPadding) - .height(logoHeight) + .height(logoHeight), ) } } @@ -158,7 +158,7 @@ fun MullvadTopBar( IconButton( modifier = Modifier.testTag(TOP_BAR_ACCOUNT_BUTTON), enabled = enabled, - onClick = onAccountClicked + onClick = onAccountClicked, ) { Icon( painter = painterResource(R.drawable.icon_account), @@ -172,7 +172,7 @@ fun MullvadTopBar( IconButton( modifier = Modifier.testTag(TOP_BAR_SETTINGS_BUTTON), enabled = enabled, - onClick = onSettingsClicked + onClick = onSettingsClicked, ) { Icon( painter = painterResource(R.drawable.icon_settings), @@ -194,7 +194,7 @@ fun MullvadTopBar( fun MullvadSmallTopBar( title: String, navigationIcon: @Composable () -> Unit = {}, - actions: @Composable RowScope.() -> Unit = {} + actions: @Composable RowScope.() -> Unit = {}, ) { TopAppBar( title = { Text(text = title, maxLines = 1, overflow = TextOverflow.Ellipsis) }, @@ -205,28 +205,20 @@ fun MullvadSmallTopBar( scrolledContainerColor = MaterialTheme.colorScheme.surface, actionIconContentColor = MaterialTheme.colorScheme.onSurface, ), - actions = actions + actions = actions, ) } @Preview @Composable private fun PreviewMediumTopBar() { - AppTheme { - MullvadMediumTopBar( - title = "Title", - ) - } + AppTheme { MullvadMediumTopBar(title = "Title") } } @Preview @Composable private fun PreviewLargeTopBar() { - AppTheme { - MullvadLargeTopBar( - title = "Title", - ) - } + AppTheme { MullvadLargeTopBar(title = "Title") } } @Preview(widthDp = 260) @@ -239,10 +231,10 @@ private fun PreviewSlimMediumTopBar() { IconButton(onClick = {}) { Icon( painter = painterResource(id = R.drawable.icon_settings), - contentDescription = null + contentDescription = null, ) } - } + }, ) } } @@ -252,7 +244,7 @@ fun MullvadMediumTopBar( title: String, navigationIcon: @Composable () -> Unit = {}, actions: @Composable RowScope.() -> Unit = {}, - scrollBehavior: TopAppBarScrollBehavior? = null + scrollBehavior: TopAppBarScrollBehavior? = null, ) { MediumTopAppBar( title = { Text(text = title, maxLines = 1, overflow = TextOverflow.Ellipsis) }, @@ -264,7 +256,7 @@ fun MullvadMediumTopBar( scrolledContainerColor = MaterialTheme.colorScheme.surface, actionIconContentColor = MaterialTheme.colorScheme.onSurface, ), - actions = actions + actions = actions, ) } @@ -274,7 +266,7 @@ fun MullvadLargeTopBar( title: String, navigationIcon: @Composable () -> Unit = {}, actions: @Composable RowScope.() -> Unit = {}, - scrollBehavior: TopAppBarScrollBehavior? = null + scrollBehavior: TopAppBarScrollBehavior? = null, ) { LargeTopAppBar( title = { @@ -282,7 +274,7 @@ fun MullvadLargeTopBar( text = title, maxLines = 2, overflow = TextOverflow.Ellipsis, - style = LocalTextStyle.current.copy(lineBreak = LineBreak.Heading) + style = LocalTextStyle.current.copy(lineBreak = LineBreak.Heading), ) }, navigationIcon = navigationIcon, @@ -293,7 +285,7 @@ fun MullvadLargeTopBar( scrolledContainerColor = MaterialTheme.colorScheme.surface, actionIconContentColor = MaterialTheme.colorScheme.onSurface, ), - actions = actions + actions = actions, ) } @@ -308,7 +300,7 @@ private fun PreviewMullvadTopBarWithLongDeviceName() { onSettingsClicked = null, onAccountClicked = null, deviceName = "Superstitious Hippopotamus with extra weight", - daysLeftUntilExpiry = 1 + daysLeftUntilExpiry = 1, ) } } @@ -325,7 +317,7 @@ private fun PreviewMullvadTopBarWithShortDeviceName() { onSettingsClicked = null, onAccountClicked = null, deviceName = "Fit Ant", - daysLeftUntilExpiry = 1 + daysLeftUntilExpiry = 1, ) } } @@ -339,7 +331,7 @@ fun MullvadTopBarWithDeviceName( iconTintColor: Color, isIconAndLogoVisible: Boolean = true, deviceName: String?, - daysLeftUntilExpiry: Int? + daysLeftUntilExpiry: Int?, ) { Column { MullvadTopBar( @@ -357,7 +349,7 @@ fun MullvadTopBarWithDeviceName( animateColorAsState( targetValue = containerColor, animationSpec = spring(stiffness = Spring.StiffnessMediumLow), - label = "ColorAnimation" + label = "ColorAnimation", ) Row( modifier = @@ -365,11 +357,11 @@ fun MullvadTopBarWithDeviceName( .padding( bottom = Dimens.smallPadding, start = Dimens.mediumPadding, - end = Dimens.mediumPadding + end = Dimens.mediumPadding, ) .fillMaxWidth() .animateContentSize(), - horizontalArrangement = Arrangement.spacedBy(Dimens.mediumPadding) + horizontalArrangement = Arrangement.spacedBy(Dimens.mediumPadding), ) { Text( modifier = Modifier.weight(1f, fill = false), @@ -380,7 +372,7 @@ fun MullvadTopBarWithDeviceName( maxLines = 1, overflow = TextOverflow.Ellipsis, style = MaterialTheme.typography.bodySmall, - color = iconTintColor + color = iconTintColor, ) if (daysLeftUntilExpiry != null) { Text( @@ -391,14 +383,14 @@ fun MullvadTopBarWithDeviceName( pluralStringResource( id = R.plurals.days, daysLeftUntilExpiry, - daysLeftUntilExpiry + daysLeftUntilExpiry, ) } else { stringResource(id = R.string.out_of_time) - } + }, ), style = MaterialTheme.typography.bodySmall, - color = iconTintColor + color = iconTintColor, ) } else { Spacer(Modifier) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationBanner.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationBanner.kt index 7630795e028e..bdce4abef60c 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationBanner.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationBanner.kt @@ -43,20 +43,18 @@ import org.joda.time.DateTime @Composable private fun PreviewNotificationBanner() { AppTheme { - Column( - Modifier.background(color = MaterialTheme.colorScheme.surface), - ) { + Column(Modifier.background(color = MaterialTheme.colorScheme.surface)) { val bannerDataList = listOf( InAppNotification.UnsupportedVersion( - versionInfo = VersionInfo(currentVersion = "1.0", isSupported = false), + versionInfo = VersionInfo(currentVersion = "1.0", isSupported = false) ), InAppNotification.AccountExpiry(expiry = DateTime.now()), InAppNotification.TunnelStateBlocked, InAppNotification.NewDevice("Courageous Turtle"), InAppNotification.TunnelStateError( error = ErrorState(ErrorStateCause.FirewallPolicyError.Generic, true) - ) + ), ) .map { it.toNotificationData(false, {}, {}, {}) } @@ -65,7 +63,7 @@ private fun PreviewNotificationBanner() { containerColor = MaterialTheme.colorScheme.primary, onSettingsClicked = {}, onAccountClicked = {}, - iconTintColor = MaterialTheme.colorScheme.primary + iconTintColor = MaterialTheme.colorScheme.primary, ) Notification(it) Spacer(modifier = Modifier.size(16.dp)) @@ -81,7 +79,7 @@ fun NotificationBanner( isPlayBuild: Boolean, onClickUpdateVersion: () -> Unit, onClickShowAccount: () -> Unit, - onClickDismissNewDevice: () -> Unit + onClickDismissNewDevice: () -> Unit, ) { // Fix for animating to invisible state val previous = rememberPrevious(current = notification, shouldUpdate = { _, _ -> true }) @@ -89,7 +87,7 @@ fun NotificationBanner( visible = notification != null, enter = slideInVertically(initialOffsetY = { -it }), exit = slideOutVertically(targetOffsetY = { -it }), - modifier = modifier + modifier = modifier, ) { val visibleNotification = notification ?: previous if (visibleNotification != null) @@ -98,7 +96,7 @@ fun NotificationBanner( isPlayBuild = isPlayBuild, onClickUpdateVersion, onClickShowAccount, - onClickDismissNewDevice + onClickDismissNewDevice, ) ) } @@ -115,7 +113,7 @@ private fun Notification(notificationBannerData: NotificationData) { start = Dimens.notificationBannerStartPadding, end = Dimens.notificationBannerEndPadding, top = Dimens.smallPadding, - bottom = Dimens.smallPadding + bottom = Dimens.smallPadding, ) .animateContentSize() .testTag(NOTIFICATION_BANNER) @@ -130,7 +128,7 @@ private fun Notification(notificationBannerData: NotificationData) { StatusLevel.Warning -> MaterialTheme.colorScheme.warning StatusLevel.Info -> MaterialTheme.colorScheme.surfaceContainer }, - shape = CircleShape + shape = CircleShape, ) .size(Dimens.notificationStatusIconSize) .constrainAs(status) { @@ -153,7 +151,7 @@ private fun Notification(notificationBannerData: NotificationData) { style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurface, maxLines = 1, - overflow = TextOverflow.Ellipsis + overflow = TextOverflow.Ellipsis, ) message?.let { Text( @@ -172,7 +170,7 @@ private fun Notification(notificationBannerData: NotificationData) { } .padding(start = Dimens.smallPadding), color = MaterialTheme.colorScheme.onSurfaceVariant, - style = MaterialTheme.typography.labelMedium + style = MaterialTheme.typography.labelMedium, ) } action?.let { @@ -185,12 +183,12 @@ private fun Notification(notificationBannerData: NotificationData) { } .testTag(NOTIFICATION_BANNER_ACTION) .padding(all = Dimens.notificationEndIconPadding), - onClick = it.onClick + onClick = it.onClick, ) { Icon( painter = painterResource(id = it.icon), contentDescription = null, - tint = MaterialTheme.colorScheme.onSurface + tint = MaterialTheme.colorScheme.onSurface, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationData.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationData.kt index b55b8ab0704f..bffd7d7560bc 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationData.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/notificationbanner/NotificationData.kt @@ -21,27 +21,24 @@ data class NotificationData( val title: String, val message: AnnotatedString? = null, val statusLevel: StatusLevel, - val action: NotificationAction? = null + val action: NotificationAction? = null, ) { constructor( title: String, message: String?, statusLevel: StatusLevel, - action: NotificationAction? + action: NotificationAction?, ) : this(title, message?.let { AnnotatedString(it) }, statusLevel, action) } -data class NotificationAction( - @DrawableRes val icon: Int, - val onClick: (() -> Unit), -) +data class NotificationAction(@DrawableRes val icon: Int, val onClick: (() -> Unit)) @Composable fun InAppNotification.toNotificationData( isPlayBuild: Boolean, onClickUpdateVersion: () -> Unit, onClickShowAccount: () -> Unit, - onDismissNewDevice: () -> Unit + onDismissNewDevice: () -> Unit, ) = when (this) { is InAppNotification.NewDevice -> @@ -51,19 +48,19 @@ fun InAppNotification.toNotificationData( HtmlCompat.fromHtml( stringResource( id = R.string.new_device_notification_message, - deviceName + deviceName, ), - HtmlCompat.FROM_HTML_MODE_COMPACT + HtmlCompat.FROM_HTML_MODE_COMPACT, ) .toAnnotatedString( boldSpanStyle = SpanStyle( color = MaterialTheme.colorScheme.onSurface, - fontWeight = FontWeight.ExtraBold - ), + fontWeight = FontWeight.ExtraBold, + ) ), statusLevel = StatusLevel.Info, - action = NotificationAction(R.drawable.icon_close, onDismissNewDevice) + action = NotificationAction(R.drawable.icon_close, onDismissNewDevice), ) is InAppNotification.AccountExpiry -> NotificationData( @@ -72,16 +69,12 @@ fun InAppNotification.toNotificationData( statusLevel = StatusLevel.Error, action = if (isPlayBuild) null - else - NotificationAction( - R.drawable.icon_extlink, - onClickShowAccount, - ), + else NotificationAction(R.drawable.icon_extlink, onClickShowAccount), ) InAppNotification.TunnelStateBlocked -> NotificationData( title = stringResource(id = R.string.blocking_internet), - statusLevel = StatusLevel.Error + statusLevel = StatusLevel.Error, ) is InAppNotification.TunnelStateError -> errorMessageBannerData(error) is InAppNotification.UnsupportedVersion -> @@ -91,7 +84,7 @@ fun InAppNotification.toNotificationData( statusLevel = StatusLevel.Error, action = if (isPlayBuild) null - else NotificationAction(R.drawable.icon_extlink, onClickUpdateVersion) + else NotificationAction(R.drawable.icon_extlink, onClickUpdateVersion), ) } @@ -104,16 +97,16 @@ private fun errorMessageBannerData(error: ErrorState) = HtmlCompat.fromHtml( optionalMessageArgument?.let { stringResource(id = messageResourceId, it) } ?: stringResource(id = messageResourceId), - HtmlCompat.FROM_HTML_MODE_COMPACT + HtmlCompat.FROM_HTML_MODE_COMPACT, ) .toAnnotatedString( boldSpanStyle = SpanStyle( color = MaterialTheme.colorScheme.onSurface, - fontWeight = FontWeight.ExtraBold + fontWeight = FontWeight.ExtraBold, ) ), statusLevel = StatusLevel.Error, - action = null + action = null, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ApiAccessMethodInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ApiAccessMethodInfoDialog.kt index db0f6a2ca18b..95d430497659 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ApiAccessMethodInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ApiAccessMethodInfoDialog.kt @@ -32,6 +32,6 @@ fun ApiAccessMethodInfo(navigator: DestinationsNavigator) { appendLine() appendLine(textResource(id = R.string.api_access_method_info_fourth_line)) }, - onDismiss = navigator::navigateUp + onDismiss = navigator::navigateUp, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ChangelogDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ChangelogDialog.kt index 6e68e2f8c1e5..d2e96dc1d910 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ChangelogDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ChangelogDialog.kt @@ -38,7 +38,7 @@ fun Changelog(navController: NavController, changeLog: Changelog) { onDismiss = { viewModel.markChangelogAsRead() navController.navigateUp() - } + }, ) } @@ -52,7 +52,7 @@ fun ChangelogDialog(changeLog: Changelog, onDismiss: () -> Unit) { style = MaterialTheme.typography.headlineLarge, color = MaterialTheme.colorScheme.onSurface, textAlign = TextAlign.Center, - modifier = Modifier.fillMaxWidth() + modifier = Modifier.fillMaxWidth(), ) }, text = { @@ -65,7 +65,7 @@ fun ChangelogDialog(changeLog: Changelog, onDismiss: () -> Unit) { text = stringResource(R.string.changes_dialog_subtitle), style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.onSurface, - modifier = Modifier.fillMaxWidth() + modifier = Modifier.fillMaxWidth(), ) changeLog.changes.forEach { changeItem -> ChangeListItem(text = changeItem) } @@ -75,7 +75,7 @@ fun ChangelogDialog(changeLog: Changelog, onDismiss: () -> Unit) { PrimaryButton(text = stringResource(R.string.got_it), onClick = onDismiss) }, containerColor = MaterialTheme.colorScheme.surface, - titleContentColor = MaterialTheme.colorScheme.onSurface + titleContentColor = MaterialTheme.colorScheme.onSurface, ) } @@ -88,12 +88,12 @@ private fun ChangeListItem(text: String) { style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurface, modifier = Modifier.width(Dimens.buttonSpacing), - textAlign = TextAlign.Center + textAlign = TextAlign.Center, ) Text( text = text, style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onSurface + color = MaterialTheme.colorScheme.onSurface, ) } } @@ -118,7 +118,7 @@ private fun PreviewChangelogDialogWithTwoLongItems() { AppTheme { ChangelogDialog( Changelog(changes = listOf(longPreviewText, longPreviewText), version = "1111.1"), - onDismiss = {} + onDismiss = {}, ) } } @@ -140,11 +140,11 @@ private fun PreviewChangelogDialogWithTenShortItems() { "Item 7", "Item 8", "Item 9", - "Item 10" + "Item 10", ), - version = "1111.1" + version = "1111.1", ), - onDismiss = {} + onDismiss = {}, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ContentBlockersInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ContentBlockersInfoDialog.kt index bde7cfa73cbc..88d125f20e32 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ContentBlockersInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ContentBlockersInfoDialog.kt @@ -26,6 +26,6 @@ fun ContentBlockersInfo(navigator: DestinationsNavigator) { stringResource(id = R.string.settings_changes_effect_warning_content_blocker) ) }, - onDismiss = dropUnlessResumed { navigator.navigateUp() } + onDismiss = dropUnlessResumed { navigator.navigateUp() }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/CreateCustomListDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/CreateCustomListDialog.kt index 3cb01482e7a4..0334b0b14dd5 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/CreateCustomListDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/CreateCustomListDialog.kt @@ -59,7 +59,7 @@ data class CreateCustomListNavArgs(val locationCode: GeoLocationId?) @Composable @Destination( style = DestinationStyle.Dialog::class, - navArgs = CreateCustomListNavArgs::class + navArgs = CreateCustomListNavArgs::class, ) fun CreateCustomList( navigator: DestinationsNavigator, @@ -73,7 +73,7 @@ fun CreateCustomList( navigator.navigate( CustomListLocationsDestination( customListId = sideEffect.customListId, - newList = true + newList = true, ) ) { launchSingleTop = true @@ -90,7 +90,7 @@ fun CreateCustomList( state = state, createCustomList = vm::createCustomList, onInputChanged = vm::clearError, - onDismiss = dropUnlessResumed { backNavigator.navigateBack() } + onDismiss = dropUnlessResumed { backNavigator.navigateBack() }, ) } @@ -99,18 +99,14 @@ fun CreateCustomListDialog( state: CreateCustomListUiState, createCustomList: (String) -> Unit = {}, onInputChanged: () -> Unit = {}, - onDismiss: () -> Unit = {} + onDismiss: () -> Unit = {}, ) { val name = remember { mutableStateOf("") } val isValidName by remember { derivedStateOf { name.value.isNotBlank() } } AlertDialog( - title = { - Text( - text = stringResource(id = R.string.create_new_list), - ) - }, + title = { Text(text = stringResource(id = R.string.create_new_list)) }, text = { CustomListNameTextField( name = name.value, @@ -121,7 +117,7 @@ fun CreateCustomListDialog( name.value = it onInputChanged() }, - modifier = Modifier.testTag(CREATE_CUSTOM_LIST_DIALOG_INPUT_TEST_TAG) + modifier = Modifier.testTag(CREATE_CUSTOM_LIST_DIALOG_INPUT_TEST_TAG), ) }, containerColor = MaterialTheme.colorScheme.surface, @@ -131,12 +127,12 @@ fun CreateCustomListDialog( PrimaryButton( text = stringResource(id = R.string.create), onClick = { createCustomList(name.value) }, - isEnabled = isValidName + isEnabled = isValidName, ) }, dismissButton = { PrimaryButton(text = stringResource(id = R.string.cancel), onClick = onDismiss) - } + }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/CustomDnsInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/CustomDnsInfoDialog.kt index 7aa1f00c793d..a464b1fbb1b2 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/CustomDnsInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/CustomDnsInfoDialog.kt @@ -22,6 +22,6 @@ private fun PreviewCustomDnsInfoDialog() { fun CustomDnsInfo(navigator: DestinationsNavigator) { InfoDialog( message = stringResource(id = R.string.settings_changes_effect_warning_content_blocker), - onDismiss = dropUnlessResumed { navigator.navigateUp() } + onDismiss = dropUnlessResumed { navigator.navigateUp() }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeleteApiAccessMethodConfirmationDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeleteApiAccessMethodConfirmationDialog.kt index 6472f7d1b2b1..e6605ac5da2e 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeleteApiAccessMethodConfirmationDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeleteApiAccessMethodConfirmationDialog.kt @@ -28,11 +28,9 @@ data class DeleteApiAccessMethodNavArgs(val apiAccessMethodId: ApiAccessMethodId @Composable @Destination( style = DestinationStyle.Dialog::class, - navArgs = DeleteApiAccessMethodNavArgs::class + navArgs = DeleteApiAccessMethodNavArgs::class, ) -fun DeleteApiAccessMethodConfirmation( - navigator: ResultBackNavigator, -) { +fun DeleteApiAccessMethodConfirmation(navigator: ResultBackNavigator) { val viewModel = koinViewModel() val state = viewModel.uiState.collectAsStateWithLifecycle() @@ -46,7 +44,7 @@ fun DeleteApiAccessMethodConfirmation( DeleteApiAccessMethodConfirmationDialog( state = state.value, onDelete = viewModel::deleteApiAccessMethod, - onBack = navigator::navigateBack + onBack = navigator::navigateBack, ) } @@ -54,20 +52,17 @@ fun DeleteApiAccessMethodConfirmation( fun DeleteApiAccessMethodConfirmationDialog( state: DeleteApiAccessMethodUiState, onDelete: () -> Unit = {}, - onBack: () -> Unit = {} + onBack: () -> Unit = {}, ) { DeleteConfirmationDialog( onDelete = onDelete, onBack = onBack, - message = - stringResource( - id = R.string.delete_method_question, - ), + message = stringResource(id = R.string.delete_method_question), errorMessage = if (state.deleteError != null) { stringResource(id = R.string.error_occurred) } else { null - } + }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeleteConfirmationDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeleteConfirmationDialog.kt index f040bc69b65e..e2cb6c1072ea 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeleteConfirmationDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeleteConfirmationDialog.kt @@ -26,10 +26,7 @@ import net.mullvad.mullvadvpn.lib.theme.Dimens @Composable private fun PreviewDeleteConfirmationDialog() { AppTheme { - DeleteConfirmationDialog( - message = "Do you want to delete Cookie?", - errorMessage = null, - ) + DeleteConfirmationDialog(message = "Do you want to delete Cookie?", errorMessage = null) } } @@ -39,7 +36,7 @@ private fun PreviewDeleteConfirmationDialogError() { AppTheme { DeleteConfirmationDialog( message = "Do you want to delete Cookie?", - errorMessage = "An error occured" + errorMessage = "An error occured", ) } } @@ -49,7 +46,7 @@ fun DeleteConfirmationDialog( message: String, errorMessage: String?, onDelete: () -> Unit = {}, - onBack: () -> Unit = {} + onBack: () -> Unit = {}, ) { AlertDialog( onDismissRequest = onBack, @@ -58,7 +55,7 @@ fun DeleteConfirmationDialog( modifier = Modifier.fillMaxWidth().height(Dimens.dialogIconHeight), painter = painterResource(id = R.drawable.icon_alert), contentDescription = stringResource(id = R.string.remove_button), - tint = MaterialTheme.colorScheme.error + tint = MaterialTheme.colorScheme.error, ) }, title = { @@ -69,7 +66,7 @@ fun DeleteConfirmationDialog( text = errorMessage, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.error, - modifier = Modifier.padding(top = Dimens.smallPadding) + modifier = Modifier.padding(top = Dimens.smallPadding), ) } } @@ -78,12 +75,12 @@ fun DeleteConfirmationDialog( PrimaryButton( modifier = Modifier.focusRequester(FocusRequester()), onClick = onBack, - text = stringResource(id = R.string.cancel) + text = stringResource(id = R.string.cancel), ) }, confirmButton = { NegativeButton(onClick = onDelete, text = stringResource(id = R.string.delete)) }, - containerColor = MaterialTheme.colorScheme.surface + containerColor = MaterialTheme.colorScheme.surface, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeleteCustomListConfirmationDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeleteCustomListConfirmationDialog.kt index bf0cd4927785..d89c04fab714 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeleteCustomListConfirmationDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeleteCustomListConfirmationDialog.kt @@ -36,11 +36,9 @@ data class DeleteCustomListNavArgs(val customListId: CustomListId, val name: Cus @Composable @Destination( style = DestinationStyle.Dialog::class, - navArgs = DeleteCustomListNavArgs::class + navArgs = DeleteCustomListNavArgs::class, ) -fun DeleteCustomList( - navigator: ResultBackNavigator, -) { +fun DeleteCustomList(navigator: ResultBackNavigator) { val viewModel: DeleteCustomListConfirmationViewModel = koinViewModel() val state by viewModel.uiState.collectAsStateWithLifecycle() @@ -54,7 +52,7 @@ fun DeleteCustomList( DeleteCustomListConfirmationDialog( state = state, onDelete = viewModel::deleteCustomList, - onBack = dropUnlessResumed { navigator.navigateBack() } + onBack = dropUnlessResumed { navigator.navigateBack() }, ) } @@ -62,7 +60,7 @@ fun DeleteCustomList( fun DeleteCustomListConfirmationDialog( state: DeleteCustomListUiState, onDelete: () -> Unit = {}, - onBack: () -> Unit = {} + onBack: () -> Unit = {}, ) { DeleteConfirmationDialog( onDelete = onDelete, @@ -70,13 +68,13 @@ fun DeleteCustomListConfirmationDialog( message = stringResource( id = R.string.delete_custom_list_confirmation_description, - state.name.value + state.name.value, ), errorMessage = if (state.deleteError != null) { stringResource(id = R.string.error_occurred) } else { null - } + }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeviceNameInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeviceNameInfoDialog.kt index f0b0923a3f19..728913d7c13b 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeviceNameInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeviceNameInfoDialog.kt @@ -21,6 +21,6 @@ fun DeviceNameInfo(navigator: DestinationsNavigator) { appendLine() append(stringResource(id = R.string.device_name_info_third_paragraph)) }, - onDismiss = dropUnlessResumed { navigator.navigateUp() } + onDismiss = dropUnlessResumed { navigator.navigateUp() }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DiscardChangesDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DiscardChangesDialog.kt index 403ba43b2424..76b4c20e743b 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DiscardChangesDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DiscardChangesDialog.kt @@ -26,15 +26,15 @@ fun DiscardChanges(resultBackNavigator: ResultBackNavigator) { PrimaryButton( modifier = Modifier.focusRequester(FocusRequester()), onClick = dropUnlessResumed { resultBackNavigator.navigateBack() }, - text = stringResource(id = R.string.cancel) + text = stringResource(id = R.string.cancel), ) }, confirmButton = { PrimaryButton( onClick = dropUnlessResumed { resultBackNavigator.navigateBack(result = true) }, - text = stringResource(id = R.string.discard) + text = stringResource(id = R.string.discard), ) }, - containerColor = MaterialTheme.colorScheme.surface + containerColor = MaterialTheme.colorScheme.surface, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialog.kt index 26b08dbcdade..242236e619c1 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialog.kt @@ -50,16 +50,11 @@ private fun PreviewDnsDialogEditAllowLanDisabled() { AppTheme { DnsDialog(DnsDialogViewState("192.168.1.1", null, true, false, 0), {}, {}, {}, {}) } } -data class DnsDialogNavArgs( - val index: Int? = null, - val initialValue: String? = null, -) +data class DnsDialogNavArgs(val index: Int? = null, val initialValue: String? = null) @Destination(style = DestinationStyle.Dialog::class, navArgs = DnsDialogNavArgs::class) @Composable -fun Dns( - resultNavigator: ResultBackNavigator, -) { +fun Dns(resultNavigator: ResultBackNavigator) { val viewModel = koinViewModel() LaunchedEffectCollect(viewModel.uiSideEffect) { @@ -78,7 +73,7 @@ fun Dns( onSaveDnsClick = viewModel::onSaveDnsClick, onRemoveDnsClick = viewModel::onRemoveDnsClick, onDismiss = - dropUnlessResumed { resultNavigator.navigateBack(result = DnsDialogResult.Cancel) } + dropUnlessResumed { resultNavigator.navigateBack(result = DnsDialogResult.Cancel) }, ) } @@ -88,7 +83,7 @@ fun DnsDialog( onDnsInputChange: (String) -> Unit, onSaveDnsClick: () -> Unit, onRemoveDnsClick: (Int) -> Unit, - onDismiss: () -> Unit + onDismiss: () -> Unit, ) { AlertDialog( title = { @@ -111,7 +106,7 @@ fun DnsDialog( onSubmit = onSaveDnsClick, isEnabled = true, placeholderText = stringResource(R.string.custom_dns_hint), - modifier = Modifier.fillMaxWidth() + modifier = Modifier.fillMaxWidth(), ) val errorMessage = @@ -132,7 +127,7 @@ fun DnsDialog( text = errorMessage, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.error, - modifier = Modifier.padding(top = Dimens.smallPadding) + modifier = Modifier.padding(top = Dimens.smallPadding), ) } } @@ -150,14 +145,14 @@ fun DnsDialog( NegativeButton( modifier = Modifier.fillMaxWidth(), onClick = { onRemoveDnsClick(state.index) }, - text = stringResource(id = R.string.remove_button) + text = stringResource(id = R.string.remove_button), ) } PrimaryButton( modifier = Modifier.fillMaxWidth(), onClick = onDismiss, - text = stringResource(id = R.string.cancel) + text = stringResource(id = R.string.cancel), ) } }, diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/EditCustomListNameDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/EditCustomListNameDialog.kt index 919db9a17744..5fbcb831a92a 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/EditCustomListNameDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/EditCustomListNameDialog.kt @@ -41,16 +41,16 @@ private fun PreviewEditCustomListNameDialog() { data class EditCustomListNameNavArgs( val customListId: CustomListId, - val initialName: CustomListName + val initialName: CustomListName, ) @Composable @Destination( style = DestinationStyle.Dialog::class, - navArgs = EditCustomListNameNavArgs::class + navArgs = EditCustomListNameNavArgs::class, ) fun EditCustomListName( - backNavigator: ResultBackNavigator, + backNavigator: ResultBackNavigator ) { val vm: EditCustomListNameDialogViewModel = koinViewModel() LaunchedEffectCollect(vm.uiSideEffect) { sideEffect -> @@ -66,7 +66,7 @@ fun EditCustomListName( state = state, updateName = vm::updateCustomListName, onInputChanged = vm::onNameChanged, - onDismiss = dropUnlessResumed { backNavigator.navigateBack() } + onDismiss = dropUnlessResumed { backNavigator.navigateBack() }, ) } @@ -75,14 +75,10 @@ fun EditCustomListNameDialog( state: EditCustomListNameUiState, updateName: (String) -> Unit = {}, onInputChanged: (String) -> Unit = {}, - onDismiss: () -> Unit = {} + onDismiss: () -> Unit = {}, ) { AlertDialog( - title = { - Text( - text = stringResource(id = R.string.update_list_name), - ) - }, + title = { Text(text = stringResource(id = R.string.update_list_name)) }, text = { CustomListNameTextField( name = state.name, @@ -90,7 +86,7 @@ fun EditCustomListNameDialog( error = state.error?.errorString(), onSubmit = updateName, onValueChanged = onInputChanged, - modifier = Modifier.testTag(EDIT_CUSTOM_LIST_DIALOG_INPUT_TEST_TAG) + modifier = Modifier.testTag(EDIT_CUSTOM_LIST_DIALOG_INPUT_TEST_TAG), ) }, containerColor = MaterialTheme.colorScheme.surface, @@ -100,12 +96,12 @@ fun EditCustomListNameDialog( PrimaryButton( text = stringResource(id = R.string.save), onClick = { updateName(state.name) }, - isEnabled = state.isValidName + isEnabled = state.isValidName, ) }, dismissButton = { PrimaryButton(text = stringResource(id = R.string.cancel), onClick = onDismiss) - } + }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/InfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/InfoDialog.kt index 0ea85eb06bb6..0b0632f1d777 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/InfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/InfoDialog.kt @@ -50,7 +50,7 @@ fun InfoDialog(message: String, additionalInfo: String? = null, onDismiss: () -> modifier = Modifier.fillMaxWidth().height(Dimens.dialogIconHeight), painter = painterResource(id = R.drawable.icon_info), contentDescription = "", - tint = MaterialTheme.colorScheme.onSurface + tint = MaterialTheme.colorScheme.onSurface, ) }, text = { @@ -58,7 +58,7 @@ fun InfoDialog(message: String, additionalInfo: String? = null, onDismiss: () -> Column( Modifier.drawVerticalScrollbar( scrollState, - MaterialTheme.colorScheme.onPrimary.copy(alpha = AlphaScrollbar) + MaterialTheme.colorScheme.onPrimary.copy(alpha = AlphaScrollbar), ) .verticalScroll(scrollState), horizontalAlignment = Alignment.CenterHorizontally, @@ -67,7 +67,7 @@ fun InfoDialog(message: String, additionalInfo: String? = null, onDismiss: () -> text = message, color = MaterialTheme.colorScheme.onSurface, style = MaterialTheme.typography.bodySmall, - modifier = Modifier.fillMaxWidth() + modifier = Modifier.fillMaxWidth(), ) if (additionalInfo != null) { Spacer(modifier = Modifier.height(Dimens.verticalSpace)) @@ -80,7 +80,7 @@ fun InfoDialog(message: String, additionalInfo: String? = null, onDismiss: () -> text = trimmed, color = MaterialTheme.colorScheme.onSurface, style = MaterialTheme.typography.bodySmall, - modifier = Modifier.fillMaxWidth() + modifier = Modifier.fillMaxWidth(), ) } } @@ -92,11 +92,7 @@ fun InfoDialog(message: String, additionalInfo: String? = null, onDismiss: () -> onClick = onDismiss, ) }, - properties = - DialogProperties( - dismissOnClickOutside = true, - dismissOnBackPress = true, - ), - containerColor = MaterialTheme.colorScheme.surface + properties = DialogProperties(dismissOnClickOutside = true, dismissOnBackPress = true), + containerColor = MaterialTheme.colorScheme.surface, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/LocalNetworkSharingInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/LocalNetworkSharingInfoDialog.kt index 6c6feebc9acd..830bdf393ff7 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/LocalNetworkSharingInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/LocalNetworkSharingInfoDialog.kt @@ -29,6 +29,6 @@ fun LocalNetworkSharingInfo(navigator: DestinationsNavigator) { appendLine(stringResource(id = R.string.local_network_sharing_additional_info)) appendLine(textResource(id = R.string.local_network_sharing_ip_ranges)) }, - onDismiss = dropUnlessResumed { navigator.navigateUp() } + onDismiss = dropUnlessResumed { navigator.navigateUp() }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/MalwareInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/MalwareInfoDialog.kt index ef905ab9f28e..c5b52240f19c 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/MalwareInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/MalwareInfoDialog.kt @@ -23,6 +23,6 @@ private fun PreviewMalwareInfoDialog() { fun MalwareInfo(navigator: DestinationsNavigator) { InfoDialog( message = stringResource(id = R.string.malware_info), - onDismiss = dropUnlessResumed { navigator.navigateUp() } + onDismiss = dropUnlessResumed { navigator.navigateUp() }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/MtuDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/MtuDialog.kt index 1a6ed21212ba..d97cfde97295 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/MtuDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/MtuDialog.kt @@ -59,7 +59,7 @@ fun Mtu(navigator: ResultBackNavigator) { onInputChanged = viewModel::onInputChanged, onSaveMtu = viewModel::onSaveClick, onResetMtu = viewModel::onRestoreClick, - onDismiss = dropUnlessResumed { navigator.navigateBack() } + onDismiss = dropUnlessResumed { navigator.navigateBack() }, ) } @@ -89,7 +89,7 @@ fun MtuDialog( placeholderText = stringResource(R.string.enter_value_placeholder), maxCharLength = 4, isValidValue = state.isValidInput, - modifier = Modifier.fillMaxWidth() + modifier = Modifier.fillMaxWidth(), ) Text( @@ -97,11 +97,11 @@ fun MtuDialog( stringResource( id = R.string.wireguard_mtu_footer, MTU_MIN_VALUE, - MTU_MAX_VALUE + MTU_MAX_VALUE, ), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant, - modifier = Modifier.padding(top = Dimens.smallPadding) + modifier = Modifier.padding(top = Dimens.smallPadding), ) } }, @@ -111,21 +111,21 @@ fun MtuDialog( modifier = Modifier.fillMaxWidth(), isEnabled = state.isValidInput, text = stringResource(R.string.submit_button), - onClick = { onSaveMtu(state.mtuInput) } + onClick = { onSaveMtu(state.mtuInput) }, ) if (state.showResetToDefault) { NegativeButton( modifier = Modifier.fillMaxWidth(), text = stringResource(R.string.reset_to_default_button), - onClick = onResetMtu + onClick = onResetMtu, ) } PrimaryButton( modifier = Modifier.fillMaxWidth(), text = stringResource(R.string.cancel), - onClick = onDismiss + onClick = onDismiss, ) } }, diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ObfuscationInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ObfuscationInfoDialog.kt index e6096ca00d6f..aa7dd334ff11 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ObfuscationInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ObfuscationInfoDialog.kt @@ -22,6 +22,6 @@ private fun PreviewObfuscationInfoDialog() { fun ObfuscationInfo(navigator: DestinationsNavigator) { InfoDialog( message = stringResource(id = R.string.obfuscation_info), - onDismiss = dropUnlessResumed { navigator.navigateUp() } + onDismiss = dropUnlessResumed { navigator.navigateUp() }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/QuantumResistanceInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/QuantumResistanceInfoDialog.kt index 91ce85dbd326..1d9a39753264 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/QuantumResistanceInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/QuantumResistanceInfoDialog.kt @@ -23,6 +23,6 @@ fun QuantumResistanceInfo(navigator: DestinationsNavigator) { InfoDialog( message = stringResource(id = R.string.quantum_resistant_info_first_paragaph), additionalInfo = stringResource(id = R.string.quantum_resistant_info_second_paragaph), - onDismiss = dropUnlessResumed { navigator.navigateUp() } + onDismiss = dropUnlessResumed { navigator.navigateUp() }, ) } 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 6d3d134e1ddf..3d49a7afcac9 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 @@ -56,7 +56,7 @@ private fun PreviewRedeemVoucherDialog() { state = VoucherDialogUiState.INITIAL, onVoucherInputChange = {}, onRedeem = {}, - onDismiss = {} + onDismiss = {}, ) } } @@ -69,7 +69,7 @@ private fun PreviewRedeemVoucherDialogVerifying() { state = VoucherDialogUiState("", VoucherDialogState.Verifying), onVoucherInputChange = {}, onRedeem = {}, - onDismiss = {} + onDismiss = {}, ) } } @@ -82,11 +82,11 @@ private fun PreviewRedeemVoucherDialogError() { state = VoucherDialogUiState( "", - VoucherDialogState.Error(RedeemVoucherError.InvalidVoucher) + VoucherDialogState.Error(RedeemVoucherError.InvalidVoucher), ), onVoucherInputChange = {}, onRedeem = {}, - onDismiss = {} + onDismiss = {}, ) } } @@ -99,7 +99,7 @@ private fun PreviewRedeemVoucherDialogSuccess() { state = VoucherDialogUiState("", VoucherDialogState.Success(3600)), onVoucherInputChange = {}, onRedeem = {}, - onDismiss = {} + onDismiss = {}, ) } } @@ -113,7 +113,7 @@ fun RedeemVoucher(resultBackNavigator: ResultBackNavigator) { state = state, onVoucherInputChange = vm::onVoucherInputChange, onRedeem = vm::onRedeem, - onDismiss = { resultBackNavigator.navigateBack(result = it) } + onDismiss = { resultBackNavigator.navigateBack(result = it) }, ) } @@ -122,14 +122,12 @@ fun RedeemVoucherDialog( state: VoucherDialogUiState, onVoucherInputChange: (String) -> Unit = {}, onRedeem: (voucherCode: String) -> Unit, - onDismiss: (isTimeAdded: Boolean) -> Unit + onDismiss: (isTimeAdded: Boolean) -> Unit, ) { AlertDialog( title = { if (state.voucherState !is VoucherDialogState.Success) - Text( - text = stringResource(id = R.string.enter_voucher_code), - ) + Text(text = stringResource(id = R.string.enter_voucher_code)) }, confirmButton = { Column { @@ -138,7 +136,7 @@ fun RedeemVoucherDialog( text = stringResource(id = R.string.redeem), onClick = { onRedeem(state.voucherInput) }, modifier = Modifier.padding(bottom = Dimens.buttonSpacing), - isEnabled = state.voucherInput.length == VOUCHER_LENGTH + isEnabled = state.voucherInput.length == VOUCHER_LENGTH, ) } PrimaryButton( @@ -149,14 +147,14 @@ fun RedeemVoucherDialog( R.string.got_it else R.string.cancel ), - onClick = { onDismiss(state.voucherState is VoucherDialogState.Success) } + onClick = { onDismiss(state.voucherState is VoucherDialogState.Success) }, ) } }, text = { Column( modifier = Modifier.fillMaxWidth(), - horizontalAlignment = Alignment.CenterHorizontally + horizontalAlignment = Alignment.CenterHorizontally, ) { if (state.voucherState is VoucherDialogState.Success) { val days: Int = @@ -175,10 +173,10 @@ fun RedeemVoucherDialog( pluralStringResource( id = R.plurals.months, count = days / 30, - days / 30 + days / 30, ) } - } + }, ) RedeemSuccessBody(message = message) } else { @@ -186,7 +184,7 @@ fun RedeemVoucherDialog( EnterVoucherBody( state = state, onVoucherInputChange = onVoucherInputChange, - onRedeem = onRedeem + onRedeem = onRedeem, ) } } @@ -198,7 +196,7 @@ fun RedeemVoucherDialog( DialogProperties( securePolicy = if (BuildConfig.DEBUG) SecureFlagPolicy.Inherit else SecureFlagPolicy.SecureOn - ) + ), ) } @@ -207,18 +205,15 @@ private fun RedeemSuccessBody(message: String) { Image( painter = painterResource(R.drawable.icon_success), contentDescription = null, - modifier = Modifier.fillMaxWidth().height(Dimens.buttonHeight) + modifier = Modifier.fillMaxWidth().height(Dimens.buttonHeight), ) Text( text = stringResource(id = R.string.voucher_success_title), modifier = - Modifier.padding( - start = Dimens.smallPadding, - top = Dimens.successIconVerticalPadding, - ) + Modifier.padding(start = Dimens.smallPadding, top = Dimens.successIconVerticalPadding) .fillMaxWidth(), color = MaterialTheme.colorScheme.onSurface, - style = MaterialTheme.typography.titleMedium + style = MaterialTheme.typography.titleMedium, ) Text( @@ -227,7 +222,7 @@ private fun RedeemSuccessBody(message: String) { Modifier.padding(start = Dimens.smallPadding, top = Dimens.cellTopPadding) .fillMaxWidth(), color = MaterialTheme.colorScheme.onSurfaceVariant, - style = MaterialTheme.typography.labelMedium + style = MaterialTheme.typography.labelMedium, ) } @@ -235,7 +230,7 @@ private fun RedeemSuccessBody(message: String) { private fun EnterVoucherBody( state: VoucherDialogUiState, onVoucherInputChange: (String) -> Unit = {}, - onRedeem: (voucherCode: String) -> Unit + onRedeem: (voucherCode: String) -> Unit, ) { CustomTextField( value = state.voucherInput, @@ -251,12 +246,12 @@ private fun EnterVoucherBody( placeholderText = stringResource(id = R.string.voucher_hint), visualTransformation = vouchersVisualTransformation(), isDigitsOnlyAllowed = false, - modifier = Modifier.testTag(VOUCHER_INPUT_TEST_TAG) + modifier = Modifier.testTag(VOUCHER_INPUT_TEST_TAG), ) Spacer(modifier = Modifier.height(Dimens.smallPadding)) Row( verticalAlignment = Alignment.CenterVertically, - modifier = Modifier.height(Dimens.listIconSize).fillMaxWidth() + modifier = Modifier.height(Dimens.listIconSize).fillMaxWidth(), ) { if (state.voucherState is VoucherDialogState.Verifying) { MullvadCircularProgressIndicatorSmall() @@ -264,13 +259,13 @@ private fun EnterVoucherBody( text = stringResource(id = R.string.verifying_voucher), modifier = Modifier.padding(start = Dimens.smallPadding), color = MaterialTheme.colorScheme.onSurface, - style = MaterialTheme.typography.bodySmall + style = MaterialTheme.typography.bodySmall, ) } else if (state.voucherState is VoucherDialogState.Error) { Text( text = stringResource(id = state.voucherState.error.message()), color = MaterialTheme.colorScheme.error, - style = MaterialTheme.typography.bodySmall + style = MaterialTheme.typography.bodySmall, ) } } @@ -282,7 +277,7 @@ private fun EnterVoucherBody( modifier = Modifier.padding(top = Dimens.smallPadding), text = stringResource(id = R.string.voucher_is_account_number), color = MaterialTheme.colorScheme.onPrimary, - style = MaterialTheme.typography.bodySmall + style = MaterialTheme.typography.bodySmall, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/RemoveDeviceConfirmationDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/RemoveDeviceConfirmationDialog.kt index 4e55921a1e28..f2f0bcd567a8 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/RemoveDeviceConfirmationDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/RemoveDeviceConfirmationDialog.kt @@ -49,14 +49,14 @@ fun RemoveDeviceConfirmation(navigator: ResultBackNavigator, device: D modifier = Modifier.fillMaxWidth().height(Dimens.dialogIconHeight), painter = painterResource(id = R.drawable.icon_alert), contentDescription = stringResource(id = R.string.remove_button), - tint = MaterialTheme.colorScheme.error + tint = MaterialTheme.colorScheme.error, ) }, text = { val htmlFormattedDialogText = textResource( id = R.string.max_devices_confirm_removal_description, - device.displayName() + device.displayName(), ) HtmlText(htmlFormattedString = htmlFormattedDialogText, textSize = 16.sp.value) @@ -65,15 +65,15 @@ fun RemoveDeviceConfirmation(navigator: ResultBackNavigator, device: D PrimaryButton( modifier = Modifier.focusRequester(FocusRequester()), onClick = dropUnlessResumed { navigator.navigateBack() }, - text = stringResource(id = R.string.back) + text = stringResource(id = R.string.back), ) }, confirmButton = { NegativeButton( onClick = dropUnlessResumed { navigator.navigateBack(result = device.id) }, - text = stringResource(id = R.string.confirm_removal) + text = stringResource(id = R.string.confirm_removal), ) }, - containerColor = MaterialTheme.colorScheme.surface + containerColor = MaterialTheme.colorScheme.surface, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ReportProblemNoEmailDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ReportProblemNoEmailDialog.kt index 482c75a2f0bd..1e212bea9762 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ReportProblemNoEmailDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ReportProblemNoEmailDialog.kt @@ -39,7 +39,7 @@ fun ReportProblemNoEmail(resultBackNavigator: ResultBackNavigator) { painter = painterResource(id = R.drawable.icon_alert), contentDescription = null, modifier = Modifier.size(Dimens.dialogIconHeight), - tint = MaterialTheme.colorScheme.error + tint = MaterialTheme.colorScheme.error, ) }, text = { @@ -47,23 +47,23 @@ fun ReportProblemNoEmail(resultBackNavigator: ResultBackNavigator) { text = stringResource(id = R.string.confirm_no_email), modifier = Modifier.fillMaxWidth(), style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurface + color = MaterialTheme.colorScheme.onSurface, ) }, dismissButton = { PrimaryButton( modifier = Modifier.fillMaxWidth(), onClick = dropUnlessResumed { resultBackNavigator.navigateBack() }, - text = stringResource(id = R.string.back) + text = stringResource(id = R.string.back), ) }, confirmButton = { NegativeButton( modifier = Modifier.fillMaxWidth(), onClick = dropUnlessResumed { resultBackNavigator.navigateBack(result = true) }, - text = stringResource(id = R.string.send_anyway) + text = stringResource(id = R.string.send_anyway), ) }, - containerColor = MaterialTheme.colorScheme.surface + containerColor = MaterialTheme.colorScheme.surface, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ResetServerIpOverridesConfirmationDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ResetServerIpOverridesConfirmationDialog.kt index 966a11dfdfb9..3678a92dce50 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ResetServerIpOverridesConfirmationDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ResetServerIpOverridesConfirmationDialog.kt @@ -45,14 +45,14 @@ fun ResetServerIpOverridesConfirmation(resultBackNavigator: ResultBackNavigator< } ResetServerIpOverridesConfirmationDialog( onClearAllOverrides = vm::clearAllOverrides, - dropUnlessResumed { resultBackNavigator.navigateBack() } + dropUnlessResumed { resultBackNavigator.navigateBack() }, ) } @Composable fun ResetServerIpOverridesConfirmationDialog( onClearAllOverrides: () -> Unit, - onNavigateBack: () -> Unit + onNavigateBack: () -> Unit, ) { AlertDialog( containerColor = MaterialTheme.colorScheme.surface, @@ -60,7 +60,7 @@ fun ResetServerIpOverridesConfirmationDialog( NegativeButton( modifier = Modifier.fillMaxWidth().testTag(RESET_SERVER_IP_OVERRIDE_RESET_TEST_TAG), text = stringResource(id = R.string.server_ip_overrides_reset_reset_button), - onClick = onClearAllOverrides + onClick = onClearAllOverrides, ) }, dismissButton = { @@ -68,13 +68,13 @@ fun ResetServerIpOverridesConfirmationDialog( modifier = Modifier.fillMaxWidth().testTag(RESET_SERVER_IP_OVERRIDE_CANCEL_TEST_TAG), text = stringResource(R.string.cancel), - onClick = onNavigateBack + onClick = onNavigateBack, ) }, title = { Text( text = stringResource(id = R.string.server_ip_overrides_reset_title), - color = MaterialTheme.colorScheme.onSurface + color = MaterialTheme.colorScheme.onSurface, ) }, text = { @@ -84,6 +84,6 @@ fun ResetServerIpOverridesConfirmationDialog( style = MaterialTheme.typography.bodySmall, ) }, - onDismissRequest = onNavigateBack + onDismissRequest = onNavigateBack, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/SaveApiAccessMethodDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/SaveApiAccessMethodDialog.kt index aabdbb4e3968..c5fb2d45d673 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/SaveApiAccessMethodDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/SaveApiAccessMethodDialog.kt @@ -48,17 +48,15 @@ private fun PreviewSaveApiAccessMethodDialog( data class SaveApiAccessMethodNavArgs( val id: ApiAccessMethodId?, val name: ApiAccessMethodName, - val customProxy: ApiAccessMethod.CustomProxy + val customProxy: ApiAccessMethod.CustomProxy, ) @Destination( style = DestinationStyle.Dialog::class, - navArgs = SaveApiAccessMethodNavArgs::class + navArgs = SaveApiAccessMethodNavArgs::class, ) @Composable -fun SaveApiAccessMethod( - backNavigator: ResultBackNavigator, -) { +fun SaveApiAccessMethod(backNavigator: ResultBackNavigator) { val viewModel = koinViewModel() LaunchedEffectCollect(sideEffect = viewModel.uiSideEffect) { @@ -74,7 +72,7 @@ fun SaveApiAccessMethod( SaveApiAccessMethodDialog( state = state, onCancel = backNavigator::navigateBack, - onSave = viewModel::save + onSave = viewModel::save, ) } @@ -82,7 +80,7 @@ fun SaveApiAccessMethod( fun SaveApiAccessMethodDialog( state: SaveApiAccessMethodUiState, onCancel: () -> Unit = {}, - onSave: () -> Unit = {} + onSave: () -> Unit = {}, ) { AlertDialog( icon = { @@ -100,7 +98,7 @@ fun SaveApiAccessMethodDialog( R.drawable.icon_fail } ), - contentDescription = null + contentDescription = null, ) TestApiAccessMethodState.Testing -> MullvadCircularProgressIndicatorMedium( @@ -109,7 +107,7 @@ fun SaveApiAccessMethodDialog( } }, title = { Text(text = state.text(), style = MaterialTheme.typography.headlineSmall) }, - onDismissRequest = { /*Should not be able to dismiss*/}, + onDismissRequest = { /*Should not be able to dismiss*/ }, confirmButton = { PrimaryButton( onClick = onCancel, @@ -117,7 +115,7 @@ fun SaveApiAccessMethodDialog( isEnabled = state.testingState is TestApiAccessMethodState.Testing || state.testingState is TestApiAccessMethodState.Result.Failure, - modifier = Modifier.testTag(SAVE_API_ACCESS_METHOD_CANCEL_BUTTON_TEST_TAG) + modifier = Modifier.testTag(SAVE_API_ACCESS_METHOD_CANCEL_BUTTON_TEST_TAG), ) }, dismissButton = { @@ -125,7 +123,7 @@ fun SaveApiAccessMethodDialog( PrimaryButton( onClick = onSave, text = stringResource(id = R.string.save), - modifier = Modifier.testTag(SAVE_API_ACCESS_METHOD_SAVE_BUTTON_TEST_TAG) + modifier = Modifier.testTag(SAVE_API_ACCESS_METHOD_SAVE_BUTTON_TEST_TAG), ) } }, diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ServerIpOverridesInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ServerIpOverridesInfoDialog.kt index 3fe00ce818fd..0a38d8d878da 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ServerIpOverridesInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ServerIpOverridesInfoDialog.kt @@ -29,6 +29,6 @@ fun ServerIpOverridesInfo(navigator: DestinationsNavigator) { appendLine() append(stringResource(id = R.string.server_ip_overrides_info_third_paragraph)) }, - onDismiss = dropUnlessResumed { navigator.navigateUp() } + onDismiss = dropUnlessResumed { navigator.navigateUp() }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/UdpOverTcpPortInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/UdpOverTcpPortInfoDialog.kt index ea8beaa8fc22..4dd1f8ce7e63 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/UdpOverTcpPortInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/UdpOverTcpPortInfoDialog.kt @@ -23,6 +23,6 @@ private fun PreviewUdpOverTcpPortInfoDialog() { fun UdpOverTcpPortInfo(navigator: DestinationsNavigator) { InfoDialog( message = stringResource(id = R.string.udp_over_tcp_port_info), - onDismiss = dropUnlessResumed { navigator.navigateUp() } + onDismiss = dropUnlessResumed { navigator.navigateUp() }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/WireguardCustomPortDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/WireguardCustomPortDialog.kt index ddcc2b662fd6..6f775358d911 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/WireguardCustomPortDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/WireguardCustomPortDialog.kt @@ -43,7 +43,7 @@ private fun PreviewWireguardCustomPortDialog() { customPort = null, allowedPortRanges = listOf(PortRange(10..10), PortRange(40..50)), ), - EmptyResultBackNavigator() + EmptyResultBackNavigator(), ) } } @@ -64,7 +64,7 @@ fun WireguardCustomPort( initialPort = navArg.customPort, allowedPortRanges = navArg.allowedPortRanges, onSave = { port -> backNavigator.navigateBack(port) }, - onDismiss = backNavigator::navigateBack + onDismiss = backNavigator::navigateBack, ) } @@ -73,29 +73,25 @@ fun WireguardCustomPortDialog( initialPort: Port?, allowedPortRanges: List, onSave: (Port?) -> Unit, - onDismiss: () -> Unit + onDismiss: () -> Unit, ) { val port = remember { mutableStateOf(initialPort?.value?.toString() ?: "") } val isValidPort = port.value.toPortOrNull()?.inAnyOf(allowedPortRanges) ?: false AlertDialog( - title = { - Text( - text = stringResource(id = R.string.custom_port_dialog_title), - ) - }, + title = { Text(text = stringResource(id = R.string.custom_port_dialog_title)) }, confirmButton = { Column(verticalArrangement = Arrangement.spacedBy(Dimens.buttonSpacing)) { PrimaryButton( text = stringResource(id = R.string.custom_port_dialog_submit), onClick = { onSave(port.value.toPortOrNull()) }, - isEnabled = isValidPort + isEnabled = isValidPort, ) if (initialPort != null) { NegativeButton( text = stringResource(R.string.custom_port_dialog_remove), - onClick = { onSave(null) } + onClick = { onSave(null) }, ) } PrimaryButton(text = stringResource(id = R.string.cancel), onClick = onDismiss) @@ -113,23 +109,23 @@ fun WireguardCustomPortDialog( onValueChanged = { input -> port.value = input }, isValidValue = isValidPort, maxCharLength = 5, - modifier = Modifier.testTag(CUSTOM_PORT_DIALOG_INPUT_TEST_TAG).fillMaxWidth() + modifier = Modifier.testTag(CUSTOM_PORT_DIALOG_INPUT_TEST_TAG).fillMaxWidth(), ) Spacer(modifier = Modifier.height(Dimens.smallPadding)) Text( text = stringResource( id = R.string.custom_port_dialog_valid_ranges, - allowedPortRanges.asString() + allowedPortRanges.asString(), ), color = MaterialTheme.colorScheme.onSurfaceVariant, - style = MaterialTheme.typography.bodySmall + style = MaterialTheme.typography.bodySmall, ) } }, containerColor = MaterialTheme.colorScheme.surface, titleContentColor = MaterialTheme.colorScheme.onSurface, - onDismissRequest = onDismiss + onDismissRequest = onDismiss, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/WireguardPortInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/WireguardPortInfoDialog.kt index d5a73c74e2c1..e4b6bf06f3f7 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/WireguardPortInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/WireguardPortInfoDialog.kt @@ -22,7 +22,7 @@ private fun PreviewWireguardPortInfoDialog() { AppTheme { WireguardPortInfo( EmptyDestinationsNavigator, - argument = WireguardPortInfoDialogArgument(listOf(PortRange(1..2))) + argument = WireguardPortInfoDialogArgument(listOf(PortRange(1..2))), ) } } @@ -37,8 +37,8 @@ fun WireguardPortInfo(navigator: DestinationsNavigator, argument: WireguardPortI additionalInfo = stringResource( id = R.string.wireguard_port_info_port_range, - argument.portRanges.asString() + argument.portRanges.asString(), ), - onDismiss = dropUnlessResumed { navigator.navigateUp() } + onDismiss = dropUnlessResumed { navigator.navigateUp() }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/PaymentDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/PaymentDialog.kt index 8744a744665f..d1cfcdfebcb8 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/PaymentDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/PaymentDialog.kt @@ -39,10 +39,10 @@ private fun PreviewPaymentDialogPurchaseCompleted() { message = R.string.payment_completed_dialog_message, icon = PaymentDialogIcon.SUCCESS, confirmAction = PaymentDialogAction.Close, - successfulPayment = true + successfulPayment = true, ), retryPurchase = {}, - onCloseDialog = {} + onCloseDialog = {}, ) } } @@ -57,10 +57,10 @@ private fun PreviewPaymentDialogPurchasePending() { title = R.string.payment_pending_dialog_title, message = R.string.payment_pending_dialog_message, confirmAction = PaymentDialogAction.Close, - closeOnDismiss = true + closeOnDismiss = true, ), retryPurchase = {}, - onCloseDialog = {} + onCloseDialog = {}, ) } } @@ -75,10 +75,10 @@ private fun PreviewPaymentDialogGenericError() { title = R.string.error_occurred, message = R.string.try_again, icon = PaymentDialogIcon.FAIL, - confirmAction = PaymentDialogAction.Close + confirmAction = PaymentDialogAction.Close, ), retryPurchase = {}, - onCloseDialog = {} + onCloseDialog = {}, ) } } @@ -92,10 +92,10 @@ private fun PreviewPaymentDialogLoading() { PaymentDialogData( title = R.string.loading_connecting, icon = PaymentDialogIcon.LOADING, - closeOnDismiss = false + closeOnDismiss = false, ), retryPurchase = {}, - onCloseDialog = {} + onCloseDialog = {}, ) } } @@ -111,10 +111,10 @@ private fun PreviewPaymentDialogPaymentAvailabilityError() { message = R.string.payment_billing_error_dialog_message, icon = PaymentDialogIcon.FAIL, confirmAction = PaymentDialogAction.Close, - dismissAction = PaymentDialogAction.RetryPurchase(productId = ProductId("test")) + dismissAction = PaymentDialogAction.RetryPurchase(productId = ProductId("test")), ), retryPurchase = {}, - onCloseDialog = {} + onCloseDialog = {}, ) } } @@ -139,7 +139,7 @@ fun Payment(productId: ProductId, resultBackNavigator: ResultBackNavigator Unit = {}, - onCloseDialog: (isPaymentSuccessful: Boolean) -> Unit = {} + onCloseDialog: (isPaymentSuccessful: Boolean) -> Unit = {}, ) { val clickResolver: (action: PaymentDialogAction) -> Unit = { when (it) { @@ -162,12 +162,12 @@ fun PaymentDialog( PaymentDialogIcon.SUCCESS -> Icon( painter = painterResource(id = R.drawable.icon_success), - contentDescription = null + contentDescription = null, ) PaymentDialogIcon.FAIL -> Icon( painter = painterResource(id = R.drawable.icon_fail), - contentDescription = null + contentDescription = null, ) PaymentDialogIcon.LOADING -> MullvadCircularProgressIndicatorMedium() else -> {} @@ -177,7 +177,7 @@ fun PaymentDialog( paymentDialogData.title?.let { Text( text = stringResource(id = paymentDialogData.title), - style = MaterialTheme.typography.headlineSmall + style = MaterialTheme.typography.headlineSmall, ) } }, @@ -186,7 +186,7 @@ fun PaymentDialog( { Text( text = stringResource(id = paymentDialogData.message), - style = MaterialTheme.typography.bodySmall + style = MaterialTheme.typography.bodySmall, ) } }, @@ -203,7 +203,7 @@ fun PaymentDialog( paymentDialogData.dismissAction?.let { PrimaryButton( text = stringResource(id = it.message), - onClick = { clickResolver(it) } + onClick = { clickResolver(it) }, ) } }, @@ -211,9 +211,9 @@ fun PaymentDialog( paymentDialogData.confirmAction?.let { PrimaryButton( text = stringResource(id = it.message), - onClick = { clickResolver(it) } + onClick = { clickResolver(it) }, ) } - } + }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/PaymentDialogData.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/PaymentDialogData.kt index 987696461049..2bdcda050754 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/PaymentDialogData.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/PaymentDialogData.kt @@ -10,7 +10,7 @@ data class PaymentDialogData( val confirmAction: PaymentDialogAction? = null, val dismissAction: PaymentDialogAction? = null, val closeOnDismiss: Boolean = true, - val successfulPayment: Boolean = false + val successfulPayment: Boolean = false, ) sealed class PaymentDialogAction(val message: Int) { @@ -22,5 +22,5 @@ sealed class PaymentDialogAction(val message: Int) { enum class PaymentDialogIcon { SUCCESS, FAIL, - LOADING + LOADING, } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/VerificationPendingDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/VerificationPendingDialog.kt index cb973b4659b1..6b7ea8a6693c 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/VerificationPendingDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/VerificationPendingDialog.kt @@ -34,13 +34,13 @@ fun VerificationPendingDialog(onClose: () -> Unit) { title = { Text( text = stringResource(id = R.string.payment_pending_dialog_title), - style = MaterialTheme.typography.headlineSmall + style = MaterialTheme.typography.headlineSmall, ) }, text = { Text( text = stringResource(id = R.string.payment_pending_dialog_message), - style = MaterialTheme.typography.bodySmall + style = MaterialTheme.typography.bodySmall, ) }, containerColor = MaterialTheme.colorScheme.surface, @@ -49,6 +49,6 @@ fun VerificationPendingDialog(onClose: () -> Unit) { onDismissRequest = onClose, confirmButton = { PrimaryButton(text = stringResource(id = R.string.got_it), onClick = onClose) - } + }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/extensions/LazyListExtensions.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/extensions/LazyListExtensions.kt index 7b009fdd67a0..3e90b6de7e2b 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/extensions/LazyListExtensions.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/extensions/LazyListExtensions.kt @@ -11,7 +11,7 @@ import androidx.compose.ui.graphics.Color inline fun LazyListScope.itemWithDivider( key: Any? = null, contentType: Any? = null, - crossinline itemContent: @Composable LazyItemScope.() -> Unit + crossinline itemContent: @Composable LazyItemScope.() -> Unit, ) = item(key = key, contentType = contentType) { itemContent() @@ -22,7 +22,7 @@ inline fun LazyListScope.itemsWithDivider( items: List, noinline key: ((item: T) -> Any)? = null, noinline contentType: (item: T) -> Any? = { null }, - crossinline itemContent: @Composable LazyItemScope.(item: T) -> Unit + crossinline itemContent: @Composable LazyItemScope.(item: T) -> Unit, ) = items(items = items, key = key, contentType = contentType) { item -> itemContent(item) @@ -33,7 +33,7 @@ inline fun LazyListScope.itemsIndexedWithDivider( items: List, noinline key: ((index: Int, item: T) -> Any)? = null, crossinline contentType: (index: Int, item: T) -> Any? = { _, _ -> null }, - crossinline itemContent: @Composable LazyItemScope.(index: Int, item: T) -> Unit + crossinline itemContent: @Composable LazyItemScope.(index: Int, item: T) -> Unit, ) = itemsIndexed(items = items, key = key, contentType = contentType) { index, item -> itemContent(index, item) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/extensions/LifecycleExtensions.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/extensions/LifecycleExtensions.kt index 3e04f83b5403..86e9e3877784 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/extensions/LifecycleExtensions.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/extensions/LifecycleExtensions.kt @@ -25,7 +25,7 @@ fun dropUnlessResumed(lifecycleOwner: LifecycleOwner, block: (T) -> Unit): ( fun LifecycleOwner.runOnAtLeast( expectedState: Lifecycle.State, - block: (T) -> Unit + block: (T) -> Unit, ): (T) -> Unit { return { if (lifecycle.currentState.isAtLeast(expectedState)) { @@ -42,12 +42,12 @@ fun dropUnlessResumed(block: (T, T2) -> Unit): (T, T2) -> Unit { fun dropUnlessResumed( lifecycleOwner: LifecycleOwner, - block: (T, T2) -> Unit + block: (T, T2) -> Unit, ): (T, T2) -> Unit = lifecycleOwner.runOnAtLeast(Lifecycle.State.RESUMED, block) fun LifecycleOwner.runOnAtLeast( expectedState: Lifecycle.State, - block: (T, T2) -> Unit + block: (T, T2) -> Unit, ): (T, T2) -> Unit { return { t, t1 -> if (lifecycle.currentState.isAtLeast(expectedState)) { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/extensions/ResourcesExtensions.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/extensions/ResourcesExtensions.kt index 89d985a40837..367c1b54af27 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/extensions/ResourcesExtensions.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/extensions/ResourcesExtensions.kt @@ -15,7 +15,7 @@ fun Resources.getExpiryQuantityString(accountExpiry: DateTime): String { private fun getExpiryQuantityString( resources: Resources, accountExpiry: DateTime, - remainingTime: Duration + remainingTime: Duration, ): String { if (remainingTime.isShorterThan(Duration.ZERO)) { return resources.getString(R.string.out_of_time) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/preview/ApiAccessListUiStateParameterProvider.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/preview/ApiAccessListUiStateParameterProvider.kt index 980ff36848a9..8ad648284ff8 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/preview/ApiAccessListUiStateParameterProvider.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/preview/ApiAccessListUiStateParameterProvider.kt @@ -12,13 +12,13 @@ class ApiAccessListUiStateParameterProvider : PreviewParameterProvider().asSharedFlow(), ) @@ -109,7 +109,7 @@ private fun PreviewAccountScreen() { @Composable fun Account( navigator: DestinationsNavigator, - playPaymentResultRecipient: ResultRecipient + playPaymentResultRecipient: ResultRecipient, ) { val vm = koinViewModel() val state by vm.uiState.collectAsStateWithLifecycle() @@ -141,7 +141,7 @@ fun Account( onPurchaseBillingProductClick = dropUnlessResumed { productId -> navigator.navigate(PaymentDestination(productId)) }, navigateToVerificationPendingDialog = - dropUnlessResumed { navigator.navigate(VerificationPendingDestination) } + dropUnlessResumed { navigator.navigate(VerificationPendingDestination) }, ) } @@ -158,7 +158,7 @@ fun AccountScreen( navigateToLogin: () -> Unit = {}, navigateToDeviceInfo: () -> Unit = {}, navigateToVerificationPendingDialog: () -> Unit = {}, - onBackClick: () -> Unit = {} + onBackClick: () -> Unit = {}, ) { // This will enable SECURE_FLAG while this screen is visible to preview screenshot SecureScreenWhileInView() @@ -183,7 +183,7 @@ fun AccountScreen( ScaffoldWithMediumTopBar( appBarTitle = stringResource(id = R.string.settings_account), navigationIcon = { NavigateBackDownIconButton(onBackClick) }, - snackbarHostState = snackbarHostState + snackbarHostState = snackbarHostState, ) { modifier -> Column( horizontalAlignment = Alignment.Start, @@ -191,20 +191,20 @@ fun AccountScreen( modifier .animateContentSize() .padding(horizontal = Dimens.sideMargin) - .padding(bottom = Dimens.screenVerticalMargin) + .padding(bottom = Dimens.screenVerticalMargin), ) { Column( verticalArrangement = Arrangement.spacedBy(Dimens.accountRowSpacing), - modifier = Modifier.padding(bottom = Dimens.smallPadding).animateContentSize() + modifier = Modifier.padding(bottom = Dimens.smallPadding).animateContentSize(), ) { DeviceNameRow( deviceName = state.deviceName ?: "", - onInfoClick = navigateToDeviceInfo + onInfoClick = navigateToDeviceInfo, ) AccountNumberRow( accountNumber = state.accountNumber?.value ?: "", - onCopyAccountNumber + onCopyAccountNumber, ) PaidUntilRow(accountExpiry = state.accountExpiry) @@ -219,7 +219,7 @@ fun AccountScreen( onPurchaseBillingProductClick(productId) }, onInfoClick = navigateToVerificationPendingDialog, - modifier = Modifier.padding(bottom = Dimens.buttonSpacing) + modifier = Modifier.padding(bottom = Dimens.buttonSpacing), ) } @@ -227,20 +227,17 @@ fun AccountScreen( ExternalButton( text = stringResource(id = R.string.manage_account), onClick = onManageAccountClick, - modifier = Modifier.padding(bottom = Dimens.buttonSpacing) + modifier = Modifier.padding(bottom = Dimens.buttonSpacing), ) } RedeemVoucherButton( onClick = onRedeemVoucherClick, modifier = Modifier.padding(bottom = Dimens.buttonSpacing), - isEnabled = true + isEnabled = true, ) - NegativeButton( - text = stringResource(id = R.string.log_out), - onClick = onLogoutClick, - ) + NegativeButton(text = stringResource(id = R.string.log_out), onClick = onLogoutClick) } } } @@ -251,7 +248,7 @@ private fun DeviceNameRow(deviceName: String, onInfoClick: () -> Unit) { Text( style = MaterialTheme.typography.labelMedium, text = stringResource(id = R.string.device_name), - color = MaterialTheme.colorScheme.onSurfaceVariant + color = MaterialTheme.colorScheme.onSurfaceVariant, ) Row(modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) { @@ -260,7 +257,7 @@ private fun DeviceNameRow(deviceName: String, onInfoClick: () -> Unit) { Icon( painter = painterResource(id = R.drawable.icon_info), contentDescription = null, - tint = MaterialTheme.colorScheme.onSurface + tint = MaterialTheme.colorScheme.onSurface, ) } } @@ -273,12 +270,12 @@ private fun AccountNumberRow(accountNumber: String, onCopyAccountNumber: (String Text( style = MaterialTheme.typography.labelMedium, text = stringResource(id = R.string.account_number), - color = MaterialTheme.colorScheme.onSurfaceVariant + color = MaterialTheme.colorScheme.onSurfaceVariant, ) CopyableObfuscationView( content = accountNumber, onCopyClicked = { onCopyAccountNumber(accountNumber) }, - modifier = Modifier.heightIn(min = Dimens.accountRowMinHeight).fillMaxWidth() + modifier = Modifier.heightIn(min = Dimens.accountRowMinHeight).fillMaxWidth(), ) } } @@ -289,16 +286,16 @@ private fun PaidUntilRow(accountExpiry: DateTime?) { Text( style = MaterialTheme.typography.labelMedium, text = stringResource(id = R.string.paid_until), - color = MaterialTheme.colorScheme.onSurfaceVariant + color = MaterialTheme.colorScheme.onSurfaceVariant, ) Row( modifier = Modifier.heightIn(min = Dimens.accountRowMinHeight), - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { InformationView( content = accountExpiry?.toExpiryDateString() ?: "", - whenMissing = MissingPolicy.SHOW_SPINNER + whenMissing = MissingPolicy.SHOW_SPINNER, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessListScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessListScreen.kt index 5619f37e4421..3773c6e54acf 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessListScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessListScreen.kt @@ -69,7 +69,7 @@ fun ApiAccessList(navigator: DestinationsNavigator) { onApiAccessInfoClick = { navigator.navigate(ApiAccessMethodInfoDestination) { launchSingleTop = true } }, - onBackClick = navigator::navigateUp + onBackClick = navigator::navigateUp, ) } @@ -79,7 +79,7 @@ fun ApiAccessListScreen( onAddMethodClick: () -> Unit = {}, onApiAccessMethodClick: (apiAccessMethodSetting: ApiAccessMethodSetting) -> Unit = {}, onApiAccessInfoClick: () -> Unit = {}, - onBackClick: () -> Unit = {} + onBackClick: () -> Unit = {}, ) { ScaffoldWithMediumTopBar( appBarTitle = stringResource(id = R.string.settings_api_access), @@ -89,11 +89,11 @@ fun ApiAccessListScreen( description() currentAccessMethod( currentApiAccessMethodName = state.currentApiAccessMethodSetting?.name, - onInfoClicked = onApiAccessInfoClick + onInfoClicked = onApiAccessInfoClick, ) apiAccessMethodItems( state.apiAccessMethodSettings, - onApiAccessMethodClick = onApiAccessMethodClick + onApiAccessMethodClick = onApiAccessMethodClick, ) buttonPanel(onAddMethodClick = onAddMethodClick) } @@ -108,14 +108,14 @@ private fun LazyListScope.description() { color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.padding(start = Dimens.cellStartPadding, end = Dimens.cellEndPadding) - .fillMaxWidth() + .fillMaxWidth(), ) } } private fun LazyListScope.currentAccessMethod( currentApiAccessMethodName: ApiAccessMethodName?, - onInfoClicked: () -> Unit + onInfoClicked: () -> Unit, ) { item { Row( @@ -123,9 +123,9 @@ private fun LazyListScope.currentAccessMethod( Modifier.padding( start = Dimens.sideMargin, end = Dimens.sideMargin, - bottom = Dimens.mediumPadding + bottom = Dimens.mediumPadding, ), - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { Text( style = MaterialTheme.typography.titleMedium, @@ -145,7 +145,7 @@ private fun LazyListScope.currentAccessMethod( Icon( painter = painterResource(id = R.drawable.icon_info), contentDescription = null, - tint = MaterialTheme.colorScheme.onSurface + tint = MaterialTheme.colorScheme.onSurface, ) } } @@ -154,7 +154,7 @@ private fun LazyListScope.currentAccessMethod( private fun LazyListScope.apiAccessMethodItems( apiAccessMethodSettings: List, - onApiAccessMethodClick: (apiAccessMethodSetting: ApiAccessMethodSetting) -> Unit + onApiAccessMethodClick: (apiAccessMethodSetting: ApiAccessMethodSetting) -> Unit, ) { itemsWithDivider( items = apiAccessMethodSettings, @@ -163,7 +163,7 @@ private fun LazyListScope.apiAccessMethodItems( ) { ApiAccessMethodItem( apiAccessMethodSetting = it, - onApiAccessMethodClick = onApiAccessMethodClick + onApiAccessMethodClick = onApiAccessMethodClick, ) } } @@ -171,7 +171,7 @@ private fun LazyListScope.apiAccessMethodItems( @Composable private fun ApiAccessMethodItem( apiAccessMethodSetting: ApiAccessMethodSetting, - onApiAccessMethodClick: (apiAccessMethodSetting: ApiAccessMethodSetting) -> Unit + onApiAccessMethodClick: (apiAccessMethodSetting: ApiAccessMethodSetting) -> Unit, ) { TwoRowCell( titleText = apiAccessMethodSetting.name.value, @@ -189,10 +189,10 @@ private fun ApiAccessMethodItem( bodyView = { DefaultNavigationView( chevronContentDescription = apiAccessMethodSetting.name.value, - tint = MaterialTheme.colorScheme.onPrimary + tint = MaterialTheme.colorScheme.onPrimary, ) }, - onCellClicked = { onApiAccessMethodClick(apiAccessMethodSetting) } + onCellClicked = { onApiAccessMethodClick(apiAccessMethodSetting) }, ) } @@ -202,7 +202,7 @@ private fun LazyListScope.buttonPanel(onAddMethodClick: () -> Unit) { modifier = Modifier.padding(horizontal = Dimens.sideMargin, vertical = Dimens.largePadding), onClick = onAddMethodClick, - text = stringResource(id = R.string.add) + text = stringResource(id = R.string.add), ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessMethodDetailsScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessMethodDetailsScreen.kt index 60cf81716413..657deca9967d 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessMethodDetailsScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessMethodDetailsScreen.kt @@ -79,13 +79,13 @@ data class ApiAccessMethodDetailsNavArgs(val accessMethodId: ApiAccessMethodId) @Destination( style = SlideInFromRightTransition::class, - navArgs = ApiAccessMethodDetailsNavArgs::class + navArgs = ApiAccessMethodDetailsNavArgs::class, ) @Composable fun ApiAccessMethodDetails( navigator: DestinationsNavigator, confirmDeleteListResultRecipient: - ResultRecipient + ResultRecipient, ) { val viewModel = koinViewModel() @@ -144,7 +144,7 @@ fun ApiAccessMethodDetails( message = context.getString(R.string.testing_name, state.name()), duration = SnackbarDuration.Indefinite, actionLabel = context.getString(R.string.cancel), - onAction = viewModel::cancelTestMethod + onAction = viewModel::cancelTestMethod, ) } } @@ -185,7 +185,7 @@ fun ApiAccessMethodDetailsScreen( onTestMethodClicked: () -> Unit = {}, onUseMethodClicked: () -> Unit = {}, onDeleteApiAccessMethodClicked: (ApiAccessMethodId) -> Unit = {}, - onBackClicked: () -> Unit = {} + onBackClicked: () -> Unit = {}, ) { ScaffoldWithMediumTopBar( appBarTitle = state.name(), @@ -199,7 +199,7 @@ fun ApiAccessMethodDetailsScreen( } ) } - } + }, ) { modifier: Modifier -> Column(modifier = modifier) { when (state) { @@ -210,7 +210,7 @@ fun ApiAccessMethodDetailsScreen( onEditMethodClicked = onEditMethodClicked, onEnableClicked = onEnableClicked, onTestMethodClicked = onTestMethodClicked, - onUseMethodClicked = onUseMethodClicked + onUseMethodClicked = onUseMethodClicked, ) } } @@ -228,13 +228,13 @@ private fun Content( onEditMethodClicked: () -> Unit, onEnableClicked: (Boolean) -> Unit, onTestMethodClicked: () -> Unit, - onUseMethodClicked: () -> Unit + onUseMethodClicked: () -> Unit, ) { if (state.isEditable) { NavigationComposeCell( title = stringResource(id = R.string.edit_method), onClick = onEditMethodClicked, - testTag = API_ACCESS_DETAILS_EDIT_BUTTON + testTag = API_ACCESS_DETAILS_EDIT_BUTTON, ) HorizontalDivider() } @@ -242,11 +242,11 @@ private fun Content( isEnabled = state.isDisableable, title = stringResource(id = R.string.enable_method), isToggled = state.enabled, - onCellClicked = onEnableClicked + onCellClicked = onEnableClicked, ) if (!state.isDisableable) { SwitchComposeSubtitleCell( - text = stringResource(id = R.string.at_least_on_method_needs_to_enabled), + text = stringResource(id = R.string.at_least_on_method_needs_to_enabled) ) } Spacer(modifier = Modifier.height(Dimens.verticalSpace)) @@ -254,7 +254,7 @@ private fun Content( modifier = Modifier.padding(horizontal = Dimens.sideMargin).testTag(API_ACCESS_TEST_METHOD_BUTTON), isTesting = state.isTestingAccessMethod, - onTestMethod = onTestMethodClicked + onTestMethod = onTestMethodClicked, ) Spacer(modifier = Modifier.height(Dimens.verticalSpace)) PrimaryButton( @@ -262,7 +262,7 @@ private fun Content( modifier = Modifier.padding(horizontal = Dimens.sideMargin).testTag(API_ACCESS_USE_METHOD_BUTTON), onClick = onUseMethodClicked, - text = stringResource(id = R.string.use_method) + text = stringResource(id = R.string.use_method), ) } @@ -271,14 +271,14 @@ private fun Actions(onDeleteAccessMethod: () -> Unit) { var showMenu by remember { mutableStateOf(false) } IconButton( onClick = { showMenu = true }, - modifier = Modifier.testTag(API_ACCESS_DETAILS_TOP_BAR_DROPDOWN_BUTTON_TEST_TAG) + modifier = Modifier.testTag(API_ACCESS_DETAILS_TOP_BAR_DROPDOWN_BUTTON_TEST_TAG), ) { Icon(painter = painterResource(id = R.drawable.icon_more_vert), contentDescription = null) if (showMenu) { DropdownMenu( expanded = true, onDismissRequest = { showMenu = false }, - modifier = Modifier.background(MaterialTheme.colorScheme.surfaceContainer) + modifier = Modifier.background(MaterialTheme.colorScheme.surfaceContainer), ) { DropdownMenuItem( text = { Text(text = stringResource(id = R.string.delete_method)) }, @@ -293,7 +293,7 @@ private fun Actions(onDeleteAccessMethod: () -> Unit) { onDeleteAccessMethod() showMenu = false }, - modifier = Modifier.testTag(DELETE_DROPDOWN_MENU_ITEM_TEST_TAG) + modifier = Modifier.testTag(DELETE_DROPDOWN_MENU_ITEM_TEST_TAG), ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AutoConnectAndLockdownModeScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AutoConnectAndLockdownModeScreen.kt index 021ce4e174fc..b6c98b5ed85f 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AutoConnectAndLockdownModeScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AutoConnectAndLockdownModeScreen.kt @@ -90,9 +90,7 @@ fun AutoConnectAndLockdownModeScreen(onBackClick: () -> Unit = {}) { Column(modifier = modifier, verticalArrangement = Arrangement.Center) { val pagerState = rememberPagerState(pageCount = { PAGES.entries.size }) val scope = rememberCoroutineScope() - ConstraintLayout( - modifier = Modifier.fillMaxSize(), - ) { + ConstraintLayout(modifier = Modifier.fillMaxSize()) { val (pager, backButtonRef, nextButtonRef, pageIndicatorRef) = createRefs() AutoConnectCarousel( @@ -100,7 +98,7 @@ fun AutoConnectAndLockdownModeScreen(onBackClick: () -> Unit = {}) { backButtonRef = backButtonRef, nextButtonRef = nextButtonRef, pager = pager, - onOpenUrl = { url -> context.openLink(Uri.parse(url)) } + onOpenUrl = { url -> context.openLink(Uri.parse(url)) }, ) // Go to previous page @@ -117,7 +115,7 @@ fun AutoConnectAndLockdownModeScreen(onBackClick: () -> Unit = {}) { } }, isEnabled = { pagerState.currentPage != 0 }, - rotation = 180f + rotation = 180f, ) // Go to next page @@ -134,13 +132,13 @@ fun AutoConnectAndLockdownModeScreen(onBackClick: () -> Unit = {}) { } }, isEnabled = { pagerState.currentPage != pagerState.pageCount - 1 }, - rotation = 0f + rotation = 0f, ) PageIndicator( pagerState = pagerState, pageIndicatorRef = pageIndicatorRef, - pager = pager + pager = pager, ) } } @@ -155,7 +153,7 @@ private fun ConstraintLayoutScope.AutoConnectCarousel( backButtonRef: ConstrainedLayoutReference, nextButtonRef: ConstrainedLayoutReference, pager: ConstrainedLayoutReference, - onOpenUrl: (String) -> Unit + onOpenUrl: (String) -> Unit, ) { HorizontalPager( state = pagerState, @@ -171,7 +169,7 @@ private fun ConstraintLayoutScope.AutoConnectCarousel( val page = PAGES.entries[pageIndex] Column( horizontalAlignment = Alignment.CenterHorizontally, - modifier = Modifier.fillMaxWidth() + modifier = Modifier.fillMaxWidth(), ) { val annotatedTopText = page.annotatedTopText() ClickableText( @@ -199,15 +197,15 @@ private fun ConstraintLayoutScope.AutoConnectCarousel( text = HtmlCompat.fromHtml( stringResource(id = page.bottomText), - HtmlCompat.FROM_HTML_MODE_COMPACT + HtmlCompat.FROM_HTML_MODE_COMPACT, ) .toAnnotatedString( boldSpanStyle = SpanStyle( fontWeight = FontWeight.ExtraBold, - color = MaterialTheme.colorScheme.onSurface + color = MaterialTheme.colorScheme.onSurface, ) - ) + ), ) } } @@ -223,12 +221,12 @@ private fun CarouselNavigationButton( IconButton( modifier = modifier.alpha(if (isEnabled.invoke()) AlphaVisible else AlphaInvisible), onClick = onClick, - enabled = isEnabled.invoke() + enabled = isEnabled.invoke(), ) { Icon( painter = painterResource(id = R.drawable.icon_chevron), contentDescription = null, - modifier = Modifier.rotate(rotation) + modifier = Modifier.rotate(rotation), ) } } @@ -238,7 +236,7 @@ private fun CarouselNavigationButton( private fun ConstraintLayoutScope.PageIndicator( pagerState: PagerState, pageIndicatorRef: ConstrainedLayoutReference, - pager: ConstrainedLayoutReference + pager: ConstrainedLayoutReference, ) { Row( Modifier.wrapContentHeight().fillMaxWidth().padding(top = Dimens.topPadding).constrainAs( @@ -249,7 +247,7 @@ private fun ConstraintLayoutScope.PageIndicator( start.linkTo(parent.start) }, horizontalArrangement = Arrangement.Center, - verticalAlignment = Alignment.Bottom + verticalAlignment = Alignment.Bottom, ) { repeat(pagerState.pageCount) { iteration -> val color = @@ -268,16 +266,14 @@ private fun ConstraintLayoutScope.PageIndicator( @Composable private fun buildTopText(@StringRes id: Int) = buildAnnotatedString { - withStyle( - style = SpanStyle(color = MaterialTheme.colorScheme.onSurfaceVariant), - ) { + withStyle(style = SpanStyle(color = MaterialTheme.colorScheme.onSurfaceVariant)) { append( HtmlCompat.fromHtml(stringResource(id = id), HtmlCompat.FROM_HTML_MODE_COMPACT) .toAnnotatedString( boldSpanStyle = SpanStyle( fontWeight = FontWeight.ExtraBold, - color = MaterialTheme.colorScheme.onSurface + color = MaterialTheme.colorScheme.onSurface, ) ) ) @@ -299,8 +295,8 @@ private fun buildLockdownTopText() = buildAnnotatedString { style = SpanStyle( color = MaterialTheme.colorScheme.onSurface, - textDecoration = TextDecoration.Underline - ), + textDecoration = TextDecoration.Underline, + ) ) { append( stringResource( @@ -316,7 +312,7 @@ private fun buildLockdownTopText() = buildAnnotatedString { @OptIn(ExperimentalTextApi::class) inline fun AnnotatedString.Builder.withLink( annotation: UrlAnnotation, - block: AnnotatedString.Builder.() -> R + block: AnnotatedString.Builder.() -> R, ): R { val index = pushUrlAnnotation(annotation) return try { @@ -329,7 +325,7 @@ inline fun AnnotatedString.Builder.withLink( private enum class PAGES( val annotatedTopText: @Composable () -> AnnotatedString, val image: Int, - val bottomText: Int + val bottomText: Int, ) { FIRST( annotatedTopText = @@ -341,11 +337,11 @@ private enum class PAGES( annotatedTopText = @Composable { buildTopText(id = R.string.auto_connect_carousel_second_slide_top_text) }, R.drawable.carousel_slide_2_always_on, - R.string.auto_connect_carousel_second_slide_bottom_text + R.string.auto_connect_carousel_second_slide_bottom_text, ), THIRD( annotatedTopText = @Composable { buildLockdownTopText() }, R.drawable.carousel_slide_3_block_connections, R.string.auto_connect_carousel_third_slide_bottom_text, - ) + ), } 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 466aa0580b0b..c5b2be56ed0d 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 @@ -108,18 +108,14 @@ private const val CONNECT_BUTTON_THROTTLE_MILLIS = 1000 @Composable private fun PreviewConnectScreen() { val state = ConnectUiState.INITIAL - AppTheme { - ConnectScreen( - state = state, - ) - } + AppTheme { ConnectScreen(state = state) } } @Destination(style = HomeTransition::class) @Composable fun Connect( navigator: DestinationsNavigator, - selectLocationResultRecipient: ResultRecipient + selectLocationResultRecipient: ResultRecipient, ) { val connectViewModel: ConnectViewModel = koinViewModel() @@ -137,7 +133,7 @@ fun Connect( val openAccountPage = LocalUriHandler.current.createOpenAccountPageHook() CollectSideEffectWithLifecycle( connectViewModel.uiSideEffect, - minActiveState = Lifecycle.State.RESUMED + minActiveState = Lifecycle.State.RESUMED, ) { sideEffect -> when (sideEffect) { is ConnectViewModel.UiSideEffect.OpenAccountManagementPageInBrowser -> { @@ -157,7 +153,7 @@ fun Connect( is ConnectViewModel.UiSideEffect.ConnectError -> launch { snackbarHostState.showSnackbarImmediately( - message = sideEffect.toMessage(context), + message = sideEffect.toMessage(context) ) } } @@ -185,7 +181,7 @@ fun Connect( context .getString(R.string.download_url) .appendHideNavOnPlayBuild(state.isPlayBuild) - ) + ), ) .apply { flags = Intent.FLAG_ACTIVITY_NEW_TASK } context.startActivity(intent) @@ -210,7 +206,7 @@ fun ConnectScreen( onManageAccountClick: () -> Unit = {}, onSettingsClick: () -> Unit = {}, onAccountClick: () -> Unit = {}, - onDismissNewDeviceClick: () -> Unit = {} + onDismissNewDeviceClick: () -> Unit = {}, ) { val scrollState = rememberScrollState() @@ -222,16 +218,11 @@ fun ConnectScreen( onAccountClicked = onAccountClick, deviceName = state.deviceName, timeLeft = state.daysLeftUntilExpiry, - snackbarHostState = snackbarHostState + snackbarHostState = snackbarHostState, ) { var progressIndicatorBias by remember { mutableFloatStateOf(0f) } - MapColumn( - state, - it, - progressIndicatorBias, - scrollState, - ) { + MapColumn(state, it, progressIndicatorBias, scrollState) { Spacer(modifier = Modifier.defaultMinSize(minHeight = Dimens.mediumPadding).weight(1f)) MullvadCircularProgressIndicatorLarge( color = MaterialTheme.colorScheme.onSurface, @@ -240,7 +231,7 @@ fun ConnectScreen( .padding( start = Dimens.sideMargin, end = Dimens.sideMargin, - top = Dimens.mediumPadding + top = Dimens.mediumPadding, ) .alpha(if (state.showLoading) AlphaVisible else AlphaInvisible) .align(Alignment.CenterHorizontally) @@ -254,7 +245,7 @@ fun ConnectScreen( progressIndicatorBias = verticalBias } } - } + }, ) Spacer(modifier = Modifier.defaultMinSize(minHeight = Dimens.mediumPadding).weight(1f)) @@ -289,7 +280,7 @@ private fun MapColumn( it: PaddingValues, progressIndicatorBias: Float, scrollState: ScrollState, - content: @Composable ColumnScope.() -> Unit + content: @Composable ColumnScope.() -> Unit, ) { // Distance to marker when secure/unsecure @@ -298,7 +289,7 @@ private fun MapColumn( targetValue = if (state.tunnelState is TunnelState.Connected) SECURE_ZOOM else UNSECURE_ZOOM, animationSpec = tween(SECURE_ZOOM_ANIMATION_MILLIS), - label = "baseZoom" + label = "baseZoom", ) val markers = state.tunnelState.toMarker(state.location)?.let { listOf(it) } ?: emptyList() @@ -313,7 +304,7 @@ private fun MapColumn( GlobeColors( landColor = MaterialTheme.colorScheme.primary, oceanColor = MaterialTheme.colorScheme.surface, - ) + ), ) Column( @@ -325,10 +316,10 @@ private fun MapColumn( .fillMaxHeight() .drawVerticalScrollbar( scrollState, - color = MaterialTheme.colorScheme.onPrimary.copy(alpha = AlphaScrollbar) + color = MaterialTheme.colorScheme.onPrimary.copy(alpha = AlphaScrollbar), ) .verticalScroll(scrollState) - .testTag(SCROLLABLE_COLUMN_TEST_TAG) + .testTag(SCROLLABLE_COLUMN_TEST_TAG), ) { content() // We need to manually add this padding so we align size with the map @@ -341,7 +332,7 @@ private fun MapColumn( private fun ConnectionInfo(state: ConnectUiState) { ConnectionStatusText( state = state.tunnelState, - modifier = Modifier.padding(horizontal = Dimens.sideMargin) + modifier = Modifier.padding(horizontal = Dimens.sideMargin), ) Text( text = state.location?.country ?: "", @@ -349,7 +340,7 @@ private fun ConnectionInfo(state: ConnectUiState) { color = MaterialTheme.colorScheme.onSurface, maxLines = 1, overflow = TextOverflow.Ellipsis, - modifier = Modifier.padding(horizontal = Dimens.sideMargin) + modifier = Modifier.padding(horizontal = Dimens.sideMargin), ) Text( text = state.location?.city ?: "", @@ -357,7 +348,7 @@ private fun ConnectionInfo(state: ConnectUiState) { color = MaterialTheme.colorScheme.onSurface, maxLines = 1, overflow = TextOverflow.Ellipsis, - modifier = Modifier.padding(horizontal = Dimens.sideMargin) + modifier = Modifier.padding(horizontal = Dimens.sideMargin), ) var expanded by rememberSaveable { mutableStateOf(false) } LocationInfo( @@ -370,7 +361,7 @@ private fun ConnectionInfo(state: ConnectUiState) { modifier = Modifier.fillMaxWidth() .padding(horizontal = Dimens.sideMargin) - .testTag(LOCATION_INFO_TEST_TAG) + .testTag(LOCATION_INFO_TEST_TAG), ) } @@ -405,7 +396,7 @@ private fun ButtonPanel( state.selectedRelayItemTitle } else { stringResource(id = R.string.switch_location) - } + }, ) Spacer(modifier = Modifier.height(Dimens.buttonSpacing)) ConnectionButton( @@ -418,7 +409,7 @@ private fun ButtonPanel( reconnectClick = { handleThrottledAction(onReconnectClick) }, cancelClick = onCancelClick, connectClick = { handleThrottledAction(onConnectClick) }, - reconnectButtonTestTag = RECONNECT_BUTTON_TEST_TAG + reconnectButtonTestTag = RECONNECT_BUTTON_TEST_TAG, ) } @@ -435,7 +426,7 @@ fun TunnelState.toMarker(location: GeoIpLocation?): Marker? { is TunnelState.Disconnected -> Marker( location.toLatLong(), - colors = LocationMarkerColors(centerColor = MaterialTheme.colorScheme.error) + colors = LocationMarkerColors(centerColor = MaterialTheme.colorScheme.error), ) is TunnelState.Disconnecting -> null is TunnelState.Error -> null diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/CustomListLocationsScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/CustomListLocationsScreen.kt index 2bd5efa88826..b7c97f92d6c1 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/CustomListLocationsScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/CustomListLocationsScreen.kt @@ -60,15 +60,12 @@ private fun PreviewCustomListLocationScreen() { // AppTheme { CustomListLocationsScreen(state = CustomListLocationsUiState.Content.Data()) } } -data class CustomListLocationsNavArgs( - val customListId: CustomListId, - val newList: Boolean, -) +data class CustomListLocationsNavArgs(val customListId: CustomListId, val newList: Boolean) @Composable @Destination( style = SlideInFromRightTransition::class, - navArgs = CustomListLocationsNavArgs::class + navArgs = CustomListLocationsNavArgs::class, ) fun CustomListLocations( navigator: DestinationsNavigator, @@ -109,7 +106,7 @@ fun CustomListLocations( } else { backNavigator.navigateBack() } - } + }, ) } @@ -120,7 +117,7 @@ fun CustomListLocationsScreen( onSaveClick: () -> Unit = {}, onRelaySelectionClick: (RelayItem.Location, selected: Boolean) -> Unit = { _, _ -> }, onExpand: (RelayItem.Location, selected: Boolean) -> Unit = { _, _ -> }, - onBackClick: () -> Unit = {} + onBackClick: () -> Unit = {}, ) { ScaffoldWithSmallTopBar( appBarTitle = @@ -132,7 +129,7 @@ fun CustomListLocationsScreen( } ), navigationIcon = { NavigateBackIconButton(onNavigateBack = onBackClick) }, - actions = { Actions(isSaveEnabled = state.saveEnabled, onSaveClick = onSaveClick) } + actions = { Actions(isSaveEnabled = state.saveEnabled, onSaveClick = onSaveClick) }, ) { modifier -> Column(modifier = modifier) { SearchTextField( @@ -152,7 +149,7 @@ fun CustomListLocationsScreen( modifier = Modifier.drawVerticalScrollbar( state = lazyListState, - color = MaterialTheme.colorScheme.onSurface.copy(alpha = AlphaScrollbar) + color = MaterialTheme.colorScheme.onSurface.copy(alpha = AlphaScrollbar), ) .fillMaxWidth(), state = lazyListState, @@ -168,7 +165,7 @@ fun CustomListLocationsScreen( content( uiState = state, onRelaySelectedChanged = onRelaySelectionClick, - onExpand = onExpand + onExpand = onExpand, ) } } @@ -185,11 +182,9 @@ private fun Actions(isSaveEnabled: Boolean, onSaveClick: () -> Unit) { colors = ButtonDefaults.textButtonColors() .copy(contentColor = MaterialTheme.colorScheme.onPrimary), - modifier = Modifier.testTag(SAVE_BUTTON_TEST_TAG) + modifier = Modifier.testTag(SAVE_BUTTON_TEST_TAG), ) { - Text( - text = stringResource(R.string.save), - ) + Text(text = stringResource(R.string.save)) } } @@ -212,10 +207,8 @@ private fun LazyListScope.content( onExpand: (RelayItem.Location, expand: Boolean) -> Unit, onRelaySelectedChanged: (RelayItem.Location, selected: Boolean) -> Unit, ) { - itemsIndexed( - uiState.locations, - key = { index, listItem -> listItem.item.id }, - ) { index, listItem -> + itemsIndexed(uiState.locations, key = { index, listItem -> listItem.item.id }) { index, listItem + -> Column(modifier = Modifier.animateItem()) { if (index != 0) { HorizontalDivider() diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/CustomListsScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/CustomListsScreen.kt index d2a66e9a3e0d..9fc0dff01855 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/CustomListsScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/CustomListsScreen.kt @@ -63,7 +63,7 @@ private fun PreviewCustomListsScreen() { fun CustomLists( navigator: DestinationsNavigator, editCustomListResultRecipient: - ResultRecipient + ResultRecipient, ) { val viewModel = koinViewModel() val state by viewModel.uiState.collectAsStateWithLifecycle() @@ -82,11 +82,11 @@ fun CustomLists( message = context.getString( R.string.delete_custom_list_message, - result.value.customListName + result.value.customListName, ), actionLabel = context.getString(R.string.undo), duration = SnackbarDuration.Long, - onAction = { viewModel.undoDeleteCustomList(result.value.undo) } + onAction = { viewModel.undoDeleteCustomList(result.value.undo) }, ) } } @@ -95,19 +95,12 @@ fun CustomLists( CustomListsScreen( state = state, snackbarHostState = snackbarHostState, - addCustomList = - dropUnlessResumed { - navigator.navigate( - CreateCustomListDestination(null), - ) - }, + addCustomList = dropUnlessResumed { navigator.navigate(CreateCustomListDestination(null)) }, openCustomList = dropUnlessResumed { customList -> - navigator.navigate( - EditCustomListDestination(customListId = customList.id), - ) + navigator.navigate(EditCustomListDestination(customListId = customList.id)) }, - onBackClick = dropUnlessResumed { navigator.navigateUp() } + onBackClick = dropUnlessResumed { navigator.navigateUp() }, ) } @@ -117,7 +110,7 @@ fun CustomListsScreen( snackbarHostState: SnackbarHostState, addCustomList: () -> Unit = {}, openCustomList: (CustomList) -> Unit = {}, - onBackClick: () -> Unit = {} + onBackClick: () -> Unit = {}, ) { ScaffoldWithMediumTopBar( appBarTitle = stringResource(id = R.string.edit_custom_lists), @@ -125,16 +118,16 @@ fun CustomListsScreen( actions = { IconButton( onClick = addCustomList, - modifier = Modifier.testTag(NEW_LIST_BUTTON_TEST_TAG) + modifier = Modifier.testTag(NEW_LIST_BUTTON_TEST_TAG), ) { Icon( painterResource(id = R.drawable.ic_icons_add), tint = MaterialTheme.colorScheme.onSurface, - contentDescription = stringResource(id = R.string.new_list) + contentDescription = stringResource(id = R.string.new_list), ) } }, - snackbarHostState = snackbarHostState + snackbarHostState = snackbarHostState, ) { modifier: Modifier, lazyListState: LazyListState -> LazyColumn( modifier = modifier, @@ -167,16 +160,16 @@ private fun LazyListScope.loading() { private fun LazyListScope.content( customLists: List, - openCustomList: (CustomList) -> Unit + openCustomList: (CustomList) -> Unit, ) { itemsWithDivider( items = customLists, key = { item: CustomList -> item.id }, - contentType = { ContentType.ITEM } + contentType = { ContentType.ITEM }, ) { customList -> NavigationComposeCell( title = customList.name.value, - onClick = { openCustomList(customList) } + onClick = { openCustomList(customList) }, ) } } @@ -187,7 +180,7 @@ private fun LazyListScope.empty() { text = stringResource(R.string.no_custom_lists_available), modifier = Modifier.padding(Dimens.screenVerticalMargin), style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant + color = MaterialTheme.colorScheme.onSurfaceVariant, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/DeviceListScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/DeviceListScreen.kt index 9764ad83a122..ba3f80536363 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/DeviceListScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/DeviceListScreen.kt @@ -106,7 +106,7 @@ data class DeviceListNavArgs(val accountNumber: AccountNumber) @Composable fun DeviceList( navigator: DestinationsNavigator, - confirmRemoveResultRecipient: ResultRecipient + confirmRemoveResultRecipient: ResultRecipient, ) { val viewModel = koinViewModel() val state by viewModel.uiState.collectAsStateWithLifecycle() @@ -126,7 +126,7 @@ fun DeviceList( val context = LocalContext.current CollectSideEffectWithLifecycle( viewModel.uiSideEffect, - minActiveState = Lifecycle.State.RESUMED + minActiveState = Lifecycle.State.RESUMED, ) { sideEffect -> when (sideEffect) { DeviceListSideEffect.FailedToRemoveDevice -> { @@ -154,7 +154,7 @@ fun DeviceList( navigateToRemoveDeviceConfirmationDialog = dropUnlessResumed { navigator.navigate(RemoveDeviceConfirmationDestination(it)) - } + }, ) } @@ -166,7 +166,7 @@ fun DeviceListScreen( onContinueWithLogin: () -> Unit = {}, onSettingsClicked: () -> Unit = {}, onTryAgainClicked: () -> Unit = {}, - navigateToRemoveDeviceConfirmationDialog: (device: Device) -> Unit = {} + navigateToRemoveDeviceConfirmationDialog: (device: Device) -> Unit = {}, ) { ScaffoldWithTopBar( @@ -174,18 +174,16 @@ fun DeviceListScreen( iconTintColor = MaterialTheme.colorScheme.onPrimary, onSettingsClicked = onSettingsClicked, onAccountClicked = null, - snackbarHostState = snackbarHostState + snackbarHostState = snackbarHostState, ) { - Column( - modifier = Modifier.fillMaxSize().padding(it), - ) { + Column(modifier = Modifier.fillMaxSize().padding(it)) { val scrollState = rememberScrollState() Column( modifier = Modifier.drawVerticalScrollbar(scrollState, MaterialTheme.colorScheme.onSurface) .verticalScroll(scrollState) .weight(1f) - .fillMaxWidth(), + .fillMaxWidth() ) { DeviceListHeader(state) when (state) { @@ -193,7 +191,7 @@ fun DeviceListScreen( DeviceListContent( state, navigateToRemoveDeviceConfirmationDialog = - navigateToRemoveDeviceConfirmationDialog + navigateToRemoveDeviceConfirmationDialog, ) is DeviceListUiState.Error -> DeviceListError(onTryAgainClicked) DeviceListUiState.Loading -> {} @@ -209,7 +207,7 @@ private fun ColumnScope.DeviceListError(tryAgain: () -> Unit) { Column(Modifier.weight(1f), verticalArrangement = Arrangement.Center) { Text( text = stringResource(id = R.string.failed_to_fetch_devices), - modifier = Modifier.padding(Dimens.smallPadding).align(Alignment.CenterHorizontally) + modifier = Modifier.padding(Dimens.smallPadding).align(Alignment.CenterHorizontally), ) PrimaryButton( onClick = tryAgain, @@ -218,8 +216,8 @@ private fun ColumnScope.DeviceListError(tryAgain: () -> Unit) { Modifier.padding( top = Dimens.buttonSpacing, start = Dimens.sideMargin, - end = Dimens.sideMargin - ) + end = Dimens.sideMargin, + ), ) } } @@ -227,13 +225,10 @@ private fun ColumnScope.DeviceListError(tryAgain: () -> Unit) { @Composable private fun ColumnScope.DeviceListContent( state: DeviceListUiState.Content, - navigateToRemoveDeviceConfirmationDialog: (Device) -> Unit + navigateToRemoveDeviceConfirmationDialog: (Device) -> Unit, ) { state.devices.forEachIndexed { index, (device, loading) -> - DeviceListItem( - device = device, - isLoading = loading, - ) { + DeviceListItem(device = device, isLoading = loading) { navigateToRemoveDeviceConfirmationDialog(device) } if (state.devices.lastIndex != index) { @@ -260,7 +255,7 @@ private fun ColumnScope.DeviceListHeader(state: DeviceListUiState) { modifier = Modifier.align(Alignment.CenterHorizontally) .padding(top = Dimens.iconFailSuccessTopMargin) - .size(Dimens.bigIconSize) + .size(Dimens.bigIconSize), ) is DeviceListUiState.Error -> Image( @@ -269,7 +264,7 @@ private fun ColumnScope.DeviceListHeader(state: DeviceListUiState) { modifier = Modifier.align(Alignment.CenterHorizontally) .padding(top = Dimens.iconFailSuccessTopMargin) - .size(Dimens.bigIconSize) + .size(Dimens.bigIconSize), ) DeviceListUiState.Loading -> MullvadCircularProgressIndicatorLarge( @@ -295,7 +290,7 @@ private fun ColumnScope.DeviceListHeader(state: DeviceListUiState) { Modifier.padding( start = Dimens.sideMargin, end = Dimens.sideMargin, - top = Dimens.screenVerticalMargin + top = Dimens.screenVerticalMargin, ), ) @@ -319,8 +314,8 @@ private fun ColumnScope.DeviceListHeader(state: DeviceListUiState) { top = Dimens.smallPadding, start = Dimens.sideMargin, end = Dimens.sideMargin, - bottom = Dimens.spacingAboveButton - ) + bottom = Dimens.spacingAboveButton, + ), ) } } @@ -335,14 +330,14 @@ private fun DeviceListItem(device: Device, isLoading: Boolean, onDeviceRemovalCl modifier = Modifier.fillMaxWidth(), text = device.displayName(), style = MaterialTheme.typography.listItemText, - color = MaterialTheme.colorScheme.onPrimary + color = MaterialTheme.colorScheme.onPrimary, ) Text( modifier = Modifier.fillMaxWidth(), text = stringResource(id = R.string.created_x, device.creationDate.formatDate()), style = MaterialTheme.typography.listItemSubText, - color = MaterialTheme.colorScheme.onSurfaceVariant + color = MaterialTheme.colorScheme.onSurfaceVariant, ) } }, @@ -357,7 +352,7 @@ private fun DeviceListItem(device: Device, isLoading: Boolean, onDeviceRemovalCl painter = painterResource(id = R.drawable.icon_close), contentDescription = stringResource(id = R.string.remove_button), tint = MaterialTheme.colorScheme.onPrimary, - modifier = Modifier.size(size = Dimens.deleteIconSize) + modifier = Modifier.size(size = Dimens.deleteIconSize), ) } } @@ -370,7 +365,7 @@ private fun DeviceListItem(device: Device, isLoading: Boolean, onDeviceRemovalCl private fun DeviceListButtonPanel( state: DeviceListUiState, onContinueWithLogin: () -> Unit, - onBackClick: () -> Unit + onBackClick: () -> Unit, ) { Column( modifier = @@ -378,20 +373,20 @@ private fun DeviceListButtonPanel( start = Dimens.sideMargin, end = Dimens.sideMargin, top = Dimens.spacingAboveButton, - bottom = Dimens.screenVerticalMargin + bottom = Dimens.screenVerticalMargin, ) ) { VariantButton( text = stringResource(id = R.string.continue_login), onClick = onContinueWithLogin, isEnabled = state is DeviceListUiState.Content && !state.hasTooManyDevices, - background = MaterialTheme.colorScheme.selected + background = MaterialTheme.colorScheme.selected, ) PrimaryButton( text = stringResource(id = R.string.back), onClick = onBackClick, - modifier = Modifier.padding(top = Dimens.buttonSpacing) + modifier = Modifier.padding(top = Dimens.buttonSpacing), ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/DeviceRevokedScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/DeviceRevokedScreen.kt index dca033234944..7408e51e5f1e 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/DeviceRevokedScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/DeviceRevokedScreen.kt @@ -64,7 +64,7 @@ fun DeviceRevoked(navigator: DestinationsNavigator) { DeviceRevokedScreen( state = state, onSettingsClicked = dropUnlessResumed { navigator.navigate(SettingsDestination) }, - onGoToLoginClicked = viewModel::onGoToLoginClicked + onGoToLoginClicked = viewModel::onGoToLoginClicked, ) } @@ -72,7 +72,7 @@ fun DeviceRevoked(navigator: DestinationsNavigator) { fun DeviceRevokedScreen( state: DeviceRevokedUiState, onSettingsClicked: () -> Unit = {}, - onGoToLoginClicked: () -> Unit = {} + onGoToLoginClicked: () -> Unit = {}, ) { val topColor = if (state == DeviceRevokedUiState.SECURED) { @@ -84,7 +84,7 @@ fun DeviceRevokedScreen( ScaffoldWithTopBar( topBarColor = topColor, onSettingsClicked = onSettingsClicked, - onAccountClicked = null + onAccountClicked = null, ) { ConstraintLayout( modifier = @@ -104,7 +104,7 @@ fun DeviceRevokedScreen( end.linkTo(parent.end) } .padding(horizontal = 12.dp) - .size(Dimens.bigIconSize) + .size(Dimens.bigIconSize), ) Column( @@ -114,20 +114,20 @@ fun DeviceRevokedScreen( start.linkTo(parent.start, margin = 22.dp) end.linkTo(parent.end, margin = 22.dp) width = Dimension.fillToConstraints - }, + } ) { Text( text = stringResource(id = R.string.device_inactive_title), fontSize = 24.sp, color = MaterialTheme.colorScheme.onSurface, - fontWeight = FontWeight.Bold + fontWeight = FontWeight.Bold, ) Text( text = stringResource(id = R.string.device_inactive_description), fontSize = 12.sp, color = MaterialTheme.colorScheme.onSurface, - modifier = Modifier.padding(top = 10.dp) + modifier = Modifier.padding(top = 10.dp), ) if (state == DeviceRevokedUiState.SECURED) { @@ -135,7 +135,7 @@ fun DeviceRevokedScreen( text = stringResource(id = R.string.device_inactive_unblock_warning), fontSize = 12.sp, color = MaterialTheme.colorScheme.onSurface, - modifier = Modifier.padding(top = 10.dp) + modifier = Modifier.padding(top = 10.dp), ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/EditApiAccessMethodScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/EditApiAccessMethodScreen.kt index 270201f943b5..57220d999ece 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/EditApiAccessMethodScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/EditApiAccessMethodScreen.kt @@ -86,7 +86,7 @@ data class EditApiAccessMethodNavArgs(val accessMethodId: ApiAccessMethodId?) @Destination( style = SlideInFromRightTransition::class, - navArgs = EditApiAccessMethodNavArgs::class + navArgs = EditApiAccessMethodNavArgs::class, ) @Composable fun EditApiAccessMethod( @@ -108,7 +108,7 @@ fun EditApiAccessMethod( SaveApiAccessMethodDestination( id = it.id, name = it.name, - customProxy = it.customProxy + customProxy = it.customProxy, ) ) { launchSingleTop = true @@ -158,7 +158,7 @@ fun EditApiAccessMethod( message = context.getString(R.string.testing), duration = SnackbarDuration.Indefinite, actionLabel = context.getString(R.string.cancel), - onAction = viewModel::cancelTestMethod + onAction = viewModel::cancelTestMethod, ) } } @@ -183,7 +183,7 @@ fun EditApiAccessMethod( } else { navigator.navigateUp() } - } + }, ) } @@ -201,7 +201,7 @@ fun EditApiAccessMethodScreen( onUsernameChanged: (String) -> Unit = {}, onTestMethod: () -> Unit = {}, onAddMethod: () -> Unit = {}, - onNavigateBack: () -> Unit = {} + onNavigateBack: () -> Unit = {}, ) { ScaffoldWithSmallTopBar( snackbarHostState = snackbarHostState, @@ -221,7 +221,7 @@ fun EditApiAccessMethodScreen( modifier .drawVerticalScrollbar( state = scrollState, - color = MaterialTheme.colorScheme.onSurface.copy(alpha = AlphaScrollbar) + color = MaterialTheme.colorScheme.onSurface.copy(alpha = AlphaScrollbar), ) .verticalScroll(scrollState) .padding(horizontal = Dimens.sideMargin, vertical = Dimens.screenVerticalMargin) @@ -232,7 +232,7 @@ fun EditApiAccessMethodScreen( NameInputField( name = state.formData.name, nameError = state.formData.nameError, - onNameChanged = onNameChanged + onNameChanged = onNameChanged, ) Spacer(modifier = Modifier.height(Dimens.verticalSpace)) ApiAccessMethodTypeSelection(state.formData, onTypeSelected) @@ -244,7 +244,7 @@ fun EditApiAccessMethodScreen( onIpChanged = onIpChanged, onPortChanged = onPortChanged, onPasswordChanged = onPasswordChanged, - onCipherChange = onCipherChange + onCipherChange = onCipherChange, ) ApiAccessMethodTypes.SOCKS5_REMOTE -> Socks5RemoteForm( @@ -253,7 +253,7 @@ fun EditApiAccessMethodScreen( onPortChanged = onPortChanged, onToggleAuthenticationEnabled = onToggleAuthenticationEnabled, onUsernameChanged = onUsernameChanged, - onPasswordChanged = onPasswordChanged + onPasswordChanged = onPasswordChanged, ) } Spacer(modifier = Modifier.weight(1f)) @@ -261,10 +261,10 @@ fun EditApiAccessMethodScreen( modifier = Modifier.padding( bottom = Dimens.verticalSpace, - top = Dimens.largePadding + top = Dimens.largePadding, ), isTesting = state.isTestingApiAccessMethod, - onTestMethod = onTestMethod + onTestMethod = onTestMethod, ) AddMethodButton(isNew = !state.editMode, onAddMethod = onAddMethod) } @@ -282,7 +282,7 @@ private fun ColumnScope.Loading() { private fun NameInputField( name: String, nameError: InvalidDataError.NameError?, - onNameChanged: (String) -> Unit + onNameChanged: (String) -> Unit, ) { ApiAccessMethodTextField( value = name, @@ -294,20 +294,20 @@ private fun NameInputField( maxCharLength = ApiAccessMethodName.MAX_LENGTH, errorText = nameError?.let { textResource(id = R.string.this_field_is_required) }, capitalization = KeyboardCapitalization.Words, - modifier = Modifier.animateContentSize().testTag(EDIT_API_ACCESS_NAME_INPUT) + modifier = Modifier.animateContentSize().testTag(EDIT_API_ACCESS_NAME_INPUT), ) } @Composable private fun ApiAccessMethodTypeSelection( formData: EditApiAccessFormData, - onTypeSelected: (ApiAccessMethodTypes) -> Unit + onTypeSelected: (ApiAccessMethodTypes) -> Unit, ) { MullvadExposedDropdownMenuBox( modifier = Modifier.padding(vertical = Dimens.miniPadding), label = stringResource(id = R.string.type), title = formData.apiAccessMethodTypes.text(), - colors = apiAccessTextFieldColors() + colors = apiAccessTextFieldColors(), ) { close -> ApiAccessMethodTypes.entries.forEach { MullvadDropdownMenuItem( @@ -325,9 +325,9 @@ private fun ApiAccessMethodTypeSelection( .alpha( if (it == formData.apiAccessMethodTypes) AlphaVisible else AlphaInvisible - ) + ), ) - } + }, ) } } @@ -339,19 +339,19 @@ private fun ShadowsocksForm( onIpChanged: (String) -> Unit, onPortChanged: (String) -> Unit, onPasswordChanged: (String) -> Unit, - onCipherChange: (Cipher) -> Unit + onCipherChange: (Cipher) -> Unit, ) { ServerIpInput( serverIp = formData.serverIp, serverIpError = formData.serverIpError, - onIpChanged = onIpChanged + onIpChanged = onIpChanged, ) PortInput(port = formData.port, formData.portError, onPortChanged = onPortChanged) PasswordInput( password = formData.password, passwordError = formData.passwordError, optional = true, - onPasswordChanged = onPasswordChanged + onPasswordChanged = onPasswordChanged, ) CipherSelection(cipher = formData.cipher, onCipherChange = onCipherChange) } @@ -363,12 +363,12 @@ private fun Socks5RemoteForm( onPortChanged: (String) -> Unit, onToggleAuthenticationEnabled: (Boolean) -> Unit, onUsernameChanged: (String) -> Unit, - onPasswordChanged: (String) -> Unit + onPasswordChanged: (String) -> Unit, ) { ServerIpInput( serverIp = formData.serverIp, serverIpError = formData.serverIpError, - onIpChanged = onIpChanged + onIpChanged = onIpChanged, ) PortInput(port = formData.port, portError = formData.portError, onPortChanged = onPortChanged) EnableAuthentication(formData.enableAuthentication, onToggleAuthenticationEnabled) @@ -382,7 +382,7 @@ private fun Socks5RemoteForm( password = formData.password, passwordError = formData.passwordError, optional = false, - onPasswordChanged = onPasswordChanged + onPasswordChanged = onPasswordChanged, ) } } @@ -391,7 +391,7 @@ private fun Socks5RemoteForm( private fun ServerIpInput( serverIp: String, serverIpError: InvalidDataError.ServerIpError?, - onIpChanged: (String) -> Unit + onIpChanged: (String) -> Unit, ) { ApiAccessMethodTextField( value = serverIp, @@ -412,7 +412,7 @@ private fun ServerIpInput( } ) }, - modifier = Modifier.animateContentSize() + modifier = Modifier.animateContentSize(), ) } @@ -420,7 +420,7 @@ private fun ServerIpInput( private fun PortInput( port: String, portError: InvalidDataError.PortError?, - onPortChanged: (String) -> Unit + onPortChanged: (String) -> Unit, ) { ApiAccessMethodTextField( value = port, @@ -440,7 +440,7 @@ private fun PortInput( } ) }, - modifier = Modifier.animateContentSize() + modifier = Modifier.animateContentSize(), ) } @@ -449,7 +449,7 @@ private fun PasswordInput( password: String, passwordError: InvalidDataError.PasswordError?, optional: Boolean, - onPasswordChanged: (String) -> Unit + onPasswordChanged: (String) -> Unit, ) { ApiAccessMethodTextField( value = password, @@ -474,7 +474,7 @@ private fun PasswordInput( ImeAction.Done }, errorText = passwordError?.let { textResource(id = R.string.this_field_is_required) }, - modifier = Modifier.animateContentSize() + modifier = Modifier.animateContentSize(), ) } @@ -484,7 +484,7 @@ private fun CipherSelection(cipher: Cipher, onCipherChange: (Cipher) -> Unit) { modifier = Modifier.padding(vertical = Dimens.miniPadding), label = stringResource(id = R.string.cipher), title = cipher.label, - colors = apiAccessTextFieldColors() + colors = apiAccessTextFieldColors(), ) { close -> Cipher.listAll().forEach { MullvadDropdownMenuItem( @@ -499,9 +499,9 @@ private fun CipherSelection(cipher: Cipher, onCipherChange: (Cipher) -> Unit) { contentDescription = null, modifier = Modifier.padding(end = Dimens.selectableCellTextMargin) - .alpha(if (it == cipher) AlphaVisible else AlphaInvisible) + .alpha(if (it == cipher) AlphaVisible else AlphaInvisible), ) - } + }, ) } } @@ -510,7 +510,7 @@ private fun CipherSelection(cipher: Cipher, onCipherChange: (Cipher) -> Unit) { @Composable private fun EnableAuthentication( authenticationEnabled: Boolean, - onToggleAuthenticationEnabled: (Boolean) -> Unit + onToggleAuthenticationEnabled: (Boolean) -> Unit, ) { MullvadExposedDropdownMenuBox( modifier = Modifier.padding(vertical = Dimens.miniPadding), @@ -524,7 +524,7 @@ private fun EnableAuthentication( R.string.off } ), - colors = apiAccessTextFieldColors() + colors = apiAccessTextFieldColors(), ) { close -> MullvadDropdownMenuItem( text = stringResource(id = R.string.on), @@ -538,9 +538,9 @@ private fun EnableAuthentication( contentDescription = null, modifier = Modifier.padding(end = Dimens.selectableCellTextMargin) - .alpha(if (authenticationEnabled) AlphaVisible else AlphaInvisible) + .alpha(if (authenticationEnabled) AlphaVisible else AlphaInvisible), ) - } + }, ) MullvadDropdownMenuItem( text = stringResource(id = R.string.off), @@ -556,9 +556,9 @@ private fun EnableAuthentication( Modifier.padding(end = Dimens.selectableCellTextMargin) .alpha( if (authenticationEnabled.not()) AlphaVisible else AlphaInvisible - ) + ), ) - } + }, ) } } @@ -567,7 +567,7 @@ private fun EnableAuthentication( private fun UsernameInput( username: String, usernameError: InvalidDataError.UserNameError?, - onUsernameChanged: (String) -> Unit + onUsernameChanged: (String) -> Unit, ) { ApiAccessMethodTextField( value = username, @@ -577,7 +577,7 @@ private fun UsernameInput( isValidValue = usernameError == null, isDigitsOnlyAllowed = false, errorText = usernameError?.let { textResource(id = R.string.this_field_is_required) }, - modifier = Modifier.animateContentSize() + modifier = Modifier.animateContentSize(), ) } @@ -593,7 +593,7 @@ private fun AddMethodButton(isNew: Boolean, onAddMethod: () -> Unit) { } else { R.string.save } - ) + ), ) } @@ -604,5 +604,5 @@ private fun ApiAccessMethodTypes.text(): String = when (this) { ApiAccessMethodTypes.SHADOWSOCKS -> R.string.shadowsocks ApiAccessMethodTypes.SOCKS5_REMOTE -> R.string.socks5_remote - }, + } ) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/EditCustomListScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/EditCustomListScreen.kt index 5a86dad098ec..0c79b06d1716 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/EditCustomListScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/EditCustomListScreen.kt @@ -69,7 +69,7 @@ private fun PreviewEditCustomListScreen() { GeoLocationId.City(GeoLocationId.Country("country"), code = "city"), "hostname", ) - ) + ), ) ) } @@ -80,13 +80,13 @@ data class EditCustomListNavArgs(val customListId: CustomListId) @Composable @Destination( style = SlideInFromRightTransition::class, - navArgs = EditCustomListNavArgs::class + navArgs = EditCustomListNavArgs::class, ) fun EditCustomList( navigator: DestinationsNavigator, backNavigator: ResultBackNavigator, confirmDeleteListResultRecipient: - ResultRecipient + ResultRecipient, ) { val viewModel = koinViewModel() @@ -105,23 +105,21 @@ fun EditCustomList( state = state, onDeleteList = dropUnlessResumed { id, name -> - navigator.navigate( - DeleteCustomListDestination(customListId = id, name = name), - ) + navigator.navigate(DeleteCustomListDestination(customListId = id, name = name)) }, onNameClicked = dropUnlessResumed { id, name -> navigator.navigate( - EditCustomListNameDestination(customListId = id, initialName = name), + EditCustomListNameDestination(customListId = id, initialName = name) ) }, onLocationsClicked = dropUnlessResumed { id -> navigator.navigate( - CustomListLocationsDestination(customListId = id, newList = false), + CustomListLocationsDestination(customListId = id, newList = false) ) }, - onBackClick = dropUnlessResumed { backNavigator.navigateBack() } + onBackClick = dropUnlessResumed { backNavigator.navigateBack() }, ) } @@ -131,7 +129,7 @@ fun EditCustomListScreen( onDeleteList: (id: CustomListId, name: CustomListName) -> Unit = { _, _ -> }, onNameClicked: (id: CustomListId, name: CustomListName) -> Unit = { _, _ -> }, onLocationsClicked: (CustomListId) -> Unit = {}, - onBackClick: () -> Unit = {} + onBackClick: () -> Unit = {}, ) { ScaffoldWithMediumTopBar( appBarTitle = stringResource(id = R.string.edit_list), @@ -144,7 +142,7 @@ fun EditCustomListScreen( if (content is EditCustomListState.Content) { onDeleteList(content.id, content.name) } - } + }, ) }, ) { modifier: Modifier -> @@ -160,7 +158,7 @@ fun EditCustomListScreen( text = stringResource(id = R.string.not_found), modifier = Modifier.padding(Dimens.screenVerticalMargin), style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onSurface + color = MaterialTheme.colorScheme.onSurface, ) } is EditCustomListState.Content -> { @@ -168,7 +166,7 @@ fun EditCustomListScreen( TwoRowCell( titleText = stringResource(id = R.string.list_name), subtitleText = state.name.value, - onCellClicked = { onNameClicked(state.id, state.name) } + onCellClicked = { onNameClicked(state.id, state.name) }, ) // Locations cell TwoRowCell( @@ -177,9 +175,9 @@ fun EditCustomListScreen( pluralStringResource( id = R.plurals.number_of_locations, state.locations.size, - state.locations.size + state.locations.size, ), - onCellClicked = { onLocationsClicked(state.id) } + onCellClicked = { onLocationsClicked(state.id) }, ) } } @@ -192,14 +190,14 @@ private fun Actions(enabled: Boolean, onDeleteList: () -> Unit) { var showMenu by remember { mutableStateOf(false) } IconButton( onClick = { showMenu = true }, - modifier = Modifier.testTag(TOP_BAR_DROPDOWN_BUTTON_TEST_TAG) + modifier = Modifier.testTag(TOP_BAR_DROPDOWN_BUTTON_TEST_TAG), ) { Icon(painter = painterResource(id = R.drawable.icon_more_vert), contentDescription = null) if (showMenu) { DropdownMenu( expanded = true, onDismissRequest = { showMenu = false }, - modifier = Modifier.background(MaterialTheme.colorScheme.surfaceContainer) + modifier = Modifier.background(MaterialTheme.colorScheme.surfaceContainer), ) { DropdownMenuItem( text = { Text(text = stringResource(id = R.string.delete_list)) }, @@ -215,7 +213,7 @@ private fun Actions(enabled: Boolean, onDeleteList: () -> Unit) { showMenu = false }, enabled = enabled, - modifier = Modifier.testTag(DELETE_DROPDOWN_MENU_ITEM_TEST_TAG) + modifier = Modifier.testTag(DELETE_DROPDOWN_MENU_ITEM_TEST_TAG), ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreen.kt index 3b5214514b32..61f865b9ec14 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreen.kt @@ -86,7 +86,7 @@ fun Filter(navigator: DestinationsNavigator) { onApplyClick = viewModel::onApplyButtonClicked, onSelectedOwnership = viewModel::setSelectedOwnership, onAllProviderCheckChange = viewModel::setAllProviders, - onSelectedProvider = viewModel::setSelectedProvider + onSelectedProvider = viewModel::setSelectedProvider, ) } @@ -97,7 +97,7 @@ fun FilterScreen( onApplyClick: () -> Unit = {}, onSelectedOwnership: (ownership: Ownership?) -> Unit = {}, onAllProviderCheckChange: (isChecked: Boolean) -> Unit = {}, - onSelectedProvider: (checked: Boolean, provider: Provider) -> Unit = { _, _ -> } + onSelectedProvider: (checked: Boolean, provider: Provider) -> Unit = { _, _ -> }, ) { var providerExpanded by rememberSaveable { mutableStateOf(false) } var ownershipExpanded by rememberSaveable { mutableStateOf(false) } @@ -110,7 +110,7 @@ fun FilterScreen( BottomBar( isApplyButtonEnabled = state.isApplyButtonEnabled, backgroundColor = backgroundColor, - onApplyClick = onApplyClick + onApplyClick = onApplyClick, ) }, ) { contentPadding -> @@ -125,7 +125,7 @@ fun FilterScreen( itemsWithDivider( key = { it.name }, contentType = { ContentType.ITEM }, - items = state.filteredOwnershipByProviders + items = state.filteredOwnershipByProviders, ) { ownership -> Ownership(ownership, state, onSelectedOwnership) } @@ -140,7 +140,7 @@ fun FilterScreen( itemsWithDivider( key = { it.providerId.value }, contentType = { ContentType.ITEM }, - items = state.filteredProvidersByOwnership + items = state.filteredProvidersByOwnership, ) { provider -> Provider(provider, state, onSelectedProvider) } @@ -157,20 +157,20 @@ private fun LazyItemScope.OwnershipHeader(expanded: Boolean, onToggleExpanded: ( isEnabled = true, onInfoClicked = null, onCellClicked = { onToggleExpanded(!expanded) }, - modifier = Modifier.animateItem() + modifier = Modifier.animateItem(), ) } @Composable private fun LazyItemScope.AnyOwnership( state: RelayFilterState, - onSelectedOwnership: (ownership: Ownership?) -> Unit + onSelectedOwnership: (ownership: Ownership?) -> Unit, ) { SelectableCell( title = stringResource(id = R.string.any), isSelected = state.selectedOwnership == null, onCellClicked = { onSelectedOwnership(null) }, - modifier = Modifier.animateItem() + modifier = Modifier.animateItem(), ) } @@ -178,13 +178,13 @@ private fun LazyItemScope.AnyOwnership( private fun LazyItemScope.Ownership( ownership: Ownership, state: RelayFilterState, - onSelectedOwnership: (ownership: Ownership?) -> Unit + onSelectedOwnership: (ownership: Ownership?) -> Unit, ) { SelectableCell( title = stringResource(id = ownership.stringResource()), isSelected = ownership == state.selectedOwnership, onCellClicked = { onSelectedOwnership(ownership) }, - modifier = Modifier.animateItem() + modifier = Modifier.animateItem(), ) } @@ -196,20 +196,20 @@ private fun LazyItemScope.ProvidersHeader(expanded: Boolean, onToggleExpanded: ( isEnabled = true, onInfoClicked = null, onCellClicked = { onToggleExpanded(!expanded) }, - modifier = Modifier.animateItem() + modifier = Modifier.animateItem(), ) } @Composable private fun LazyItemScope.AllProviders( state: RelayFilterState, - onAllProviderCheckChange: (isChecked: Boolean) -> Unit + onAllProviderCheckChange: (isChecked: Boolean) -> Unit, ) { CheckboxCell( title = stringResource(R.string.all_providers), checked = state.isAllProvidersChecked, onCheckedChange = { isChecked -> onAllProviderCheckChange(isChecked) }, - modifier = Modifier.animateItem() + modifier = Modifier.animateItem(), ) } @@ -217,13 +217,13 @@ private fun LazyItemScope.AllProviders( private fun LazyItemScope.Provider( provider: Provider, state: RelayFilterState, - onSelectedProvider: (checked: Boolean, provider: Provider) -> Unit + onSelectedProvider: (checked: Boolean, provider: Provider) -> Unit, ) { CheckboxCell( title = provider.providerId.value, checked = provider in state.selectedProviders, onCheckedChange = { checked -> onSelectedProvider(checked, provider) }, - modifier = Modifier.animateItem() + modifier = Modifier.animateItem(), ) } @@ -242,7 +242,7 @@ private fun TopBar(onBackClick: () -> Unit) { modifier = Modifier.weight(1f).padding(end = Dimens.titleIconSize), textAlign = TextAlign.Center, style = MaterialTheme.typography.titleLarge, - color = MaterialTheme.colorScheme.onSurface + color = MaterialTheme.colorScheme.onSurface, ) } } @@ -251,14 +251,14 @@ private fun TopBar(onBackClick: () -> Unit) { private fun BottomBar( isApplyButtonEnabled: Boolean, backgroundColor: Color, - onApplyClick: () -> Unit + onApplyClick: () -> Unit, ) { Box( modifier = Modifier.fillMaxWidth() .background(color = backgroundColor) .padding(top = Dimens.screenVerticalMargin), - contentAlignment = Alignment.BottomCenter + contentAlignment = Alignment.BottomCenter, ) { ApplyButton( onClick = onApplyClick, @@ -267,7 +267,7 @@ private fun BottomBar( Modifier.padding( start = Dimens.sideMargin, end = Dimens.sideMargin, - bottom = Dimens.screenVerticalMargin + bottom = Dimens.screenVerticalMargin, ), ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ImportOverridesByTextScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ImportOverridesByTextScreen.kt index 6623886578ab..9a5e34c285f1 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ImportOverridesByTextScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ImportOverridesByTextScreen.kt @@ -38,20 +38,15 @@ private fun PreviewImportOverridesByText() { @Destination(style = DefaultTransition::class) @Composable -fun ImportOverridesByText( - resultNavigator: ResultBackNavigator, -) { +fun ImportOverridesByText(resultNavigator: ResultBackNavigator) { ImportOverridesByTextScreen( onNavigateBack = dropUnlessResumed { resultNavigator.navigateBack() }, - onImportClicked = { resultNavigator.navigateBack(result = it) } + onImportClicked = { resultNavigator.navigateBack(result = it) }, ) } @Composable -fun ImportOverridesByTextScreen( - onNavigateBack: () -> Unit, - onImportClicked: (String) -> Unit, -) { +fun ImportOverridesByTextScreen(onNavigateBack: () -> Unit, onImportClicked: (String) -> Unit) { var text by remember { mutableStateOf("") } Scaffold( @@ -69,15 +64,13 @@ fun ImportOverridesByTextScreen( colors = ButtonDefaults.textButtonColors() .copy(contentColor = MaterialTheme.colorScheme.onPrimary), - onClick = dropUnlessResumed { onImportClicked(text) } + onClick = dropUnlessResumed { onImportClicked(text) }, ) { - Text( - text = stringResource(R.string.import_overrides_import), - ) + Text(text = stringResource(R.string.import_overrides_import)) } - } + }, ) - }, + } ) { Column(modifier = Modifier.padding(it)) { TextField( @@ -87,7 +80,7 @@ fun ImportOverridesByTextScreen( placeholder = { Text(text = stringResource(R.string.import_override_textfield_placeholder)) }, - colors = mullvadWhiteTextFieldColors() + colors = mullvadWhiteTextFieldColors(), ) } } 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 1758a31432d4..e5a59a263554 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 @@ -117,7 +117,7 @@ private fun PreviewLoginSuccess() { fun Login( navigator: DestinationsNavigator, accountNumber: String? = null, - vm: LoginViewModel = koinViewModel() + vm: LoginViewModel = koinViewModel(), ) { val state by vm.uiState.collectAsStateWithLifecycle() @@ -154,7 +154,7 @@ fun Login( } LoginUiSideEffect.GenericError -> snackbarHostState.showSnackbarImmediately( - message = context.getString(R.string.error_occurred), + message = context.getString(R.string.error_occurred) ) } } @@ -165,7 +165,7 @@ fun Login( onCreateAccountClick = vm::createAccount, onDeleteHistoryClick = vm::clearAccountHistory, onAccountNumberChange = vm::onAccountNumberChange, - onSettingsClick = dropUnlessResumed { navigator.navigate(SettingsDestination) } + onSettingsClick = dropUnlessResumed { navigator.navigate(SettingsDestination) }, ) } @@ -200,7 +200,7 @@ private fun LoginScreen( state.loginState, modifier = Modifier.align(Alignment.CenterHorizontally) - .padding(bottom = Dimens.largePadding) + .padding(bottom = Dimens.largePadding), ) LoginContent(state, onAccountNumberChange, onLoginClick, onDeleteHistoryClick) Spacer(modifier = Modifier.weight(3f)) @@ -214,7 +214,7 @@ private fun LoginContent( state: LoginUiState, onAccountNumberChange: (String) -> Unit, onLoginClick: (String) -> Unit, - onDeleteHistoryClick: () -> Unit + onDeleteHistoryClick: () -> Unit, ) { Column(modifier = Modifier.fillMaxWidth().padding(horizontal = Dimens.sideMargin)) { Text( @@ -224,7 +224,7 @@ private fun LoginContent( modifier = Modifier.testTag(LOGIN_TITLE_TEST_TAG) .fillMaxWidth() - .padding(bottom = Dimens.smallPadding) + .padding(bottom = Dimens.smallPadding), ) LoginInput(state, onLoginClick, onAccountNumberChange, onDeleteHistoryClick) @@ -234,7 +234,7 @@ private fun LoginContent( isEnabled = state.loginButtonEnabled, onClick = { onLoginClick(state.accountNumberInput) }, text = stringResource(id = R.string.login_title), - modifier = Modifier.padding(bottom = Dimens.mediumPadding) + modifier = Modifier.padding(bottom = Dimens.mediumPadding), ) } } @@ -245,7 +245,7 @@ private fun ColumnScope.LoginInput( state: LoginUiState, onLoginClick: (String) -> Unit, onAccountNumberChange: (String) -> Unit, - onDeleteHistoryClick: () -> Unit + onDeleteHistoryClick: () -> Unit, ) { Text( modifier = Modifier.padding(bottom = Dimens.smallPadding), @@ -280,14 +280,14 @@ private fun ColumnScope.LoginInput( Text( text = stringResource(id = R.string.login_description), maxLines = 1, - overflow = TextOverflow.Ellipsis + overflow = TextOverflow.Ellipsis, ) }, keyboardActions = KeyboardActions(onDone = { onLoginClick(state.accountNumberInput) }), keyboardOptions = KeyboardOptions( imeAction = if (state.loginButtonEnabled) ImeAction.Done else ImeAction.None, - keyboardType = KeyboardType.NumberPassword + keyboardType = KeyboardType.NumberPassword, ), onValueChange = onAccountNumberChange, singleLine = true, @@ -313,7 +313,7 @@ private fun ColumnScope.LoginInput( } }, enabled = state.loginState is Idle, - onDeleteClick = onDeleteHistoryClick + onDeleteClick = onDeleteHistoryClick, ) } } @@ -327,7 +327,7 @@ private fun LoginIcon(loginState: LoginState, modifier: Modifier = Modifier) { Image( painter = painterResource(id = R.drawable.icon_fail), contentDescription = stringResource(id = R.string.login_fail_title), - contentScale = ContentScale.Inside + contentScale = ContentScale.Inside, ) } else { // If view is Idle, we display empty box to keep the same size as other states @@ -383,7 +383,7 @@ private fun AccountDropDownItem( accountNumber: String, enabled: Boolean, onClick: () -> Unit, - onDeleteClick: () -> Unit + onDeleteClick: () -> Unit, ) { Row( modifier = @@ -391,12 +391,12 @@ private fun AccountDropDownItem( .clip( MaterialTheme.shapes.medium.copy( topStart = CornerSize(0f), - topEnd = CornerSize(0f) + topEnd = CornerSize(0f), ) ) .background(MaterialTheme.colorScheme.background) .height(IntrinsicSize.Min), - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { Box( modifier = @@ -404,7 +404,7 @@ private fun AccountDropDownItem( .fillMaxHeight() .weight(1f) .padding(horizontal = Dimens.mediumPadding, vertical = Dimens.smallPadding), - contentAlignment = Alignment.CenterStart + contentAlignment = Alignment.CenterStart, ) { Text(text = accountNumber, overflow = TextOverflow.Clip) } @@ -423,7 +423,7 @@ private fun CreateAccountPanel(onCreateAccountClick: () -> Unit, isEnabled: Bool Column( Modifier.fillMaxWidth() .background(MaterialTheme.colorScheme.background) - .padding(horizontal = Dimens.sideMargin, vertical = Dimens.screenVerticalMargin), + .padding(horizontal = Dimens.sideMargin, vertical = Dimens.screenVerticalMargin) ) { Text( modifier = Modifier.padding(bottom = Dimens.smallPadding), @@ -434,7 +434,7 @@ private fun CreateAccountPanel(onCreateAccountClick: () -> Unit, isEnabled: Bool modifier = Modifier.fillMaxWidth(), text = stringResource(id = R.string.create_account), isEnabled = isEnabled, - onClick = onCreateAccountClick + onClick = onCreateAccountClick, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/NoDaemonScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/NoDaemonScreen.kt index 17aa35770373..d7bebb401620 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/NoDaemonScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/NoDaemonScreen.kt @@ -67,16 +67,16 @@ fun NoDaemonScreen(onNavigateToSettings: () -> Unit) { Modifier.background(backgroundColor) .padding(it) .padding(bottom = it.calculateTopPadding()) - .fillMaxSize() + .fillMaxSize(), ) { Column( verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally + horizontalAlignment = Alignment.CenterHorizontally, ) { Image( painter = painterResource(id = R.drawable.launch_logo), contentDescription = "", - modifier = Modifier.size(Dimens.splashLogoSize) + modifier = Modifier.size(Dimens.splashLogoSize), ) Image( painter = painterResource(id = R.drawable.logo_text), @@ -85,7 +85,7 @@ fun NoDaemonScreen(onNavigateToSettings: () -> Unit) { colorFilter = ColorFilter.tint(color = MaterialTheme.colorScheme.onPrimary), modifier = Modifier.padding(top = Dimens.mediumPadding) - .height(Dimens.splashLogoTextHeight) + .height(Dimens.splashLogoTextHeight), ) Text( text = stringResource(id = R.string.connecting_to_daemon), @@ -94,10 +94,10 @@ fun NoDaemonScreen(onNavigateToSettings: () -> Unit) { modifier = Modifier.padding(top = Dimens.mediumPadding) .padding(horizontal = Dimens.sideMargin), - textAlign = TextAlign.Center + textAlign = TextAlign.Center, ) } } - } + }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/OutOfTimeScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/OutOfTimeScreen.kt index 43730ff164aa..d6ec6c3b7768 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/OutOfTimeScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/OutOfTimeScreen.kt @@ -69,11 +69,7 @@ import org.koin.androidx.compose.koinViewModel private fun PreviewOutOfTimeScreen( @PreviewParameter(OutOfTimeScreenPreviewParameterProvider::class) state: OutOfTimeUiState ) { - AppTheme { - OutOfTimeScreen( - state = state, - ) - } + AppTheme { OutOfTimeScreen(state = state) } } @Destination(style = HomeTransition::class) @@ -81,7 +77,7 @@ private fun PreviewOutOfTimeScreen( fun OutOfTime( navigator: DestinationsNavigator, redeemVoucherResultRecipient: ResultRecipient, - playPaymentResultRecipient: ResultRecipient + playPaymentResultRecipient: ResultRecipient, ) { val vm = koinViewModel() val state by vm.uiState.collectAsStateWithLifecycle() @@ -134,7 +130,7 @@ fun OutOfTime( onPurchaseBillingProductClick = dropUnlessResumed { productId -> navigator.navigate(PaymentDestination(productId)) }, navigateToVerificationPendingDialog = - dropUnlessResumed { navigator.navigate(VerificationPendingDestination) } + dropUnlessResumed { navigator.navigate(VerificationPendingDestination) }, ) } @@ -148,7 +144,7 @@ fun OutOfTimeScreen( onSettingsClick: () -> Unit = {}, onAccountClick: () -> Unit = {}, onPurchaseBillingProductClick: (ProductId) -> Unit = { _ -> }, - navigateToVerificationPendingDialog: () -> Unit = {} + navigateToVerificationPendingDialog: () -> Unit = {}, ) { val scrollState = rememberScrollState() @@ -169,7 +165,7 @@ fun OutOfTimeScreen( onSettingsClicked = onSettingsClick, onAccountClicked = onAccountClick, deviceName = state.deviceName, - timeLeft = null + timeLeft = null, ) { Column( modifier = @@ -178,7 +174,7 @@ fun OutOfTimeScreen( .verticalScroll(scrollState) .drawVerticalScrollbar( state = scrollState, - color = MaterialTheme.colorScheme.onSurface.copy(alpha = AlphaScrollbar) + color = MaterialTheme.colorScheme.onSurface.copy(alpha = AlphaScrollbar), ) .background(color = MaterialTheme.colorScheme.surface) ) { @@ -188,7 +184,7 @@ fun OutOfTimeScreen( modifier = Modifier.align(Alignment.CenterHorizontally) .padding(vertical = Dimens.screenVerticalMargin) - .size(Dimens.bigIconSize) + .size(Dimens.bigIconSize), ) Text( text = stringResource(id = R.string.out_of_time), @@ -196,7 +192,7 @@ fun OutOfTimeScreen( color = MaterialTheme.colorScheme.onSurface, modifier = Modifier.padding(horizontal = Dimens.sideMargin) - .testTag(OUT_OF_TIME_SCREEN_TITLE_TEST_TAG) + .testTag(OUT_OF_TIME_SCREEN_TITLE_TEST_TAG), ) Text( text = @@ -213,8 +209,8 @@ fun OutOfTimeScreen( Modifier.padding( top = Dimens.mediumPadding, start = Dimens.sideMargin, - end = Dimens.sideMargin - ) + end = Dimens.sideMargin, + ), ) Spacer(modifier = Modifier.weight(1f).defaultMinSize(minHeight = Dimens.verticalSpace)) // Button area @@ -225,7 +221,7 @@ fun OutOfTimeScreen( onPurchaseBillingProductClick = onPurchaseBillingProductClick, onRedeemVoucherClick = onRedeemVoucherClick, onSitePaymentClick = onSitePaymentClick, - navigateToVerificationPendingDialog = navigateToVerificationPendingDialog + navigateToVerificationPendingDialog = navigateToVerificationPendingDialog, ) } } @@ -238,7 +234,7 @@ private fun ButtonPanel( onPurchaseBillingProductClick: (ProductId) -> Unit, onRedeemVoucherClick: () -> Unit, onSitePaymentClick: () -> Unit, - navigateToVerificationPendingDialog: () -> Unit + navigateToVerificationPendingDialog: () -> Unit, ) { Column { @@ -250,8 +246,8 @@ private fun ButtonPanel( Modifier.padding( start = Dimens.sideMargin, end = Dimens.sideMargin, - bottom = Dimens.buttonSpacing - ) + bottom = Dimens.buttonSpacing, + ), ) } state.billingPaymentState?.let { @@ -265,9 +261,9 @@ private fun ButtonPanel( Modifier.padding( start = Dimens.sideMargin, end = Dimens.sideMargin, - bottom = Dimens.buttonSpacing + bottom = Dimens.buttonSpacing, ) - .align(Alignment.CenterHorizontally) + .align(Alignment.CenterHorizontally), ) } if (state.showSitePayment) { @@ -278,8 +274,8 @@ private fun ButtonPanel( Modifier.padding( start = Dimens.sideMargin, end = Dimens.sideMargin, - bottom = Dimens.buttonSpacing - ) + bottom = Dimens.buttonSpacing, + ), ) } RedeemVoucherButton( @@ -288,9 +284,9 @@ private fun ButtonPanel( Modifier.padding( start = Dimens.sideMargin, end = Dimens.sideMargin, - bottom = Dimens.screenVerticalMargin + bottom = Dimens.screenVerticalMargin, ), - isEnabled = state.tunnelState.enableRedeemButton() + isEnabled = state.tunnelState.enableRedeemButton(), ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/PrivacyDisclaimerScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/PrivacyDisclaimerScreen.kt index 8341ee008f9e..3094fe17722a 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/PrivacyDisclaimerScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/PrivacyDisclaimerScreen.kt @@ -68,16 +68,14 @@ private fun PreviewPrivacyDisclaimerScreen() { PrivacyDisclaimerScreen( PrivacyDisclaimerViewState(isStartingService = false, isPlayBuild = false), {}, - {} + {}, ) } } @Destination @Composable -fun PrivacyDisclaimer( - navigator: DestinationsNavigator, -) { +fun PrivacyDisclaimer(navigator: DestinationsNavigator) { val viewModel: PrivacyDisclaimerViewModel = koinViewModel() val state by viewModel.uiState.collectAsStateWithLifecycle() @@ -111,7 +109,7 @@ fun PrivacyDisclaimer( PrivacyDisclaimerScreen( state, { openPrivacyPolicy(context, state.isPlayBuild) }, - viewModel::setPrivacyDisclosureAccepted + viewModel::setPrivacyDisclosureAccepted, ) } @@ -132,9 +130,9 @@ fun PrivacyDisclaimerScreen( .padding(horizontal = Dimens.sideMargin, vertical = Dimens.screenVerticalMargin) .drawVerticalScrollbar( state = scrollState, - color = MaterialTheme.colorScheme.onPrimary.copy(alpha = AlphaScrollbar) + color = MaterialTheme.colorScheme.onPrimary.copy(alpha = AlphaScrollbar), ), - verticalArrangement = Arrangement.SpaceBetween + verticalArrangement = Arrangement.SpaceBetween, ) { Content(onPrivacyPolicyLinkClicked) @@ -150,7 +148,7 @@ private fun Content(onPrivacyPolicyLinkClicked: () -> Unit) { text = stringResource(id = R.string.privacy_disclaimer_title), style = MaterialTheme.typography.headlineSmall, color = MaterialTheme.colorScheme.onSurface, - fontWeight = FontWeight.Bold + fontWeight = FontWeight.Bold, ) val fontSize = 14.sp @@ -158,7 +156,7 @@ private fun Content(onPrivacyPolicyLinkClicked: () -> Unit) { text = stringResource(id = R.string.privacy_disclaimer_body_first_paragraph), fontSize = fontSize, color = MaterialTheme.colorScheme.onSurface, - modifier = Modifier.padding(top = 10.dp) + modifier = Modifier.padding(top = 10.dp), ) Spacer(modifier = Modifier.height(fontSize.toDp() + Dimens.smallPadding)) @@ -177,8 +175,8 @@ private fun Content(onPrivacyPolicyLinkClicked: () -> Unit) { TextStyle( fontSize = 12.sp, color = MaterialTheme.colorScheme.onSurface, - textDecoration = TextDecoration.Underline - ) + textDecoration = TextDecoration.Underline, + ), ) Icon( @@ -189,7 +187,7 @@ private fun Content(onPrivacyPolicyLinkClicked: () -> Unit) { .padding(start = 2.dp, top = 2.dp) .width(10.dp) .height(10.dp), - tint = MaterialTheme.colorScheme.onSurface + tint = MaterialTheme.colorScheme.onSurface, ) } } @@ -203,7 +201,7 @@ private fun ButtonPanel(isStartingService: Boolean, onAcceptClicked: () -> Unit) } else { PrimaryButton( text = stringResource(id = R.string.agree_and_continue), - onClick = onAcceptClicked::invoke + onClick = onAcceptClicked::invoke, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ReportProblemScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ReportProblemScreen.kt index ecf88b3205e4..09cc4e1cdcaa 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ReportProblemScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ReportProblemScreen.kt @@ -65,7 +65,7 @@ private fun PreviewReportProblemScreen() { private fun PreviewReportProblemSendingScreen() { AppTheme { ReportProblemScreen( - state = ReportProblemUiState(sendingState = SendingReportUiState.Sending), + state = ReportProblemUiState(sendingState = SendingReportUiState.Sending) ) } } @@ -76,7 +76,7 @@ private fun PreviewReportProblemSuccessScreen() { AppTheme { ReportProblemScreen( state = - ReportProblemUiState(sendingState = SendingReportUiState.Success("email@mail.com")), + ReportProblemUiState(sendingState = SendingReportUiState.Success("email@mail.com")) ) } } @@ -99,7 +99,7 @@ private fun PreviewReportProblemErrorScreen() { @Composable fun ReportProblem( navigator: DestinationsNavigator, - noEmailConfirmResultRecipent: ResultRecipient + noEmailConfirmResultRecipent: ResultRecipient, ) { val vm = koinViewModel() val state by vm.uiState.collectAsStateWithLifecycle() @@ -140,12 +140,12 @@ private fun ReportProblemScreen( onNavigateToViewLogs: () -> Unit = {}, onEmailChanged: (String) -> Unit = {}, onDescriptionChanged: (String) -> Unit = {}, - onBackClick: () -> Unit = {} + onBackClick: () -> Unit = {}, ) { ScaffoldWithMediumTopBar( appBarTitle = stringResource(id = R.string.report_a_problem), - navigationIcon = { NavigateBackIconButton(onNavigateBack = onBackClick) } + navigationIcon = { NavigateBackIconButton(onNavigateBack = onBackClick) }, ) { modifier -> // Show sending states if (state.sendingState != null) { @@ -153,7 +153,7 @@ private fun ReportProblemScreen( modifier = modifier.padding( vertical = Dimens.mediumPadding, - horizontal = Dimens.sideMargin + horizontal = Dimens.sideMargin, ) ) { when (state.sendingState) { @@ -172,11 +172,11 @@ private fun ReportProblemScreen( bottom = Dimens.verticalSpace, ) .height(IntrinsicSize.Max), - verticalArrangement = Arrangement.spacedBy(Dimens.mediumPadding) + verticalArrangement = Arrangement.spacedBy(Dimens.mediumPadding), ) { Text( text = stringResource(id = R.string.problem_report_description), - color = MaterialTheme.colorScheme.onSurfaceVariant + color = MaterialTheme.colorScheme.onSurfaceVariant, ) TextField( @@ -186,7 +186,7 @@ private fun ReportProblemScreen( maxLines = 1, singleLine = true, placeholder = { Text(text = stringResource(id = R.string.user_email_hint)) }, - colors = mullvadWhiteTextFieldColors() + colors = mullvadWhiteTextFieldColors(), ) TextField( @@ -194,19 +194,19 @@ private fun ReportProblemScreen( value = state.description, onValueChange = onDescriptionChanged, placeholder = { Text(stringResource(R.string.user_message_hint)) }, - colors = mullvadWhiteTextFieldColors() + colors = mullvadWhiteTextFieldColors(), ) Column { PrimaryButton( onClick = onNavigateToViewLogs, - text = stringResource(id = R.string.view_logs) + text = stringResource(id = R.string.view_logs), ) Spacer(modifier = Modifier.height(Dimens.buttonSpacing)) VariantButton( onClick = onSendReport, isEnabled = state.description.isNotEmpty(), - text = stringResource(id = R.string.send) + text = stringResource(id = R.string.send), ) } } @@ -216,14 +216,12 @@ private fun ReportProblemScreen( @Composable private fun ColumnScope.SendingContent() { - MullvadCircularProgressIndicatorLarge( - modifier = Modifier.align(Alignment.CenterHorizontally), - ) + MullvadCircularProgressIndicatorLarge(modifier = Modifier.align(Alignment.CenterHorizontally)) Spacer(modifier = Modifier.height(Dimens.problemReportIconToTitlePadding)) Text( text = stringResource(id = R.string.sending), style = MaterialTheme.typography.headlineLarge, - color = MaterialTheme.colorScheme.onSurface + color = MaterialTheme.colorScheme.onSurface, ) } @@ -234,14 +232,14 @@ private fun ColumnScope.SentContent(sendingState: SendingReportUiState.Success) painter = painterResource(id = R.drawable.icon_success), contentDescription = stringResource(id = R.string.sent), modifier = Modifier.align(Alignment.CenterHorizontally).size(Dimens.dialogIconHeight), - tint = Color.Unspecified + tint = Color.Unspecified, ) Spacer(modifier = Modifier.height(Dimens.problemReportIconToTitlePadding)) Text( text = stringResource(id = R.string.sent), style = MaterialTheme.typography.headlineLarge, - color = MaterialTheme.colorScheme.onSurface + color = MaterialTheme.colorScheme.onSurface, ) Text( text = @@ -255,7 +253,7 @@ private fun ColumnScope.SentContent(sendingState: SendingReportUiState.Success) } }, style = MaterialTheme.typography.bodySmall, - modifier = Modifier.fillMaxWidth() + modifier = Modifier.fillMaxWidth(), ) Spacer(modifier = Modifier.height(Dimens.smallPadding)) @@ -277,7 +275,7 @@ private fun ColumnScope.SentContent(sendingState: SendingReportUiState.Success) text = annotatedEmailString, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurface, - modifier = Modifier.fillMaxWidth() + modifier = Modifier.fillMaxWidth(), ) } } @@ -288,7 +286,7 @@ private fun ColumnScope.ErrorContent(retry: () -> Unit, onDismiss: () -> Unit) { painter = painterResource(id = R.drawable.icon_fail), contentDescription = stringResource(id = R.string.failed_to_send), modifier = Modifier.size(Dimens.dialogIconHeight).align(Alignment.CenterHorizontally), - tint = Color.Unspecified + tint = Color.Unspecified, ) Spacer(modifier = Modifier.height(Dimens.problemReportIconToTitlePadding)) Text( @@ -300,7 +298,7 @@ private fun ColumnScope.ErrorContent(retry: () -> Unit, onDismiss: () -> Unit) { text = stringResource(id = R.string.failed_to_send_details), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurface, - modifier = Modifier.fillMaxWidth() + modifier = Modifier.fillMaxWidth(), ) Spacer(modifier = Modifier.weight(1f)) PrimaryButton( @@ -308,11 +306,11 @@ private fun ColumnScope.ErrorContent(retry: () -> Unit, onDismiss: () -> Unit) { Modifier.fillMaxWidth() .padding(top = Dimens.mediumPadding, bottom = Dimens.buttonSpacing), onClick = onDismiss, - text = stringResource(id = R.string.edit_message) + text = stringResource(id = R.string.edit_message), ) VariantButton( modifier = Modifier.fillMaxWidth(), onClick = retry, - text = stringResource(id = R.string.try_again) + text = stringResource(id = R.string.try_again), ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt index 417cf5736633..013ed1d02947 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt @@ -117,11 +117,7 @@ private fun PreviewSelectLocationScreen() { relayListItems = emptyList(), customLists = emptyList(), ) - AppTheme { - SelectLocationScreen( - state = state, - ) - } + AppTheme { SelectLocationScreen(state = state) } } @Destination(style = SelectLocationTransition::class) @@ -133,14 +129,14 @@ fun SelectLocation( createCustomListDialogResultRecipient: ResultRecipient< CreateCustomListDestination, - CustomListActionResultData.Success.CreatedWithLocations + CustomListActionResultData.Success.CreatedWithLocations, >, editCustomListNameDialogResultRecipient: ResultRecipient, deleteCustomListDialogResultRecipient: ResultRecipient, updateCustomListResultRecipient: - ResultRecipient + ResultRecipient, ) { val vm = koinViewModel() val state = vm.uiState.collectAsStateWithLifecycle() @@ -156,14 +152,14 @@ fun SelectLocation( snackbarHostState.showResultSnackbar( context = context, result = it.resultData, - onUndo = vm::performAction + onUndo = vm::performAction, ) } SelectLocationSideEffect.GenericError -> launch { snackbarHostState.showSnackbarImmediately( message = context.getString(R.string.error_occurred), - duration = SnackbarDuration.Short + duration = SnackbarDuration.Short, ) } } @@ -180,17 +176,17 @@ fun SelectLocation( createCustomListDialogResultRecipient.OnCustomListNavResult( snackbarHostState, - vm::performAction + vm::performAction, ) editCustomListNameDialogResultRecipient.OnCustomListNavResult( snackbarHostState, - vm::performAction + vm::performAction, ) deleteCustomListDialogResultRecipient.OnCustomListNavResult( snackbarHostState, - vm::performAction + vm::performAction, ) updateCustomListResultRecipient.OnCustomListNavResult(snackbarHostState, vm::performAction) @@ -205,9 +201,7 @@ fun SelectLocation( onFilterClick = dropUnlessResumed { navigator.navigate(FilterDestination) }, onCreateCustomList = dropUnlessResumed { relayItem -> - navigator.navigate( - CreateCustomListDestination(locationCode = relayItem?.id), - ) + navigator.navigate(CreateCustomListDestination(locationCode = relayItem?.id)) }, onToggleExpand = vm::onToggleExpand, onEditCustomLists = dropUnlessResumed { navigator.navigate(CustomListsDestination()) }, @@ -220,14 +214,14 @@ fun SelectLocation( navigator.navigate( EditCustomListNameDestination( customListId = customList.id, - initialName = customList.customList.name - ), + initialName = customList.customList.name, + ) ) }, onEditLocationsCustomList = dropUnlessResumed { customList: RelayItem.CustomList -> navigator.navigate( - CustomListLocationsDestination(customListId = customList.id, newList = false), + CustomListLocationsDestination(customListId = customList.id, newList = false) ) }, onDeleteCustomList = @@ -235,10 +229,10 @@ fun SelectLocation( navigator.navigate( DeleteCustomListDestination( customListId = customList.id, - name = customList.customList.name - ), + name = customList.customList.name, + ) ) - } + }, ) } @@ -274,7 +268,7 @@ fun SelectLocationScreen( snackbarHost = { SnackbarHost( snackbarHostState, - snackbar = { snackbarData -> MullvadSnackbar(snackbarData = snackbarData) } + snackbar = { snackbarData -> MullvadSnackbar(snackbarData = snackbarData) }, ) } ) { @@ -288,7 +282,7 @@ fun SelectLocationScreen( onEditCustomListName = onEditCustomListName, onEditLocationsCustomList = onEditLocationsCustomList, onDeleteCustomList = onDeleteCustomList, - onHideBottomSheet = { bottomSheetState = null } + onHideBottomSheet = { bottomSheetState = null }, ) Column(modifier = Modifier.padding(it).background(backgroundColor).fillMaxSize()) { @@ -304,7 +298,7 @@ fun SelectLocationScreen( .height(Dimens.searchFieldHeight) .padding(horizontal = Dimens.searchFieldHorizontalPadding), textColor = MaterialTheme.colorScheme.onTertiaryContainer, - backgroundColor = MaterialTheme.colorScheme.tertiaryContainer + backgroundColor = MaterialTheme.colorScheme.tertiaryContainer, ) { searchString -> onSearchTermInput.invoke(searchString) } @@ -356,7 +350,7 @@ fun SelectLocationScreen( }, { customListId, expand -> onToggleExpand(customListId, null, expand) - } + }, ) is RelayListItem.CustomListEntryItem -> CustomListEntryItem( @@ -368,7 +362,7 @@ fun SelectLocationScreen( ShowCustomListsEntryBottomSheet( listItem.parentId, listItem.parentName, - listItem.item + listItem.item, ) } } else { @@ -378,9 +372,9 @@ fun SelectLocationScreen( onToggleExpand( listItem.item.id, listItem.parentId, - expand + expand, ) - } + }, ) is RelayListItem.CustomListFooter -> CustomListFooter(listItem) @@ -394,18 +388,18 @@ fun SelectLocationScreen( bottomSheetState = ShowLocationBottomSheet( state.customLists, - listItem.item + listItem.item, ) }, { expand -> onToggleExpand(listItem.item.id, null, expand) - } + }, ) is RelayListItem.LocationsEmptyText -> LocationsEmptyText(listItem.searchTerm) } } - } + }, ) } } @@ -434,7 +428,7 @@ fun LazyItemScope.RelayLocationItem( onLongClick = { onLongClick() }, onToggleExpand = { onExpand(it) }, isExpanded = relayItem.expanded, - depth = relayItem.depth + depth = relayItem.depth, ) } @@ -452,7 +446,7 @@ fun LazyItemScope.CustomListItem( onClick = { onSelectRelay(customListItem) }, onLongClick = { onShowEditBottomSheet(customListItem) }, onToggleExpand = { onExpand(customListItem.id, it) }, - isExpanded = itemState.expanded + isExpanded = itemState.expanded, ) } @@ -471,7 +465,7 @@ fun LazyItemScope.CustomListEntryItem( onLongClick = onShowEditCustomListEntryBottomSheet, onToggleExpand = onToggleExpand, isExpanded = itemState.expanded, - depth = itemState.depth + depth = itemState.depth, ) } @@ -484,7 +478,7 @@ fun LazyItemScope.CustomListFooter(item: RelayListItem.CustomListFooter) { } else { stringResource(R.string.to_create_a_custom_list) }, - modifier = Modifier.background(MaterialTheme.colorScheme.surface) + modifier = Modifier.background(MaterialTheme.colorScheme.surface), ) } @@ -527,7 +521,7 @@ private fun LazyItemScope.CustomListHeader(onShowCustomListBottomSheet: () -> Un ThreeDotCell( text = stringResource(R.string.custom_lists), onClickDots = onShowCustomListBottomSheet, - modifier = Modifier.testTag(SELECT_LOCATION_CUSTOM_LIST_HEADER_TEST_TAG) + modifier = Modifier.testTag(SELECT_LOCATION_CUSTOM_LIST_HEADER_TEST_TAG), ) } @@ -542,7 +536,7 @@ private fun BottomSheets( onEditCustomListName: (RelayItem.CustomList) -> Unit, onEditLocationsCustomList: (RelayItem.CustomList) -> Unit, onDeleteCustomList: (RelayItem.CustomList) -> Unit, - onHideBottomSheet: () -> Unit + onHideBottomSheet: () -> Unit, ) { val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) val scope = rememberCoroutineScope() @@ -565,7 +559,7 @@ private fun BottomSheets( bottomSheetState = bottomSheetState, onCreateCustomList = { onCreateCustomList(null) }, onEditCustomLists = onEditCustomLists, - closeBottomSheet = onCloseBottomSheet + closeBottomSheet = onCloseBottomSheet, ) } is ShowLocationBottomSheet -> { @@ -577,7 +571,7 @@ private fun BottomSheets( item = bottomSheetState.item, onCreateCustomList = onCreateCustomList, onAddLocationToList = onAddLocationToList, - closeBottomSheet = onCloseBottomSheet + closeBottomSheet = onCloseBottomSheet, ) } is ShowEditCustomListBottomSheet -> { @@ -589,7 +583,7 @@ private fun BottomSheets( onEditName = onEditCustomListName, onEditLocations = onEditLocationsCustomList, onDeleteCustomList = onDeleteCustomList, - closeBottomSheet = onCloseBottomSheet + closeBottomSheet = onCloseBottomSheet, ) } is ShowCustomListsEntryBottomSheet -> { @@ -601,7 +595,7 @@ private fun BottomSheets( customListName = bottomSheetState.customListName, item = bottomSheetState.item, onRemoveLocationFromList = onRemoveLocationFromList, - closeBottomSheet = onCloseBottomSheet + closeBottomSheet = onCloseBottomSheet, ) } null -> { @@ -636,7 +630,7 @@ private fun CustomListsBottomSheet( bottomSheetState: ShowCustomListsBottomSheet, onCreateCustomList: () -> Unit, onEditCustomLists: () -> Unit, - closeBottomSheet: (animate: Boolean) -> Unit + closeBottomSheet: (animate: Boolean) -> Unit, ) { MullvadModalBottomSheet( @@ -644,11 +638,11 @@ private fun CustomListsBottomSheet( backgroundColor = backgroundColor, onBackgroundColor = onBackgroundColor, onDismissRequest = { closeBottomSheet(false) }, - modifier = Modifier.testTag(SELECT_LOCATION_CUSTOM_LIST_BOTTOM_SHEET_TEST_TAG) + modifier = Modifier.testTag(SELECT_LOCATION_CUSTOM_LIST_BOTTOM_SHEET_TEST_TAG), ) { HeaderCell( text = stringResource(id = R.string.edit_custom_lists), - background = backgroundColor + background = backgroundColor, ) HorizontalDivider(color = onBackgroundColor) IconCell( @@ -659,7 +653,7 @@ private fun CustomListsBottomSheet( onCreateCustomList() closeBottomSheet(true) }, - background = backgroundColor + background = backgroundColor, ) IconCell( iconId = R.drawable.icon_edit, @@ -678,7 +672,7 @@ private fun CustomListsBottomSheet( closeBottomSheet(true) }, background = backgroundColor, - enabled = bottomSheetState.editListEnabled + enabled = bottomSheetState.editListEnabled, ) } } @@ -693,18 +687,18 @@ private fun LocationBottomSheet( item: RelayItem.Location, onCreateCustomList: (relayItem: RelayItem.Location) -> Unit, onAddLocationToList: (location: RelayItem.Location, customList: RelayItem.CustomList) -> Unit, - closeBottomSheet: (animate: Boolean) -> Unit + closeBottomSheet: (animate: Boolean) -> Unit, ) { MullvadModalBottomSheet( sheetState = sheetState, backgroundColor = backgroundColor, onBackgroundColor = onBackgroundColor, onDismissRequest = { closeBottomSheet(false) }, - modifier = Modifier.testTag(SELECT_LOCATION_LOCATION_BOTTOM_SHEET_TEST_TAG) + modifier = Modifier.testTag(SELECT_LOCATION_LOCATION_BOTTOM_SHEET_TEST_TAG), ) { -> HeaderCell( text = stringResource(id = R.string.add_location_to_list, item.name), - background = backgroundColor + background = backgroundColor, ) HorizontalDivider(color = onBackgroundColor) customLists.forEach { @@ -728,7 +722,7 @@ private fun LocationBottomSheet( closeBottomSheet(true) }, background = backgroundColor, - enabled = enabled + enabled = enabled, ) } IconCell( @@ -739,7 +733,7 @@ private fun LocationBottomSheet( onCreateCustomList(item) closeBottomSheet(true) }, - background = backgroundColor + background = backgroundColor, ) } } @@ -754,13 +748,13 @@ private fun EditCustomListBottomSheet( onEditName: (item: RelayItem.CustomList) -> Unit, onEditLocations: (item: RelayItem.CustomList) -> Unit, onDeleteCustomList: (item: RelayItem.CustomList) -> Unit, - closeBottomSheet: (animate: Boolean) -> Unit + closeBottomSheet: (animate: Boolean) -> Unit, ) { MullvadModalBottomSheet( backgroundColor = backgroundColor, onBackgroundColor = onBackgroundColor, sheetState = sheetState, - onDismissRequest = { closeBottomSheet(false) } + onDismissRequest = { closeBottomSheet(false) }, ) { HeaderCell(text = customList.name, background = backgroundColor) HorizontalDivider(color = onBackgroundColor) @@ -772,7 +766,7 @@ private fun EditCustomListBottomSheet( onEditName(customList) closeBottomSheet(true) }, - background = backgroundColor + background = backgroundColor, ) IconCell( iconId = R.drawable.icon_add, @@ -782,7 +776,7 @@ private fun EditCustomListBottomSheet( onEditLocations(customList) closeBottomSheet(true) }, - background = backgroundColor + background = backgroundColor, ) IconCell( iconId = R.drawable.icon_delete, @@ -792,7 +786,7 @@ private fun EditCustomListBottomSheet( onDeleteCustomList(customList) closeBottomSheet(true) }, - background = backgroundColor + background = backgroundColor, ) } } @@ -807,19 +801,19 @@ private fun CustomListEntryBottomSheet( customListName: CustomListName, item: RelayItem.Location, onRemoveLocationFromList: (location: RelayItem.Location, customListId: CustomListId) -> Unit, - closeBottomSheet: (animate: Boolean) -> Unit + closeBottomSheet: (animate: Boolean) -> Unit, ) { MullvadModalBottomSheet( sheetState = sheetState, backgroundColor = backgroundColor, onBackgroundColor = onBackgroundColor, onDismissRequest = { closeBottomSheet(false) }, - modifier = Modifier.testTag(SELECT_LOCATION_LOCATION_BOTTOM_SHEET_TEST_TAG) + modifier = Modifier.testTag(SELECT_LOCATION_LOCATION_BOTTOM_SHEET_TEST_TAG), ) { HeaderCell( text = stringResource(id = R.string.remove_location_from_list, item.name, customListName), - background = backgroundColor + background = backgroundColor, ) HorizontalDivider(color = onBackgroundColor) @@ -831,7 +825,7 @@ private fun CustomListEntryBottomSheet( onRemoveLocationFromList(item, customListId) closeBottomSheet(true) }, - background = backgroundColor + background = backgroundColor, ) } } @@ -850,7 +844,7 @@ private suspend fun LazyListState.animateScrollAndCentralizeItem(index: Int) { private suspend fun SnackbarHostState.showResultSnackbar( context: Context, result: CustomListActionResultData, - onUndo: (CustomListAction) -> Unit + onUndo: (CustomListAction) -> Unit, ) { showSnackbarImmediately( @@ -865,7 +859,7 @@ private suspend fun SnackbarHostState.showResultSnackbar( if (result is CustomListActionResultData.Success) { onUndo(result.undo) } - } + }, ) } @@ -876,7 +870,7 @@ private fun CustomListActionResultData.message(context: Context): String = context.getString( R.string.location_was_added_to_list, locationNames.first(), - customListName + customListName, ) } else { context.getString(R.string.create_custom_list_message, customListName) @@ -898,7 +892,7 @@ private fun CustomListActionResultData.message(context: Context): String = private fun ResultRecipient .OnCustomListNavResult( snackbarHostState: SnackbarHostState, - performAction: (action: CustomListAction) -> Unit + performAction: (action: CustomListAction) -> Unit, ) { val scope = rememberCoroutineScope() val context = LocalContext.current @@ -913,7 +907,7 @@ private fun ResultRecipien snackbarHostState.showResultSnackbar( context = context, result = result.value, - onUndo = performAction + onUndo = performAction, ) } } @@ -928,12 +922,12 @@ sealed interface BottomSheetState { data class ShowCustomListsEntryBottomSheet( val customListId: CustomListId, val customListName: CustomListName, - val item: RelayItem.Location + val item: RelayItem.Location, ) : BottomSheetState data class ShowLocationBottomSheet( val customLists: List, - val item: RelayItem.Location + val item: RelayItem.Location, ) : BottomSheetState data class ShowEditCustomListBottomSheet(val customList: RelayItem.CustomList) : diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ServerIpOverridesScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ServerIpOverridesScreen.kt index 0c87b02ffb3e..3f3b8312ed5a 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ServerIpOverridesScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ServerIpOverridesScreen.kt @@ -89,7 +89,7 @@ private fun PreviewServerIpOverridesScreen() { onResetOverridesClick = {}, onImportByFile = {}, onImportByText = {}, - SnackbarHostState() + SnackbarHostState(), ) } } @@ -112,7 +112,7 @@ fun ServerIpOverrides( launch { snackbarHostState.showSnackbarImmediately( message = sideEffect.error.toString(context), - actionLabel = null + actionLabel = null, ) } } @@ -131,7 +131,7 @@ fun ServerIpOverrides( } else { context.getString(R.string.error_occurred) }, - actionLabel = null + actionLabel = null, ) } } @@ -151,7 +151,7 @@ fun ServerIpOverrides( dropUnlessResumed { navigator.navigate(ResetServerIpOverridesConfirmationDestination) }, onImportByFile = dropUnlessResumed { openFileLauncher.launch("application/json") }, onImportByText = dropUnlessResumed { navigator.navigate(ImportOverridesByTextDestination) }, - snackbarHostState + snackbarHostState, ) } @@ -164,7 +164,7 @@ fun ServerIpOverridesScreen( onResetOverridesClick: () -> Unit, onImportByFile: () -> Unit, onImportByText: () -> Unit, - snackbarHostState: SnackbarHostState = remember { SnackbarHostState() } + snackbarHostState: SnackbarHostState = remember { SnackbarHostState() }, ) { val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) @@ -177,9 +177,9 @@ fun ServerIpOverridesScreen( TopBarActions( overridesActive = state.overridesActive, onInfoClick = onInfoClick, - onResetOverridesClick = onResetOverridesClick + onResetOverridesClick = onResetOverridesClick, ) - } + }, ) { modifier -> if (showBottomSheet && state.overridesActive != null) { ImportOverridesByBottomSheet( @@ -187,13 +187,11 @@ fun ServerIpOverridesScreen( { showBottomSheet = it }, state.overridesActive!!, onImportByFile, - onImportByText + onImportByText, ) } - Column( - modifier = modifier.animateContentSize(), - ) { + Column(modifier = modifier.animateContentSize()) { ServerIpOverridesCell(active = state.overridesActive) Spacer(modifier = Modifier.weight(1f)) @@ -219,7 +217,7 @@ private fun ImportOverridesByBottomSheet( showBottomSheet: (Boolean) -> Unit, overridesActive: Boolean, onImportByFile: () -> Unit, - onImportByText: () -> Unit + onImportByText: () -> Unit, ) { val scope = rememberCoroutineScope() val onCloseSheet = { @@ -242,7 +240,7 @@ private fun ImportOverridesByBottomSheet( ) { HeaderCell( text = stringResource(id = R.string.server_ip_overrides_import_by), - background = backgroundColor + background = backgroundColor, ) HorizontalDivider(color = onBackgroundColor) IconCell( @@ -253,7 +251,7 @@ private fun ImportOverridesByBottomSheet( onCloseSheet() }, background = backgroundColor, - modifier = Modifier.testTag(SERVER_IP_OVERRIDES_IMPORT_BY_FILE_TEST_TAG) + modifier = Modifier.testTag(SERVER_IP_OVERRIDES_IMPORT_BY_FILE_TEST_TAG), ) IconCell( iconId = R.drawable.icon_text_fields, @@ -263,25 +261,23 @@ private fun ImportOverridesByBottomSheet( onCloseSheet() }, background = backgroundColor, - modifier = Modifier.testTag(SERVER_IP_OVERRIDES_IMPORT_BY_TEXT_TEST_TAG) + modifier = Modifier.testTag(SERVER_IP_OVERRIDES_IMPORT_BY_TEXT_TEST_TAG), ) if (overridesActive) { HorizontalDivider(color = onBackgroundColor) - Row( - verticalAlignment = Alignment.CenterVertically, - ) { + Row(verticalAlignment = Alignment.CenterVertically) { Icon( modifier = Modifier.padding(Dimens.mediumPadding), painter = painterResource(id = R.drawable.icon_info), tint = MaterialTheme.colorScheme.error, - contentDescription = null + contentDescription = null, ) Text( modifier = Modifier.padding( top = Dimens.smallPadding, end = Dimens.mediumPadding, - bottom = Dimens.smallPadding + bottom = Dimens.smallPadding, ), text = stringResource(R.string.import_overrides_bottom_sheet_override_warning), maxLines = 2, @@ -297,23 +293,23 @@ private fun ImportOverridesByBottomSheet( private fun TopBarActions( overridesActive: Boolean?, onInfoClick: () -> Unit, - onResetOverridesClick: () -> Unit + onResetOverridesClick: () -> Unit, ) { var showMenu by remember { mutableStateOf(false) } InfoIconButton( onClick = onInfoClick, - modifier = Modifier.testTag(SERVER_IP_OVERRIDE_INFO_TEST_TAG) + modifier = Modifier.testTag(SERVER_IP_OVERRIDE_INFO_TEST_TAG), ) IconButton( onClick = { showMenu = !showMenu }, - modifier = Modifier.testTag(SERVER_IP_OVERRIDE_MORE_VERT_TEST_TAG) + modifier = Modifier.testTag(SERVER_IP_OVERRIDE_MORE_VERT_TEST_TAG), ) { Icon(painterResource(id = R.drawable.icon_more_vert), contentDescription = null) } DropdownMenu( modifier = Modifier.background(MaterialTheme.colorScheme.surfaceContainer), expanded = showMenu, - onDismissRequest = { showMenu = false } + onDismissRequest = { showMenu = false }, ) { DropdownMenuItem( text = { Text(text = stringResource(R.string.server_ip_overrides_reset)) }, @@ -326,15 +322,10 @@ private fun TopBarActions( MenuDefaults.itemColors( leadingIconColor = MaterialTheme.colorScheme.onPrimary, disabledLeadingIconColor = - MaterialTheme.colorScheme.onPrimary.copy(alpha = AlphaDisabled) + MaterialTheme.colorScheme.onPrimary.copy(alpha = AlphaDisabled), ), - leadingIcon = { - Icon( - Icons.Filled.Delete, - contentDescription = null, - ) - }, - modifier = Modifier.testTag(SERVER_IP_OVERRIDE_RESET_OVERRIDES_TEST_TAG) + leadingIcon = { Icon(Icons.Filled.Delete, contentDescription = null) }, + modifier = Modifier.testTag(SERVER_IP_OVERRIDE_RESET_OVERRIDES_TEST_TAG), ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SettingsScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SettingsScreen.kt index df6b7f109eb9..9023a3ef4933 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SettingsScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SettingsScreen.kt @@ -56,7 +56,7 @@ private fun PreviewSettings() { isLoggedIn = true, isSupportedVersion = true, isPlayBuild = false, - ), + ) ) } } @@ -75,7 +75,7 @@ fun Settings(navigator: DestinationsNavigator) { onApiAccessClick = dropUnlessResumed { navigator.navigate(ApiAccessListDestination) }, onReportProblemCellClick = dropUnlessResumed { navigator.navigate(ReportProblemDestination) }, - onBackClick = dropUnlessResumed { navigator.navigateUp() } + onBackClick = dropUnlessResumed { navigator.navigateUp() }, ) } @@ -87,7 +87,7 @@ fun SettingsScreen( onSplitTunnelingCellClick: () -> Unit = {}, onReportProblemCellClick: () -> Unit = {}, onApiAccessClick: () -> Unit = {}, - onBackClick: () -> Unit = {} + onBackClick: () -> Unit = {}, ) { val context = LocalContext.current @@ -97,14 +97,14 @@ fun SettingsScreen( ) { modifier, lazyListState -> LazyColumn( modifier = modifier.testTag(LAZY_LIST_TEST_TAG).animateContentSize(), - state = lazyListState + state = lazyListState, ) { if (state.isLoggedIn) { item { Spacer(modifier = Modifier.height(Dimens.cellLabelVerticalPadding)) } item { NavigationComposeCell( title = stringResource(id = R.string.settings_vpn), - onClick = onVpnSettingCellClick + onClick = onVpnSettingCellClick, ) } item { Spacer(modifier = Modifier.height(Dimens.cellVerticalSpacing)) } @@ -115,7 +115,7 @@ fun SettingsScreen( item { NavigationComposeCell( title = stringResource(id = R.string.settings_api_access), - onClick = onApiAccessClick + onClick = onApiAccessClick, ) } item { Spacer(modifier = Modifier.height(Dimens.cellVerticalSpacing)) } @@ -139,7 +139,7 @@ fun SettingsScreen( private fun SplitTunneling(onSplitTunnelingCellClick: () -> Unit) { NavigationComposeCell( title = stringResource(id = R.string.split_tunneling), - onClick = onSplitTunnelingCellClick + onClick = onSplitTunnelingCellClick, ) } @@ -169,12 +169,12 @@ private fun AppVersion(context: Context, state: SettingsUiState) { Text( text = state.appVersion, style = MaterialTheme.typography.labelMedium, - color = MaterialTheme.colorScheme.onSurfaceVariant + color = MaterialTheme.colorScheme.onSurfaceVariant, ) } }, showWarning = !state.isSupportedVersion, - isRowEnabled = !state.isPlayBuild + isRowEnabled = !state.isPlayBuild, ) if (!state.isSupportedVersion) { @@ -189,7 +189,7 @@ private fun AppVersion(context: Context, state: SettingsUiState) { top = Dimens.cellTopPadding, end = Dimens.cellStartPadding, bottom = Dimens.cellLabelVerticalPadding, - ) + ), ) } } @@ -198,7 +198,7 @@ private fun AppVersion(context: Context, state: SettingsUiState) { private fun ReportProblem(onReportProblemCellClick: () -> Unit) { NavigationComposeCell( title = stringResource(id = R.string.report_a_problem), - onClick = { onReportProblemCellClick() } + onClick = { onReportProblemCellClick() }, ) } @@ -211,12 +211,12 @@ private fun FaqAndGuides(context: Context) { @Composable { DefaultExternalLinkView( chevronContentDescription = faqGuideLabel, - tint = MaterialTheme.colorScheme.onPrimary + tint = MaterialTheme.colorScheme.onPrimary, ) }, onClick = { context.openLink(Uri.parse(context.resources.getString(R.string.faqs_and_guides_url))) - } + }, ) } @@ -229,7 +229,7 @@ private fun PrivacyPolicy(context: Context, state: SettingsUiState) { @Composable { DefaultExternalLinkView( chevronContentDescription = privacyPolicyLabel, - tint = MaterialTheme.colorScheme.onPrimary + tint = MaterialTheme.colorScheme.onPrimary, ) }, onClick = { @@ -240,6 +240,6 @@ private fun PrivacyPolicy(context: Context, state: SettingsUiState) { .appendHideNavOnPlayBuild(state.isPlayBuild) ) ) - } + }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SplashScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SplashScreen.kt index 5884ee4e90c1..2c247f2e0ac5 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SplashScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SplashScreen.kt @@ -94,16 +94,16 @@ fun SplashScreen() { Modifier.background(backgroundColor) .padding(it) .padding(bottom = it.calculateTopPadding()) - .fillMaxSize() + .fillMaxSize(), ) { Column( verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally + horizontalAlignment = Alignment.CenterHorizontally, ) { Image( painter = painterResource(id = R.drawable.launch_logo), contentDescription = "", - modifier = Modifier.size(Dimens.splashLogoSize) + modifier = Modifier.size(Dimens.splashLogoSize), ) Image( painter = painterResource(id = R.drawable.logo_text), @@ -111,16 +111,16 @@ fun SplashScreen() { alpha = 0.6f, modifier = Modifier.padding(top = Dimens.mediumPadding) - .height(Dimens.splashLogoTextHeight) + .height(Dimens.splashLogoTextHeight), ) Text( text = stringResource(id = R.string.connecting_to_daemon), style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant, - modifier = Modifier.padding(top = Dimens.mediumPadding) + modifier = Modifier.padding(top = Dimens.mediumPadding), ) } } - } + }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SplitTunnelingScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SplitTunnelingScreen.kt index 352b64144fcb..cc8a616c26cc 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SplitTunnelingScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SplitTunnelingScreen.kt @@ -79,10 +79,10 @@ private fun PreviewSplitTunnelingScreen() { packageName = "my.package.c", name = "TitleC", iconRes = R.drawable.icon_alert, - ), + ) ), showSystemApps = true, - ), + ) ) } } @@ -116,7 +116,7 @@ fun SplitTunnelingScreen( onExcludeAppClick: (packageName: String) -> Unit = {}, onIncludeAppClick: (packageName: String) -> Unit = {}, onBackClick: () -> Unit = {}, - onResolveIcon: (String) -> Bitmap? = { null } + onResolveIcon: (String) -> Bitmap? = { null }, ) { val focusManager = LocalFocusManager.current @@ -154,7 +154,7 @@ fun SplitTunnelingScreen( private fun LazyListScope.enabledToggle( enabled: Boolean, - onEnableSplitTunneling: (Boolean) -> Unit + onEnableSplitTunneling: (Boolean) -> Unit, ) { item { HeaderSwitchComposeCell( @@ -172,7 +172,7 @@ private fun LazyListScope.description() { buildString { appendLine(stringResource(id = R.string.split_tunneling_description)) append(stringResource(id = R.string.split_tunneling_description_warning)) - }, + } ) } } @@ -189,7 +189,7 @@ private fun LazyListScope.appList( onShowSystemAppsClick: (show: Boolean) -> Unit, onExcludeAppClick: (packageName: String) -> Unit, onIncludeAppClick: (packageName: String) -> Unit, - onResolveIcon: (String) -> Bitmap? + onResolveIcon: (String) -> Bitmap?, ) { if (state.excludedApps.isNotEmpty()) { headerItem( @@ -234,7 +234,7 @@ private fun LazyListScope.appItems( onAppClick: (String) -> Unit, onResolveIcon: (String) -> Bitmap?, enabled: Boolean, - excluded: Boolean + excluded: Boolean, ) { itemsIndexedWithDivider( items = apps, @@ -254,7 +254,7 @@ private fun LazyListScope.appItems( AlphaVisible } else { AlphaDisabled - }, + } ), onResolveIcon = onResolveIcon, ) { @@ -282,7 +282,7 @@ private fun LazyListScope.headerItem(key: String, textId: Int, enabled: Boolean) AlphaVisible } else { AlphaDisabled - }, + } ), text = stringResource(id = textId), background = MaterialTheme.colorScheme.primary, @@ -294,7 +294,7 @@ private fun LazyListScope.headerItem(key: String, textId: Int, enabled: Boolean) private fun LazyListScope.systemAppsToggle( showSystemApps: Boolean, onShowSystemAppsClick: (show: Boolean) -> Unit, - enabled: Boolean + enabled: Boolean, ) { itemWithDivider( key = SplitTunnelingContentKey.SHOW_SYSTEM_APPLICATIONS, @@ -312,7 +312,7 @@ private fun LazyListScope.systemAppsToggle( AlphaVisible } else { AlphaDisabled - }, + } ), ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ViewLogsScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ViewLogsScreen.kt index 5a8bf556b417..0018d3e2aaee 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ViewLogsScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ViewLogsScreen.kt @@ -77,17 +77,14 @@ fun ViewLogs(navigator: DestinationsNavigator) { } @Composable -fun ViewLogsScreen( - state: ViewLogsUiState, - onBackClick: () -> Unit = {}, -) { +fun ViewLogsScreen(state: ViewLogsUiState, onBackClick: () -> Unit = {}) { val snackbarHostState = remember { SnackbarHostState() } val clipboardHandle = createCopyToClipboardHandle(snackbarHostState = snackbarHostState) Scaffold( snackbarHost = { SnackbarHost( snackbarHostState, - snackbar = { snackbarData -> MullvadSnackbar(snackbarData = snackbarData) } + snackbar = { snackbarData -> MullvadSnackbar(snackbarData = snackbarData) }, ) }, topBar = { TopBar(state, clipboardHandle, onBackClick) }, @@ -101,7 +98,7 @@ fun ViewLogsScreen( private fun TopBar( state: ViewLogsUiState, clipboardHandle: CopyToClipboardHandle, - onBackClick: () -> Unit + onBackClick: () -> Unit, ) { val scope = rememberCoroutineScope() val context = LocalContext.current @@ -110,27 +107,27 @@ private fun TopBar( navigationIcon = { NavigateBackIconButton( onNavigateBack = onBackClick, - modifier = Modifier.focusProperties { down = FocusRequester.Cancel } + modifier = Modifier.focusProperties { down = FocusRequester.Cancel }, ) }, actions = { val clipboardToastMessage = stringResource(R.string.copied_logs_to_clipboard) IconButton( onClick = { clipboardHandle(state.text(), clipboardToastMessage) }, - modifier = Modifier.focusProperties { down = FocusRequester.Cancel } + modifier = Modifier.focusProperties { down = FocusRequester.Cancel }, ) { Icon( painter = painterResource(id = R.drawable.icon_copy), - contentDescription = null + contentDescription = null, ) } IconButton( onClick = { scope.launch { shareText(context, state.text()) } }, - modifier = Modifier.focusProperties { down = FocusRequester.Cancel } + modifier = Modifier.focusProperties { down = FocusRequester.Cancel }, ) { Icon(imageVector = Icons.Default.Share, contentDescription = null) } - } + }, ) } @@ -143,15 +140,15 @@ private fun Content(state: ViewLogsUiState, paddingValues: PaddingValues) { .padding( start = Dimens.sideMargin, end = Dimens.sideMargin, - bottom = Dimens.screenVerticalMargin + bottom = Dimens.screenVerticalMargin, ), - colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.onPrimary) + colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.onPrimary), ) { if (state.isLoading) { MullvadCircularProgressIndicatorMedium( modifier = Modifier.padding(Dimens.mediumPadding).align(Alignment.CenterHorizontally), - color = MaterialTheme.colorScheme.primary + color = MaterialTheme.colorScheme.primary, ) } else { val listState = rememberLazyListState() @@ -161,15 +158,15 @@ private fun Content(state: ViewLogsUiState, paddingValues: PaddingValues) { Modifier.fillMaxWidth() .drawVerticalScrollbar( listState, - MaterialTheme.colorScheme.primary.copy(alpha = AlphaScrollbar) + MaterialTheme.colorScheme.primary.copy(alpha = AlphaScrollbar), ) - .padding(horizontal = Dimens.smallPadding) + .padding(horizontal = Dimens.smallPadding), ) { items(state.allLines) { text -> Text( text = text, style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.primary + color = MaterialTheme.colorScheme.primary, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/VpnSettingsScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/VpnSettingsScreen.kt index 2a5157319807..7358d4cd16fc 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/VpnSettingsScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/VpnSettingsScreen.kt @@ -219,7 +219,7 @@ fun VpnSettings( navigator.navigate( WireguardPortInfoDestination( WireguardPortInfoDialogArgument(availablePortRanges) - ), + ) ) }, navigateToLocalNetworkSharingInfo = @@ -245,7 +245,7 @@ fun VpnSettings( val args = WireguardCustomPortNavArgs( state.customWireguardPort?.toPortOrNull(), - state.availablePortRanges + state.availablePortRanges, ) navigator.navigate(WireguardCustomPortDestination(args)) }, @@ -300,11 +300,11 @@ fun VpnSettingsScreen( ScaffoldWithMediumTopBar( appBarTitle = stringResource(id = R.string.settings_vpn), navigationIcon = { NavigateBackIconButton(onNavigateBack = onBackClick) }, - snackbarHostState = snackbarHostState + snackbarHostState = snackbarHostState, ) { modifier, lazyListState -> LazyColumn( modifier = modifier.testTag(LAZY_LIST_TEST_TAG).animateContentSize(), - state = lazyListState + state = lazyListState, ) { if (state.systemVpnSettingsAvailable) { item { @@ -326,7 +326,7 @@ fun VpnSettingsScreen( title = stringResource(R.string.auto_connect_legacy), isToggled = state.isAutoConnectEnabled, isEnabled = true, - onCellClicked = { newValue -> onToggleAutoConnect(newValue) } + onCellClicked = { newValue -> onToggleAutoConnect(newValue) }, ) } item { @@ -336,12 +336,12 @@ fun VpnSettingsScreen( if (state.systemVpnSettingsAvailable) { textResource( R.string.auto_connect_footer_legacy, - textResource(R.string.auto_connect_and_lockdown_mode) + textResource(R.string.auto_connect_and_lockdown_mode), ) } else { textResource(R.string.auto_connect_footer_legacy_tv) }, - HtmlCompat.FROM_HTML_MODE_COMPACT + HtmlCompat.FROM_HTML_MODE_COMPACT, ) .toAnnotatedString(boldFontWeight = FontWeight.ExtraBold) ) @@ -353,7 +353,7 @@ fun VpnSettingsScreen( isToggled = state.isLocalNetworkSharingEnabled, isEnabled = true, onCellClicked = { newValue -> onToggleLocalNetworkSharing(newValue) }, - onInfoClicked = navigateToLocalNetworkSharingInfo + onInfoClicked = navigateToLocalNetworkSharingInfo, ) Spacer(modifier = Modifier.height(Dimens.cellLabelVerticalPadding)) } @@ -364,7 +364,7 @@ fun VpnSettingsScreen( isExpanded = expandContentBlockersState, isEnabled = !state.isCustomDnsEnabled, onInfoClicked = { navigateToContentBlockersInfo() }, - onCellClicked = { expandContentBlockersState = !expandContentBlockersState } + onCellClicked = { expandContentBlockersState = !expandContentBlockersState }, ) } @@ -376,7 +376,7 @@ fun VpnSettingsScreen( isEnabled = !state.isCustomDnsEnabled, onCellClicked = { onToggleBlockAds(it) }, background = MaterialTheme.colorScheme.surfaceContainerLow, - startPadding = Dimens.indentedCellStartPadding + startPadding = Dimens.indentedCellStartPadding, ) } itemWithDivider { @@ -386,7 +386,7 @@ fun VpnSettingsScreen( isEnabled = !state.isCustomDnsEnabled, onCellClicked = { onToggleBlockTrackers(it) }, background = MaterialTheme.colorScheme.surfaceContainerLow, - startPadding = Dimens.indentedCellStartPadding + startPadding = Dimens.indentedCellStartPadding, ) } itemWithDivider { @@ -397,7 +397,7 @@ fun VpnSettingsScreen( onCellClicked = { onToggleBlockMalware(it) }, onInfoClicked = { navigateToMalwareInfo() }, background = MaterialTheme.colorScheme.surfaceContainerLow, - startPadding = Dimens.indentedCellStartPadding + startPadding = Dimens.indentedCellStartPadding, ) } itemWithDivider { @@ -407,7 +407,7 @@ fun VpnSettingsScreen( isEnabled = !state.isCustomDnsEnabled, onCellClicked = { onToggleBlockGambling(it) }, background = MaterialTheme.colorScheme.surfaceContainerLow, - startPadding = Dimens.indentedCellStartPadding + startPadding = Dimens.indentedCellStartPadding, ) } itemWithDivider { @@ -417,7 +417,7 @@ fun VpnSettingsScreen( isEnabled = !state.isCustomDnsEnabled, onCellClicked = { onToggleBlockAdultContent(it) }, background = MaterialTheme.colorScheme.surfaceContainerLow, - startPadding = Dimens.indentedCellStartPadding + startPadding = Dimens.indentedCellStartPadding, ) } @@ -428,7 +428,7 @@ fun VpnSettingsScreen( isEnabled = !state.isCustomDnsEnabled, onCellClicked = { onToggleBlockSocialMedia(it) }, background = MaterialTheme.colorScheme.surfaceContainerLow, - startPadding = Dimens.indentedCellStartPadding + startPadding = Dimens.indentedCellStartPadding, ) } @@ -440,7 +440,7 @@ fun VpnSettingsScreen( start = Dimens.cellStartPadding, top = topPadding, end = Dimens.cellEndPadding, - bottom = Dimens.cellLabelVerticalPadding + bottom = Dimens.cellLabelVerticalPadding, ) ) } @@ -453,7 +453,7 @@ fun VpnSettingsScreen( isToggled = state.isCustomDnsEnabled, isEnabled = state.contentBlockersOptions.isAnyBlockerEnabled().not(), onCellClicked = { newValue -> onToggleDnsClick(newValue) }, - onInfoClicked = { navigateToCustomDnsInfo() } + onInfoClicked = { navigateToCustomDnsInfo() }, ) } @@ -464,7 +464,7 @@ fun VpnSettingsScreen( isUnreachableLocalDnsWarningVisible = item.isLocal && !state.isLocalNetworkSharingEnabled, onClick = { navigateToDns(index, item.address) }, - modifier = Modifier.animateItemPlacement() + modifier = Modifier.animateItemPlacement(), ) } @@ -493,7 +493,7 @@ fun VpnSettingsScreen( top = topPadding, end = Dimens.cellEndPadding, bottom = Dimens.cellLabelVerticalPadding, - ) + ), ) } @@ -510,7 +510,7 @@ fun VpnSettingsScreen( SelectableCell( title = stringResource(id = R.string.automatic), isSelected = state.selectedWireguardPort == Constraint.Any, - onCellClicked = { onWireguardPortSelected(Constraint.Any) } + onCellClicked = { onWireguardPortSelected(Constraint.Any) }, ) } @@ -521,7 +521,7 @@ fun VpnSettingsScreen( testTag = String.format(null, LAZY_LIST_WIREGUARD_PORT_ITEM_X_TEST_TAG, port), isSelected = state.selectedWireguardPort.hasValue(port), - onCellClicked = { onWireguardPortSelected(Constraint.Only(Port(port))) } + onCellClicked = { onWireguardPortSelected(Constraint.Only(Port(port))) }, ) } } @@ -540,7 +540,7 @@ fun VpnSettingsScreen( }, onPortCellClicked = navigateToWireguardPortDialog, mainTestTag = LAZY_LIST_WIREGUARD_CUSTOM_PORT_TEXT_TEST_TAG, - numberTestTag = LAZY_LIST_WIREGUARD_CUSTOM_PORT_NUMBER_TEST_TAG + numberTestTag = LAZY_LIST_WIREGUARD_CUSTOM_PORT_NUMBER_TEST_TAG, ) } @@ -549,28 +549,28 @@ fun VpnSettingsScreen( InformationComposeCell( title = stringResource(R.string.obfuscation_title), onInfoClicked = navigateToObfuscationInfo, - onCellClicked = navigateToObfuscationInfo + onCellClicked = navigateToObfuscationInfo, ) } itemWithDivider { SelectableCell( title = stringResource(id = R.string.automatic), isSelected = state.selectedObfuscation == SelectedObfuscation.Auto, - onCellClicked = { onSelectObfuscationSetting(SelectedObfuscation.Auto) } + onCellClicked = { onSelectObfuscationSetting(SelectedObfuscation.Auto) }, ) } itemWithDivider { SelectableCell( title = stringResource(id = R.string.obfuscation_on_udp_over_tcp), isSelected = state.selectedObfuscation == SelectedObfuscation.Udp2Tcp, - onCellClicked = { onSelectObfuscationSetting(SelectedObfuscation.Udp2Tcp) } + onCellClicked = { onSelectObfuscationSetting(SelectedObfuscation.Udp2Tcp) }, ) } itemWithDivider { SelectableCell( title = stringResource(id = R.string.off), isSelected = state.selectedObfuscation == SelectedObfuscation.Off, - onCellClicked = { onSelectObfuscationSetting(SelectedObfuscation.Off) } + onCellClicked = { onSelectObfuscationSetting(SelectedObfuscation.Off) }, ) } @@ -581,7 +581,7 @@ fun VpnSettingsScreen( isEnabled = state.selectedObfuscation != SelectedObfuscation.Off, onInfoClicked = navigateUdp2TcpInfo, onCellClicked = { expandUdp2TcpPortSettings = !expandUdp2TcpPortSettings }, - testTag = LAZY_LIST_UDP_OVER_TCP_PORT_TEST_TAG + testTag = LAZY_LIST_UDP_OVER_TCP_PORT_TEST_TAG, ) } @@ -609,8 +609,8 @@ fun VpnSettingsScreen( String.format( null, LAZY_LIST_UDP_OVER_TCP_PORT_ITEM_X_TEST_TAG, - port - ) + port, + ), ) } } @@ -621,14 +621,14 @@ fun VpnSettingsScreen( InformationComposeCell( title = stringResource(R.string.quantum_resistant_title), onInfoClicked = navigateToQuantumResistanceInfo, - onCellClicked = navigateToQuantumResistanceInfo + onCellClicked = navigateToQuantumResistanceInfo, ) } itemWithDivider { SelectableCell( title = stringResource(id = R.string.automatic), isSelected = state.quantumResistant == QuantumResistantState.Auto, - onCellClicked = { onSelectQuantumResistanceSetting(QuantumResistantState.Auto) } + onCellClicked = { onSelectQuantumResistanceSetting(QuantumResistantState.Auto) }, ) } itemWithDivider { @@ -636,7 +636,7 @@ fun VpnSettingsScreen( title = stringResource(id = R.string.on), testTag = LAZY_LIST_QUANTUM_ITEM_ON_TEST_TAG, isSelected = state.quantumResistant == QuantumResistantState.On, - onCellClicked = { onSelectQuantumResistanceSetting(QuantumResistantState.On) } + onCellClicked = { onSelectQuantumResistanceSetting(QuantumResistantState.On) }, ) } item { @@ -644,7 +644,7 @@ fun VpnSettingsScreen( title = stringResource(id = R.string.off), testTag = LAZY_LIST_QUANTUM_ITEM_OFF_TEST_TAG, isSelected = state.quantumResistant == QuantumResistantState.Off, - onCellClicked = { onSelectQuantumResistanceSetting(QuantumResistantState.Off) } + onCellClicked = { onSelectQuantumResistanceSetting(QuantumResistantState.Off) }, ) Spacer(modifier = Modifier.height(Dimens.cellLabelVerticalPadding)) } @@ -666,7 +666,7 @@ fun VpnSettingsScreen( private fun ServerIpOverrides(onServerIpOverridesClick: () -> Unit) { NavigationComposeCell( title = stringResource(id = R.string.server_ip_overrides), - onClick = onServerIpOverridesClick + onClick = onServerIpOverridesClick, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/WelcomeScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/WelcomeScreen.kt index e53ec044cc22..c67ff2876523 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/WelcomeScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/WelcomeScreen.kt @@ -85,7 +85,7 @@ private fun PreviewWelcomeScreen() { listOf( PaymentProduct(ProductId("product"), ProductPrice("$44"), null) ) - ) + ), ), onSitePaymentClick = {}, onRedeemVoucherClick = {}, @@ -94,7 +94,7 @@ private fun PreviewWelcomeScreen() { onPurchaseBillingProductClick = { _ -> }, navigateToDeviceInfoDialog = {}, navigateToVerificationPendingDialog = {}, - onDisconnectClick = {} + onDisconnectClick = {}, ) } } @@ -104,7 +104,7 @@ private fun PreviewWelcomeScreen() { fun Welcome( navigator: DestinationsNavigator, voucherRedeemResultRecipient: ResultRecipient, - playPaymentResultRecipient: ResultRecipient + playPaymentResultRecipient: ResultRecipient, ) { val vm = koinViewModel() val state by vm.uiState.collectAsStateWithLifecycle() @@ -165,7 +165,7 @@ fun Welcome( dropUnlessResumed { productId -> navigator.navigate(PaymentDestination(productId)) }, onDisconnectClick = vm::onDisconnectClick, navigateToVerificationPendingDialog = - dropUnlessResumed { navigator.navigate(VerificationPendingDestination) } + dropUnlessResumed { navigator.navigate(VerificationPendingDestination) }, ) } @@ -180,7 +180,7 @@ fun WelcomeScreen( onPurchaseBillingProductClick: (productId: ProductId) -> Unit, onDisconnectClick: () -> Unit, navigateToDeviceInfoDialog: () -> Unit, - navigateToVerificationPendingDialog: () -> Unit + navigateToVerificationPendingDialog: () -> Unit, ) { val scrollState = rememberScrollState() @@ -199,7 +199,7 @@ fun WelcomeScreen( .verticalScroll(scrollState) .drawVerticalScrollbar( state = scrollState, - color = MaterialTheme.colorScheme.onSurface.copy(alpha = AlphaScrollbar) + color = MaterialTheme.colorScheme.onSurface.copy(alpha = AlphaScrollbar), ) ) { // Welcome info area @@ -216,7 +216,7 @@ fun WelcomeScreen( onRedeemVoucherClick = onRedeemVoucherClick, onPurchaseBillingProductClick = onPurchaseBillingProductClick, onPaymentInfoClick = navigateToVerificationPendingDialog, - onDisconnectClick = onDisconnectClick + onDisconnectClick = onDisconnectClick, ) } } @@ -226,7 +226,7 @@ fun WelcomeScreen( private fun WelcomeInfo( snackbarHostState: SnackbarHostState, state: WelcomeUiState, - navigateToDeviceInfoDialog: () -> Unit + navigateToDeviceInfoDialog: () -> Unit, ) { Column { Text( @@ -236,23 +236,20 @@ private fun WelcomeInfo( .padding( top = Dimens.screenVerticalMargin, start = Dimens.sideMargin, - end = Dimens.sideMargin + end = Dimens.sideMargin, ), style = MaterialTheme.typography.headlineLarge, color = MaterialTheme.colorScheme.onSurface, maxLines = 1, - overflow = TextOverflow.Ellipsis + overflow = TextOverflow.Ellipsis, ) Text( text = stringResource(id = R.string.here_is_your_account_number), modifier = Modifier.fillMaxWidth() - .padding( - horizontal = Dimens.sideMargin, - vertical = Dimens.smallPadding, - ), + .padding(horizontal = Dimens.sideMargin, vertical = Dimens.smallPadding), style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurface + color = MaterialTheme.colorScheme.onSurface, ) AccountNumberRow(snackbarHostState, state) @@ -273,10 +270,10 @@ private fun WelcomeInfo( top = Dimens.smallPadding, bottom = Dimens.verticalSpace, start = Dimens.sideMargin, - end = Dimens.sideMargin + end = Dimens.sideMargin, ), style = MaterialTheme.typography.bodySmall, - color = MaterialTheme.colorScheme.onSurface + color = MaterialTheme.colorScheme.onSurface, ) } } @@ -295,13 +292,13 @@ private fun AccountNumberRow(snackbarHostState: SnackbarHostState, state: Welcom modifier = Modifier.fillMaxWidth() .clickable(onClick = onCopyToClipboard) - .padding(horizontal = Dimens.sideMargin) + .padding(horizontal = Dimens.sideMargin), ) { Text( text = state.accountNumber?.value?.groupWithSpaces() ?: "", modifier = Modifier.weight(1f).padding(vertical = Dimens.smallPadding), style = MaterialTheme.typography.headlineSmall, - color = MaterialTheme.colorScheme.onSurface + color = MaterialTheme.colorScheme.onSurface, ) CopyAnimatedIconButton(onCopyToClipboard) @@ -325,17 +322,17 @@ fun DeviceNameRow(deviceName: String?, navigateToDeviceInfoDialog: () -> Unit) { style = MaterialTheme.typography.bodySmall, maxLines = 1, overflow = TextOverflow.Ellipsis, - color = MaterialTheme.colorScheme.onSurface + color = MaterialTheme.colorScheme.onSurface, ) IconButton( modifier = Modifier.align(Alignment.CenterVertically), - onClick = navigateToDeviceInfoDialog + onClick = navigateToDeviceInfoDialog, ) { Icon( painter = painterResource(id = R.drawable.icon_info), contentDescription = null, - tint = MaterialTheme.colorScheme.onSurface + tint = MaterialTheme.colorScheme.onSurface, ) } } @@ -350,7 +347,7 @@ private fun ButtonPanel( onRedeemVoucherClick: () -> Unit, onPurchaseBillingProductClick: (productId: ProductId) -> Unit, onPaymentInfoClick: () -> Unit, - onDisconnectClick: () -> Unit + onDisconnectClick: () -> Unit, ) { Column(modifier = Modifier.fillMaxWidth().padding(top = Dimens.mediumPadding)) { Spacer(modifier = Modifier.padding(top = Dimens.screenVerticalMargin)) @@ -362,8 +359,8 @@ private fun ButtonPanel( Modifier.padding( start = Dimens.sideMargin, end = Dimens.sideMargin, - bottom = Dimens.buttonSpacing - ) + bottom = Dimens.buttonSpacing, + ), ) } billingPaymentState?.let { @@ -377,9 +374,9 @@ private fun ButtonPanel( Modifier.padding( start = Dimens.sideMargin, end = Dimens.sideMargin, - bottom = Dimens.buttonSpacing + bottom = Dimens.buttonSpacing, ) - .align(Alignment.CenterHorizontally) + .align(Alignment.CenterHorizontally), ) } if (showSitePayment) { @@ -390,8 +387,8 @@ private fun ButtonPanel( Modifier.padding( start = Dimens.sideMargin, end = Dimens.sideMargin, - bottom = Dimens.buttonSpacing - ) + bottom = Dimens.buttonSpacing, + ), ) } RedeemVoucherButton( @@ -401,8 +398,8 @@ private fun ButtonPanel( Modifier.padding( start = Dimens.sideMargin, end = Dimens.sideMargin, - bottom = Dimens.screenVerticalMargin - ) + bottom = Dimens.screenVerticalMargin, + ), ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/ApiAccessListUiState.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/ApiAccessListUiState.kt index 91b84d36b73c..903d1dea6b85 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/ApiAccessListUiState.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/ApiAccessListUiState.kt @@ -4,5 +4,5 @@ import net.mullvad.mullvadvpn.lib.model.ApiAccessMethodSetting data class ApiAccessListUiState( val currentApiAccessMethodSetting: ApiAccessMethodSetting? = null, - val apiAccessMethodSettings: List = emptyList() + val apiAccessMethodSettings: List = emptyList(), ) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/CustomListLocationsUiState.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/CustomListLocationsUiState.kt index c9c842ee0b46..8a3c5c756b2e 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/CustomListLocationsUiState.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/CustomListLocationsUiState.kt @@ -25,7 +25,7 @@ sealed interface CustomListLocationsUiState { val locations: List, override val searchTerm: String = "", override val saveEnabled: Boolean = false, - override val hasUnsavedChanges: Boolean = false + override val hasUnsavedChanges: Boolean = false, ) : Content } } @@ -34,5 +34,5 @@ data class RelayLocationListItem( val item: RelayItem.Location, val depth: Int = 0, val checked: Boolean = false, - val expanded: Boolean = false + val expanded: Boolean = false, ) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/DeviceListUiState.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/DeviceListUiState.kt index c5c2d5fab096..adc5e3d07dbb 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/DeviceListUiState.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/DeviceListUiState.kt @@ -8,9 +8,7 @@ sealed interface DeviceListUiState { data class Error(val error: GetDeviceListError) : DeviceListUiState - data class Content( - val devices: List, - ) : DeviceListUiState { + data class Content(val devices: List) : DeviceListUiState { val hasTooManyDevices = devices.size >= MAXIMUM_DEVICES } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/DeviceRevokedUiState.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/DeviceRevokedUiState.kt index b2223e77e4f2..4bc32ae75770 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/DeviceRevokedUiState.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/DeviceRevokedUiState.kt @@ -3,5 +3,5 @@ package net.mullvad.mullvadvpn.compose.state enum class DeviceRevokedUiState { SECURED, UNSECURED, - UNKNOWN + UNKNOWN, } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/EditApiAccessMethodUiState.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/EditApiAccessMethodUiState.kt index 77590611c08e..1132731d6db2 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/EditApiAccessMethodUiState.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/EditApiAccessMethodUiState.kt @@ -37,7 +37,7 @@ data class EditApiAccessFormData( val usernameError: InvalidDataError.UserNameError? = null, val password: String, val passwordError: InvalidDataError.PasswordError? = null, - val cipher: Cipher = Cipher.first() + val cipher: Cipher = Cipher.first(), ) { fun updateWithErrors(errors: NonEmptyList): EditApiAccessFormData = copy( @@ -45,7 +45,7 @@ data class EditApiAccessFormData( serverIpError = errors.getFirstInstanceOrNull(), portError = errors.getFirstInstanceOrNull(), usernameError = errors.getFirstInstanceOrNull(), - passwordError = errors.getFirstInstanceOrNull() + passwordError = errors.getFirstInstanceOrNull(), ) companion object { @@ -71,7 +71,7 @@ data class EditApiAccessFormData( port = customProxy.port.toString(), enableAuthentication = customProxy.auth != null, username = customProxy.auth?.username ?: "", - password = customProxy.auth?.password ?: "" + password = customProxy.auth?.password ?: "", ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/EditCustomListState.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/EditCustomListState.kt index fa583e6fb99d..27a3fe881e56 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/EditCustomListState.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/EditCustomListState.kt @@ -12,6 +12,6 @@ sealed interface EditCustomListState { data class Content( val id: CustomListId, val name: CustomListName, - val locations: List + val locations: List, ) : EditCustomListState } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/LoginUiState.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/LoginUiState.kt index 6b2f0e7d04cb..59ee72d6bad0 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/LoginUiState.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/LoginUiState.kt @@ -7,7 +7,7 @@ const val MIN_ACCOUNT_LOGIN_LENGTH = 8 data class LoginUiState( val accountNumberInput: String = "", val lastUsedAccount: AccountNumber? = null, - val loginState: LoginState = LoginState.Idle(null) + val loginState: LoginState = LoginState.Idle(null), ) { val loginButtonEnabled = accountNumberInput.length >= MIN_ACCOUNT_LOGIN_LENGTH && loginState is LoginState.Idle diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/RelayFilterState.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/RelayFilterState.kt index 0ef8dfb9c1c9..c9393f67e30c 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/RelayFilterState.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/RelayFilterState.kt @@ -6,7 +6,7 @@ import net.mullvad.mullvadvpn.lib.model.Provider data class RelayFilterState( val selectedOwnership: Ownership? = null, val allProviders: List = emptyList(), - val selectedProviders: List = allProviders + val selectedProviders: List = allProviders, ) { val isApplyButtonEnabled = selectedProviders.isNotEmpty() diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SaveApiAccessMethodUiState.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SaveApiAccessMethodUiState.kt index e38a4de569b6..92e5b002e224 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SaveApiAccessMethodUiState.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SaveApiAccessMethodUiState.kt @@ -2,7 +2,7 @@ package net.mullvad.mullvadvpn.compose.state data class SaveApiAccessMethodUiState( val testingState: TestApiAccessMethodState = TestApiAccessMethodState.Testing, - val isSaving: Boolean = false + val isSaving: Boolean = false, ) sealed interface TestApiAccessMethodState { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SelectLocationUiState.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SelectLocationUiState.kt index 88d557c5327c..4fa2fbb1eb88 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SelectLocationUiState.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SelectLocationUiState.kt @@ -31,7 +31,7 @@ enum class RelayListItemContentType { CUSTOM_LIST_FOOTER, LOCATION_HEADER, LOCATION_ITEM, - LOCATIONS_EMPTY_TEXT + LOCATIONS_EMPTY_TEXT, } sealed interface RelayListItem { @@ -64,7 +64,7 @@ sealed interface RelayListItem { val parentName: CustomListName, val item: RelayItem.Location, override val expanded: Boolean, - override val depth: Int = 0 + override val depth: Int = 0, ) : SelectableItem { override val key = parentId to item.id diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SplitTunnelingUiState.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SplitTunnelingUiState.kt index 24552444e951..c466dcc2daa8 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SplitTunnelingUiState.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/SplitTunnelingUiState.kt @@ -11,6 +11,6 @@ sealed interface SplitTunnelingUiState { override val enabled: Boolean = false, val excludedApps: List = emptyList(), val includedApps: List = emptyList(), - val showSystemApps: Boolean = false + val showSystemApps: Boolean = false, ) : SplitTunnelingUiState } 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 925dc33aa9a4..d9855a2b42ff 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 @@ -4,7 +4,7 @@ import net.mullvad.mullvadvpn.lib.model.RedeemVoucherError data class VoucherDialogUiState( val voucherInput: String = "", - val voucherState: VoucherDialogState = VoucherDialogState.Default + val voucherState: VoucherDialogState = VoucherDialogState.Default, ) { companion object { val INITIAL = VoucherDialogUiState() diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/VpnSettingsUiState.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/VpnSettingsUiState.kt index 17eb69d380e8..0eaf1695a7be 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/VpnSettingsUiState.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/VpnSettingsUiState.kt @@ -55,7 +55,7 @@ data class VpnSettingsUiState( selectedWireguardPort, customWireguardPort, availablePortRanges, - systemVpnSettingsAvailable + systemVpnSettingsAvailable, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/ApiAccessMethodTextField.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/ApiAccessMethodTextField.kt index 99a91bbfd73c..76007f7ae8c2 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/ApiAccessMethodTextField.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/ApiAccessMethodTextField.kt @@ -59,8 +59,8 @@ fun ApiAccessMethodTextField( capitalization = capitalization, autoCorrect = false, keyboardType = keyboardType, - imeAction = imeAction - ) + imeAction = imeAction, + ), ) } @@ -68,19 +68,19 @@ fun ApiAccessMethodTextField( private fun ErrorSupportingText(text: String) { Row( verticalAlignment = Alignment.CenterVertically, - modifier = Modifier.padding(top = Dimens.miniPadding) + modifier = Modifier.padding(top = Dimens.miniPadding), ) { Icon( painter = painterResource(id = R.drawable.icon_alert), contentDescription = null, modifier = Modifier.size(Dimens.smallIconSize), - tint = MaterialTheme.colorScheme.error + tint = MaterialTheme.colorScheme.error, ) Text( text = text, color = MaterialTheme.colorScheme.onSecondary, style = MaterialTheme.typography.bodySmall, - modifier = Modifier.padding(horizontal = Dimens.smallPadding) + modifier = Modifier.padding(horizontal = Dimens.smallPadding), ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/CustomListNameTextField.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/CustomListNameTextField.kt index 058b69d69d90..d8439a5c0dcc 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/CustomListNameTextField.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/CustomListNameTextField.kt @@ -21,7 +21,7 @@ fun CustomListNameTextField( isValidName: Boolean, error: String?, onValueChanged: (String) -> Unit, - onSubmit: (String) -> Unit + onSubmit: (String) -> Unit, ) { val focusRequester = remember { FocusRequester() } val keyboardController = LocalSoftwareKeyboardController.current @@ -46,7 +46,7 @@ fun CustomListNameTextField( Text( text = it, color = MaterialTheme.colorScheme.error, - style = MaterialTheme.typography.bodySmall + style = MaterialTheme.typography.bodySmall, ) } }, @@ -56,7 +56,7 @@ fun CustomListNameTextField( if (focusState.hasFocus) { keyboardController?.show() } - } + }, ) LaunchedEffect(Unit) { focusRequester.requestFocus() } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/CustomPortTextField.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/CustomPortTextField.kt index 72d8b950935f..dc6dac0eaa1c 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/CustomPortTextField.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/CustomPortTextField.kt @@ -13,7 +13,7 @@ fun CustomPortTextField( onSubmit: (String) -> Unit, onValueChanged: (String) -> Unit, isValidValue: Boolean, - maxCharLength: Int + maxCharLength: Int, ) { CustomTextField( value = value, @@ -25,6 +25,6 @@ fun CustomPortTextField( isDigitsOnlyAllowed = true, isEnabled = true, isValidValue = isValidValue, - maxCharLength = maxCharLength + maxCharLength = maxCharLength, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/CustomTextField.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/CustomTextField.kt index fb325ffb46b0..d14855053817 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/CustomTextField.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/CustomTextField.kt @@ -50,7 +50,7 @@ fun CustomTextField( keyboardType = keyboardType, imeAction = ImeAction.Done, autoCorrect = false, - capitalization = capitalization + capitalization = capitalization, ), ) { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/DnsTextField.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/DnsTextField.kt index 388bec98bf39..a2c8877e786a 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/DnsTextField.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/DnsTextField.kt @@ -12,7 +12,7 @@ fun DnsTextField( onSubmit: () -> Unit = {}, placeholderText: String?, isEnabled: Boolean = true, - isValidValue: Boolean = true + isValidValue: Boolean = true, ) { CustomTextField( value = value, @@ -24,6 +24,6 @@ fun DnsTextField( placeholderText = placeholderText, maxCharLength = Int.MAX_VALUE, isDigitsOnlyAllowed = false, - isValidValue = isValidValue + isValidValue = isValidValue, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/MtuTextField.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/MtuTextField.kt index 8df93d7b86a4..ca694391293a 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/MtuTextField.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/MtuTextField.kt @@ -13,7 +13,7 @@ fun MtuTextField( onSubmit: (String) -> Unit = {}, isEnabled: Boolean = true, placeholderText: String = "", - maxCharLength: Int + maxCharLength: Int, ) { CustomTextField( value = value, @@ -25,6 +25,6 @@ fun MtuTextField( placeholderText = placeholderText, maxCharLength = maxCharLength, isValidValue = isValidValue, - isDigitsOnlyAllowed = true + isDigitsOnlyAllowed = true, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/SearchTextField.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/SearchTextField.kt index 174c1fb7e02b..d418add080db 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/SearchTextField.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/SearchTextField.kt @@ -55,7 +55,7 @@ fun SearchTextField( singleLine: Boolean = true, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, visualTransformation: VisualTransformation = VisualTransformation.None, - onValueChange: (String) -> Unit + onValueChange: (String) -> Unit, ) { var searchTerm by rememberSaveable { mutableStateOf("") } @@ -117,11 +117,11 @@ fun SearchTextField( unfocusedIndicatorColor = Color.Transparent, cursorColor = textColor, focusedPlaceholderColor = textColor, - unfocusedPlaceholderColor = textColor + unfocusedPlaceholderColor = textColor, ), contentPadding = PaddingValues(), ) }, - modifier = modifier + modifier = modifier, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/TextFieldColors.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/TextFieldColors.kt index 041bea285a44..341378c91a0f 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/TextFieldColors.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/textfield/TextFieldColors.kt @@ -49,7 +49,7 @@ private fun PreviewDarkTextField() { AppTheme { Column( modifier = Modifier.background(MaterialTheme.colorScheme.background).padding(16.dp), - verticalArrangement = Arrangement.spacedBy(16.dp) + verticalArrangement = Arrangement.spacedBy(16.dp), ) { // Normal TextField( @@ -58,7 +58,7 @@ private fun PreviewDarkTextField() { placeholder = { Text(text = "Placeholder") }, label = { Text(text = "Label") }, colors = mullvadDarkTextFieldColors(), - shape = MaterialTheme.shapes.small + shape = MaterialTheme.shapes.small, ) // Normal empty @@ -68,7 +68,7 @@ private fun PreviewDarkTextField() { placeholder = { Text(text = "Placeholder") }, label = { Text(text = "Label") }, colors = mullvadDarkTextFieldColors(), - shape = MaterialTheme.shapes.small + shape = MaterialTheme.shapes.small, ) // Error @@ -79,7 +79,7 @@ private fun PreviewDarkTextField() { label = { Text(text = "Label") }, isError = true, colors = mullvadDarkTextFieldColors(), - shape = MaterialTheme.shapes.small + shape = MaterialTheme.shapes.small, ) } } @@ -138,5 +138,5 @@ fun apiAccessTextFieldColors(): TextFieldColors = unfocusedIndicatorColor = Color.Transparent, focusedTrailingIconColor = MaterialTheme.colorScheme.onSurface, disabledTrailingIconColor = MaterialTheme.colorScheme.onSurface, - unfocusedTrailingIconColor = MaterialTheme.colorScheme.onSurface + unfocusedTrailingIconColor = MaterialTheme.colorScheme.onSurface, ) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/AccountNumberVisualTransformation.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/AccountNumberVisualTransformation.kt index 56426af6f49f..cb6df396e570 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/AccountNumberVisualTransformation.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/AccountNumberVisualTransformation.kt @@ -21,6 +21,6 @@ fun accountNumberVisualTransformation() = VisualTransformation { override fun transformedToOriginal(offset: Int): Int = offset - (offset - 1) / (ACCOUNT_NUMBER_CHUNK_SIZE + 1) - } + }, ) } 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 ce8f9989bbc0..d3b3f166dabb 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 @@ -13,9 +13,7 @@ import kotlinx.coroutines.launch typealias CopyToClipboardHandle = (content: String, toastMessage: String?) -> Unit @Composable -fun createCopyToClipboardHandle( - snackbarHostState: SnackbarHostState, -): CopyToClipboardHandle { +fun createCopyToClipboardHandle(snackbarHostState: SnackbarHostState): CopyToClipboardHandle { val scope = rememberCoroutineScope() val clipboardManager: ClipboardManager = LocalClipboardManager.current @@ -24,7 +22,7 @@ fun createCopyToClipboardHandle( scope.launch { snackbarHostState.showSnackbarImmediately( message = toastMessage, - duration = SnackbarDuration.Short + duration = SnackbarDuration.Short, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/Effect.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/Effect.kt index d4aac9c2aa6c..fa0c22eca0df 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/Effect.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/Effect.kt @@ -15,7 +15,7 @@ import kotlinx.coroutines.launch inline fun LaunchedEffectCollect( sideEffect: Flow, key: Any = Unit, - crossinline collector: suspend CoroutineScope.(T) -> Unit + crossinline collector: suspend CoroutineScope.(T) -> Unit, ) { LaunchedEffect(key) { sideEffect.collect { collector(it) } } } @@ -27,7 +27,7 @@ inline fun CollectSideEffectWithLifecycle( sideEffect: Flow, minActiveState: Lifecycle.State = Lifecycle.State.STARTED, key: Any? = Unit, - crossinline collector: suspend CoroutineScope.(T) -> Unit + crossinline collector: suspend CoroutineScope.(T) -> Unit, ) { val lifecycleOwner = LocalLifecycleOwner.current diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/Snackbar.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/Snackbar.kt index 1dcbc302efbe..88ec729d4639 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/Snackbar.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/Snackbar.kt @@ -12,7 +12,7 @@ suspend fun SnackbarHostState.showSnackbarImmediately( withDismissAction: Boolean = false, onDismiss: (() -> Unit) = {}, duration: SnackbarDuration = - if (actionLabel == null) SnackbarDuration.Short else SnackbarDuration.Indefinite + if (actionLabel == null) SnackbarDuration.Short else SnackbarDuration.Indefinite, ) { currentSnackbarData?.dismiss() when (showSnackbar(message, actionLabel, withDismissAction, duration)) { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/VoucherVisualTransformation.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/VoucherVisualTransformation.kt index 2c97f2031468..fd568de35ea3 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/VoucherVisualTransformation.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/util/VoucherVisualTransformation.kt @@ -27,12 +27,12 @@ fun vouchersVisualTransformation() = VisualTransformation { text -> // Limit max input to 19 characters (16 voucher - 3 dividers) return min( res, - MAX_VOUCHER_LENGTH + MAX_VOUCHER_LENGTH / ACCOUNT_NUMBER_CHUNK_SIZE - 1 + MAX_VOUCHER_LENGTH + MAX_VOUCHER_LENGTH / ACCOUNT_NUMBER_CHUNK_SIZE - 1, ) } override fun transformedToOriginal(offset: Int): Int = offset - offset / (ACCOUNT_NUMBER_CHUNK_SIZE + 1) - } + }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt index 02c2d81a3dbc..f4a0777e3f0c 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/dataproxy/MullvadProblemReport.kt @@ -51,7 +51,7 @@ class MullvadProblemReport(context: Context, val dispatcher: CoroutineDispatcher userReport.email ?: "", userReport.description, logsPath.absolutePath, - cacheDirectory.absolutePath + cacheDirectory.absolutePath, ) } @@ -88,6 +88,6 @@ class MullvadProblemReport(context: Context, val dispatcher: CoroutineDispatcher userEmail: String, userMessage: String, reportPath: String, - cacheDirectory: String + cacheDirectory: String, ): Boolean } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/di/UiModule.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/di/UiModule.kt index 1bfd860b01e6..1f1a48968420 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/di/UiModule.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/di/UiModule.kt @@ -109,7 +109,7 @@ val uiModule = module { single { ChangelogRepository(get(named(APP_PREFERENCES_NAME)), get()) } single { PrivacyDisclaimerRepository( - androidContext().getSharedPreferences(APP_PREFERENCES_NAME, Context.MODE_PRIVATE), + androidContext().getSharedPreferences(APP_PREFERENCES_NAME, Context.MODE_PRIVATE) ) } single { SettingsRepository(get()) } @@ -175,7 +175,7 @@ val uiModule = module { get(), get(), get(), - IS_PLAY_BUILD + IS_PLAY_BUILD, ) } viewModel { DeviceListViewModel(get(), get()) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/provider/MullvadFileProvider.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/provider/MullvadFileProvider.kt index d15f83da0c72..729fe5f2c2f0 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/provider/MullvadFileProvider.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/provider/MullvadFileProvider.kt @@ -40,10 +40,7 @@ fun Context.getLogsShareIntent(logContent: String): Intent { return Intent.createChooser(sendIntent, null) } -fun Context.createCacheFile( - directory: ProviderCacheDirectory, - fileName: String, -): File { +fun Context.createCacheFile(directory: ProviderCacheDirectory, fileName: String): File { // Path to log file val logsPath = File(cacheDir, directory.directoryName) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayItemExtensions.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayItemExtensions.kt index a3758b25fef9..c87a9548c50a 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayItemExtensions.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayItemExtensions.kt @@ -55,7 +55,7 @@ private fun RelayItem.Location.hasProvider(providersConstraint: Constraint, - providers: Constraint + providers: Constraint, ): RelayItem.CustomList { val newLocations = locations.mapNotNull { @@ -71,7 +71,7 @@ fun RelayItem.CustomList.filterOnOwnershipAndProvider( fun RelayItem.Location.Country.filterOnOwnershipAndProvider( ownership: Constraint, - providers: Constraint + providers: Constraint, ): RelayItem.Location.Country? { val cities = cities.mapNotNull { it.filterOnOwnershipAndProvider(ownership, providers) } return if (cities.isNotEmpty()) { @@ -83,7 +83,7 @@ fun RelayItem.Location.Country.filterOnOwnershipAndProvider( private fun RelayItem.Location.City.filterOnOwnershipAndProvider( ownership: Constraint, - providers: Constraint + providers: Constraint, ): RelayItem.Location.City? { val relays = relays.mapNotNull { it.filterOnOwnershipAndProvider(ownership, providers) } return if (relays.isNotEmpty()) { @@ -95,7 +95,7 @@ private fun RelayItem.Location.City.filterOnOwnershipAndProvider( private fun RelayItem.Location.Relay.filterOnOwnershipAndProvider( ownership: Constraint, - providers: Constraint + providers: Constraint, ): RelayItem.Location.Relay? { return if (hasOwnership(ownership) && hasProvider(providers)) { this diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/ApiAccessRepository.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/ApiAccessRepository.kt index bba17d84a0ea..cdb3779fed25 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/ApiAccessRepository.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/ApiAccessRepository.kt @@ -18,7 +18,7 @@ import net.mullvad.mullvadvpn.lib.model.NewAccessMethodSetting class ApiAccessRepository( private val managementService: ManagementService, - dispatcher: CoroutineDispatcher = Dispatchers.IO + dispatcher: CoroutineDispatcher = Dispatchers.IO, ) { val accessMethods = managementService.settings @@ -29,7 +29,7 @@ class ApiAccessRepository( managementService.currentAccessMethod.stateIn( CoroutineScope(dispatcher), SharingStarted.Eagerly, - null + null, ) suspend fun addApiAccessMethod(newAccessMethodSetting: NewAccessMethodSetting) = @@ -47,14 +47,14 @@ class ApiAccessRepository( suspend fun updateApiAccessMethod( apiAccessMethodId: ApiAccessMethodId, apiAccessMethodName: ApiAccessMethodName, - apiAccessMethod: ApiAccessMethod + apiAccessMethod: ApiAccessMethod, ) = either { val apiAccessMethodSetting = getApiAccessMethodSettingById(apiAccessMethodId).bind() updateApiAccessMethod( apiAccessMethodSetting.copy( id = apiAccessMethodId, name = apiAccessMethodName, - apiAccessMethod = apiAccessMethod + apiAccessMethod = apiAccessMethod, ) ) .bind() diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/ChangelogRepository.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/ChangelogRepository.kt index 2a4b63972582..768423e01a85 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/ChangelogRepository.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/ChangelogRepository.kt @@ -12,7 +12,7 @@ private const val LAST_SHOWED_CHANGELOG_VERSION_CODE = "last_showed_changelog_ve class ChangelogRepository( private val preferences: SharedPreferences, - private val dataProvider: IChangelogDataProvider + private val dataProvider: IChangelogDataProvider, ) { fun getVersionCodeOfMostRecentChangelogShowed(): Int { return preferences.getInt(LAST_SHOWED_CHANGELOG_VERSION_CODE, MISSING_VERSION_CODE) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/CustomListsRepository.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/CustomListsRepository.kt index fd67a6c17a8f..c53d07320f64 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/CustomListsRepository.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/CustomListsRepository.kt @@ -37,7 +37,7 @@ class CustomListsRepository( suspend fun updateCustomListName( id: CustomListId, - name: CustomListName + name: CustomListName, ): Either = either { val customList = getCustomListById(id).bind() updateCustomList(customList.copy(name = name)) @@ -47,7 +47,7 @@ class CustomListsRepository( suspend fun updateCustomListLocations( id: CustomListId, - locations: List + locations: List, ): Either = either { val customList = getCustomListById(id).bind() updateCustomList(customList.copy(locations = locations)) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/InAppNotificationController.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/InAppNotificationController.kt index 6686621f7b65..821fe769c296 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/InAppNotificationController.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/InAppNotificationController.kt @@ -70,7 +70,7 @@ class InAppNotificationController( it.sortedWith( compareBy( { notification -> notification.statusLevel.ordinal }, - { notification -> -notification.priority } + { notification -> -notification.priority }, ) ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/RelayListFilterRepository.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/RelayListFilterRepository.kt index 9251cac65c96..431656ce35e5 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/RelayListFilterRepository.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/RelayListFilterRepository.kt @@ -14,7 +14,7 @@ import net.mullvad.mullvadvpn.lib.model.Providers class RelayListFilterRepository( private val managementService: ManagementService, - dispatcher: CoroutineDispatcher = Dispatchers.IO + dispatcher: CoroutineDispatcher = Dispatchers.IO, ) { val selectedOwnership: StateFlow> = managementService.settings @@ -28,7 +28,7 @@ class RelayListFilterRepository( suspend fun updateSelectedOwnershipAndProviderFilter( ownership: Constraint, - providers: Constraint + providers: Constraint, ) = managementService.setOwnershipAndProviders(ownership, providers) suspend fun updateSelectedOwnership(value: Constraint) = diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/RelayListRepository.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/RelayListRepository.kt index 69a35c406ba0..1dd18fc71a70 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/RelayListRepository.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/RelayListRepository.kt @@ -30,7 +30,7 @@ import net.mullvad.mullvadvpn.relaylist.sortedByName class RelayListRepository( private val managementService: ManagementService, private val translationRepository: RelayLocationTranslationRepository, - dispatcher: CoroutineDispatcher = Dispatchers.IO + dispatcher: CoroutineDispatcher = Dispatchers.IO, ) { val relayList: StateFlow> = combine(managementService.relayCountries, translationRepository.translations) { @@ -65,7 +65,7 @@ class RelayListRepository( managementService.wireguardEndpointData.stateIn( CoroutineScope(dispatcher), SharingStarted.WhileSubscribed(), - defaultWireguardEndpointData() + defaultWireguardEndpointData(), ) val selectedLocation: StateFlow> = diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/SettingsRepository.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/SettingsRepository.kt index 7a9be0303a13..19e52b979074 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/SettingsRepository.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/SettingsRepository.kt @@ -21,31 +21,29 @@ import net.mullvad.mullvadvpn.lib.model.Settings class SettingsRepository( private val managementService: ManagementService, - dispatcher: CoroutineDispatcher = Dispatchers.IO + dispatcher: CoroutineDispatcher = Dispatchers.IO, ) { val settingsUpdates: StateFlow = managementService.settings.stateIn( CoroutineScope(dispatcher), SharingStarted.WhileSubscribed(), - null + null, ) suspend fun setDnsOptions( isCustomDnsEnabled: Boolean, dnsList: List, - contentBlockersOptions: DefaultDnsOptions + contentBlockersOptions: DefaultDnsOptions, ) = managementService.setDnsOptions( DnsOptions( state = if (isCustomDnsEnabled) DnsState.Custom else DnsState.Default, customOptions = CustomDnsOptions(ArrayList(dnsList)), - defaultOptions = contentBlockersOptions + defaultOptions = contentBlockersOptions, ) ) - suspend fun setDnsState( - state: DnsState, - ) = managementService.setDnsState(state) + suspend fun setDnsState(state: DnsState) = managementService.setDnsState(state) suspend fun deleteCustomDns(index: Int) = managementService.deleteCustomDns(index) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/SplitTunnelingRepository.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/SplitTunnelingRepository.kt index 383d52b6ce71..82078f3dd831 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/SplitTunnelingRepository.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/SplitTunnelingRepository.kt @@ -11,7 +11,7 @@ import net.mullvad.mullvadvpn.lib.model.AppId class SplitTunnelingRepository( private val managementService: ManagementService, - dispatcher: CoroutineDispatcher = Dispatchers.IO + dispatcher: CoroutineDispatcher = Dispatchers.IO, ) { val splitTunnelingEnabled = managementService.settings diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/serviceconnection/AppVersionInfoRepository.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/serviceconnection/AppVersionInfoRepository.kt index edf5dba1310b..6f8b92f3045d 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/serviceconnection/AppVersionInfoRepository.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/serviceconnection/AppVersionInfoRepository.kt @@ -14,20 +14,20 @@ import net.mullvad.mullvadvpn.ui.VersionInfo class AppVersionInfoRepository( private val buildVersion: BuildVersion, private val managementService: ManagementService, - private val dispatcher: CoroutineDispatcher = Dispatchers.IO + private val dispatcher: CoroutineDispatcher = Dispatchers.IO, ) { fun versionInfo(): StateFlow = managementService.versionInfo .map { appVersionInfo -> VersionInfo( currentVersion = buildVersion.name, - isSupported = appVersionInfo.supported + isSupported = appVersionInfo.supported, ) } .stateIn( CoroutineScope(dispatcher), WhileSubscribed(), // By default we assume we are supported - VersionInfo(currentVersion = buildVersion.name, isSupported = true) + VersionInfo(currentVersion = buildVersion.name, isSupported = true), ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/serviceconnection/ServiceConnectionManager.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/serviceconnection/ServiceConnectionManager.kt index 315243a77ced..a8e054e00ae6 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/serviceconnection/ServiceConnectionManager.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/serviceconnection/ServiceConnectionManager.kt @@ -28,7 +28,7 @@ class ServiceConnectionManager(private val context: Context) { context.bindService( intent, serviceConnection, - ServiceInfo.FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED or BIND_AUTO_CREATE + ServiceInfo.FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED or BIND_AUTO_CREATE, ) } else { context.bindService(intent, serviceConnection, BIND_AUTO_CREATE) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/AccountExpiryNotificationUseCase.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/AccountExpiryNotificationUseCase.kt index 4a7f1092a758..df14750ceda9 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/AccountExpiryNotificationUseCase.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/AccountExpiryNotificationUseCase.kt @@ -9,9 +9,7 @@ import net.mullvad.mullvadvpn.lib.shared.AccountRepository import net.mullvad.mullvadvpn.repository.InAppNotification import org.joda.time.DateTime -class AccountExpiryNotificationUseCase( - private val accountRepository: AccountRepository, -) { +class AccountExpiryNotificationUseCase(private val accountRepository: AccountRepository) { operator fun invoke(): Flow> = accountRepository.accountData .map(::accountExpiryNotification) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/FilteredRelayListUseCase.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/FilteredRelayListUseCase.kt index c4e05ccc92cc..9c1994e075f0 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/FilteredRelayListUseCase.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/FilteredRelayListUseCase.kt @@ -11,7 +11,7 @@ import net.mullvad.mullvadvpn.repository.RelayListRepository class FilteredRelayListUseCase( private val relayListRepository: RelayListRepository, - private val relayListFilterRepository: RelayListFilterRepository + private val relayListFilterRepository: RelayListFilterRepository, ) { operator fun invoke() = combine( @@ -19,14 +19,11 @@ class FilteredRelayListUseCase( relayListFilterRepository.selectedOwnership, relayListFilterRepository.selectedProviders, ) { relayList, selectedOwnership, selectedProviders -> - relayList.filterOnOwnershipAndProvider( - selectedOwnership, - selectedProviders, - ) + relayList.filterOnOwnershipAndProvider(selectedOwnership, selectedProviders) } private fun List.filterOnOwnershipAndProvider( ownership: Constraint, - providers: Constraint + providers: Constraint, ) = mapNotNull { it.filterOnOwnershipAndProvider(ownership, providers) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/NewDeviceNotificationUseCase.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/NewDeviceNotificationUseCase.kt index 12ce35615556..2faca012b75d 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/NewDeviceNotificationUseCase.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/NewDeviceNotificationUseCase.kt @@ -9,12 +9,12 @@ import net.mullvad.mullvadvpn.repository.NewDeviceRepository class NewDeviceNotificationUseCase( private val newDeviceRepository: NewDeviceRepository, - private val deviceRepository: DeviceRepository + private val deviceRepository: DeviceRepository, ) { operator fun invoke() = combine( deviceRepository.deviceState.map { it?.displayName() }, - newDeviceRepository.isNewDevice + newDeviceRepository.isNewDevice, ) { deviceName, newDeviceCreated -> if (newDeviceCreated && deviceName != null) { InAppNotification.NewDevice(deviceName) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/OutOfTimeUseCase.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/OutOfTimeUseCase.kt index a86124c8a9bf..209c213feb6e 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/OutOfTimeUseCase.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/OutOfTimeUseCase.kt @@ -22,7 +22,7 @@ import org.joda.time.DateTime class OutOfTimeUseCase( private val connectionProxy: ConnectionProxy, private val repository: AccountRepository, - scope: CoroutineScope + scope: CoroutineScope, ) { val isOutOfTime: StateFlow = diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/PaymentUseCase.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/PaymentUseCase.kt index 23f6c797b0f3..c1abfb571717 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/PaymentUseCase.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/PaymentUseCase.kt @@ -67,7 +67,7 @@ class PlayPaymentUseCase(private val paymentRepository: PaymentRepository) : Pay override suspend fun verifyPurchases() = Schedule.exponential( VERIFICATION_INITIAL_BACK_OFF_DURATION, - VERIFICATION_BACK_OFF_FACTOR + VERIFICATION_BACK_OFF_FACTOR, ) .and(Schedule.recurs(VERIFICATION_MAX_ATTEMPTS.toLong())) .retryEither { paymentRepository.verifyPurchases() } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/SelectedLocationTitleUseCase.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/SelectedLocationTitleUseCase.kt index a45da5ae769f..98bc77d05b50 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/SelectedLocationTitleUseCase.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/SelectedLocationTitleUseCase.kt @@ -20,7 +20,7 @@ class SelectedLocationTitleUseCase( combine( customListsRepository.customLists, relayListRepository.relayList, - relayListRepository.selectedLocation + relayListRepository.selectedLocation, ) { customLists, relayList, selectedLocation -> if (selectedLocation is Constraint.Only) { createRelayItemTitle(selectedLocation.value, relayList, customLists ?: emptyList()) @@ -32,7 +32,7 @@ class SelectedLocationTitleUseCase( private fun createRelayItemTitle( relayItemId: RelayItemId, relayCountries: List, - customLists: List + customLists: List, ): String? = when (relayItemId) { is CustomListId -> customLists.firstOrNull { it.id == relayItemId }?.name?.value @@ -43,7 +43,7 @@ class SelectedLocationTitleUseCase( private fun createRelayTitle( relayCountries: List, - relayItemId: GeoLocationId.Hostname + relayItemId: GeoLocationId.Hostname, ): String? = nullable { val city = relayCountries.findByGeoLocationId(relayItemId.city).bind() val relay = city.relays.firstOrNull { it.id == relayItemId }.bind() diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/customlists/CustomListActionUseCase.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/customlists/CustomListActionUseCase.kt index a23a6c6de5c0..5fb7b0e964e0 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/customlists/CustomListActionUseCase.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/customlists/CustomListActionUseCase.kt @@ -20,7 +20,7 @@ import net.mullvad.mullvadvpn.repository.RelayListRepository class CustomListActionUseCase( private val customListsRepository: CustomListsRepository, - private val relayListRepository: RelayListRepository + private val relayListRepository: RelayListRepository, ) { suspend operator fun invoke( action: CustomListAction @@ -75,7 +75,7 @@ class CustomListActionUseCase( id = customListId, name = action.name, locationNames = locationNames, - undo = action.not(customListId) + undo = action.not(customListId), ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/customlists/CustomListRelayItemsUseCase.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/customlists/CustomListRelayItemsUseCase.kt index 3390b8f9a16b..ca3dbd97eaa1 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/customlists/CustomListRelayItemsUseCase.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/customlists/CustomListRelayItemsUseCase.kt @@ -12,12 +12,12 @@ import net.mullvad.mullvadvpn.repository.RelayListRepository class CustomListRelayItemsUseCase( private val customListsRepository: CustomListsRepository, - private val relayListRepository: RelayListRepository + private val relayListRepository: RelayListRepository, ) { operator fun invoke(customListId: CustomListId): Flow> = combine( customListsRepository.customLists.mapNotNull { it?.getById(customListId) }, - relayListRepository.relayList + relayListRepository.relayList, ) { customList, countries -> countries.getRelayItemsByCodes(customList.locations) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/customlists/FilterCustomListsRelayItemUseCase.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/customlists/FilterCustomListsRelayItemUseCase.kt index f82d9eed5e20..49c8ec89f6c1 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/customlists/FilterCustomListsRelayItemUseCase.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/usecase/customlists/FilterCustomListsRelayItemUseCase.kt @@ -11,7 +11,7 @@ import net.mullvad.mullvadvpn.repository.RelayListFilterRepository class FilterCustomListsRelayItemUseCase( private val customListsRelayItemUseCase: CustomListsRelayItemUseCase, - private val relayListFilterRepository: RelayListFilterRepository + private val relayListFilterRepository: RelayListFilterRepository, ) { operator fun invoke() = @@ -25,6 +25,6 @@ class FilterCustomListsRelayItemUseCase( private fun List.filterOnOwnershipAndProvider( ownership: Constraint, - providers: Constraint + providers: Constraint, ) = mapNotNull { it.filterOnOwnershipAndProvider(ownership, providers) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/FlowUtils.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/FlowUtils.kt index 368c614aae52..c25e71ef9c25 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/FlowUtils.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/FlowUtils.kt @@ -12,7 +12,7 @@ inline fun combine( flow4: Flow, flow5: Flow, flow6: Flow, - crossinline transform: suspend (T1, T2, T3, T4, T5, T6) -> R + crossinline transform: suspend (T1, T2, T3, T4, T5, T6) -> R, ): Flow { return kotlinx.coroutines.flow.combine(flow, flow2, flow3, flow4, flow5, flow6) { args: Array<*> -> diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/PurchaseResultExtensions.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/PurchaseResultExtensions.kt index bf6dbec35e73..c04b81566e36 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/PurchaseResultExtensions.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/util/PurchaseResultExtensions.kt @@ -22,14 +22,14 @@ fun PurchaseResult.toPaymentDialogData(): PaymentDialogData? = PaymentDialogData( title = R.string.loading_connecting, icon = PaymentDialogIcon.LOADING, - closeOnDismiss = false + closeOnDismiss = false, ) // Verifying loading states PurchaseResult.VerificationStarted -> PaymentDialogData( title = R.string.loading_verifying, icon = PaymentDialogIcon.LOADING, - closeOnDismiss = false + closeOnDismiss = false, ) // Pending state PurchaseResult.Completed.Pending, @@ -37,7 +37,7 @@ fun PurchaseResult.toPaymentDialogData(): PaymentDialogData? = PaymentDialogData( title = R.string.payment_pending_dialog_title, message = R.string.payment_pending_dialog_message, - confirmAction = PaymentDialogAction.Close + confirmAction = PaymentDialogAction.Close, ) // Success state PurchaseResult.Completed.Success -> @@ -46,7 +46,7 @@ fun PurchaseResult.toPaymentDialogData(): PaymentDialogData? = message = R.string.payment_completed_dialog_message, icon = PaymentDialogIcon.SUCCESS, confirmAction = PaymentDialogAction.Close, - successfulPayment = true + successfulPayment = true, ) // Error states is PurchaseResult.Error.TransactionIdError -> diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/AccountViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/AccountViewModel.kt index f8f66563e8f9..048a6fc91368 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/AccountViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/AccountViewModel.kt @@ -41,14 +41,14 @@ class AccountViewModel( combine( deviceRepository.deviceState.filterIsInstance(), accountData(), - paymentUseCase.paymentAvailability + paymentUseCase.paymentAvailability, ) { deviceState, accountData, paymentAvailability -> AccountUiState( deviceName = deviceState.device.displayName(), accountNumber = deviceState.accountNumber, accountExpiry = accountData?.expiryDate, showSitePayment = !isPlayBuild, - billingPaymentState = paymentAvailability?.toPaymentState() + billingPaymentState = paymentAvailability?.toPaymentState(), ) } .stateIn(viewModelScope, SharingStarted.WhileSubscribed(), AccountUiState.default()) @@ -79,7 +79,7 @@ class AccountViewModel( .logout() .fold( { _uiSideEffect.send(UiSideEffect.GenericError) }, - { _uiSideEffect.send(UiSideEffect.NavigateToLogin) } + { _uiSideEffect.send(UiSideEffect.NavigateToLogin) }, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ApiAccessListViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ApiAccessListViewModel.kt index cabc452b0ab1..86d6069c16a1 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ApiAccessListViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ApiAccessListViewModel.kt @@ -16,7 +16,7 @@ class ApiAccessListViewModel(apiAccessRepository: ApiAccessRepository) : ViewMod currentAccessMethod -> ApiAccessListUiState( currentApiAccessMethodSetting = currentAccessMethod, - apiAccessMethodSettings = apiAccessMethods ?: emptyList() + apiAccessMethodSettings = apiAccessMethods ?: emptyList(), ) } .stateIn(viewModelScope, SharingStarted.WhileSubscribed(), ApiAccessListUiState()) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ApiAccessMethodDetailsViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ApiAccessMethodDetailsViewModel.kt index f133cf217268..6d3dd5ccdb6b 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ApiAccessMethodDetailsViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ApiAccessMethodDetailsViewModel.kt @@ -25,7 +25,7 @@ import net.mullvad.mullvadvpn.util.delayAtLeast class ApiAccessMethodDetailsViewModel( private val apiAccessRepository: ApiAccessRepository, - savedStateHandle: SavedStateHandle + savedStateHandle: SavedStateHandle, ) : ViewModel() { private var testingJob: Job? = null @@ -40,7 +40,7 @@ class ApiAccessMethodDetailsViewModel( apiAccessRepository.apiAccessMethodSettingById(apiAccessMethodId), apiAccessRepository.enabledApiAccessMethods(), apiAccessRepository.currentAccessMethod, - isTestingApiAccessMethodState + isTestingApiAccessMethodState, ) { apiAccessMethod, enabledApiAccessMethods, @@ -53,13 +53,13 @@ class ApiAccessMethodDetailsViewModel( isEditable = apiAccessMethod.apiAccessMethod is ApiAccessMethod.CustomProxy, isDisableable = enabledApiAccessMethods.any { it.id != apiAccessMethodId }, isCurrentMethod = currentAccessMethod?.id == apiAccessMethodId, - isTestingAccessMethod = isTestingApiAccessMethod + isTestingAccessMethod = isTestingApiAccessMethod, ) } .stateIn( viewModelScope, SharingStarted.WhileSubscribed(), - ApiAccessMethodDetailsUiState.Loading(apiAccessMethodId = apiAccessMethodId) + ApiAccessMethodDetailsUiState.Loading(apiAccessMethodId = apiAccessMethodId), ) fun setCurrentMethod() { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ChangelogViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ChangelogViewModel.kt index 7b15e74a0e04..f0817ea4feb9 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ChangelogViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ChangelogViewModel.kt @@ -13,7 +13,7 @@ import net.mullvad.mullvadvpn.repository.ChangelogRepository class ChangelogViewModel( private val changelogRepository: ChangelogRepository, private val buildVersion: BuildVersion, - private val alwaysShowChangelog: Boolean + private val alwaysShowChangelog: Boolean, ) : ViewModel() { private val _uiSideEffect = MutableSharedFlow(replay = 1, extraBufferCapacity = 1) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModel.kt index 325ee42b431d..7da838e58fcb 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModel.kt @@ -48,7 +48,7 @@ class ConnectViewModel( private val connectionProxy: ConnectionProxy, lastKnownLocationUseCase: LastKnownLocationUseCase, private val vpnPermissionRepository: VpnPermissionRepository, - private val isPlayBuild: Boolean + private val isPlayBuild: Boolean, ) : ViewModel() { private val _uiSideEffect = Channel() @@ -63,7 +63,7 @@ class ConnectViewModel( connectionProxy.tunnelState, lastKnownLocationUseCase.lastKnownDisconnectedLocation, accountRepository.accountData, - deviceRepository.deviceState.map { it?.displayName() } + deviceRepository.deviceState.map { it?.displayName() }, ) { selectedRelayItemTitle, notifications, diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/CreateCustomListDialogViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/CreateCustomListDialogViewModel.kt index 5603ab41846c..8cb8cfb0129d 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/CreateCustomListDialogViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/CreateCustomListDialogViewModel.kt @@ -23,7 +23,7 @@ import net.mullvad.mullvadvpn.usecase.customlists.CustomListActionUseCase class CreateCustomListDialogViewModel( private val customListActionUseCase: CustomListActionUseCase, - savedStateHandle: SavedStateHandle + savedStateHandle: SavedStateHandle, ) : ViewModel() { private val locationCode: GeoLocationId? = @@ -45,7 +45,7 @@ class CreateCustomListDialogViewModel( customListActionUseCase( CustomListAction.Create( CustomListName.fromString(name), - listOfNotNull(locationCode) + listOfNotNull(locationCode), ) ) .fold( @@ -62,12 +62,12 @@ class CreateCustomListDialogViewModel( CustomListActionResultData.Success.CreatedWithLocations( customListName = it.name, locationNames = it.locationNames, - undo = it.undo + undo = it.undo, ) ) ) } - } + }, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/CustomListLocationsViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/CustomListLocationsViewModel.kt index ffed0757b0ab..83b9d7961150 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/CustomListLocationsViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/CustomListLocationsViewModel.kt @@ -37,7 +37,7 @@ class CustomListLocationsViewModel( private val relayListRepository: RelayListRepository, private val customListRelayItemsUseCase: CustomListRelayItemsUseCase, private val customListActionUseCase: CustomListActionUseCase, - savedStateHandle: SavedStateHandle + savedStateHandle: SavedStateHandle, ) : ViewModel() { private val navArgs = CustomListLocationsDestination.argsFrom(savedStateHandle = savedStateHandle) @@ -62,7 +62,7 @@ class CustomListLocationsViewModel( relayCountries.isEmpty() -> CustomListLocationsUiState.Content.Empty( newList = navArgs.newList, - searchTerm = searchTerm + searchTerm = searchTerm, ) else -> CustomListLocationsUiState.Content.Data( @@ -76,14 +76,14 @@ class CustomListLocationsViewModel( saveEnabled = selectedLocations.isNotEmpty() && selectedLocations != _initialLocations.value, - hasUnsavedChanges = selectedLocations != _initialLocations.value + hasUnsavedChanges = selectedLocations != _initialLocations.value, ) } } .stateIn( viewModelScope, SharingStarted.WhileSubscribed(), - CustomListLocationsUiState.Loading(newList = navArgs.newList) + CustomListLocationsUiState.Loading(newList = navArgs.newList), ) init { @@ -91,10 +91,7 @@ class CustomListLocationsViewModel( } private fun searchRelayListLocations() = - combine( - _searchTerm, - relayListRepository.relayList, - ) { searchTerm, relayCountries -> + combine(_searchTerm, relayListRepository.relayList) { searchTerm, relayCountries -> val isSearching = searchTerm.length >= MIN_SEARCH_LENGTH if (isSearching) { val (exp, filteredRelayCountries) = relayCountries.newFilterOnSearch(searchTerm) @@ -118,7 +115,7 @@ class CustomListLocationsViewModel( customListActionUseCase( CustomListAction.UpdateLocations( navArgs.customListId, - locationsToSave.map { it.id } + locationsToSave.map { it.id }, ) ) .bind() @@ -248,7 +245,7 @@ class CustomListLocationsViewModel( item = relayItem, depth = depth, checked = isSelected(relayItem), - expanded = expanded + expanded = expanded, ) ) if (expanded) { @@ -258,7 +255,7 @@ class CustomListLocationsViewModel( relayItem.relays.toRelayItems( isSelected = isSelected, isExpanded = isExpanded, - depth = depth + 1 + depth = depth + 1, ) ) is RelayItem.Location.Country -> @@ -266,7 +263,7 @@ class CustomListLocationsViewModel( relayItem.cities.toRelayItems( isSelected = isSelected, isExpanded = isExpanded, - depth = depth + 1 + depth = depth + 1, ) ) is RelayItem.Location.Relay -> { @@ -279,13 +276,13 @@ class CustomListLocationsViewModel( private fun calculateResultData( success: LocationsChanged, - locationsToSave: List + locationsToSave: List, ) = if (navArgs.newList) { CustomListActionResultData.Success.CreatedWithLocations( customListName = success.name, locationNames = locationsToSave.map { it.name }, - undo = CustomListAction.Delete(id = success.id) + undo = CustomListAction.Delete(id = success.id), ) } else { when { @@ -293,19 +290,19 @@ class CustomListLocationsViewModel( CustomListActionResultData.Success.LocationAdded( customListName = success.name, relayListRepository.find(success.removedLocations.first())!!.name, - undo = success.undo + undo = success.undo, ) success.removedLocations.size == 1 && success.addedLocations.isEmpty() -> CustomListActionResultData.Success.LocationRemoved( customListName = success.name, locationName = relayListRepository.find(success.removedLocations.first())!!.name, - undo = success.undo + undo = success.undo, ) else -> CustomListActionResultData.Success.LocationChanged( customListName = success.name, - undo = success.undo + undo = success.undo, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/CustomListsViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/CustomListsViewModel.kt index 03d3548ebc95..c30b8ca63790 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/CustomListsViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/CustomListsViewModel.kt @@ -14,7 +14,7 @@ import net.mullvad.mullvadvpn.usecase.customlists.CustomListActionUseCase class CustomListsViewModel( customListsRepository: CustomListsRepository, - private val customListActionUseCase: CustomListActionUseCase + private val customListActionUseCase: CustomListActionUseCase, ) : ViewModel() { val uiState = @@ -24,7 +24,7 @@ class CustomListsViewModel( .stateIn( viewModelScope, started = SharingStarted.WhileSubscribed(), - CustomListsUiState.Loading + CustomListsUiState.Loading, ) fun undoDeleteCustomList(action: CustomListAction.Create) { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeleteApiAccessMethodConfirmationViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeleteApiAccessMethodConfirmationViewModel.kt index bac2e3ad95e5..6e7d99dc39fb 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeleteApiAccessMethodConfirmationViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeleteApiAccessMethodConfirmationViewModel.kt @@ -18,7 +18,7 @@ import net.mullvad.mullvadvpn.repository.ApiAccessRepository class DeleteApiAccessMethodConfirmationViewModel( private val apiAccessRepository: ApiAccessRepository, - savedStateHandle: SavedStateHandle + savedStateHandle: SavedStateHandle, ) : ViewModel() { private val apiAccessMethodId: ApiAccessMethodId = DeleteApiAccessMethodConfirmationDestination.argsFrom(savedStateHandle).apiAccessMethodId @@ -35,7 +35,7 @@ class DeleteApiAccessMethodConfirmationViewModel( .stateIn( viewModelScope, SharingStarted.WhileSubscribed(), - DeleteApiAccessMethodUiState(null) + DeleteApiAccessMethodUiState(null), ) fun deleteApiAccessMethod() { @@ -45,7 +45,7 @@ class DeleteApiAccessMethodConfirmationViewModel( .removeApiAccessMethod(apiAccessMethodId) .fold( { _error.tryEmit(it) }, - { _uiSideEffect.send(DeleteApiAccessMethodConfirmationSideEffect.Deleted) } + { _uiSideEffect.send(DeleteApiAccessMethodConfirmationSideEffect.Deleted) }, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeleteCustomListConfirmationViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeleteCustomListConfirmationViewModel.kt index cdb0327d1643..398325d7ed2f 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeleteCustomListConfirmationViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeleteCustomListConfirmationViewModel.kt @@ -21,7 +21,7 @@ import net.mullvad.mullvadvpn.usecase.customlists.DeleteWithUndoError class DeleteCustomListConfirmationViewModel( private val customListActionUseCase: CustomListActionUseCase, - savedStateHandle: SavedStateHandle + savedStateHandle: SavedStateHandle, ) : ViewModel() { private val navArgs = DeleteCustomListDestination.argsFrom(savedStateHandle) private val name: CustomListName = navArgs.name @@ -38,7 +38,7 @@ class DeleteCustomListConfirmationViewModel( .stateIn( viewModelScope, SharingStarted.WhileSubscribed(), - DeleteCustomListUiState(name, null) + DeleteCustomListUiState(name, null), ) fun deleteCustomList() { @@ -52,11 +52,11 @@ class DeleteCustomListConfirmationViewModel( DeleteCustomListConfirmationSideEffect.ReturnWithResult( CustomListActionResultData.Success.Deleted( customListName = it.name, - undo = it.undo + undo = it.undo, ) ) ) - } + }, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceListViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceListViewModel.kt index 11e4071c9eef..e28fe1027d2a 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceListViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceListViewModel.kt @@ -46,7 +46,7 @@ class DeviceListViewModel( loadingDevices, deviceList.map { it.sortedBy { it.creationDate } }, loading, - error + error, ) { loadingDevices, devices, loading, error -> when { loading -> DeviceListUiState.Loading @@ -81,7 +81,7 @@ class DeviceListViewModel( setLoadingState(deviceIdToRemove, false) deviceRepository.deviceList(accountNumber).onRight { deviceList.value = it } }, - { removeDeviceFromState(deviceIdToRemove) } + { removeDeviceFromState(deviceIdToRemove) }, ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceRevokedViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceRevokedViewModel.kt index 8d526ba9b2d2..ca503f3ee353 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceRevokedViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceRevokedViewModel.kt @@ -18,7 +18,7 @@ import net.mullvad.mullvadvpn.lib.shared.ConnectionProxy class DeviceRevokedViewModel( private val accountRepository: AccountRepository, private val connectionProxy: ConnectionProxy, - dispatcher: CoroutineDispatcher = Dispatchers.IO + dispatcher: CoroutineDispatcher = Dispatchers.IO, ) : ViewModel() { val uiState = @@ -33,7 +33,7 @@ class DeviceRevokedViewModel( .stateIn( scope = CoroutineScope(dispatcher), started = SharingStarted.WhileSubscribed(), - initialValue = DeviceRevokedUiState.UNKNOWN + initialValue = DeviceRevokedUiState.UNKNOWN, ) private val _uiSideEffect = Channel() diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DnsDialogViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DnsDialogViewModel.kt index a7fb64bf0f87..a009210318de 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DnsDialogViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DnsDialogViewModel.kt @@ -70,7 +70,7 @@ class DnsDialogViewModel( .stateIn( viewModelScope, SharingStarted.Lazily, - createViewState(emptyList(), null, false, _ipAddressInput.value) + createViewState(emptyList(), null, false, _ipAddressInput.value), ) private val _uiSideEffect = Channel() @@ -84,19 +84,19 @@ class DnsDialogViewModel( customDnsList: List, currentIndex: Int?, isAllowLanEnabled: Boolean, - input: String + input: String, ): DnsDialogViewState = DnsDialogViewState( input, input.validateDnsEntry(currentIndex, customDnsList).leftOrNull(), input.isLocalAddress(), isAllowLanEnabled = isAllowLanEnabled, - currentIndex + currentIndex, ) private fun String.validateDnsEntry( index: Int?, - dnsList: List + dnsList: List, ): Either = either { ensure(isNotBlank()) { ValidationError.InvalidAddress } ensure(isValidIp()) { ValidationError.InvalidAddress } @@ -127,7 +127,7 @@ class DnsDialogViewModel( result.fold( { _uiSideEffect.send(DnsDialogSideEffect.Error) }, - { _uiSideEffect.send(DnsDialogSideEffect.Complete) } + { _uiSideEffect.send(DnsDialogSideEffect.Complete) }, ) } @@ -137,7 +137,7 @@ class DnsDialogViewModel( .deleteCustomDns(index) .fold( { _uiSideEffect.send(DnsDialogSideEffect.Error) }, - { _uiSideEffect.send(DnsDialogSideEffect.Complete) } + { _uiSideEffect.send(DnsDialogSideEffect.Complete) }, ) } @@ -155,7 +155,7 @@ class DnsDialogViewModel( private fun InetAddress.isDuplicateDnsEntry( currentIndex: Int? = null, - dnsList: List + dnsList: List, ): Boolean = dnsList.withIndex().any { (index, entry) -> if (index == currentIndex) { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/EditApiAccessMethodViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/EditApiAccessMethodViewModel.kt index d677b27f7ac8..4d85ae986842 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/EditApiAccessMethodViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/EditApiAccessMethodViewModel.kt @@ -41,7 +41,7 @@ import org.apache.commons.validator.routines.InetAddressValidator class EditApiAccessMethodViewModel( private val apiAccessRepository: ApiAccessRepository, private val inetAddressValidator: InetAddressValidator, - savedStateHandle: SavedStateHandle + savedStateHandle: SavedStateHandle, ) : ViewModel() { private var testingJob: Job? = null private val apiAccessMethodId = @@ -60,13 +60,13 @@ class EditApiAccessMethodViewModel( editMode = apiAccessMethodId != null, formData = formData, hasChanges = initialData != formData, - isTestingApiAccessMethod = isTestingApiAccessMethod + isTestingApiAccessMethod = isTestingApiAccessMethod, ) } .stateIn( viewModelScope, SharingStarted.WhileSubscribed(), - EditApiAccessMethodUiState.Loading(editMode = apiAccessMethodId != null) + EditApiAccessMethodUiState.Loading(editMode = apiAccessMethodId != null), ) fun setAccessMethodType(accessMethodType: ApiAccessMethodTypes) { @@ -118,7 +118,7 @@ class EditApiAccessMethodViewModel( EditApiAccessSideEffect.TestApiAccessMethodResult(result.isRight()) ) isTestingApiAccessMethod.value = false - } + }, ) } } @@ -134,10 +134,10 @@ class EditApiAccessMethodViewModel( EditApiAccessSideEffect.OpenSaveDialog( id = apiAccessMethodId, name = name, - customProxy = customProxy + customProxy = customProxy, ) ) - } + }, ) } } @@ -161,7 +161,7 @@ class EditApiAccessMethodViewModel( accessMethod.apiAccessMethod as? ApiAccessMethod.CustomProxy ?: error( "${accessMethod.apiAccessMethod} api access type can not be edited" - ) + ), ) } .getOrElse { error("Access method with id $apiAccessMethodId not found") } @@ -191,7 +191,7 @@ class EditApiAccessMethodViewModel( ip = ip, port = port, password = formData.password.ifBlank { null }, - cipher = formData.cipher + cipher = formData.cipher, ) } @@ -223,24 +223,19 @@ class EditApiAccessMethodViewModel( parseAuth( authEnabled = formData.enableAuthentication, inputUsername = formData.username, - inputPassword = formData.password - ) + inputPassword = formData.password, + ), ) { (ip, port), auth -> ApiAccessMethod.CustomProxy.Socks5Remote(ip = ip, port = port, auth = auth) } private fun parseIpAndPort(ipInput: String, portInput: String) = - zipOrAccumulate( - parseIpAddress(ipInput), - parsePort(portInput), - ) { ip, port -> - ip to port - } + zipOrAccumulate(parseIpAddress(ipInput), parsePort(portInput)) { ip, port -> ip to port } private fun parseAuth( authEnabled: Boolean, inputUsername: String, - inputPassword: String + inputPassword: String, ): EitherNel = if (!authEnabled) { Either.Right(null) @@ -276,7 +271,7 @@ sealed interface EditApiAccessSideEffect { data class OpenSaveDialog( val id: ApiAccessMethodId?, val name: ApiAccessMethodName, - val customProxy: ApiAccessMethod.CustomProxy + val customProxy: ApiAccessMethod.CustomProxy, ) : EditApiAccessSideEffect data class TestApiAccessMethodResult(val successful: Boolean) : EditApiAccessSideEffect diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/EditCustomListNameDialogViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/EditCustomListNameDialogViewModel.kt index c4825be9b710..b57d3f3a6133 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/EditCustomListNameDialogViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/EditCustomListNameDialogViewModel.kt @@ -21,7 +21,7 @@ import net.mullvad.mullvadvpn.usecase.customlists.RenameError class EditCustomListNameDialogViewModel( private val customListActionUseCase: CustomListActionUseCase, - savedStateHandle: SavedStateHandle + savedStateHandle: SavedStateHandle, ) : ViewModel() { private val navArgs = EditCustomListNameDestination.argsFrom(savedStateHandle) @@ -38,7 +38,7 @@ class EditCustomListNameDialogViewModel( .stateIn( viewModelScope, SharingStarted.WhileSubscribed(), - EditCustomListNameUiState(name = navArgs.initialName.value) + EditCustomListNameUiState(name = navArgs.initialName.value), ) fun updateCustomListName(name: String) { @@ -47,7 +47,7 @@ class EditCustomListNameDialogViewModel( CustomListAction.Rename( id = navArgs.customListId, name = navArgs.initialName, - newName = CustomListName.fromString(name) + newName = CustomListName.fromString(name), ) ) .fold( @@ -57,11 +57,11 @@ class EditCustomListNameDialogViewModel( EditCustomListNameDialogSideEffect.ReturnWithResult( CustomListActionResultData.Success.Renamed( newName = it.name, - undo = it.undo + undo = it.undo, ) ) ) - } + }, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/EditCustomListViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/EditCustomListViewModel.kt index 14295533d70c..aa2520c7a1c2 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/EditCustomListViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/EditCustomListViewModel.kt @@ -13,7 +13,7 @@ import net.mullvad.mullvadvpn.repository.CustomListsRepository class EditCustomListViewModel( customListsRepository: CustomListsRepository, - savedStateHandle: SavedStateHandle + savedStateHandle: SavedStateHandle, ) : ViewModel() { private val customListId: CustomListId = EditCustomListDestination.argsFrom(savedStateHandle).customListId @@ -27,7 +27,7 @@ class EditCustomListViewModel( EditCustomListState.Content( id = it.id, name = it.name, - locations = it.locations + locations = it.locations, ) } ?: EditCustomListState.NotFound } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/FilterViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/FilterViewModel.kt index 1529bb42217a..4eaaf21c0fd4 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/FilterViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/FilterViewModel.kt @@ -22,7 +22,7 @@ import net.mullvad.mullvadvpn.usecase.AvailableProvidersUseCase class FilterViewModel( private val availableProvidersUseCase: AvailableProvidersUseCase, - private val relayListFilterRepository: RelayListFilterRepository + private val relayListFilterRepository: RelayListFilterRepository, ) : ViewModel() { private val _uiSideEffect = Channel() val uiSideEffect = _uiSideEffect.receiveAsFlow() @@ -33,10 +33,9 @@ class FilterViewModel( init { viewModelScope.launch { selectedProviders.value = - combine( - availableProvidersUseCase(), - relayListFilterRepository.selectedProviders, - ) { allProviders, selectedConstraintProviders -> + combine(availableProvidersUseCase(), relayListFilterRepository.selectedProviders) { + allProviders, + selectedConstraintProviders -> selectedConstraintProviders.toSelectedProviders(allProviders) } .first() @@ -47,15 +46,14 @@ class FilterViewModel( } val uiState: StateFlow = - combine( + combine(selectedOwnership, availableProvidersUseCase(), selectedProviders) { selectedOwnership, - availableProvidersUseCase(), - selectedProviders, - ) { selectedOwnership, allProviders, selectedProviders -> + allProviders, + selectedProviders -> RelayFilterState( selectedOwnership = selectedOwnership, allProviders = allProviders, - selectedProviders = selectedProviders + selectedProviders = selectedProviders, ) } .stateIn( @@ -64,7 +62,7 @@ class FilterViewModel( RelayFilterState( allProviders = emptyList(), selectedOwnership = null, - selectedProviders = emptyList() + selectedProviders = emptyList(), ), ) @@ -100,7 +98,7 @@ class FilterViewModel( viewModelScope.launch { relayListFilterRepository.updateSelectedOwnershipAndProviderFilter( newSelectedOwnership, - newSelectedProviders + newSelectedProviders, ) _uiSideEffect.send(FilterScreenSideEffect.CloseScreen) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/LoginViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/LoginViewModel.kt index 3c02c9291762..3481a8d1e78f 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/LoginViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/LoginViewModel.kt @@ -50,7 +50,7 @@ class LoginViewModel( private val accountRepository: AccountRepository, private val newDeviceRepository: NewDeviceRepository, private val internetAvailableUseCase: InternetAvailableUseCase, - private val dispatcher: CoroutineDispatcher = Dispatchers.IO + private val dispatcher: CoroutineDispatcher = Dispatchers.IO, ) : ViewModel() { private val _loginState = MutableStateFlow(LoginUiState.INITIAL.loginState) private val _loginInput = MutableStateFlow(LoginUiState.INITIAL.accountNumberInput) @@ -61,11 +61,10 @@ class LoginViewModel( private val _mutableAccountHistory: MutableStateFlow = MutableStateFlow(null) private val _uiState = - combine( - _loginInput, - _mutableAccountHistory, - _loginState, - ) { loginInput, historyAccountNumber, loginState -> + combine(_loginInput, _mutableAccountHistory, _loginState) { + loginInput, + historyAccountNumber, + loginState -> LoginUiState(loginInput, historyAccountNumber, loginState) } @@ -87,7 +86,7 @@ class LoginViewModel( { _mutableAccountHistory.update { null } _mutableAccountHistory.update { accountRepository.fetchAccountHistory() } - } + }, ) } @@ -98,7 +97,7 @@ class LoginViewModel( .createAccount() .fold( { _loginState.value = Idle(LoginError.UnableToCreateAccount) }, - { _uiSideEffect.send(LoginUiSideEffect.NavigateToWelcome) } + { _uiSideEffect.send(LoginUiSideEffect.NavigateToWelcome) }, ) } } @@ -121,7 +120,7 @@ class LoginViewModel( { onSuccessfulLogin() Success - } + }, ) _loginState.update { uiState } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/MtuDialogViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/MtuDialogViewModel.kt index 04484e5dbbd0..292ceec717b6 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/MtuDialogViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/MtuDialogViewModel.kt @@ -20,7 +20,7 @@ import net.mullvad.mullvadvpn.repository.SettingsRepository class MtuDialogViewModel( private val repository: SettingsRepository, savedStateHandle: SavedStateHandle, - private val dispatcher: CoroutineDispatcher = Dispatchers.IO + private val dispatcher: CoroutineDispatcher = Dispatchers.IO, ) : ViewModel() { private val navArgs = MtuDestination.argsFrom(savedStateHandle) @@ -32,7 +32,7 @@ class MtuDialogViewModel( .stateIn( viewModelScope, SharingStarted.WhileSubscribed(), - createState(_mtuInput.value, _isValidMtu.value) + createState(_mtuInput.value, _isValidMtu.value), ) private val _uiSideEffect = Channel() @@ -42,7 +42,7 @@ class MtuDialogViewModel( MtuDialogUiState( mtuInput = mtuInput, isValidInput = isValidMtuInput, - showResetToDefault = navArgs.initialMtu != null + showResetToDefault = navArgs.initialMtu != null, ) fun onInputChanged(value: String) { @@ -57,7 +57,7 @@ class MtuDialogViewModel( .setWireguardMtu(mtu) .fold( { _uiSideEffect.send(MtuDialogSideEffect.Error) }, - { _uiSideEffect.send(MtuDialogSideEffect.Complete) } + { _uiSideEffect.send(MtuDialogSideEffect.Complete) }, ) } @@ -67,7 +67,7 @@ class MtuDialogViewModel( .resetWireguardMtu() .fold( { _uiSideEffect.send(MtuDialogSideEffect.Error) }, - { _uiSideEffect.send(MtuDialogSideEffect.Complete) } + { _uiSideEffect.send(MtuDialogSideEffect.Complete) }, ) } } @@ -81,5 +81,5 @@ sealed interface MtuDialogSideEffect { data class MtuDialogUiState( val mtuInput: String, val isValidInput: Boolean, - val showResetToDefault: Boolean + val showResetToDefault: Boolean, ) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/NoDaemonViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/NoDaemonViewModel.kt index d0c7e4113dad..a3f21f8ccf5c 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/NoDaemonViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/NoDaemonViewModel.kt @@ -67,7 +67,7 @@ class NoDaemonViewModel(managementService: ManagementService) : private fun toDaemonState( lifecycleEvent: Lifecycle.Event, serviceState: GrpcConnectivityState, - currentDestination: DestinationSpec + currentDestination: DestinationSpec, ): DaemonState { // In these destinations we don't care about showing the NoDaemonScreen if (currentDestination in noServiceDestinations) { @@ -92,7 +92,7 @@ class NoDaemonViewModel(managementService: ManagementService) : override fun onDestinationChanged( controller: NavController, destination: NavDestination, - arguments: Bundle? + arguments: Bundle?, ) { viewModelScope.launch { controller.currentBackStackEntry?.destination()?.let { destinationFlow.emit(it) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/OutOfTimeViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/OutOfTimeViewModel.kt index dfa4e6e3cc35..1566cfa65ce0 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/OutOfTimeViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/OutOfTimeViewModel.kt @@ -31,7 +31,7 @@ class OutOfTimeViewModel( private val outOfTimeUseCase: OutOfTimeUseCase, private val connectionProxy: ConnectionProxy, private val pollAccountExpiry: Boolean = true, - private val isPlayBuild: Boolean + private val isPlayBuild: Boolean, ) : ViewModel() { private val _uiSideEffect = Channel() diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/PaymentViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/PaymentViewModel.kt index 7f210721df22..5deae9534da2 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/PaymentViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/PaymentViewModel.kt @@ -16,9 +16,7 @@ import net.mullvad.mullvadvpn.lib.payment.model.PurchaseResult import net.mullvad.mullvadvpn.usecase.PaymentUseCase import net.mullvad.mullvadvpn.util.toPaymentDialogData -class PaymentViewModel( - private val paymentUseCase: PaymentUseCase, -) : ViewModel() { +class PaymentViewModel(private val paymentUseCase: PaymentUseCase) : ViewModel() { val uiState: StateFlow = paymentUseCase.purchaseResult .filterNot { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/PrivacyDisclaimerViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/PrivacyDisclaimerViewModel.kt index bfeadee54707..a78eb1a17bf5 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/PrivacyDisclaimerViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/PrivacyDisclaimerViewModel.kt @@ -13,7 +13,7 @@ data class PrivacyDisclaimerViewState(val isStartingService: Boolean, val isPlay class PrivacyDisclaimerViewModel( private val privacyDisclaimerRepository: PrivacyDisclaimerRepository, - isPlayBuild: Boolean + isPlayBuild: Boolean, ) : ViewModel() { private val _uiState = diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ReportProblemViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ReportProblemViewModel.kt index 208c65a31288..3b1ce59a70b9 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ReportProblemViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ReportProblemViewModel.kt @@ -37,16 +37,13 @@ sealed interface ReportProblemSideEffect { class ReportProblemViewModel( private val mullvadProblemReporter: MullvadProblemReport, - private val problemReportRepository: ProblemReportRepository + private val problemReportRepository: ProblemReportRepository, ) : ViewModel() { private val sendingState: MutableStateFlow = MutableStateFlow(null) val uiState = - combine( - sendingState, - problemReportRepository.problemReport, - ) { pendingState, userReport -> + combine(sendingState, problemReportRepository.problemReport) { pendingState, userReport -> ReportProblemUiState( sendingState = pendingState, email = userReport.email ?: "", diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ResetServerIpOverridesConfirmationViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ResetServerIpOverridesConfirmationViewModel.kt index f7bbd73907c6..254ef7006637 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ResetServerIpOverridesConfirmationViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ResetServerIpOverridesConfirmationViewModel.kt @@ -9,7 +9,7 @@ import net.mullvad.mullvadvpn.lib.model.ClearAllOverridesError import net.mullvad.mullvadvpn.repository.RelayOverridesRepository class ResetServerIpOverridesConfirmationViewModel( - private val relayOverridesRepository: RelayOverridesRepository, + private val relayOverridesRepository: RelayOverridesRepository ) : ViewModel() { private val _uiSideEffect = Channel() val uiSideEffect = _uiSideEffect.receiveAsFlow() @@ -28,7 +28,7 @@ class ResetServerIpOverridesConfirmationViewModel( _uiSideEffect.send( ResetServerIpOverridesConfirmationUiSideEffect.OverridesCleared ) - } + }, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SaveApiAccessMethodViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SaveApiAccessMethodViewModel.kt index e3bb3f783af9..28d382ac04b4 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SaveApiAccessMethodViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SaveApiAccessMethodViewModel.kt @@ -20,7 +20,7 @@ import net.mullvad.mullvadvpn.repository.ApiAccessRepository class SaveApiAccessMethodViewModel( private val apiAccessRepository: ApiAccessRepository, - savedStateHandle: SavedStateHandle + savedStateHandle: SavedStateHandle, ) : ViewModel() { private val navArgs = SaveApiAccessMethodDestination.argsFrom(savedStateHandle) private val apiAccessMethodId: ApiAccessMethodId? = navArgs.id @@ -47,7 +47,7 @@ class SaveApiAccessMethodViewModel( it.copy(testingState = TestApiAccessMethodState.Result.Successful) } save() - } + }, ) } } @@ -59,14 +59,14 @@ class SaveApiAccessMethodViewModel( updateAccessMethod( id = apiAccessMethodId, name = apiAccessMethodName, - apiAccessMethod = customProxy + apiAccessMethod = customProxy, ) } else { addNewAccessMethod( NewAccessMethodSetting( name = apiAccessMethodName, enabled = true, - apiAccessMethod = customProxy + apiAccessMethod = customProxy, ) ) } @@ -78,24 +78,24 @@ class SaveApiAccessMethodViewModel( .addApiAccessMethod(newAccessMethodSetting) .fold( { _uiSideEffect.send(SaveApiAccessMethodSideEffect.CouldNotSaveApiAccessMethod) }, - { _uiSideEffect.send(SaveApiAccessMethodSideEffect.SuccessfullyCreatedApiMethod) } + { _uiSideEffect.send(SaveApiAccessMethodSideEffect.SuccessfullyCreatedApiMethod) }, ) } private suspend fun updateAccessMethod( id: ApiAccessMethodId, name: ApiAccessMethodName, - apiAccessMethod: ApiAccessMethod.CustomProxy + apiAccessMethod: ApiAccessMethod.CustomProxy, ) { apiAccessRepository .updateApiAccessMethod( apiAccessMethodId = id, apiAccessMethodName = name, - apiAccessMethod = apiAccessMethod + apiAccessMethod = apiAccessMethod, ) .fold( { _uiSideEffect.send(SaveApiAccessMethodSideEffect.CouldNotSaveApiAccessMethod) }, - { _uiSideEffect.send(SaveApiAccessMethodSideEffect.SuccessfullyCreatedApiMethod) } + { _uiSideEffect.send(SaveApiAccessMethodSideEffect.SuccessfullyCreatedApiMethod) }, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModel.kt index dae0071bc71e..04476ea560db 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModel.kt @@ -50,7 +50,7 @@ class SelectLocationViewModel( private val customListsRepository: CustomListsRepository, private val customListActionUseCase: CustomListActionUseCase, private val filteredRelayListUseCase: FilteredRelayListUseCase, - private val relayListRepository: RelayListRepository + private val relayListRepository: RelayListRepository, ) : ViewModel() { private val _searchTerm = MutableStateFlow(EMPTY_SEARCH_TERM) @@ -67,14 +67,10 @@ class SelectLocationViewModel( searchTerm = searchTerm, filterChips = filterChips, relayListItems = relayListItems, - customLists = customLists + customLists = customLists, ) } - .stateIn( - viewModelScope, - SharingStarted.Lazily, - SelectLocationUiState.Loading, - ) + .stateIn(viewModelScope, SharingStarted.Lazily, SelectLocationUiState.Loading) private val _uiSideEffect = Channel() val uiSideEffect = _uiSideEffect.receiveAsFlow() @@ -97,10 +93,7 @@ class SelectLocationViewModel( } private fun searchRelayListLocations() = - combine( - _searchTerm, - filteredRelayListUseCase(), - ) { searchTerm, relayCountries -> + combine(_searchTerm, filteredRelayListUseCase()) { searchTerm, relayCountries -> val isSearching = searchTerm.length >= MIN_SEARCH_LENGTH if (isSearching) { val (exp, filteredRelayCountries) = relayCountries.newFilterOnSearch(searchTerm) @@ -117,8 +110,7 @@ class SelectLocationViewModel( relayListFilterRepository.selectedOwnership, relayListFilterRepository.selectedProviders, availableProvidersUseCase(), - ) { selectedOwnership, selectedConstraintProviders, allProviders, - -> + ) { selectedOwnership, selectedConstraintProviders, allProviders -> val ownershipFilter = selectedOwnership.getOrNull() val providerCountFilter = when (selectedConstraintProviders) { @@ -157,7 +149,7 @@ class SelectLocationViewModel( searchTerm.length >= MIN_SEARCH_LENGTH, selectedItem.getOrNull(), filteredCustomLists, - relayCountries + relayCountries, ) { it in expandedItems } @@ -174,7 +166,7 @@ class SelectLocationViewModel( selectedItem: RelayItemId?, customLists: List, countries: List, - isExpanded: (String) -> Boolean + isExpanded: (String) -> Boolean, ): List = createCustomListSection(isSearching, selectedItem, customLists, isExpanded) + createLocationSection(isSearching, selectedItem, countries, isExpanded) @@ -183,7 +175,7 @@ class SelectLocationViewModel( isSearching: Boolean, selectedItem: RelayItemId?, customLists: List, - isExpanded: (String) -> Boolean + isExpanded: (String) -> Boolean, ): List = buildList { if (isSearching && customLists.isEmpty()) { // If we are searching and no results are found don't show header or footer @@ -198,7 +190,7 @@ class SelectLocationViewModel( private fun createCustomListRelayItems( customLists: List, selectedItem: RelayItemId?, - isExpanded: (String) -> Boolean + isExpanded: (String) -> Boolean, ): List = customLists.flatMap { customList -> val expanded = isExpanded(customList.id.expandKey()) @@ -207,7 +199,7 @@ class SelectLocationViewModel( RelayListItem.CustomListItem( customList, isSelected = selectedItem == customList.id, - expanded + expanded, ) ) @@ -225,7 +217,7 @@ class SelectLocationViewModel( isSearching: Boolean, selectedItem: RelayItemId?, countries: List, - isExpanded: (String) -> Boolean + isExpanded: (String) -> Boolean, ): List = buildList { if (isSearching && countries.isEmpty()) { // If we are searching and no results are found don't show header or footer @@ -252,7 +244,7 @@ class SelectLocationViewModel( parentName = parent.customList.name, item = item, expanded = expanded, - depth + depth, ) ) @@ -279,7 +271,7 @@ class SelectLocationViewModel( item: RelayItem.Location, selectedItem: RelayItemId?, depth: Int = 0, - isExpanded: (String) -> Boolean + isExpanded: (String) -> Boolean, ): List = buildList { val expanded = isExpanded(item.id.expandKey()) @@ -347,7 +339,7 @@ class SelectLocationViewModel( private fun filterSelectedProvidersByOwnership( selectedProviders: List, - selectedOwnership: Ownership? + selectedOwnership: Ownership?, ): List = if (selectedOwnership == null) selectedProviders else selectedProviders.filter { it.ownership == selectedOwnership } @@ -375,12 +367,12 @@ class SelectLocationViewModel( CustomListActionResultData.Success.LocationAdded( customListName = it.name, locationName = item.name, - undo = it.undo + undo = it.undo, ) } else { CustomListActionResultData.Success.LocationChanged( customListName = it.name, - undo = it.undo + undo = it.undo, ) } }, @@ -409,12 +401,12 @@ class SelectLocationViewModel( CustomListActionResultData.Success.LocationRemoved( customListName = success.name, locationName = item.name, - undo = success.undo + undo = success.undo, ) } else { CustomListActionResultData.Success.LocationChanged( customListName = success.name, - undo = success.undo + undo = success.undo, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ServerIpOverridesViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ServerIpOverridesViewModel.kt index 069eda8dc8f3..99440530a551 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ServerIpOverridesViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ServerIpOverridesViewModel.kt @@ -32,7 +32,7 @@ class ServerIpOverridesViewModel( .stateIn( viewModelScope, SharingStarted.WhileSubscribed(), - ServerIpOverridesViewState.Loading + ServerIpOverridesViewState.Loading, ) fun importFile(uri: Uri) = @@ -56,7 +56,7 @@ class ServerIpOverridesViewModel( { error -> _uiSideEffect.send(ServerIpOverridesUiSideEffect.ImportResult(error)) }, - { _uiSideEffect.send(ServerIpOverridesUiSideEffect.ImportResult(null)) } + { _uiSideEffect.send(ServerIpOverridesUiSideEffect.ImportResult(null)) }, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SettingsViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SettingsViewModel.kt index f3aa1b24c7eb..4cd11f2cc461 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SettingsViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SettingsViewModel.kt @@ -14,19 +14,18 @@ import net.mullvad.mullvadvpn.ui.serviceconnection.AppVersionInfoRepository class SettingsViewModel( deviceRepository: DeviceRepository, appVersionInfoRepository: AppVersionInfoRepository, - isPlayBuild: Boolean + isPlayBuild: Boolean, ) : ViewModel() { val uiState: StateFlow = - combine( - deviceRepository.deviceState, - appVersionInfoRepository.versionInfo(), - ) { deviceState, versionInfo -> + combine(deviceRepository.deviceState, appVersionInfoRepository.versionInfo()) { + deviceState, + versionInfo -> SettingsUiState( isLoggedIn = deviceState is DeviceState.LoggedIn, appVersion = versionInfo.currentVersion, isSupportedVersion = versionInfo.isSupported, - isPlayBuild = isPlayBuild + isPlayBuild = isPlayBuild, ) } .stateIn( @@ -37,6 +36,6 @@ class SettingsViewModel( isLoggedIn = false, isSupportedVersion = true, isPlayBuild = isPlayBuild, - ) + ), ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SplashViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SplashViewModel.kt index cc9743510597..9a0d9cdeffc1 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SplashViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SplashViewModel.kt @@ -24,7 +24,7 @@ class SplashViewModel( private val privacyDisclaimerRepository: PrivacyDisclaimerRepository, private val accountRepository: AccountRepository, private val deviceRepository: DeviceRepository, - private val splashCompleteRepository: SplashCompleteRepository + private val splashCompleteRepository: SplashCompleteRepository, ) : ViewModel() { val uiSideEffect = flow { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SplitTunnelingViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SplitTunnelingViewModel.kt index b43e046e570b..939de6a38a0e 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SplitTunnelingViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SplitTunnelingViewModel.kt @@ -19,7 +19,7 @@ import net.mullvad.mullvadvpn.repository.SplitTunnelingRepository class SplitTunnelingViewModel( private val appsProvider: ApplicationsProvider, private val splitTunnelingRepository: SplitTunnelingRepository, - private val dispatcher: CoroutineDispatcher + private val dispatcher: CoroutineDispatcher, ) : ViewModel() { private val allApps = MutableStateFlow?>(null) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SplitTunnelingViewModelState.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SplitTunnelingViewModelState.kt index 38eac0d4eec1..391f29a3a057 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SplitTunnelingViewModelState.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/SplitTunnelingViewModelState.kt @@ -8,7 +8,7 @@ data class SplitTunnelingViewModelState( val enabled: Boolean = false, val excludedApps: Set = emptySet(), val allApps: List? = null, - val showSystemApps: Boolean = false + val showSystemApps: Boolean = false, ) { fun toUiState(): SplitTunnelingUiState { return allApps @@ -30,7 +30,7 @@ data class SplitTunnelingViewModelState( included.filter { appData -> !appData.isSystemApp } } .sort(), - showSystemApps = showSystemApps + showSystemApps = showSystemApps, ) } ?: SplitTunnelingUiState.Loading(enabled = enabled) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ViewLogsViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ViewLogsViewModel.kt index 618536eaa2d2..27f1156540d2 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ViewLogsViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ViewLogsViewModel.kt @@ -11,7 +11,7 @@ import net.mullvad.mullvadvpn.dataproxy.MullvadProblemReport data class ViewLogsUiState( val allLines: List = emptyList(), - val isLoading: Boolean = true + val isLoading: Boolean = true, ) { fun text() = allLines.joinToString(NEWLINE_STRING) } 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 857953f28bbf..23fe12130e93 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 @@ -48,7 +48,7 @@ class VoucherDialogViewModel(private val voucherRepository: VoucherRepository) : } .fold( { error -> setError(error) }, - { success -> handleAddedTime(success.timeAdded) } + { success -> handleAddedTime(success.timeAdded) }, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnPermissionViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnPermissionViewModel.kt index cd9a52efa19d..1e5972b53897 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnPermissionViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnPermissionViewModel.kt @@ -15,7 +15,7 @@ import net.mullvad.mullvadvpn.lib.shared.ConnectionProxy class VpnPermissionViewModel( intentProvider: IntentProvider, - private val connectionProxy: ConnectionProxy + private val connectionProxy: ConnectionProxy, ) : ViewModel() { val uiSideEffect: Flow = intentProvider.intents diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModel.kt index 1e9a335951d3..abaad265fe12 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModel.kt @@ -46,7 +46,7 @@ class VpnSettingsViewModel( private val repository: SettingsRepository, private val relayListRepository: RelayListRepository, private val systemVpnSettingsUseCase: SystemVpnSettingsAvailableUseCase, - private val dispatcher: CoroutineDispatcher = Dispatchers.IO + private val dispatcher: CoroutineDispatcher = Dispatchers.IO, ) : ViewModel() { private val _uiSideEffect = Channel() @@ -55,11 +55,10 @@ class VpnSettingsViewModel( private val customPort = MutableStateFlow?>(null) private val vmState = - combine( - repository.settingsUpdates, - relayListRepository.portRanges, - customPort, - ) { settings, portRanges, customWgPort -> + combine(repository.settingsUpdates, relayListRepository.portRanges, customPort) { + settings, + portRanges, + customWgPort -> VpnSettingsViewModelState( mtuValue = settings?.tunnelOptions?.wireguard?.mtu, isAutoConnectEnabled = settings?.autoConnect ?: false, @@ -76,13 +75,13 @@ class VpnSettingsViewModel( selectedWireguardPort = settings?.getWireguardPort() ?: Constraint.Any, customWireguardPort = customWgPort, availablePortRanges = portRanges, - systemVpnSettingsAvailable = systemVpnSettingsUseCase() + systemVpnSettingsAvailable = systemVpnSettingsUseCase(), ) } .stateIn( viewModelScope, SharingStarted.WhileSubscribed(), - VpnSettingsViewModelState.default() + VpnSettingsViewModelState.default(), ) val uiState = @@ -91,7 +90,7 @@ class VpnSettingsViewModel( .stateIn( viewModelScope, SharingStarted.WhileSubscribed(), - VpnSettingsUiState.createDefault() + VpnSettingsUiState.createDefault(), ) init { @@ -144,7 +143,7 @@ class VpnSettingsViewModel( } else if (vmState.value.customDnsList.isNotEmpty()) { showApplySettingChangesWarningToast() } - } + }, ) } } @@ -250,7 +249,7 @@ class VpnSettingsViewModel( .setDnsOptions( isCustomDnsEnabled = vmState.value.isCustomDnsEnabled, dnsList = vmState.value.customDnsList.map { it.address }.asInetAddressList(), - contentBlockersOptions = contentBlockersOption + contentBlockersOptions = contentBlockersOption, ) .onLeft { _uiSideEffect.send(VpnSettingsSideEffect.ShowToast.GenericError) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModelState.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModelState.kt index d8be8d1cf27e..534263b44b1f 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModelState.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModelState.kt @@ -38,7 +38,7 @@ data class VpnSettingsViewModelState( selectedWireguardPort, customWireguardPort, availablePortRanges, - systemVpnSettingsAvailable + systemVpnSettingsAvailable, ) companion object { @@ -56,7 +56,7 @@ data class VpnSettingsViewModelState( selectedWireguardPort = Constraint.Any, customWireguardPort = null, availablePortRanges = emptyList(), - systemVpnSettingsAvailable = false + systemVpnSettingsAvailable = false, ) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/WelcomeViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/WelcomeViewModel.kt index e532045ae280..2a6b00775500 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/WelcomeViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/WelcomeViewModel.kt @@ -30,7 +30,7 @@ class WelcomeViewModel( private val paymentUseCase: PaymentUseCase, private val connectionProxy: ConnectionProxy, private val pollAccountExpiry: Boolean = true, - private val isPlayBuild: Boolean + private val isPlayBuild: Boolean, ) : ViewModel() { private val _uiSideEffect = Channel() val uiSideEffect = merge(_uiSideEffect.receiveAsFlow(), hasAddedTimeEffect()) diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/InAppNotificationControllerTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/InAppNotificationControllerTest.kt index 78f1563c852b..3bbdcea9ccdf 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/InAppNotificationControllerTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/InAppNotificationControllerTest.kt @@ -56,7 +56,7 @@ class InAppNotificationControllerTest { newDeviceNotificationUseCase, versionNotificationUseCase, tunnelStateNotificationUseCase, - CoroutineScope(job + UnconfinedTestDispatcher()) + CoroutineScope(job + UnconfinedTestDispatcher()), ) } @@ -93,7 +93,7 @@ class InAppNotificationControllerTest { accountExpiry, newDevice, ), - notifications + notifications, ) } } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/applist/ApplicationsProviderTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/applist/ApplicationsProviderTest.kt index 62ceaa7ebefd..560dafb24a42 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/applist/ApplicationsProviderTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/applist/ApplicationsProviderTest.kt @@ -39,7 +39,7 @@ class ApplicationsProviderTest { createApplicationInfo( launchWithInternetPackageName, launch = true, - internet = true + internet = true, ), createApplicationInfo(launchWithoutInternetPackageName, launch = true), createApplicationInfo(nonLaunchWithInternetPackageName, internet = true), @@ -47,10 +47,10 @@ class ApplicationsProviderTest { createApplicationInfo( leanbackLaunchWithInternetPackageName, leanback = true, - internet = true + internet = true, ), createApplicationInfo(leanbackLaunchWithoutInternetPackageName, leanback = true), - createApplicationInfo(selfPackageName, internet = true, launch = true) + createApplicationInfo(selfPackageName, internet = true, launch = true), ) val result = testSubject.getAppsList() @@ -61,13 +61,13 @@ class ApplicationsProviderTest { nonLaunchWithInternetPackageName, 0, nonLaunchWithInternetPackageName, - true + true, ), AppData( leanbackLaunchWithInternetPackageName, 0, - leanbackLaunchWithInternetPackageName - ) + leanbackLaunchWithInternetPackageName, + ), ) assertLists(expected, result) @@ -82,7 +82,7 @@ class ApplicationsProviderTest { nonLaunchWithoutInternetPackageName, leanbackLaunchWithInternetPackageName, leanbackLaunchWithoutInternetPackageName, - selfPackageName + selfPackageName, ) .forEach { packageName -> mockedPackageManager.checkPermission(internet, packageName) @@ -91,16 +91,13 @@ class ApplicationsProviderTest { listOf( launchWithInternetPackageName, nonLaunchWithInternetPackageName, - leanbackLaunchWithInternetPackageName + leanbackLaunchWithInternetPackageName, ) .forEach { packageName -> mockedPackageManager.getLaunchIntentForPackage(packageName) } - listOf( - nonLaunchWithInternetPackageName, - leanbackLaunchWithInternetPackageName, - ) + listOf(nonLaunchWithInternetPackageName, leanbackLaunchWithInternetPackageName) .forEach { packageName -> mockedPackageManager.getLeanbackLaunchIntentForPackage(packageName) } @@ -112,7 +109,7 @@ class ApplicationsProviderTest { launch: Boolean = false, leanback: Boolean = false, internet: Boolean = false, - systemApp: Boolean = false + systemApp: Boolean = false, ): ApplicationInfo { val mockApplicationInfo = mockk() diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/repository/ApiAccessRepositoryTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/repository/ApiAccessRepositoryTest.kt index cb1042e6f8e4..9f0e9e9c68a1 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/repository/ApiAccessRepositoryTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/repository/ApiAccessRepositoryTest.kt @@ -42,7 +42,7 @@ class ApiAccessRepositoryTest { apiAccessRepository = ApiAccessRepository( managementService = mockManagementService, - dispatcher = UnconfinedTestDispatcher() + dispatcher = UnconfinedTestDispatcher(), ) } @@ -180,7 +180,7 @@ class ApiAccessRepositoryTest { name = ApiAccessMethodName.fromString("Name"), apiAccessMethod = ApiAccessMethod.Direct, enabled = true, - id = apiAccessMethodId + id = apiAccessMethodId, ) val mockSettings: Settings = mockk() every { mockSettings.apiAccessMethodSettings } returns listOf(expectedResult) @@ -220,7 +220,7 @@ class ApiAccessRepositoryTest { name = ApiAccessMethodName.fromString("Name"), apiAccessMethod = ApiAccessMethod.Direct, enabled = true, - id = apiAccessMethodId + id = apiAccessMethodId, ) val mockSettings: Settings = mockk() every { mockSettings.apiAccessMethodSettings } returns listOf(apiAccessMethodSetting) @@ -263,7 +263,7 @@ class ApiAccessRepositoryTest { name = ApiAccessMethodName.fromString("Name"), apiAccessMethod = ApiAccessMethod.Direct, enabled = true, - id = apiAccessMethodId + id = apiAccessMethodId, ) val mockSettings: Settings = mockk() every { mockSettings.apiAccessMethodSettings } returns listOf(apiAccessMethodSetting) diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/repository/ChangelogRepositoryTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/repository/ChangelogRepositoryTest.kt index 4df5c101a759..4929c7117b09 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/repository/ChangelogRepositoryTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/repository/ChangelogRepositoryTest.kt @@ -25,7 +25,7 @@ class ChangelogRepositoryTest { val expectedResult = listOf( "Added very nice new feature with a very long descriptive message about how it works...", - "Fixed super bad leak." + "Fixed super bad leak.", ) every { mockDataProvider.getChangelog() } returns testChangelog diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/repository/CustomListsRepositoryTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/repository/CustomListsRepositoryTest.kt index 09b5f4925b03..9148d45be7f4 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/repository/CustomListsRepositoryTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/repository/CustomListsRepositoryTest.kt @@ -36,7 +36,7 @@ class CustomListsRepositoryTest { customListsRepository = CustomListsRepository( managementService = mockManagementService, - dispatcher = UnconfinedTestDispatcher() + dispatcher = UnconfinedTestDispatcher(), ) } @@ -49,7 +49,7 @@ class CustomListsRepositoryTest { CustomList( id = customListId, name = mockk(relaxed = true), - locations = mockk(relaxed = true) + locations = mockk(relaxed = true), ) val mockSettings: Settings = mockk() every { mockSettings.customLists } returns listOf(mockCustomList) @@ -71,7 +71,7 @@ class CustomListsRepositoryTest { CustomList( id = customListId, name = mockk(relaxed = true), - locations = mockk(relaxed = true) + locations = mockk(relaxed = true), ) val mockSettings: Settings = mockk() val otherCustomListId = CustomListId("2") @@ -126,7 +126,7 @@ class CustomListsRepositoryTest { CustomList( id = customListId, name = mockk(relaxed = true), - locations = mockk(relaxed = true) + locations = mockk(relaxed = true), ) every { mockSettings.customLists } returns listOf(mockCustomList) settingsFlow.value = mockSettings @@ -152,7 +152,7 @@ class CustomListsRepositoryTest { CustomList( id = customListId, name = CustomListName.fromString("OLD CUSTOM"), - locations = emptyList() + locations = emptyList(), ) val updatedCustomList = CustomList(id = customListId, name = customListName, locations = emptyList()) @@ -220,7 +220,7 @@ class CustomListsRepositoryTest { CustomList( id = customListId, name = CustomListName.fromString("name"), - locations = emptyList() + locations = emptyList(), ) val locationId = GeoLocationId.Country("se") every { mockSettings.customLists } returns listOf(mockCustomList) @@ -230,7 +230,7 @@ class CustomListsRepositoryTest { val result = customListsRepository.updateCustomListLocations( otherCustomListId, - listOf(locationId) + listOf(locationId), ) // Assert diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/repository/RelayListFilterRepositoryTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/repository/RelayListFilterRepositoryTest.kt index c8027240a264..53d2b1044df0 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/repository/RelayListFilterRepositoryTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/repository/RelayListFilterRepositoryTest.kt @@ -34,7 +34,7 @@ class RelayListFilterRepositoryTest { relayListFilterRepository = RelayListFilterRepository( managementService = mockManagementService, - dispatcher = UnconfinedTestDispatcher() + dispatcher = UnconfinedTestDispatcher(), ) } @@ -82,7 +82,7 @@ class RelayListFilterRepositoryTest { val result = relayListFilterRepository.updateSelectedOwnershipAndProviderFilter( ownership, - providers + providers, ) // Assert @@ -104,7 +104,7 @@ class RelayListFilterRepositoryTest { val result = relayListFilterRepository.updateSelectedOwnershipAndProviderFilter( ownership, - providers + providers, ) // Assert diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/usecase/AccountExpiryNotificationUseCaseTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/usecase/AccountExpiryNotificationUseCaseTest.kt index 897ab65e15f4..f8a0e52a3e83 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/usecase/AccountExpiryNotificationUseCaseTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/usecase/AccountExpiryNotificationUseCaseTest.kt @@ -56,7 +56,7 @@ class AccountExpiryNotificationUseCaseTest { assertEquals( listOf(InAppNotification.AccountExpiry(closeToExpiry.expiryDate)), - awaitItem() + awaitItem(), ) } } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/usecase/CustomListActionUseCaseTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/usecase/CustomListActionUseCaseTest.kt index 5af19ade8b28..233d429bc488 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/usecase/CustomListActionUseCaseTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/usecase/CustomListActionUseCaseTest.kt @@ -35,7 +35,7 @@ class CustomListActionUseCaseTest { private val customListActionUseCase = CustomListActionUseCase( customListsRepository = mockCustomListsRepository, - relayListRepository = mockRelayListRepository + relayListRepository = mockRelayListRepository, ) private val relayListFlow = MutableStateFlow(emptyList()) @@ -59,7 +59,7 @@ class CustomListActionUseCaseTest { id = createdId, name = name, locationNames = listOf(locationName), - undo = action.not(createdId) + undo = action.not(createdId), ) .right() coEvery { mockCustomListsRepository.createCustomList(name) } returns createdId.right() @@ -71,7 +71,7 @@ class CustomListActionUseCaseTest { RelayItem.Location.Country( id = locationId, name = locationName, - cities = emptyList() + cities = emptyList(), ) ) diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/usecase/NewDeviceNotificationUseCaseTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/usecase/NewDeviceNotificationUseCaseTest.kt index 0ed49aae7fb7..32cc48f2c5e9 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/usecase/NewDeviceNotificationUseCaseTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/usecase/NewDeviceNotificationUseCaseTest.kt @@ -35,8 +35,8 @@ class NewDeviceNotificationUseCaseTest { Device( id = DeviceId.fromString(UUID), name = deviceName, - creationDate = DateTime.now() - ) + creationDate = DateTime.now(), + ), ) ) private val isNewDeviceState = MutableStateFlow(false) @@ -57,7 +57,7 @@ class NewDeviceNotificationUseCaseTest { newDeviceNotificationUseCase = NewDeviceNotificationUseCase( newDeviceRepository = mockNewDeviceRepository, - deviceRepository = mockDeviceRepository + deviceRepository = mockDeviceRepository, ) } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/usecase/VersionNotificationUseCaseTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/usecase/VersionNotificationUseCaseTest.kt index 944ebc11a4a8..1aead39d853d 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/usecase/VersionNotificationUseCaseTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/usecase/VersionNotificationUseCaseTest.kt @@ -34,7 +34,7 @@ class VersionNotificationUseCaseTest { versionNotificationUseCase = VersionNotificationUseCase( appVersionInfoRepository = mockAppVersionInfoRepository, - isVersionInfoNotificationEnabled = true + isVersionInfoNotificationEnabled = true, ) } @@ -54,18 +54,14 @@ class VersionNotificationUseCaseTest { runTest { versionNotificationUseCase().test { // Arrange, Act - val upgradeVersionInfo = - VersionInfo( - currentVersion = "1.0", - isSupported = false, - ) + val upgradeVersionInfo = VersionInfo(currentVersion = "1.0", isSupported = false) awaitItem() versionInfo.value = upgradeVersionInfo // Assert assertEquals( awaitItem(), - listOf(InAppNotification.UnsupportedVersion(upgradeVersionInfo)) + listOf(InAppNotification.UnsupportedVersion(upgradeVersionInfo)), ) } } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/utils/VoucherRegexHelperParameterizedTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/utils/VoucherRegexHelperParameterizedTest.kt index abe325ba4393..5ccf28e6f6f2 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/utils/VoucherRegexHelperParameterizedTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/utils/VoucherRegexHelperParameterizedTest.kt @@ -34,7 +34,7 @@ class VoucherRegexHelperParameterizedTest { arrayOf(IS_ACCEPTED_FORMAT, "AAAA-AAAA-1111-2222\n"), arrayOf(IS_UNACCEPTED_FORMAT, "@"), arrayOf(IS_UNACCEPTED_FORMAT, "AAAABBBBCCCCDDDD\t"), - arrayOf(IS_UNACCEPTED_FORMAT, "AAAA_BBBB_CCCC_DDDD") + arrayOf(IS_UNACCEPTED_FORMAT, "AAAA_BBBB_CCCC_DDDD"), ) } } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/AccountViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/AccountViewModelTest.kt index d239e01331a6..0a9d2f36f9a1 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/AccountViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/AccountViewModelTest.kt @@ -43,10 +43,7 @@ class AccountViewModelTest { private val dummyDevice = Device(id = DeviceId.fromString(UUID), name = "fake_name", creationDate = DateTime.now()) - private val dummyAccountNumber: AccountNumber = - AccountNumber( - DUMMY_DEVICE_NAME, - ) + private val dummyAccountNumber: AccountNumber = AccountNumber(DUMMY_DEVICE_NAME) private val deviceState: MutableStateFlow = MutableStateFlow( @@ -72,7 +69,7 @@ class AccountViewModelTest { accountRepository = mockAccountRepository, deviceRepository = mockDeviceRepository, paymentUseCase = mockPaymentUseCase, - isPlayBuild = false + isPlayBuild = false, ) } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ApiAccessMethodDetailsViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ApiAccessMethodDetailsViewModelTest.kt index bd304573d3da..7b355ed194a9 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ApiAccessMethodDetailsViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ApiAccessMethodDetailsViewModelTest.kt @@ -54,7 +54,7 @@ class ApiAccessMethodDetailsViewModelTest { apiAccessRepository = mockApiAccessRepository, savedStateHandle = ApiAccessMethodDetailsNavArgs(accessMethodId = apiAccessMethodId) - .toSavedStateHandle() + .toSavedStateHandle(), ) } @@ -183,7 +183,7 @@ class ApiAccessMethodDetailsViewModelTest { apiAccessMethodDetailsViewModel.openEditPage() assertEquals( ApiAccessMethodDetailsSideEffect.OpenEditPage(apiAccessMethodId), - awaitItem() + awaitItem(), ) } } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModelTest.kt index 855eea238d6a..79f97ff46644 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModelTest.kt @@ -130,7 +130,7 @@ class ConnectViewModelTest { connectionProxy = mockConnectionProxy, lastKnownLocationUseCase = mockLastKnownLocationUseCase, vpnPermissionRepository = mockVpnPermissionRepository, - isPlayBuild = false + isPlayBuild = false, ) } @@ -200,7 +200,7 @@ class ConnectViewModelTest { city = "Gothenburg", hostname = "Host", latitude = 57.7065, - longitude = 11.967 + longitude = 11.967, ) // Act, Assert diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/CreateCustomListDialogViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/CreateCustomListDialogViewModelTest.kt index fee63ae8047a..bcc6f6ff95df 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/CreateCustomListDialogViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/CreateCustomListDialogViewModelTest.kt @@ -42,7 +42,7 @@ class CreateCustomListDialogViewModelTest { CustomListActionResultData.Success.CreatedWithLocations( customListName = customListName, locationNames = locationNames, - undo = mockUndo + undo = mockUndo, ) val viewModel = createViewModelWithLocationCode(GeoLocationId.Country("AB")) coEvery { mockCustomListActionUseCase(any()) } returns @@ -72,7 +72,7 @@ class CreateCustomListDialogViewModelTest { id = createdId, name = customListName, locationNames = emptyList(), - undo = CustomListAction.Delete(createdId) + undo = CustomListAction.Delete(createdId), ) val viewModel = createViewModelWithLocationCode(GeoLocationId.Country("AB")) coEvery { mockCustomListActionUseCase(any()) } returns @@ -130,9 +130,6 @@ class CreateCustomListDialogViewModelTest { CreateCustomListDialogViewModel( customListActionUseCase = mockCustomListActionUseCase, savedStateHandle = - CreateCustomListNavArgs( - locationCode = locationCode, - ) - .toSavedStateHandle() + CreateCustomListNavArgs(locationCode = locationCode).toSavedStateHandle(), ) } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/CustomListLocationsViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/CustomListLocationsViewModelTest.kt index f453223ec709..e4012abd9e0e 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/CustomListLocationsViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/CustomListLocationsViewModelTest.kt @@ -58,7 +58,7 @@ class CustomListLocationsViewModelTest { CustomList( id = CustomListId("id"), name = CustomListName.fromString("name"), - locations = emptyList() + locations = emptyList(), ) val viewModel = createViewModel(customListId = customList.id, newList = newList) @@ -76,7 +76,7 @@ class CustomListLocationsViewModelTest { item = it, depth = it.toDepth(), checked = false, - expanded = false + expanded = false, ) } val customListId = CustomListId("id") @@ -250,7 +250,7 @@ class CustomListLocationsViewModelTest { val expectedResult = CustomListActionResultData.Success.LocationChanged( customListName = customListName, - undo = mockUndo + undo = mockUndo, ) coEvery { mockCustomListUseCase(any()) } returns locationsChangedMock.right() @@ -272,18 +272,15 @@ class CustomListLocationsViewModelTest { private fun createViewModel( customListId: CustomListId, - newList: Boolean + newList: Boolean, ): CustomListLocationsViewModel { return CustomListLocationsViewModel( relayListRepository = mockRelayListRepository, customListRelayItemsUseCase = mockCustomListRelayItemsUseCase, customListActionUseCase = mockCustomListUseCase, savedStateHandle = - CustomListLocationsNavArgs( - customListId = customListId, - newList = newList, - ) - .toSavedStateHandle() + CustomListLocationsNavArgs(customListId = customListId, newList = newList) + .toSavedStateHandle(), ) } @@ -315,20 +312,20 @@ class CustomListLocationsViewModelTest { GeoLocationId.Hostname( GeoLocationId.City( GeoLocationId.Country("SE"), - "GBG" + "GBG", ), - "gbg-1" + "gbg-1", ), active = true, provider = Provider( ProviderId("Provider"), - ownership = Ownership.MullvadOwned - ) + ownership = Ownership.MullvadOwned, + ), ) - ) + ), ) - ) + ), ) ) } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/CustomListsViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/CustomListsViewModelTest.kt index bddb36e44691..50c52f74cd8c 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/CustomListsViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/CustomListsViewModelTest.kt @@ -49,6 +49,6 @@ class CustomListsViewModelTest { private fun createViewModel() = CustomListsViewModel( customListsRepository = mockCustomListsRepository, - customListActionUseCase = mockCustomListsActionUseCase + customListActionUseCase = mockCustomListsActionUseCase, ) } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/DeleteApiAccessMethodConfirmationViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/DeleteApiAccessMethodConfirmationViewModelTest.kt index eea3c01b2d3f..0f248a99d235 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/DeleteApiAccessMethodConfirmationViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/DeleteApiAccessMethodConfirmationViewModelTest.kt @@ -34,7 +34,7 @@ class DeleteApiAccessMethodConfirmationViewModelTest { apiAccessRepository = mockApiAccessRepository, savedStateHandle = DeleteApiAccessMethodNavArgs(apiAccessMethodId = apiAccessMethodId) - .toSavedStateHandle() + .toSavedStateHandle(), ) } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/DeleteCustomListConfirmationViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/DeleteCustomListConfirmationViewModelTest.kt index d90deeb99e31..2a6263e9801c 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/DeleteCustomListConfirmationViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/DeleteCustomListConfirmationViewModelTest.kt @@ -53,8 +53,8 @@ class DeleteCustomListConfirmationViewModelTest { savedStateHandle = DeleteCustomListNavArgs( customListId = CustomListId("1"), - name = CustomListName.fromString("asdf") + name = CustomListName.fromString("asdf"), ) - .toSavedStateHandle() + .toSavedStateHandle(), ) } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceRevokedViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceRevokedViewModelTest.kt index 51ea31540ca1..4fb6047066f5 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceRevokedViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/DeviceRevokedViewModelTest.kt @@ -43,7 +43,7 @@ class DeviceRevokedViewModelTest { DeviceRevokedViewModel( accountRepository = mockedAccountRepository, connectionProxy = mockConnectionProxy, - dispatcher = UnconfinedTestDispatcher() + dispatcher = UnconfinedTestDispatcher(), ) } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/EditCustomListNameDialogViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/EditCustomListNameDialogViewModelTest.kt index 83ddaec36edc..47f16e25359c 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/EditCustomListNameDialogViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/EditCustomListNameDialogViewModelTest.kt @@ -96,6 +96,6 @@ class EditCustomListNameDialogViewModelTest { customListId = customListId, initialName = CustomListName.fromString(initialName), ) - .toSavedStateHandle() + .toSavedStateHandle(), ) } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/EditCustomListViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/EditCustomListViewModelTest.kt index 16d1488bc41d..5d0ecff5df6b 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/EditCustomListViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/EditCustomListViewModelTest.kt @@ -62,6 +62,6 @@ class EditCustomListViewModelTest { customListsRepository = mockCustomListsRepository, savedStateHandle = EditCustomListNameNavArgs(customListId = customListId, initialName = initialName) - .toSavedStateHandle() + .toSavedStateHandle(), ) } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/FilterViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/FilterViewModelTest.kt index dc8322339469..4453f08ee424 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/FilterViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/FilterViewModelTest.kt @@ -54,13 +54,13 @@ class FilterViewModelTest { Provider(ProviderId("Quadranet"), Ownership.Rented), Provider(ProviderId("techfutures"), Ownership.Rented), Provider(ProviderId("Tzulo"), Ownership.Rented), - Provider(ProviderId("xtom"), Ownership.Rented) + Provider(ProviderId("xtom"), Ownership.Rented), ) private val mockSelectedProviders: List = listOf( Provider(ProviderId("31173"), Ownership.MullvadOwned), Provider(ProviderId("Blix"), Ownership.MullvadOwned), - Provider(ProviderId("Creanova"), Ownership.MullvadOwned) + Provider(ProviderId("Creanova"), Ownership.MullvadOwned), ) @BeforeEach @@ -74,7 +74,7 @@ class FilterViewModelTest { viewModel = FilterViewModel( availableProvidersUseCase = mockAvailableProvidersUseCase, - relayListFilterRepository = mockRelayListFilterRepository + relayListFilterRepository = mockRelayListFilterRepository, ) } @@ -108,7 +108,7 @@ class FilterViewModelTest { viewModel.setSelectedProvider(true, mockSelectedProvidersList) assertLists( listOf(mockSelectedProvidersList) + mockSelectedProviders, - awaitItem().selectedProviders + awaitItem().selectedProviders, ) } } @@ -137,7 +137,7 @@ class FilterViewModelTest { coEvery { mockRelayListFilterRepository.updateSelectedOwnershipAndProviderFilter( mockOwnership, - mockSelectedProviders + mockSelectedProviders, ) } returns Unit.right() @@ -148,7 +148,7 @@ class FilterViewModelTest { coVerify { mockRelayListFilterRepository.updateSelectedOwnershipAndProviderFilter( mockOwnership, - mockSelectedProviders + mockSelectedProviders, ) } } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/LoginViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/LoginViewModelTest.kt index a9905e9506a9..a01554befc79 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/LoginViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/LoginViewModelTest.kt @@ -54,7 +54,7 @@ class LoginViewModelTest { accountRepository = mockedAccountRepository, newDeviceRepository = mockk(relaxUnitFun = true), internetAvailableUseCase = connectivityUseCase, - UnconfinedTestDispatcher() + UnconfinedTestDispatcher(), ) } @@ -74,7 +74,7 @@ class LoginViewModelTest { // Assert assertEquals( Idle(loginError = LoginError.NoInternetConnection), - uiStates.awaitItem().loginState + uiStates.awaitItem().loginState, ) } } @@ -151,7 +151,7 @@ class LoginViewModelTest { assertEquals(Idle(null), uiStates.awaitItem().loginState) assertEquals( LoginUiSideEffect.TooManyDevices(DUMMY_ACCOUNT_NUMBER), - sideEffects.awaitItem() + sideEffects.awaitItem(), ) } } @@ -169,7 +169,7 @@ class LoginViewModelTest { assertEquals(Loading.LoggingIn, awaitItem().loginState) assertEquals( Idle(LoginError.Unknown(EXPECTED_RPC_ERROR_MESSAGE)), - awaitItem().loginState + awaitItem().loginState, ) } } @@ -201,7 +201,7 @@ class LoginViewModelTest { loginViewModel.uiState.test { assertEquals( LoginUiState.INITIAL.copy(lastUsedAccount = DUMMY_ACCOUNT_NUMBER), - awaitItem() + awaitItem(), ) } } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/OutOfTimeViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/OutOfTimeViewModelTest.kt index 047369b5cb46..6c1ff9e1a2d9 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/OutOfTimeViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/OutOfTimeViewModelTest.kt @@ -89,7 +89,7 @@ class OutOfTimeViewModelTest { outOfTimeUseCase = mockOutOfTimeUseCase, connectionProxy = mockConnectionProxy, pollAccountExpiry = false, - isPlayBuild = false + isPlayBuild = false, ) } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ReportProblemViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ReportProblemViewModelTest.kt index 80cb2d5e58f3..fa5ec10b5cb2 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ReportProblemViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ReportProblemViewModelTest.kt @@ -59,7 +59,7 @@ class ReportProblemViewModelTest { assertEquals(SendingReportUiState.Sending, awaitItem().sendingState) assertEquals( SendingReportUiState.Error(SendProblemReportResult.Error.CollectLog), - awaitItem().sendingState + awaitItem().sendingState, ) } } @@ -79,7 +79,7 @@ class ReportProblemViewModelTest { assertEquals(SendingReportUiState.Sending, awaitItem().sendingState) assertEquals( SendingReportUiState.Error(SendProblemReportResult.Error.SendReport), - awaitItem().sendingState + awaitItem().sendingState, ) } } @@ -107,15 +107,11 @@ class ReportProblemViewModelTest { viewModel.sendReport(email, description, true) assertEquals( ReportProblemUiState(SendingReportUiState.Sending, email, description), - awaitItem() + awaitItem(), ) assertEquals( - ReportProblemUiState( - SendingReportUiState.Success(null), - "", - "", - ), - awaitItem() + ReportProblemUiState(SendingReportUiState.Success(null), "", ""), + awaitItem(), ) } } @@ -154,20 +150,12 @@ class ReportProblemViewModelTest { viewModel.sendReport(email, description) assertEquals( - ReportProblemUiState( - SendingReportUiState.Sending, - email, - description, - ), - awaitItem() + ReportProblemUiState(SendingReportUiState.Sending, email, description), + awaitItem(), ) assertEquals( - ReportProblemUiState( - SendingReportUiState.Success(email), - "", - "", - ), - awaitItem() + ReportProblemUiState(SendingReportUiState.Success(email), "", ""), + awaitItem(), ) } } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ResetServerIpOverridesConfirmationViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ResetServerIpOverridesConfirmationViewModelTest.kt index 17394c39db2f..3b166f098ca8 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ResetServerIpOverridesConfirmationViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ResetServerIpOverridesConfirmationViewModelTest.kt @@ -32,7 +32,7 @@ class ResetServerIpOverridesConfirmationViewModelTest { viewModel = ResetServerIpOverridesConfirmationViewModel( - relayOverridesRepository = mockRelayOverridesRepository, + relayOverridesRepository = mockRelayOverridesRepository ) } @@ -49,7 +49,7 @@ class ResetServerIpOverridesConfirmationViewModelTest { viewModel.clearAllOverrides() assertEquals( ResetServerIpOverridesConfirmationUiSideEffect.OverridesCleared, - awaitItem() + awaitItem(), ) } } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/SaveApiAccessMethodViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/SaveApiAccessMethodViewModelTest.kt index 3455bba423f5..f02447ba8f4f 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/SaveApiAccessMethodViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/SaveApiAccessMethodViewModelTest.kt @@ -43,13 +43,13 @@ class SaveApiAccessMethodViewModelTest { mockApiAccessRepository.updateApiAccessMethod( apiAccessMethodId, apiAccessMethodName, - customProxy + customProxy, ) } returns Unit.right() createSaveApiAccessMethodViewModel( apiAccessMethodId = apiAccessMethodId, apiAccessMethodName = apiAccessMethodName, - customProxy = customProxy + customProxy = customProxy, ) // Act, Assert @@ -58,16 +58,16 @@ class SaveApiAccessMethodViewModelTest { assertEquals( SaveApiAccessMethodUiState( testingState = TestApiAccessMethodState.Result.Successful, - isSaving = true + isSaving = true, ), - awaitItem() + awaitItem(), ) } saveApiAccessMethodViewModel.uiSideEffect.test { // Check for successful creation assertEquals( SaveApiAccessMethodSideEffect.SuccessfullyCreatedApiMethod, - awaitItem() + awaitItem(), ) } } @@ -83,7 +83,7 @@ class SaveApiAccessMethodViewModelTest { createSaveApiAccessMethodViewModel( apiAccessMethodId = apiAccessMethodId, apiAccessMethodName = apiAccessMethodName, - customProxy = customProxy + customProxy = customProxy, ) // Act, Assert @@ -91,9 +91,9 @@ class SaveApiAccessMethodViewModelTest { assertEquals( SaveApiAccessMethodUiState( testingState = TestApiAccessMethodState.Result.Failure, - isSaving = false + isSaving = false, ), - awaitItem() + awaitItem(), ) } } @@ -110,13 +110,13 @@ class SaveApiAccessMethodViewModelTest { mockApiAccessRepository.updateApiAccessMethod( apiAccessMethodId, apiAccessMethodName, - customProxy + customProxy, ) } returns Unit.right() createSaveApiAccessMethodViewModel( apiAccessMethodId = apiAccessMethodId, apiAccessMethodName = apiAccessMethodName, - customProxy = customProxy + customProxy = customProxy, ) // Act, Assert @@ -125,18 +125,18 @@ class SaveApiAccessMethodViewModelTest { assertEquals( SaveApiAccessMethodUiState( testingState = TestApiAccessMethodState.Result.Failure, - isSaving = false + isSaving = false, ), - awaitItem() + awaitItem(), ) saveApiAccessMethodViewModel.save() // Saving assertEquals( SaveApiAccessMethodUiState( testingState = TestApiAccessMethodState.Result.Failure, - isSaving = true + isSaving = true, ), - awaitItem() + awaitItem(), ) } saveApiAccessMethodViewModel.uiSideEffect.test { @@ -157,13 +157,13 @@ class SaveApiAccessMethodViewModelTest { mockApiAccessRepository.updateApiAccessMethod( apiAccessMethodId, apiAccessMethodName, - customProxy + customProxy, ) } returns UnknownApiAccessMethodError(Throwable()).left() createSaveApiAccessMethodViewModel( apiAccessMethodId = apiAccessMethodId, apiAccessMethodName = apiAccessMethodName, - customProxy = customProxy + customProxy = customProxy, ) // Act, Assert @@ -185,14 +185,14 @@ class SaveApiAccessMethodViewModelTest { NewAccessMethodSetting( name = apiAccessMethodName, enabled = true, - apiAccessMethod = customProxy + apiAccessMethod = customProxy, ) ) } returns ApiAccessMethodId.fromString(UUID).right() createSaveApiAccessMethodViewModel( apiAccessMethodId = apiAccessMethodId, apiAccessMethodName = apiAccessMethodName, - customProxy = customProxy + customProxy = customProxy, ) // Assert @@ -201,7 +201,7 @@ class SaveApiAccessMethodViewModelTest { NewAccessMethodSetting( name = apiAccessMethodName, enabled = true, - apiAccessMethod = customProxy + apiAccessMethod = customProxy, ) ) } @@ -210,7 +210,7 @@ class SaveApiAccessMethodViewModelTest { private fun createSaveApiAccessMethodViewModel( apiAccessMethodId: ApiAccessMethodId?, apiAccessMethodName: ApiAccessMethodName, - customProxy: ApiAccessMethod.CustomProxy + customProxy: ApiAccessMethod.CustomProxy, ) { saveApiAccessMethodViewModel = SaveApiAccessMethodViewModel( @@ -221,7 +221,7 @@ class SaveApiAccessMethodViewModelTest { name = apiAccessMethodName, customProxy = customProxy, ) - .toSavedStateHandle() + .toSavedStateHandle(), ) } } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModelTest.kt index 993190ba2c74..5a44f6db06a7 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/SelectLocationViewModelTest.kt @@ -120,7 +120,7 @@ class SelectLocationViewModelTest { assertIs(actualState) assertLists( testCountries.map { it.id }, - actualState.relayListItems.mapNotNull { it.relayItemId() } + actualState.relayListItems.mapNotNull { it.relayItemId() }, ) assertTrue( actualState.relayListItems @@ -143,7 +143,7 @@ class SelectLocationViewModelTest { assertIs(actualState) assertLists( testCountries.map { it.id }, - actualState.relayListItems.mapNotNull { it.relayItemId() } + actualState.relayListItems.mapNotNull { it.relayItemId() }, ) assertTrue( actualState.relayListItems.filterIsInstance().all { @@ -224,7 +224,7 @@ class SelectLocationViewModelTest { assertIs(actualState) assertEquals( listOf(RelayListItem.LocationsEmptyText(mockSearchString)), - actualState.relayListItems + actualState.relayListItems, ) } } @@ -288,7 +288,7 @@ class SelectLocationViewModelTest { CustomList( id = CustomListId("1"), name = customListName, - locations = emptyList() + locations = emptyList(), ), locations = emptyList(), ) @@ -296,7 +296,7 @@ class SelectLocationViewModelTest { CustomListActionResultData.Success.LocationAdded( customListName = customListName, locationName = location.name, - undo = CustomListAction.UpdateLocations(id = customListId, locations = emptyList()) + undo = CustomListAction.UpdateLocations(id = customListId, locations = emptyList()), ) coEvery { mockCustomListActionUseCase(any()) } returns @@ -304,7 +304,7 @@ class SelectLocationViewModelTest { id = customListId, name = customListName, locations = listOf(addedLocationsId), - oldLocations = emptyList() + oldLocations = emptyList(), ) .right() @@ -337,8 +337,8 @@ class SelectLocationViewModelTest { undo = CustomListAction.UpdateLocations( id = customListId, - locations = listOf(location.id) - ) + locations = listOf(location.id), + ), ) coEvery { mockCustomListActionUseCase(any()) } returns LocationsChanged( @@ -352,7 +352,7 @@ class SelectLocationViewModelTest { CustomList( id = customListId, name = customListName, - locations = listOf(removedLocationsId) + locations = listOf(removedLocationsId), ) .right() @@ -393,11 +393,11 @@ class SelectLocationViewModelTest { RelayItem.Location.City( id = GeoLocationId.City(GeoLocationId.Country("se"), "got"), "Gothenburg", - emptyList() + emptyList(), ) - ) + ), ), - RelayItem.Location.Country(id = GeoLocationId.Country("no"), "Norway", emptyList()) + RelayItem.Location.Country(id = GeoLocationId.Country("no"), "Norway", emptyList()), ) } } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ServerIpOverridesViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ServerIpOverridesViewModelTest.kt index b39d4357de4e..6203d54b6362 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ServerIpOverridesViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/ServerIpOverridesViewModelTest.kt @@ -45,7 +45,7 @@ class ServerIpOverridesViewModelTest { viewModel = ServerIpOverridesViewModel( relayOverridesRepository = mockRelayOverridesRepository, - contentResolver = mockContentResolver + contentResolver = mockContentResolver, ) } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/SettingsViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/SettingsViewModelTest.kt index 416dd7c1a9af..97259b8b438c 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/SettingsViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/SettingsViewModelTest.kt @@ -41,7 +41,7 @@ class SettingsViewModelTest { SettingsViewModel( deviceRepository = mockDeviceRepository, appVersionInfoRepository = mockAppVersionInfoRepository, - isPlayBuild = false + isPlayBuild = false, ) } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/SplitTunnelingViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/SplitTunnelingViewModelTest.kt index aa1ccc82f088..00fd6e752cff 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/SplitTunnelingViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/SplitTunnelingViewModelTest.kt @@ -70,7 +70,7 @@ class SplitTunnelingViewModelTest { enabled = true, excludedApps = emptyList(), includedApps = emptyList(), - showSystemApps = false + showSystemApps = false, ) testSubject.uiState.test { assertEquals(expectedState, awaitItem()) } } @@ -88,7 +88,7 @@ class SplitTunnelingViewModelTest { enabled = true, excludedApps = listOf(appExcluded), includedApps = listOf(appNotExcluded), - showSystemApps = false + showSystemApps = false, ) testSubject.uiState.test { @@ -109,14 +109,14 @@ class SplitTunnelingViewModelTest { enabled = true, excludedApps = listOf(app), includedApps = emptyList(), - showSystemApps = false + showSystemApps = false, ) val expectedStateAfterAction = SplitTunnelingUiState.ShowAppList( enabled = true, excludedApps = emptyList(), includedApps = listOf(app), - showSystemApps = false + showSystemApps = false, ) coEvery { mockedSplitTunnelingRepository.includeApp(AppId(app.packageName)) } returns Unit.right() @@ -142,7 +142,7 @@ class SplitTunnelingViewModelTest { enabled = true, excludedApps = emptyList(), includedApps = listOf(app), - showSystemApps = false + showSystemApps = false, ) val expectedStateAfterAction = @@ -150,7 +150,7 @@ class SplitTunnelingViewModelTest { enabled = true, excludedApps = listOf(app), includedApps = emptyList(), - showSystemApps = false + showSystemApps = false, ) coEvery { mockedSplitTunnelingRepository.excludeApp(AppId(app.packageName)) } returns @@ -185,7 +185,7 @@ class SplitTunnelingViewModelTest { SplitTunnelingViewModel( mockedApplicationsProvider, mockedSplitTunnelingRepository, - UnconfinedTestDispatcher() + UnconfinedTestDispatcher(), ) } } diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModelTest.kt index add2ee8580d5..c2f9ca34a68e 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModelTest.kt @@ -57,7 +57,7 @@ class VpnSettingsViewModelTest { repository = mockSettingsRepository, systemVpnSettingsUseCase = mockSystemVpnSettingsUseCase, relayListRepository = mockRelayListRepository, - dispatcher = UnconfinedTestDispatcher() + dispatcher = UnconfinedTestDispatcher(), ) } @@ -145,9 +145,9 @@ class VpnSettingsViewModelTest { wireguard = WireguardTunnelOptions( mtu = null, - quantumResistant = QuantumResistantState.Off + quantumResistant = QuantumResistantState.Off, ), - dnsOptions = mockk(relaxed = true) + dnsOptions = mockk(relaxed = true), ) // Act, Assert diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/WelcomeViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/WelcomeViewModelTest.kt index 9ef1455bb723..3fe3804b8b1d 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/WelcomeViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/WelcomeViewModelTest.kt @@ -84,7 +84,7 @@ class WelcomeViewModelTest { paymentUseCase = mockPaymentUseCase, connectionProxy = mockConnectionProxy, pollAccountExpiry = false, - isPlayBuild = false + isPlayBuild = false, ) } diff --git a/android/lib/billing/src/androidTest/kotlin/net/mullvad/mullvadvpn/lib/billing/BillingRepositoryTest.kt b/android/lib/billing/src/androidTest/kotlin/net/mullvad/mullvadvpn/lib/billing/BillingRepositoryTest.kt index 7ca3219cfbd4..35dedb6200e8 100644 --- a/android/lib/billing/src/androidTest/kotlin/net/mullvad/mullvadvpn/lib/billing/BillingRepositoryTest.kt +++ b/android/lib/billing/src/androidTest/kotlin/net/mullvad/mullvadvpn/lib/billing/BillingRepositoryTest.kt @@ -158,7 +158,7 @@ class BillingRepositoryTest { billingRepository.startPurchaseFlow( mockProductDetails, transactionId, - mockActivityProvider + mockActivityProvider, ) // Assert @@ -184,7 +184,7 @@ class BillingRepositoryTest { billingRepository.startPurchaseFlow( mockProductDetails, transactionId, - mockActivityProvider + mockActivityProvider, ) // Assert @@ -252,7 +252,7 @@ class BillingRepositoryTest { // Assert assertEquals( expectedError.toBillingResult().responseCode, - result.billingResult.responseCode + result.billingResult.responseCode, ) assertEquals(expectedError.message, result.billingResult.debugMessage) } @@ -269,7 +269,7 @@ class BillingRepositoryTest { billingRepository.purchaseEvents.test { purchaseUpdatedListenerSlot.captured.onPurchasesUpdated( mockBillingResult, - mockPurchaseList + mockPurchaseList, ) val result = awaitItem() assertIs(result) diff --git a/android/lib/billing/src/main/kotlin/net/mullvad/mullvadvpn/lib/billing/BillingPaymentRepository.kt b/android/lib/billing/src/main/kotlin/net/mullvad/mullvadvpn/lib/billing/BillingPaymentRepository.kt index b526a10032cb..540a8ad929de 100644 --- a/android/lib/billing/src/main/kotlin/net/mullvad/mullvadvpn/lib/billing/BillingPaymentRepository.kt +++ b/android/lib/billing/src/main/kotlin/net/mullvad/mullvadvpn/lib/billing/BillingPaymentRepository.kt @@ -30,7 +30,7 @@ import net.mullvad.mullvadvpn.lib.payment.model.VerificationResult class BillingPaymentRepository( private val billingRepository: BillingRepository, - private val playPurchaseRepository: PlayPurchaseRepository + private val playPurchaseRepository: PlayPurchaseRepository, ) : PaymentRepository { override fun queryPaymentAvailability(): Flow = flow { @@ -49,7 +49,7 @@ class BillingPaymentRepository( override fun purchaseProduct( productId: ProductId, - activityProvider: () -> Activity + activityProvider: () -> Activity, ): Flow = flow { emit(PurchaseResult.FetchingProducts) @@ -68,7 +68,7 @@ class BillingPaymentRepository( emit( PurchaseResult.Error.FetchProductsError( productId, - productDetailsResult.toBillingException() + productDetailsResult.toBillingException(), ) ) return@flow @@ -84,14 +84,14 @@ class BillingPaymentRepository( emit(PurchaseResult.Error.TransactionIdError(productId, null)) return@flow }, - { it } + { it }, ) val result = billingRepository.startPurchaseFlow( productDetails = productDetails, obfuscatedId = obfuscatedId.value, - activityProvider = activityProvider + activityProvider = activityProvider, ) if (result.responseCode == BillingResponseCode.OK) { @@ -123,7 +123,7 @@ class BillingPaymentRepository( verifyPurchase(event.purchases.first()) .fold( { PurchaseResult.Error.VerificationError(null) }, - { PurchaseResult.Completed.Success } + { PurchaseResult.Completed.Success }, ) ) } diff --git a/android/lib/billing/src/main/kotlin/net/mullvad/mullvadvpn/lib/billing/BillingRepository.kt b/android/lib/billing/src/main/kotlin/net/mullvad/mullvadvpn/lib/billing/BillingRepository.kt index 6b3098fad071..544c3481709f 100644 --- a/android/lib/billing/src/main/kotlin/net/mullvad/mullvadvpn/lib/billing/BillingRepository.kt +++ b/android/lib/billing/src/main/kotlin/net/mullvad/mullvadvpn/lib/billing/BillingRepository.kt @@ -48,7 +48,7 @@ class BillingRepository(context: Context) { exception = BillingException( responseCode = result.responseCode, - message = result.debugMessage + message = result.debugMessage, ) ) ) @@ -110,7 +110,7 @@ class BillingRepository(context: Context) { suspend fun startPurchaseFlow( productDetails: ProductDetails, obfuscatedId: String, - activityProvider: () -> Activity + activityProvider: () -> Activity, ): BillingResult { return try { ensureConnected() @@ -172,7 +172,7 @@ class BillingRepository(context: Context) { } catch (t: Throwable) { ProductDetailsResult( BillingResult.newBuilder().setResponseCode(BillingResponseCode.ERROR).build(), - null + null, ) } } diff --git a/android/lib/billing/src/main/kotlin/net/mullvad/mullvadvpn/lib/billing/extension/ProductDetailsToPaymentProduct.kt b/android/lib/billing/src/main/kotlin/net/mullvad/mullvadvpn/lib/billing/extension/ProductDetailsToPaymentProduct.kt index fa9a20613f32..5a0d0b42fb98 100644 --- a/android/lib/billing/src/main/kotlin/net/mullvad/mullvadvpn/lib/billing/extension/ProductDetailsToPaymentProduct.kt +++ b/android/lib/billing/src/main/kotlin/net/mullvad/mullvadvpn/lib/billing/extension/ProductDetailsToPaymentProduct.kt @@ -10,7 +10,7 @@ fun ProductDetails.toPaymentProduct(productIdToStatus: Map.toPaymentProducts(productIdToStatus: Map) = diff --git a/android/lib/billing/src/test/kotlin/net/mullvad/mullvadvpn/lib/billing/BillingPaymentRepositoryTest.kt b/android/lib/billing/src/test/kotlin/net/mullvad/mullvadvpn/lib/billing/BillingPaymentRepositoryTest.kt index ad716cd30c4c..48618feb2bef 100644 --- a/android/lib/billing/src/test/kotlin/net/mullvad/mullvadvpn/lib/billing/BillingPaymentRepositoryTest.kt +++ b/android/lib/billing/src/test/kotlin/net/mullvad/mullvadvpn/lib/billing/BillingPaymentRepositoryTest.kt @@ -49,7 +49,7 @@ class BillingPaymentRepositoryTest { paymentRepository = BillingPaymentRepository( billingRepository = mockBillingRepository, - playPurchaseRepository = mockPlayPurchaseRepository + playPurchaseRepository = mockPlayPurchaseRepository, ) } @@ -203,7 +203,7 @@ class BillingPaymentRepositoryTest { mockBillingRepository.startPurchaseFlow( productDetails = any(), obfuscatedId = any(), - activityProvider = any() + activityProvider = any(), ) } returns mockBillingResult coEvery { mockPlayPurchaseRepository.initializePlayPurchase() } returns @@ -238,7 +238,7 @@ class BillingPaymentRepositoryTest { mockBillingRepository.startPurchaseFlow( productDetails = any(), obfuscatedId = mockObfuscatedId, - activityProvider = any() + activityProvider = any(), ) } returns mockBillingResult coEvery { mockPlayPurchaseRepository.initializePlayPurchase() } returns @@ -280,7 +280,7 @@ class BillingPaymentRepositoryTest { mockBillingRepository.startPurchaseFlow( productDetails = any(), obfuscatedId = any(), - activityProvider = any() + activityProvider = any(), ) } returns mockBillingResult coEvery { mockPlayPurchaseRepository.initializePlayPurchase() } returns @@ -323,7 +323,7 @@ class BillingPaymentRepositoryTest { mockBillingRepository.startPurchaseFlow( productDetails = any(), obfuscatedId = any(), - activityProvider = any() + activityProvider = any(), ) } returns mockBillingResult coEvery { mockPlayPurchaseRepository.initializePlayPurchase() } returns @@ -364,7 +364,7 @@ class BillingPaymentRepositoryTest { mockBillingRepository.startPurchaseFlow( productDetails = any(), obfuscatedId = any(), - activityProvider = any() + activityProvider = any(), ) } returns mockBillingResult coEvery { mockPlayPurchaseRepository.initializePlayPurchase() } returns diff --git a/android/lib/common-test/src/main/java/net/mullvad/mullvadvpn/lib/common/test/TestUtils.kt b/android/lib/common-test/src/main/java/net/mullvad/mullvadvpn/lib/common/test/TestUtils.kt index 8d09cdf22c7f..60f991fce683 100644 --- a/android/lib/common-test/src/main/java/net/mullvad/mullvadvpn/lib/common/test/TestUtils.kt +++ b/android/lib/common-test/src/main/java/net/mullvad/mullvadvpn/lib/common/test/TestUtils.kt @@ -12,5 +12,5 @@ fun assertLists(expected: List, actual: List, message: String? = null) | Expected(${expected.size}): $expected | Actual(${actual.size}) : $actual """ - .trimMargin() + .trimMargin(), ) diff --git a/android/lib/common/src/main/kotlin/net/mullvad/mullvadvpn/lib/common/util/ErrorNotificationMessage.kt b/android/lib/common/src/main/kotlin/net/mullvad/mullvadvpn/lib/common/util/ErrorNotificationMessage.kt index bbdd2a56a57e..4a5c902d9659 100644 --- a/android/lib/common/src/main/kotlin/net/mullvad/mullvadvpn/lib/common/util/ErrorNotificationMessage.kt +++ b/android/lib/common/src/main/kotlin/net/mullvad/mullvadvpn/lib/common/util/ErrorNotificationMessage.kt @@ -3,5 +3,5 @@ package net.mullvad.mullvadvpn.lib.common.util data class ErrorNotificationMessage( val titleResourceId: Int, val messageResourceId: Int, - val optionalMessageArgument: String? = null + val optionalMessageArgument: String? = null, ) diff --git a/android/lib/common/src/main/kotlin/net/mullvad/mullvadvpn/lib/common/util/ErrorStateExtension.kt b/android/lib/common/src/main/kotlin/net/mullvad/mullvadvpn/lib/common/util/ErrorStateExtension.kt index 2c9554a84224..5d30a01b2fdf 100644 --- a/android/lib/common/src/main/kotlin/net/mullvad/mullvadvpn/lib/common/util/ErrorStateExtension.kt +++ b/android/lib/common/src/main/kotlin/net/mullvad/mullvadvpn/lib/common/util/ErrorStateExtension.kt @@ -15,7 +15,7 @@ fun ErrorState.getErrorNotificationResources(context: Context): ErrorNotificatio cause.errorMessageId(), (cause as ErrorStateCause.InvalidDnsServers).addresses.joinToString { address -> address.addressString() - } + }, ) } cause is ErrorStateCause.VpnPermissionDenied -> { @@ -33,12 +33,12 @@ private fun resolveAlwaysOnVpnErrorNotificationMessage( ErrorNotificationMessage( R.string.always_on_vpn_error_notification_title, R.string.always_on_vpn_error_notification_content, - alwaysOnVpnAppName + alwaysOnVpnAppName, ) } else { ErrorNotificationMessage( R.string.vpn_permission_error_notification_title, - R.string.vpn_permission_error_notification_message + R.string.vpn_permission_error_notification_message, ) } } diff --git a/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/ManagementService.kt b/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/ManagementService.kt index c10f3b58e661..b51fd7eb2ff0 100644 --- a/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/ManagementService.kt +++ b/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/ManagementService.kt @@ -145,7 +145,7 @@ class ManagementService( private val channel = UdsChannelBuilder.forPath( rpcSocketFile.absolutePath, - LocalSocketAddress.Namespace.FILESYSTEM + LocalSocketAddress.Namespace.FILESYSTEM, ) // We need to provide a DummyNameResolver to avoid default NameResolver making incorrect // InetSocketAddress look ups. For more info see: @@ -264,14 +264,14 @@ class ManagementService( suspend fun removeDevice( token: AccountNumber, - deviceId: DeviceId + deviceId: DeviceId, ): Either = Either.catch { grpc.removeDevice( ManagementInterface.DeviceRemoval.newBuilder() .setAccountToken(token.value) .setDeviceId(deviceId.value.toString()) - .build(), + .build() ) } .mapEmpty() @@ -363,7 +363,7 @@ class ManagementService( async { _mutableSettings.update { getSettings() } }, async { _mutableVersionInfo.update { getVersionInfo().getOrNull() } }, async { _mutableRelayList.update { getRelayList() } }, - async { _mutableCurrentAccessMethod.update { getCurrentApiAccessMethod() } } + async { _mutableCurrentAccessMethod.update { getCurrentApiAccessMethod() } }, ) } } @@ -584,7 +584,7 @@ class ManagementService( suspend fun setOwnershipAndProviders( ownershipConstraint: Constraint, - providersConstraint: Constraint + providersConstraint: Constraint, ): Either = Either.catch { val relaySettings = getSettings().relaySettings diff --git a/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/mapper/ToDomain.kt b/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/mapper/ToDomain.kt index ca4e924b6cdf..5e8df1edc4b0 100644 --- a/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/mapper/ToDomain.kt +++ b/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/mapper/ToDomain.kt @@ -80,7 +80,7 @@ internal fun ManagementInterface.TunnelState.toDomain(): TunnelState = if (hasDisconnectedLocation()) { disconnectedLocation.toDomain() } else null - }, + } ) ManagementInterface.TunnelState.StateCase.CONNECTING -> TunnelState.Connecting( @@ -91,7 +91,7 @@ internal fun ManagementInterface.TunnelState.toDomain(): TunnelState = location.toDomain() } else null }, - featureIndicators = connected.featureIndicators.toDomain() + featureIndicators = connected.featureIndicators.toDomain(), ) ManagementInterface.TunnelState.StateCase.CONNECTED -> TunnelState.Connected( @@ -104,18 +104,16 @@ internal fun ManagementInterface.TunnelState.toDomain(): TunnelState = null } }, - featureIndicators = connected.featureIndicators.toDomain() + featureIndicators = connected.featureIndicators.toDomain(), ) ManagementInterface.TunnelState.StateCase.DISCONNECTING -> TunnelState.Disconnecting( - actionAfterDisconnect = disconnecting.afterDisconnect.toDomain(), + actionAfterDisconnect = disconnecting.afterDisconnect.toDomain() ) ManagementInterface.TunnelState.StateCase.ERROR -> TunnelState.Error(errorState = error.errorState.toDomain()) ManagementInterface.TunnelState.StateCase.STATE_NOT_SET -> - TunnelState.Disconnected( - location = disconnected.disconnectedLocation.toDomain(), - ) + TunnelState.Disconnected(location = disconnected.disconnectedLocation.toDomain()) } internal fun ManagementInterface.GeoIpLocation.toDomain(): GeoIpLocation = @@ -136,7 +134,7 @@ internal fun ManagementInterface.GeoIpLocation.toDomain(): GeoIpLocation = city = city, latitude = latitude, longitude = longitude, - hostname = hostname + hostname = hostname, ) internal fun ManagementInterface.TunnelEndpoint.toDomain(): TunnelEndpoint = @@ -150,7 +148,7 @@ internal fun ManagementInterface.TunnelEndpoint.toDomain(): TunnelEndpoint = Endpoint( address = InetSocketAddress(InetAddress.getByName(ipPart), portPart.toInt()), - protocol = protocol.toDomain() + protocol = protocol.toDomain(), ) }, quantumResistant = quantumResistant, @@ -159,14 +157,14 @@ internal fun ManagementInterface.TunnelEndpoint.toDomain(): TunnelEndpoint = obfuscation.toDomain() } else { null - } + }, ) internal fun ManagementInterface.ObfuscationEndpoint.toDomain(): ObfuscationEndpoint = ObfuscationEndpoint( endpoint = Endpoint(address = InetSocketAddress(address, port), protocol = protocol.toDomain()), - obfuscationType = obfuscationType.toDomain() + obfuscationType = obfuscationType.toDomain(), ) internal fun ManagementInterface.ObfuscationEndpoint.ObfuscationType.toDomain(): ObfuscationType = @@ -220,7 +218,7 @@ internal fun ManagementInterface.ErrorState.toDomain(): ErrorState = ManagementInterface.ErrorState.Cause.CREATE_TUNNEL_DEVICE -> throw IllegalArgumentException("Unrecognized error state cause") }, - isBlocking = !hasBlockingError() + isBlocking = !hasBlockingError(), ) internal fun ManagementInterface.ErrorState.FirewallPolicyError.toDomain(): @@ -258,14 +256,14 @@ internal fun ManagementInterface.Settings.toDomain(): Settings = relayOverrides = relayOverridesList.map { it.toDomain() }, showBetaReleases = showBetaReleases, splitTunnelSettings = splitTunnel.toDomain(), - apiAccessMethodSettings = apiAccessMethods.toDomain() + apiAccessMethodSettings = apiAccessMethods.toDomain(), ) internal fun ManagementInterface.RelayOverride.toDomain(): RelayOverride = RelayOverride( hostname = hostname, ipv4AddressIn = if (hasIpv4AddrIn()) InetAddress.getByName(ipv4AddrIn) else null, - ipv6AddressIn = if (hasIpv6AddrIn()) InetAddress.getByName(ipv6AddrIn) else null + ipv6AddressIn = if (hasIpv6AddrIn()) InetAddress.getByName(ipv6AddrIn) else null, ) internal fun ManagementInterface.RelaySettings.toDomain(): RelaySettings = @@ -283,7 +281,7 @@ internal fun ManagementInterface.NormalRelaySettings.toDomain(): RelayConstraint location = location.toDomain(), providers = providersList.toDomain(), ownership = ownership.toDomain(), - wireguardConstraints = wireguardConstraints.toDomain() + wireguardConstraints = wireguardConstraints.toDomain(), ) internal fun ManagementInterface.LocationConstraint.toDomain(): Constraint = @@ -320,7 +318,7 @@ internal fun ManagementInterface.WireguardConstraints.toDomain(): WireguardConst Constraint.Only(Port(port)) } else { Constraint.Any - }, + } ) internal fun ManagementInterface.Ownership.toDomain(): Constraint = @@ -335,7 +333,7 @@ internal fun ManagementInterface.Ownership.toDomain(): Constraint = internal fun ManagementInterface.ObfuscationSettings.toDomain(): ObfuscationSettings = ObfuscationSettings( selectedObfuscation = selectedObfuscation.toDomain(), - udp2tcp = udp2Tcp.toDomain() + udp2tcp = udp2Tcp.toDomain(), ) internal fun ManagementInterface.ObfuscationSettings.SelectedObfuscation.toDomain(): @@ -362,7 +360,7 @@ internal fun ManagementInterface.CustomList.toDomain(): CustomList = CustomList( id = CustomListId(id), name = CustomListName.fromString(name), - locations = locationsList.map { it.toDomain() } + locations = locationsList.map { it.toDomain() }, ) internal fun ManagementInterface.TunnelOptions.toDomain(): TunnelOptions = @@ -388,7 +386,7 @@ internal fun ManagementInterface.DnsOptions.toDomain(): DnsOptions = DnsOptions( state = state.toDomain(), defaultOptions = defaultOptions.toDomain(), - customOptions = customOptions.toDomain() + customOptions = customOptions.toDomain(), ) internal fun ManagementInterface.DnsOptions.DnsState.toDomain(): DnsState = @@ -406,7 +404,7 @@ internal fun ManagementInterface.DefaultDnsOptions.toDomain() = blockAdultContent = blockAdultContent, blockGambling = blockGambling, blockSocialMedia = blockSocialMedia, - blockTrackers = blockTrackers + blockTrackers = blockTrackers, ) internal fun ManagementInterface.CustomDnsOptions.toDomain() = @@ -426,7 +424,7 @@ internal fun QuantumResistantState.toDomain(): ManagementInterface.QuantumResist internal fun ManagementInterface.AppVersionInfo.toDomain(): AppVersionInfo = AppVersionInfo( supported = supported, - suggestedUpgrade = if (hasSuggestedUpgrade()) suggestedUpgrade else null + suggestedUpgrade = if (hasSuggestedUpgrade()) suggestedUpgrade else null, ) internal fun ConnectivityState.toDomain(): GrpcConnectivityState = @@ -465,7 +463,7 @@ internal fun ManagementInterface.RelayListCountry.toDomain(): RelayItem.Location citiesList .map { city -> city.toDomain(countryCode) } .filter { it.relays.isNotEmpty() } - .sortedBy { it.name } + .sortedBy { it.name }, ) } @@ -480,7 +478,7 @@ internal fun ManagementInterface.RelayListCity.toDomain( relaysList .filter { it.endpointType == ManagementInterface.Relay.RelayType.WIREGUARD } .map { it.toDomain(cityCode) } - .sortedWith(RelayNameComparator) + .sortedWith(RelayNameComparator), ) } @@ -493,8 +491,8 @@ internal fun ManagementInterface.Relay.toDomain( provider = Provider( ProviderId(provider), - ownership = if (owned) Ownership.MullvadOwned else Ownership.Rented - ) + ownership = if (owned) Ownership.MullvadOwned else Ownership.Rented, + ), ) internal fun ManagementInterface.Device.toDomain(): Device = @@ -514,19 +512,19 @@ internal fun ManagementInterface.DeviceState.toDomain(): DeviceState = internal fun ManagementInterface.AccountData.toDomain(): AccountData = AccountData( AccountId(UUID.fromString(id)), - expiryDate = Instant.ofEpochSecond(expiry.seconds).toDateTime() + expiryDate = Instant.ofEpochSecond(expiry.seconds).toDateTime(), ) internal fun ManagementInterface.VoucherSubmission.toDomain(): RedeemVoucherSuccess = RedeemVoucherSuccess( timeAdded = secondsAdded, - newExpiryDate = Instant.ofEpochSecond(newExpiry.seconds).toDateTime() + newExpiryDate = Instant.ofEpochSecond(newExpiry.seconds).toDateTime(), ) internal fun ManagementInterface.SplitTunnelSettings.toDomain(): SplitTunnelSettings = SplitTunnelSettings( enabled = enableExclusions, - excludedApps = appsList.map { AppId(it) }.toSet() + excludedApps = appsList.map { AppId(it) }.toSet(), ) internal fun ManagementInterface.PlayPurchasePaymentToken.toDomain(): PlayPurchasePaymentToken = @@ -540,7 +538,7 @@ internal fun ManagementInterface.AccessMethodSetting.toDomain(): ApiAccessMethod id = ApiAccessMethodId.fromString(id.value), name = ApiAccessMethodName.fromString(name), enabled = enabled, - apiAccessMethod = accessMethod.toDomain() + apiAccessMethod = accessMethod.toDomain(), ) internal fun ManagementInterface.AccessMethod.toDomain(): ApiAccessMethod = @@ -564,7 +562,7 @@ internal fun ManagementInterface.Shadowsocks.toDomain(): ApiAccessMethod.CustomP ip = ip, port = Port(port), password = password, - cipher = Cipher.fromString(cipher) + cipher = Cipher.fromString(cipher), ) internal fun ManagementInterface.Socks5Remote.toDomain(): ApiAccessMethod.CustomProxy.Socks5Remote = @@ -576,7 +574,7 @@ internal fun ManagementInterface.Socks5Remote.toDomain(): ApiAccessMethod.Custom auth.toDomain() } else { null - } + }, ) internal fun ManagementInterface.SocksAuth.toDomain(): SocksAuth = diff --git a/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/util/LogInterceptor.kt b/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/util/LogInterceptor.kt index b01b0266b787..1bff85300f0f 100644 --- a/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/util/LogInterceptor.kt +++ b/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/util/LogInterceptor.kt @@ -11,7 +11,7 @@ internal class LogInterceptor : ClientInterceptor { override fun interceptCall( method: MethodDescriptor?, callOptions: CallOptions?, - next: Channel? + next: Channel?, ): ClientCall { Logger.v("Intercepted call: ${method?.fullMethodName}") return next!!.newCall(method, callOptions) diff --git a/android/lib/daemon-grpc/src/test/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/RelayNameComparatorTest.kt b/android/lib/daemon-grpc/src/test/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/RelayNameComparatorTest.kt index 42cf7455107e..1494851bcb69 100644 --- a/android/lib/daemon-grpc/src/test/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/RelayNameComparatorTest.kt +++ b/android/lib/daemon-grpc/src/test/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/RelayNameComparatorTest.kt @@ -27,7 +27,7 @@ class RelayNameComparatorTest { provider = Provider( providerId = ProviderId("Provider"), - ownership = Ownership.MullvadOwned + ownership = Ownership.MullvadOwned, ), ) val relay10 = @@ -37,8 +37,8 @@ class RelayNameComparatorTest { provider = Provider( providerId = ProviderId("Provider"), - ownership = Ownership.MullvadOwned - ) + ownership = Ownership.MullvadOwned, + ), ) relay9 assertOrderBothDirection relay10 @@ -53,8 +53,8 @@ class RelayNameComparatorTest { provider = Provider( providerId = ProviderId("Provider"), - ownership = Ownership.MullvadOwned - ) + ownership = Ownership.MullvadOwned, + ), ) val relay9b = RelayItem.Location.Relay( @@ -63,8 +63,8 @@ class RelayNameComparatorTest { provider = Provider( providerId = ProviderId("Provider"), - ownership = Ownership.MullvadOwned - ) + ownership = Ownership.MullvadOwned, + ), ) assertTrue(RelayNameComparator.compare(relay9a, relay9b) == 0) @@ -80,8 +80,8 @@ class RelayNameComparatorTest { provider = Provider( providerId = ProviderId("Provider"), - ownership = Ownership.MullvadOwned - ) + ownership = Ownership.MullvadOwned, + ), ) val relay1 = RelayItem.Location.Relay( @@ -90,8 +90,8 @@ class RelayNameComparatorTest { provider = Provider( providerId = ProviderId("Provider"), - ownership = Ownership.MullvadOwned - ) + ownership = Ownership.MullvadOwned, + ), ) val relay3 = RelayItem.Location.Relay( @@ -100,8 +100,8 @@ class RelayNameComparatorTest { provider = Provider( providerId = ProviderId("Provider"), - ownership = Ownership.MullvadOwned - ) + ownership = Ownership.MullvadOwned, + ), ) val relay100 = RelayItem.Location.Relay( @@ -110,8 +110,8 @@ class RelayNameComparatorTest { provider = Provider( providerId = ProviderId("Provider"), - ownership = Ownership.MullvadOwned - ) + ownership = Ownership.MullvadOwned, + ), ) relay001 assertOrderBothDirection relay1 @@ -129,8 +129,8 @@ class RelayNameComparatorTest { provider = Provider( providerId = ProviderId("Provider"), - ownership = Ownership.MullvadOwned - ) + ownership = Ownership.MullvadOwned, + ), ) val relay9b = RelayItem.Location.Relay( @@ -139,8 +139,8 @@ class RelayNameComparatorTest { provider = Provider( providerId = ProviderId("Provider"), - ownership = Ownership.MullvadOwned - ) + ownership = Ownership.MullvadOwned, + ), ) assertTrue(RelayNameComparator.compare(relay9a, relay9b) == 0) @@ -156,8 +156,8 @@ class RelayNameComparatorTest { provider = Provider( providerId = ProviderId("Provider"), - ownership = Ownership.MullvadOwned - ) + ownership = Ownership.MullvadOwned, + ), ) val relay005 = RelayItem.Location.Relay( @@ -166,8 +166,8 @@ class RelayNameComparatorTest { provider = Provider( providerId = ProviderId("Provider"), - ownership = Ownership.MullvadOwned - ) + ownership = Ownership.MullvadOwned, + ), ) relay001 assertOrderBothDirection relay005 @@ -182,8 +182,8 @@ class RelayNameComparatorTest { provider = Provider( providerId = ProviderId("Provider"), - ownership = Ownership.MullvadOwned - ) + ownership = Ownership.MullvadOwned, + ), ) val relayAr8 = RelayItem.Location.Relay( @@ -192,8 +192,8 @@ class RelayNameComparatorTest { provider = Provider( providerId = ProviderId("Provider"), - ownership = Ownership.MullvadOwned - ) + ownership = Ownership.MullvadOwned, + ), ) val relaySe5 = RelayItem.Location.Relay( @@ -202,8 +202,8 @@ class RelayNameComparatorTest { provider = Provider( providerId = ProviderId("Provider"), - ownership = Ownership.MullvadOwned - ) + ownership = Ownership.MullvadOwned, + ), ) val relaySe10 = RelayItem.Location.Relay( @@ -212,8 +212,8 @@ class RelayNameComparatorTest { provider = Provider( providerId = ProviderId("Provider"), - ownership = Ownership.MullvadOwned - ) + ownership = Ownership.MullvadOwned, + ), ) relayAr2 assertOrderBothDirection relayAr8 @@ -230,8 +230,8 @@ class RelayNameComparatorTest { provider = Provider( providerId = ProviderId("Provider"), - ownership = Ownership.MullvadOwned - ) + ownership = Ownership.MullvadOwned, + ), ) val relay2w = RelayItem.Location.Relay( @@ -240,8 +240,8 @@ class RelayNameComparatorTest { provider = Provider( providerId = ProviderId("Provider"), - ownership = Ownership.MullvadOwned - ) + ownership = Ownership.MullvadOwned, + ), ) relay2c assertOrderBothDirection relay2w @@ -256,8 +256,8 @@ class RelayNameComparatorTest { provider = Provider( providerId = ProviderId("Provider"), - ownership = Ownership.MullvadOwned - ) + ownership = Ownership.MullvadOwned, + ), ) val relay22b = RelayItem.Location.Relay( @@ -266,8 +266,8 @@ class RelayNameComparatorTest { provider = Provider( providerId = ProviderId("Provider"), - ownership = Ownership.MullvadOwned - ) + ownership = Ownership.MullvadOwned, + ), ) relay22a assertOrderBothDirection relay22b diff --git a/android/lib/endpoint/src/main/kotlin/net/mullvad/mullvadvpn/lib/endpoint/ApiEndpoint.kt b/android/lib/endpoint/src/main/kotlin/net/mullvad/mullvadvpn/lib/endpoint/ApiEndpoint.kt index 4b5beacf491b..1fd26bddae8b 100644 --- a/android/lib/endpoint/src/main/kotlin/net/mullvad/mullvadvpn/lib/endpoint/ApiEndpoint.kt +++ b/android/lib/endpoint/src/main/kotlin/net/mullvad/mullvadvpn/lib/endpoint/ApiEndpoint.kt @@ -8,5 +8,5 @@ import kotlinx.parcelize.Parcelize data class ApiEndpoint( val address: InetSocketAddress, val disableAddressCache: Boolean, - val disableTls: Boolean + val disableTls: Boolean, ) : Parcelable diff --git a/android/lib/endpoint/src/main/kotlin/net/mullvad/mullvadvpn/lib/endpoint/CustomApiEndpointConfiguration.kt b/android/lib/endpoint/src/main/kotlin/net/mullvad/mullvadvpn/lib/endpoint/CustomApiEndpointConfiguration.kt index b1559be777ef..92dffed35f67 100644 --- a/android/lib/endpoint/src/main/kotlin/net/mullvad/mullvadvpn/lib/endpoint/CustomApiEndpointConfiguration.kt +++ b/android/lib/endpoint/src/main/kotlin/net/mullvad/mullvadvpn/lib/endpoint/CustomApiEndpointConfiguration.kt @@ -10,12 +10,12 @@ data class CustomApiEndpointConfiguration( val hostname: String, val port: Int, val disableAddressCache: Boolean = true, - val disableTls: Boolean = false + val disableTls: Boolean = false, ) : ApiEndpointConfiguration { override fun apiEndpoint() = ApiEndpoint( address = InetSocketAddress(hostname, port), disableAddressCache = disableAddressCache, - disableTls = disableTls + disableTls = disableTls, ) } diff --git a/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/CameraAnimation.kt b/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/CameraAnimation.kt index 40477838259c..2e0b2fcf050b 100644 --- a/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/CameraAnimation.kt +++ b/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/CameraAnimation.kt @@ -81,7 +81,7 @@ fun animatedCameraPosition( EaseInOut 1f at duration using EaseInOut } - } + }, ) } } @@ -91,9 +91,9 @@ fun animatedCameraPosition( latLong = LatLong( Latitude(latitudeAnimation.value), - Longitude.fromFloat(longitudeAnimation.value) + Longitude.fromFloat(longitudeAnimation.value), ), - verticalBias = cameraVerticalBias + verticalBias = cameraVerticalBias, ) } diff --git a/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/Map.kt b/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/Map.kt index b1ea1144f95a..a1e411bece6e 100644 --- a/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/Map.kt +++ b/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/Map.kt @@ -33,7 +33,7 @@ fun AnimatedMap( cameraBaseZoom: Float, cameraVerticalBias: Float, markers: List, - globeColors: GlobeColors + globeColors: GlobeColors, ) { Map( modifier = modifier, @@ -41,10 +41,10 @@ fun AnimatedMap( animatedCameraPosition( baseZoom = cameraBaseZoom, targetCameraLocation = cameraLocation, - cameraVerticalBias = cameraVerticalBias + cameraVerticalBias = cameraVerticalBias, ), markers = markers, - globeColors + globeColors, ) } diff --git a/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/data/LocationMarkerColors.kt b/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/data/LocationMarkerColors.kt index 7d4edb09cb8a..4e0959912b02 100644 --- a/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/data/LocationMarkerColors.kt +++ b/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/data/LocationMarkerColors.kt @@ -8,7 +8,7 @@ data class LocationMarkerColors( val centerColor: Color, val ringBorderColor: Color = Color.White, val shadowColor: Color = Color.Black.copy(alpha = DEFAULT_SHADOW_ALPHA), - val perimeterColors: Color = centerColor.copy(alpha = DEFAULT_PERIMETER_ALPHA) + val perimeterColors: Color = centerColor.copy(alpha = DEFAULT_PERIMETER_ALPHA), ) { companion object { private const val DEFAULT_SHADOW_ALPHA = 0.55f diff --git a/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/data/MapViewState.kt b/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/data/MapViewState.kt index 1e1a21111569..5430a4fe1ccd 100644 --- a/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/data/MapViewState.kt +++ b/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/data/MapViewState.kt @@ -6,5 +6,5 @@ import androidx.compose.runtime.Immutable class MapViewState( val cameraPosition: CameraPosition, val locationMarker: List, - val globeColors: GlobeColors + val globeColors: GlobeColors, ) diff --git a/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/data/Marker.kt b/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/data/Marker.kt index 4d26348d4580..a7f25ec54593 100644 --- a/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/data/Marker.kt +++ b/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/data/Marker.kt @@ -7,7 +7,7 @@ import net.mullvad.mullvadvpn.lib.model.LatLong data class Marker( val latLong: LatLong, val size: Float = DEFAULT_MARKER_SIZE, - val colors: LocationMarkerColors + val colors: LocationMarkerColors, ) { companion object { private const val DEFAULT_MARKER_SIZE = 0.02f diff --git a/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/internal/GLHelper.kt b/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/internal/GLHelper.kt index b60dc83c7f6c..b54fd97e4b3c 100644 --- a/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/internal/GLHelper.kt +++ b/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/internal/GLHelper.kt @@ -76,7 +76,7 @@ private fun initArrayBuffer(dataBuffer: Buffer, unitSizeInBytes: Int = 1): Int { GLES20.GL_ARRAY_BUFFER, dataBuffer.capacity() * unitSizeInBytes, dataBuffer, - GLES20.GL_STATIC_DRAW + GLES20.GL_STATIC_DRAW, ) return buffer[0] } @@ -90,11 +90,11 @@ internal fun initIndexBuffer(dataBuffer: Buffer): IndexBufferWithLength { GLES20.GL_ELEMENT_ARRAY_BUFFER, dataBuffer.capacity(), dataBuffer, - GLES20.GL_STATIC_DRAW + GLES20.GL_STATIC_DRAW, ) return IndexBufferWithLength( indexBuffer = buffer[0], - length = dataBuffer.capacity() / Float.SIZE_BYTES + length = dataBuffer.capacity() / Float.SIZE_BYTES, ) } diff --git a/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/internal/MapGLRenderer.kt b/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/internal/MapGLRenderer.kt index 887e64bebd8a..b767d894b7ba 100644 --- a/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/internal/MapGLRenderer.kt +++ b/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/internal/MapGLRenderer.kt @@ -27,7 +27,7 @@ internal class MapGLRenderer(private val resources: Resources) : GLSurfaceView.R evicted: Boolean, key: LocationMarkerColors, oldValue: LocationMarker, - newValue: LocationMarker? + newValue: LocationMarker?, ) { oldValue.onRemove() } @@ -114,7 +114,7 @@ internal class MapGLRenderer(private val resources: Resources) : GLSurfaceView.R FIELD_OF_VIEW, ratio, PERSPECTIVE_Z_NEAR, - PERSPECTIVE_Z_FAR + PERSPECTIVE_Z_FAR, ) } } diff --git a/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/internal/shapes/Globe.kt b/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/internal/shapes/Globe.kt index 7e862ef59e80..8b5b834f6136 100644 --- a/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/internal/shapes/Globe.kt +++ b/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/internal/shapes/Globe.kt @@ -61,7 +61,7 @@ internal class Globe(resources: Resources) { UniformLocation( color = GLES20.glGetUniformLocation(shaderProgram, "uColor"), projectionMatrix = GLES20.glGetUniformLocation(shaderProgram, "uProjectionMatrix"), - modelViewMatrix = GLES20.glGetUniformLocation(shaderProgram, "uModelViewMatrix") + modelViewMatrix = GLES20.glGetUniformLocation(shaderProgram, "uModelViewMatrix"), ) } @@ -69,7 +69,7 @@ internal class Globe(resources: Resources) { projectionMatrix: FloatArray, viewMatrix: FloatArray, colors: GlobeColors, - contourWidth: Float = 3f + contourWidth: Float = 3f, ) { val globeViewMatrix = viewMatrix.copyOf() @@ -84,7 +84,7 @@ internal class Globe(resources: Resources) { landVertexBuffer, landContour, colors.contourColorArray, - GLES20.GL_LINE_STRIP + GLES20.GL_LINE_STRIP, ) // Scale the globe to avoid z-fighting @@ -93,7 +93,7 @@ internal class Globe(resources: Resources) { 0, LAND_OCEAN_SCALE_FACTOR, LAND_OCEAN_SCALE_FACTOR, - LAND_OCEAN_SCALE_FACTOR + LAND_OCEAN_SCALE_FACTOR, ) // Draw land @@ -113,7 +113,7 @@ internal class Globe(resources: Resources) { oceanVertexBuffer, oceanIndices, colors.oceanColorArray, - GLES20.GL_TRIANGLES + GLES20.GL_TRIANGLES, ) } @@ -149,7 +149,7 @@ internal class Globe(resources: Resources) { private data class UniformLocation( val color: Int, val projectionMatrix: Int, - val modelViewMatrix: Int + val modelViewMatrix: Int, ) companion object { diff --git a/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/internal/shapes/LocationMarker.kt b/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/internal/shapes/LocationMarker.kt index c67a0a1bb7f8..26e69416b98c 100644 --- a/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/internal/shapes/LocationMarker.kt +++ b/android/lib/map/src/main/kotlin/net/mullvad/mullvadvpn/lib/map/internal/shapes/LocationMarker.kt @@ -41,12 +41,12 @@ internal class LocationMarker(val colors: LocationMarkerColors) { attribLocations = AttribLocations( vertexPosition = GLES20.glGetAttribLocation(shaderProgram, "aVertexPosition"), - vertexColor = GLES20.glGetAttribLocation(shaderProgram, "aVertexColor") + vertexColor = GLES20.glGetAttribLocation(shaderProgram, "aVertexColor"), ) uniformLocation = UniformLocation( projectionMatrix = GLES20.glGetUniformLocation(shaderProgram, "uProjectionMatrix"), - modelViewMatrix = GLES20.glGetUniformLocation(shaderProgram, "uModelViewMatrix") + modelViewMatrix = GLES20.glGetUniformLocation(shaderProgram, "uModelViewMatrix"), ) } @@ -177,7 +177,7 @@ internal class LocationMarker(val colors: LocationMarkerColors) { floatArrayOf(0.0f, 0.0f, 0.00003f), colors.centerColor, colors.centerColor, - ) // Center colored circle + ), // Center colored circle ) fun onRemove() { diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/AccountData.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/AccountData.kt index 60395721d845..8a4182b2e502 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/AccountData.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/AccountData.kt @@ -2,7 +2,4 @@ package net.mullvad.mullvadvpn.lib.model import org.joda.time.DateTime -data class AccountData( - val id: AccountId, - val expiryDate: DateTime, -) +data class AccountData(val id: AccountId, val expiryDate: DateTime) diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ActionAfterDisconnect.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ActionAfterDisconnect.kt index 531fc1c0735e..d18d887b50d1 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ActionAfterDisconnect.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ActionAfterDisconnect.kt @@ -3,5 +3,5 @@ package net.mullvad.mullvadvpn.lib.model enum class ActionAfterDisconnect { Nothing, Block, - Reconnect + Reconnect, } diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ApiAccessMethod.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ApiAccessMethod.kt index d8762af39169..3fdcf8c73009 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ApiAccessMethod.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ApiAccessMethod.kt @@ -17,7 +17,7 @@ sealed interface ApiAccessMethod : Parcelable { val ip: String, val port: Port, val password: String?, - val cipher: Cipher + val cipher: Cipher, ) : CustomProxy } } diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ApiAccessMethodSetting.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ApiAccessMethodSetting.kt index 07e1c185dfeb..ff1fa8a7716b 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ApiAccessMethodSetting.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ApiAccessMethodSetting.kt @@ -4,5 +4,5 @@ data class ApiAccessMethodSetting( val id: ApiAccessMethodId, val name: ApiAccessMethodName, val enabled: Boolean, - val apiAccessMethod: ApiAccessMethod + val apiAccessMethod: ApiAccessMethod, ) diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/CustomList.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/CustomList.kt index ed43ac1097a7..12468aaecd0b 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/CustomList.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/CustomList.kt @@ -6,7 +6,7 @@ import arrow.optics.optics data class CustomList( val id: CustomListId, val name: CustomListName, - val locations: List + val locations: List, ) { companion object } diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/DnsOptions.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/DnsOptions.kt index ae27e4745776..0aee2239d29c 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/DnsOptions.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/DnsOptions.kt @@ -6,7 +6,7 @@ import arrow.optics.optics data class DnsOptions( val state: DnsState, val defaultOptions: DefaultDnsOptions, - val customOptions: CustomDnsOptions + val customOptions: CustomDnsOptions, ) { companion object } diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/DnsState.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/DnsState.kt index 4bf053eef1ae..7529b5486442 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/DnsState.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/DnsState.kt @@ -2,5 +2,5 @@ package net.mullvad.mullvadvpn.lib.model enum class DnsState { Default, - Custom + Custom, } diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/NewAccessMethodSetting.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/NewAccessMethodSetting.kt index 990dc300bcc4..b7a1016b8f04 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/NewAccessMethodSetting.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/NewAccessMethodSetting.kt @@ -7,5 +7,5 @@ import kotlinx.parcelize.Parcelize data class NewAccessMethodSetting( val name: ApiAccessMethodName, val enabled: Boolean, - val apiAccessMethod: ApiAccessMethod.CustomProxy + val apiAccessMethod: ApiAccessMethod.CustomProxy, ) : Parcelable diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/Notification.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/Notification.kt index 5dda03aa9dd7..acb8d7490767 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/Notification.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/Notification.kt @@ -18,7 +18,7 @@ sealed interface Notification { override val channelId: NotificationChannelId, override val actions: List, val websiteAuthToken: WebsiteAuthToken?, - val durationUntilExpiry: Duration + val durationUntilExpiry: Duration, ) : Notification { override val ongoing: Boolean = false } diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ObfuscationSettings.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ObfuscationSettings.kt index b8a26973a25d..1bf12b2f9b8a 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ObfuscationSettings.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ObfuscationSettings.kt @@ -5,7 +5,7 @@ import arrow.optics.optics @optics data class ObfuscationSettings( val selectedObfuscation: SelectedObfuscation, - val udp2tcp: Udp2TcpObfuscationSettings + val udp2tcp: Udp2TcpObfuscationSettings, ) { companion object } diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ObfuscationType.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ObfuscationType.kt index 4e7cb1f5a897..80c2f70e135b 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ObfuscationType.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ObfuscationType.kt @@ -2,5 +2,5 @@ package net.mullvad.mullvadvpn.lib.model enum class ObfuscationType { Udp2Tcp, - Shadowsocks + Shadowsocks, } diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/Ownership.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/Ownership.kt index 5257f944d309..682419c19bfe 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/Ownership.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/Ownership.kt @@ -2,5 +2,5 @@ package net.mullvad.mullvadvpn.lib.model enum class Ownership { MullvadOwned, - Rented + Rented, } diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ParameterGenerationError.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ParameterGenerationError.kt index 476aed1407ab..0aadc19094c4 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ParameterGenerationError.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/ParameterGenerationError.kt @@ -4,5 +4,5 @@ enum class ParameterGenerationError { NoMatchingRelay, NoMatchingBridgeRelay, NoWireguardKey, - CustomTunnelHostResultionError + CustomTunnelHostResultionError, } diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/QuantumResistantState.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/QuantumResistantState.kt index c77dab72d390..26179c25c320 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/QuantumResistantState.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/QuantumResistantState.kt @@ -3,5 +3,5 @@ package net.mullvad.mullvadvpn.lib.model enum class QuantumResistantState { Auto, On, - Off + Off, } diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/RelayItem.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/RelayItem.kt index 17bc563a8ddd..edf00d4cb4fa 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/RelayItem.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/RelayItem.kt @@ -13,10 +13,8 @@ sealed interface RelayItem { val hasChildren: Boolean @optics - data class CustomList( - val customList: DomainCustomList, - val locations: List, - ) : RelayItem { + data class CustomList(val customList: DomainCustomList, val locations: List) : + RelayItem { override val name: String = customList.name.value override val id = customList.id @@ -34,7 +32,7 @@ sealed interface RelayItem { data class Country( override val id: GeoLocationId.Country, override val name: String, - val cities: List + val cities: List, ) : Location { val relays = cities.flatMap { city -> city.relays } override val active = cities.any { it.active } @@ -47,7 +45,7 @@ sealed interface RelayItem { data class City( override val id: GeoLocationId.City, override val name: String, - val relays: List + val relays: List, ) : Location { override val active = relays.any { it.active } override val hasChildren: Boolean = relays.isNotEmpty() diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/RelayList.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/RelayList.kt index 39e43a713ede..197849b2f10e 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/RelayList.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/RelayList.kt @@ -2,5 +2,5 @@ package net.mullvad.mullvadvpn.lib.model data class RelayList( val countries: List, - val wireguardEndpointData: WireguardEndpointData + val wireguardEndpointData: WireguardEndpointData, ) diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/RelayOverride.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/RelayOverride.kt index 3bd0a2f0a1d9..522031a3326e 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/RelayOverride.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/RelayOverride.kt @@ -7,7 +7,7 @@ import java.net.InetAddress data class RelayOverride( val hostname: String, val ipv4AddressIn: InetAddress?, - val ipv6AddressIn: InetAddress? + val ipv6AddressIn: InetAddress?, ) { companion object } diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/SelectedObfuscation.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/SelectedObfuscation.kt index 1651d61db7ab..03de12079e0f 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/SelectedObfuscation.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/SelectedObfuscation.kt @@ -3,5 +3,5 @@ package net.mullvad.mullvadvpn.lib.model enum class SelectedObfuscation { Auto, Off, - Udp2Tcp + Udp2Tcp, } diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/Settings.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/Settings.kt index e801397b2773..0c15202beeca 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/Settings.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/Settings.kt @@ -13,7 +13,7 @@ data class Settings( val relayOverrides: List, val showBetaReleases: Boolean, val splitTunnelSettings: SplitTunnelSettings, - val apiAccessMethodSettings: List + val apiAccessMethodSettings: List, ) { companion object } diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/TransportProtocol.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/TransportProtocol.kt index b25e3061bea5..4a36c3ce3cf6 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/TransportProtocol.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/TransportProtocol.kt @@ -6,5 +6,5 @@ import kotlinx.parcelize.Parcelize @Parcelize enum class TransportProtocol : Parcelable { Tcp, - Udp + Udp, } diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/TunnelEndpoint.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/TunnelEndpoint.kt index d715f1676610..1465997cc57c 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/TunnelEndpoint.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/TunnelEndpoint.kt @@ -3,5 +3,5 @@ package net.mullvad.mullvadvpn.lib.model data class TunnelEndpoint( val endpoint: Endpoint, val quantumResistant: Boolean, - val obfuscation: ObfuscationEndpoint? + val obfuscation: ObfuscationEndpoint?, ) diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/TunnelState.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/TunnelState.kt index 8ed43bd294b2..53d468c01ec4 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/TunnelState.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/lib/model/TunnelState.kt @@ -6,13 +6,13 @@ sealed class TunnelState { data class Connecting( val endpoint: TunnelEndpoint?, val location: GeoIpLocation?, - val featureIndicators: List + val featureIndicators: List, ) : TunnelState() data class Connected( val endpoint: TunnelEndpoint, val location: GeoIpLocation?, - val featureIndicators: List + val featureIndicators: List, ) : TunnelState() data class Disconnecting(val actionAfterDisconnect: ActionAfterDisconnect) : TunnelState() @@ -33,7 +33,7 @@ sealed class TunnelState { return when (this) { is Connected, is Connecting, - is Disconnecting, -> true + is Disconnecting -> true is Disconnected -> false is Error -> this.errorState.isBlocking } diff --git a/android/lib/payment/src/main/kotlin/net/mullvad/mullvadvpn/lib/payment/PaymentRepository.kt b/android/lib/payment/src/main/kotlin/net/mullvad/mullvadvpn/lib/payment/PaymentRepository.kt index 0f076eab74e1..8faa7d08bcdb 100644 --- a/android/lib/payment/src/main/kotlin/net/mullvad/mullvadvpn/lib/payment/PaymentRepository.kt +++ b/android/lib/payment/src/main/kotlin/net/mullvad/mullvadvpn/lib/payment/PaymentRepository.kt @@ -13,7 +13,7 @@ interface PaymentRepository { fun purchaseProduct( productId: ProductId, - activityProvider: () -> Activity + activityProvider: () -> Activity, ): Flow suspend fun verifyPurchases(): Either diff --git a/android/lib/payment/src/main/kotlin/net/mullvad/mullvadvpn/lib/payment/model/PaymentProduct.kt b/android/lib/payment/src/main/kotlin/net/mullvad/mullvadvpn/lib/payment/model/PaymentProduct.kt index 8945453d3773..6185d9d093aa 100644 --- a/android/lib/payment/src/main/kotlin/net/mullvad/mullvadvpn/lib/payment/model/PaymentProduct.kt +++ b/android/lib/payment/src/main/kotlin/net/mullvad/mullvadvpn/lib/payment/model/PaymentProduct.kt @@ -3,5 +3,5 @@ package net.mullvad.mullvadvpn.lib.payment.model data class PaymentProduct( val productId: ProductId, val price: ProductPrice, - val status: PaymentStatus? + val status: PaymentStatus?, ) diff --git a/android/lib/payment/src/main/kotlin/net/mullvad/mullvadvpn/lib/payment/model/PaymentStatus.kt b/android/lib/payment/src/main/kotlin/net/mullvad/mullvadvpn/lib/payment/model/PaymentStatus.kt index 37574249a631..294802c1d78a 100644 --- a/android/lib/payment/src/main/kotlin/net/mullvad/mullvadvpn/lib/payment/model/PaymentStatus.kt +++ b/android/lib/payment/src/main/kotlin/net/mullvad/mullvadvpn/lib/payment/model/PaymentStatus.kt @@ -2,5 +2,5 @@ package net.mullvad.mullvadvpn.lib.payment.model enum class PaymentStatus { PENDING, - VERIFICATION_IN_PROGRESS + VERIFICATION_IN_PROGRESS, } diff --git a/android/lib/shared/src/main/kotlin/net/mullvad/mullvadvpn/lib/shared/AccountRepository.kt b/android/lib/shared/src/main/kotlin/net/mullvad/mullvadvpn/lib/shared/AccountRepository.kt index 82f70e8140a7..b605bf7ac09f 100644 --- a/android/lib/shared/src/main/kotlin/net/mullvad/mullvadvpn/lib/shared/AccountRepository.kt +++ b/android/lib/shared/src/main/kotlin/net/mullvad/mullvadvpn/lib/shared/AccountRepository.kt @@ -25,7 +25,7 @@ import org.joda.time.DateTime class AccountRepository( private val managementService: ManagementService, private val deviceRepository: DeviceRepository, - val scope: CoroutineScope + val scope: CoroutineScope, ) { private val _mutableAccountDataCache: MutableSharedFlow = MutableSharedFlow() @@ -43,7 +43,7 @@ class AccountRepository( DeviceState.Revoked -> null } }, - _mutableAccountDataCache + _mutableAccountDataCache, ) .distinctUntilChanged() .stateIn(scope = scope, SharingStarted.Eagerly, null) diff --git a/android/lib/shared/src/main/kotlin/net/mullvad/mullvadvpn/lib/shared/ConnectionProxy.kt b/android/lib/shared/src/main/kotlin/net/mullvad/mullvadvpn/lib/shared/ConnectionProxy.kt index 13d668b65bb7..2dbd15ec0360 100644 --- a/android/lib/shared/src/main/kotlin/net/mullvad/mullvadvpn/lib/shared/ConnectionProxy.kt +++ b/android/lib/shared/src/main/kotlin/net/mullvad/mullvadvpn/lib/shared/ConnectionProxy.kt @@ -12,7 +12,7 @@ import net.mullvad.mullvadvpn.lib.model.TunnelState class ConnectionProxy( private val managementService: ManagementService, translationRepository: RelayLocationTranslationRepository, - private val vpnPermissionRepository: VpnPermissionRepository + private val vpnPermissionRepository: VpnPermissionRepository, ) { val tunnelState = combine(managementService.tunnelState, translationRepository.translations) { diff --git a/android/lib/shared/src/main/kotlin/net/mullvad/mullvadvpn/lib/shared/DeviceRepository.kt b/android/lib/shared/src/main/kotlin/net/mullvad/mullvadvpn/lib/shared/DeviceRepository.kt index 29f91b43f1b1..258f918788aa 100644 --- a/android/lib/shared/src/main/kotlin/net/mullvad/mullvadvpn/lib/shared/DeviceRepository.kt +++ b/android/lib/shared/src/main/kotlin/net/mullvad/mullvadvpn/lib/shared/DeviceRepository.kt @@ -18,18 +18,18 @@ import net.mullvad.mullvadvpn.lib.model.GetDeviceListError class DeviceRepository( private val managementService: ManagementService, - dispatcher: CoroutineDispatcher = Dispatchers.IO + dispatcher: CoroutineDispatcher = Dispatchers.IO, ) { val deviceState: StateFlow = managementService.deviceState.stateIn( CoroutineScope(dispatcher), SharingStarted.Eagerly, - null + null, ) suspend fun removeDevice( accountNumber: AccountNumber, - deviceId: DeviceId + deviceId: DeviceId, ): Either = managementService.removeDevice(accountNumber, deviceId) suspend fun deviceList(accountNumber: AccountNumber): Either> = diff --git a/android/lib/shared/src/main/kotlin/net/mullvad/mullvadvpn/lib/shared/RelayLocationTranslationRepository.kt b/android/lib/shared/src/main/kotlin/net/mullvad/mullvadvpn/lib/shared/RelayLocationTranslationRepository.kt index edaa0c1ebc41..b2685abaf2e5 100644 --- a/android/lib/shared/src/main/kotlin/net/mullvad/mullvadvpn/lib/shared/RelayLocationTranslationRepository.kt +++ b/android/lib/shared/src/main/kotlin/net/mullvad/mullvadvpn/lib/shared/RelayLocationTranslationRepository.kt @@ -23,7 +23,7 @@ class RelayLocationTranslationRepository( val context: Context, val localeRepository: LocaleRepository, externalScope: CoroutineScope = MainScope(), - val dispatcher: CoroutineDispatcher = Dispatchers.IO + val dispatcher: CoroutineDispatcher = Dispatchers.IO, ) { val translations: StateFlow = localeRepository.currentLocale diff --git a/android/lib/shared/src/main/kotlin/net/mullvad/mullvadvpn/lib/shared/VoucherRepository.kt b/android/lib/shared/src/main/kotlin/net/mullvad/mullvadvpn/lib/shared/VoucherRepository.kt index 3ea55ccd9d55..9b08181ee3b3 100644 --- a/android/lib/shared/src/main/kotlin/net/mullvad/mullvadvpn/lib/shared/VoucherRepository.kt +++ b/android/lib/shared/src/main/kotlin/net/mullvad/mullvadvpn/lib/shared/VoucherRepository.kt @@ -5,7 +5,7 @@ import net.mullvad.mullvadvpn.lib.model.VoucherCode class VoucherRepository( private val managementService: ManagementService, - private val accountRepository: AccountRepository + private val accountRepository: AccountRepository, ) { suspend fun submitVoucher(voucher: VoucherCode) = managementService.submitVoucher(voucher).onRight { diff --git a/android/lib/shared/src/test/kotlin/net/mullvad/mullvadvpn/lib/shared/ConnectionProxyTest.kt b/android/lib/shared/src/test/kotlin/net/mullvad/mullvadvpn/lib/shared/ConnectionProxyTest.kt index 138d0f5a41d9..065286710518 100644 --- a/android/lib/shared/src/test/kotlin/net/mullvad/mullvadvpn/lib/shared/ConnectionProxyTest.kt +++ b/android/lib/shared/src/test/kotlin/net/mullvad/mullvadvpn/lib/shared/ConnectionProxyTest.kt @@ -20,7 +20,7 @@ class ConnectionProxyTest { ConnectionProxy( managementService = mockManagementService, vpnPermissionRepository = mockVpnPermissionRepository, - translationRepository = mockTranslationRepository + translationRepository = mockTranslationRepository, ) @Test diff --git a/android/lib/talpid/src/main/kotlin/net/mullvad/talpid/model/TunConfig.kt b/android/lib/talpid/src/main/kotlin/net/mullvad/talpid/model/TunConfig.kt index 955a6f445432..77ea112043e0 100644 --- a/android/lib/talpid/src/main/kotlin/net/mullvad/talpid/model/TunConfig.kt +++ b/android/lib/talpid/src/main/kotlin/net/mullvad/talpid/model/TunConfig.kt @@ -7,5 +7,5 @@ data class TunConfig( val dnsServers: ArrayList, val routes: ArrayList, val excludedPackages: ArrayList, - val mtu: Int + val mtu: Int, ) diff --git a/android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/Theme.kt b/android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/Theme.kt index 88ed41e6ab41..1aa70f5fc2d1 100644 --- a/android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/Theme.kt +++ b/android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/Theme.kt @@ -47,8 +47,8 @@ private val MullvadTypography = TextStyle( fontWeight = FontWeight.Normal, letterSpacing = TextUnit.Unspecified, - fontSize = TypeScale.TextMedium - ) + fontSize = TypeScale.TextMedium, + ), ) private val lightColorScheme = @@ -136,7 +136,7 @@ val Shapes = small = RoundedCornerShape(4.dp), medium = RoundedCornerShape(4.dp), large = RoundedCornerShape(0.dp), - extraLarge = RoundedCornerShape(11.dp) + extraLarge = RoundedCornerShape(11.dp), ) val Dimens: Dimensions @@ -154,7 +154,7 @@ private val rippleAlpha = pressedAlpha = StateTokens.PressedStateLayerOpacity, focusedAlpha = StateTokens.FocusStateLayerOpacity, draggedAlpha = StateTokens.DraggedStateLayerOpacity, - hoveredAlpha = StateTokens.HoverStateLayerOpacity + hoveredAlpha = StateTokens.HoverStateLayerOpacity, ) @Composable @@ -183,7 +183,7 @@ fun AppTheme(content: @Composable () -> Unit) { ) { content() } - } + }, ) } } diff --git a/android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/Type.kt b/android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/Type.kt index 55997a8f71db..848e375e1cbf 100644 --- a/android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/Type.kt +++ b/android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/Type.kt @@ -25,9 +25,9 @@ internal val MullvadMaterial3Typography = fontFamily = FontFamily.SansSerif, fontWeight = FontWeight.SemiBold, fontSize = 18.sp, - lineHeight = 23.sp + lineHeight = 23.sp, ), labelMedium = TextStyle(fontFamily = FontFamily.SansSerif, fontWeight = FontWeight.SemiBold), - labelSmall = TextStyle(fontFamily = FontFamily.SansSerif, fontWeight = FontWeight.SemiBold) + labelSmall = TextStyle(fontFamily = FontFamily.SansSerif, fontWeight = FontWeight.SemiBold), ) diff --git a/android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/typeface/Typeface.kt b/android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/typeface/Typeface.kt index 5b79b1df1531..9ea368382dcf 100644 --- a/android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/typeface/Typeface.kt +++ b/android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/typeface/Typeface.kt @@ -13,7 +13,7 @@ val Typography.listItemText: TextStyle return TextStyle( fontWeight = FontWeight.Normal, letterSpacing = TextUnit.Unspecified, - fontSize = TypeScale.TextMediumPlus + fontSize = TypeScale.TextMediumPlus, ) } @@ -23,7 +23,7 @@ val Typography.listItemSubText: TextStyle return TextStyle( fontWeight = FontWeight.SemiBold, letterSpacing = TextUnit.Unspecified, - fontSize = TypeScale.TextSmall + fontSize = TypeScale.TextSmall, ) } @@ -33,6 +33,6 @@ val Typography.connectionStatus: TextStyle return TextStyle( fontWeight = FontWeight.Bold, letterSpacing = TextUnit.Unspecified, - fontSize = TypeScale.TextMedium + fontSize = TypeScale.TextMedium, ) } diff --git a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadDaemon.kt b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadDaemon.kt index cdaddec614cc..5bfae14383ed 100644 --- a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadDaemon.kt +++ b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadDaemon.kt @@ -12,7 +12,7 @@ object MullvadDaemon { rpcSocketPath: String, filesDirectory: String, cacheDirectory: String, - apiEndpoint: ApiEndpoint? + apiEndpoint: ApiEndpoint?, ) external fun shutdown() diff --git a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt index 6d17b85b6a30..560339237639 100644 --- a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt +++ b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/MullvadVpnService.kt @@ -161,7 +161,7 @@ class MullvadVpnService : TalpidVpnService() { rpcSocketPath = rpcSocketFile.absolutePath, filesDirectory = filesDir.absolutePath, cacheDirectory = cacheDir.absolutePath, - apiEndpoint = apiEndpointConfiguration.apiEndpoint() + apiEndpoint = apiEndpointConfiguration.apiEndpoint(), ) Logger.i("MullvadVpnService: Daemon initialized") } diff --git a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/di/VpnServiceModule.kt b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/di/VpnServiceModule.kt index e0370396751d..e229e0ed2404 100644 --- a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/di/VpnServiceModule.kt +++ b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/di/VpnServiceModule.kt @@ -29,25 +29,21 @@ val vpnServiceModule = module { get(), get(), get().id, - MainScope() + MainScope(), ) } bind NotificationProvider::class single { AccountExpiryNotificationProvider( get().id, get(), - get() + get(), ) } bind NotificationProvider::class - single { - NotificationManager( - get(), - getAll(), - get(), - MainScope(), - ) - } withOptions { createdAtStart() } + single { NotificationManager(get(), getAll(), get(), MainScope()) } withOptions + { + createdAtStart() + } single { MigrateSplitTunneling(androidContext()) } } diff --git a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/ForegroundNotificationManager.kt b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/ForegroundNotificationManager.kt index e02705cb2d65..5745377254cb 100644 --- a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/ForegroundNotificationManager.kt +++ b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/ForegroundNotificationManager.kt @@ -52,7 +52,7 @@ class ForegroundNotificationManager( vpnService.startForeground( tunnelStateNotificationProvider.notificationId.value, androidNotification, - ServiceInfo.FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED + ServiceInfo.FOREGROUND_SERVICE_TYPE_SYSTEM_EXEMPTED, ) } else { vpnService.startForeground( @@ -67,6 +67,6 @@ class ForegroundNotificationManager( NotificationChannel.TunnelUpdates.id, NotificationTunnelState.Disconnected(true), emptyList(), - false + false, ) } diff --git a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/NotificationChannelFactory.kt b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/NotificationChannelFactory.kt index c7c9a67b43cb..72539e8e9442 100644 --- a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/NotificationChannelFactory.kt +++ b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/NotificationChannelFactory.kt @@ -11,7 +11,7 @@ import net.mullvad.mullvadvpn.lib.model.NotificationChannelId class NotificationChannelFactory( private val notificationManagerCompat: NotificationManagerCompat, private val resources: Resources, - channels: List + channels: List, ) { init { channels.forEach { create(it) } @@ -30,10 +30,7 @@ class NotificationChannelFactory( } private fun NotificationChannel.TunnelUpdates.toChannel(): NotificationChannelCompat = - NotificationChannelCompat.Builder( - id.value, - NotificationManager.IMPORTANCE_LOW, - ) + NotificationChannelCompat.Builder(id.value, NotificationManager.IMPORTANCE_LOW) .setName(resources.getString(R.string.foreground_notification_channel_name)) .setDescription( resources.getString(R.string.foreground_notification_channel_description) @@ -43,10 +40,7 @@ class NotificationChannelFactory( .build() private fun NotificationChannel.AccountUpdates.toChannel(): NotificationChannelCompat = - NotificationChannelCompat.Builder( - id.value, - NotificationManager.IMPORTANCE_HIGH, - ) + NotificationChannelCompat.Builder(id.value, NotificationManager.IMPORTANCE_HIGH) .setName(resources.getString(R.string.account_time_notification_channel_name)) .setDescription( resources.getString(R.string.account_time_notification_channel_description) diff --git a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/NotificationManager.kt b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/NotificationManager.kt index 74aff9cca0cb..3d58e571fd00 100644 --- a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/NotificationManager.kt +++ b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/NotificationManager.kt @@ -37,12 +37,12 @@ class NotificationManager( if ( ActivityCompat.checkSelfPermission( context, - Manifest.permission.POST_NOTIFICATIONS + Manifest.permission.POST_NOTIFICATIONS, ) == PackageManager.PERMISSION_GRANTED ) { notificationManagerCompat.notify( notificationUpdate.notificationId.value, - androidNotification + androidNotification, ) } } diff --git a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/accountexpiry/AccountExpiryAndroidNotification.kt b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/accountexpiry/AccountExpiryAndroidNotification.kt index 5b5570470db2..0e8a1a528f28 100644 --- a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/accountexpiry/AccountExpiryAndroidNotification.kt +++ b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/accountexpiry/AccountExpiryAndroidNotification.kt @@ -45,13 +45,13 @@ private fun Resources.contentTitle(remainingTime: Duration): String = remainingTime.standardDays >= 1 -> { getRemainingText( R.plurals.account_credit_expires_in_days, - remainingTime.standardDays.toInt() + remainingTime.standardDays.toInt(), ) } remainingTime.standardHours >= 1 -> { getRemainingText( R.plurals.account_credit_expires_in_hours, - remainingTime.standardHours.toInt() + remainingTime.standardHours.toInt(), ) } else -> getString(R.string.account_credit_expires_in_a_few_minutes) diff --git a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/accountexpiry/AccountExpiryNotificationProvider.kt b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/accountexpiry/AccountExpiryNotificationProvider.kt index b1f16138909a..e6980b97069c 100644 --- a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/accountexpiry/AccountExpiryNotificationProvider.kt +++ b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/accountexpiry/AccountExpiryNotificationProvider.kt @@ -26,7 +26,7 @@ class AccountExpiryNotificationProvider( combine( deviceRepository.deviceState, accountRepository.accountData.filterNotNull(), - accountRepository.isNewAccount + accountRepository.isNewAccount, ) { deviceState, accountData, isNewAccount -> if (deviceState !is DeviceState.LoggedIn) { return@combine NotificationUpdate.Cancel(notificationId) diff --git a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/tunnelstate/TunnelStateNotificationAction.kt b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/tunnelstate/TunnelStateNotificationAction.kt index 74027ac940b5..3e0f3f7e3ba5 100644 --- a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/tunnelstate/TunnelStateNotificationAction.kt +++ b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/tunnelstate/TunnelStateNotificationAction.kt @@ -77,7 +77,7 @@ internal fun NotificationAction.Tunnel.toCompatAction(context: Context): Notific return NotificationCompat.Action( toIconResource(), context.getString(titleResource()), - pendingIntent + pendingIntent, ) } diff --git a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/tunnelstate/TunnelStateNotificationProvider.kt b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/tunnelstate/TunnelStateNotificationProvider.kt index dada16ace3b3..3ff3b07e66df 100644 --- a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/tunnelstate/TunnelStateNotificationProvider.kt +++ b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/notifications/tunnelstate/TunnelStateNotificationProvider.kt @@ -30,7 +30,7 @@ class TunnelStateNotificationProvider( vpnPermissionRepository: VpnPermissionRepository, deviceRepository: DeviceRepository, channelId: NotificationChannelId, - scope: CoroutineScope + scope: CoroutineScope, ) : NotificationProvider { internal val notificationId = NotificationId(2) @@ -38,7 +38,7 @@ class TunnelStateNotificationProvider( combine( connectionProxy.tunnelState, connectionProxy.tunnelState.actionAfterDisconnect().distinctUntilChanged(), - deviceRepository.deviceState + deviceRepository.deviceState, ) { tunnelState: TunnelState, actionAfterDisconnect: ActionAfterDisconnect?, deviceState -> if ( @@ -51,7 +51,7 @@ class TunnelStateNotificationProvider( tunnelState, actionAfterDisconnect, vpnPermissionRepository.hasVpnPermission(), - vpnPermissionRepository.getAlwaysOnVpnAppName() + vpnPermissionRepository.getAlwaysOnVpnAppName(), ) return@combine NotificationUpdate.Notify( @@ -60,8 +60,8 @@ class TunnelStateNotificationProvider( channelId = channelId, state = notificationTunnelState, actions = listOfNotNull(notificationTunnelState.toAction()), - ongoing = notificationTunnelState is NotificationTunnelState.Connected - ) + ongoing = notificationTunnelState is NotificationTunnelState.Connected, + ), ) } .stateIn(scope, SharingStarted.Eagerly, NotificationUpdate.Cancel(notificationId)) @@ -70,12 +70,12 @@ class TunnelStateNotificationProvider( tunnelState: TunnelState, actionAfterDisconnect: ActionAfterDisconnect?, hasVpnPermission: Boolean, - alwaysOnVpnPermissionName: String? + alwaysOnVpnPermissionName: String?, ): NotificationTunnelState = tunnelState.toNotificationTunnelState( actionAfterDisconnect, hasVpnPermission, - alwaysOnVpnPermissionName + alwaysOnVpnPermissionName, ) private fun Flow.actionAfterDisconnect(): Flow = @@ -86,7 +86,7 @@ class TunnelStateNotificationProvider( private fun TunnelState.toNotificationTunnelState( actionAfterDisconnect: ActionAfterDisconnect?, hasVpnPermission: Boolean, - alwaysOnVpnPermissionName: String? + alwaysOnVpnPermissionName: String?, ) = when (this) { is TunnelState.Disconnected -> NotificationTunnelState.Disconnected(hasVpnPermission) diff --git a/android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/NameTest.kt b/android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/NameTest.kt index be397e658219..238b73780999 100644 --- a/android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/NameTest.kt +++ b/android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/NameTest.kt @@ -24,10 +24,6 @@ class NameTest { companion object { private val DISALLOWED_DECLARATION_OR_PARAMETER_NAMES = - listOf( - "accountToken", - "AccountToken", - "ACCOUNT_TOKEN", - ) + listOf("accountToken", "AccountToken", "ACCOUNT_TOKEN") } } diff --git a/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/extension/UiAutomatorExtensions.kt b/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/extension/UiAutomatorExtensions.kt index 9f3d727d2906..462639ed472d 100644 --- a/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/extension/UiAutomatorExtensions.kt +++ b/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/extension/UiAutomatorExtensions.kt @@ -19,7 +19,7 @@ fun UiObject2.findObjectByCaseInsensitiveText(text: String): UiObject2 { fun UiDevice.findObjectWithTimeout( selector: BySelector, - timeout: Long = DEFAULT_INTERACTION_TIMEOUT + timeout: Long = DEFAULT_INTERACTION_TIMEOUT, ): UiObject2 { wait(Until.hasObject(selector), timeout) @@ -67,7 +67,7 @@ fun UiDevice.clickAllowOnNotificationPermissionPromptIfApiLevel33AndAbove( fun UiObject2.findObjectWithTimeout( selector: BySelector, - timeout: Long = DEFAULT_INTERACTION_TIMEOUT + timeout: Long = DEFAULT_INTERACTION_TIMEOUT, ): UiObject2 { wait(Until.hasObject(selector), timeout) diff --git a/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/interactor/AppInteractor.kt b/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/interactor/AppInteractor.kt index 19de2ac789b0..9abd2aa7e20d 100644 --- a/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/interactor/AppInteractor.kt +++ b/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/interactor/AppInteractor.kt @@ -21,14 +21,14 @@ import net.mullvad.mullvadvpn.test.common.extension.findObjectWithTimeout class AppInteractor( private val device: UiDevice, private val targetContext: Context, - private val targetPackageName: String + private val targetPackageName: String, ) { fun launch(customApiEndpointConfiguration: CustomApiEndpointConfiguration? = null) { device.pressHome() // Wait for launcher device.wait( Until.hasObject(By.pkg(device.launcherPackageName).depth(0)), - APP_LAUNCH_TIMEOUT + APP_LAUNCH_TIMEOUT, ) val intent = @@ -95,7 +95,7 @@ class AppInteractor( .findObjectWithTimeout( // Text exist and contains IP address By.res("location_info_connection_out_test_tag").textContains("."), - CONNECTION_TIMEOUT + CONNECTION_TIMEOUT, ) .text .extractIpAddress() diff --git a/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/rule/CaptureScreenshotOnFailedTestRule.kt b/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/rule/CaptureScreenshotOnFailedTestRule.kt index 2018714e09af..4a64738aebd3 100644 --- a/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/rule/CaptureScreenshotOnFailedTestRule.kt +++ b/android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/rule/CaptureScreenshotOnFailedTestRule.kt @@ -38,14 +38,14 @@ class CaptureScreenshotOnFailedTestRule(private val testTag: String) : TestWatch contentValues = contentValues, contentResolver = contentResolver, baseDir = baseDir, - filename = filename + filename = filename, ) } else { writeToExternalStorage( contentValues = contentValues, contentResolver = contentResolver, baseDir = baseDir, - filename = filename + filename = filename, ) } } @@ -56,7 +56,7 @@ class CaptureScreenshotOnFailedTestRule(private val testTag: String) : TestWatch contentValues: ContentValues, contentResolver: ContentResolver, baseDir: String, - filename: String + filename: String, ) { contentValues.apply { put(MediaStore.MediaColumns.DISPLAY_NAME, filename) @@ -84,7 +84,7 @@ class CaptureScreenshotOnFailedTestRule(private val testTag: String) : TestWatch contentValues: ContentValues, contentResolver: ContentResolver, baseDir: String, - filename: String + filename: String, ) { val screenshotBaseDirectory = Paths.get( diff --git a/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/EndToEndTest.kt b/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/EndToEndTest.kt index 160ef52468a7..278def0b35c1 100644 --- a/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/EndToEndTest.kt +++ b/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/EndToEndTest.kt @@ -23,7 +23,7 @@ abstract class EndToEndTest(private val infra: String) { (if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { GrantPermissionExtension.grant( Manifest.permission.WRITE_EXTERNAL_STORAGE, - Manifest.permission.READ_EXTERNAL_STORAGE + Manifest.permission.READ_EXTERNAL_STORAGE, ) } else { GrantPermissionExtension.grant() diff --git a/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/WebLinkTest.kt b/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/WebLinkTest.kt index d4caa1da56f6..5ea05159a647 100644 --- a/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/WebLinkTest.kt +++ b/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/WebLinkTest.kt @@ -25,7 +25,7 @@ class WebLinkTest : EndToEndTest(BuildConfig.FLAVOR_infrastructure) { // Then device.findObjectWithTimeout( selector = By.text("Mullvad help center"), - timeout = WEB_TIMEOUT + timeout = WEB_TIMEOUT, ) } } diff --git a/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/interactor/MullvadAccountInteractor.kt b/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/interactor/MullvadAccountInteractor.kt index 59c9b49b9176..b4b3f19e05e3 100644 --- a/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/interactor/MullvadAccountInteractor.kt +++ b/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/interactor/MullvadAccountInteractor.kt @@ -4,7 +4,7 @@ import net.mullvad.mullvadvpn.test.e2e.misc.SimpleMullvadHttpClient class MullvadAccountInteractor( private val httpClient: SimpleMullvadHttpClient, - private val testAccountNumber: String + private val testAccountNumber: String, ) { fun cleanupAccount() { httpClient.removeAllDevices(testAccountNumber) diff --git a/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/misc/AccountTestRule.kt b/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/misc/AccountTestRule.kt index 6496f82e0793..ff6276a69f6d 100644 --- a/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/misc/AccountTestRule.kt +++ b/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/misc/AccountTestRule.kt @@ -23,7 +23,7 @@ class AccountTestRule : BeforeEachCallback { client.addTimeToAccountUsingPartnerAuth( accountNumber = validAccountNumber, daysToAdd = 1, - partnerAuth = partnerAuth + partnerAuth = partnerAuth, ) } else { validAccountNumber = diff --git a/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/misc/SimpleMullvadHttpClient.kt b/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/misc/SimpleMullvadHttpClient.kt index eaff4290eddd..d7fcfb05e89e 100644 --- a/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/misc/SimpleMullvadHttpClient.kt +++ b/android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/misc/SimpleMullvadHttpClient.kt @@ -48,13 +48,13 @@ class SimpleMullvadHttpClient(context: Context) { fun addTimeToAccountUsingPartnerAuth( accountNumber: String, daysToAdd: Int, - partnerAuth: String + partnerAuth: String, ) { sendSimpleSynchronousRequest( method = Request.Method.POST, url = "$PARTNER_ACCOUNT_URL/$accountNumber/extend", body = JSONObject().apply { put("days", "$daysToAdd") }, - authorizationHeader = "Basic $partnerAuth" + authorizationHeader = "Basic $partnerAuth", ) } @@ -65,7 +65,7 @@ class SimpleMullvadHttpClient(context: Context) { sendSimpleSynchronousRequestArray( Request.Method.GET, DEVICE_LIST_URL, - token = accessToken + token = accessToken, ) return response!! @@ -85,7 +85,7 @@ class SimpleMullvadHttpClient(context: Context) { sendSimpleSynchronousRequestString( method = Request.Method.DELETE, url = "$DEVICE_LIST_URL/$deviceId", - authorizationHeader = "Bearer $token" + authorizationHeader = "Bearer $token", ) } @@ -95,7 +95,7 @@ class SimpleMullvadHttpClient(context: Context) { ?.let { json -> ConnCheckState( isConnected = json.getBoolean("mullvad_exit_ip"), - ipAddress = json.getString("ip") + ipAddress = json.getString("ip"), ) } } @@ -104,7 +104,7 @@ class SimpleMullvadHttpClient(context: Context) { method: Int, url: String, body: JSONObject? = null, - authorizationHeader: String? = null + authorizationHeader: String? = null, ): JSONObject? { val future = RequestFuture.newFuture() @@ -134,7 +134,7 @@ class SimpleMullvadHttpClient(context: Context) { method: Int, url: String, body: String? = null, - authorizationHeader: String? = null + authorizationHeader: String? = null, ): String? { val future = RequestFuture.newFuture() val request = @@ -163,7 +163,7 @@ class SimpleMullvadHttpClient(context: Context) { method: Int, url: String, body: JSONArray? = null, - token: String? = null + token: String? = null, ): JSONArray? { val future = RequestFuture.newFuture() val request = diff --git a/android/test/mockapi/src/main/kotlin/net/mullvad/mullvadvpn/test/mockapi/MockApiDispatcher.kt b/android/test/mockapi/src/main/kotlin/net/mullvad/mullvadvpn/test/mockapi/MockApiDispatcher.kt index 3539bad0fa7f..a2978808d775 100644 --- a/android/test/mockapi/src/main/kotlin/net/mullvad/mullvadvpn/test/mockapi/MockApiDispatcher.kt +++ b/android/test/mockapi/src/main/kotlin/net/mullvad/mullvadvpn/test/mockapi/MockApiDispatcher.kt @@ -83,7 +83,7 @@ class MockApiDispatcher : Dispatcher() { .setBody( accessTokenJsonResponse( accessToken = DUMMY_ACCESS_TOKEN, - expiry = currentUtcTimeWithOffsetZero().plusDays(1) + expiry = currentUtcTimeWithOffsetZero().plusDays(1), ) .toString() ) @@ -114,7 +114,7 @@ class MockApiDispatcher : Dispatcher() { id = deviceId, name = devices!![deviceId]!!, // Should always exist publicKey = cachedKey, - creationDate = currentUtcTimeWithOffsetZero().minusDays(1) + creationDate = currentUtcTimeWithOffsetZero().minusDays(1), ) .toString() ) @@ -135,7 +135,7 @@ class MockApiDispatcher : Dispatcher() { id = devicePendingToGetCreated!!.first, name = devicePendingToGetCreated!!.second, publicKey = newKey, - creationDate = currentUtcTimeWithOffsetZero().minusDays(1) + creationDate = currentUtcTimeWithOffsetZero().minusDays(1), ) .toString() ) @@ -157,7 +157,7 @@ class MockApiDispatcher : Dispatcher() { id = entry.key, name = entry.value, publicKey = cachedKey, - creationDate = currentUtcTimeWithOffsetZero().minusDays(index + 1) + creationDate = currentUtcTimeWithOffsetZero().minusDays(index + 1), ) ) } @@ -174,7 +174,7 @@ class MockApiDispatcher : Dispatcher() { accountCreationJson( id = DUMMY_ID_1, expiry = DateTime(), - accountNumber = expectedAccountNumber + accountNumber = expectedAccountNumber, ) .toString() ) diff --git a/android/test/mockapi/src/main/kotlin/net/mullvad/mullvadvpn/test/mockapi/MockApiTest.kt b/android/test/mockapi/src/main/kotlin/net/mullvad/mullvadvpn/test/mockapi/MockApiTest.kt index 74a47f3c3d14..bd236bb9783d 100644 --- a/android/test/mockapi/src/main/kotlin/net/mullvad/mullvadvpn/test/mockapi/MockApiTest.kt +++ b/android/test/mockapi/src/main/kotlin/net/mullvad/mullvadvpn/test/mockapi/MockApiTest.kt @@ -59,7 +59,7 @@ abstract class MockApiTest { InetAddress.getLocalHost().hostName, port, disableAddressCache = true, - disableTls = true + disableTls = true, ) } } diff --git a/android/test/mockapi/src/main/kotlin/net/mullvad/mullvadvpn/test/mockapi/TooManyDevicesMockApiTest.kt b/android/test/mockapi/src/main/kotlin/net/mullvad/mullvadvpn/test/mockapi/TooManyDevicesMockApiTest.kt index c652bd403a5e..fbd3c3ca8437 100644 --- a/android/test/mockapi/src/main/kotlin/net/mullvad/mullvadvpn/test/mockapi/TooManyDevicesMockApiTest.kt +++ b/android/test/mockapi/src/main/kotlin/net/mullvad/mullvadvpn/test/mockapi/TooManyDevicesMockApiTest.kt @@ -34,7 +34,7 @@ class TooManyDevicesMockApiTest : MockApiTest() { DUMMY_ID_2 to DUMMY_DEVICE_NAME_2, DUMMY_ID_3 to DUMMY_DEVICE_NAME_3, DUMMY_ID_4 to DUMMY_DEVICE_NAME_4, - DUMMY_ID_5 to DUMMY_DEVICE_NAME_5 + DUMMY_ID_5 to DUMMY_DEVICE_NAME_5, ) devicePendingToGetCreated = DUMMY_ID_6 to DUMMY_DEVICE_NAME_6 } diff --git a/android/test/mockapi/src/main/kotlin/net/mullvad/mullvadvpn/test/mockapi/constant/Constants.kt b/android/test/mockapi/src/main/kotlin/net/mullvad/mullvadvpn/test/mockapi/constant/Constants.kt index 27099cc67ad5..e11e14879e3c 100644 --- a/android/test/mockapi/src/main/kotlin/net/mullvad/mullvadvpn/test/mockapi/constant/Constants.kt +++ b/android/test/mockapi/src/main/kotlin/net/mullvad/mullvadvpn/test/mockapi/constant/Constants.kt @@ -31,5 +31,5 @@ val FULL_DEVICE_LIST = DUMMY_ID_2 to DUMMY_DEVICE_NAME_2, DUMMY_ID_3 to DUMMY_DEVICE_NAME_3, DUMMY_ID_4 to DUMMY_DEVICE_NAME_4, - DUMMY_ID_5 to DUMMY_DEVICE_NAME_5 + DUMMY_ID_5 to DUMMY_DEVICE_NAME_5, ) diff --git a/android/tile/src/main/kotlin/net/mullvad/mullvadvpn/tile/MullvadTileService.kt b/android/tile/src/main/kotlin/net/mullvad/mullvadvpn/tile/MullvadTileService.kt index aef6f3505e54..8e1d9e10ed6a 100644 --- a/android/tile/src/main/kotlin/net/mullvad/mullvadvpn/tile/MullvadTileService.kt +++ b/android/tile/src/main/kotlin/net/mullvad/mullvadvpn/tile/MullvadTileService.kt @@ -51,7 +51,7 @@ class MullvadTileService : TileService() { // Workaround for the reported bug: https://issuetracker.google.com/issues/236862865 suspend fun isUnlockStatusPropagatedWithinTimeout( unlockTimeoutMillis: Long, - unlockCheckDelayMillis: Long + unlockCheckDelayMillis: Long, ): Boolean { return withTimeoutOrNull(unlockTimeoutMillis) { while (isLocked) { @@ -66,7 +66,7 @@ class MullvadTileService : TileService() { val isUnlockStatusPropagated = isUnlockStatusPropagatedWithinTimeout( unlockTimeoutMillis = 1000L, - unlockCheckDelayMillis = 100L + unlockCheckDelayMillis = 100L, ) if (isUnlockStatusPropagated) { @@ -130,7 +130,7 @@ class MullvadTileService : TileService() { applicationContext, 0, intent, - SdkUtils.getSupportedPendingIntentFlags() + SdkUtils.getSupportedPendingIntentFlags(), ) startActivityAndCollapse(pendingIntent) } else { @@ -142,7 +142,7 @@ class MullvadTileService : TileService() { private suspend fun launchListenToTunnelState() { combine( connectionProxy.tunnelState.onStart { emit(TunnelState.Disconnected(null)) }, - managementService.connectionState + managementService.connectionState, ) { tunnelState, connectionState -> tunnelState to connectionState } @@ -153,7 +153,7 @@ class MullvadTileService : TileService() { private fun mapToTileState( tunnelState: TunnelState, - connectionState: GrpcConnectivityState + connectionState: GrpcConnectivityState, ): Int { return if (connectionState == GrpcConnectivityState.Ready) { when (tunnelState) { From 981e97d254e180362d9e9a6407708a333e5e4f44 Mon Sep 17 00:00:00 2001 From: Albin Date: Wed, 28 Aug 2024 21:06:00 +0200 Subject: [PATCH 4/4] Suppress long compose function lint warnings These functions are better refactored separately from the current work with reformatting the code. --- .../net/mullvad/mullvadvpn/compose/button/ConnectionButton.kt | 3 +-- .../mullvadvpn/compose/screen/ApiAccessMethodDetailsScreen.kt | 1 + .../mullvadvpn/compose/screen/EditApiAccessMethodScreen.kt | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/ConnectionButton.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/ConnectionButton.kt index 9494542ba621..1bb99571144e 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/ConnectionButton.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/button/ConnectionButton.kt @@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.CornerSize import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.FilledIconButton import androidx.compose.material3.Icon import androidx.compose.material3.IconButtonDefaults @@ -124,8 +123,8 @@ fun ConnectionButton( ) } -@OptIn(ExperimentalMaterial3Api::class) @Composable +@Suppress("LongMethod") private fun ConnectionButton( text: String, mainClick: () -> Unit, diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessMethodDetailsScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessMethodDetailsScreen.kt index 657deca9967d..f8265389c1a1 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessMethodDetailsScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessMethodDetailsScreen.kt @@ -82,6 +82,7 @@ data class ApiAccessMethodDetailsNavArgs(val accessMethodId: ApiAccessMethodId) navArgs = ApiAccessMethodDetailsNavArgs::class, ) @Composable +@Suppress("LongMethod") fun ApiAccessMethodDetails( navigator: DestinationsNavigator, confirmDeleteListResultRecipient: diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/EditApiAccessMethodScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/EditApiAccessMethodScreen.kt index 57220d999ece..8c6c59e59a42 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/EditApiAccessMethodScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/EditApiAccessMethodScreen.kt @@ -89,6 +89,7 @@ data class EditApiAccessMethodNavArgs(val accessMethodId: ApiAccessMethodId?) navArgs = EditApiAccessMethodNavArgs::class, ) @Composable +@Suppress("LongMethod") fun EditApiAccessMethod( navigator: DestinationsNavigator, backNavigator: ResultBackNavigator,