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 db241664d5dd..80b7d107b815 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 @@ -77,7 +77,8 @@ fun SplitTunnelingCell( .clickable(onClick = onCellClicked) ) { Image( - painter = icon?.let { iconImage -> BitmapPainter(iconImage) } + painter = + icon?.let { iconImage -> BitmapPainter(iconImage) } ?: painterResource(id = R.drawable.ic_icons_missing), contentDescription = null, modifier = 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 97602ed592ee..5bdb448483fc 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 @@ -100,8 +100,7 @@ fun LocationInfo( TransportProtocol.Udp -> stringResource(id = R.string.udp) } "${inAddress.first}:${inAddress.second} $protocol" - } - ?: "" + } ?: "" Text( text = "${stringResource(id = R.string.in_address)} $textInAddress", color = colorExpanded, 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 73bec5f14f1c..319cd9e9542d 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 @@ -315,8 +315,7 @@ fun MullvadTopBarWithDeviceName( text = deviceName?.let { stringResource(id = R.string.top_bar_device_name, deviceName) - } - ?: "", + } ?: "", maxLines = 1, overflow = TextOverflow.Ellipsis, style = MaterialTheme.typography.bodySmall, 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 96f2894a23f2..fa5ce34c775d 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 @@ -248,8 +248,7 @@ private fun DeviceListItem( text = deviceUiState.device.created.parseAsDateTime()?.let { creationDate -> stringResource(id = R.string.created_x, creationDate.formatDate()) - } - ?: "", + } ?: "", style = MaterialTheme.typography.listItemSubText, color = MaterialTheme.colorScheme.onPrimary diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayListExtensions.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayListExtensions.kt index 71d4701e41dc..6462ed9f4151 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayListExtensions.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/relaylist/RelayListExtensions.kt @@ -237,8 +237,7 @@ private fun List.expandItemForSelection( } } } - } - ?: this + } ?: this } private const val MIN_SEARCH_LENGTH = 2 diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/DeviceRepository.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/DeviceRepository.kt index 7df83816e28b..a13c3e9bc98b 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/DeviceRepository.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/repository/DeviceRepository.kt @@ -122,8 +122,7 @@ class DeviceRepository( withTimeoutOrNull(timeoutMillis) { deviceListEvents.onStart { refreshDeviceList(accountToken) }.firstOrNull() ?: DeviceListEvent.Error - } - ?: DeviceListEvent.Error + } ?: DeviceListEvent.Error if (shouldOverrideCache) { updateCache(result, accountToken) 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 ba7ce83172af..267a76f9961d 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 @@ -50,8 +50,7 @@ class OutOfTimeUseCase( private fun TunnelState.isTunnelErrorStateDueToExpiredAccount(): Boolean { return ((this as? TunnelState.Error)?.errorState?.cause as? ErrorStateCause.AuthFailed) - ?.isCausedByExpiredAccount() - ?: false + ?.isCausedByExpiredAccount() ?: false } private fun pastAccountExpiry(): Flow = 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 69a75bea7f25..9b5a6c1e0013 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 @@ -94,10 +94,10 @@ class ConnectViewModel( ConnectUiState( location = when (tunnelRealState) { - is TunnelState.Disconnected -> tunnelRealState.location() - ?: lastKnownDisconnectedLocation - is TunnelState.Connecting -> tunnelRealState.location - ?: relayLocation?.location?.location + is TunnelState.Disconnected -> + tunnelRealState.location() ?: lastKnownDisconnectedLocation + is TunnelState.Connecting -> + tunnelRealState.location ?: relayLocation?.location?.location is TunnelState.Connected -> tunnelRealState.location is TunnelState.Disconnecting -> lastKnownDisconnectedLocation is TunnelState.Error -> null 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 fed739905080..5027d1cf13d3 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 @@ -38,8 +38,7 @@ class DeviceRevokedViewModel( } else { DeviceRevokedUiState.UNSECURED } - } - ?: flowOf(DeviceRevokedUiState.UNKNOWN) + } ?: flowOf(DeviceRevokedUiState.UNKNOWN) } .stateIn( scope = CoroutineScope(dispatcher), 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 bd0703e6ae6f..4a9fb709fde1 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 @@ -39,8 +39,7 @@ class FilterViewModel( ) { allProviders, selectedConstraintProviders -> selectedConstraintProviders.toSelectedProviders(allProviders) } - .first() - ?: emptyList() + .first() ?: emptyList() val ownershipConstraint = relayListFilterUseCase.selectedOwnership().first() selectedOwnership.value = ownershipConstraint.toNullableOwnership() 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 7e258869fabe..05bc6fb0720a 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 @@ -23,7 +23,6 @@ data class SplitTunnelingViewModelState( .sortedBy { it.name }, showSystemApps = showSystemApps ) - } - ?: SplitTunnelingUiState.Loading + } ?: SplitTunnelingUiState.Loading } } 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 80b51a811c31..7a7332eb2a2f 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 @@ -67,10 +67,10 @@ class VpnSettingsViewModel( isLocalNetworkSharingEnabled = settings?.allowLan ?: false, isCustomDnsEnabled = settings?.isCustomDnsEnabled() ?: false, customDnsList = settings?.addresses()?.asStringAddressList() ?: listOf(), - contentBlockersOptions = settings?.contentBlockersSettings() - ?: DefaultDnsOptions(), - selectedObfuscation = settings?.selectedObfuscationSettings() - ?: SelectedObfuscation.Off, + contentBlockersOptions = + settings?.contentBlockersSettings() ?: DefaultDnsOptions(), + selectedObfuscation = + settings?.selectedObfuscationSettings() ?: SelectedObfuscation.Off, quantumResistant = settings?.quantumResistant() ?: QuantumResistantState.Off, selectedWireguardPort = settings?.getWireguardPort() ?: Constraint.Any(), customWireguardPort = customWgPort, diff --git a/android/buildSrc/src/main/kotlin/Versions.kt b/android/buildSrc/src/main/kotlin/Versions.kt index c8502b4c16dc..7a4c63a4d287 100644 --- a/android/buildSrc/src/main/kotlin/Versions.kt +++ b/android/buildSrc/src/main/kotlin/Versions.kt @@ -52,7 +52,7 @@ object Versions { const val dependencyCheck = "8.3.1" const val gradleVersions = "0.47.0" const val junit5 = "1.10.0.0" - const val ktfmt = "0.13.0" + const val ktfmt = "0.16.0" // Ksp version is linked with kotlin version, find matching release here: // https://github.com/google/ksp/releases const val ksp = "${kotlin}-1.0.14" diff --git a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/AccountCache.kt b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/AccountCache.kt index 64459dbfb985..093f13403d27 100644 --- a/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/AccountCache.kt +++ b/android/service/src/main/kotlin/net/mullvad/mullvadvpn/service/endpoint/AccountCache.kt @@ -44,8 +44,7 @@ class AccountCache(private val endpoint: ServiceEndpoint) { deviceState .token() .also { cachedAccountToken = it } - ?.let { fetchAccountExpiry(it) } - ?: AccountExpiry.Missing + ?.let { fetchAccountExpiry(it) } ?: AccountExpiry.Missing } } 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 821a95f68a67..39818d195ca1 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 @@ -103,8 +103,7 @@ class MockApiDispatcher : Dispatcher() { .setResponseCode(200) .addJsonHeader() .setBody(accountInfoJson(id = DUMMY_ID_1, expiry = expiry).toString()) - } - ?: MockResponse().setResponseCode(400) + } ?: MockResponse().setResponseCode(400) } private fun handleDeviceInfoRequest(deviceId: String): MockResponse { @@ -121,8 +120,7 @@ class MockApiDispatcher : Dispatcher() { ) .toString() ) - } - ?: MockResponse().setResponseCode(400) + } ?: MockResponse().setResponseCode(400) } private fun handleDeviceCreationRequest(body: Buffer): MockResponse { @@ -149,8 +147,7 @@ class MockApiDispatcher : Dispatcher() { .addJsonHeader() .setBody(tooManyDevicesJsonResponse().toString()) } - } - ?: MockResponse().setResponseCode(400) + } ?: MockResponse().setResponseCode(400) } private fun handleDeviceListRequest(): MockResponse { @@ -167,8 +164,7 @@ class MockApiDispatcher : Dispatcher() { ) } MockResponse().setResponseCode(200).addJsonHeader().setBody(body.toString()) - } - ?: MockResponse().setResponseCode(400) + } ?: MockResponse().setResponseCode(400) } private fun handleAccountCreationRequest(): MockResponse { @@ -184,7 +180,6 @@ class MockApiDispatcher : Dispatcher() { ) .toString() ) - } - ?: MockResponse().setResponseCode(400) + } ?: MockResponse().setResponseCode(400) } } 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 d8b1c85a6bf4..ae80bedef8cf 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,8 +51,7 @@ class MullvadTileService : TileService() { delay(unlockCheckDelayMillis) } return@withTimeoutOrNull true - } - ?: false + } ?: false } unlockAndRun {