From 328aa2be9482f77cb1cf86c5d227fdcee9981b16 Mon Sep 17 00:00:00 2001
From: Eric Bailey <git@esb.lol>
Date: Wed, 6 Aug 2025 15:15:52 -0500
Subject: [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>
---
 src/components/PolicyUpdateOverlay/index.tsx | 41 ++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 src/components/PolicyUpdateOverlay/index.tsx

(limited to 'src/components/PolicyUpdateOverlay/index.tsx')

diff --git a/src/components/PolicyUpdateOverlay/index.tsx b/src/components/PolicyUpdateOverlay/index.tsx
new file mode 100644
index 000000000..1900dc27f
--- /dev/null
+++ b/src/components/PolicyUpdateOverlay/index.tsx
@@ -0,0 +1,41 @@
+import {View} from 'react-native'
+
+import {isIOS} from '#/platform/detection'
+import {atoms as a} from '#/alf'
+import {FullWindowOverlay} from '#/components/FullWindowOverlay'
+import {usePolicyUpdateStateContext} from '#/components/PolicyUpdateOverlay/context'
+import {Portal} from '#/components/PolicyUpdateOverlay/Portal'
+import {Content} from '#/components/PolicyUpdateOverlay/updates/202508'
+
+export {Provider} from '#/components/PolicyUpdateOverlay/context'
+export {usePolicyUpdateStateContext} from '#/components/PolicyUpdateOverlay/context'
+export {Outlet} from '#/components/PolicyUpdateOverlay/Portal'
+
+export function PolicyUpdateOverlay() {
+  const state = usePolicyUpdateStateContext()
+
+  /*
+   * See `window.clearNux` example in `/state/queries/nuxs` for a way to clear
+   * NUX state for local testing and debugging.
+   */
+
+  if (state.completed) return null
+
+  return (
+    <Portal>
+      <FullWindowOverlay>
+        <View
+          style={[
+            a.fixed,
+            a.inset_0,
+            // setting a zIndex when using FullWindowOverlay on iOS
+            // means the taps pass straight through to the underlying content (???)
+            // so don't set it on iOS. FullWindowOverlay already does the job.
+            !isIOS && {zIndex: 9999},
+          ]}>
+          <Content state={state} />
+        </View>
+      </FullWindowOverlay>
+    </Portal>
+  )
+}
-- 
cgit 1.4.1

