mirror of https://github.com/trezor/trezor-wallet
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
953 B
25 lines
953 B
6 years ago
|
/* @flow */
|
||
|
'use strict';
|
||
|
|
||
|
import * as NOTIFICATION from './constants/notification';
|
||
|
|
||
|
|
||
|
// called from RouterService
|
||
|
export const clear = (currentParams, requestedParams): any => {
|
||
|
return async (dispatch, getState) => {
|
||
|
// if route has been changed from device view into something else (like other device, settings...)
|
||
|
// try to remove all Notifications which are linked to previous device (they are not cancelable by user)
|
||
|
if (currentParams.device !== requestedParams.device || currentParams.deviceInstance !== requestedParams.deviceInstance) {
|
||
|
const entries = getState().notifications.filter(entry => typeof entry.devicePath === 'string');
|
||
|
entries.forEach(entry => {
|
||
|
dispatch({
|
||
|
type: NOTIFICATION.CLOSE,
|
||
|
payload: {
|
||
|
devicePath: entry.devicePath
|
||
|
}
|
||
|
})
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|