[SDK] Remove @atproto/api (#11386)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,5 @@
|
||||
import {useCallback, useMemo, useRef, useState} from 'react'
|
||||
import {View, type ViewabilityConfig} from 'react-native'
|
||||
import {
|
||||
type AppBskyActorDefs,
|
||||
type AppBskyFeedDefs,
|
||||
type AppBskyGraphDefs,
|
||||
} from '@atproto/api'
|
||||
import {Trans, useLingui} from '@lingui/react/macro'
|
||||
import {useQueryClient} from '@tanstack/react-query'
|
||||
import * as bcp47Match from 'bcp-47-match'
|
||||
@@ -68,6 +63,7 @@ import {SubtleHover} from '#/components/SubtleHover'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {type Metrics, useAnalytics} from '#/analytics'
|
||||
import {ExploreScreenLiveEventFeedsBanner} from '#/features/liveEvents/components/ExploreScreenLiveEventFeedsBanner'
|
||||
import {type app} from '#/lexicons'
|
||||
import * as ModuleHeader from './components/ModuleHeader'
|
||||
import {
|
||||
SuggestedAccountsTabBar,
|
||||
@@ -155,7 +151,7 @@ type ExploreScreenItems =
|
||||
| {
|
||||
type: 'profile'
|
||||
key: string
|
||||
profile: AppBskyActorDefs.ProfileView
|
||||
profile: app.bsky.actor.defs.ProfileView
|
||||
recId?: string
|
||||
}
|
||||
| {
|
||||
@@ -165,7 +161,7 @@ type ExploreScreenItems =
|
||||
| {
|
||||
type: 'feed'
|
||||
key: string
|
||||
feed: AppBskyFeedDefs.GeneratorView
|
||||
feed: app.bsky.feed.defs.GeneratorView
|
||||
}
|
||||
| {
|
||||
type: 'loadMore'
|
||||
@@ -191,7 +187,7 @@ type ExploreScreenItems =
|
||||
| {
|
||||
type: 'starterPack'
|
||||
key: string
|
||||
view: AppBskyGraphDefs.StarterPackView
|
||||
view: app.bsky.graph.defs.StarterPackView
|
||||
}
|
||||
| {
|
||||
type: 'starterPackSkeleton'
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import {memo, useCallback, useMemo, useState} from 'react'
|
||||
import {ActivityIndicator, View} from 'react-native'
|
||||
import {type AppBskyFeedDefs, type AppBskyGraphDefs} from '@atproto/api'
|
||||
import {Trans, useLingui} from '@lingui/react/macro'
|
||||
|
||||
import {urls} from '#/lib/constants'
|
||||
@@ -37,6 +36,7 @@ import {ListFooter} from '#/components/Lists'
|
||||
import {SearchError} from '#/components/SearchError'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {type Metrics, useAnalytics} from '#/analytics'
|
||||
import {type app} from '#/lexicons'
|
||||
import type * as bsky from '#/types/bsky'
|
||||
|
||||
let SearchResults = ({
|
||||
@@ -292,7 +292,7 @@ type SearchResultSlice =
|
||||
| {
|
||||
type: 'post'
|
||||
key: string
|
||||
post: AppBskyFeedDefs.PostView
|
||||
post: app.bsky.feed.defs.PostView
|
||||
}
|
||||
| {
|
||||
type: 'loadingMore'
|
||||
@@ -504,7 +504,7 @@ function SearchPost({
|
||||
}: {
|
||||
from: Metrics['search:result:press']['tab']
|
||||
position: Metrics['search:result:press']['position']
|
||||
post: AppBskyFeedDefs.PostView
|
||||
post: app.bsky.feed.defs.PostView
|
||||
}) {
|
||||
const ax = useAnalytics()
|
||||
|
||||
@@ -672,7 +672,7 @@ let SearchScreenFeedsResults = ({
|
||||
item,
|
||||
index,
|
||||
}: {
|
||||
item: AppBskyFeedDefs.GeneratorView
|
||||
item: app.bsky.feed.defs.GeneratorView
|
||||
index: number
|
||||
}) => (
|
||||
<View
|
||||
@@ -685,7 +685,7 @@ let SearchScreenFeedsResults = ({
|
||||
<SearchFeedCard position={index} view={item} />
|
||||
</View>
|
||||
)}
|
||||
keyExtractor={(item: AppBskyFeedDefs.GeneratorView) => item.uri}
|
||||
keyExtractor={(item: app.bsky.feed.defs.GeneratorView) => item.uri}
|
||||
desktopFixedHeight
|
||||
ListFooterComponent={<ListFooter />}
|
||||
/>
|
||||
@@ -704,7 +704,7 @@ function SearchFeedCard({
|
||||
view,
|
||||
}: {
|
||||
position: number
|
||||
view: AppBskyFeedDefs.GeneratorView
|
||||
view: app.bsky.feed.defs.GeneratorView
|
||||
}) {
|
||||
const ax = useAnalytics()
|
||||
|
||||
@@ -790,14 +790,14 @@ let SearchScreenStarterPackResults = ({
|
||||
item,
|
||||
index,
|
||||
}: {
|
||||
item: AppBskyGraphDefs.StarterPackView
|
||||
item: app.bsky.graph.defs.StarterPackView
|
||||
index: number
|
||||
}) => (
|
||||
<View style={[a.px_lg, a.pb_lg, index === 0 && a.pt_lg]}>
|
||||
<SearchStarterPack position={index} view={item} />
|
||||
</View>
|
||||
)}
|
||||
keyExtractor={(item: AppBskyGraphDefs.StarterPackView) => item.uri}
|
||||
keyExtractor={(item: app.bsky.graph.defs.StarterPackView) => item.uri}
|
||||
refreshing={isPTR}
|
||||
onRefresh={() => void onPullToRefresh()}
|
||||
onEndReached={onEndReached}
|
||||
@@ -824,7 +824,7 @@ function SearchStarterPack({
|
||||
view,
|
||||
}: {
|
||||
position: number
|
||||
view: AppBskyGraphDefs.StarterPackView
|
||||
view: app.bsky.graph.defs.StarterPackView
|
||||
}) {
|
||||
const ax = useAnalytics()
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {useMemo} from 'react'
|
||||
import {View} from 'react-native'
|
||||
import {type AppBskyFeedDefs, AtUri} from '@atproto/api'
|
||||
import {AtUri} from '@atproto/syntax'
|
||||
|
||||
import {PressableScale} from '#/lib/custom-animations/PressableScale'
|
||||
import {makeCustomFeedLink} from '#/lib/routes/links'
|
||||
@@ -14,6 +14,7 @@ import {MagnifyingGlass_Stroke2_Corner0_Rounded as SearchIcon} from '#/component
|
||||
import {Link} from '#/components/Link'
|
||||
import {Text, type TextProps} from '#/components/Typography'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
import {type app} from '#/lexicons'
|
||||
|
||||
export function Container({
|
||||
style,
|
||||
@@ -46,7 +47,7 @@ export function FeedLink({
|
||||
feed,
|
||||
children,
|
||||
}: {
|
||||
feed: AppBskyFeedDefs.GeneratorView
|
||||
feed: app.bsky.feed.defs.GeneratorView
|
||||
children?: React.ReactNode
|
||||
}) {
|
||||
const t = useTheme()
|
||||
@@ -75,7 +76,7 @@ export function FeedLink({
|
||||
)
|
||||
}
|
||||
|
||||
export function FeedAvatar({feed}: {feed: AppBskyFeedDefs.GeneratorView}) {
|
||||
export function FeedAvatar({feed}: {feed: app.bsky.feed.defs.GeneratorView}) {
|
||||
return <UserAvatar type="algo" size={38} avatar={feed.avatar} />
|
||||
}
|
||||
|
||||
@@ -178,7 +179,7 @@ export function EllipsisButton({
|
||||
)
|
||||
}
|
||||
|
||||
export function PinButton({feed}: {feed: AppBskyFeedDefs.GeneratorView}) {
|
||||
export function PinButton({feed}: {feed: app.bsky.feed.defs.GeneratorView}) {
|
||||
return (
|
||||
<View style={[a.z_20, {marginRight: -6}]}>
|
||||
<FeedCard.SaveButton
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import {ScrollView, View} from 'react-native'
|
||||
import {type ModerationOpts} from '@bsky.app/sdk/moderation'
|
||||
import {moderateProfile, type ModerationOpts} from '@bsky.app/sdk/moderation'
|
||||
import {Plural, Trans, useLingui} from '@lingui/react/macro'
|
||||
|
||||
import {createHitslop} from '#/lib/constants'
|
||||
import {moderateProfile} from '#/lib/moderation/subjects'
|
||||
import {makeProfileLink} from '#/lib/routes/links'
|
||||
import {sanitizeDisplayName} from '#/lib/strings/display-names'
|
||||
import {sanitizeHandle} from '#/lib/strings/handles'
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import {useState} from 'react'
|
||||
import {View} from 'react-native'
|
||||
import {type AppBskyGraphDefs, AppBskyGraphStarterpack} from '@atproto/api'
|
||||
import {moderateProfile} from '@bsky.app/sdk/moderation'
|
||||
import {msg} from '@lingui/core/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
import {Trans} from '@lingui/react/macro'
|
||||
|
||||
import {moderateProfile} from '#/lib/moderation/subjects'
|
||||
import {sanitizeHandle} from '#/lib/strings/handles'
|
||||
import {useModerationOpts} from '#/state/preferences/moderation-opts'
|
||||
import {useSession} from '#/state/session'
|
||||
@@ -19,13 +18,14 @@ import {MediaInsetBorder} from '#/components/MediaInsetBorder'
|
||||
import {useStarterPackLink} from '#/components/StarterPack/StarterPackCard'
|
||||
import {SubtleHover} from '#/components/SubtleHover'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {app} from '#/lexicons'
|
||||
import * as bsky from '#/types/bsky'
|
||||
|
||||
export function StarterPackCard({
|
||||
view,
|
||||
onPress,
|
||||
}: {
|
||||
view: AppBskyGraphDefs.StarterPackView
|
||||
view: app.bsky.graph.defs.StarterPackView
|
||||
onPress?: () => void
|
||||
}) {
|
||||
const t = useTheme()
|
||||
@@ -35,12 +35,7 @@ export function StarterPackCard({
|
||||
const link = useStarterPackLink({view})
|
||||
const record = view.record
|
||||
|
||||
if (
|
||||
!bsky.dangerousIsType<AppBskyGraphStarterpack.Record>(
|
||||
record,
|
||||
AppBskyGraphStarterpack.isRecord,
|
||||
)
|
||||
) {
|
||||
if (!bsky.isType(app.bsky.graph.starterpack, record)) {
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import {memo, useEffect} from 'react'
|
||||
import {View} from 'react-native'
|
||||
import {type AppBskyActorSearchActors} from '@atproto/api'
|
||||
import {type ModerationOpts} from '@bsky.app/sdk/moderation'
|
||||
import {msg} from '@lingui/core/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
@@ -14,6 +13,7 @@ import {boostInterests, InterestTabs} from '#/components/InterestTabs'
|
||||
import * as ProfileCard from '#/components/ProfileCard'
|
||||
import {SubtleHover} from '#/components/SubtleHover'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
import {type app} from '#/lexicons'
|
||||
import type * as bsky from '#/types/bsky'
|
||||
|
||||
export function useLoadEnoughProfiles({
|
||||
@@ -25,7 +25,7 @@ export function useLoadEnoughProfiles({
|
||||
fetchNextPage,
|
||||
}: {
|
||||
interest: string | null
|
||||
data?: InfiniteData<AppBskyActorSearchActors.OutputSchema>
|
||||
data?: InfiniteData<app.bsky.actor.searchActors.$OutputBody>
|
||||
isLoading: boolean
|
||||
isFetchingNextPage: boolean
|
||||
hasNextPage: boolean
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import {useMemo} from 'react'
|
||||
import {Pressable, View} from 'react-native'
|
||||
import {Image} from 'expo-image'
|
||||
import {type AppBskyUnspeccedDefs} from '@atproto/api'
|
||||
import {moderateProfile} from '@bsky.app/sdk/moderation'
|
||||
import {RichText as RichTextApi} from '@bsky.app/sdk/richtext'
|
||||
import {Plural, Trans, useLingui} from '@lingui/react/macro'
|
||||
|
||||
import {moderateProfile} from '#/lib/moderation/subjects'
|
||||
import {useModerationOpts} from '#/state/preferences/moderation-opts'
|
||||
import {
|
||||
useTrendingSettings,
|
||||
@@ -28,6 +27,7 @@ import {SubtleHover} from '#/components/SubtleHover'
|
||||
import {useTrendingTopicSeen} from '#/components/TrendingTopics'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
import {type app} from '#/lexicons'
|
||||
import * as ModuleHeader from '../components/ModuleHeader'
|
||||
|
||||
const IMAGE_SIZE = 56
|
||||
@@ -118,7 +118,7 @@ export function TrendRow({
|
||||
children,
|
||||
onPress,
|
||||
}: ViewStyleProp & {
|
||||
trend: AppBskyUnspeccedDefs.TrendView
|
||||
trend: app.bsky.unspecced.defs.TrendView
|
||||
rank: number
|
||||
recId?: string
|
||||
children?: React.ReactNode
|
||||
@@ -229,7 +229,7 @@ export function TrendRow({
|
||||
|
||||
// Unused atm, but leaving here so we don't lose localization. -dsb
|
||||
export function useCategoryDisplayName(
|
||||
category: AppBskyUnspeccedDefs.TrendView['category'],
|
||||
category: app.bsky.unspecced.defs.TrendView['category'],
|
||||
) {
|
||||
const {t: l} = useLingui()
|
||||
|
||||
@@ -297,7 +297,7 @@ export function TrendingTopicRowSkeleton() {
|
||||
}
|
||||
|
||||
function useModerateTrendingActors(
|
||||
actors: AppBskyUnspeccedDefs.TrendView['actors'],
|
||||
actors: app.bsky.unspecced.defs.TrendView['actors'],
|
||||
) {
|
||||
const moderationOpts = useModerationOpts()
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {useMemo} from 'react'
|
||||
import {ScrollView, View} from 'react-native'
|
||||
import {AppBskyEmbedVideo, AtUri} from '@atproto/api'
|
||||
import {AtUri} from '@atproto/syntax'
|
||||
import {msg} from '@lingui/core/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
import {Trans} from '@lingui/react/macro'
|
||||
@@ -21,6 +21,8 @@ import {
|
||||
CompactVideoPostCardPlaceholder,
|
||||
} from '#/components/VideoPostCard'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
import {app} from '#/lexicons'
|
||||
import * as bsky from '#/types/bsky'
|
||||
|
||||
const CARD_WIDTH = 100
|
||||
|
||||
@@ -158,7 +160,7 @@ function VideoCards({
|
||||
.flatMap(page => page.slices)
|
||||
.map(slice => slice.items[0])
|
||||
.filter(Boolean)
|
||||
.filter(item => AppBskyEmbedVideo.isView(item.post.embed))
|
||||
.filter(item => bsky.isType(app.bsky.embed.video.view, item.post.embed))
|
||||
.slice(0, 8)
|
||||
}, [data])
|
||||
const href = useMemo(() => {
|
||||
|
||||
Reference in New Issue
Block a user