[Fix] Fixed removing a module when it is currently disabled not working

pull/36/head
Oj18 3 years ago
parent d82b5c87e9
commit 8f0ede867c

@ -18,6 +18,7 @@
- ### Fixes
- Made custom version info in settings more precise and should no longer crash if also using Powercord's BDCompat when opening settings
- Fixed crashes for modules using color picker component in settings without initial value
- Fixed removing a module when it is currently disabled not working
## v6.0.1 [2021-01-22]

6
dist/index.js vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

@ -114,7 +114,7 @@ export default {
buttonText: goosemodScope.modules[m.name] ? 'Remove' : 'Import',
onclick: async (el) => {
if (goosemodScope.modules[m.name]) {
if (goosemodScope.modules[m.name] || goosemodScope.disabledModules[m.name]) {
el.textContent = 'Removing...';
goosemodScope.settings.removeModuleUI(m.name, 'Module Store');
@ -129,7 +129,7 @@ export default {
goosemodScope.settings.openSettingItem('Module Store');
},
isToggled: () => goosemodScope.modules[m.name] !== undefined,
onToggle: async (checked) => {
onToggle: async (checked, el) => {
if (checked) {
goosemodScope.modules[m.name] = Object.assign({}, goosemodScope.disabledModules[m.name]);
delete goosemodScope.disabledModules[m.name];

@ -13,9 +13,15 @@ export const removeModuleUI = (field, where) => {
// settingItem[2].splice(settingItem[2].indexOf(settingItem[2].find((x) => x.subtext === goosemodScope.modules[field].description)), 1);
const isDisabled = goosemodScope.modules[field] === undefined; // If module is currently disabled
if (isDisabled) {
goosemodScope.modules[field] = Object.assign({}, goosemodScope.disabledModules[field]); // Move from disabledModules -> modules
delete goosemodScope.disabledModules[field];
}
goosemodScope.moduleStoreAPI.moduleRemoved(goosemodScope.modules[field]);
goosemodScope.modules[field].goosemodHandlers.onRemove();
if (!isDisabled) goosemodScope.modules[field].goosemodHandlers.onRemove();
delete goosemodScope.modules[field];

Loading…
Cancel
Save