simplify logic to avoid reusing starter pack flowo n native
This commit is contained in:
@@ -3,20 +3,20 @@ import React from 'react'
|
||||
import {createStarterPackLinkFromAndroidReferrer} from 'lib/strings/starter-pack'
|
||||
import {isAndroid} from 'platform/detection'
|
||||
import {useSetCurrentStarterPack} from 'state/preferences/starter-pack'
|
||||
import {useUsedStarterPacks} from 'state/preferences/used-starter-packs'
|
||||
import {useHasCheckedForStarterPack} from 'state/preferences/used-starter-packs'
|
||||
import SwissArmyKnife from '../../../modules/expo-bluesky-swiss-army'
|
||||
import GooglePlayReferrer from '../../../modules/expo-google-play-referrer'
|
||||
|
||||
export function useStarterPackEntry() {
|
||||
const [ready, setReady] = React.useState(false)
|
||||
const setCurrentStarterPack = useSetCurrentStarterPack()
|
||||
const usedStarterPacks = useUsedStarterPacks()
|
||||
const hasRan = React.useRef(false)
|
||||
const hasCheckedForStarterPack = useHasCheckedForStarterPack()
|
||||
const setHasCheckedForStarterPack = useHasCheckedForStarterPack()
|
||||
|
||||
React.useEffect(() => {
|
||||
if (ready || hasRan.current) return
|
||||
if (ready || hasCheckedForStarterPack) return
|
||||
|
||||
hasRan.current = true
|
||||
setHasCheckedForStarterPack(true)
|
||||
;(async () => {
|
||||
let uri: string | null | undefined
|
||||
|
||||
@@ -38,7 +38,12 @@ export function useStarterPackEntry() {
|
||||
|
||||
setReady(true)
|
||||
})()
|
||||
}, [ready, setCurrentStarterPack, usedStarterPacks])
|
||||
}, [
|
||||
ready,
|
||||
setCurrentStarterPack,
|
||||
setHasCheckedForStarterPack,
|
||||
hasCheckedForStarterPack,
|
||||
])
|
||||
|
||||
return ready
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user