Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawa committed Nov 10, 2023
1 parent 9d72e87 commit 10849b5
Show file tree
Hide file tree
Showing 26 changed files with 31 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import com.ramcosta.composedestinations.spec.DestinationStyle
import net.mullvad.mullvadvpn.R
import net.mullvad.mullvadvpn.compose.component.textResource

@Destination(
style = DestinationStyle.Dialog::class
)
@Destination(style = DestinationStyle.Dialog::class)
@Composable
fun ContentBlockersInfoDialog(navigator: DestinationsNavigator) {
InfoDialog(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ private fun PreviewCustomDnsInfoDialog() {
CustomDnsInfoDialog(EmptyDestinationsNavigator)
}

@Destination(
style = DestinationStyle.Dialog::class
)
@Destination(style = DestinationStyle.Dialog::class)
@Composable
fun CustomDnsInfoDialog(navigator: DestinationsNavigator) {
InfoDialog(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ private fun PreviewCustomPortDialog() {
}
}

@Destination(
style = DestinationStyle.Dialog::class
)
@Destination(style = DestinationStyle.Dialog::class)
@Composable
fun CustomPortDialog(
customPort: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import com.ramcosta.composedestinations.navigation.DestinationsNavigator
import com.ramcosta.composedestinations.spec.DestinationStyle
import net.mullvad.mullvadvpn.R

@Destination(
style = DestinationStyle.Dialog::class
)
@Destination(style = DestinationStyle.Dialog::class)
@Composable
fun DeviceNameInfoDialog(navigator: DestinationsNavigator) {
InfoDialog(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ private fun PreviewShowDeviceRemovalDialog() {
)
}

@Destination(
style = DestinationStyle.Dialog::class
)
@Destination(style = DestinationStyle.Dialog::class)
@Composable
fun ShowDeviceRemovalDialog(onDismiss: () -> Unit, onConfirm: () -> Unit, device: Device) {
AlertDialog(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ private fun PreviewDnsDialogEditAllowLanDisabled() {
}
}

@Destination(
style = DestinationStyle.Dialog::class
)
@Destination(style = DestinationStyle.Dialog::class)
@Composable
fun DnsDialog(
stagedDns: StagedDns,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ private fun PreviewLocalNetworkSharingInfoDialog() {
LocalNetworkSharingInfoDialog(EmptyDestinationsNavigator)
}

@Destination(
style = DestinationStyle.Dialog::class
)
@Destination(style = DestinationStyle.Dialog::class)
@Composable
fun LocalNetworkSharingInfoDialog(navigator: DestinationsNavigator) {
InfoDialog(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ private fun PreviewMtuDialog() {
}
}

@Destination(
style = DestinationStyle.Dialog::class
)
@Destination(style = DestinationStyle.Dialog::class)
@Composable
fun MtuDialog(
mtuInitial: Int?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ private fun PreviewObfuscationInfoDialog() {
ObfuscationInfoDialog(EmptyDestinationsNavigator)
}

@Destination(
style = DestinationStyle.Dialog::class
)
@Destination(style = DestinationStyle.Dialog::class)
@Composable
fun ObfuscationInfoDialog(navigator: DestinationsNavigator) {
InfoDialog(message = stringResource(id = R.string.obfuscation_info), onDismiss = navigator::navigateUp)
InfoDialog(
message = stringResource(id = R.string.obfuscation_info),
onDismiss = navigator::navigateUp
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ private fun PreviewQuantumResistanceInfoDialog() {
QuantumResistanceInfoDialog(EmptyDestinationsNavigator)
}

@Destination(
style = DestinationStyle.Dialog::class
)
@Destination(style = DestinationStyle.Dialog::class)
@Composable
fun QuantumResistanceInfoDialog(navigator: DestinationsNavigator) {
InfoDialog(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ private fun PreviewRedeemVoucherDialogSuccess() {
}
}

@Destination(
style = DestinationStyle.Dialog::class
)
@Destination(style = DestinationStyle.Dialog::class)
@Composable
fun RedeemVoucherDialog(
uiState: VoucherDialogUiState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ private fun PreviewReportProblemNoEmailDialog() {
}
}

@Destination(
style = DestinationStyle.Dialog::class
)
@Destination(style = DestinationStyle.Dialog::class)
@Composable
fun ReportProblemNoEmailDialog(onDismiss: () -> Unit, onConfirm: () -> Unit) {
AlertDialog(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ import net.mullvad.mullvadvpn.compose.button.PrimaryButton
import net.mullvad.mullvadvpn.compose.button.VariantButton
import net.mullvad.mullvadvpn.compose.component.ListItem
import net.mullvad.mullvadvpn.compose.component.ScaffoldWithTopBar
import net.mullvad.mullvadvpn.compose.dialog.ShowDeviceRemovalDialog
import net.mullvad.mullvadvpn.compose.destinations.LoginDestination
import net.mullvad.mullvadvpn.compose.destinations.SettingsDestination
import net.mullvad.mullvadvpn.compose.dialog.ShowDeviceRemovalDialog
import net.mullvad.mullvadvpn.compose.state.DeviceListItemUiState
import net.mullvad.mullvadvpn.compose.state.DeviceListUiState
import net.mullvad.mullvadvpn.lib.common.util.parseAsDateTime
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.mullvad.mullvadvpn.compose.screen

import android.util.Log
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import kotlinx.coroutines.flow.map
import net.mullvad.mullvadvpn.compose.NavGraphs
import net.mullvad.mullvadvpn.compose.destinations.ChangelogDestination
import net.mullvad.mullvadvpn.compose.destinations.ConnectDestination
import net.mullvad.mullvadvpn.compose.destinations.LoginDestination
import net.mullvad.mullvadvpn.compose.destinations.OutOfTimeDestination
import net.mullvad.mullvadvpn.viewmodel.ChangelogViewModel
import org.koin.androidx.compose.koinViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ import net.mullvad.mullvadvpn.compose.button.RedeemVoucherButton
import net.mullvad.mullvadvpn.compose.button.SitePaymentButton
import net.mullvad.mullvadvpn.compose.component.ScaffoldWithTopBarAndDeviceName
import net.mullvad.mullvadvpn.compose.component.drawVerticalScrollbar
import net.mullvad.mullvadvpn.compose.extensions.createOpenAccountPageHook
import net.mullvad.mullvadvpn.compose.destinations.AccountDestination
import net.mullvad.mullvadvpn.compose.destinations.ConnectDestination
import net.mullvad.mullvadvpn.compose.destinations.RedeemVoucherDestination
import net.mullvad.mullvadvpn.compose.destinations.SettingsDestination
import net.mullvad.mullvadvpn.compose.extensions.createOpenAccountPageHook
import net.mullvad.mullvadvpn.compose.state.OutOfTimeUiState
import net.mullvad.mullvadvpn.constant.IS_PLAY_BUILD
import net.mullvad.mullvadvpn.lib.theme.AppTheme
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import com.ramcosta.composedestinations.navigation.DestinationsNavigator
import com.ramcosta.composedestinations.navigation.popUpTo
import com.ramcosta.composedestinations.spec.DestinationStyle
import net.mullvad.mullvadvpn.compose.NavGraphs
import net.mullvad.mullvadvpn.compose.dialog.RedeemVoucherDialog
import net.mullvad.mullvadvpn.compose.destinations.ConnectDestination
import net.mullvad.mullvadvpn.compose.dialog.RedeemVoucherDialog
import net.mullvad.mullvadvpn.compose.state.VoucherDialogUiState
import net.mullvad.mullvadvpn.lib.theme.AppTheme
import net.mullvad.mullvadvpn.viewmodel.VoucherDialogViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ import net.mullvad.mullvadvpn.compose.button.VariantButton
import net.mullvad.mullvadvpn.compose.component.MullvadCircularProgressIndicatorLarge
import net.mullvad.mullvadvpn.compose.component.NavigateBackIconButton
import net.mullvad.mullvadvpn.compose.component.ScaffoldWithMediumTopBar
import net.mullvad.mullvadvpn.compose.dialog.ReportProblemNoEmailDialog
import net.mullvad.mullvadvpn.compose.destinations.ViewLogsDestination
import net.mullvad.mullvadvpn.compose.dialog.ReportProblemNoEmailDialog
import net.mullvad.mullvadvpn.compose.textfield.mullvadWhiteTextFieldColors
import net.mullvad.mullvadvpn.compose.transitions.SlideInFromRightTransition
import net.mullvad.mullvadvpn.dataproxy.SendProblemReportResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import net.mullvad.mullvadvpn.compose.cell.NavigationCellBody
import net.mullvad.mullvadvpn.compose.cell.NavigationComposeCell
import net.mullvad.mullvadvpn.compose.component.NavigateBackDownIconButton
import net.mullvad.mullvadvpn.compose.component.ScaffoldWithMediumTopBar
import net.mullvad.mullvadvpn.compose.extensions.itemWithDivider
import net.mullvad.mullvadvpn.compose.destinations.ReportProblemDestination
import net.mullvad.mullvadvpn.compose.destinations.SplitTunnelingDestination
import net.mullvad.mullvadvpn.compose.destinations.VpnSettingsDestination
import net.mullvad.mullvadvpn.compose.extensions.itemWithDivider
import net.mullvad.mullvadvpn.compose.state.SettingsUiState
import net.mullvad.mullvadvpn.compose.test.LAZY_LIST_TEST_TAG
import net.mullvad.mullvadvpn.compose.transitions.SettingsTransition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ fun Welcome(navigator: DestinationsNavigator) {
openConnectScreen = {
navigator.navigate(ConnectDestination) { popUpTo(NavGraphs.root) { inclusive = true } }
},
navigateToDeviceInfoDialog = {
navigator.navigate(DeviceNameInfoDialogDestination)
}
navigateToDeviceInfoDialog = { navigator.navigate(DeviceNameInfoDialogDestination) }
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ interface VpnSettingsDialog {

data class Dns(val stagedDns: StagedDns) : VpnSettingsDialog


data class WireguardPortInfo(val availablePortRanges: List<PortRange> = emptyList()) :
VpnSettingsDialog

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ open class MainActivity : ComponentActivity() {
serviceConnectionManager.onVpnPermissionResult(resultCode == Activity.RESULT_OK)
}


override fun onStart() {
super.onStart()

if (privacyDisclaimerRepository.hasAcceptedPrivacyDisclosure()) {
initializeStateHandlerAndServiceConnection()
}
}

override fun onStop() {
Log.d("mullvad", "Stopping main activity")
super.onStop()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package net.mullvad.mullvadvpn.viewmodel
import android.util.Log
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import androidx.lifecycle.viewmodel.compose.viewModel
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.flow.filterNotNull
Expand Down Expand Up @@ -32,6 +31,7 @@ class SplashViewModel(
}
}
}

private suspend fun getStartDestination(): SplashUiSideEffect =
deviceRepository.deviceState
.map { deviceState ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ class VpnSettingsViewModel(
isLocalNetworkSharingEnabled = settings?.allowLan ?: false,
isCustomDnsEnabled = settings?.isCustomDnsEnabled() ?: false,
customDnsList = settings?.addresses()?.asStringAddressList() ?: listOf(),
contentBlockersOptions =
settings?.contentBlockersSettings() ?: DefaultDnsOptions(),
contentBlockersOptions = settings?.contentBlockersSettings()
?: DefaultDnsOptions(),
isAllowLanEnabled = settings?.allowLan ?: false,
selectedObfuscation =
settings?.selectedObfuscationSettings() ?: SelectedObfuscation.Off,
selectedObfuscation = settings?.selectedObfuscationSettings()
?: SelectedObfuscation.Off,
dialogState = dialogState,
quantumResistant = settings?.quantumResistant() ?: QuantumResistantState.Off,
selectedWireguardPort = settings?.getWireguardPort() ?: Constraint.Any(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
package net.mullvad.mullvadvpn.viewmodel

import app.cash.turbine.test
import io.mockk.MockKAnnotations
import io.mockk.Runs
import io.mockk.every
import io.mockk.impl.annotations.MockK
import io.mockk.just
import io.mockk.mockkStatic
import io.mockk.unmockkAll
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlin.test.assertNull
import kotlinx.coroutines.test.runTest
import net.mullvad.mullvadvpn.repository.ChangelogRepository
import org.junit.After
import org.junit.Before
import org.junit.Test
import kotlin.test.assertNotNull

class ChangelogViewModelTest {

Expand Down Expand Up @@ -52,20 +50,17 @@ class ChangelogViewModelTest {
@Test
fun testNotUpToDateVersionCode() = runTest {
// Arrange
every { mockedChangelogRepository.getVersionCodeOfMostRecentChangelogShowed() } returns
-1
every { mockedChangelogRepository.getVersionCodeOfMostRecentChangelogShowed() } returns -1
every { mockedChangelogRepository.getLastVersionChanges() } returns listOf("bla", "bla")

// Given a new version with a change log we should return it
assertNotNull(viewModel.getChangeLog())
}


@Test
fun testNotUpToDateVersionCodeWithEmptyChangeLog() = runTest {
// Arrange
every { mockedChangelogRepository.getVersionCodeOfMostRecentChangelogShowed() } returns
-1
every { mockedChangelogRepository.getVersionCodeOfMostRecentChangelogShowed() } returns -1
every { mockedChangelogRepository.getLastVersionChanges() } returns emptyList()

// Given a new version with a change log we should not return it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.os.Build
import android.service.quicksettings.Tile
import android.widget.Toast

object SdkUtils {
// TODO Rework how pending intents work
Expand Down

0 comments on commit 10849b5

Please sign in to comment.