This commit is contained in:
Hamza-Ayed
2024-03-25 17:15:13 +03:00
parent 5c702e7d06
commit 0f79b2d86b
20 changed files with 327 additions and 179 deletions

View File

@@ -1,5 +1,7 @@
import 'dart:io';
import 'package:SEFER/constant/box_name.dart';
import 'package:background_location/background_location.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
@@ -14,6 +16,7 @@ import 'constant/credential.dart';
import 'constant/info.dart';
import 'controller/firebase/firbase_messge.dart';
import 'controller/firebase/local_notification.dart';
import 'controller/functions/location_background_controller.dart';
import 'controller/local/local_controller.dart';
import 'controller/local/translations.dart';
import 'firebase_options.dart';
@@ -31,9 +34,17 @@ Future<void> backgroundMessageHandler(RemoteMessage message) async {
FirebaseMessagesController().fireBaseTitles(message);
}
// @pragma('vm:entry-point')
// Future<void> backgroundLocation() async {
// await LocationBackgroundController().startBackLocation().then((location) {
// print('This is current Location ${location.toMap()}');
// });
// }
void main() async {
WidgetsFlutterBinding.ensureInitialized();
WakelockPlus.enable();
await BackgroundLocation.startLocationService();
if (Platform.isAndroid) {
await NotificationController().initNotifications();
}
@@ -46,7 +57,9 @@ void main() async {
print(Get.deviceLocale!.countryCode);
Stripe.publishableKey = AK.publishableKey;
// if (box.read(BoxName.driverID) != null) {
// Get.put(LocationBackgroundController());
// }
if (Platform.isAndroid || Platform.isIOS) {
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,