Skip to content

Commit

Permalink
Migrate all navigation to compose navigation
Browse files Browse the repository at this point in the history
Remove old fragments

Improve animations between destinations

Fix glitch in animation

Temporary fix for pending intent flags

Fix status bar colors

Fix transition for welcome screen

Fix bug caused by triggering navigation too fast

Fix accidentally not starting service

Handle Change log

Fix screen rotation

Make settings use scaffold snackbar instead

Migrate info dialogs to destinations

Fix formatting

Fix some failed tests

Remove unused function

Refactor out MTU dialog

Migrate DnsDialog

Fix Devicelist confirmation dialog

Migrate ReportProblemNoEmail dialog

Migrate custom WG port to dialog

Fix voucher dialog and out of time navigation from connect

Fix tests

Update gradle lockfile

Disable settings button while logging in

Add nav graph

Fix out of time navigation, transitions and multiple navigation calls.

Fix xml formatting

Fix test

Add CVE supression

Clean up build config

Remove duplicate deps

Fix test
  • Loading branch information
Rawa committed Nov 20, 2023
1 parent 89420ba commit 19f4c3f
Show file tree
Hide file tree
Showing 129 changed files with 2,912 additions and 3,016 deletions.
7 changes: 5 additions & 2 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ plugins {
id(Dependencies.Plugin.playPublisherId)
id(Dependencies.Plugin.kotlinAndroidId)
id(Dependencies.Plugin.kotlinParcelizeId)
id(Dependencies.Plugin.ksp) version Versions.Plugin.ksp
}

val repoRootPath = rootProject.projectDir.absoluteFile.parentFile.absolutePath
Expand Down Expand Up @@ -181,8 +182,7 @@ android {

val enableInAppVersionNotifications =
gradleLocalProperties(rootProject.projectDir)
.getProperty("ENABLE_IN_APP_VERSION_NOTIFICATIONS")
?: "true"
.getProperty("ENABLE_IN_APP_VERSION_NOTIFICATIONS") ?: "true"

buildConfigField(
"boolean",
Expand Down Expand Up @@ -337,6 +337,9 @@ dependencies {
implementation(Dependencies.Compose.uiController)
implementation(Dependencies.Compose.ui)
implementation(Dependencies.Compose.uiUtil)
implementation(Dependencies.Compose.destinations)
ksp(Dependencies.Compose.destinationsKsp)

implementation(Dependencies.jodaTime)
implementation(Dependencies.Koin.core)
implementation(Dependencies.Koin.android)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,13 @@ class AccountScreenTest {
// Arrange
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState(
deviceName = DUMMY_DEVICE_NAME,
accountNumber = DUMMY_ACCOUNT_NUMBER,
accountExpiry = null
),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow()
)
}

Expand All @@ -66,15 +64,13 @@ class AccountScreenTest {
val mockedClickHandler: () -> Unit = mockk(relaxed = true)
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState(
deviceName = DUMMY_DEVICE_NAME,
accountNumber = DUMMY_ACCOUNT_NUMBER,
accountExpiry = null
),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow(),
onManageAccountClick = mockedClickHandler
)
}
Expand All @@ -92,15 +88,13 @@ class AccountScreenTest {
val mockedClickHandler: () -> Unit = mockk(relaxed = true)
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState(
deviceName = DUMMY_DEVICE_NAME,
accountNumber = DUMMY_ACCOUNT_NUMBER,
accountExpiry = null
),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow(),
onRedeemVoucherClick = mockedClickHandler
)
}
Expand All @@ -118,15 +112,13 @@ class AccountScreenTest {
val mockedClickHandler: () -> Unit = mockk(relaxed = true)
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState(
deviceName = DUMMY_DEVICE_NAME,
accountNumber = DUMMY_ACCOUNT_NUMBER,
accountExpiry = null
),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow(),
onLogoutClick = mockedClickHandler
)
}
Expand All @@ -143,15 +135,13 @@ class AccountScreenTest {
// Arrange
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState.default()
.copy(
paymentDialogData =
PurchaseResult.Completed.Success.toPaymentDialogData()
),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow()
)
}

Expand All @@ -164,15 +154,13 @@ class AccountScreenTest {
// Arrange
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState.default()
.copy(
paymentDialogData =
PurchaseResult.Error.VerificationError(null).toPaymentDialogData()
),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow()
)
}

Expand All @@ -185,7 +173,6 @@ class AccountScreenTest {
// Arrange
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState.default()
.copy(
Expand All @@ -194,7 +181,6 @@ class AccountScreenTest {
.toPaymentDialogData()
),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow()
)
}

Expand All @@ -207,11 +193,9 @@ class AccountScreenTest {
// Arrange
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState.default().copy(billingPaymentState = PaymentState.Error.Billing),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow()
)
}

Expand All @@ -227,15 +211,13 @@ class AccountScreenTest {
every { mockPaymentProduct.status } returns null
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState.default()
.copy(
billingPaymentState =
PaymentState.PaymentAvailable(listOf(mockPaymentProduct))
),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow()
)
}

Expand All @@ -251,15 +233,13 @@ class AccountScreenTest {
every { mockPaymentProduct.status } returns PaymentStatus.PENDING
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState.default()
.copy(
billingPaymentState =
PaymentState.PaymentAvailable(listOf(mockPaymentProduct))
),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow()
)
}

Expand All @@ -275,15 +255,13 @@ class AccountScreenTest {
every { mockPaymentProduct.status } returns PaymentStatus.PENDING
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState.default()
.copy(
billingPaymentState =
PaymentState.PaymentAvailable(listOf(mockPaymentProduct))
),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow()
)
}

Expand All @@ -306,15 +284,13 @@ class AccountScreenTest {
every { mockPaymentProduct.status } returns PaymentStatus.VERIFICATION_IN_PROGRESS
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState.default()
.copy(
billingPaymentState =
PaymentState.PaymentAvailable(listOf(mockPaymentProduct))
),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow()
)
}

Expand All @@ -332,7 +308,6 @@ class AccountScreenTest {
every { mockPaymentProduct.status } returns null
composeTestRule.setContentWithTheme {
AccountScreen(
showSitePayment = true,
uiState =
AccountUiState.default()
.copy(
Expand All @@ -341,7 +316,6 @@ class AccountScreenTest {
),
onPurchaseBillingProductClick = clickHandler,
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow()
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import io.mockk.every
import io.mockk.impl.annotations.MockK
import io.mockk.just
import io.mockk.verify
import kotlinx.coroutines.flow.MutableStateFlow
import net.mullvad.mullvadvpn.compose.dialog.ChangelogDialog
import net.mullvad.mullvadvpn.compose.setContentWithTheme
import net.mullvad.mullvadvpn.viewmodel.ChangelogDialogUiState
import net.mullvad.mullvadvpn.viewmodel.ChangeLog
import net.mullvad.mullvadvpn.viewmodel.ChangelogViewModel
import org.junit.Before
import org.junit.Rule
Expand All @@ -31,15 +30,15 @@ class ChangelogDialogTest {
@Test
fun testShowChangeLogWhenNeeded() {
// Arrange
every { mockedViewModel.uiState } returns
MutableStateFlow(ChangelogDialogUiState.Show(listOf(CHANGELOG_ITEM)))
every { mockedViewModel.dismissChangelogDialog() } just Runs
every { mockedViewModel.markChangeLogAsRead() } just Runs

composeTestRule.setContentWithTheme {
ChangelogDialog(
changesList = listOf(CHANGELOG_ITEM),
version = CHANGELOG_VERSION,
onDismiss = { mockedViewModel.dismissChangelogDialog() }
ChangeLog(
changes = listOf(CHANGELOG_ITEM),
version = CHANGELOG_VERSION,
),
onDismiss = { mockedViewModel.markChangeLogAsRead() }
)
}

Expand All @@ -50,7 +49,7 @@ class ChangelogDialogTest {
composeTestRule.onNodeWithText(CHANGELOG_BUTTON_TEXT).performClick()

// Assert
verify { mockedViewModel.dismissChangelogDialog() }
verify { mockedViewModel.markChangeLogAsRead() }
}

companion object {
Expand Down
Loading

0 comments on commit 19f4c3f

Please sign in to comment.