Toast device verification outcomes on NoAccessScreen
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -40,6 +40,7 @@ import {
|
|||||||
useAgeAssuranceServerDataContext,
|
useAgeAssuranceServerDataContext,
|
||||||
} from '#/ageAssurance/data'
|
} from '#/ageAssurance/data'
|
||||||
import {logger} from '#/ageAssurance/logger'
|
import {logger} from '#/ageAssurance/logger'
|
||||||
|
import {unsafeGetAndComputeAgeAssurance} from '#/ageAssurance/state'
|
||||||
import {useComputeAgeAssuranceRegionAccess} from '#/ageAssurance/useComputeAgeAssuranceRegionAccess'
|
import {useComputeAgeAssuranceRegionAccess} from '#/ageAssurance/useComputeAgeAssuranceRegionAccess'
|
||||||
import {
|
import {
|
||||||
getAgeAssuranceDataFromDeviceSignals,
|
getAgeAssuranceDataFromDeviceSignals,
|
||||||
@@ -367,12 +368,35 @@ function AccessSection() {
|
|||||||
signals,
|
signals,
|
||||||
)
|
)
|
||||||
if (assuredAge !== undefined) {
|
if (assuredAge !== undefined) {
|
||||||
// Sufficient device signals: persist (keyed by this region) and let
|
// Persist (keyed by this region) so the AA state recomputes from the
|
||||||
// the AA state recompute from the cache write unlock access. Nothing
|
// cache write. Recompute here too so we can react to the outcome: a
|
||||||
// else to do here.
|
// sufficient age lifts the gate (nothing more to do), but the device
|
||||||
|
// may report an age below the region's threshold, in which case
|
||||||
|
// access stays `none` and we tell the user.
|
||||||
setDeviceSignalsForRegion({did, region, signals})
|
setDeviceSignalsForRegion({did, region, signals})
|
||||||
|
const {state} = unsafeGetAndComputeAgeAssurance({did})
|
||||||
|
if (state.access === aa.Access.None) {
|
||||||
|
Toast.show(
|
||||||
|
_(
|
||||||
|
msg`We're sorry, but based on the data shared by your device, you are not old enough to access Bluesky.`,
|
||||||
|
),
|
||||||
|
{type: 'info'},
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Toast.show(_(msg`Thanks! You're all set.`), {
|
||||||
|
type: 'success',
|
||||||
|
})
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// We got a device response but it carried no usable age information.
|
||||||
|
Toast.show(
|
||||||
|
_(
|
||||||
|
msg`Hmm, it seems your device was unable to share age information with us.`,
|
||||||
|
),
|
||||||
|
{type: 'warning'},
|
||||||
|
)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
logger.debug(
|
logger.debug(
|
||||||
`onPressVerify: device signals unavailable or insufficient, falling back to KWS`,
|
`onPressVerify: device signals unavailable or insufficient, falling back to KWS`,
|
||||||
@@ -380,7 +404,14 @@ function AccessSection() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
openKwsDialog()
|
openKwsDialog()
|
||||||
}, [region, currentAccount?.did, openKwsDialog])
|
}, [
|
||||||
|
region,
|
||||||
|
currentAccount?.did,
|
||||||
|
openKwsDialog,
|
||||||
|
allowsDeviceVerification,
|
||||||
|
aa,
|
||||||
|
_,
|
||||||
|
])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
Reference in New Issue
Block a user