2-10/3/1
This commit is contained in:
@@ -7,6 +7,7 @@ import 'package:SEFER/views/home/Captin/orderCaptin/order_request_page.dart';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:flutter_overlay_window/flutter_overlay_window.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:flutter_stripe/flutter_stripe.dart';
|
||||
@@ -59,7 +60,7 @@ Future<void> backgroundMessageHandler(RemoteMessage message) async {
|
||||
}
|
||||
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
NotificationController1().showNotification(
|
||||
NotificationController().showNotification(
|
||||
message.notification!.title.toString(),
|
||||
message.notification!.body.toString(),
|
||||
'order',
|
||||
@@ -70,11 +71,11 @@ Future<void> backgroundMessageHandler(RemoteMessage message) async {
|
||||
if (isOverlayActive) {
|
||||
await FlutterOverlayWindow.closeOverlay();
|
||||
}
|
||||
|
||||
await FlutterOverlayWindow.shareData(myList);
|
||||
await FlutterOverlayWindow.showOverlay(
|
||||
enableDrag: true,
|
||||
flag: OverlayFlag.focusPointer,
|
||||
visibility: NotificationVisibility.visibilityPublic,
|
||||
// visibility: NotificationVisibility.visibilityPublic,
|
||||
positionGravity: PositionGravity.auto,
|
||||
height: 700,
|
||||
width: WindowSize.matchParent,
|
||||
@@ -89,6 +90,14 @@ Future<void> backgroundMessageHandler(RemoteMessage message) async {
|
||||
}
|
||||
}
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
void notificationTapBackground(NotificationResponse notificationResponse) {
|
||||
// handle background notification taps here
|
||||
print('Notification tapped in background!');
|
||||
NotificationController().handleNotificationResponse(notificationResponse);
|
||||
// You can add your logic here to handle the notification tap
|
||||
}
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
void overlayMain() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
@@ -99,8 +108,12 @@ void overlayMain() async {
|
||||
));
|
||||
}
|
||||
|
||||
void closeOverLay() {
|
||||
FlutterOverlayWindow.closeOverlay();
|
||||
Future<void> closeOverLay() async {
|
||||
// FlutterOverlayWindow.closeOverlay();
|
||||
bool isOverlayActive = await FlutterOverlayWindow.isActive();
|
||||
if (isOverlayActive) {
|
||||
await FlutterOverlayWindow.closeOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
void main() async {
|
||||
@@ -122,8 +135,11 @@ void main() async {
|
||||
await FirebaseMessagesController().requestFirebaseMessagingPermission();
|
||||
|
||||
FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler);
|
||||
NotificationController1().initNotifications();
|
||||
// NotificationController1().initNotifications();
|
||||
// NotificationController().initNotifications();
|
||||
if (Platform.isAndroid) {
|
||||
await Get.put(NotificationController()).initNotifications();
|
||||
}
|
||||
|
||||
await Future.wait([
|
||||
FirebaseMessagesController().getNotificationSettings(),
|
||||
|
||||
Reference in New Issue
Block a user