Improve link meta fetching for bsky links (#54)

* Add share dropdown item to profiles

* Temporary improvement for links to content on the network

* Enlarge text slightly on embed cards
This commit is contained in:
Paul Frazee 2023-01-19 12:30:28 -06:00 committed by GitHub
parent 0536a6afcf
commit 9230d52ff5
8 changed files with 123 additions and 23 deletions

View file

@ -94,7 +94,7 @@ export const ComposePost = observer(function ComposePost({
return cleanup
}
if (!extLink.meta) {
getLinkMeta(extLink.uri).then(meta => {
getLinkMeta(store, extLink.uri).then(meta => {
if (aborted) {
return
}

View file

@ -1,6 +1,7 @@
import React from 'react'
import {observer} from 'mobx-react-lite'
import {
Share,
StyleSheet,
TouchableOpacity,
TouchableWithoutFeedback,
@ -16,7 +17,7 @@ import {
ReportAccountModal,
ProfileImageLightbox,
} from '../../../state/models/shell-ui'
import {pluralize} from '../../../lib/strings'
import {pluralize, toShareUrl} from '../../../lib/strings'
import {s, gradients} from '../../lib/styles'
import {DropdownButton, DropdownItem} from '../util/forms/DropdownButton'
import * as Toast from '../util/Toast'
@ -66,6 +67,9 @@ export const ProfileHeader = observer(function ProfileHeader({
const onPressFollows = () => {
store.nav.navigate(`/profile/${view.handle}/follows`)
}
const onPressShare = () => {
Share.share({url: toShareUrl(`/profile/${view.handle}`)})
}
const onPressMuteAccount = async () => {
try {
await view.muteAccount()
@ -133,9 +137,8 @@ export const ProfileHeader = observer(function ProfileHeader({
// loaded
// =
const isMe = store.me.did === view.did
let dropdownItems: DropdownItem[] | undefined
let dropdownItems: DropdownItem[] = [{label: 'Share', onPress: onPressShare}]
if (!isMe) {
dropdownItems = dropdownItems || []
dropdownItems.push({
label: view.myState.muted ? 'Unmute Account' : 'Mute Account',
onPress: view.myState.muted ? onPressUnmuteAccount : onPressMuteAccount,

View file

@ -92,7 +92,7 @@ export function PostEmbeds({
/>
)}
<View style={styles.extInner}>
<Text type="sm-bold" numberOfLines={2} style={[pal.text]}>
<Text type="md-bold" numberOfLines={2} style={[pal.text]}>
{link.title || link.uri}
</Text>
<Text