[SDK] Remove @atproto/api (#11386)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import {memo, useEffect, useMemo, useState} from 'react'
|
||||
import {View} from 'react-native'
|
||||
import {type AppBskyActorDefs, type AppBskyFeedPost, 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'
|
||||
@@ -20,15 +20,16 @@ import {
|
||||
} from '#/components/icons/Chevron'
|
||||
import {CodeBrackets_Stroke2_Corner0_Rounded as CodeBracketsIcon} from '#/components/icons/CodeBrackets'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {type app} from '#/lexicons'
|
||||
|
||||
export type ColorModeValues = 'system' | 'light' | 'dark'
|
||||
|
||||
type EmbedDialogProps = {
|
||||
control: Dialog.DialogControlProps
|
||||
postAuthor: AppBskyActorDefs.ProfileViewBasic
|
||||
postAuthor: app.bsky.actor.defs.ProfileViewBasic
|
||||
postCid: string
|
||||
postUri: string
|
||||
record: AppBskyFeedPost.Record
|
||||
record: app.bsky.feed.post.Main
|
||||
timestamp: string
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import {useCallback, useMemo, useState} from 'react'
|
||||
import {LayoutAnimation, Text as NestedText, View} from 'react-native'
|
||||
import {type AppBskyFeedDefs} from '@atproto/api'
|
||||
import {AtUri} from '@atproto/syntax'
|
||||
import {msg} from '@lingui/core/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
@@ -133,10 +132,10 @@ export type PostInteractionSettingsDialogProps = {
|
||||
*/
|
||||
rootPostUri: string
|
||||
/**
|
||||
* Optional initial {@link AppBskyFeedDefs.ThreadgateView} to use if we
|
||||
* Optional initial {@link app.bsky.feed.defs.ThreadgateView} to use if we
|
||||
* happen to have one before opening the settings dialog.
|
||||
*/
|
||||
initialThreadgateView?: AppBskyFeedDefs.ThreadgateView
|
||||
initialThreadgateView?: app.bsky.feed.defs.ThreadgateView
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,11 +7,10 @@ import {
|
||||
useState,
|
||||
} from 'react'
|
||||
import {TextInput, 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 {createSanitizedDisplayName} from '#/lib/moderation/create-sanitized-display-name'
|
||||
import {moderateProfile} from '#/lib/moderation/subjects'
|
||||
import {sanitizeHandle} from '#/lib/strings/handles'
|
||||
import {useModerationOpts} from '#/state/preferences/moderation-opts'
|
||||
import {useActorAutocompleteQuery} from '#/state/queries/actor-autocomplete'
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import {useCallback} from 'react'
|
||||
import {View} from 'react-native'
|
||||
import {
|
||||
type AppBskyGraphGetStarterPacksWithMembership,
|
||||
AppBskyGraphStarterpack,
|
||||
} from '@atproto/api'
|
||||
import {msg} from '@lingui/core/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
import {Plural, Trans} from '@lingui/react/macro'
|
||||
@@ -33,10 +29,11 @@ import * as Toast from '#/components/Toast'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
import {IS_WEB} from '#/env'
|
||||
import {app} from '#/lexicons'
|
||||
import * as bsky from '#/types/bsky'
|
||||
|
||||
type StarterPackWithMembership =
|
||||
AppBskyGraphGetStarterPacksWithMembership.StarterPackWithMembership
|
||||
app.bsky.graph.getStarterPacksWithMembership.StarterPackWithMembership
|
||||
|
||||
export type StarterPackDialogProps = {
|
||||
control: Dialog.DialogControlProps
|
||||
@@ -324,12 +321,7 @@ function StarterPackItem({
|
||||
|
||||
const {record} = starterPack
|
||||
|
||||
if (
|
||||
!bsky.dangerousIsType<AppBskyGraphStarterpack.Record>(
|
||||
record,
|
||||
AppBskyGraphStarterpack.isRecord,
|
||||
)
|
||||
) {
|
||||
if (!bsky.isType(app.bsky.graph.starterpack, record)) {
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {View} from 'react-native'
|
||||
import {type AppBskyGraphDefs, type AppBskyGraphStarterpack} from '@atproto/api'
|
||||
import {TID} from '@atproto/common-web'
|
||||
import {type $Typed} from '@atproto/lex'
|
||||
import {
|
||||
@@ -37,7 +36,7 @@ export function CreateListFromStarterPackDialog({
|
||||
starterPack,
|
||||
}: {
|
||||
control: Dialog.DialogControlProps
|
||||
starterPack: AppBskyGraphDefs.StarterPackView
|
||||
starterPack: app.bsky.graph.defs.StarterPackView
|
||||
}) {
|
||||
const {_} = useLingui()
|
||||
const t = useTheme()
|
||||
@@ -50,7 +49,7 @@ export function CreateListFromStarterPackDialog({
|
||||
const createDialogControl = Dialog.useDialogControl()
|
||||
const loadingDialogControl = Dialog.useDialogControl()
|
||||
|
||||
const record = starterPack.record as AppBskyGraphStarterpack.Record
|
||||
const record = starterPack.record as app.bsky.graph.starterpack.Main
|
||||
|
||||
const onPressCreate = () => {
|
||||
control.close(() => createDialogControl.open())
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import {useCallback, useEffect, useMemo, useState} from 'react'
|
||||
import {View} from 'react-native'
|
||||
import {type AppBskyGraphDefs} from '@atproto/api'
|
||||
import {RichText as RichTextAPI} from '@bsky.app/sdk/richtext'
|
||||
import {msg} from '@lingui/core/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
@@ -8,7 +7,7 @@ import {Plural, Trans} from '@lingui/react/macro'
|
||||
|
||||
import {cleanError} from '#/lib/strings/errors'
|
||||
import {isOverMaxGraphemeCount} from '#/lib/strings/helpers'
|
||||
import {asSdkFacets, richTextToString} from '#/lib/strings/rich-text-helpers'
|
||||
import {richTextToString} from '#/lib/strings/rich-text-helpers'
|
||||
import {shortenLinks, stripInvalidMentions} from '#/lib/strings/rich-text-manip'
|
||||
import {logger} from '#/logger'
|
||||
import {type ImageMeta} from '#/state/gallery'
|
||||
@@ -28,6 +27,7 @@ import * as Prompt from '#/components/Prompt'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {IS_WEB} from '#/env'
|
||||
import {type app} from '#/lexicons'
|
||||
|
||||
const DISPLAY_NAME_MAX_GRAPHEMES = 64
|
||||
const DESCRIPTION_MAX_GRAPHEMES = 300
|
||||
@@ -46,8 +46,8 @@ export function CreateOrEditListDialog({
|
||||
initialValues,
|
||||
}: {
|
||||
control: Dialog.DialogControlProps
|
||||
list?: AppBskyGraphDefs.ListView
|
||||
purpose?: AppBskyGraphDefs.ListPurpose
|
||||
list?: app.bsky.graph.defs.ListView
|
||||
purpose?: app.bsky.graph.defs.ListPurpose
|
||||
onSave?: (uri: string) => void
|
||||
initialValues?: InitialListValues
|
||||
}) {
|
||||
@@ -114,8 +114,8 @@ function DialogInner({
|
||||
onPressCancel,
|
||||
initialValues,
|
||||
}: {
|
||||
list?: AppBskyGraphDefs.ListView
|
||||
purpose?: AppBskyGraphDefs.ListPurpose
|
||||
list?: app.bsky.graph.defs.ListView
|
||||
purpose?: app.bsky.graph.defs.ListPurpose
|
||||
onSave?: (uri: string) => void
|
||||
setDirty: (dirty: boolean) => void
|
||||
onPressCancel: () => void
|
||||
@@ -169,7 +169,7 @@ function DialogInner({
|
||||
// We want to be working with a blank state here, so let's get the
|
||||
// serialized version and turn it back into a RichText
|
||||
const serialized = richTextToString(
|
||||
new RichTextAPI({text, facets: asSdkFacets(facets)}),
|
||||
new RichTextAPI({text, facets: facets}),
|
||||
false,
|
||||
)
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import {useCallback, useMemo} from 'react'
|
||||
import {View} from 'react-native'
|
||||
import {type AppBskyGraphDefs} from '@atproto/api'
|
||||
import {type ModerationOpts} from '@bsky.app/sdk/moderation'
|
||||
import {msg} from '@lingui/core/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
@@ -23,6 +22,7 @@ import {
|
||||
import {Loader} from '#/components/Loader'
|
||||
import * as ProfileCard from '#/components/ProfileCard'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {type app} from '#/lexicons'
|
||||
import type * as bsky from '#/types/bsky'
|
||||
|
||||
export function ListAddRemoveUsersDialog({
|
||||
@@ -31,7 +31,7 @@ export function ListAddRemoveUsersDialog({
|
||||
onChange,
|
||||
}: {
|
||||
control: Dialog.DialogControlProps
|
||||
list: AppBskyGraphDefs.ListView
|
||||
list: app.bsky.graph.defs.ListView
|
||||
onChange?: (
|
||||
type: 'add' | 'remove',
|
||||
profile: bsky.profile.AnyProfileView,
|
||||
@@ -52,7 +52,7 @@ function DialogInner({
|
||||
list,
|
||||
onChange,
|
||||
}: {
|
||||
list: AppBskyGraphDefs.ListView
|
||||
list: app.bsky.graph.defs.ListView
|
||||
onChange?: (
|
||||
type: 'add' | 'remove',
|
||||
profile: bsky.profile.AnyProfileView,
|
||||
@@ -89,7 +89,7 @@ function DialogInner({
|
||||
* Returns undefined for pending, false for not a member, and string for a member (the URI of the membership record)
|
||||
*/
|
||||
function getMembership(
|
||||
listMembers: AppBskyGraphDefs.ListItemView[] | undefined,
|
||||
listMembers: app.bsky.graph.defs.ListItemView[] | undefined,
|
||||
actorDid: string,
|
||||
): string | false | undefined {
|
||||
if (!listMembers) {
|
||||
@@ -107,8 +107,8 @@ function UserResult({
|
||||
moderationOpts,
|
||||
}: {
|
||||
profile: bsky.profile.AnyProfileView
|
||||
list: AppBskyGraphDefs.ListView
|
||||
listMembers: AppBskyGraphDefs.ListItemView[] | undefined
|
||||
list: app.bsky.graph.defs.ListView
|
||||
listMembers: app.bsky.graph.defs.ListItemView[] | undefined
|
||||
onChange?: (
|
||||
type: 'add' | 'remove',
|
||||
profile: bsky.profile.AnyProfileView,
|
||||
|
||||
@@ -6,7 +6,6 @@ import {
|
||||
useMemo,
|
||||
useState,
|
||||
} from 'react'
|
||||
import {type AppBskyActorDefs} from '@atproto/api'
|
||||
|
||||
import {logger} from '#/logger'
|
||||
import {STALE} from '#/state/queries'
|
||||
@@ -30,6 +29,7 @@ import {isSnoozed, snooze, unsnooze} from '#/components/dialogs/nuxs/snoozing'
|
||||
import {type EnabledCheckProps} from '#/components/dialogs/nuxs/utils'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
import {useGeolocation} from '#/geolocation'
|
||||
import {type app} from '#/lexicons'
|
||||
|
||||
type Context = {
|
||||
activeNux: Nux | undefined
|
||||
@@ -93,7 +93,7 @@ function Inner({
|
||||
preferences,
|
||||
}: {
|
||||
currentAccount: SessionAccount
|
||||
currentProfile: AppBskyActorDefs.ProfileViewDetailed
|
||||
currentProfile: app.bsky.actor.defs.ProfileViewDetailed
|
||||
preferences: UsePreferencesQueryResponse
|
||||
}) {
|
||||
const ax = useAnalytics()
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import {type AppBskyActorDefs} from '@atproto/api'
|
||||
|
||||
import {type UsePreferencesQueryResponse} from '#/state/queries/preferences'
|
||||
import {type SessionAccount} from '#/state/session'
|
||||
import {type AnalyticsContextType} from '#/analytics'
|
||||
import {type Geolocation} from '#/geolocation'
|
||||
import {type app} from '#/lexicons'
|
||||
|
||||
export type EnabledCheckProps = {
|
||||
features: AnalyticsContextType['features']
|
||||
currentAccount: SessionAccount
|
||||
currentProfile: AppBskyActorDefs.ProfileViewDetailed
|
||||
currentProfile: app.bsky.actor.defs.ProfileViewDetailed
|
||||
preferences: UsePreferencesQueryResponse
|
||||
geolocation: Geolocation
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user