about summary refs log tree commit diff
path: root/src/state
diff options
context:
space:
mode:
Diffstat (limited to 'src/state')
-rw-r--r--src/state/persisted/index.ts6
-rw-r--r--src/state/queries/nuxs/__mocks__/index.ts25
-rw-r--r--src/state/queries/nuxs/definitions.ts10
3 files changed, 39 insertions, 2 deletions
diff --git a/src/state/persisted/index.ts b/src/state/persisted/index.ts
index 51d757ad8..8c043a342 100644
--- a/src/state/persisted/index.ts
+++ b/src/state/persisted/index.ts
@@ -3,11 +3,12 @@ import AsyncStorage from '@react-native-async-storage/async-storage'
 import {logger} from '#/logger'
 import {
   defaults,
-  Schema,
+  type Schema,
   tryParse,
   tryStringify,
 } from '#/state/persisted/schema'
-import {PersistedApi} from './types'
+import {device} from '#/storage'
+import {type PersistedApi} from './types'
 import {normalizeData} from './util'
 
 export type {PersistedAccount, Schema} from '#/state/persisted/schema'
@@ -53,6 +54,7 @@ onUpdate satisfies PersistedApi['onUpdate']
 export async function clearStorage() {
   try {
     await AsyncStorage.removeItem(BSKY_STORAGE)
+    device.removeAll()
   } catch (e: any) {
     logger.error(`persisted store: failed to clear`, {message: e.toString()})
   }
diff --git a/src/state/queries/nuxs/__mocks__/index.ts b/src/state/queries/nuxs/__mocks__/index.ts
new file mode 100644
index 000000000..c718b1594
--- /dev/null
+++ b/src/state/queries/nuxs/__mocks__/index.ts
@@ -0,0 +1,25 @@
+import {jest} from '@jest/globals'
+
+export {Nux} from '#/state/queries/nuxs/definitions'
+
+export const useNuxs = jest.fn(() => {
+  return {
+    nuxs: undefined,
+    status: 'loading' as const,
+  }
+})
+
+export const useNux = jest.fn((id: string) => {
+  return {
+    nux: undefined,
+    status: 'loading' as const,
+  }
+})
+
+export const useSaveNux = jest.fn(() => {
+  return {}
+})
+
+export const useResetNuxs = jest.fn(() => {
+  return {}
+})
diff --git a/src/state/queries/nuxs/definitions.ts b/src/state/queries/nuxs/definitions.ts
index 3d5c132f2..7577d6b20 100644
--- a/src/state/queries/nuxs/definitions.ts
+++ b/src/state/queries/nuxs/definitions.ts
@@ -9,6 +9,11 @@ export enum Nux {
   ActivitySubscriptions = 'ActivitySubscriptions',
   AgeAssuranceDismissibleNotice = 'AgeAssuranceDismissibleNotice',
   AgeAssuranceDismissibleFeedBanner = 'AgeAssuranceDismissibleFeedBanner',
+
+  /*
+   * Blocking announcements. New IDs are required for each new announcement.
+   */
+  PolicyUpdate202508 = 'PolicyUpdate202508',
 }
 
 export const nuxNames = new Set(Object.values(Nux))
@@ -38,6 +43,10 @@ export type AppNux = BaseNux<
       id: Nux.AgeAssuranceDismissibleFeedBanner
       data: undefined
     }
+  | {
+      id: Nux.PolicyUpdate202508
+      data: undefined
+    }
 >
 
 export const NuxSchemas: Record<Nux, zod.ZodObject<any> | undefined> = {
@@ -47,4 +56,5 @@ export const NuxSchemas: Record<Nux, zod.ZodObject<any> | undefined> = {
   [Nux.ActivitySubscriptions]: undefined,
   [Nux.AgeAssuranceDismissibleNotice]: undefined,
   [Nux.AgeAssuranceDismissibleFeedBanner]: undefined,
+  [Nux.PolicyUpdate202508]: undefined,
 }