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.
  • Loading branch information
Rawa committed Nov 17, 2023
1 parent 0a82036 commit 512a6d9
Show file tree
Hide file tree
Showing 123 changed files with 2,775 additions and 2,972 deletions.
6 changes: 4 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,8 @@ dependencies {
implementation(Dependencies.Compose.uiController)
implementation(Dependencies.Compose.ui)
implementation(Dependencies.Compose.uiUtil)
implementation(Dependencies.Compose.destinations)
ksp("io.github.raamcosta.compose-destinations:ksp:1.9.54")
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 @@ -49,7 +49,6 @@ class AccountScreenTest {
accountExpiry = null
),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow()
)
}

Expand All @@ -74,7 +73,6 @@ class AccountScreenTest {
accountExpiry = null
),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow(),
onManageAccountClick = mockedClickHandler
)
}
Expand All @@ -100,7 +98,6 @@ class AccountScreenTest {
accountExpiry = null
),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow(),
onRedeemVoucherClick = mockedClickHandler
)
}
Expand All @@ -126,7 +123,6 @@ class AccountScreenTest {
accountExpiry = null
),
uiSideEffect = MutableSharedFlow<AccountViewModel.UiSideEffect>().asSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow(),
onLogoutClick = mockedClickHandler
)
}
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import io.mockk.every
import io.mockk.mockk
import io.mockk.unmockkAll
import io.mockk.verify
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asSharedFlow
import net.mullvad.mullvadvpn.compose.setContentWithTheme
import net.mullvad.mullvadvpn.compose.state.ConnectUiState
import net.mullvad.mullvadvpn.compose.test.CIRCULAR_PROGRESS_INDICATOR
Expand All @@ -26,7 +23,6 @@ import net.mullvad.mullvadvpn.model.TunnelState
import net.mullvad.mullvadvpn.relaylist.RelayItem
import net.mullvad.mullvadvpn.repository.InAppNotification
import net.mullvad.mullvadvpn.ui.VersionInfo
import net.mullvad.mullvadvpn.viewmodel.ConnectViewModel
import net.mullvad.talpid.net.TransportProtocol
import net.mullvad.talpid.net.TunnelEndpoint
import net.mullvad.talpid.tunnel.ActionAfterDisconnect
Expand Down Expand Up @@ -57,7 +53,6 @@ class ConnectScreenTest {
composeTestRule.setContentWithTheme {
ConnectScreen(
uiState = ConnectUiState.INITIAL,
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
}

Expand Down Expand Up @@ -88,7 +83,6 @@ class ConnectScreenTest {
daysLeftUntilExpiry = null,
inAppNotification = InAppNotification.TunnelStateBlocked
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
}

Expand Down Expand Up @@ -124,7 +118,6 @@ class ConnectScreenTest {
daysLeftUntilExpiry = null,
inAppNotification = InAppNotification.TunnelStateBlocked
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
}

Expand Down Expand Up @@ -158,7 +151,6 @@ class ConnectScreenTest {
daysLeftUntilExpiry = null,
inAppNotification = null
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
}

Expand Down Expand Up @@ -191,7 +183,6 @@ class ConnectScreenTest {
daysLeftUntilExpiry = null,
inAppNotification = null
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
}

Expand Down Expand Up @@ -225,7 +216,6 @@ class ConnectScreenTest {
daysLeftUntilExpiry = null,
inAppNotification = null
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
}

Expand Down Expand Up @@ -259,7 +249,6 @@ class ConnectScreenTest {
daysLeftUntilExpiry = null,
inAppNotification = null
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
}

Expand Down Expand Up @@ -298,7 +287,6 @@ class ConnectScreenTest {
ErrorState(ErrorStateCause.StartTunnelError, true)
)
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
}

Expand Down Expand Up @@ -338,7 +326,6 @@ class ConnectScreenTest {
ErrorState(ErrorStateCause.StartTunnelError, false)
)
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
}

Expand Down Expand Up @@ -372,7 +359,6 @@ class ConnectScreenTest {
daysLeftUntilExpiry = null,
inAppNotification = InAppNotification.TunnelStateBlocked
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
}

Expand Down Expand Up @@ -408,7 +394,6 @@ class ConnectScreenTest {
daysLeftUntilExpiry = null,
inAppNotification = InAppNotification.TunnelStateBlocked
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
}

Expand Down Expand Up @@ -444,7 +429,6 @@ class ConnectScreenTest {
daysLeftUntilExpiry = null,
inAppNotification = null
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow(),
onSwitchLocationClick = mockedClickHandler
)
}
Expand Down Expand Up @@ -477,7 +461,6 @@ class ConnectScreenTest {
daysLeftUntilExpiry = null,
inAppNotification = null
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow(),
onDisconnectClick = mockedClickHandler
)
}
Expand Down Expand Up @@ -510,7 +493,6 @@ class ConnectScreenTest {
daysLeftUntilExpiry = null,
inAppNotification = null
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow(),
onReconnectClick = mockedClickHandler
)
}
Expand Down Expand Up @@ -542,7 +524,6 @@ class ConnectScreenTest {
daysLeftUntilExpiry = null,
inAppNotification = null
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow(),
onConnectClick = mockedClickHandler
)
}
Expand Down Expand Up @@ -574,7 +555,6 @@ class ConnectScreenTest {
daysLeftUntilExpiry = null,
inAppNotification = null
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow(),
onCancelClick = mockedClickHandler
)
}
Expand Down Expand Up @@ -607,7 +587,6 @@ class ConnectScreenTest {
daysLeftUntilExpiry = null,
inAppNotification = null
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow(),
onToggleTunnelInfo = mockedClickHandler
)
}
Expand Down Expand Up @@ -647,7 +626,6 @@ class ConnectScreenTest {
daysLeftUntilExpiry = null,
inAppNotification = null
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
}

Expand Down Expand Up @@ -686,7 +664,6 @@ class ConnectScreenTest {
daysLeftUntilExpiry = null,
inAppNotification = InAppNotification.UpdateAvailable(versionInfo)
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
}

Expand Down Expand Up @@ -723,7 +700,6 @@ class ConnectScreenTest {
daysLeftUntilExpiry = null,
inAppNotification = InAppNotification.UnsupportedVersion(versionInfo)
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
}

Expand Down Expand Up @@ -757,7 +733,6 @@ class ConnectScreenTest {
daysLeftUntilExpiry = null,
inAppNotification = InAppNotification.AccountExpiry(expiryDate)
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
}

Expand Down Expand Up @@ -796,7 +771,6 @@ class ConnectScreenTest {
daysLeftUntilExpiry = null,
inAppNotification = InAppNotification.UnsupportedVersion(versionInfo)
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
}

Expand Down Expand Up @@ -829,7 +803,6 @@ class ConnectScreenTest {
daysLeftUntilExpiry = null,
inAppNotification = InAppNotification.AccountExpiry(expiryDate)
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
}

Expand All @@ -846,10 +819,6 @@ class ConnectScreenTest {
composeTestRule.setContentWithTheme {
ConnectScreen(
uiState = ConnectUiState.INITIAL,
uiSideEffect =
MutableStateFlow(
ConnectViewModel.UiSideEffect.OpenAccountManagementPageInBrowser("222")
)
)
}

Expand All @@ -864,8 +833,6 @@ class ConnectScreenTest {
composeTestRule.setContentWithTheme {
ConnectScreen(
uiState = ConnectUiState.INITIAL,
uiSideEffect = MutableStateFlow(ConnectViewModel.UiSideEffect.OpenOutOfTimeView),
onOpenOutOfTimeScreen = mockedOpenScreenHandler
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import io.mockk.MockKAnnotations
import io.mockk.mockk
import io.mockk.verify
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.asSharedFlow
import net.mullvad.mullvadvpn.compose.setContentWithTheme
import net.mullvad.mullvadvpn.compose.state.SelectLocationUiState
import net.mullvad.mullvadvpn.compose.test.CIRCULAR_PROGRESS_INDICATOR
Expand Down Expand Up @@ -40,7 +39,6 @@ class SelectLocationScreenTest {
SelectLocationScreen(
uiState = SelectLocationUiState.Loading,
uiCloseAction = MutableSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow()
)
}

Expand All @@ -59,7 +57,6 @@ class SelectLocationScreenTest {
selectedRelay = null
),
uiCloseAction = MutableSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow()
)
}

Expand Down Expand Up @@ -96,7 +93,6 @@ class SelectLocationScreenTest {
selectedRelay = updatedDummyList[0].cities[0].relays[0]
),
uiCloseAction = MutableSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow()
)
}

Expand All @@ -120,7 +116,6 @@ class SelectLocationScreenTest {
uiState =
SelectLocationUiState.ShowData(countries = emptyList(), selectedRelay = null),
uiCloseAction = MutableSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow(),
onSearchTermInput = mockedSearchTermInput
)
}
Expand All @@ -142,7 +137,6 @@ class SelectLocationScreenTest {
SelectLocationScreen(
uiState = SelectLocationUiState.NoSearchResultFound(searchTerm = mockSearchString),
uiCloseAction = MutableSharedFlow(),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow(),
onSearchTermInput = mockedSearchTermInput
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithText
import io.mockk.MockKAnnotations
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.asSharedFlow
import net.mullvad.mullvadvpn.compose.setContentWithTheme
import net.mullvad.mullvadvpn.compose.state.SettingsUiState
import org.junit.Before
Expand All @@ -28,7 +26,6 @@ class SettingsScreenTest {
SettingsScreen(
uiState =
SettingsUiState(appVersion = "", isLoggedIn = true, isUpdateAvailable = true),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow()
)
}
// Assert
Expand All @@ -47,7 +44,6 @@ class SettingsScreenTest {
SettingsScreen(
uiState =
SettingsUiState(appVersion = "", isLoggedIn = false, isUpdateAvailable = true),
enterTransitionEndAction = MutableSharedFlow<Unit>().asSharedFlow()
)
}
// Assert
Expand Down
Loading

0 comments on commit 512a6d9

Please sign in to comment.