remove imports from @atproto/api internals (#8403)
This commit is contained in:
@@ -1,12 +1,11 @@
|
|||||||
import React, {useCallback} from 'react'
|
import React, {useCallback} from 'react'
|
||||||
import {ListRenderItemInfo, View} from 'react-native'
|
import {type ListRenderItemInfo, View} from 'react-native'
|
||||||
import {AppBskyFeedDefs} from '@atproto/api'
|
import {type AppBskyFeedDefs} from '@atproto/api'
|
||||||
import {GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs'
|
|
||||||
|
|
||||||
import {useBottomBarOffset} from '#/lib/hooks/useBottomBarOffset'
|
import {useBottomBarOffset} from '#/lib/hooks/useBottomBarOffset'
|
||||||
import {isNative, isWeb} from '#/platform/detection'
|
import {isNative, isWeb} from '#/platform/detection'
|
||||||
import {List, ListRef} from '#/view/com/util/List'
|
import {List, type ListRef} from '#/view/com/util/List'
|
||||||
import {SectionRef} from '#/screens/Profile/Sections/types'
|
import {type SectionRef} from '#/screens/Profile/Sections/types'
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import * as FeedCard from '#/components/FeedCard'
|
import * as FeedCard from '#/components/FeedCard'
|
||||||
|
|
||||||
@@ -37,7 +36,10 @@ export const FeedsList = React.forwardRef<SectionRef, ProfilesListProps>(
|
|||||||
scrollToTop: onScrollToTop,
|
scrollToTop: onScrollToTop,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const renderItem = ({item, index}: ListRenderItemInfo<GeneratorView>) => {
|
const renderItem = ({
|
||||||
|
item,
|
||||||
|
index,
|
||||||
|
}: ListRenderItemInfo<AppBskyFeedDefs.GeneratorView>) => {
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
|
|||||||
@@ -1,16 +1,22 @@
|
|||||||
import {useRef} from 'react'
|
import {useRef} from 'react'
|
||||||
import type {ListRenderItemInfo} from 'react-native'
|
import {type ListRenderItemInfo} from 'react-native'
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {AppBskyActorDefs, ModerationOpts} from '@atproto/api'
|
import {
|
||||||
import {GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs'
|
type AppBskyActorDefs,
|
||||||
|
type AppBskyFeedDefs,
|
||||||
|
type ModerationOpts,
|
||||||
|
} from '@atproto/api'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender'
|
import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender'
|
||||||
import {isWeb} from '#/platform/detection'
|
import {isWeb} from '#/platform/detection'
|
||||||
import {useSession} from '#/state/session'
|
import {useSession} from '#/state/session'
|
||||||
import {ListMethods} from '#/view/com/util/List'
|
import {type ListMethods} from '#/view/com/util/List'
|
||||||
import {WizardAction, WizardState} from '#/screens/StarterPack/Wizard/State'
|
import {
|
||||||
|
type WizardAction,
|
||||||
|
type WizardState,
|
||||||
|
} from '#/screens/StarterPack/Wizard/State'
|
||||||
import {atoms as a, native, useTheme, web} from '#/alf'
|
import {atoms as a, native, useTheme, web} from '#/alf'
|
||||||
import {Button, ButtonText} from '#/components/Button'
|
import {Button, ButtonText} from '#/components/Button'
|
||||||
import * as Dialog from '#/components/Dialog'
|
import * as Dialog from '#/components/Dialog'
|
||||||
@@ -21,7 +27,7 @@ import {
|
|||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
|
|
||||||
function keyExtractor(
|
function keyExtractor(
|
||||||
item: AppBskyActorDefs.ProfileViewBasic | GeneratorView,
|
item: AppBskyActorDefs.ProfileViewBasic | AppBskyFeedDefs.GeneratorView,
|
||||||
index: number,
|
index: number,
|
||||||
) {
|
) {
|
||||||
return `${item.did}-${index}`
|
return `${item.did}-${index}`
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
import {Keyboard, View} from 'react-native'
|
import {Keyboard, View} from 'react-native'
|
||||||
import {
|
import {
|
||||||
AppBskyActorDefs,
|
type AppBskyActorDefs,
|
||||||
AppBskyFeedDefs,
|
type AppBskyFeedDefs,
|
||||||
moderateFeedGenerator,
|
moderateFeedGenerator,
|
||||||
moderateProfile,
|
moderateProfile,
|
||||||
ModerationOpts,
|
type ModerationOpts,
|
||||||
ModerationUI,
|
type ModerationUI,
|
||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
import {GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs'
|
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
@@ -16,13 +15,16 @@ import {sanitizeDisplayName} from '#/lib/strings/display-names'
|
|||||||
import {sanitizeHandle} from '#/lib/strings/handles'
|
import {sanitizeHandle} from '#/lib/strings/handles'
|
||||||
import {useSession} from '#/state/session'
|
import {useSession} from '#/state/session'
|
||||||
import {UserAvatar} from '#/view/com/util/UserAvatar'
|
import {UserAvatar} from '#/view/com/util/UserAvatar'
|
||||||
import {WizardAction, WizardState} from '#/screens/StarterPack/Wizard/State'
|
import {
|
||||||
|
type WizardAction,
|
||||||
|
type WizardState,
|
||||||
|
} from '#/screens/StarterPack/Wizard/State'
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
import {Button, ButtonText} from '#/components/Button'
|
import {Button, ButtonText} from '#/components/Button'
|
||||||
import * as Toggle from '#/components/forms/Toggle'
|
import * as Toggle from '#/components/forms/Toggle'
|
||||||
import {Checkbox} from '#/components/forms/Toggle'
|
import {Checkbox} from '#/components/forms/Toggle'
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
import * as bsky from '#/types/bsky'
|
import type * as bsky from '#/types/bsky'
|
||||||
|
|
||||||
function WizardListCard({
|
function WizardListCard({
|
||||||
type,
|
type,
|
||||||
@@ -174,7 +176,7 @@ export function WizardFeedCard({
|
|||||||
moderationOpts,
|
moderationOpts,
|
||||||
}: {
|
}: {
|
||||||
btnType: 'checkbox' | 'remove'
|
btnType: 'checkbox' | 'remove'
|
||||||
generator: GeneratorView
|
generator: AppBskyFeedDefs.GeneratorView
|
||||||
state: WizardState
|
state: WizardState
|
||||||
dispatch: (action: WizardAction) => void
|
dispatch: (action: WizardAction) => void
|
||||||
moderationOpts: ModerationOpts
|
moderationOpts: ModerationOpts
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {type ListRenderItemInfo, View} from 'react-native'
|
import {type ListRenderItemInfo, View} from 'react-native'
|
||||||
import {type PostView} from '@atproto/api/dist/client/types/app/bsky/feed/defs'
|
import {type AppBskyFeedDefs} from '@atproto/api'
|
||||||
import {msg} from '@lingui/macro'
|
import {msg} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {useFocusEffect} from '@react-navigation/native'
|
import {useFocusEffect} from '@react-navigation/native'
|
||||||
@@ -25,11 +25,11 @@ import {ArrowOutOfBoxModified_Stroke2_Corner2_Rounded as Share} from '#/componen
|
|||||||
import * as Layout from '#/components/Layout'
|
import * as Layout from '#/components/Layout'
|
||||||
import {ListFooter, ListMaybePlaceholder} from '#/components/Lists'
|
import {ListFooter, ListMaybePlaceholder} from '#/components/Lists'
|
||||||
|
|
||||||
const renderItem = ({item}: ListRenderItemInfo<PostView>) => {
|
const renderItem = ({item}: ListRenderItemInfo<AppBskyFeedDefs.PostView>) => {
|
||||||
return <Post post={item} />
|
return <Post post={item} />
|
||||||
}
|
}
|
||||||
|
|
||||||
const keyExtractor = (item: PostView, index: number) => {
|
const keyExtractor = (item: AppBskyFeedDefs.PostView, index: number) => {
|
||||||
return `${item.uri}-${index}`
|
return `${item.uri}-${index}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {View} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import {
|
import {
|
||||||
|
type AppBskyActorDefs,
|
||||||
type AppBskyActorProfile,
|
type AppBskyActorProfile,
|
||||||
type AppBskyGraphDefs,
|
type AppBskyGraphDefs,
|
||||||
AppBskyGraphStarterpack,
|
AppBskyGraphStarterpack,
|
||||||
type Un$Typed,
|
type Un$Typed,
|
||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
import {type SavedFeed} from '@atproto/api/dist/client/types/app/bsky/actor/defs'
|
|
||||||
import {TID} from '@atproto/common-web'
|
import {TID} from '@atproto/common-web'
|
||||||
import {msg, Trans} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
@@ -108,7 +108,7 @@ export function StepFinished() {
|
|||||||
await agent.setInterestsPref({tags: selectedInterests})
|
await agent.setInterestsPref({tags: selectedInterests})
|
||||||
|
|
||||||
// Default feeds that every user should have pinned when landing in the app
|
// Default feeds that every user should have pinned when landing in the app
|
||||||
const feedsToSave: SavedFeed[] = [
|
const feedsToSave: AppBskyActorDefs.SavedFeed[] = [
|
||||||
{
|
{
|
||||||
...DISCOVER_SAVED_FEED,
|
...DISCOVER_SAVED_FEED,
|
||||||
id: TID.nextStr(),
|
id: TID.nextStr(),
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {type AppBskyGraphDefs, AppBskyGraphStarterpack} from '@atproto/api'
|
import {
|
||||||
import {type GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs'
|
type AppBskyFeedDefs,
|
||||||
|
type AppBskyGraphDefs,
|
||||||
|
AppBskyGraphStarterpack,
|
||||||
|
} from '@atproto/api'
|
||||||
import {msg, plural} from '@lingui/macro'
|
import {msg, plural} from '@lingui/macro'
|
||||||
|
|
||||||
import {STARTER_PACK_MAX_SIZE} from '#/lib/constants'
|
import {STARTER_PACK_MAX_SIZE} from '#/lib/constants'
|
||||||
@@ -19,7 +22,7 @@ type Action =
|
|||||||
| {type: 'SetDescription'; description: string}
|
| {type: 'SetDescription'; description: string}
|
||||||
| {type: 'AddProfile'; profile: bsky.profile.AnyProfileView}
|
| {type: 'AddProfile'; profile: bsky.profile.AnyProfileView}
|
||||||
| {type: 'RemoveProfile'; profileDid: string}
|
| {type: 'RemoveProfile'; profileDid: string}
|
||||||
| {type: 'AddFeed'; feed: GeneratorView}
|
| {type: 'AddFeed'; feed: AppBskyFeedDefs.GeneratorView}
|
||||||
| {type: 'RemoveFeed'; feedUri: string}
|
| {type: 'RemoveFeed'; feedUri: string}
|
||||||
| {type: 'SetProcessing'; processing: boolean}
|
| {type: 'SetProcessing'; processing: boolean}
|
||||||
| {type: 'SetError'; error: string}
|
| {type: 'SetError'; error: string}
|
||||||
@@ -30,7 +33,7 @@ interface State {
|
|||||||
name?: string
|
name?: string
|
||||||
description?: string
|
description?: string
|
||||||
profiles: bsky.profile.AnyProfileView[]
|
profiles: bsky.profile.AnyProfileView[]
|
||||||
feeds: GeneratorView[]
|
feeds: AppBskyFeedDefs.GeneratorView[]
|
||||||
processing: boolean
|
processing: boolean
|
||||||
error?: string
|
error?: string
|
||||||
transitionDirection: 'Backward' | 'Forward'
|
transitionDirection: 'Backward' | 'Forward'
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import {useSafeAreaInsets} from 'react-native-safe-area-context'
|
|||||||
import {Image} from 'expo-image'
|
import {Image} from 'expo-image'
|
||||||
import {
|
import {
|
||||||
type AppBskyActorDefs,
|
type AppBskyActorDefs,
|
||||||
|
type AppBskyFeedDefs,
|
||||||
type AppBskyGraphDefs,
|
type AppBskyGraphDefs,
|
||||||
AtUri,
|
AtUri,
|
||||||
type ModerationOpts,
|
type ModerationOpts,
|
||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
import {type GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs'
|
|
||||||
import {msg, Plural, Trans} from '@lingui/macro'
|
import {msg, Plural, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {useFocusEffect, useNavigation} from '@react-navigation/native'
|
import {useFocusEffect, useNavigation} from '@react-navigation/native'
|
||||||
@@ -591,7 +591,9 @@ function Footer({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getName(item: bsky.profile.AnyProfileView | GeneratorView) {
|
function getName(
|
||||||
|
item: bsky.profile.AnyProfileView | AppBskyFeedDefs.GeneratorView,
|
||||||
|
) {
|
||||||
if (typeof item.displayName === 'string') {
|
if (typeof item.displayName === 'string') {
|
||||||
return enforceLen(sanitizeDisplayName(item.displayName), 28, true)
|
return enforceLen(sanitizeDisplayName(item.displayName), 28, true)
|
||||||
} else if ('handle' in item && typeof item.handle === 'string') {
|
} else if ('handle' in item && typeof item.handle === 'string') {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {type ListRenderItemInfo, View} from 'react-native'
|
import {type ListRenderItemInfo, View} from 'react-native'
|
||||||
import {type PostView} from '@atproto/api/dist/client/types/app/bsky/feed/defs'
|
import {type AppBskyFeedDefs} from '@atproto/api'
|
||||||
import {msg} from '@lingui/macro'
|
import {msg} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
import {useFocusEffect} from '@react-navigation/native'
|
import {useFocusEffect} from '@react-navigation/native'
|
||||||
@@ -24,11 +24,11 @@ import {ArrowOutOfBoxModified_Stroke2_Corner2_Rounded as Share} from '#/componen
|
|||||||
import * as Layout from '#/components/Layout'
|
import * as Layout from '#/components/Layout'
|
||||||
import {ListFooter, ListMaybePlaceholder} from '#/components/Lists'
|
import {ListFooter, ListMaybePlaceholder} from '#/components/Lists'
|
||||||
|
|
||||||
const renderItem = ({item}: ListRenderItemInfo<PostView>) => {
|
const renderItem = ({item}: ListRenderItemInfo<AppBskyFeedDefs.PostView>) => {
|
||||||
return <Post post={item} />
|
return <Post post={item} />
|
||||||
}
|
}
|
||||||
|
|
||||||
const keyExtractor = (item: PostView, index: number) => {
|
const keyExtractor = (item: AppBskyFeedDefs.PostView, index: number) => {
|
||||||
return `${item.uri}-${index}`
|
return `${item.uri}-${index}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
import {
|
import {
|
||||||
AppBskyFeedDefs,
|
type AppBskyFeedDefs,
|
||||||
AppBskyGraphDefs,
|
AppBskyGraphDefs,
|
||||||
AppBskyGraphGetStarterPack,
|
type AppBskyGraphGetStarterPack,
|
||||||
AppBskyGraphStarterpack,
|
AppBskyGraphStarterpack,
|
||||||
AppBskyRichtextFacet,
|
type AppBskyRichtextFacet,
|
||||||
AtUri,
|
AtUri,
|
||||||
BskyAgent,
|
type BskyAgent,
|
||||||
RichText,
|
RichText,
|
||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
import {StarterPackView} from '@atproto/api/dist/client/types/app/bsky/graph/defs'
|
|
||||||
import {
|
import {
|
||||||
QueryClient,
|
type QueryClient,
|
||||||
useMutation,
|
useMutation,
|
||||||
useQuery,
|
useQuery,
|
||||||
useQueryClient,
|
useQueryClient,
|
||||||
@@ -59,7 +58,7 @@ export function useStarterPackQuery({
|
|||||||
}) {
|
}) {
|
||||||
const agent = useAgent()
|
const agent = useAgent()
|
||||||
|
|
||||||
return useQuery<StarterPackView>({
|
return useQuery<AppBskyGraphDefs.StarterPackView>({
|
||||||
queryKey: RQKEY(uri ? {uri} : {did, rkey}),
|
queryKey: RQKEY(uri ? {uri} : {did, rkey}),
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
if (!uri) {
|
if (!uri) {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {type AppBskyUnspeccedGetTrends} from '@atproto/api'
|
import {type AppBskyUnspeccedGetTrends, hasMutedWord} from '@atproto/api'
|
||||||
import {hasMutedWord} from '@atproto/api/dist/moderation/mutewords'
|
|
||||||
import {useQuery} from '@tanstack/react-query'
|
import {useQuery} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {AppBskyUnspeccedDefs} from '@atproto/api'
|
import {type AppBskyUnspeccedDefs, hasMutedWord} from '@atproto/api'
|
||||||
import {hasMutedWord} from '@atproto/api/dist/moderation/mutewords'
|
|
||||||
import {useQuery} from '@tanstack/react-query'
|
import {useQuery} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {STALE} from '#/state/queries'
|
import {STALE} from '#/state/queries'
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import {type ImagePickerAsset} from 'expo-image-picker'
|
import {type ImagePickerAsset} from 'expo-image-picker'
|
||||||
import {type AppBskyVideoDefs, type BlobRef, type BskyAgent} from '@atproto/api'
|
import {type AppBskyVideoDefs, type BlobRef, type BskyAgent} from '@atproto/api'
|
||||||
import {type JobStatus} from '@atproto/api/dist/client/types/app/bsky/video/defs'
|
|
||||||
import {type I18n} from '@lingui/core'
|
import {type I18n} from '@lingui/core'
|
||||||
import {msg} from '@lingui/macro'
|
import {msg} from '@lingui/macro'
|
||||||
|
|
||||||
@@ -328,7 +327,7 @@ export async function processVideo(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const videoAgent = createVideoAgent()
|
const videoAgent = createVideoAgent()
|
||||||
let status: JobStatus | undefined
|
let status: AppBskyVideoDefs.JobStatus | undefined
|
||||||
let blob: BlobRef | undefined
|
let blob: BlobRef | undefined
|
||||||
try {
|
try {
|
||||||
const response = await videoAgent.app.bsky.video.getJobStatus({jobId})
|
const response = await videoAgent.app.bsky.video.getJobStatus({jobId})
|
||||||
|
|||||||
Reference in New Issue
Block a user