mirror of
https://github.com/status-im/safe-react.git
synced 2025-01-09 17:45:38 +00:00
Fix notification re-appears (#1925)
Co-authored-by: Daniel Sanchez <daniel.sanchez@gnosis.pm>
This commit is contained in:
parent
45b24e98fd
commit
8e52ec5f60
@ -32,6 +32,8 @@ const watchedActions = [
|
|||||||
ADD_QUEUED_TRANSACTIONS,
|
ADD_QUEUED_TRANSACTIONS,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const LAST_TIME_USED_LOGGED_IN_ID = 'LAST_TIME_USED_LOGGED_IN_ID'
|
||||||
|
|
||||||
const sendAwaitingTransactionNotification = async (
|
const sendAwaitingTransactionNotification = async (
|
||||||
dispatch,
|
dispatch,
|
||||||
safeAddress,
|
safeAddress,
|
||||||
@ -39,7 +41,6 @@ const sendAwaitingTransactionNotification = async (
|
|||||||
notificationKey,
|
notificationKey,
|
||||||
notificationClickedCb,
|
notificationClickedCb,
|
||||||
) => {
|
) => {
|
||||||
const LAST_TIME_USED_LOGGED_IN_ID = 'LAST_TIME_USED_LOGGED_IN_ID'
|
|
||||||
if (!dispatch || !safeAddress || !awaitingTxsSubmissionDateList || !notificationKey) {
|
if (!dispatch || !safeAddress || !awaitingTxsSubmissionDateList || !notificationKey) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -48,8 +49,7 @@ const sendAwaitingTransactionNotification = async (
|
|||||||
}
|
}
|
||||||
|
|
||||||
let lastTimeUserLoggedInForSafes = (await loadFromStorage<Record<string, string>>(LAST_TIME_USED_LOGGED_IN_ID)) || {}
|
let lastTimeUserLoggedInForSafes = (await loadFromStorage<Record<string, string>>(LAST_TIME_USED_LOGGED_IN_ID)) || {}
|
||||||
const lastTimeUserLoggedIn =
|
const lastTimeUserLoggedIn = lastTimeUserLoggedInForSafes[safeAddress]
|
||||||
lastTimeUserLoggedInForSafes && lastTimeUserLoggedInForSafes[safeAddress]
|
|
||||||
? lastTimeUserLoggedInForSafes[safeAddress]
|
? lastTimeUserLoggedInForSafes[safeAddress]
|
||||||
: null
|
: null
|
||||||
|
|
||||||
@ -57,16 +57,17 @@ const sendAwaitingTransactionNotification = async (
|
|||||||
return lastTimeUserLoggedIn ? new Date(submissionDate) > new Date(lastTimeUserLoggedIn) : true
|
return lastTimeUserLoggedIn ? new Date(submissionDate) > new Date(lastTimeUserLoggedIn) : true
|
||||||
})
|
})
|
||||||
|
|
||||||
if (filteredDuplicatedAwaitingTxList.length === 0) {
|
if (!filteredDuplicatedAwaitingTxList.length) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch(
|
dispatch(
|
||||||
enqueueSnackbar(enhanceSnackbarForAction(NOTIFICATIONS.TX_WAITING_MSG, notificationKey, notificationClickedCb)),
|
enqueueSnackbar(enhanceSnackbarForAction(NOTIFICATIONS.TX_WAITING_MSG, notificationKey, notificationClickedCb)),
|
||||||
)
|
)
|
||||||
|
|
||||||
lastTimeUserLoggedInForSafes = {
|
lastTimeUserLoggedInForSafes = {
|
||||||
...lastTimeUserLoggedInForSafes,
|
...lastTimeUserLoggedInForSafes,
|
||||||
[safeAddress]: lastTimeUserLoggedIn || new Date(),
|
[safeAddress]: new Date(),
|
||||||
}
|
}
|
||||||
await saveToStorage(LAST_TIME_USED_LOGGED_IN_ID, lastTimeUserLoggedInForSafes)
|
await saveToStorage(LAST_TIME_USED_LOGGED_IN_ID, lastTimeUserLoggedInForSafes)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user