mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-05-02 18:34:19 +00:00
feat: Show toast notification
This commit is contained in:
parent
e7f3b08466
commit
fb7963c09e
1 changed files with 10 additions and 1 deletions
|
|
@ -4,24 +4,28 @@ const React = require('react');
|
||||||
const {
|
const {
|
||||||
withCoreSuspender,
|
withCoreSuspender,
|
||||||
useProfile,
|
useProfile,
|
||||||
|
useToast,
|
||||||
} = require('stremio/common');
|
} = require('stremio/common');
|
||||||
const { useServices } = require('stremio/services');
|
const { useServices } = require('stremio/services');
|
||||||
|
|
||||||
const DefaultSettingsHandler = () => {
|
const DefaultSettingsHandler = () => {
|
||||||
const { core } = useServices();
|
const { core } = useServices();
|
||||||
|
const toast = useToast();
|
||||||
|
|
||||||
const profile = useProfile();
|
const profile = useProfile();
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const searchParams = new URLSearchParams(window.location.search);
|
const searchParams = new URLSearchParams(window.location.search);
|
||||||
if (searchParams.has('streamingServerUrl')) {
|
if (searchParams.has('streamingServerUrl')) {
|
||||||
|
const streamingServerUrl = searchParams.get('streamingServerUrl');
|
||||||
|
|
||||||
core.transport.dispatch({
|
core.transport.dispatch({
|
||||||
action: 'Ctx',
|
action: 'Ctx',
|
||||||
args: {
|
args: {
|
||||||
action: 'UpdateSettings',
|
action: 'UpdateSettings',
|
||||||
args: {
|
args: {
|
||||||
...profile.settings,
|
...profile.settings,
|
||||||
streamingServerUrl: searchParams.get('streamingServerUrl')
|
streamingServerUrl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -33,6 +37,11 @@ const DefaultSettingsHandler = () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
toast.show({
|
||||||
|
type: 'info',
|
||||||
|
title: `Using streaming server at ${streamingServerUrl}`,
|
||||||
|
timeout: 4000
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue