Skip to content

Commit

Permalink
Update ktfmt to version 0.16.0 and reformat files
Browse files Browse the repository at this point in the history
  • Loading branch information
Pururun committed Jan 25, 2024
1 parent c52c2af commit 6d1737d
Show file tree
Hide file tree
Showing 16 changed files with 27 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,7 @@ private fun List<RelayCountry>.expandItemForSelection(
}
}
}
}
?: this
} ?: this
}

private const val MIN_SEARCH_LENGTH = 2
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ class DeviceRepository(
withTimeoutOrNull(timeoutMillis) {
deviceListEvents.onStart { refreshDeviceList(accountToken) }.firstOrNull()
?: DeviceListEvent.Error
}
?: DeviceListEvent.Error
} ?: DeviceListEvent.Error

if (shouldOverrideCache) {
updateCache(result, accountToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Boolean?> =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ class DeviceRevokedViewModel(
} else {
DeviceRevokedUiState.UNSECURED
}
}
?: flowOf(DeviceRevokedUiState.UNKNOWN)
} ?: flowOf(DeviceRevokedUiState.UNKNOWN)
}
.stateIn(
scope = CoroutineScope(dispatcher),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ class FilterViewModel(
) { allProviders, selectedConstraintProviders ->
selectedConstraintProviders.toSelectedProviders(allProviders)
}
.first()
?: emptyList()
.first() ?: emptyList()

val ownershipConstraint = relayListFilterUseCase.selectedOwnership().first()
selectedOwnership.value = ownershipConstraint.toNullableOwnership()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ data class SplitTunnelingViewModelState(
.sortedBy { it.name },
showSystemApps = showSystemApps
)
}
?: SplitTunnelingUiState.Loading
} ?: SplitTunnelingUiState.Loading
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion android/buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -121,8 +120,7 @@ class MockApiDispatcher : Dispatcher() {
)
.toString()
)
}
?: MockResponse().setResponseCode(400)
} ?: MockResponse().setResponseCode(400)
}

private fun handleDeviceCreationRequest(body: Buffer): MockResponse {
Expand All @@ -149,8 +147,7 @@ class MockApiDispatcher : Dispatcher() {
.addJsonHeader()
.setBody(tooManyDevicesJsonResponse().toString())
}
}
?: MockResponse().setResponseCode(400)
} ?: MockResponse().setResponseCode(400)
}

private fun handleDeviceListRequest(): MockResponse {
Expand All @@ -167,8 +164,7 @@ class MockApiDispatcher : Dispatcher() {
)
}
MockResponse().setResponseCode(200).addJsonHeader().setBody(body.toString())
}
?: MockResponse().setResponseCode(400)
} ?: MockResponse().setResponseCode(400)
}

private fun handleAccountCreationRequest(): MockResponse {
Expand All @@ -184,7 +180,6 @@ class MockApiDispatcher : Dispatcher() {
)
.toString()
)
}
?: MockResponse().setResponseCode(400)
} ?: MockResponse().setResponseCode(400)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ class MullvadTileService : TileService() {
delay(unlockCheckDelayMillis)
}
return@withTimeoutOrNull true
}
?: false
} ?: false
}

unlockAndRun {
Expand Down

0 comments on commit 6d1737d

Please sign in to comment.