diff options
author | Eric Bailey <git@esb.lol> | 2025-08-06 15:15:52 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-06 15:15:52 -0500 |
commit | 328aa2be9482f77cb1cf86c5d227fdcee9981b16 (patch) | |
tree | 27174f10e0fe80288c0cd6907f8686486131d082 /src/components/PolicyUpdateOverlay/usePreemptivelyCompleteActivePolicyUpdate.ts | |
parent | fd37d92f85ddf0f075a67c4e9b2d85bef38f1835 (diff) | |
download | voidsky-328aa2be9482f77cb1cf86c5d227fdcee9981b16.tar.zst |
[APP-1356] Policy update dialog (#8782)
* Add blocking announcement dialog feature * WIP custom dialog * Rework dialog and add native FocusScope * Lock scroll on web, fix backdrop * Add web FocusScope * Create custom Outlet for these announcements * Clean up FocusScope native impl * Comments * Some styling fixes * Handle screen reader specifically * Clean up state, remove Portal edits * Reorg, rename * Add syncing, tests * Revert dialog updates * Revert formatting * Delete unused file * Format * Add FullWindowOverlay * remove mmkv storage in debug btn * Add debug code * fix taps passing through on iOS * Reorg * Reorg, rename everything * Complete policy update after signup * Add logger * Move context around, unmount portals on native * Move a11y prop into FocusScope * Remove useMemo * Update dates * Move debug to dev settings * Unmount web portals until policy update completed * UPdate dates --------- Co-authored-by: Samuel Newman <mozzius@protonmail.com>
Diffstat (limited to 'src/components/PolicyUpdateOverlay/usePreemptivelyCompleteActivePolicyUpdate.ts')
-rw-r--r-- | src/components/PolicyUpdateOverlay/usePreemptivelyCompleteActivePolicyUpdate.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/components/PolicyUpdateOverlay/usePreemptivelyCompleteActivePolicyUpdate.ts b/src/components/PolicyUpdateOverlay/usePreemptivelyCompleteActivePolicyUpdate.ts new file mode 100644 index 000000000..f41b3e6d7 --- /dev/null +++ b/src/components/PolicyUpdateOverlay/usePreemptivelyCompleteActivePolicyUpdate.ts @@ -0,0 +1,21 @@ +import {useCallback} from 'react' + +import {ACTIVE_UPDATE_ID} from '#/components/PolicyUpdateOverlay/config' +import {logger} from '#/components/PolicyUpdateOverlay/logger' +import {device, useStorage} from '#/storage' + +/* + * Marks the active policy update as completed in device storage. + * `usePolicyUpdateState` will react to this and replicate this status in the + * server NUX state for this account. + */ +export function usePreemptivelyCompleteActivePolicyUpdate() { + const [_completedForDevice, setCompletedForDevice] = useStorage(device, [ + ACTIVE_UPDATE_ID, + ]) + + return useCallback(() => { + logger.debug(`preemptively completing active policy update`) + setCompletedForDevice(true) + }, [setCompletedForDevice]) +} |