this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Provide age-restricted viewers the option to delete their account (#10041)

authored by

DS Boyce and committed by
GitHub
7b5d5a4f 4737bfb7

+36 -4
+33 -3
src/ageAssurance/components/NoAccessScreen.tsx
··· 12 12 import {dateDiff, useGetTimeAgo} from '#/lib/hooks/useTimeAgo' 13 13 import {useIsBirthdateUpdateAllowed} from '#/state/birthdate' 14 14 import {useSessionApi} from '#/state/session' 15 + import {DeactivateAccountDialog} from '#/screens/Settings/components/DeactivateAccountDialog' 16 + import {DeleteAccountDialog} from '#/screens/Settings/components/DeleteAccountDialog' 15 17 import {atoms as a, useBreakpoints, useTheme, web} from '#/alf' 16 18 import {Admonition} from '#/components/Admonition' 17 19 import {AgeAssuranceAppealDialog} from '#/components/ageAssurance/AgeAssuranceAppealDialog' ··· 49 51 const {gtPhone} = useBreakpoints() 50 52 const insets = useSafeAreaInsets() 51 53 const birthdateControl = useDialogControl() 54 + const deactivateAccountControl = useDialogControl() 55 + const deleteAccountControl = useDialogControl() 52 56 const {data} = useAgeAssuranceDataContext() 53 57 const region = useAgeAssuranceRegionConfig() 54 58 const isBirthdateUpdateAllowed = useIsBirthdateUpdateAllowed() ··· 71 75 hasDeclaredAge, 72 76 canUpdateBirthday, 73 77 }) 78 + // TODO This can be cleaned up with useEffectEvent once we're on 19.2 74 79 // eslint-disable-next-line react-hooks/exhaustive-deps 75 80 }, []) 76 81 ··· 234 239 </View> 235 240 )} 236 241 237 - <View style={[a.pt_lg, a.gap_xl]}> 242 + <View style={[a.pt_lg, a.gap_xl, {maxWidth: 280}]}> 238 243 <Logo width={120} textFill={t.atoms.text.color} /> 239 - <Text style={[a.text_sm, a.italic, t.atoms.text_contrast_medium]}> 244 + <Text 245 + style={[ 246 + a.text_sm, 247 + a.italic, 248 + a.leading_snug, 249 + t.atoms.text_contrast_medium, 250 + ]}> 240 251 <Trans> 241 252 To log out,{' '} 242 253 <SimpleInlineLinkText 243 254 label={_(msg`Click here to log out`)} 244 255 {...createStaticClick(() => { 245 256 onPressLogout() 246 - })}> 257 + })} 258 + style={[a.italic]}> 247 259 click here 248 260 </SimpleInlineLinkText> 261 + . Or if you’d prefer, you can{' '} 262 + <SimpleInlineLinkText 263 + label={_(msg`Click here to delete your account`)} 264 + {...createStaticClick(() => { 265 + ax.metric( 266 + 'ageAssurance:noAccessScreen:openDeleteAccountDialog', 267 + {}, 268 + ) 269 + deleteAccountControl.open() 270 + })} 271 + style={[a.italic]}> 272 + delete your account 273 + </SimpleInlineLinkText> 249 274 . 250 275 </Trans> 251 276 </Text> ··· 255 280 </View> 256 281 257 282 <BirthDateSettingsDialog control={birthdateControl} /> 283 + <DeactivateAccountDialog control={deactivateAccountControl} /> 284 + <DeleteAccountDialog 285 + control={deleteAccountControl} 286 + deactivateDialogControl={deactivateAccountControl} 287 + /> 258 288 259 289 {/* 260 290 * While this blocking overlay is up, other dialogs in the shell
+1
src/analytics/metrics/types.ts
··· 847 847 canUpdateBirthday: boolean 848 848 } 849 849 'ageAssurance:noAccessScreen:openBirthdateDialog': {} 850 + 'ageAssurance:noAccessScreen:openDeleteAccountDialog': {} 850 851 851 852 /* 852 853 * Specifically for the `BlockedGeoOverlay`
+2 -1
src/state/birthdate.ts
··· 43 43 ]) 44 44 if (!lastUpdated) return true 45 45 const lastUpdatedDate = new Date(lastUpdated) 46 + // eslint-disable-next-line react-hooks/purity 46 47 const diffMs = Date.now() - lastUpdatedDate.getTime() 47 48 const diffHours = diffMs / (1000 * 60 * 60) 48 49 return diffHours >= BIRTHDATE_DELAY_HOURS ··· 66 67 * Also patch the age assurance other required data with the new 67 68 * birthdate, which may change the user's age assurance access level. 68 69 */ 69 - patchOtherRequiredData({birthdate: bday}) 70 + void patchOtherRequiredData({birthdate: bday}) 70 71 snoozeBirthdateUpdateAllowedForDid(agent.sessionManager.did!) 71 72 }, 72 73 })