Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 1 addition & 20 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1731,7 +1731,7 @@ export default class MetamaskController extends EventEmitter {
),
disableSnap: this.snapController.disableSnap.bind(this.snapController),
enableSnap: this.snapController.enableSnap.bind(this.snapController),
removeSnap: this.removeSnap.bind(this),
removeSnap: this.snapController.removeSnap.bind(this.snapController),
///: END:ONLY_INCLUDE_IN

// swaps
Expand Down Expand Up @@ -4121,23 +4121,4 @@ export default class MetamaskController extends EventEmitter {
}
return this.keyringController.setLocked();
}

///: BEGIN:ONLY_INCLUDE_IN(flask)
// SNAPS
/**
* Removes the specified snap, and all of its associated permissions.
* If we didn't revoke the permission to access the snap from all subjects,
* they could just reinstall without any confirmation.
*
* TODO: This should be implemented in `SnapController.removeSnap` via a controller action.
*
* @param {{ id: string, permissionName: string }} snap - The wrapper object of the snap to remove.
*/
removeSnap(snap) {
this.snapController.removeSnap(snap.id);
this.permissionController.revokePermissionForAllSubjects(
snap.permissionName,
);
}
///: END:ONLY_INCLUDE_IN
}
2 changes: 1 addition & 1 deletion ui/pages/settings/flask/view-snap/view-snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function ViewSnap() {
<SnapRemoveWarning
onCancel={() => setIsShowingRemoveWarning(false)}
onSubmit={async () => {
await dispatch(removeSnap(snap));
await dispatch(removeSnap(snap.id));
}}
snapName={snap.manifest.proposedName}
/>
Expand Down
4 changes: 2 additions & 2 deletions ui/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -991,9 +991,9 @@ export function enableSnap(snapId) {
};
}

export function removeSnap(snap) {
export function removeSnap(snapId) {
return async (dispatch) => {
await promisifiedBackground.removeSnap(snap);
await promisifiedBackground.removeSnap(snapId);
await forceUpdateMetamaskState(dispatch);
};
}
Expand Down