Feature: Live Stream-Liste + Toast Notifications
- stream_available/stream_ended WS-Events verarbeiten - WS sofort beim Mount verbinden (nicht nur beim Broadcasting) - WS reconnect immer aktiv (nicht nur bei aktivem Stream) - Toast Notifications: neuer Stream, Update verfügbar/bereit - Notification Permission beim App-Start anfragen Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
939137cc77
commit
3455e20a96
2 changed files with 51 additions and 8 deletions
|
|
@ -37,6 +37,13 @@ export default function App() {
|
|||
const [pluginData, setPluginData] = useState<Record<string, any>>({});
|
||||
const eventSourceRef = useRef<EventSource | null>(null);
|
||||
|
||||
// Request notification permission
|
||||
useEffect(() => {
|
||||
if ('Notification' in window && Notification.permission === 'default') {
|
||||
Notification.requestPermission();
|
||||
}
|
||||
}, []);
|
||||
|
||||
// Fetch plugin list
|
||||
useEffect(() => {
|
||||
fetch('/api/plugins')
|
||||
|
|
@ -98,8 +105,18 @@ export default function App() {
|
|||
useEffect(() => {
|
||||
const api = (window as any).electronAPI;
|
||||
if (!api?.onUpdateAvailable) return;
|
||||
api.onUpdateAvailable(() => setUpdateState('downloading'));
|
||||
api.onUpdateReady(() => setUpdateState('ready'));
|
||||
api.onUpdateAvailable(() => {
|
||||
setUpdateState('downloading');
|
||||
if (Notification.permission === 'granted') {
|
||||
new Notification('Gaming Hub Update', { body: 'Ein Update wird heruntergeladen...' });
|
||||
}
|
||||
});
|
||||
api.onUpdateReady(() => {
|
||||
setUpdateState('ready');
|
||||
if (Notification.permission === 'granted') {
|
||||
new Notification('Gaming Hub Update bereit', { body: 'Klicke OK um das Update zu installieren.' });
|
||||
}
|
||||
});
|
||||
api.onUpdateNotAvailable?.(() => setUpdateState('uptodate'));
|
||||
api.onUpdateError?.(() => setUpdateState('error'));
|
||||
}, []);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue