merge main

This commit is contained in:
Hailey
2024-06-10 13:20:05 -07:00
11 changed files with 101 additions and 33 deletions
+10 -3
View File
@@ -305,7 +305,13 @@ export const ComposePost = observer(function ComposePost({
localThumb: undefined,
} as apilib.ExternalEmbedDraft)
}
setError(cleanError(e.message))
let err = cleanError(e.message)
if (err.includes('not locate record')) {
err = _(
msg`We're sorry! The post you are replying to has been deleted.`,
)
}
setError(err)
setIsProcessing(false)
return
} finally {
@@ -785,11 +791,12 @@ const styles = StyleSheet.create({
},
errorLine: {
flexDirection: 'row',
alignItems: 'center',
backgroundColor: colors.red1,
borderRadius: 6,
marginHorizontal: 16,
paddingHorizontal: 8,
paddingVertical: 6,
paddingHorizontal: 12,
paddingVertical: 10,
marginBottom: 8,
},
reminderLine: {
+31 -10
View File
@@ -1,5 +1,12 @@
import React from 'react'
import {Pressable, StyleProp, StyleSheet, View, ViewStyle} from 'react-native'
import {
Linking,
Pressable,
StyleProp,
StyleSheet,
View,
ViewStyle,
} from 'react-native'
import {AtUri} from '@atproto/api'
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
import {msg, Plural, Trans} from '@lingui/macro'
@@ -26,6 +33,7 @@ import {RichText} from '#/components/RichText'
import {Text} from '../util/text/Text'
import {UserAvatar} from '../util/UserAvatar'
import hairlineWidth = StyleSheet.hairlineWidth
import {shouldClickOpenNewTab} from '#/platform/urls'
export function FeedSourceCard({
feedUri,
@@ -203,17 +211,30 @@ export function FeedSourceCardLoaded({
style,
{borderTopWidth: hideTopBorder ? 0 : hairlineWidth},
]}
onPress={() => {
onPress={e => {
const shouldOpenInNewTab = shouldClickOpenNewTab(e)
if (feed.type === 'feed') {
navigation.push('ProfileFeed', {
name: feed.creatorDid,
rkey: new AtUri(feed.uri).rkey,
})
if (shouldOpenInNewTab) {
Linking.openURL(
`/profile/${feed.creatorDid}/feed/${new AtUri(feed.uri).rkey}`,
)
} else {
navigation.push('ProfileFeed', {
name: feed.creatorDid,
rkey: new AtUri(feed.uri).rkey,
})
}
} else if (feed.type === 'list') {
navigation.push('ProfileList', {
name: feed.creatorDid,
rkey: new AtUri(feed.uri).rkey,
})
if (shouldOpenInNewTab) {
Linking.openURL(
`/profile/${feed.creatorDid}/lists/${new AtUri(feed.uri).rkey}`,
)
} else {
navigation.push('ProfileList', {
name: feed.creatorDid,
rkey: new AtUri(feed.uri).rkey,
})
}
}
}}
key={feed.uri}>
+2 -3
View File
@@ -49,8 +49,7 @@ export function FeedErrorMessage({
if (
typeof knownError !== 'undefined' &&
knownError !== KnownError.Unknown &&
(savedFeedConfig?.type === 'feed' ||
knownError === KnownError.FeedNSFPublic)
feedDesc.startsWith('feedgen')
) {
return (
<FeedgenErrorMessage
@@ -272,7 +271,7 @@ function detectKnownError(
) {
return KnownError.FeedgenMisconfigured
}
if (error.includes('feed provided an invalid response')) {
if (error.includes('invalid response')) {
return KnownError.FeedgenBadResponse
}
return KnownError.FeedgenUnknown
+6
View File
@@ -20,6 +20,7 @@ import {
} from '#/state/shell'
import {useSelectedFeed, useSetSelectedFeed} from '#/state/shell/selected-feed'
import {useOTAUpdates} from 'lib/hooks/useOTAUpdates'
import {useRequestNotificationsPermission} from 'lib/notifications/notifications'
import {HomeTabNavigatorParams, NativeStackScreenProps} from 'lib/routes/types'
import {
useSetUsedStarterPack,
@@ -71,12 +72,17 @@ function HomeScreenReady({
const maybeFoundIndex = allFeeds.indexOf(rawSelectedFeed)
const selectedIndex = Math.max(0, maybeFoundIndex)
const selectedFeed = allFeeds[selectedIndex]
const requestNotificationsPermission = useRequestNotificationsPermission()
const usedStarterPack = useUsedStarterPack()
const setUsedStarterPack = useSetUsedStarterPack()
useSetTitle(pinnedFeedInfos[selectedIndex]?.displayName)
useOTAUpdates()
React.useEffect(() => {
requestNotificationsPermission('Home')
}, [requestNotificationsPermission])
const pagerRef = React.useRef<PagerRef>(null)
const lastPagerReportedIndexRef = React.useRef(selectedIndex)
React.useLayoutEffect(() => {