Add "your media will be deleted today" mechanism based off last checkin time and media TTL.

This commit is contained in:
Alex Hart
2024-11-22 10:23:23 -04:00
committed by Greyson Parrelli
parent f16827d9ec
commit bae86d127f
9 changed files with 65 additions and 50 deletions

View File

@@ -36,6 +36,7 @@ class BackupValues(store: KeyValueStore) : SignalStoreValues(store) {
private const val KEY_BACKUP_TIER = "backup.backupTier"
private const val KEY_LATEST_BACKUP_TIER = "backup.latestBackupTier"
private const val KEY_LAST_CHECK_IN_MILLIS = "backup.lastCheckInMilliseconds"
private const val KEY_LAST_CHECK_IN_SNOOZE_MILLIS = "backup.lastCheckInSnoozeMilliseconds"
private const val KEY_NEXT_BACKUP_TIME = "backup.nextBackupTime"
private const val KEY_LAST_BACKUP_TIME = "backup.lastBackupTime"
@@ -95,8 +96,19 @@ class BackupValues(store: KeyValueStore) : SignalStoreValues(store) {
var userManuallySkippedMediaRestore: Boolean by booleanValue(KEY_USER_MANUALLY_SKIPPED_MEDIA_RESTORE, false)
/**
* The last time the device notified the server that the archive is still in use.
*/
var lastCheckInMillis: Long by longValue(KEY_LAST_CHECK_IN_MILLIS, 0L)
/**
* The time we last displayed the "Your media will be deleted today" sheet.
*
* Set when the user dismisses the "Your media will be deleted today" alert
* Cleared when the system performs a check-in or the user subscribes to backups.
*/
var lastCheckInSnoozeMillis: Long by longValue(KEY_LAST_CHECK_IN_SNOOZE_MILLIS, 0)
/**
* Key used to backup messages.
*/

View File

@@ -71,7 +71,6 @@ class InAppPaymentValues internal constructor(store: KeyValueStore) : SignalStor
private const val SUBSCRIPTION_CANCELATION_TIMESTAMP = "donation.subscription.cancelation.timestamp"
private const val SUBSCRIPTION_CANCELATION_WATERMARK = "donation.subscription.cancelation.watermark"
private const val SHOW_CANT_PROCESS_DIALOG = "show.cant.process.dialog"
private const val SHOW_LAST_DAY_TO_DOWNLOAD_MEDIA_DIALOG = "inapppayment.show.last.day.to.download.media.dialog"
/**
* The current request context for subscription. This should be stored until either
@@ -162,8 +161,7 @@ class InAppPaymentValues internal constructor(store: KeyValueStore) : SignalStor
SUBSCRIPTION_EOP_STARTED_TO_CONVERT,
SUBSCRIPTION_EOP_STARTED_TO_REDEEM,
SUBSCRIPTION_EOP_REDEEMED,
SUBSCRIPTION_PAYMENT_SOURCE_TYPE,
SHOW_LAST_DAY_TO_DOWNLOAD_MEDIA_DIALOG
SUBSCRIPTION_PAYMENT_SOURCE_TYPE
)
private val recurringDonationCurrencyPublisher: Subject<Currency> by lazy { BehaviorSubject.createDefault(getSubscriptionCurrency(InAppPaymentSubscriberRecord.Type.DONATION)) }
@@ -420,9 +418,6 @@ class InAppPaymentValues internal constructor(store: KeyValueStore) : SignalStor
@get:JvmName("showCantProcessDialog")
var showMonthlyDonationCanceledDialog: Boolean by booleanValue(SHOW_CANT_PROCESS_DIALOG, true)
@get:JvmName("showLastDayToDownloadMediaDialog")
var showLastDayToDownloadMediaDialog: Boolean by booleanValue(SHOW_LAST_DAY_TO_DOWNLOAD_MEDIA_DIALOG, false)
/**
* Denotes that the previous attempt to subscribe failed in some way. Either an
* automatic renewal failed resulting in an unexpected expiration, or payment failed