From b69fd23456485d22c24b51da833d2707c718d61e Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Mon, 16 Sep 2024 16:52:28 -0500 Subject: Milly tweaks (#5365) Co-authored-by: Hailey --- src/components/dialogs/nuxs/index.tsx | 42 +++++------------------------------ 1 file changed, 5 insertions(+), 37 deletions(-) (limited to 'src/components/dialogs/nuxs/index.tsx') diff --git a/src/components/dialogs/nuxs/index.tsx b/src/components/dialogs/nuxs/index.tsx index a13d99eb2..a38c87b68 100644 --- a/src/components/dialogs/nuxs/index.tsx +++ b/src/components/dialogs/nuxs/index.tsx @@ -19,31 +19,12 @@ type Context = { dismissActiveNux: () => void } -/** - * If we fail to complete a NUX here, it may show again on next reload, - * or if prefs state updates. If `true`, this fallback ensures that the last - * shown NUX won't show again, at least for this session. - * - * This is temporary, and only needed for the 10Milly dialog rn, since we - * aren't snoozing that one in device storage. - */ -let __isSnoozedFallback = false - const queuedNuxs: { id: Nux - enabled(props: {gate: ReturnType}): boolean - /** - * TEMP only intended for use with the 10Milly dialog rn, since there are no - * other NUX dialogs configured - */ - unsafe_disableSnooze: boolean + enabled?: (props: {gate: ReturnType}) => boolean }[] = [ { id: Nux.TenMillionDialog, - enabled({gate}) { - return gate('ten_million_dialog') - }, - unsafe_disableSnooze: true, }, ] @@ -92,30 +73,23 @@ function Inner() { } React.useEffect(() => { - if (__isSnoozedFallback) return if (snoozed) return if (!nuxs) return - for (const {id, enabled, unsafe_disableSnooze} of queuedNuxs) { + for (const {id, enabled} of queuedNuxs) { const nux = nuxs.find(nux => nux.id === id) // check if completed first if (nux && nux.completed) continue // then check gate (track exposure) - if (!enabled({gate})) continue + if (enabled && !enabled({gate})) continue // we have a winner setActiveNux(id) - /** - * TEMP only intended for use with the 10Milly dialog rn, since there are no - * other NUX dialogs configured - */ - if (!unsafe_disableSnooze) { - // immediately snooze for a day - snoozeNuxDialog() - } + // immediately snooze for a day + snoozeNuxDialog() // immediately update remote data (affects next reload) upsertNux({ @@ -126,12 +100,6 @@ function Inner() { logger.error(`NUX dialogs: failed to upsert '${id}' NUX`, { safeMessage: e.message, }) - /* - * TEMP only intended for use with the 10Milly dialog rn - */ - if (unsafe_disableSnooze) { - __isSnoozedFallback = true - } }) break -- cgit 1.4.1