mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-27 21:24:42 +00:00
Update linked device education logic.
This commit is contained in:
committed by
Greyson Parrelli
parent
553d783860
commit
a934df5f97
@@ -30,7 +30,7 @@ public class UiHintValues extends SignalStoreValues {
|
||||
private static final String HAS_EVER_ENABLED_REMOTE_BACKUPS = "uihints.has_ever_enabled_remote_backups";
|
||||
private static final String HAS_SEEN_CHAT_FOLDERS_EDUCATION_SHEET = "uihints.has_seen_chat_folders_education_sheet";
|
||||
private static final String HAS_SEEN_LINK_DEVICE_QR_EDUCATION_SHEET = "uihints.has_seen_link_device_qr_education_sheet";
|
||||
private static final String HAS_SEEN_LINK_DEVICE_AUTH_SHEET = "uihints.has_seen_link_device_auth_sheet";
|
||||
private static final String LAST_SEEN_LINK_DEVICE_AUTH_SHEET_TIME = "uihints.last_seen_link_device_auth_sheet_time";
|
||||
private static final String HAS_DISMISSED_SAVE_STORAGE_WARNING = "uihints.has_dismissed_save_storage_warning";
|
||||
|
||||
UiHintValues(@NonNull KeyValueStore store) {
|
||||
@@ -230,12 +230,12 @@ public class UiHintValues extends SignalStoreValues {
|
||||
return getBoolean(HAS_SEEN_LINK_DEVICE_QR_EDUCATION_SHEET, false);
|
||||
}
|
||||
|
||||
public void markHasSeenLinkDeviceAuthSheet() {
|
||||
putBoolean(HAS_SEEN_LINK_DEVICE_AUTH_SHEET, true);
|
||||
public void setLastSeenLinkDeviceAuthSheetTime(long time) {
|
||||
putLong(LAST_SEEN_LINK_DEVICE_AUTH_SHEET_TIME, time);
|
||||
}
|
||||
|
||||
public boolean hasSeenLinkDeviceAuthSheet() {
|
||||
return getBoolean(HAS_SEEN_LINK_DEVICE_AUTH_SHEET, false);
|
||||
public long getLastSeenLinkDeviceAuthSheetTime() {
|
||||
return getLong(LAST_SEEN_LINK_DEVICE_AUTH_SHEET_TIME, 0);
|
||||
}
|
||||
|
||||
public boolean hasDismissedSaveStorageWarning() {
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.linkdevice
|
||||
import android.net.Uri
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.linkdevice.LinkDeviceRepository.LinkDeviceResult
|
||||
import kotlin.time.Duration.Companion.days
|
||||
|
||||
/**
|
||||
* Information about linked devices. Used in [LinkDeviceViewModel].
|
||||
@@ -19,7 +20,7 @@ data class LinkDeviceSettingsState(
|
||||
val linkDeviceResult: LinkDeviceResult = LinkDeviceResult.None,
|
||||
val seenQrEducationSheet: Boolean = SignalStore.uiHints.hasSeenLinkDeviceQrEducationSheet() || SignalStore.account.hasLinkedDevices,
|
||||
val seenBioAuthEducationSheet: Boolean = false,
|
||||
val needsBioAuthEducationSheet: Boolean = !seenBioAuthEducationSheet && !SignalStore.uiHints.hasSeenLinkDeviceAuthSheet() && !SignalStore.account.hasLinkedDevices,
|
||||
val needsBioAuthEducationSheet: Boolean = !seenBioAuthEducationSheet && SignalStore.uiHints.lastSeenLinkDeviceAuthSheetTime < System.currentTimeMillis() - 30.days.inWholeMilliseconds,
|
||||
val bottomSheetVisible: Boolean = false,
|
||||
val deviceToEdit: Device? = null,
|
||||
val shouldCancelArchiveUpload: Boolean = false
|
||||
|
||||
@@ -259,7 +259,7 @@ class LinkDeviceViewModel : ViewModel() {
|
||||
}
|
||||
|
||||
fun markBioAuthEducationSheetSeen(seen: Boolean) {
|
||||
SignalStore.uiHints.markHasSeenLinkDeviceAuthSheet()
|
||||
SignalStore.uiHints.lastSeenLinkDeviceAuthSheetTime = System.currentTimeMillis()
|
||||
_state.update {
|
||||
it.copy(
|
||||
seenBioAuthEducationSheet = seen,
|
||||
|
||||
Reference in New Issue
Block a user