simulacion de estados y flujo de notificacion, modificacion de estilos en todas las vistas
This commit is contained in:
@@ -1,22 +1,12 @@
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import 'app/app.dart';
|
||||
import 'features/notifications/notification_service.dart';
|
||||
import 'firebase_options.dart';
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
|
||||
try {
|
||||
await Firebase.initializeApp(
|
||||
options: DefaultFirebaseOptions.currentPlatform,
|
||||
);
|
||||
} catch (_) {}
|
||||
debugPrint('FCM background: ${message.messageId} | data: ${message.data}');
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
try {
|
||||
@@ -31,6 +21,8 @@ Future<void> main() async {
|
||||
} on UnsupportedError {
|
||||
await Firebase.initializeApp();
|
||||
}
|
||||
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
|
||||
// Registra handlers FCM (foreground + background), pide permisos
|
||||
// POST_NOTIFICATIONS y crea el canal Android `recolecta_alerts`.
|
||||
await NotificationService.initialize();
|
||||
runApp(const ProviderScope(child: RecolectaApp()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user