Skip to content

Commit 4f5c106

Browse files
authored
fix: skip reporting already-read notifications (#8848)
1 parent 05f53bf commit 4f5c106

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

packages/kit/src/views/Notifications/pages/NotificationList.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ function BaseNotificationList() {
492492
item?.body?.extras?.params?.msgId ||
493493
item?.body?.extras?.msgId ||
494494
'',
495+
isRead: !!item.readed,
495496
});
496497
setTimeout(() => {
497498
if (!item.readed) {

packages/shared/src/logger/scopes/app/scenes/page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class PageScene extends BaseScene {
3737
public notificationItemClicked(
3838
notificationId: string,
3939
type: ENotificationPushTopicTypes | 'unknown',
40-
clickFrom: 'notificationClick' | 'notificationListClick',
40+
clickFrom: 'app' | 'system',
4141
) {
4242
return { notificationId, type, clickFrom };
4343
}

packages/shared/src/utils/notificationsUtils.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ export interface INavigateToNotificationDetailParams {
121121
mode?: ENotificationPushMessageMode;
122122
payload?: string;
123123
topicType?: ENotificationPushTopicTypes;
124+
isRead?: boolean;
124125
}
125126

126127
export function parseNotificationPayload(
@@ -174,18 +175,21 @@ async function navigateToNotificationDetail({
174175
mode,
175176
payload,
176177
topicType,
178+
isRead = false,
177179
}: INavigateToNotificationDetailParams) {
178180
let routes: string[] = [];
179181
let params: any = {};
180182
let shouldAckRead = true;
181183

182-
setTimeout(() => {
183-
defaultLogger.app.page.notificationItemClicked(
184-
notificationId,
185-
topicType || 'unknown',
186-
isFromNotificationClick ? 'notificationClick' : 'notificationListClick',
187-
);
188-
});
184+
if (!isRead) {
185+
setTimeout(() => {
186+
defaultLogger.app.page.notificationItemClicked(
187+
notificationId,
188+
topicType || 'unknown',
189+
isFromNotificationClick ? 'app' : 'system',
190+
);
191+
});
192+
}
189193

190194
if (isFromNotificationClick) {
191195
const statusRoutes = appGlobals.$navigationRef.current?.getState().routes;

0 commit comments

Comments
 (0)