mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-03 03:11:40 +00:00
Merge pull request #1034 from Lyall-A/private-mode
add private mode toggle to app menu
This commit is contained in:
commit
59065d24bc
7 changed files with 81 additions and 20 deletions
|
|
@ -6,6 +6,7 @@ import { controller } from '/@/renderer/api/controller';
|
|||
import {
|
||||
DiscordDisplayType,
|
||||
getServerById,
|
||||
useAppStore,
|
||||
useDiscordSetttings,
|
||||
useGeneralSettings,
|
||||
usePlayerStore,
|
||||
|
|
@ -18,6 +19,7 @@ const discordRpc = isElectron() ? window.api.discordRpc : null;
|
|||
export const useDiscordRpc = () => {
|
||||
const discordSettings = useDiscordSetttings();
|
||||
const generalSettings = useGeneralSettings();
|
||||
const { privateMode } = useAppStore();
|
||||
const [lastUniqueId, setlastUniqueId] = useState('');
|
||||
|
||||
const setActivity = useCallback(
|
||||
|
|
@ -148,15 +150,15 @@ export const useDiscordRpc = () => {
|
|||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!discordSettings.enabled) return discordRpc?.quit();
|
||||
if (!discordSettings.enabled || privateMode) return discordRpc?.quit();
|
||||
|
||||
return () => {
|
||||
discordRpc?.quit();
|
||||
};
|
||||
}, [discordSettings.clientId, discordSettings.enabled]);
|
||||
}, [discordSettings.clientId, privateMode, discordSettings.enabled]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!discordSettings.enabled) return;
|
||||
if (!discordSettings.enabled || privateMode) return;
|
||||
const unsubSongChange = usePlayerStore.subscribe(
|
||||
(state) => [state.current.song, state.current.time, state.current.status],
|
||||
setActivity,
|
||||
|
|
@ -164,5 +166,5 @@ export const useDiscordRpc = () => {
|
|||
return () => {
|
||||
unsubSongChange();
|
||||
};
|
||||
}, [discordSettings.enabled, setActivity]);
|
||||
}, [discordSettings.enabled, privateMode, setActivity]);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue