mirror of
https://github.com/Lightcord/Lightcord.git
synced 2025-04-12 00:55:40 +02:00
Add Notification Shim Switch
This commit is contained in:
parent
9058c89961
commit
e47e1b0158
@ -91,6 +91,7 @@ export const settings = {
|
||||
"Enable Lightcord Servers": {id: "lightcord-5", info: "Enable Lightcord's servers. Disabling this will disable custom badges.", implemented: true, hidden: false, cat: "lightcord", category: "Lightcord"},
|
||||
"Disable typing": {id: "lightcord-7", info: "Don't let other see you're typing.", implemented: true, hidden: false, cat: "lightcord", category: "Lightcord"},
|
||||
"Lightcord Tabs": {id: "lightcord-8", info: "Allows you to launch multiple instances of Lightcord in the same window.", implemented: true, hidden: false, cat: "lightcord", category: "Lightcord", experimental: true},
|
||||
"Use Notification Shim": {id: "lightcord-10", info: "Basically don't use Windows's Notifications.", implemented: true, hidden: process.platform !== "win32", cat: "lightcord", category: "Lightcord", experimental: false},
|
||||
|
||||
/** Lightcord Window */
|
||||
"Always-on-Top": {id: "lightcord-3", info: "Enable the window's Always-on-Top mode, where Lightcord stays on top of other applications.", implemented: true, hidden: false, cat: "lightcord", category: "Window"},
|
||||
@ -145,6 +146,7 @@ export const defaultCookie = {
|
||||
"lightcord-6": true,
|
||||
"lightcord-7": false,
|
||||
"lightcord-8": false,
|
||||
"lightcord-10": false,
|
||||
"no_window_bound": false,
|
||||
};
|
||||
|
||||
|
@ -33,6 +33,12 @@ Core.prototype.setConfig = function(config) {
|
||||
Object.assign(bdConfig, config);
|
||||
};
|
||||
|
||||
Object.defineProperty(Core.prototype, "methods", {
|
||||
get(){
|
||||
return methods
|
||||
}
|
||||
})
|
||||
|
||||
Core.prototype.setMethods = function(m) {
|
||||
if (this.hasStarted) return;
|
||||
methods = m
|
||||
|
@ -29,6 +29,7 @@ import MarginTop from "../ui/margintop";
|
||||
import webpackModules from "./webpackModules";
|
||||
import tooltipWrap from "../ui/tooltipWrap";
|
||||
import History from "../ui/icons/history";
|
||||
import core from "./core";
|
||||
|
||||
class BDSidebarHeader extends React.PureComponent {
|
||||
render(){
|
||||
@ -144,7 +145,7 @@ export default new class V2_SettingsPanel {
|
||||
}
|
||||
|
||||
updateSettings(id, enabled, sidebar) {
|
||||
if(!["lightcord-8", "no_window_bound", "enable_glasstron"].includes(id))settingsCookie[id] = enabled;
|
||||
if(!["lightcord-8", "no_window_bound", "enable_glasstron", "lightcord-10"].includes(id))settingsCookie[id] = enabled;
|
||||
|
||||
if (id == "bda-gs-2") {
|
||||
if (enabled) DOM.addClass(document.body, "bd-minimal");
|
||||
@ -268,6 +269,10 @@ export default new class V2_SettingsPanel {
|
||||
remote.app.relaunch()
|
||||
remote.app.exit()
|
||||
}
|
||||
if (id === "lightcord-10"){
|
||||
core.methods.NotificationsUseShim(enabled)
|
||||
return
|
||||
}
|
||||
if (id === "no_window_bound"){
|
||||
let appSettings = remote.getGlobal("appSettings")
|
||||
appSettings.set("NO_WINDOWS_BOUND", enabled)
|
||||
@ -345,6 +350,7 @@ export default new class V2_SettingsPanel {
|
||||
if(setting.id === "lightcord-8")isChecked = appSettings.get("isTabs", false);
|
||||
if(setting.id === "no_window_bound")isChecked = appSettings.get("NO_WINDOWS_BOUND", false)
|
||||
if(setting.id === "enable_glasstron")isChecked = appSettings.get("GLASSTRON", true)
|
||||
if(setting.id === "lightcord-10")isChecked = !appSettings.get("DEFAULT_NOTIFICATIONS", true)
|
||||
let returnValue = BDV2.react.createElement(Switch, {id: setting.id, key: setting.id, data: setting, checked: isChecked, onChange: (id, checked) => {
|
||||
this.onChange(id, checked, sidebar);
|
||||
}})
|
||||
|
@ -1,3 +1,12 @@
|
||||
const electron = require("electron")
|
||||
const { useShim } = require("./patchNotifications");
|
||||
const appSettings = electron.remote.getGlobal("appSettings")
|
||||
|
||||
module.exports = {
|
||||
|
||||
NotificationsUseShim: (value) => {
|
||||
if(![true, false].includes(value))return
|
||||
appSettings.set("DEFAULT_NOTIFICATIONS", !value)
|
||||
appSettings.save()
|
||||
useShim(value)
|
||||
}
|
||||
}
|
@ -9,6 +9,7 @@ const uuid = require("uuid/v4")
|
||||
|
||||
const events = exports.events = new EventEmitter()
|
||||
const logger = exports.logger = new Logger("Lightcord")
|
||||
const appSettings = electron.remote.getGlobal("appSettings")
|
||||
|
||||
let hasInit = false
|
||||
let tries = 0
|
||||
@ -229,8 +230,6 @@ async function privateInit(){
|
||||
console.error(err)
|
||||
DiscordJS = null
|
||||
}
|
||||
|
||||
const appSettings = electron.remote.getGlobal("appSettings")
|
||||
/*let Authorization = appSettings.get("LIGHTCORD_AUTH", false)
|
||||
let shouldShowPrompt = Authorization === false
|
||||
|
||||
@ -1291,7 +1290,7 @@ var ensureExported = global.ensureExported = function ensureExported(filter, max
|
||||
})
|
||||
}
|
||||
let Notifications = require("./patchNotifications")
|
||||
Notifications.useShim(true)
|
||||
Notifications.useShim(!appSettings.get("DEFAULT_NOTIFICATIONS", true))
|
||||
|
||||
function getGuildClasses() {
|
||||
const guildsWrapper = ModuleLoader.get(e => e.wrapper && e.unreadMentionsBar)[0];
|
||||
|
Loading…
x
Reference in New Issue
Block a user