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

remove imports from @atproto/api internals (#8403)

authored by samuel.fm and committed by

GitHub 338fa4df bf869d91

+58 -47
+8 -6
src/components/StarterPack/Main/FeedsList.tsx
··· 1 import React, {useCallback} from 'react' 2 - import {ListRenderItemInfo, View} from 'react-native' 3 - import {AppBskyFeedDefs} from '@atproto/api' 4 - import {GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs' 5 6 import {useBottomBarOffset} from '#/lib/hooks/useBottomBarOffset' 7 import {isNative, isWeb} from '#/platform/detection' 8 - import {List, ListRef} from '#/view/com/util/List' 9 - import {SectionRef} from '#/screens/Profile/Sections/types' 10 import {atoms as a, useTheme} from '#/alf' 11 import * as FeedCard from '#/components/FeedCard' 12 ··· 37 scrollToTop: onScrollToTop, 38 })) 39 40 - const renderItem = ({item, index}: ListRenderItemInfo<GeneratorView>) => { 41 return ( 42 <View 43 style={[
··· 1 import React, {useCallback} from 'react' 2 + import {type ListRenderItemInfo, View} from 'react-native' 3 + import {type AppBskyFeedDefs} from '@atproto/api' 4 5 import {useBottomBarOffset} from '#/lib/hooks/useBottomBarOffset' 6 import {isNative, isWeb} from '#/platform/detection' 7 + import {List, type ListRef} from '#/view/com/util/List' 8 + import {type SectionRef} from '#/screens/Profile/Sections/types' 9 import {atoms as a, useTheme} from '#/alf' 10 import * as FeedCard from '#/components/FeedCard' 11 ··· 36 scrollToTop: onScrollToTop, 37 })) 38 39 + const renderItem = ({ 40 + item, 41 + index, 42 + }: ListRenderItemInfo<AppBskyFeedDefs.GeneratorView>) => { 43 return ( 44 <View 45 style={[
+12 -6
src/components/StarterPack/Wizard/WizardEditListDialog.tsx
··· 1 import {useRef} from 'react' 2 - import type {ListRenderItemInfo} from 'react-native' 3 import {View} from 'react-native' 4 - import {AppBskyActorDefs, ModerationOpts} from '@atproto/api' 5 - import {GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs' 6 import {msg, Trans} from '@lingui/macro' 7 import {useLingui} from '@lingui/react' 8 9 import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender' 10 import {isWeb} from '#/platform/detection' 11 import {useSession} from '#/state/session' 12 - import {ListMethods} from '#/view/com/util/List' 13 - import {WizardAction, WizardState} from '#/screens/StarterPack/Wizard/State' 14 import {atoms as a, native, useTheme, web} from '#/alf' 15 import {Button, ButtonText} from '#/components/Button' 16 import * as Dialog from '#/components/Dialog' ··· 21 import {Text} from '#/components/Typography' 22 23 function keyExtractor( 24 - item: AppBskyActorDefs.ProfileViewBasic | GeneratorView, 25 index: number, 26 ) { 27 return `${item.did}-${index}`
··· 1 import {useRef} from 'react' 2 + import {type ListRenderItemInfo} from 'react-native' 3 import {View} from 'react-native' 4 + import { 5 + type AppBskyActorDefs, 6 + type AppBskyFeedDefs, 7 + type ModerationOpts, 8 + } from '@atproto/api' 9 import {msg, Trans} from '@lingui/macro' 10 import {useLingui} from '@lingui/react' 11 12 import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender' 13 import {isWeb} from '#/platform/detection' 14 import {useSession} from '#/state/session' 15 + import {type ListMethods} from '#/view/com/util/List' 16 + import { 17 + type WizardAction, 18 + type WizardState, 19 + } from '#/screens/StarterPack/Wizard/State' 20 import {atoms as a, native, useTheme, web} from '#/alf' 21 import {Button, ButtonText} from '#/components/Button' 22 import * as Dialog from '#/components/Dialog' ··· 27 import {Text} from '#/components/Typography' 28 29 function keyExtractor( 30 + item: AppBskyActorDefs.ProfileViewBasic | AppBskyFeedDefs.GeneratorView, 31 index: number, 32 ) { 33 return `${item.did}-${index}`
+10 -8
src/components/StarterPack/Wizard/WizardListCard.tsx
··· 1 import {Keyboard, View} from 'react-native' 2 import { 3 - AppBskyActorDefs, 4 - AppBskyFeedDefs, 5 moderateFeedGenerator, 6 moderateProfile, 7 - ModerationOpts, 8 - ModerationUI, 9 } from '@atproto/api' 10 - import {GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs' 11 import {msg, Trans} from '@lingui/macro' 12 import {useLingui} from '@lingui/react' 13 ··· 16 import {sanitizeHandle} from '#/lib/strings/handles' 17 import {useSession} from '#/state/session' 18 import {UserAvatar} from '#/view/com/util/UserAvatar' 19 - import {WizardAction, WizardState} from '#/screens/StarterPack/Wizard/State' 20 import {atoms as a, useTheme} from '#/alf' 21 import {Button, ButtonText} from '#/components/Button' 22 import * as Toggle from '#/components/forms/Toggle' 23 import {Checkbox} from '#/components/forms/Toggle' 24 import {Text} from '#/components/Typography' 25 - import * as bsky from '#/types/bsky' 26 27 function WizardListCard({ 28 type, ··· 174 moderationOpts, 175 }: { 176 btnType: 'checkbox' | 'remove' 177 - generator: GeneratorView 178 state: WizardState 179 dispatch: (action: WizardAction) => void 180 moderationOpts: ModerationOpts
··· 1 import {Keyboard, View} from 'react-native' 2 import { 3 + type AppBskyActorDefs, 4 + type AppBskyFeedDefs, 5 moderateFeedGenerator, 6 moderateProfile, 7 + type ModerationOpts, 8 + type ModerationUI, 9 } from '@atproto/api' 10 import {msg, Trans} from '@lingui/macro' 11 import {useLingui} from '@lingui/react' 12 ··· 15 import {sanitizeHandle} from '#/lib/strings/handles' 16 import {useSession} from '#/state/session' 17 import {UserAvatar} from '#/view/com/util/UserAvatar' 18 + import { 19 + type WizardAction, 20 + type WizardState, 21 + } from '#/screens/StarterPack/Wizard/State' 22 import {atoms as a, useTheme} from '#/alf' 23 import {Button, ButtonText} from '#/components/Button' 24 import * as Toggle from '#/components/forms/Toggle' 25 import {Checkbox} from '#/components/forms/Toggle' 26 import {Text} from '#/components/Typography' 27 + import type * as bsky from '#/types/bsky' 28 29 function WizardListCard({ 30 type, ··· 176 moderationOpts, 177 }: { 178 btnType: 'checkbox' | 'remove' 179 + generator: AppBskyFeedDefs.GeneratorView 180 state: WizardState 181 dispatch: (action: WizardAction) => void 182 moderationOpts: ModerationOpts
+3 -3
src/screens/Hashtag.tsx
··· 1 import React from 'react' 2 import {type ListRenderItemInfo, View} from 'react-native' 3 - import {type PostView} from '@atproto/api/dist/client/types/app/bsky/feed/defs' 4 import {msg} from '@lingui/macro' 5 import {useLingui} from '@lingui/react' 6 import {useFocusEffect} from '@react-navigation/native' ··· 25 import * as Layout from '#/components/Layout' 26 import {ListFooter, ListMaybePlaceholder} from '#/components/Lists' 27 28 - const renderItem = ({item}: ListRenderItemInfo<PostView>) => { 29 return <Post post={item} /> 30 } 31 32 - const keyExtractor = (item: PostView, index: number) => { 33 return `${item.uri}-${index}` 34 } 35
··· 1 import React from 'react' 2 import {type ListRenderItemInfo, View} from 'react-native' 3 + import {type AppBskyFeedDefs} from '@atproto/api' 4 import {msg} from '@lingui/macro' 5 import {useLingui} from '@lingui/react' 6 import {useFocusEffect} from '@react-navigation/native' ··· 25 import * as Layout from '#/components/Layout' 26 import {ListFooter, ListMaybePlaceholder} from '#/components/Lists' 27 28 + const renderItem = ({item}: ListRenderItemInfo<AppBskyFeedDefs.PostView>) => { 29 return <Post post={item} /> 30 } 31 32 + const keyExtractor = (item: AppBskyFeedDefs.PostView, index: number) => { 33 return `${item.uri}-${index}` 34 } 35
+2 -2
src/screens/Onboarding/StepFinished.tsx
··· 1 import React from 'react' 2 import {View} from 'react-native' 3 import { 4 type AppBskyActorProfile, 5 type AppBskyGraphDefs, 6 AppBskyGraphStarterpack, 7 type Un$Typed, 8 } from '@atproto/api' 9 - import {type SavedFeed} from '@atproto/api/dist/client/types/app/bsky/actor/defs' 10 import {TID} from '@atproto/common-web' 11 import {msg, Trans} from '@lingui/macro' 12 import {useLingui} from '@lingui/react' ··· 108 await agent.setInterestsPref({tags: selectedInterests}) 109 110 // Default feeds that every user should have pinned when landing in the app 111 - const feedsToSave: SavedFeed[] = [ 112 { 113 ...DISCOVER_SAVED_FEED, 114 id: TID.nextStr(),
··· 1 import React from 'react' 2 import {View} from 'react-native' 3 import { 4 + type AppBskyActorDefs, 5 type AppBskyActorProfile, 6 type AppBskyGraphDefs, 7 AppBskyGraphStarterpack, 8 type Un$Typed, 9 } from '@atproto/api' 10 import {TID} from '@atproto/common-web' 11 import {msg, Trans} from '@lingui/macro' 12 import {useLingui} from '@lingui/react' ··· 108 await agent.setInterestsPref({tags: selectedInterests}) 109 110 // Default feeds that every user should have pinned when landing in the app 111 + const feedsToSave: AppBskyActorDefs.SavedFeed[] = [ 112 { 113 ...DISCOVER_SAVED_FEED, 114 id: TID.nextStr(),
+7 -4
src/screens/StarterPack/Wizard/State.tsx
··· 1 import React from 'react' 2 - import {type AppBskyGraphDefs, AppBskyGraphStarterpack} from '@atproto/api' 3 - import {type GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs' 4 import {msg, plural} from '@lingui/macro' 5 6 import {STARTER_PACK_MAX_SIZE} from '#/lib/constants' ··· 19 | {type: 'SetDescription'; description: string} 20 | {type: 'AddProfile'; profile: bsky.profile.AnyProfileView} 21 | {type: 'RemoveProfile'; profileDid: string} 22 - | {type: 'AddFeed'; feed: GeneratorView} 23 | {type: 'RemoveFeed'; feedUri: string} 24 | {type: 'SetProcessing'; processing: boolean} 25 | {type: 'SetError'; error: string} ··· 30 name?: string 31 description?: string 32 profiles: bsky.profile.AnyProfileView[] 33 - feeds: GeneratorView[] 34 processing: boolean 35 error?: string 36 transitionDirection: 'Backward' | 'Forward'
··· 1 import React from 'react' 2 + import { 3 + type AppBskyFeedDefs, 4 + type AppBskyGraphDefs, 5 + AppBskyGraphStarterpack, 6 + } from '@atproto/api' 7 import {msg, plural} from '@lingui/macro' 8 9 import {STARTER_PACK_MAX_SIZE} from '#/lib/constants' ··· 22 | {type: 'SetDescription'; description: string} 23 | {type: 'AddProfile'; profile: bsky.profile.AnyProfileView} 24 | {type: 'RemoveProfile'; profileDid: string} 25 + | {type: 'AddFeed'; feed: AppBskyFeedDefs.GeneratorView} 26 | {type: 'RemoveFeed'; feedUri: string} 27 | {type: 'SetProcessing'; processing: boolean} 28 | {type: 'SetError'; error: string} ··· 33 name?: string 34 description?: string 35 profiles: bsky.profile.AnyProfileView[] 36 + feeds: AppBskyFeedDefs.GeneratorView[] 37 processing: boolean 38 error?: string 39 transitionDirection: 'Backward' | 'Forward'
+4 -2
src/screens/StarterPack/Wizard/index.tsx
··· 5 import {Image} from 'expo-image' 6 import { 7 type AppBskyActorDefs, 8 type AppBskyGraphDefs, 9 AtUri, 10 type ModerationOpts, 11 } from '@atproto/api' 12 - import {type GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs' 13 import {msg, Plural, Trans} from '@lingui/macro' 14 import {useLingui} from '@lingui/react' 15 import {useFocusEffect, useNavigation} from '@react-navigation/native' ··· 591 ) 592 } 593 594 - function getName(item: bsky.profile.AnyProfileView | GeneratorView) { 595 if (typeof item.displayName === 'string') { 596 return enforceLen(sanitizeDisplayName(item.displayName), 28, true) 597 } else if ('handle' in item && typeof item.handle === 'string') {
··· 5 import {Image} from 'expo-image' 6 import { 7 type AppBskyActorDefs, 8 + type AppBskyFeedDefs, 9 type AppBskyGraphDefs, 10 AtUri, 11 type ModerationOpts, 12 } from '@atproto/api' 13 import {msg, Plural, Trans} from '@lingui/macro' 14 import {useLingui} from '@lingui/react' 15 import {useFocusEffect, useNavigation} from '@react-navigation/native' ··· 591 ) 592 } 593 594 + function getName( 595 + item: bsky.profile.AnyProfileView | AppBskyFeedDefs.GeneratorView, 596 + ) { 597 if (typeof item.displayName === 'string') { 598 return enforceLen(sanitizeDisplayName(item.displayName), 28, true) 599 } else if ('handle' in item && typeof item.handle === 'string') {
+3 -3
src/screens/Topic.tsx
··· 1 import React from 'react' 2 import {type ListRenderItemInfo, View} from 'react-native' 3 - import {type PostView} from '@atproto/api/dist/client/types/app/bsky/feed/defs' 4 import {msg} from '@lingui/macro' 5 import {useLingui} from '@lingui/react' 6 import {useFocusEffect} from '@react-navigation/native' ··· 24 import * as Layout from '#/components/Layout' 25 import {ListFooter, ListMaybePlaceholder} from '#/components/Lists' 26 27 - const renderItem = ({item}: ListRenderItemInfo<PostView>) => { 28 return <Post post={item} /> 29 } 30 31 - const keyExtractor = (item: PostView, index: number) => { 32 return `${item.uri}-${index}` 33 } 34
··· 1 import React from 'react' 2 import {type ListRenderItemInfo, View} from 'react-native' 3 + import {type AppBskyFeedDefs} from '@atproto/api' 4 import {msg} from '@lingui/macro' 5 import {useLingui} from '@lingui/react' 6 import {useFocusEffect} from '@react-navigation/native' ··· 24 import * as Layout from '#/components/Layout' 25 import {ListFooter, ListMaybePlaceholder} from '#/components/Lists' 26 27 + const renderItem = ({item}: ListRenderItemInfo<AppBskyFeedDefs.PostView>) => { 28 return <Post post={item} /> 29 } 30 31 + const keyExtractor = (item: AppBskyFeedDefs.PostView, index: number) => { 32 return `${item.uri}-${index}` 33 } 34
+6 -7
src/state/queries/starter-packs.ts
··· 1 import { 2 - AppBskyFeedDefs, 3 AppBskyGraphDefs, 4 - AppBskyGraphGetStarterPack, 5 AppBskyGraphStarterpack, 6 - AppBskyRichtextFacet, 7 AtUri, 8 - BskyAgent, 9 RichText, 10 } from '@atproto/api' 11 - import {StarterPackView} from '@atproto/api/dist/client/types/app/bsky/graph/defs' 12 import { 13 - QueryClient, 14 useMutation, 15 useQuery, 16 useQueryClient, ··· 59 }) { 60 const agent = useAgent() 61 62 - return useQuery<StarterPackView>({ 63 queryKey: RQKEY(uri ? {uri} : {did, rkey}), 64 queryFn: async () => { 65 if (!uri) {
··· 1 import { 2 + type AppBskyFeedDefs, 3 AppBskyGraphDefs, 4 + type AppBskyGraphGetStarterPack, 5 AppBskyGraphStarterpack, 6 + type AppBskyRichtextFacet, 7 AtUri, 8 + type BskyAgent, 9 RichText, 10 } from '@atproto/api' 11 import { 12 + type QueryClient, 13 useMutation, 14 useQuery, 15 useQueryClient, ··· 58 }) { 59 const agent = useAgent() 60 61 + return useQuery<AppBskyGraphDefs.StarterPackView>({ 62 queryKey: RQKEY(uri ? {uri} : {did, rkey}), 63 queryFn: async () => { 64 if (!uri) {
+1 -2
src/state/queries/trending/useGetTrendsQuery.ts
··· 1 import React from 'react' 2 - import {type AppBskyUnspeccedGetTrends} from '@atproto/api' 3 - import {hasMutedWord} from '@atproto/api/dist/moderation/mutewords' 4 import {useQuery} from '@tanstack/react-query' 5 6 import {
··· 1 import React from 'react' 2 + import {type AppBskyUnspeccedGetTrends, hasMutedWord} from '@atproto/api' 3 import {useQuery} from '@tanstack/react-query' 4 5 import {
+1 -2
src/state/queries/trending/useTrendingTopics.ts
··· 1 import React from 'react' 2 - import {AppBskyUnspeccedDefs} from '@atproto/api' 3 - import {hasMutedWord} from '@atproto/api/dist/moderation/mutewords' 4 import {useQuery} from '@tanstack/react-query' 5 6 import {STALE} from '#/state/queries'
··· 1 import React from 'react' 2 + import {type AppBskyUnspeccedDefs, hasMutedWord} from '@atproto/api' 3 import {useQuery} from '@tanstack/react-query' 4 5 import {STALE} from '#/state/queries'
+1 -2
src/view/com/composer/state/video.ts
··· 1 import {type ImagePickerAsset} from 'expo-image-picker' 2 import {type AppBskyVideoDefs, type BlobRef, type BskyAgent} from '@atproto/api' 3 - import {type JobStatus} from '@atproto/api/dist/client/types/app/bsky/video/defs' 4 import {type I18n} from '@lingui/core' 5 import {msg} from '@lingui/macro' 6 ··· 328 } 329 330 const videoAgent = createVideoAgent() 331 - let status: JobStatus | undefined 332 let blob: BlobRef | undefined 333 try { 334 const response = await videoAgent.app.bsky.video.getJobStatus({jobId})
··· 1 import {type ImagePickerAsset} from 'expo-image-picker' 2 import {type AppBskyVideoDefs, type BlobRef, type BskyAgent} from '@atproto/api' 3 import {type I18n} from '@lingui/core' 4 import {msg} from '@lingui/macro' 5 ··· 327 } 328 329 const videoAgent = createVideoAgent() 330 + let status: AppBskyVideoDefs.JobStatus | undefined 331 let blob: BlobRef | undefined 332 try { 333 const response = await videoAgent.app.bsky.video.getJobStatus({jobId})