Update to latest APIs

This commit is contained in:
Paul Frazee 2022-10-26 14:34:47 -05:00
parent 349cfe7177
commit 1983512fef
74 changed files with 2334 additions and 525 deletions

View file

@ -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