Skip to content

Commit

Permalink
Fix remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawa committed Oct 17, 2023
1 parent 55c3143 commit 1a360f9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ fun NotificationBanner(
onClickShowAccount: () -> Unit,
onClickDismissNewDevice: () -> Unit
) {
// Fix for animating to invisible state
val previous = rememberPrevious(current = notification, shouldUpdate = { _, _ -> true })
// Fix for animating t hide
AnimatedVisibility(
visible = notification != null,
enter = slideInVertically(initialOffsetY = { -it }),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
package net.mullvad.mullvadvpn.constant

const val ACCOUNT_EXPIRY_POLL_INTERVAL: Long = 15 /* s */ * 1000 /* ms */
const val ACCOUNT_EXPIRY_CLOSE_TO_EXPIRY_THRESHOLD_DAYS = 3
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.map
import net.mullvad.mullvadvpn.constant.ACCOUNT_EXPIRY_CLOSE_TO_EXPIRY_THRESHOLD_DAYS
import net.mullvad.mullvadvpn.model.AccountExpiry
import net.mullvad.mullvadvpn.repository.InAppNotification
import net.mullvad.mullvadvpn.ui.serviceconnection.ServiceConnectionManager
Expand All @@ -28,7 +29,8 @@ class AccountExpiryNotificationUseCase(
} else null

private fun AccountExpiry.isCloseToExpiring(): Boolean {
val threeDaysFromNow = DateTime.now().plusDays(3)
val threeDaysFromNow =
DateTime.now().plusDays(ACCOUNT_EXPIRY_CLOSE_TO_EXPIRY_THRESHOLD_DAYS)
return this.date()?.isBefore(threeDaysFromNow) == true
}
}

0 comments on commit 1a360f9

Please sign in to comment.