Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32944676
D15444.1768261275.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D15444.1768261275.diff
View Options
diff --git a/native/push/push-handler.react.js b/native/push/push-handler.react.js
--- a/native/push/push-handler.react.js
+++ b/native/push/push-handler.react.js
@@ -347,10 +347,6 @@
unreadCount: curThinUnreadCounts[keyserverID],
});
}
- notifStorageUpdates.push({
- id: 'FARCASTER',
- unreadCount: currentFarcasterUnreadCount,
- });
let queriedKeyserverData: $ReadOnlyArray<{
+id: string,
@@ -367,13 +363,34 @@
return await commCoreModule.getUnreadThickThreadIDsFromNotifsStorage();
})();
+ const handleUnreadFarcasterInNotifsStorage = (async () => {
+ if (currentTunnelbrokerConnectionStatus) {
+ const farcasterEntry = {
+ id: 'FARCASTER',
+ unreadCount: currentFarcasterUnreadCount,
+ };
+ await commCoreModule.updateDataInNotifStorage([farcasterEntry]);
+ return currentFarcasterUnreadCount;
+ }
+ const farcasterData = await commCoreModule.getDataFromNotifStorage([
+ 'FARCASTER',
+ ]);
+ if (farcasterData.length > 0) {
+ return farcasterData[0].unreadCount;
+ }
+ return 0;
+ })();
+
let unreadThickThreadIDs: $ReadOnlyArray<string>;
+ let farcasterUnreadCount: number;
try {
- [queriedKeyserverData, unreadThickThreadIDs] = await Promise.all([
- commCoreModule.getDataFromNotifStorage(notifsStorageQueries),
- handleUnreadThickThreadIDsInNotifsStorage,
- commCoreModule.updateDataInNotifStorage(notifStorageUpdates),
- ]);
+ [queriedKeyserverData, unreadThickThreadIDs, farcasterUnreadCount] =
+ await Promise.all([
+ commCoreModule.getDataFromNotifStorage(notifsStorageQueries),
+ handleUnreadThickThreadIDsInNotifsStorage,
+ handleUnreadFarcasterInNotifsStorage,
+ commCoreModule.updateDataInNotifStorage(notifStorageUpdates),
+ ]);
} catch (e) {
if (__DEV__) {
Alert.alert(
@@ -394,19 +411,6 @@
}
totalUnreadCount += unreadThickThreadIDs.length;
-
- let farcasterUnreadCount = 0;
- try {
- const farcasterData = await commCoreModule.getDataFromNotifStorage([
- 'FARCASTER',
- ]);
- if (farcasterData.length > 0) {
- farcasterUnreadCount = farcasterData[0].unreadCount;
- }
- } catch (e) {
- console.error('Failed to get Farcaster unread count:', e);
- }
-
totalUnreadCount += farcasterUnreadCount;
if (Platform.OS === 'ios') {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 12, 11:41 PM (6 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5922509
Default Alt Text
D15444.1768261275.diff (2 KB)
Attached To
Mode
D15444: [native] Don't count unread counts twice
Attached
Detach File
Event Timeline
Log In to Comment