File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
apps/mobile/src/store/unread Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,15 @@ class UnreadSyncService {
30
30
return res . data
31
31
}
32
32
33
+ private async updateUnreadStatus ( feedIds : string [ ] ) {
34
+ await unreadActions . upsertMany ( feedIds . map ( ( id ) => ( { subscriptionId : id , count : 0 } ) ) )
35
+ entryActions . markEntryReadStatusInSession ( { feedIds, read : true } )
36
+ await EntryService . patchMany ( {
37
+ feedIds,
38
+ entry : { read : true } ,
39
+ } )
40
+ }
41
+
33
42
async markViewAsRead ( view : FeedViewType ) {
34
43
await apiClient . reads . all . $post ( {
35
44
json : {
@@ -38,7 +47,7 @@ class UnreadSyncService {
38
47
} )
39
48
40
49
const subscriptionIds = getSubscriptionByView ( view )
41
- await unreadActions . upsertMany ( subscriptionIds . map ( ( id ) => ( { subscriptionId : id , count : 0 } ) ) )
50
+ this . updateUnreadStatus ( subscriptionIds )
42
51
}
43
52
44
53
async markFeedAsRead ( feedId : string | string [ ] ) {
@@ -48,12 +57,7 @@ class UnreadSyncService {
48
57
json : { feedIdList : feedIds } ,
49
58
} )
50
59
51
- await unreadActions . upsertMany ( feedIds . map ( ( id ) => ( { subscriptionId : id , count : 0 } ) ) )
52
- entryActions . markEntryReadStatusInSession ( { feedIds, read : true } )
53
- await EntryService . patchMany ( {
54
- feedIds,
55
- entry : { read : true } ,
56
- } )
60
+ this . updateUnreadStatus ( feedIds )
57
61
}
58
62
59
63
async markEntryAsRead ( entryId : string ) {
You can’t perform that action at this time.
0 commit comments