[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>
This commit is contained in:
Eric Bailey
2025-08-06 15:15:52 -05:00
committed by GitHub
parent fd37d92f85
commit 328aa2be94
29 changed files with 1214 additions and 88 deletions
@@ -0,0 +1,7 @@
/*
* Keep this file separate to avoid import issues.
*/
import {Nux} from '#/state/queries/nuxs'
export const ID = Nux.PolicyUpdate202508
@@ -0,0 +1,190 @@
import {useCallback} from 'react'
import {View} from 'react-native'
import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {isAndroid} from '#/platform/detection'
import {useA11y} from '#/state/a11y'
import {atoms as a, useTheme} from '#/alf'
import {Button, ButtonText} from '#/components/Button'
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 Content({state}: {state: PolicyUpdateState}) {
const t = useTheme()
const {_} = useLingui()
const {screenReaderEnabled} = useA11y()
const handleClose = useCallback(() => {
state.complete()
}, [state])
const linkStyle = [a.text_md]
const links = {
terms: {
overridePresentation: false,
to: `https://bsky.social/about/support`,
label: _(msg`Terms of Service`),
},
privacy: {
overridePresentation: false,
to: `https://bsky.social/about/support`,
label: _(msg`Privacy Policy`),
},
copyright: {
overridePresentation: false,
to: `https://bsky.social/about/support`,
label: _(msg`Copyright Policy`),
},
guidelines: {
overridePresentation: false,
to: `https://bsky.social/about/support`,
label: _(msg`Community Guidelines`),
},
blog: {
overridePresentation: false,
to: `https://bsky.social/about/support`,
label: _(msg`Our blog post`),
},
}
const linkButtonStyles = {
overridePresentation: false,
color: 'secondary',
size: 'small',
} as const
const label = isAndroid
? _(
msg`We’re updating our Terms of Service, Privacy Policy, and Copyright Policy, effective September 12th, 2025. We're also updating our Community Guidelines, and we want your input! These new guidelines will take effect on October 13th, 2025. Learn more about these changes and how to share your thoughts with us by reading our blog post.`,
)
: _(msg`We're updating our policies`)
return (
<Overlay label={label}>
<View style={[a.align_start, a.gap_xl]}>
<Badge />
{screenReaderEnabled ? (
<View style={[a.gap_sm]}>
<Text emoji style={[a.text_2xl, a.font_bold, a.leading_snug]}>
<Trans>Hey there 👋</Trans>
</Text>
<Text style={[a.leading_snug, a.text_md]}>
<Trans>
We’re updating our Terms of Service, Privacy Policy, and
Copyright Policy, effective September 12th, 2025.
</Trans>
</Text>
<Text style={[a.leading_snug, a.text_md]}>
<Trans>
We're also updating our Community Guidelines, and we want your
input! These new guidelines will take effect on October 13th,
2025.
</Trans>
</Text>
<Text style={[a.leading_snug, a.text_md]}>
<Trans>
Learn more about these changes and how to share your thoughts
with us by reading our blog post.
</Trans>
</Text>
<Link {...links.terms} {...linkButtonStyles}>
<ButtonText>
<Trans>Terms of Service</Trans>
</ButtonText>
</Link>
<Link {...links.privacy} {...linkButtonStyles}>
<ButtonText>
<Trans>Privacy Policy</Trans>
</ButtonText>
</Link>
<Link {...links.copyright} {...linkButtonStyles}>
<ButtonText>
<Trans>Copyright Policy</Trans>
</ButtonText>
</Link>
<Link {...links.blog} {...linkButtonStyles}>
<ButtonText>
<Trans>Read our blog post</Trans>
</ButtonText>
</Link>
</View>
) : (
<View style={[a.gap_sm]}>
<Text emoji style={[a.text_2xl, a.font_bold, a.leading_snug]}>
<Trans>Hey there 👋</Trans>
</Text>
<Text style={[a.leading_snug, a.text_md]}>
<Trans>
We’re updating our{' '}
<InlineLinkText {...links.terms} style={linkStyle}>
Terms of Service
</InlineLinkText>
,{' '}
<InlineLinkText {...links.privacy} style={linkStyle}>
Privacy Policy
</InlineLinkText>
, and{' '}
<InlineLinkText {...links.copyright} style={linkStyle}>
Copyright Policy
</InlineLinkText>
, effective September 12th, 2025.
</Trans>
</Text>
<Text style={[a.leading_snug, a.text_md]}>
<Trans>
We're also updating our{' '}
<InlineLinkText {...links.guidelines} style={linkStyle}>
Community Guidelines
</InlineLinkText>
, and we want your input! These new guidelines will take effect
on October 13th, 2025.
</Trans>
</Text>
<Text style={[a.leading_snug, a.text_md]}>
<Trans>
Learn more about these changes and how to share your thoughts
with us by{' '}
<InlineLinkText {...links.blog} style={linkStyle}>
reading our blog post.
</InlineLinkText>
</Trans>
</Text>
</View>
)}
<View style={[a.w_full, a.gap_md]}>
<Button
label={_(msg`Continue`)}
accessibilityHint={_(
msg`Tap to acknowledge that you understand and agree to these updates and continue using Bluesky`,
)}
color="primary"
size="large"
onPress={handleClose}>
<ButtonText>
<Trans>Continue</Trans>
</ButtonText>
</Button>
<Text
style={[
a.leading_snug,
a.text_sm,
a.italic,
t.atoms.text_contrast_medium,
]}>
<Trans>
By clicking "Continue" you acknowledge that you understand and
agree to these updates.
</Trans>
</Text>
</View>
</View>
</Overlay>
)
}