mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
[FLASK] Resolve snap_dialog
approval on close (#16801)
This commit is contained in:
parent
f8881a01db
commit
3cfef11f71
@ -17,6 +17,9 @@ import {
|
||||
ENVIRONMENT_TYPE_FULLSCREEN,
|
||||
EXTENSION_MESSAGES,
|
||||
PLATFORM_FIREFOX,
|
||||
///: BEGIN:ONLY_INCLUDE_IN(flask)
|
||||
MESSAGE_TYPE,
|
||||
///: END:ONLY_INCLUDE_IN
|
||||
} from '../../shared/constants/app';
|
||||
import { SECOND } from '../../shared/constants/time';
|
||||
import {
|
||||
@ -721,9 +724,27 @@ function setupController(initState, initLangCode) {
|
||||
),
|
||||
);
|
||||
|
||||
// Finally, reject all approvals managed by the ApprovalController
|
||||
controller.approvalController.clear(
|
||||
ethErrors.provider.userRejectedRequest(),
|
||||
// Finally, resolve snap dialog approvals on Flask and reject all the others managed by the ApprovalController.
|
||||
Object.values(controller.approvalController.state.pendingApprovals).forEach(
|
||||
({ id, type }) => {
|
||||
switch (type) {
|
||||
///: BEGIN:ONLY_INCLUDE_IN(flask)
|
||||
case MESSAGE_TYPE.SNAP_DIALOG_ALERT:
|
||||
case MESSAGE_TYPE.SNAP_DIALOG_PROMPT:
|
||||
controller.approvalController.accept(id, null);
|
||||
break;
|
||||
case MESSAGE_TYPE.SNAP_DIALOG_CONFIRMATION:
|
||||
controller.approvalController.accept(id, false);
|
||||
break;
|
||||
///: END:ONLY_INCLUDE_IN
|
||||
default:
|
||||
controller.approvalController.reject(
|
||||
id,
|
||||
ethErrors.provider.userRejectedRequest(),
|
||||
);
|
||||
break;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
updateBadge();
|
||||
|
Loading…
Reference in New Issue
Block a user