Bluesky app fork with some witchin' additions 💫 witchsky.app
bluesky fork client

Add attribution for starter pack follows (#9834)

authored by samuel.fm and committed by

GitHub 3be1f5ca 18eea81e

+22 -7
+7 -4
src/screens/Onboarding/StepFinished/index.tsx
··· 96 const {selectedInterests} = interestsStepResults 97 98 await Promise.all([ 99 - bulkWriteFollows(agent, [ 100 - BSKY_APP_ACCOUNT_DID, 101 - ...(listItems?.map(i => i.subject.did) ?? []), 102 - ]), 103 (async () => { 104 // Interests need to get saved first, then we can write the feeds to prefs 105 await agent.setInterestsPref({tags: selectedInterests})
··· 96 const {selectedInterests} = interestsStepResults 97 98 await Promise.all([ 99 + bulkWriteFollows( 100 + agent, 101 + [BSKY_APP_ACCOUNT_DID, ...(listItems?.map(i => i.subject.did) ?? [])], 102 + starterPack 103 + ? {uri: starterPack.uri, cid: starterPack.cid} 104 + : undefined, 105 + ), 106 (async () => { 107 // Interests need to get saved first, then we can write the feeds to prefs 108 await agent.setInterestsPref({tags: selectedInterests})
+4 -1
src/screens/Onboarding/StepSuggestedStarterpacks/StarterPackCard.tsx
··· 72 73 let followUris: Map<string, string> 74 try { 75 - followUris = await bulkWriteFollows(agent, dids) 76 } catch (e) { 77 setIsProcessing(false) 78 Toast.show(_(msg`An error occurred while trying to follow all`), {
··· 72 73 let followUris: Map<string, string> 74 try { 75 + followUris = await bulkWriteFollows(agent, dids, { 76 + uri: view.uri, 77 + cid: view.cid, 78 + }) 79 } catch (e) { 80 setIsProcessing(false) 81 Toast.show(_(msg`An error occurred while trying to follow all`), {
+7 -1
src/screens/Onboarding/util.ts
··· 4 type AppBskyGraphGetFollows, 5 type BskyAgent, 6 type ComAtprotoRepoApplyWrites, 7 } from '@atproto/api' 8 import {TID} from '@atproto/common-web' 9 import chunk from 'lodash.chunk' 10 11 import {until} from '#/lib/async/until' 12 13 - export async function bulkWriteFollows(agent: BskyAgent, dids: string[]) { 14 const session = agent.session 15 16 if (!session) { ··· 22 $type: 'app.bsky.graph.follow', 23 subject: did, 24 createdAt: new Date().toISOString(), 25 } 26 }) 27
··· 4 type AppBskyGraphGetFollows, 5 type BskyAgent, 6 type ComAtprotoRepoApplyWrites, 7 + type ComAtprotoRepoStrongRef, 8 } from '@atproto/api' 9 import {TID} from '@atproto/common-web' 10 import chunk from 'lodash.chunk' 11 12 import {until} from '#/lib/async/until' 13 14 + export async function bulkWriteFollows( 15 + agent: BskyAgent, 16 + dids: string[], 17 + via?: ComAtprotoRepoStrongRef.Main, 18 + ) { 19 const session = agent.session 20 21 if (!session) { ··· 27 $type: 'app.bsky.graph.follow', 28 subject: did, 29 createdAt: new Date().toISOString(), 30 + via, 31 } 32 }) 33
+4 -1
src/screens/StarterPack/StarterPackScreen.tsx
··· 372 373 let followUris: Map<string, string> 374 try { 375 - followUris = await bulkWriteFollows(agent, dids) 376 } catch (e) { 377 setIsProcessing(false) 378 Toast.show(_(msg`An error occurred while trying to follow all`), 'xmark')
··· 372 373 let followUris: Map<string, string> 374 try { 375 + followUris = await bulkWriteFollows(agent, dids, { 376 + uri: starterPack.uri, 377 + cid: starterPack.cid, 378 + }) 379 } catch (e) { 380 setIsProcessing(false) 381 Toast.show(_(msg`An error occurred while trying to follow all`), 'xmark')