From e7f3b0846627f71fdd1bd783b3a5bc9aaecdee10 Mon Sep 17 00:00:00 2001 From: Felipe Pontes Date: Thu, 10 Aug 2023 17:23:07 -0300 Subject: [PATCH] feat: Use core dispatch directly --- src/App/DefaultSettingsHandler.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/App/DefaultSettingsHandler.js b/src/App/DefaultSettingsHandler.js index 42cc8165d..47bc329e9 100644 --- a/src/App/DefaultSettingsHandler.js +++ b/src/App/DefaultSettingsHandler.js @@ -5,7 +5,6 @@ const { withCoreSuspender, useProfile, } = require('stremio/common'); -const useProfileSettingsInputs = require('stremio/routes/Settings/useProfileSettingsInputs'); const { useServices } = require('stremio/services'); const DefaultSettingsHandler = () => { @@ -13,12 +12,19 @@ const DefaultSettingsHandler = () => { const profile = useProfile(); - const { streamingServerUrlInput } = useProfileSettingsInputs(profile); - React.useEffect(() => { const searchParams = new URLSearchParams(window.location.search); if (searchParams.has('streamingServerUrl')) { - streamingServerUrlInput.onChange(searchParams.get('streamingServerUrl')); + core.transport.dispatch({ + action: 'Ctx', + args: { + action: 'UpdateSettings', + args: { + ...profile.settings, + streamingServerUrl: searchParams.get('streamingServerUrl') + } + } + }); setTimeout(() => { core.transport.dispatch({ action: 'StreamingServer', @@ -26,7 +32,7 @@ const DefaultSettingsHandler = () => { action: 'Reload' } }); - }, 2000); + }, 1000); } }, []);