Skip to content

Commit

Permalink
Rename updated to changed
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljscript committed Oct 25, 2024
1 parent 46a95dc commit da958a8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {PermissionsAndroid} from 'react-native'

import {notificationManager} from './notification-manager'
import {parseNotificationId} from './notifications'
import {usePrimaryTokenPriceChangedNotification} from './primary-token-price-updated-notification'
import {usePrimaryTokenPriceChangedNotification} from './primary-token-price-changed-notification'
import {useTransactionReceivedNotifications} from './transaction-received-notification'

let initialized = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {notificationManagerMaker} from '@yoroi/notifications'
import {Notifications} from '@yoroi/types'

import {displayNotificationEvent} from './notifications'
import {primaryTokenPriceChangedSubject} from './primary-token-price-updated-notification'
import {primaryTokenPriceChangedSubject} from './primary-token-price-changed-notification'
import {transactionReceivedSubject} from './transaction-received-notification'

const appStorage = mountAsyncStorage({path: '/'})
Expand Down
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 {formatCurrency, getCurrencySymbol} from '../../../Settings/useCases/changeAppSettings/Currency/CurrencyContext'

export const generateNotificationId = (): number => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import {notificationManager} from './notification-manager'
import {generateNotificationId} from './notifications'
import {buildProcessedNotificationsStorage} from './storage'

const backgroundTaskId = 'yoroi-primary-token-price-updated-background-fetch'
const backgroundTaskId = 'yoroi-primary-token-price-changed-background-fetch'
const refetchIntervalInSeconds = 60 * 10
const refetchIntervalInMilliseconds = refetchIntervalInSeconds * 1000
const storageKey = 'notifications/primary-token-price-updated/'
const storageKey = 'notifications/primary-token-price-changed/'

// Check is needed for hot reloading, as task can not be defined twice
if (!TaskManager.isTaskDefined(backgroundTaskId)) {
Expand Down Expand Up @@ -54,7 +54,7 @@ const buildNotifications = async (
const changeInPercent = (Math.abs(close - open) / open) * 100

if (changeInPercent >= primaryTokenChangeNotificationConfig.thresholdInPercent) {
const event = createPrimaryTokenPriceUpdatedNotification({previousPrice: open, nextPrice: close})
const event = createPrimaryTokenPriceChangedNotification({previousPrice: open, nextPrice: close})
notifications.push(event)
await storage.addValues([dateString])
}
Expand Down Expand Up @@ -101,7 +101,7 @@ const unregisterBackgroundFetchAsync = () => {
return BackgroundFetch.unregisterTaskAsync(backgroundTaskId)
}

const createPrimaryTokenPriceUpdatedNotification = (
const createPrimaryTokenPriceChangedNotification = (
metadata: NotificationTypes.PrimaryTokenPriceChangedEvent['metadata'],
): NotificationTypes.PrimaryTokenPriceChangedEvent => {
return {
Expand Down

0 comments on commit da958a8

Please sign in to comment.