diff options
Diffstat (limited to 'src/screens/Onboarding/StepFinished.tsx')
-rw-r--r-- | src/screens/Onboarding/StepFinished.tsx | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/screens/Onboarding/StepFinished.tsx b/src/screens/Onboarding/StepFinished.tsx index 33d27cf66..d0b0cacca 100644 --- a/src/screens/Onboarding/StepFinished.tsx +++ b/src/screens/Onboarding/StepFinished.tsx @@ -1,6 +1,11 @@ import React from 'react' import {View} from 'react-native' -import {AppBskyGraphDefs, AppBskyGraphStarterpack} from '@atproto/api' +import { + AppBskyActorProfile, + AppBskyGraphDefs, + AppBskyGraphStarterpack, + Un$Typed, +} from '@atproto/api' import {SavedFeed} from '@atproto/api/dist/client/types/app/bsky/actor/defs' import {TID} from '@atproto/common-web' import {msg, Trans} from '@lingui/macro' @@ -44,6 +49,7 @@ import {News2_Stroke2_Corner0_Rounded as News} from '#/components/icons/News2' import {Trending2_Stroke2_Corner2_Rounded as Trending} from '#/components/icons/Trending2' import {Loader} from '#/components/Loader' import {Text} from '#/components/Typography' +import * as bsky from '#/types/bsky' export function StepFinished() { const {_} = useLingui() @@ -141,29 +147,29 @@ export function StepFinished() { : undefined await agent.upsertProfile(async existing => { - existing = existing ?? {} + let next: Un$Typed<AppBskyActorProfile.Record> = existing ?? {} if (blobPromise) { const res = await blobPromise if (res.data.blob) { - existing.avatar = res.data.blob + next.avatar = res.data.blob } } if (starterPack) { - existing.joinedViaStarterPack = { + next.joinedViaStarterPack = { uri: starterPack.uri, cid: starterPack.cid, } } - existing.displayName = '' + next.displayName = '' // HACKFIX // creating a bunch of identical profile objects is breaking the relay // tossing this unspecced field onto it to reduce the size of the problem // -prf - existing.createdAt = new Date().toISOString() - return existing + next.createdAt = new Date().toISOString() + return next }) logEvent('onboarding:finished:avatarResult', { @@ -205,9 +211,14 @@ export function StepFinished() { onboardDispatch({type: 'finish'}) logEvent('onboarding:finished:nextPressed', { usedStarterPack: Boolean(starterPack), - starterPackName: AppBskyGraphStarterpack.isRecord(starterPack?.record) - ? starterPack.record.name - : undefined, + starterPackName: + starterPack && + bsky.dangerousIsType<AppBskyGraphStarterpack.Record>( + starterPack.record, + AppBskyGraphStarterpack.isRecord, + ) + ? starterPack.record.name + : undefined, starterPackCreator: starterPack?.creator.did, starterPackUri: starterPack?.uri, profilesFollowed: listItems?.length ?? 0, |