@@ -4,6 +4,7 @@ import { collectionSyncService } from "@follow/store/collection/store"
44import { getEntry } from "@follow/store/entry/getter"
55import { useEntry } from "@follow/store/entry/hooks"
66import { unreadSyncService } from "@follow/store/unread/store"
7+ import { useIsLoggedIn } from "@follow/store/user/hooks"
78import { PortalProvider } from "@gorhom/portal"
89import type { PropsWithChildren } from "react"
910import { useCallback } from "react"
@@ -32,6 +33,7 @@ export const EntryItemContextMenu = ({
3233 const { t } = useTranslation ( )
3334 const selectedView = useSelectedView ( )
3435 const selectedFeed = useSelectedFeed ( )
36+ const isLoggedIn = useIsLoggedIn ( )
3537 const entry = useEntry ( id , ( state ) => ( {
3638 read : state . read ,
3739 feedId : state . feedId ,
@@ -73,81 +75,85 @@ export const EntryItemContextMenu = ({
7375 ) }
7476 </ ContextMenu . Preview >
7577
76- < ContextMenu . Item
77- key = "MarkAsReadAbove"
78- onSelect = { ( ) => {
79- const payload = getFetchEntryPayload ( selectedFeed , selectedView )
80- const { publishedAt } = entry
81- unreadSyncService . markBatchAsRead ( {
82- view : selectedView ,
83- filter : payload ,
84- time : {
85- startTime : new Date ( publishedAt ) . getTime ( ) + 1 ,
86- endTime : Date . now ( ) ,
87- } ,
88- excludePrivate : getHideAllReadSubscriptions ( ) ,
89- } )
90- } }
91- >
92- < ContextMenu . ItemIcon
93- ios = { {
94- name : "arrow.up" ,
95- } }
96- />
97- < ContextMenu . ItemTitle >
98- { t ( "operation.mark_all_as_read_which" , {
99- which : t ( "operation.mark_all_as_read_which_above" ) ,
100- } ) }
101- </ ContextMenu . ItemTitle >
102- </ ContextMenu . Item >
78+ { isLoggedIn && (
79+ < >
80+ < ContextMenu . Item
81+ key = "MarkAsReadAbove"
82+ onSelect = { ( ) => {
83+ const payload = getFetchEntryPayload ( selectedFeed , selectedView )
84+ const { publishedAt } = entry
85+ unreadSyncService . markBatchAsRead ( {
86+ view : selectedView ,
87+ filter : payload ,
88+ time : {
89+ startTime : new Date ( publishedAt ) . getTime ( ) + 1 ,
90+ endTime : Date . now ( ) ,
91+ } ,
92+ excludePrivate : getHideAllReadSubscriptions ( ) ,
93+ } )
94+ } }
95+ >
96+ < ContextMenu . ItemIcon
97+ ios = { {
98+ name : "arrow.up" ,
99+ } }
100+ />
101+ < ContextMenu . ItemTitle >
102+ { t ( "operation.mark_all_as_read_which" , {
103+ which : t ( "operation.mark_all_as_read_which_above" ) ,
104+ } ) }
105+ </ ContextMenu . ItemTitle >
106+ </ ContextMenu . Item >
103107
104- < ContextMenu . Item
105- key = "MarkAsRead"
106- onSelect = { ( ) => {
107- entry . read
108- ? unreadSyncService . markEntryAsUnread ( id )
109- : unreadSyncService . markEntryAsRead ( id )
110- } }
111- >
112- < ContextMenu . ItemTitle >
113- { entry . read ? t ( "operation.mark_as_unread" ) : t ( "operation.mark_as_read" ) }
114- </ ContextMenu . ItemTitle >
115- < ContextMenu . ItemIcon
116- ios = { {
117- name : entry . read ? "circle.fill" : "checkmark.circle" ,
118- } }
119- />
120- </ ContextMenu . Item >
108+ < ContextMenu . Item
109+ key = "MarkAsRead"
110+ onSelect = { ( ) => {
111+ entry . read
112+ ? unreadSyncService . markEntryAsUnread ( id )
113+ : unreadSyncService . markEntryAsRead ( id )
114+ } }
115+ >
116+ < ContextMenu . ItemTitle >
117+ { entry . read ? t ( "operation.mark_as_unread" ) : t ( "operation.mark_as_read" ) }
118+ </ ContextMenu . ItemTitle >
119+ < ContextMenu . ItemIcon
120+ ios = { {
121+ name : entry . read ? "circle.fill" : "checkmark.circle" ,
122+ } }
123+ />
124+ </ ContextMenu . Item >
121125
122- < ContextMenu . Item
123- key = "MarkAsReadBelow"
124- onSelect = { ( ) => {
125- const payload = getFetchEntryPayload ( selectedFeed , selectedView )
126- const { publishedAt } = entry
127- unreadSyncService . markBatchAsRead ( {
128- view : selectedView ,
129- filter : payload ,
130- time : {
131- startTime : 1 ,
132- endTime : new Date ( publishedAt ) . getTime ( ) - 1 ,
133- } ,
134- excludePrivate : getHideAllReadSubscriptions ( ) ,
135- } )
136- } }
137- >
138- < ContextMenu . ItemIcon
139- ios = { {
140- name : "arrow.down" ,
141- } }
142- />
143- < ContextMenu . ItemTitle >
144- { t ( "operation.mark_all_as_read_which" , {
145- which : t ( "operation.mark_all_as_read_which_below" ) ,
146- } ) }
147- </ ContextMenu . ItemTitle >
148- </ ContextMenu . Item >
126+ < ContextMenu . Item
127+ key = "MarkAsReadBelow"
128+ onSelect = { ( ) => {
129+ const payload = getFetchEntryPayload ( selectedFeed , selectedView )
130+ const { publishedAt } = entry
131+ unreadSyncService . markBatchAsRead ( {
132+ view : selectedView ,
133+ filter : payload ,
134+ time : {
135+ startTime : 1 ,
136+ endTime : new Date ( publishedAt ) . getTime ( ) - 1 ,
137+ } ,
138+ excludePrivate : getHideAllReadSubscriptions ( ) ,
139+ } )
140+ } }
141+ >
142+ < ContextMenu . ItemIcon
143+ ios = { {
144+ name : "arrow.down" ,
145+ } }
146+ />
147+ < ContextMenu . ItemTitle >
148+ { t ( "operation.mark_all_as_read_which" , {
149+ which : t ( "operation.mark_all_as_read_which_below" ) ,
150+ } ) }
151+ </ ContextMenu . ItemTitle >
152+ </ ContextMenu . Item >
153+ </ >
154+ ) }
149155
150- { feedId && view !== undefined && (
156+ { isLoggedIn && feedId && view !== undefined && (
151157 < ContextMenu . Item
152158 key = "Star"
153159 onSelect = { ( ) => {
0 commit comments