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