mirror of
https://github.com/Equicord/Equicord.git
synced 2025-01-18 13:23:28 -05:00
Use GetUserSettingLazy Instead
This commit is contained in:
parent
ee4952f0b6
commit
1d2ad8114e
1 changed files with 7 additions and 7 deletions
|
@ -5,13 +5,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { definePluginSettings } from "@api/Settings";
|
import { definePluginSettings } from "@api/Settings";
|
||||||
|
import { getUserSettingLazy } from "@api/UserSettings";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByCodeLazy } from "@webpack";
|
|
||||||
import { PresenceStore, UserStore } from "@webpack/common";
|
import { PresenceStore, UserStore } from "@webpack/common";
|
||||||
|
|
||||||
let savedStatus = "";
|
let oldStatus = "";
|
||||||
const updateAsync = findByCodeLazy("updateAsync", "status");
|
const statusSettings = getUserSettingLazy("status", "status");
|
||||||
const settings = definePluginSettings({
|
const settings = definePluginSettings({
|
||||||
statusToSet: {
|
statusToSet: {
|
||||||
type: OptionType.SELECT,
|
type: OptionType.SELECT,
|
||||||
|
@ -47,11 +47,11 @@ export default definePlugin({
|
||||||
RUNNING_GAMES_CHANGE(event) {
|
RUNNING_GAMES_CHANGE(event) {
|
||||||
const status = PresenceStore.getStatus(UserStore.getCurrentUser().id);
|
const status = PresenceStore.getStatus(UserStore.getCurrentUser().id);
|
||||||
if (event.games.length > 0 && status !== settings.store.statusToSet) {
|
if (event.games.length > 0 && status !== settings.store.statusToSet) {
|
||||||
savedStatus = status;
|
oldStatus = status;
|
||||||
updateAsync(settings.store.statusToSet);
|
statusSettings?.updateSetting(settings.store.statusToSet);
|
||||||
} else {
|
} else {
|
||||||
if (savedStatus !== "" && savedStatus !== settings.store.statusToSet)
|
if (oldStatus !== "" && oldStatus !== settings.store.statusToSet)
|
||||||
updateAsync(savedStatus);
|
statusSettings?.updateSetting(oldStatus);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue