flip the screen type imports to the generated lexicons

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-08-04 04:20:43 +03:00
parent e056c43116
commit 94ed6c7f0f
71 changed files with 322 additions and 357 deletions
@@ -1,7 +1,8 @@
import {View} from 'react-native'
import {type AppBskyFeedDefs, AtUri} from '@atproto/api'
import {Plural, Trans, useLingui} from '@lingui/react/macro'
import {AtUri} from '@atproto/syntax'
import {app} from '#/lexicons'
import {moderateProfile} from '#/lib/moderation/subjects'
import {makeProfileLink} from '#/lib/routes/links'
import {sanitizeDisplayName} from '#/lib/strings/display-names'
@@ -22,7 +23,7 @@ const AVI_SIZE = 20
* The plain "N likes" stat for the expanded anchor post, linking to the likes
* list. Renders nothing when the post has no likes.
*/
export function LikesStat({post}: {post: AppBskyFeedDefs.PostView}) {
export function LikesStat({post}: {post: app.bsky.feed.defs.PostView}) {
const t = useTheme()
const {t: l} = useLingui()
const formatPostStatCount = useFormatPostStatCount()
@@ -62,7 +63,7 @@ export function LikesStat({post}: {post: AppBskyFeedDefs.PostView}) {
* likes, the API max per page), so they are a sample of the most recent
* likers, not an exhaustive list.
*/
export function KnownLikers({post}: {post: AppBskyFeedDefs.PostView}) {
export function KnownLikers({post}: {post: app.bsky.feed.defs.PostView}) {
const t = useTheme()
const {t: l} = useLingui()
const {hasSession, currentAccount} = useSession()
@@ -1,14 +1,10 @@
import {memo, useMemo} from 'react'
import {Text as RNText, View} from 'react-native'
import {
AppBskyFeedDefs,
AppBskyFeedPost,
type AppBskyFeedThreadgate,
AtUri,
} from '@atproto/api'
import {RichText as RichTextAPI} from '@bsky.app/sdk/richtext'
import {Plural, Trans, useLingui} from '@lingui/react/macro'
import {AtUri} from '@atproto/syntax'
import {app} from '#/lexicons'
import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
import {useOpenComposer} from '#/lib/hooks/useOpenComposer'
import {makeProfileLink} from '#/lib/routes/links'
@@ -75,7 +71,7 @@ export function ThreadItemAnchor({
}: {
item: Extract<ThreadItem, {type: 'threadPost'}>
onPostSuccess?: (data: OnPostSuccessData) => void
threadgateRecord?: AppBskyFeedThreadgate.Record
threadgateRecord?: app.bsky.feed.threadgate.Main
postSource?: PostSource
}) {
const postShadow = usePostShadow(item.value.post)
@@ -176,9 +172,9 @@ const ThreadItemAnchorInner = memo(function ThreadItemAnchorInner({
}: {
item: Extract<ThreadItem, {type: 'threadPost'}>
isRoot: boolean
postShadow: Shadow<AppBskyFeedDefs.PostView>
postShadow: Shadow<app.bsky.feed.defs.PostView>
onPostSuccess?: (data: OnPostSuccessData) => void
threadgateRecord?: AppBskyFeedThreadgate.Record
threadgateRecord?: app.bsky.feed.threadgate.Main
postSource?: PostSource
}) {
const t = useTheme()
@@ -244,7 +240,11 @@ const ThreadItemAnchorInner = memo(function ThreadItemAnchorInner({
const viaRepost = useMemo(() => {
const reason = postSource?.post.reason
if (AppBskyFeedDefs.isReasonRepost(reason) && reason.uri && reason.cid) {
if (
bsky.isType(app.bsky.feed.defs.reasonRepost, reason) &&
reason.uri &&
reason.cid
) {
return {
uri: reason.uri,
cid: reason.cid,
@@ -574,16 +574,13 @@ function ExpandedPostDetails({
)
}
function BackdatedPostIndicator({post}: {post: AppBskyFeedDefs.PostView}) {
function BackdatedPostIndicator({post}: {post: app.bsky.feed.defs.PostView}) {
const t = useTheme()
const {t: l, i18n} = useLingui()
const control = Prompt.usePromptControl()
const indexedAt = new Date(post.indexedAt)
const createdAt = bsky.dangerousIsType<AppBskyFeedPost.Record>(
post.record,
AppBskyFeedPost.isRecord,
)
const createdAt = bsky.isType(app.bsky.feed.post, post.record)
? new Date(post.record.createdAt)
: new Date(post.indexedAt)
@@ -664,8 +661,8 @@ function BackdatedPostIndicator({post}: {post: AppBskyFeedDefs.PostView}) {
}
function getThreadAuthor(
post: AppBskyFeedDefs.PostView,
record: AppBskyFeedPost.Record,
post: app.bsky.feed.defs.PostView,
record: app.bsky.feed.post.Main,
): string {
if (!record.reply) {
return post.author.did
@@ -1,10 +1,10 @@
import {useCallback, useEffect, useMemo, useState} from 'react'
import {type AppBskyActorDefs} from '@atproto/api'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
import {Trans} from '@lingui/react/macro'
import {useNavigation} from '@react-navigation/native'
import {app} from '#/lexicons'
import {logger} from '#/logger'
import {useProfileShadow} from '#/state/cache/profile-shadow'
import {
@@ -57,7 +57,7 @@ export function ThreadItemAnchorFollowButtonInner({
function PostThreadFollowBtnLoaded({
profile: profileUnshadowed,
}: {
profile: AppBskyActorDefs.ProfileViewDetailed
profile: app.bsky.actor.defs.ProfileViewDetailed
}) {
const navigation = useNavigation()
const {_} = useLingui()
@@ -1,13 +1,10 @@
import {memo, type ReactNode, useCallback, useMemo, useState} from 'react'
import {View} from 'react-native'
import {
type AppBskyFeedDefs,
type AppBskyFeedThreadgate,
AtUri,
} from '@atproto/api'
import {RichText as RichTextAPI} from '@bsky.app/sdk/richtext'
import {Trans} from '@lingui/react/macro'
import {AtUri} from '@atproto/syntax'
import {app} from '#/lexicons'
import {MAX_POST_LINES} from '#/lib/constants'
import {useOpenComposer} from '#/lib/hooks/useOpenComposer'
import {makeProfileLink} from '#/lib/routes/links'
@@ -63,7 +60,7 @@ export type ThreadItemPostProps = {
topBorder?: boolean
}
onPostSuccess?: (data: OnPostSuccessData) => void
threadgateRecord?: AppBskyFeedThreadgate.Record
threadgateRecord?: app.bsky.feed.threadgate.Main
}
export function ThreadItemPost({
@@ -197,7 +194,7 @@ const ThreadItemPostInner = memo(function ThreadItemPostInner({
onPostSuccess,
threadgateRecord,
}: ThreadItemPostProps & {
postShadow: Shadow<AppBskyFeedDefs.PostView>
postShadow: Shadow<app.bsky.feed.defs.PostView>
}) {
const t = useTheme()
const {openComposer} = useOpenComposer()
@@ -1,13 +1,10 @@
import {memo, useCallback, useMemo, useState} from 'react'
import {View} from 'react-native'
import {
type AppBskyFeedDefs,
type AppBskyFeedThreadgate,
AtUri,
} from '@atproto/api'
import {RichText as RichTextAPI} from '@bsky.app/sdk/richtext'
import {Trans} from '@lingui/react/macro'
import {AtUri} from '@atproto/syntax'
import {app} from '#/lexicons'
import {MAX_POST_LINES} from '#/lib/constants'
import {useOpenComposer} from '#/lib/hooks/useOpenComposer'
import {makeProfileLink} from '#/lib/routes/links'
@@ -69,7 +66,7 @@ export function ThreadItemTreePost({
topBorder?: boolean
}
onPostSuccess?: (data: OnPostSuccessData) => void
threadgateRecord?: AppBskyFeedThreadgate.Record
threadgateRecord?: app.bsky.feed.threadgate.Main
}) {
const postShadow = usePostShadow(item.value.post)
@@ -252,13 +249,13 @@ const ThreadItemTreePostInner = memo(function ThreadItemTreePostInner({
threadgateRecord,
}: {
item: Extract<ThreadItem, {type: 'threadPost'}>
postShadow: Shadow<AppBskyFeedDefs.PostView>
postShadow: Shadow<app.bsky.feed.defs.PostView>
overrides?: {
moderation?: boolean
topBorder?: boolean
}
onPostSuccess?: (data: OnPostSuccessData) => void
threadgateRecord?: AppBskyFeedThreadgate.Record
threadgateRecord?: app.bsky.feed.threadgate.Main
}): React.ReactNode {
const {openComposer} = useOpenComposer()
const {currentAccount} = useSession()