[APP-702] Render Custom Feed likes properly (#980)
* render href for custom feed likes properly * fix custom feed text in push notification * fix custom feed accessibility title * fix lint
This commit is contained in:
parent
99aa38e3ca
commit
fe32730025
4 changed files with 25 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
||||||
import notifee, {EventType} from '@notifee/react-native'
|
import notifee, {EventType} from '@notifee/react-native'
|
||||||
import {AppBskyEmbedImages} from '@atproto/api'
|
import {AppBskyEmbedImages, AtUri} from '@atproto/api'
|
||||||
import {RootStoreModel} from 'state/models/root-store'
|
import {RootStoreModel} from 'state/models/root-store'
|
||||||
import {NotificationsFeedItemModel} from 'state/models/feeds/notifications'
|
import {NotificationsFeedItemModel} from 'state/models/feeds/notifications'
|
||||||
import {enforceLen} from 'lib/strings/helpers'
|
import {enforceLen} from 'lib/strings/helpers'
|
||||||
|
@ -63,6 +63,9 @@ export function displayNotificationFromModel(
|
||||||
} else if (notification.isFollow) {
|
} else if (notification.isFollow) {
|
||||||
title = 'New follower!'
|
title = 'New follower!'
|
||||||
body = `${author} has followed you`
|
body = `${author} has followed you`
|
||||||
|
} else if (notification.isCustomFeedLike) {
|
||||||
|
title = `${author} liked your custom feed`
|
||||||
|
body = `${new AtUri(notification.subjectUri).rkey}`
|
||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,7 +145,7 @@ export class NotificationsFeedItemModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
get isLike() {
|
get isLike() {
|
||||||
return this.reason === 'like'
|
return this.reason === 'like' && !this.isCustomFeedLike // the reason property for custom feed likes is also 'like'
|
||||||
}
|
}
|
||||||
|
|
||||||
get isRepost() {
|
get isRepost() {
|
||||||
|
@ -168,6 +168,12 @@ export class NotificationsFeedItemModel {
|
||||||
return this.reason === 'follow'
|
return this.reason === 'follow'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isCustomFeedLike() {
|
||||||
|
return (
|
||||||
|
this.reason === 'like' && this.reasonSubject?.includes('feed.generator')
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
get needsAdditionalData() {
|
get needsAdditionalData() {
|
||||||
if (
|
if (
|
||||||
this.isLike ||
|
this.isLike ||
|
||||||
|
|
|
@ -65,6 +65,9 @@ export const FeedItem = observer(function ({
|
||||||
} else if (item.isReply) {
|
} else if (item.isReply) {
|
||||||
const urip = new AtUri(item.uri)
|
const urip = new AtUri(item.uri)
|
||||||
return `/profile/${urip.host}/post/${urip.rkey}`
|
return `/profile/${urip.host}/post/${urip.rkey}`
|
||||||
|
} else if (item.isCustomFeedLike) {
|
||||||
|
const urip = new AtUri(item.subjectUri)
|
||||||
|
return `/profile/${urip.host}/feed/${urip.rkey}`
|
||||||
}
|
}
|
||||||
return ''
|
return ''
|
||||||
}, [item])
|
}, [item])
|
||||||
|
@ -75,6 +78,8 @@ export const FeedItem = observer(function ({
|
||||||
return item.author.handle
|
return item.author.handle
|
||||||
} else if (item.isReply) {
|
} else if (item.isReply) {
|
||||||
return 'Post'
|
return 'Post'
|
||||||
|
} else if (item.isCustomFeedLike) {
|
||||||
|
return 'Custom Feed'
|
||||||
}
|
}
|
||||||
}, [item])
|
}, [item])
|
||||||
|
|
||||||
|
@ -160,6 +165,13 @@ export const FeedItem = observer(function ({
|
||||||
action = 'followed you'
|
action = 'followed you'
|
||||||
icon = 'user-plus'
|
icon = 'user-plus'
|
||||||
iconStyle = [s.blue3 as FontAwesomeIconStyle]
|
iconStyle = [s.blue3 as FontAwesomeIconStyle]
|
||||||
|
} else if (item.isCustomFeedLike) {
|
||||||
|
action = `liked your custom feed '${new AtUri(item.subjectUri).rkey}'`
|
||||||
|
icon = 'HeartIconSolid'
|
||||||
|
iconStyle = [
|
||||||
|
s.red3 as FontAwesomeIconStyle,
|
||||||
|
{position: 'relative', top: -4},
|
||||||
|
]
|
||||||
} else {
|
} else {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ const styles = isDesktopWeb
|
||||||
paddingHorizontal: 10,
|
paddingHorizontal: 10,
|
||||||
borderBottomWidth: 3,
|
borderBottomWidth: 3,
|
||||||
borderBottomColor: 'transparent',
|
borderBottomColor: 'transparent',
|
||||||
justifyContent: 'center'
|
justifyContent: 'center',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
: StyleSheet.create({
|
: StyleSheet.create({
|
||||||
|
@ -130,6 +130,6 @@ const styles = isDesktopWeb
|
||||||
paddingHorizontal: isMobileWeb ? 8 : 0,
|
paddingHorizontal: isMobileWeb ? 8 : 0,
|
||||||
borderBottomWidth: 3,
|
borderBottomWidth: 3,
|
||||||
borderBottomColor: 'transparent',
|
borderBottomColor: 'transparent',
|
||||||
justifyContent: 'center'
|
justifyContent: 'center',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue