move onboarding to screens
This commit is contained in:
parent
84e065667a
commit
edfd326069
11 changed files with 149 additions and 107 deletions
|
@ -31,7 +31,7 @@ const POLL_FREQ = 30e3 // 30sec
|
|||
|
||||
type Props = NativeStackScreenProps<HomeTabNavigatorParams, 'Home'>
|
||||
export const HomeScreen = withAuthRequired(
|
||||
observer((_opts: Props) => {
|
||||
observer(({navigation}: Props) => {
|
||||
const store = useStores()
|
||||
const pagerRef = React.useRef<PagerRef>(null)
|
||||
const [selectedPage, setSelectedPage] = React.useState(0)
|
||||
|
@ -40,6 +40,12 @@ export const HomeScreen = withAuthRequired(
|
|||
string[]
|
||||
>([])
|
||||
|
||||
React.useEffect(() => {
|
||||
if (store.onboarding.isRemaining) {
|
||||
navigation.navigate('Welcome')
|
||||
}
|
||||
}, [store.onboarding.isRemaining, navigation])
|
||||
|
||||
React.useEffect(() => {
|
||||
const {pinned} = store.me.savedFeeds
|
||||
|
||||
|
|
|
@ -162,6 +162,11 @@ export const SettingsScreen = withAuthRequired(
|
|||
Toast.show('Preferences reset')
|
||||
}, [store])
|
||||
|
||||
const onPressResetOnboarding = React.useCallback(async () => {
|
||||
store.onboarding.reset()
|
||||
Toast.show('Onboarding reset')
|
||||
}, [store])
|
||||
|
||||
const onPressBuildInfo = React.useCallback(() => {
|
||||
Clipboard.setString(
|
||||
`Build version: ${AppInfo.appVersion}; Platform: ${Platform.OS}`,
|
||||
|
@ -535,6 +540,16 @@ export const SettingsScreen = withAuthRequired(
|
|||
Reset preferences state
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
<TouchableOpacity
|
||||
style={[pal.view, styles.linkCardNoIcon]}
|
||||
onPress={onPressResetOnboarding}
|
||||
accessibilityRole="button"
|
||||
accessibilityHint="Reset onboarding"
|
||||
accessibilityLabel="Resets the onboarding state">
|
||||
<Text type="lg" style={pal.text}>
|
||||
Reset onboarding state
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
</>
|
||||
) : null}
|
||||
<View style={[styles.footer]}>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue