feat: ajout système de notifications Web Push et prompt installation PWA iOS

This commit is contained in:
2026-05-25 21:12:05 +02:00
parent 7682b90557
commit 86b86e9037
12 changed files with 5102 additions and 4 deletions
+18
View File
@@ -1,9 +1,11 @@
import { useState, useEffect } from 'react';
import useLiveKit from './hooks/useLiveKit';
import usePush from './hooks/usePush';
import PTTButton from './components/PTTButton';
import UserList from './components/UserList';
import GroupSelector from './components/GroupSelector';
import Settings from './components/Settings';
import PWAInstallPrompt from './components/PWAInstallPrompt';
import './App.css';
const API_URL = import.meta.env.VITE_API_URL || '/api';
@@ -29,6 +31,13 @@ function App() {
toggleParticipantMute
} = useLiveKit();
const {
isSupported: isPushSupported,
isPermissionGranted: isPushGranted,
requestPermission: requestPushPermission,
showNotification
} = usePush();
// Charger configuration au démarrage
useEffect(() => {
fetch(`${API_URL}/config`)
@@ -60,6 +69,12 @@ function App() {
setError(null);
try {
// Demander permission notifications au premier lancement
if (isPushSupported && !isPushGranted) {
console.log('Demande permission notifications...');
await requestPushPermission();
}
// IMPORTANT iOS : Demander permission microphone AVANT tout
console.log('🎤 Demande permission microphone...');
try {
@@ -268,6 +283,9 @@ function App() {
{/* Modal de paramètres */}
<Settings isOpen={showSettings} onClose={() => setShowSettings(false)} />
{/* Prompt installation PWA (iOS) */}
<PWAInstallPrompt />
</div>
);
}