better handling
This commit is contained in:
@@ -83,14 +83,26 @@ export function StepFinished() {
|
||||
(async () => {
|
||||
// Interests need to get saved first, then we can write the feeds to prefs
|
||||
await agent.setInterestsPref({tags: selectedInterests})
|
||||
if (starterPack?.feeds?.length) {
|
||||
await agent.addSavedFeeds(
|
||||
starterPack.feeds.map(f => ({
|
||||
type: 'feed',
|
||||
value: f.uri,
|
||||
pinned: true,
|
||||
})),
|
||||
)
|
||||
if (starterPack) {
|
||||
if (starterPack.feeds?.length) {
|
||||
await agent.addSavedFeeds(
|
||||
starterPack.feeds.map(f => ({
|
||||
type: 'feed',
|
||||
value: f.uri,
|
||||
pinned: true,
|
||||
})),
|
||||
)
|
||||
setCurrentStarterPack({
|
||||
uri: '',
|
||||
initialFeed: starterPack.feeds?.[0].uri,
|
||||
})
|
||||
} else {
|
||||
setCurrentStarterPack({
|
||||
uri: '',
|
||||
initialFeed: 'following',
|
||||
})
|
||||
}
|
||||
addUsedStarterPack(makeStarterPackLink(starterPack))
|
||||
}
|
||||
})(),
|
||||
(async () => {
|
||||
@@ -135,17 +147,12 @@ export function StepFinished() {
|
||||
})(),
|
||||
requestNotificationsPermission('AfterOnboarding'),
|
||||
])
|
||||
|
||||
if (currentStarterPack && starterPack) {
|
||||
setCurrentStarterPack({
|
||||
...currentStarterPack,
|
||||
initialFeed: starterPack?.feeds?.[0].uri ?? 'following',
|
||||
})
|
||||
addUsedStarterPack(makeStarterPackLink(starterPack))
|
||||
}
|
||||
} catch (e: any) {
|
||||
logger.info(`onboarding: bulk save failed`)
|
||||
logger.error(e)
|
||||
// If there was an error encountered, we need to just clear the starter pack so we don't break things for subsequent
|
||||
// app restarts
|
||||
setCurrentStarterPack(undefined)
|
||||
// don't alert the user, just let them into their account
|
||||
}
|
||||
|
||||
@@ -177,8 +184,8 @@ export function StepFinished() {
|
||||
currentStarterPack,
|
||||
state,
|
||||
requestNotificationsPermission,
|
||||
setCurrentStarterPack,
|
||||
addUsedStarterPack,
|
||||
setCurrentStarterPack,
|
||||
])
|
||||
|
||||
React.useEffect(() => {
|
||||
|
||||
@@ -105,13 +105,10 @@ function HomeScreenReady({
|
||||
let initialIndex = selectedIndex
|
||||
if (currentStarterPack?.initialFeed) {
|
||||
if (currentStarterPack.initialFeed === 'following') {
|
||||
initialIndex = allFeeds.findIndex(f => f === 'following')
|
||||
} else {
|
||||
initialIndex = allFeeds.findIndex(
|
||||
f => f === `feedgen|${currentStarterPack.initialFeed}`,
|
||||
)
|
||||
}
|
||||
if (initialIndex === -1) {
|
||||
initialIndex = 1
|
||||
} else if (allFeeds.length >= 3) {
|
||||
initialIndex = 2
|
||||
} else if (initialIndex === -1) {
|
||||
initialIndex = 0
|
||||
}
|
||||
setCurrentStarterPack(undefined)
|
||||
|
||||
Reference in New Issue
Block a user