Add unregisterAddonSettings function (for you AA)

pull/9/head
dperolio 3 years ago
parent b6d5b2e2c2
commit 7c86cbcb60

@ -32,7 +32,6 @@
* @experimental Code that is not fully tested and possibly unstable
* @note Generic message meant to explain or point out something
* @i18n Indication that the section needs to have proper internationalization added
* @powercord Code that is a remnant of Powercord and needs to be removed
* @test Information for testing a certain scenario, or code that needs to be tested
* @warning Alert that indicates something important to be aware of
*/

@ -10,7 +10,6 @@
"@experimental",
"@i18n",
"@note",
"@powercord",
"@test",
"@todo",
"@warning"
@ -55,12 +54,6 @@
"background": "#7842ff",
"opacity": 0
},
"@powercord": {
"icon": "zap",
"foreground": "#889c54",
"background": "#889c54",
"opacity": 0
},
"@test": {
"icon": "gear",
"foreground": "#ec0ddf",

@ -75,6 +75,9 @@ export default class SettingsAPI extends API {
this.tabs[id] = props;
this.tabs[id].settings = this.connectStores(id)(render);
Object.freeze(this.tabs[id].render.prototype);
Object.freeze(this.tabs[id]);
const Render = this.tabs[id].settings;
vizality.api.router.registerRoute({
@ -92,6 +95,20 @@ export default class SettingsAPI extends API {
}
}
unregisterAddonSettings (addonId) {
try {
if (this.tabs[addonId]) {
delete this.tabs[addonId];
} else {
throw new Error(`Settings for "${addonId}" are not registered, so they cannot be unregistered!`);
}
vizality.api.router.unregisterRoute(`/dashboard/plugins/${addonId}`);
} catch (err) {
return error(_module, `${_submodule}:unregisterAddonSettings`, null, err);
}
}
registerDashboardItem (props) {
try {
const { id, path, heading, subheading, icon, render } = props;

Loading…
Cancel
Save