diff --git a/packages/extension-base/src/services/inapp-notification-service/index.ts b/packages/extension-base/src/services/inapp-notification-service/index.ts index c90fa5219a..dc8095d503 100644 --- a/packages/extension-base/src/services/inapp-notification-service/index.ts +++ b/packages/extension-base/src/services/inapp-notification-service/index.ts @@ -165,27 +165,26 @@ export class InappNotificationService implements CronServiceInterface { } async validateAndWriteNotificationsToDB (notifications: _BaseNotificationInfo[], address: string) { - return; - // const proxyId = this.keyringService.context.belongUnifiedAccount(address) || address; - // const accountName = this.keyringService.context.getCurrentAccountProxyName(proxyId); - // const passNotifications: _NotificationInfo[] = []; - // const [comparedNotifications, remindTimeConfig] = await Promise.all([ - // this.fetchNotificationsByParams({ notificationTab: NotificationTab.ALL, proxyId }), - // await fetchLastestRemindNotificationTime() - // ]); - // - // for (const candidateNotification of notifications) { - // candidateNotification.title = candidateNotification.title.replace('{{accountName}}', accountName); - // - // if (this.passValidateNotification(candidateNotification, comparedNotifications, remindTimeConfig)) { - // passNotifications.push({ - // ...candidateNotification, - // proxyId - // }); - // } - // } - // - // await this.dbService.upsertNotifications(passNotifications); + const proxyId = this.keyringService.context.belongUnifiedAccount(address) || address; + const accountName = this.keyringService.context.getCurrentAccountProxyName(proxyId); + const passNotifications: _NotificationInfo[] = []; + const [comparedNotifications, remindTimeConfig] = await Promise.all([ + this.fetchNotificationsByParams({ notificationTab: NotificationTab.ALL, proxyId }), + await fetchLastestRemindNotificationTime() + ]); + + for (const candidateNotification of notifications) { + candidateNotification.title = candidateNotification.title.replace('{{accountName}}', accountName); + + if (this.passValidateNotification(candidateNotification, comparedNotifications, remindTimeConfig)) { + passNotifications.push({ + ...candidateNotification, + proxyId + }); + } + } + + await this.dbService.upsertNotifications(passNotifications); } cronCreateBridgeClaimNotification () { @@ -374,7 +373,7 @@ export class InappNotificationService implements CronServiceInterface { try { this.status = ServiceStatus.STARTING; - // await this.startCron(); + await this.startCron(); this.status = ServiceStatus.STARTED; } catch (e) {