This commit is contained in:
Mirco Wittrien 2021-12-23 17:52:59 +01:00
parent 2751d73b26
commit aae414dbc7
6 changed files with 31 additions and 36 deletions

View File

@ -4297,8 +4297,12 @@ module.exports = (_ => {
return BDFDB.DiscordUtils.getSettings("messageDisplayCompact") ? "compact" : "cozy";
};
BDFDB.DiscordUtils.getSettings = function (key) {
const settings = Object.assign({}, typeof LibraryModules.SettingsStore.getAllSettings == "function" ? LibraryModules.SettingsStore.getAllSettings() : LibraryModules.SettingsStore);
return key == null ? settings : (settings[key] != null ? settings[key] : LibraryModules.SettingsStore[key]);
if (!key || !LibraryModules.SettingsUtils || (!LibraryModules.SettingsUtils[key] && !LibraryModules.SettingsUtils[key + "DoNotUseYet"])) return null;
return (LibraryModules.SettingsUtils[key] || LibraryModules.SettingsUtils[key + "DoNotUseYet"]).getSetting();
};
BDFDB.DiscordUtils.setSettings = function (key, value) {
if (!key || !LibraryModules.SettingsUtils || (!LibraryModules.SettingsUtils[key] && !LibraryModules.SettingsUtils[key + "DoNotUseYet"])) return;
(LibraryModules.SettingsUtils[key] || LibraryModules.SettingsUtils[key + "DoNotUseYet"]).updateSetting(value);
};
BDFDB.DiscordUtils.getZoomFactor = function () {
let aRects = BDFDB.DOMUtils.getRects(document.querySelector(BDFDB.dotCN.appmount));
@ -8143,15 +8147,15 @@ module.exports = (_ => {
if (!e.returnValue.props.children) LibraryModules.ContextMenuUtils.closeContextMenu();
}}, {priority: 10});
let languageChangeTimeout, translateAllNew = e => {
let languageChangeTimeout;
if (LibraryModules.SettingsUtilsOld) BDFDB.PatchUtils.patch(BDFDB, LibraryModules.SettingsUtilsOld, ["updateRemoteSettings", "updateLocalSettings"], {after: e => {
if (e.methodArguments[0] && e.methodArguments[0].locale) {
BDFDB.TimeUtils.clear(languageChangeTimeout);
languageChangeTimeout = BDFDB.TimeUtils.timeout(_ => {
for (let pluginName in PluginStores.loaded) if (PluginStores.loaded[pluginName].started) BDFDB.PluginUtils.translate(PluginStores.loaded[pluginName]);
}, 10000);
}
};
if (LibraryModules.SettingsUtils) BDFDB.PatchUtils.patch(BDFDB, LibraryModules.SettingsUtils, "updateLocalSettings", {after: translateAllNew});
}});
InternalBDFDB.onSettingsClosed = function () {
if (InternalBDFDB.SettingsUpdated) {

View File

@ -119,7 +119,8 @@
"RoleIconUtils": {"props": ["getRoleIconData"]},
"SearchPageUtils": {"props": ["searchNextPage", "searchPreviousPage"]},
"SettingsStore": {"props": ["guildPositions", "theme"]},
"SettingsUtils": {"props": ["updateRemoteSettings", "updateLocalSettings"]},
"SettingsUtils": {"props": ["ShowCurrentGame", "DeveloperMode"]},
"SettingsUtilsOld": {"props": ["updateLocalSettings", "updateRemoteSettings"]},
"SimpleMarkdownComponents": {"strings": ["customEmoji", "emojiTooltipPosition", "timestampTooltip"]},
"SimpleMarkdownParser": {"props": ["parseBlock", "parseInline", "defaultOutput"]},
"SlateUtils": {"props": ["serialize", "deserialize"], "nonProps": ["getFlag"]},

View File

@ -2,7 +2,7 @@
* @name CustomStatusPresets
* @author DevilBro
* @authorId 278543574059057154
* @version 1.0.7
* @version 1.0.8
* @description Allows you to save Custom Statuses as Quick Select
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,13 +17,8 @@ module.exports = (_ => {
"info": {
"name": "CustomStatusPresets",
"author": "DevilBro",
"version": "1.0.7",
"version": "1.0.8",
"description": "Allows you to save Custom Statuses as Quick Select"
},
"changeLog": {
"fixed": {
"Status/Overflow": "Fixed some Issues with very long Status causing overflow issues"
}
}
};
@ -393,7 +388,7 @@ module.exports = (_ => {
let date = new Date;
expiresAt = new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1).getTime() - date.getTime();
}
BDFDB.LibraryModules.SettingsUtils.updateRemoteSettings({
BDFDB.LibraryModules.SettingsUtilsOld.updateRemoteSettings({
status: presets[id].status,
customStatus: {
text: presets[id].text && presets[id].text.length > 0 ? presets[id].text : null,

View File

@ -2,7 +2,7 @@
* @name GameActivityToggle
* @author DevilBro
* @authorId 278543574059057154
* @version 1.0.5
* @version 1.0.6
* @description Adds a Quick-Toggle Game Activity Button
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,7 +17,7 @@ module.exports = (_ => {
"info": {
"name": "GameActivityToggle",
"author": "DevilBro",
"version": "1.0.5",
"version": "1.0.6",
"description": "Adds a Quick-Toggle Game Activity Button"
}
};
@ -76,7 +76,7 @@ module.exports = (_ => {
toggleButton = this;
}
render() {
const enabled = BDFDB.DiscordUtils.getSettings("showCurrentGame");
const enabled = BDFDB.DiscordUtils.getSettings("ShowCurrentGame");
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.PanelButton, Object.assign({}, this.props, {
tooltipText: enabled ? _this.labels.disable_activity : _this.labels.enable_activity,
icon: iconProps => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, Object.assign({}, iconProps, {
@ -87,9 +87,9 @@ module.exports = (_ => {
name: enabled ? BDFDB.LibraryComponents.SvgIcon.Names.GAMEPAD : BDFDB.LibraryComponents.SvgIcon.Names.GAMEPAD_DISABLED
})),
onClick: _ => {
const shouldEnable = !BDFDB.DiscordUtils.getSettings("showCurrentGame");
const shouldEnable = !BDFDB.DiscordUtils.getSettings("ShowCurrentGame");
_this.settings.general[shouldEnable ? "playEnable" : "playDisable"] && BDFDB.LibraryModules.SoundUtils.playSound(_this.settings.selections[shouldEnable ? "enableSound" : "disableSound"], .4);
BDFDB.LibraryModules.SettingsUtils.updateRemoteSettings({showCurrentGame: shouldEnable});
BDFDB.DiscordUtils.setSettings("ShowCurrentGame", shouldEnable);
}
}));
}

View File

@ -2,7 +2,7 @@
* @name ServerFolders
* @author DevilBro
* @authorId 278543574059057154
* @version 6.9.7
* @version 6.9.8
* @description Changes Discord's Folders, Servers open in a new Container, also adds extra Features to more easily organize, customize and manage your Folders
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,13 +17,8 @@ module.exports = (_ => {
"info": {
"name": "ServerFolders",
"author": "DevilBro",
"version": "6.9.7",
"version": "6.9.8",
"description": "Changes Discord's Folders, Servers open in a new Container, also adds extra Features to more easily organize, customize and manage your Folders"
},
"changeLog": {
"fixed": {
"Server Changes": "Works again after Discords 100th Change for Servers"
}
}
};
@ -1097,7 +1092,7 @@ module.exports = (_ => {
else guildFolders.push(oldFolder);
}
for (let folder of guildFolders) for (let fGuildId of folder.guildIds) guildPositions.push(fGuildId);
BDFDB.LibraryModules.SettingsUtils.updateRemoteSettings({guildPositions, guildFolders});
BDFDB.LibraryModules.SettingsUtilsOld.updateRemoteSettings({guildPositions, guildFolders});
}
createFolder (guildIds) {
@ -1118,7 +1113,7 @@ module.exports = (_ => {
else guildFolders.push(oldFolder);
}
for (let folder of guildFolders) for (let fGuildId of folder.guildIds) guildPositions.push(fGuildId);
BDFDB.LibraryModules.SettingsUtils.updateRemoteSettings({guildPositions, guildFolders});
BDFDB.LibraryModules.SettingsUtilsOld.updateRemoteSettings({guildPositions, guildFolders});
}
removeFolder (folderId) {
@ -1130,7 +1125,7 @@ module.exports = (_ => {
else guildFolders.push(oldFolder);
}
for (let folder of guildFolders) for (let fGuildId of folder.guildIds) guildPositions.push(fGuildId);
BDFDB.LibraryModules.SettingsUtils.updateRemoteSettings({guildPositions, guildFolders});
BDFDB.LibraryModules.SettingsUtilsOld.updateRemoteSettings({guildPositions, guildFolders});
}
addGuildToFolder (folderId, guildId) {
@ -1145,7 +1140,7 @@ module.exports = (_ => {
else if (oldFolder.guildIds[0] != guildId) guildFolders.push(oldFolder);
}
for (let folder of guildFolders) for (let fGuildId of folder.guildIds) guildPositions.push(fGuildId);
BDFDB.LibraryModules.SettingsUtils.updateRemoteSettings({guildPositions, guildFolders});
BDFDB.LibraryModules.SettingsUtilsOld.updateRemoteSettings({guildPositions, guildFolders});
}
removeGuildFromFolder (folderId, guildId) {
@ -1160,7 +1155,7 @@ module.exports = (_ => {
else guildFolders.push(oldFolder);
}
for (let folder of guildFolders) for (let fGuildId of folder.guildIds) guildPositions.push(fGuildId);
BDFDB.LibraryModules.SettingsUtils.updateRemoteSettings({guildPositions, guildFolders});
BDFDB.LibraryModules.SettingsUtilsOld.updateRemoteSettings({guildPositions, guildFolders});
}
createDragPreview (div, event) {

View File

@ -2,7 +2,7 @@
* @name TimedLightDarkMode
* @author DevilBro
* @authorId 278543574059057154
* @version 1.1.0
* @version 1.1.1
* @description Adds a Time Slider to the Appearance Settings
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,7 +17,7 @@ module.exports = (_ => {
"info": {
"name": "TimedLightDarkMode",
"author": "DevilBro",
"version": "1.1.0",
"version": "1.1.1",
"description": "Adds a Time Slider to the Appearance Settings"
}
};
@ -91,7 +91,7 @@ module.exports = (_ => {
}
onStart () {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.SettingsUtils, "updateLocalSettings", {after: e => {
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.SettingsUtilsOld, "updateLocalSettings", {after: e => {
if (BDFDB.ObjectUtils.is(e.methodArguments[0]) && e.methodArguments[0].theme && settings.running) {
BDFDB.TimeUtils.clear(changeTimeout);
disableChanging = true;
@ -178,8 +178,8 @@ module.exports = (_ => {
changeTheme (dark) {
let theme = BDFDB.DiscordUtils.getTheme();
if (dark && theme == BDFDB.disCN.themelight) BDFDB.LibraryModules.SettingsUtils.updateLocalSettings({theme: "dark"});
else if (!dark && theme == BDFDB.disCN.themedark) BDFDB.LibraryModules.SettingsUtils.updateLocalSettings({theme: "light"});
if (dark && theme == BDFDB.disCN.themelight) BDFDB.LibraryModules.SettingsUtilsOld.updateLocalSettings({theme: "dark"});
else if (!dark && theme == BDFDB.disCN.themedark) BDFDB.LibraryModules.SettingsUtilsOld.updateLocalSettings({theme: "light"});
}
showCurrentTime (grabber) {