Skip to content

Commit 01bc48c

Browse files
Simplify removeSnap functionality after snaps-skunkworks update
1 parent 07da8ce commit 01bc48c

File tree

3 files changed

+4
-23
lines changed

3 files changed

+4
-23
lines changed

app/scripts/metamask-controller.js

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,7 +1731,7 @@ export default class MetamaskController extends EventEmitter {
17311731
),
17321732
disableSnap: this.snapController.disableSnap.bind(this.snapController),
17331733
enableSnap: this.snapController.enableSnap.bind(this.snapController),
1734-
removeSnap: this.removeSnap.bind(this),
1734+
removeSnap: this.snapController.removeSnap.bind(this.snapController),
17351735
///: END:ONLY_INCLUDE_IN
17361736

17371737
// swaps
@@ -4121,23 +4121,4 @@ export default class MetamaskController extends EventEmitter {
41214121
}
41224122
return this.keyringController.setLocked();
41234123
}
4124-
4125-
///: BEGIN:ONLY_INCLUDE_IN(flask)
4126-
// SNAPS
4127-
/**
4128-
* Removes the specified snap, and all of its associated permissions.
4129-
* If we didn't revoke the permission to access the snap from all subjects,
4130-
* they could just reinstall without any confirmation.
4131-
*
4132-
* TODO: This should be implemented in `SnapController.removeSnap` via a controller action.
4133-
*
4134-
* @param {{ id: string, permissionName: string }} snap - The wrapper object of the snap to remove.
4135-
*/
4136-
removeSnap(snap) {
4137-
this.snapController.removeSnap(snap.id);
4138-
this.permissionController.revokePermissionForAllSubjects(
4139-
snap.permissionName,
4140-
);
4141-
}
4142-
///: END:ONLY_INCLUDE_IN
41434124
}

ui/pages/settings/flask/view-snap/view-snap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ function ViewSnap() {
190190
<SnapRemoveWarning
191191
onCancel={() => setIsShowingRemoveWarning(false)}
192192
onSubmit={async () => {
193-
await dispatch(removeSnap(snap));
193+
await dispatch(removeSnap(snap.id));
194194
}}
195195
snapName={snap.manifest.proposedName}
196196
/>

ui/store/actions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -991,9 +991,9 @@ export function enableSnap(snapId) {
991991
};
992992
}
993993

994-
export function removeSnap(snap) {
994+
export function removeSnap(snapId) {
995995
return async (dispatch) => {
996-
await promisifiedBackground.removeSnap(snap);
996+
await promisifiedBackground.removeSnap(snapId);
997997
await forceUpdateMetamaskState(dispatch);
998998
};
999999
}

0 commit comments

Comments
 (0)