This commit is contained in:
Hamza-Ayed
2024-11-12 00:45:23 +02:00
parent 213c2724aa
commit bf8a29b814
8 changed files with 156 additions and 81 deletions

View File

@@ -85,6 +85,8 @@ import 'package:permission_handler/permission_handler.dart';
import 'package:timezone/data/latest.dart' as tz;
import 'package:timezone/timezone.dart' as tz;
import '../../print.dart';
class NotificationController extends GetxController {
final FlutterLocalNotificationsPlugin _flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();
@@ -185,13 +187,16 @@ class NotificationController extends GetxController {
// Initialize and set Cairo timezone
tz.initializeTimeZones();
var cairoLocation;
if (box.read(BoxName.countryCode).toString() == 'Egypt') {
cairoLocation = tz.getLocation('Africa/Cairo');
} else {} // todo get for location country
// if (box.read(BoxName.countryCode).toString() == 'Egypt') {
cairoLocation = tz.getLocation('Africa/Cairo');
// } else {
// cairoLocation = tz.getLocation('UTC');
// } // todo get for location country
// Set Cairo timezone
Log.print('cairoLocation: ${cairoLocation}');
final now = tz.TZDateTime.now(
cairoLocation); // Use Cairo timezone for the current time
tz.TZDateTime scheduledDate = tz.TZDateTime(
cairoLocation, now.year, now.month, now.day, hour, minute);