Page MenuHomePhorge

D15444.1768261275.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D15444.1768261275.diff

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

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)

Event Timeline