diff options
Diffstat (limited to 'src/view/com')
-rw-r--r-- | src/view/com/modals/ComposePost.tsx | 3 | ||||
-rw-r--r-- | src/view/com/notifications/FeedItem.tsx | 10 | ||||
-rw-r--r-- | src/view/com/post-thread/PostThreadItem.tsx | 19 | ||||
-rw-r--r-- | src/view/com/post/Post.tsx | 14 | ||||
-rw-r--r-- | src/view/com/posts/FeedItem.tsx | 16 |
5 files changed, 35 insertions, 27 deletions
diff --git a/src/view/com/modals/ComposePost.tsx b/src/view/com/modals/ComposePost.tsx index 6e634ed65..0032fbe7c 100644 --- a/src/view/com/modals/ComposePost.tsx +++ b/src/view/com/modals/ComposePost.tsx @@ -4,6 +4,7 @@ import {BottomSheetTextInput} from '@gorhom/bottom-sheet' import LinearGradient from 'react-native-linear-gradient' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import * as GetUserFollows from '../../../third-party/api/src/types/app/bsky/getUserFollows' +import * as Post from '../../../third-party/api/src/types/app/bsky/post' import {Autocomplete} from './composer/Autocomplete' import Toast from '../util/Toast' import ProgressCircle from '../util/ProgressCircle' @@ -20,7 +21,7 @@ export function Component({ replyTo, onPost, }: { - replyTo?: string + replyTo?: Post.PostRef onPost?: () => void }) { const store = useStores() diff --git a/src/view/com/notifications/FeedItem.tsx b/src/view/com/notifications/FeedItem.tsx index e76056067..c498dd607 100644 --- a/src/view/com/notifications/FeedItem.tsx +++ b/src/view/com/notifications/FeedItem.tsx @@ -1,7 +1,7 @@ import React, {useMemo} from 'react' import {observer} from 'mobx-react-lite' import {Image, StyleSheet, Text, View} from 'react-native' -import {AdxUri} from '../../../third-party/uri' +import {AtUri} from '../../../third-party/uri' import {FontAwesomeIcon, Props} from '@fortawesome/react-native-fontawesome' import {NotificationsViewItemModel} from '../../../state/models/notifications-view' import {s, colors} from '../../lib/styles' @@ -20,13 +20,13 @@ export const FeedItem = observer(function FeedItem({ }) { const itemHref = useMemo(() => { if (item.isLike || item.isRepost) { - const urip = new AdxUri(item.subjectUri) - return `/profile/${urip.host}/post/${urip.recordKey}` + const urip = new AtUri(item.subjectUri) + return `/profile/${urip.host}/post/${urip.rkey}` } else if (item.isFollow) { return `/profile/${item.author.name}` } else if (item.isReply) { - const urip = new AdxUri(item.uri) - return `/profile/${urip.host}/post/${urip.recordKey}` + const urip = new AtUri(item.uri) + return `/profile/${urip.host}/post/${urip.rkey}` } return '' }, [item]) diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx index 6f84aff10..e8fdd91af 100644 --- a/src/view/com/post-thread/PostThreadItem.tsx +++ b/src/view/com/post-thread/PostThreadItem.tsx @@ -2,7 +2,7 @@ import React, {useMemo} from 'react' import {observer} from 'mobx-react-lite' import {Image, StyleSheet, Text, TouchableOpacity, View} from 'react-native' import Svg, {Line} from 'react-native-svg' -import {AdxUri} from '../../../third-party/uri' +import {AtUri} from '../../../third-party/uri' import * as PostType from '../../../third-party/api/src/types/app/bsky/post' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {PostThreadViewPostModel} from '../../../state/models/post-thread-view' @@ -31,26 +31,29 @@ export const PostThreadItem = observer(function PostThreadItem({ const hasEngagement = item.likeCount || item.repostCount const itemHref = useMemo(() => { - const urip = new AdxUri(item.uri) - return `/profile/${item.author.name}/post/${urip.recordKey}` + const urip = new AtUri(item.uri) + return `/profile/${item.author.name}/post/${urip.rkey}` }, [item.uri, item.author.name]) const itemTitle = `Post by ${item.author.name}` const authorHref = `/profile/${item.author.name}` const authorTitle = item.author.name const likesHref = useMemo(() => { - const urip = new AdxUri(item.uri) - return `/profile/${item.author.name}/post/${urip.recordKey}/liked-by` + const urip = new AtUri(item.uri) + return `/profile/${item.author.name}/post/${urip.rkey}/liked-by` }, [item.uri, item.author.name]) const likesTitle = 'Likes on this post' const repostsHref = useMemo(() => { - const urip = new AdxUri(item.uri) - return `/profile/${item.author.name}/post/${urip.recordKey}/reposted-by` + const urip = new AtUri(item.uri) + return `/profile/${item.author.name}/post/${urip.rkey}/reposted-by` }, [item.uri, item.author.name]) const repostsTitle = 'Reposts of this post' const onPressReply = () => { store.shell.openModal( - new ComposePostModel({replyTo: item.uri, onPost: onPostReply}), + new ComposePostModel({ + replyTo: {uri: item.uri, cid: item.cid}, + onPost: onPostReply, + }), ) } const onPressToggleRepost = () => { diff --git a/src/view/com/post/Post.tsx b/src/view/com/post/Post.tsx index 04cc5cdd6..42611a39a 100644 --- a/src/view/com/post/Post.tsx +++ b/src/view/com/post/Post.tsx @@ -1,6 +1,6 @@ import React, {useState, useEffect, useMemo} from 'react' import {observer} from 'mobx-react-lite' -import {AdxUri} from '../../../third-party/uri' +import {AtUri} from '../../../third-party/uri' import * as PostType from '../../../third-party/api/src/types/app/bsky/post' import { ActivityIndicator, @@ -59,20 +59,22 @@ export const Post = observer(function Post({uri}: {uri: string}) { const item = view.thread const record = view.thread?.record as unknown as PostType.Record - const itemUrip = new AdxUri(item.uri) - const itemHref = `/profile/${item.author.name}/post/${itemUrip.recordKey}` + const itemUrip = new AtUri(item.uri) + const itemHref = `/profile/${item.author.name}/post/${itemUrip.rkey}` const itemTitle = `Post by ${item.author.name}` const authorHref = `/profile/${item.author.name}` const authorTitle = item.author.name let replyAuthorDid = '' let replyHref = '' if (record.reply) { - const urip = new AdxUri(record.reply.parent || record.reply.root) + const urip = new AtUri(record.reply.parent?.uri || record.reply.root.uri) replyAuthorDid = urip.hostname - replyHref = `/profile/${urip.hostname}/post/${urip.recordKey}` + replyHref = `/profile/${urip.hostname}/post/${urip.rkey}` } const onPressReply = () => { - store.shell.openModal(new ComposePostModel({replyTo: item.uri})) + store.shell.openModal( + new ComposePostModel({replyTo: {uri: item.uri, cid: item.cid}}), + ) } const onPressToggleRepost = () => { item diff --git a/src/view/com/posts/FeedItem.tsx b/src/view/com/posts/FeedItem.tsx index 9bb94ad05..6eb2b38fb 100644 --- a/src/view/com/posts/FeedItem.tsx +++ b/src/view/com/posts/FeedItem.tsx @@ -1,7 +1,7 @@ import React, {useMemo} from 'react' import {observer} from 'mobx-react-lite' import {Image, StyleSheet, Text, TouchableOpacity, View} from 'react-native' -import {AdxUri} from '../../../third-party/uri' +import {AtUri} from '../../../third-party/uri' import * as PostType from '../../../third-party/api/src/types/app/bsky/post' import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome' import {FeedViewItemModel} from '../../../state/models/feed-view' @@ -23,24 +23,26 @@ export const FeedItem = observer(function FeedItem({ const store = useStores() const record = item.record as unknown as PostType.Record const itemHref = useMemo(() => { - const urip = new AdxUri(item.uri) - return `/profile/${item.author.name}/post/${urip.recordKey}` + const urip = new AtUri(item.uri) + return `/profile/${item.author.name}/post/${urip.rkey}` }, [item.uri, item.author.name]) const itemTitle = `Post by ${item.author.name}` const authorHref = `/profile/${item.author.name}` const replyAuthorDid = useMemo(() => { if (!record.reply) return '' - const urip = new AdxUri(record.reply.parent || record.reply.root) + const urip = new AtUri(record.reply.parent?.uri || record.reply.root.uri) return urip.hostname }, [record.reply]) const replyHref = useMemo(() => { if (!record.reply) return '' - const urip = new AdxUri(record.reply.parent || record.reply.root) - return `/profile/${urip.hostname}/post/${urip.recordKey}` + const urip = new AtUri(record.reply.parent?.uri || record.reply.root.uri) + return `/profile/${urip.hostname}/post/${urip.rkey}` }, [record.reply]) const onPressReply = () => { - store.shell.openModal(new ComposePostModel({replyTo: item.uri})) + store.shell.openModal( + new ComposePostModel({replyTo: {uri: item.uri, cid: item.cid}}), + ) } const onPressToggleRepost = () => { item |