feat(notification): handle notification onclick event
This commit is contained in:
@@ -225,8 +225,7 @@ class _DevicesManagerScreenState extends State<DevicesManagerScreen> {
|
||||
|
||||
void getUserRole() async {
|
||||
role = await apiServices.getUserRole();
|
||||
devicesManagerBloc.sinkUserRole.add(role);F:
|
||||
cd
|
||||
devicesManagerBloc.sinkUserRole.add(role);
|
||||
}
|
||||
|
||||
double getTableHeight(int dataLength){
|
||||
|
||||
@@ -2,12 +2,15 @@
|
||||
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:badges/badges.dart' as badges;
|
||||
import 'package:persistent_bottom_nav_bar/persistent_bottom_nav_bar.dart';
|
||||
import '../../product/permission/notification_permission.dart';
|
||||
import '../../product/services/notification_services.dart';
|
||||
import '../settings/profile/profile_model.dart';
|
||||
import '../../product/extension/context_extension.dart';
|
||||
import '../../bloc/home_bloc.dart';
|
||||
@@ -41,8 +44,22 @@ class MainScreen extends StatefulWidget {
|
||||
State<MainScreen> createState() => _MainScreenState();
|
||||
}
|
||||
|
||||
PersistentTabController controller = PersistentTabController(initialIndex: 0);
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
Future<void> firebaseMessagingBackgroundHandler(RemoteMessage message) async {
|
||||
log("Full background message payload: ${message.toMap()}");
|
||||
await Firebase.initializeApp();
|
||||
final notificationServices = NotificationServices();
|
||||
await notificationServices.initLocalNotifications(controller);
|
||||
await notificationServices.showNotification(message);
|
||||
log("Background message handled: ${message.data['title']}");
|
||||
}
|
||||
|
||||
|
||||
class _MainScreenState extends State<MainScreen> with WidgetsBindingObserver {
|
||||
APIServices apiServices = APIServices();
|
||||
final NotificationServices notificationServices = NotificationServices();
|
||||
late MainBloc mainBloc;
|
||||
bool isVN = true;
|
||||
bool isLight = true;
|
||||
@@ -81,6 +98,9 @@ class _MainScreenState extends State<MainScreen> with WidgetsBindingObserver {
|
||||
initialCheck();
|
||||
getBellNotification();
|
||||
mainBloc.getUserProfile();
|
||||
notificationServices.initLocalNotifications(controller);
|
||||
notificationServices.firebaseInit(context);
|
||||
NotificationServices().setupInteractMessage(controller);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -104,7 +124,7 @@ class _MainScreenState extends State<MainScreen> with WidgetsBindingObserver {
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
}
|
||||
|
||||
PersistentTabController controller = PersistentTabController(initialIndex: 0);
|
||||
|
||||
List<PersistentBottomNavBarItem> _navBarsItems() {
|
||||
return [
|
||||
PersistentBottomNavBarItem(
|
||||
@@ -180,10 +200,6 @@ class _MainScreenState extends State<MainScreen> with WidgetsBindingObserver {
|
||||
child: const InterFamilyScreen(),
|
||||
blocBuilder: () => InterFamilyBloc(),
|
||||
),
|
||||
/*BlocProvider(
|
||||
child: const NotificationScreen(),
|
||||
blocBuilder: () => NotificationBloc(),
|
||||
),*/
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user