forked from bitwarden/android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PM-8217] New device two factor notice (bitwarden#4508)
Co-authored-by: Federico Maccaroni <[email protected]>
- Loading branch information
1 parent
ae8db92
commit a35ec8c
Showing
29 changed files
with
1,345 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
.../java/com/x8bit/bitwarden/data/auth/datasource/disk/model/NewDeviceNoticeDisplayStatus.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package com.x8bit.bitwarden.data.auth.datasource.disk.model | ||
|
||
import kotlinx.serialization.Contextual | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
import java.time.ZonedDateTime | ||
|
||
/** | ||
* Describes the current display status of the new device notice screen. | ||
*/ | ||
@Serializable | ||
enum class NewDeviceNoticeDisplayStatus { | ||
/** | ||
* The user has seen the screen and indicated they can access their email. | ||
*/ | ||
@SerialName("canAccessEmail") | ||
CAN_ACCESS_EMAIL, | ||
|
||
/** | ||
* The user has indicated they can access their email | ||
* as specified by the Permanent mode of the notice. | ||
*/ | ||
@SerialName("canAccessEmailPermanent") | ||
CAN_ACCESS_EMAIL_PERMANENT, | ||
|
||
/** | ||
* The user has not seen the screen. | ||
*/ | ||
@SerialName("hasNotSeen") | ||
HAS_NOT_SEEN, | ||
|
||
/** | ||
* The user has seen the screen and selected "remind me later". | ||
*/ | ||
@SerialName("hasSeen") | ||
HAS_SEEN, | ||
} | ||
|
||
/** | ||
* The state of the new device notice screen. | ||
*/ | ||
@Suppress("MagicNumber") | ||
@Serializable | ||
data class NewDeviceNoticeState( | ||
@SerialName("displayStatus") | ||
val displayStatus: NewDeviceNoticeDisplayStatus, | ||
|
||
@SerialName("lastSeenDate") | ||
@Contextual | ||
val lastSeenDate: ZonedDateTime?, | ||
) { | ||
/** | ||
* Whether the [lastSeenDate] is at least 7 days old. | ||
*/ | ||
val shouldDisplayNoticeIfSeen = lastSeenDate | ||
?.isBefore( | ||
ZonedDateTime.now().minusDays(7), | ||
) | ||
?: false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.