Skip to content

Commit

Permalink
Fix key
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljscript committed Oct 30, 2024
1 parent 560dd08 commit 74ea1ff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Notification, Notifications} from '@jamsinclair/react-native-notifications'
import {mountAsyncStorage} from '@yoroi/common'
import {Notifications as NotificationTypes} from '@yoroi/types'
import {NotificationTrigger} from '@yoroi/types/lib/typescript/notifications/manager'

import {formatCurrency, getCurrencySymbol} from '../../../Settings/useCases/changeAppSettings/Currency/CurrencyContext'

Expand Down Expand Up @@ -36,6 +37,14 @@ export const displayNotificationEvent = async (notificationEvent: NotificationTy
id: notificationEvent.id,
})
}

if (notificationEvent.trigger === NotificationTrigger.RewardsUpdated) {
sendNotification({
title: 'Rewards updated',
body: 'Your rewards have been updated',
id: notificationEvent.id,
})
}
}

const sendNotification = (options: {title: string; body: string; id: number}) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ const buildNotifications = async (appStorage: App.Storage) => {
const wallet = walletManager.getWalletById(walletId)
if (!wallet) continue

const storage = buildProcessedNotificationsStorage(appStorage.join(`wallet/${walletId}/${storageKey}/`))
const fullStorageKey = `wallet/${walletId}/${wallet.networkManager.network}/${storageKey}/` as const
const storage = buildProcessedNotificationsStorage(appStorage.join(fullStorageKey))
const stakingInfo = await wallet.getStakingInfo()
if (stakingInfo.status !== 'staked') continue

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ const buildNotifications = async (appStorage: App.Storage) => {
for (const walletId of walletIds) {
const wallet = walletManager.getWalletById(walletId)
if (!wallet) continue
const storage = buildProcessedNotificationsStorage(appStorage.join(`wallet/${walletId}/${storageKey}/`))

const fullStorageKey = `wallet/${walletId}/${wallet.networkManager.network}/${storageKey}/` as const
const storage = buildProcessedNotificationsStorage(appStorage.join(fullStorageKey))
const processed = await storage.getValues()
const allTxIds = getTxIds(wallet)

Expand Down

0 comments on commit 74ea1ff

Please sign in to comment.