Reorg, rename everything
This commit is contained in:
+3
-3
@@ -70,9 +70,9 @@ import {Provider as ContextMenuProvider} from '#/components/ContextMenu'
|
||||
import {NuxDialogs} from '#/components/dialogs/nuxs'
|
||||
import {useStarterPackEntry} from '#/components/hooks/useStarterPackEntry'
|
||||
import {Provider as IntentDialogProvider} from '#/components/intents/IntentDialogs'
|
||||
import {Provider as PolicyUpdateOverlayProvider} from '#/components/PolicyUpdateOverlay'
|
||||
import {Provider as PortalProvider} from '#/components/Portal'
|
||||
import {Provider as VideoVolumeProvider} from '#/components/Post/Embed/VideoEmbed/VideoVolumeContext'
|
||||
import {Provider as BlockingAnnouncementsPortalProvider} from '#/components/dialogs/BlockingAnnouncements'
|
||||
import {Splash} from '#/Splash'
|
||||
import {BottomSheetProvider} from '../modules/bottom-sheet'
|
||||
import {BackgroundNotificationPreferencesProvider} from '../modules/expo-background-notification-handler/src/BackgroundNotificationHandlerProvider'
|
||||
@@ -221,7 +221,7 @@ function App() {
|
||||
<ModalStateProvider>
|
||||
<DialogStateProvider>
|
||||
<LightboxStateProvider>
|
||||
<BlockingAnnouncementsPortalProvider>
|
||||
<PolicyUpdateOverlayProvider>
|
||||
<PortalProvider>
|
||||
<BottomSheetProvider>
|
||||
<StarterPackProvider>
|
||||
@@ -232,7 +232,7 @@ function App() {
|
||||
</StarterPackProvider>
|
||||
</BottomSheetProvider>
|
||||
</PortalProvider>
|
||||
</BlockingAnnouncementsPortalProvider>
|
||||
</PolicyUpdateOverlayProvider>
|
||||
</LightboxStateProvider>
|
||||
</DialogStateProvider>
|
||||
</ModalStateProvider>
|
||||
|
||||
+3
-3
@@ -54,10 +54,10 @@ import {Shell} from '#/view/shell/index'
|
||||
import {ThemeProvider as Alf} from '#/alf'
|
||||
import {useColorModeTheme} from '#/alf/util/useColorModeTheme'
|
||||
import {Provider as ContextMenuProvider} from '#/components/ContextMenu'
|
||||
import {Provider as BlockingAnnouncementsPortalProvider} from '#/components/dialogs/BlockingAnnouncements'
|
||||
import {NuxDialogs} from '#/components/dialogs/nuxs'
|
||||
import {useStarterPackEntry} from '#/components/hooks/useStarterPackEntry'
|
||||
import {Provider as IntentDialogProvider} from '#/components/intents/IntentDialogs'
|
||||
import {Provider as PolicyUpdateOverlayProvider} from '#/components/PolicyUpdateOverlay'
|
||||
import {Provider as PortalProvider} from '#/components/Portal'
|
||||
import {Provider as ActiveVideoProvider} from '#/components/Post/Embed/VideoEmbed/ActiveVideoWebContext'
|
||||
import {Provider as VideoVolumeProvider} from '#/components/Post/Embed/VideoEmbed/VideoVolumeContext'
|
||||
@@ -197,13 +197,13 @@ function App() {
|
||||
<ModalStateProvider>
|
||||
<DialogStateProvider>
|
||||
<LightboxStateProvider>
|
||||
<BlockingAnnouncementsPortalProvider>
|
||||
<PolicyUpdateOverlayProvider>
|
||||
<PortalProvider>
|
||||
<StarterPackProvider>
|
||||
<InnerApp />
|
||||
</StarterPackProvider>
|
||||
</PortalProvider>
|
||||
</BlockingAnnouncementsPortalProvider>
|
||||
</PolicyUpdateOverlayProvider>
|
||||
</LightboxStateProvider>
|
||||
</DialogStateProvider>
|
||||
</ModalStateProvider>
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import {Logo} from '#/view/icons/Logo'
|
||||
import {atoms as a, useTheme} from '#/alf'
|
||||
import {Text} from '#/components/Typography'
|
||||
|
||||
export function AnnouncementBadge() {
|
||||
export function Badge() {
|
||||
const t = useTheme()
|
||||
return (
|
||||
<View style={[a.align_start]}>
|
||||
+1
-1
@@ -15,7 +15,7 @@ import {LockScroll} from '#/components/LockScroll'
|
||||
|
||||
const GUTTER = 24
|
||||
|
||||
export function AnnouncementDialog({
|
||||
export function Overlay({
|
||||
children,
|
||||
label,
|
||||
}: {
|
||||
+2
-2
@@ -3,9 +3,9 @@ import {describe, test} from '@jest/globals'
|
||||
import {
|
||||
computeCompletedState,
|
||||
syncCompletedState,
|
||||
} from '#/components/dialogs/BlockingAnnouncements/useAnnouncementState'
|
||||
} from '#/components/PolicyUpdateOverlay/usePolicyUpdateState'
|
||||
|
||||
jest.mock('../../../../state/queries/nuxs')
|
||||
jest.mock('../../../state/queries/nuxs')
|
||||
|
||||
describe('computeCompletedState', () => {
|
||||
test(`initial state`, () => {
|
||||
@@ -0,0 +1,7 @@
|
||||
import {ID} from '#/components/PolicyUpdateOverlay/updates/202508/config'
|
||||
|
||||
/**
|
||||
* The singulary active update ID. This is configured here to ensure that
|
||||
* the relationship is clear.
|
||||
*/
|
||||
export const ACTIVE_UPDATE_ID = ID
|
||||
+5
-5
@@ -2,9 +2,9 @@ import {View} from 'react-native'
|
||||
|
||||
import {isIOS} from '#/platform/detection'
|
||||
import {atoms as a} from '#/alf'
|
||||
import {Announcement} from '#/components/dialogs/BlockingAnnouncements/announcements/PolicyUpdate202508'
|
||||
import {useAnnouncementState} from '#/components/dialogs/BlockingAnnouncements/useAnnouncementState'
|
||||
import {FullWindowOverlay} from '#/components/FullWindowOverlay'
|
||||
import {Content} from '#/components/PolicyUpdateOverlay/updates/202508'
|
||||
import {usePolicyUpdateState} from '#/components/PolicyUpdateOverlay/usePolicyUpdateState'
|
||||
import {createPortalGroup} from '#/components/Portal'
|
||||
|
||||
const portalGroup = createPortalGroup()
|
||||
@@ -13,8 +13,8 @@ export const Provider = portalGroup.Provider
|
||||
export const Portal = portalGroup.Portal
|
||||
export const Outlet = portalGroup.Outlet
|
||||
|
||||
export function BlockingAnnouncements() {
|
||||
const state = useAnnouncementState()
|
||||
export function PolicyUpdateOverlay() {
|
||||
const state = usePolicyUpdateState()
|
||||
|
||||
/*
|
||||
* See `window.clearNux` example in `/state/queries/nuxs` for a way to clear
|
||||
@@ -35,7 +35,7 @@ export function BlockingAnnouncements() {
|
||||
// so don't set it on iOS. FullWindowOverlay already does the job.
|
||||
!isIOS && {zIndex: 9999},
|
||||
]}>
|
||||
<Announcement state={state} />
|
||||
<Content state={state} />
|
||||
</View>
|
||||
</FullWindowOverlay>
|
||||
</Portal>
|
||||
+1
-1
@@ -4,4 +4,4 @@
|
||||
|
||||
import {Nux} from '#/state/queries/nuxs'
|
||||
|
||||
export const ID = Nux.BlockingAnnouncementPolicyUpdate202508
|
||||
export const ID = Nux.PolicyUpdate202508
|
||||
+7
-7
@@ -7,13 +7,13 @@ import {isAndroid} from '#/platform/detection'
|
||||
import {useA11y} from '#/state/a11y'
|
||||
import {atoms as a, useTheme} from '#/alf'
|
||||
import {Button, ButtonText} from '#/components/Button'
|
||||
import {AnnouncementBadge} from '#/components/dialogs/BlockingAnnouncements/AnnouncementBadge'
|
||||
import {AnnouncementDialog} from '#/components/dialogs/BlockingAnnouncements/AnnouncementDialog'
|
||||
import {type AnnouncementState} from '#/components/dialogs/BlockingAnnouncements/useAnnouncementState'
|
||||
import {InlineLinkText, Link} from '#/components/Link'
|
||||
import {Badge} from '#/components/PolicyUpdateOverlay/Badge'
|
||||
import {Overlay} from '#/components/PolicyUpdateOverlay/Overlay'
|
||||
import {type PolicyUpdateState} from '#/components/PolicyUpdateOverlay/usePolicyUpdateState'
|
||||
import {Text} from '#/components/Typography'
|
||||
|
||||
export function Announcement({state}: {state: AnnouncementState}) {
|
||||
export function Content({state}: {state: PolicyUpdateState}) {
|
||||
const t = useTheme()
|
||||
const {_} = useLingui()
|
||||
const {screenReaderEnabled} = useA11y()
|
||||
@@ -63,9 +63,9 @@ export function Announcement({state}: {state: AnnouncementState}) {
|
||||
: _(msg`We're updating our policies`)
|
||||
|
||||
return (
|
||||
<AnnouncementDialog label={label}>
|
||||
<Overlay label={label}>
|
||||
<View style={[a.align_start, a.gap_xl]}>
|
||||
<AnnouncementBadge />
|
||||
<Badge />
|
||||
|
||||
{screenReaderEnabled ? (
|
||||
<View style={[a.gap_sm]}>
|
||||
@@ -184,6 +184,6 @@ export function Announcement({state}: {state: AnnouncementState}) {
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
</AnnouncementDialog>
|
||||
</Overlay>
|
||||
)
|
||||
}
|
||||
+11
-11
@@ -1,21 +1,21 @@
|
||||
import {useMemo} from 'react'
|
||||
|
||||
import {useNux, useSaveNux} from '#/state/queries/nuxs'
|
||||
import {ACTIVE_ANNOUNCEMENT} from '#/components/dialogs/BlockingAnnouncements/config'
|
||||
import {ACTIVE_UPDATE_ID} from '#/components/PolicyUpdateOverlay/config'
|
||||
import {IS_DEV} from '#/env'
|
||||
import {device, useStorage} from '#/storage'
|
||||
|
||||
export type AnnouncementState = {
|
||||
export type PolicyUpdateState = {
|
||||
completed: boolean
|
||||
complete: () => void
|
||||
}
|
||||
|
||||
export function useAnnouncementState() {
|
||||
const nux = useNux(ACTIVE_ANNOUNCEMENT)
|
||||
export function usePolicyUpdateState() {
|
||||
const nux = useNux(ACTIVE_UPDATE_ID)
|
||||
const {mutate: save, variables} = useSaveNux()
|
||||
const deviceStorage = useStorage(device, [ACTIVE_ANNOUNCEMENT])
|
||||
const devOnlyOverride =
|
||||
useStorage(device, ['blockingAnnouncementOverride']) && IS_DEV
|
||||
const deviceStorage = useStorage(device, [ACTIVE_UPDATE_ID])
|
||||
const debugOverride =
|
||||
useStorage(device, ['policyUpdateDebugOverride']) && IS_DEV
|
||||
return useMemo(() => {
|
||||
const nuxIsReady = nux.status === 'ready'
|
||||
const nuxIsCompleted = nux.nux?.completed === true
|
||||
@@ -29,7 +29,7 @@ export function useAnnouncementState() {
|
||||
completedForDevice,
|
||||
})
|
||||
|
||||
if (!devOnlyOverride) {
|
||||
if (!debugOverride) {
|
||||
syncCompletedState({
|
||||
nuxIsReady,
|
||||
nuxIsCompleted,
|
||||
@@ -44,13 +44,13 @@ export function useAnnouncementState() {
|
||||
completed,
|
||||
complete() {
|
||||
save({
|
||||
id: ACTIVE_ANNOUNCEMENT,
|
||||
id: ACTIVE_UPDATE_ID,
|
||||
completed: true,
|
||||
data: undefined,
|
||||
})
|
||||
},
|
||||
}
|
||||
}, [nux, save, variables, deviceStorage, devOnlyOverride])
|
||||
}, [nux, save, variables, deviceStorage, debugOverride])
|
||||
}
|
||||
|
||||
export function computeCompletedState({
|
||||
@@ -111,7 +111,7 @@ export function syncCompletedState({
|
||||
!!completedForDevice
|
||||
) {
|
||||
save({
|
||||
id: ACTIVE_ANNOUNCEMENT,
|
||||
id: ACTIVE_UPDATE_ID,
|
||||
completed: true,
|
||||
data: undefined,
|
||||
})
|
||||
@@ -1,7 +0,0 @@
|
||||
import {ID} from '#/components/dialogs/BlockingAnnouncements/announcements/PolicyUpdate202508/config'
|
||||
|
||||
/**
|
||||
* The singulary active announcement ID. This is configured here to ensure that
|
||||
* the relationship is clear.
|
||||
*/
|
||||
export const ACTIVE_ANNOUNCEMENT = ID
|
||||
@@ -17,7 +17,6 @@ import * as Toast from '#/view/com/util/Toast'
|
||||
import * as SettingsList from '#/screens/Settings/components/SettingsList'
|
||||
import {atoms as a} from '#/alf'
|
||||
import {Button, ButtonText} from '#/components/Button'
|
||||
import {ID as PolicyUpdate202508} from '#/components/dialogs/BlockingAnnouncements/announcements/PolicyUpdate202508/config'
|
||||
import {Atom_Stroke2_Corner0_Rounded as AtomIcon} from '#/components/icons/Atom'
|
||||
import {BroomSparkle_Stroke2_Corner2_Rounded as BroomSparkleIcon} from '#/components/icons/BroomSparkle'
|
||||
import {CodeLines_Stroke2_Corner2_Rounded as CodeLinesIcon} from '#/components/icons/CodeLines'
|
||||
@@ -26,6 +25,7 @@ import {Newspaper_Stroke2_Corner2_Rounded as NewspaperIcon} from '#/components/i
|
||||
import {Wrench_Stroke2_Corner2_Rounded as WrenchIcon} from '#/components/icons/Wrench'
|
||||
import * as Layout from '#/components/Layout'
|
||||
import {Loader} from '#/components/Loader'
|
||||
import {ID as PolicyUpdate202508} from '#/components/PolicyUpdateOverlay/updates/202508/config'
|
||||
import {Text} from '#/components/Typography'
|
||||
import * as env from '#/env'
|
||||
import {device, useStorage} from '#/storage'
|
||||
@@ -198,7 +198,7 @@ export function AboutSettingsScreen({}: Props) {
|
||||
function PolicyUpdateDebug() {
|
||||
const agent = useAgent()
|
||||
const [override, setOverride] = useStorage(device, [
|
||||
'blockingAnnouncementOverride',
|
||||
'policyUpdateDebugOverride',
|
||||
])
|
||||
|
||||
return (
|
||||
|
||||
@@ -13,7 +13,7 @@ export enum Nux {
|
||||
/*
|
||||
* Blocking announcements. New IDs are required for each new announcement.
|
||||
*/
|
||||
BlockingAnnouncementPolicyUpdate202508 = 'BlockingAnnouncementPolicyUpdate202508',
|
||||
PolicyUpdate202508 = 'PolicyUpdate202508',
|
||||
}
|
||||
|
||||
export const nuxNames = new Set(Object.values(Nux))
|
||||
@@ -44,7 +44,7 @@ export type AppNux = BaseNux<
|
||||
data: undefined
|
||||
}
|
||||
| {
|
||||
id: Nux.BlockingAnnouncementPolicyUpdate202508
|
||||
id: Nux.PolicyUpdate202508
|
||||
data: undefined
|
||||
}
|
||||
>
|
||||
@@ -56,5 +56,5 @@ export const NuxSchemas: Record<Nux, zod.ZodObject<any> | undefined> = {
|
||||
[Nux.ActivitySubscriptions]: undefined,
|
||||
[Nux.AgeAssuranceDismissibleNotice]: undefined,
|
||||
[Nux.AgeAssuranceDismissibleFeedBanner]: undefined,
|
||||
[Nux.BlockingAnnouncementPolicyUpdate202508]: undefined,
|
||||
[Nux.PolicyUpdate202508]: undefined,
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {type ID as PolicyUpdate202508} from '#/components/dialogs/BlockingAnnouncements/announcements/PolicyUpdate202508/config'
|
||||
import {type ID as PolicyUpdate202508} from '#/components/PolicyUpdateOverlay/updates/202508/config'
|
||||
|
||||
/**
|
||||
* Device data that's specific to the device and does not vary based account
|
||||
@@ -17,9 +17,9 @@ export type Device = {
|
||||
activitySubscriptionsNudged?: boolean
|
||||
|
||||
/**
|
||||
* Blocking announcements. New IDs are required for each new announcement.
|
||||
* Policy update overlays. New IDs are required for each new announcement.
|
||||
*/
|
||||
blockingAnnouncementOverride?: boolean
|
||||
policyUpdateDebugOverride?: boolean
|
||||
[PolicyUpdate202508]?: boolean
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ import {Onboarding} from '#/screens/Onboarding'
|
||||
import {SignupQueued} from '#/screens/SignupQueued'
|
||||
import {Takendown} from '#/screens/Takendown'
|
||||
import {atoms as a, useLayoutBreakpoints} from '#/alf'
|
||||
import {BlockingAnnouncements} from '#/components/dialogs/BlockingAnnouncements'
|
||||
import {PolicyUpdateOverlay} from '#/components/PolicyUpdateOverlay'
|
||||
import {BottomBarWeb} from './bottom-bar/BottomBarWeb'
|
||||
import {DesktopLeftNav} from './desktop/LeftNav'
|
||||
import {DesktopRightNav} from './desktop/RightNav'
|
||||
@@ -168,7 +168,9 @@ function NativeStackNavigator({
|
||||
{!isMobile && <DesktopRightNav routeName={activeRoute.name} />}
|
||||
</>
|
||||
)}
|
||||
<BlockingAnnouncements />
|
||||
|
||||
{/* Only shown after logged in and onboaring etc are complete */}
|
||||
{hasSession && <PolicyUpdateOverlay />}
|
||||
</NavigationContent>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ import {InAppBrowserConsentDialog} from '#/components/dialogs/InAppBrowserConsen
|
||||
import {LinkWarningDialog} from '#/components/dialogs/LinkWarning'
|
||||
import {MutedWordsDialog} from '#/components/dialogs/MutedWords'
|
||||
import {SigninDialog} from '#/components/dialogs/Signin'
|
||||
import {Outlet as PolicyUpdateOverlayPortal} from '#/components/PolicyUpdateOverlay'
|
||||
import {Outlet as PortalOutlet} from '#/components/Portal'
|
||||
import {Outlet as BlockingAccouncementsPortalOutlet} from '#/components/dialogs/BlockingAnnouncements'
|
||||
import {RoutesContainer, TabsNavigator} from '#/Navigation'
|
||||
import {BottomSheetOutlet} from '../../../modules/bottom-sheet'
|
||||
import {updateActiveViewAsync} from '../../../modules/expo-bluesky-swiss-army/src/VisibilityView'
|
||||
@@ -165,7 +165,7 @@ function ShellInner() {
|
||||
<BottomSheetOutlet />
|
||||
|
||||
{/* MUST BE LAST */}
|
||||
<BlockingAccouncementsPortalOutlet />
|
||||
<PolicyUpdateOverlayPortal />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -18,11 +18,11 @@ import {ModalsContainer} from '#/view/com/modals/Modal'
|
||||
import {ErrorBoundary} from '#/view/com/util/ErrorBoundary'
|
||||
import {atoms as a, select, useTheme} from '#/alf'
|
||||
import {AgeAssuranceRedirectDialog} from '#/components/ageAssurance/AgeAssuranceRedirectDialog'
|
||||
import {Outlet as BlockingAccouncementsPortalOutlet} from '#/components/dialogs/BlockingAnnouncements'
|
||||
import {EmailDialog} from '#/components/dialogs/EmailDialog'
|
||||
import {LinkWarningDialog} from '#/components/dialogs/LinkWarning'
|
||||
import {MutedWordsDialog} from '#/components/dialogs/MutedWords'
|
||||
import {SigninDialog} from '#/components/dialogs/Signin'
|
||||
import {Outlet as PolicyUpdateOverlayPortal} from '#/components/PolicyUpdateOverlay'
|
||||
import {Outlet as PortalOutlet} from '#/components/Portal'
|
||||
import {FlatNavigator, RoutesContainer} from '#/Navigation'
|
||||
import {Composer} from './Composer.web'
|
||||
@@ -116,7 +116,7 @@ function ShellInner() {
|
||||
)}
|
||||
|
||||
{/* MUST BE LAST */}
|
||||
<BlockingAccouncementsPortalOutlet />
|
||||
<PolicyUpdateOverlayPortal />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user