mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-01-11 22:40:31 +00:00
refactor: add persistance
This commit is contained in:
parent
e093583889
commit
bbbf505e10
2 changed files with 25 additions and 0 deletions
|
|
@ -73,8 +73,26 @@ const General = forwardRef<HTMLDivElement, Props>(({ profile }: Props, ref) => {
|
|||
const onToggleDiscord = useCallback(() => {
|
||||
if (isDiscordConnected) {
|
||||
disconnectDiscord();
|
||||
core.transport.dispatch({
|
||||
action: 'Ctx',
|
||||
args: {
|
||||
action: 'UpdateSettings',
|
||||
args: {
|
||||
discordRpcEnabled: false
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
connectDiscord();
|
||||
core.transport.dispatch({
|
||||
action: 'Ctx',
|
||||
args: {
|
||||
action: 'UpdateSettings',
|
||||
args: {
|
||||
discordRpcEnabled: true
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}, [isDiscordConnected, connectDiscord, disconnectDiscord]);
|
||||
|
||||
|
|
@ -84,6 +102,12 @@ const General = forwardRef<HTMLDivElement, Props>(({ profile }: Props, ref) => {
|
|||
}
|
||||
}, [dataExport.exportUrl]);
|
||||
|
||||
useEffect(() => {
|
||||
if (discordAvailable && profile.settings.discordRpcEnabled && !isDiscordConnected) {
|
||||
connectDiscord();
|
||||
}
|
||||
}, [discordAvailable, profile.settings.discordRpcEnabled]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isTraktAuthenticated && traktAuthStarted) {
|
||||
core.transport.dispatch({
|
||||
|
|
|
|||
1
src/types/models/Ctx.d.ts
vendored
1
src/types/models/Ctx.d.ts
vendored
|
|
@ -18,6 +18,7 @@ type Settings = {
|
|||
audioPassthrough: boolean,
|
||||
autoFrameRateMatching: boolean,
|
||||
bingeWatching: boolean,
|
||||
discordRpcEnabled: boolean,
|
||||
hardwareDecoding: boolean,
|
||||
videoMode: string | null,
|
||||
escExitFullscreen: boolean,
|
||||
|
|
|
|||
Loading…
Reference in a new issue