Skip to content

Commit

Permalink
Merge branch 'add-in-app-banner-message-for-a-new-device-droid-92'
Browse files Browse the repository at this point in the history
  • Loading branch information
Pururun committed Oct 23, 2023
2 parents 8f9cff2 + c43b476 commit f58efc2
Show file tree
Hide file tree
Showing 51 changed files with 1,183 additions and 500 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Line wrap the file at 100 chars. Th
- Migrate Report Problem view to compose.
- Migrate View Logs view to compose.
- Migrate voucher dialog to compose.
- Add "New Device" in app notification & rework notification system

#### Linux
- Don't block forwarding of traffic when the split tunnel mark (ct mark) is set.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ 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.ConnectNotificationState
import net.mullvad.mullvadvpn.compose.state.ConnectUiState
import net.mullvad.mullvadvpn.compose.test.CIRCULAR_PROGRESS_INDICATOR
import net.mullvad.mullvadvpn.compose.test.CONNECT_BUTTON_TEST_TAG
import net.mullvad.mullvadvpn.compose.test.LOCATION_INFO_TEST_TAG
import net.mullvad.mullvadvpn.compose.test.NOTIFICATION_BANNER
import net.mullvad.mullvadvpn.compose.test.NOTIFICATION_BANNER_ACTION
import net.mullvad.mullvadvpn.compose.test.RECONNECT_BUTTON_TEST_TAG
import net.mullvad.mullvadvpn.compose.test.SCROLLABLE_COLUMN_TEST_TAG
import net.mullvad.mullvadvpn.compose.test.SELECT_LOCATION_BUTTON_TEST_TAG
import net.mullvad.mullvadvpn.model.GeoIpLocation
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
Expand Down Expand Up @@ -86,8 +86,7 @@ class ConnectScreenTest {
isTunnelInfoExpanded = false,
deviceName = "",
daysLeftUntilExpiry = null,
connectNotificationState =
ConnectNotificationState.ShowTunnelStateNotificationBlocked
inAppNotification = InAppNotification.TunnelStateBlocked
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
Expand Down Expand Up @@ -123,8 +122,7 @@ class ConnectScreenTest {
isTunnelInfoExpanded = false,
deviceName = "",
daysLeftUntilExpiry = null,
connectNotificationState =
ConnectNotificationState.ShowTunnelStateNotificationBlocked
inAppNotification = InAppNotification.TunnelStateBlocked
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
Expand Down Expand Up @@ -158,7 +156,7 @@ class ConnectScreenTest {
isTunnelInfoExpanded = false,
deviceName = "",
daysLeftUntilExpiry = null,
connectNotificationState = ConnectNotificationState.HideNotification
inAppNotification = null
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
Expand Down Expand Up @@ -191,7 +189,7 @@ class ConnectScreenTest {
isTunnelInfoExpanded = false,
deviceName = "",
daysLeftUntilExpiry = null,
connectNotificationState = ConnectNotificationState.HideNotification
inAppNotification = null
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
Expand Down Expand Up @@ -225,7 +223,7 @@ class ConnectScreenTest {
isTunnelInfoExpanded = false,
deviceName = "",
daysLeftUntilExpiry = null,
connectNotificationState = ConnectNotificationState.HideNotification
inAppNotification = null
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
Expand Down Expand Up @@ -259,7 +257,7 @@ class ConnectScreenTest {
isTunnelInfoExpanded = false,
deviceName = "",
daysLeftUntilExpiry = null,
connectNotificationState = ConnectNotificationState.HideNotification
inAppNotification = null
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
Expand Down Expand Up @@ -295,8 +293,8 @@ class ConnectScreenTest {
isTunnelInfoExpanded = false,
deviceName = "",
daysLeftUntilExpiry = null,
connectNotificationState =
ConnectNotificationState.ShowTunnelStateNotificationError(
inAppNotification =
InAppNotification.TunnelStateError(
ErrorState(ErrorStateCause.StartTunnelError, true)
)
),
Expand Down Expand Up @@ -335,8 +333,8 @@ class ConnectScreenTest {
isTunnelInfoExpanded = false,
deviceName = "",
daysLeftUntilExpiry = null,
connectNotificationState =
ConnectNotificationState.ShowTunnelStateNotificationError(
inAppNotification =
InAppNotification.TunnelStateError(
ErrorState(ErrorStateCause.StartTunnelError, false)
)
),
Expand Down Expand Up @@ -372,8 +370,7 @@ class ConnectScreenTest {
isTunnelInfoExpanded = false,
deviceName = "",
daysLeftUntilExpiry = null,
connectNotificationState =
ConnectNotificationState.ShowTunnelStateNotificationBlocked
inAppNotification = InAppNotification.TunnelStateBlocked
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
Expand Down Expand Up @@ -409,8 +406,7 @@ class ConnectScreenTest {
isTunnelInfoExpanded = false,
deviceName = "",
daysLeftUntilExpiry = null,
connectNotificationState =
ConnectNotificationState.ShowTunnelStateNotificationBlocked
inAppNotification = InAppNotification.TunnelStateBlocked
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
Expand Down Expand Up @@ -446,7 +442,7 @@ class ConnectScreenTest {
isTunnelInfoExpanded = false,
deviceName = "",
daysLeftUntilExpiry = null,
connectNotificationState = ConnectNotificationState.HideNotification
inAppNotification = null
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow(),
onSwitchLocationClick = mockedClickHandler
Expand Down Expand Up @@ -479,7 +475,7 @@ class ConnectScreenTest {
isTunnelInfoExpanded = false,
deviceName = "",
daysLeftUntilExpiry = null,
connectNotificationState = ConnectNotificationState.HideNotification
inAppNotification = null
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow(),
onDisconnectClick = mockedClickHandler
Expand Down Expand Up @@ -512,7 +508,7 @@ class ConnectScreenTest {
isTunnelInfoExpanded = false,
deviceName = "",
daysLeftUntilExpiry = null,
connectNotificationState = ConnectNotificationState.HideNotification
inAppNotification = null
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow(),
onReconnectClick = mockedClickHandler
Expand Down Expand Up @@ -544,7 +540,7 @@ class ConnectScreenTest {
isTunnelInfoExpanded = false,
deviceName = "",
daysLeftUntilExpiry = null,
connectNotificationState = ConnectNotificationState.HideNotification
inAppNotification = null
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow(),
onConnectClick = mockedClickHandler
Expand Down Expand Up @@ -576,7 +572,7 @@ class ConnectScreenTest {
isTunnelInfoExpanded = false,
deviceName = "",
daysLeftUntilExpiry = null,
connectNotificationState = ConnectNotificationState.HideNotification
inAppNotification = null
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow(),
onCancelClick = mockedClickHandler
Expand Down Expand Up @@ -609,7 +605,7 @@ class ConnectScreenTest {
isTunnelInfoExpanded = false,
deviceName = "",
daysLeftUntilExpiry = null,
connectNotificationState = ConnectNotificationState.HideNotification
inAppNotification = null
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow(),
onToggleTunnelInfo = mockedClickHandler
Expand Down Expand Up @@ -649,7 +645,7 @@ class ConnectScreenTest {
isTunnelInfoExpanded = true,
deviceName = "",
daysLeftUntilExpiry = null,
connectNotificationState = ConnectNotificationState.HideNotification
inAppNotification = null
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
Expand Down Expand Up @@ -688,8 +684,7 @@ class ConnectScreenTest {
isTunnelInfoExpanded = false,
deviceName = "",
daysLeftUntilExpiry = null,
connectNotificationState =
ConnectNotificationState.ShowVersionInfoNotification(versionInfo)
inAppNotification = InAppNotification.UpdateAvailable(versionInfo)
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
Expand Down Expand Up @@ -726,8 +721,7 @@ class ConnectScreenTest {
isTunnelInfoExpanded = false,
deviceName = "",
daysLeftUntilExpiry = null,
connectNotificationState =
ConnectNotificationState.ShowVersionInfoNotification(versionInfo)
inAppNotification = InAppNotification.UnsupportedVersion(versionInfo)
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
Expand Down Expand Up @@ -759,10 +753,9 @@ class ConnectScreenTest {
outAddress = "",
showLocation = false,
isTunnelInfoExpanded = false,
deviceName = null,
deviceName = "",
daysLeftUntilExpiry = null,
connectNotificationState =
ConnectNotificationState.ShowAccountExpiryNotification(expiryDate)
inAppNotification = InAppNotification.AccountExpiry(expiryDate)
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
Expand Down Expand Up @@ -801,15 +794,14 @@ class ConnectScreenTest {
isTunnelInfoExpanded = false,
deviceName = "",
daysLeftUntilExpiry = null,
connectNotificationState =
ConnectNotificationState.ShowVersionInfoNotification(versionInfo)
inAppNotification = InAppNotification.UnsupportedVersion(versionInfo)
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
}

// Act
composeTestRule.onNodeWithTag(NOTIFICATION_BANNER).performClick()
composeTestRule.onNodeWithTag(NOTIFICATION_BANNER_ACTION).performClick()

// Assert
verify { mockedClickHandler.invoke() }
Expand All @@ -835,15 +827,14 @@ class ConnectScreenTest {
isTunnelInfoExpanded = false,
deviceName = "",
daysLeftUntilExpiry = null,
connectNotificationState =
ConnectNotificationState.ShowAccountExpiryNotification(expiryDate)
inAppNotification = InAppNotification.AccountExpiry(expiryDate)
),
uiSideEffect = MutableSharedFlow<ConnectViewModel.UiSideEffect>().asSharedFlow()
)
}

// Act
composeTestRule.onNodeWithTag(NOTIFICATION_BANNER).performClick()
composeTestRule.onNodeWithTag(NOTIFICATION_BANNER_ACTION).performClick()

// Assert
verify { mockedClickHandler.invoke() }
Expand Down
Loading

0 comments on commit f58efc2

Please sign in to comment.