Snooze the bulk unverified sessions reminder on dismiss (#9706)

* test bulk unverified sessions toast behaviour

* unverified sessions toast text tweak

* only show bulk unverified sessions toast when current device is verified

* add Setting for BulkUnverifiedSessionsReminder

* add build config for BulkUnverifiedSessionsReminder

* add more assertions for show/hide toast, fix strict errors

* fix strict error

* add util methods for snoozing in local storage

* rename nag to reminder

* set and read snooze for toast

* test snooze

* remove debug

* strict fix

* remove unused code
This commit is contained in:
Kerry 2022-12-06 19:18:03 +13:00 committed by GitHub
parent 75c2c1a572
commit 82ad8d5aa2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 167 additions and 0 deletions

View file

@ -48,6 +48,7 @@ import {
} from "./utils/device/clientInformation";
import SettingsStore, { CallbackFn } from "./settings/SettingsStore";
import { UIFeature } from "./settings/UIFeature";
import { isBulkUnverifiedDeviceReminderSnoozed } from "./utils/device/snoozeBulkUnverifiedDeviceReminder";
const KEY_BACKUP_POLL_INTERVAL = 5 * 60 * 1000;
@ -335,12 +336,15 @@ export default class DeviceListener {
logger.debug("New unverified sessions: " + Array.from(newUnverifiedDeviceIds).join(','));
logger.debug("Currently showing toasts for: " + Array.from(this.displayingToastsForDeviceIds).join(','));
const isBulkUnverifiedSessionsReminderSnoozed = isBulkUnverifiedDeviceReminderSnoozed();
// Display or hide the batch toast for old unverified sessions
// don't show the toast if the current device is unverified
if (
oldUnverifiedDeviceIds.size > 0
&& isCurrentDeviceTrusted
&& this.enableBulkUnverifiedSessionsReminder
&& !isBulkUnverifiedSessionsReminderSnoozed
) {
showBulkUnverifiedSessionsToast(oldUnverifiedDeviceIds);
} else {