diff --git a/.firebase/hosting.YnVpbGRcd2Vi.cache b/.firebase/hosting.YnVpbGRcd2Vi.cache deleted file mode 100644 index 8efd982..0000000 --- a/.firebase/hosting.YnVpbGRcd2Vi.cache +++ /dev/null @@ -1,27 +0,0 @@ -favicon.png,1671141275163,0cab6e3dd5a9f008afdd133e1e1207cf65f2f2a10eb6712e3c209d8a5f76425a -manifest.json,1677423181199,254fdcf849addaa9b3aff95fd77bfa468cb2fbfa8eb3abf0423b6bcefcd759db -assets/assets/font/arbi.ttf,1679654861409,61a09ba813cd875fd87261e0c6c285d365abdbde0ab31c4e16f39d9f48067ba6 -assets/assets/font/Lato-Regular.ttf,1292349600000,c8a2f0862a0f2fd745b880edd167e34d01e74daca5a09eb7841ea72c9840bb26 -assets/assets/font/Li.ttf,1658161952000,7d4df342113a91355efc64b56b9c16246b6c5f1d721447fcd67ded0f0b828701 -assets/assets/font/Tuli.ttf,1573727814237,0b6009ff47987dfcad157955cff9e4761103e49868f52ab165ca2c4e94487590 -assets/assets/images/logo.png,1679327629703,8efa0376b492b2a5c227aabcd5a5b25cda1f57a704fb2e37b4b5ca7692fa5950 -assets/assets/json/Allahname.json,1679653707746,68e6befdbedd65840e59ccabd59b1b675da660f71c0b933d9d02275c34e03d93 -assets/assets/sound/notification.mp3,1679726541416,cf05bd9c32e44b277bc3e98588cd961dad02cb21ba23ef801c795739ab58ede4 -assets/fonts/MaterialIcons-Regular.otf,1678307915449,26ccc86b05c476a6b792d6abae012d693ce5e7effabb62ca623c44b7ca264aae -assets/packages/cupertino_icons/assets/CupertinoIcons.ttf,1679146007040,007720e2ea8128f223e5f1a08073b8f40df49b41dac35727107ab73dc4488ae0 -canvaskit/canvaskit.js,1678307992889,8ff9cbe5dbf69c38eb7c466ad2a03f276996bfafabafa667fb31de3a9ce3161b -canvaskit/canvaskit.wasm,1678307992937,c02c266899510d8fe7228271e0c9219e42f3f81c38d2cf677abb3893f2bcb119 -canvaskit/profiling/canvaskit.js,1678307992937,6420bd60a37f0870f2d750e80e38eca52602e2664288d1a2ce6f99b399e946a8 -canvaskit/profiling/canvaskit.wasm,1678307992984,6b433eb1c13eea60832b8f784715a0305ca764effb0443a8134485495203341e -icons/Icon-192.png,1671141275163,eaf2464bfb1d192fdd192a616f7b858dee456d573c6ec619648a1dcf2bdddfa6 -icons/Icon-512.png,1671141275163,9cf4cd298ae95acc1f25e97d88aa3f6bbfdf40867ea0f8a854c4393f49d56e64 -icons/Icon-maskable-192.png,1674815710414,196ce9142a3442ab37ae90cd46c3389e4660400c859b81cbb0538a51b39752eb -icons/Icon-maskable-512.png,1674815710405,6833b7c449e0dd24d5e164a53cc4557e643893e675b476b05efcbb9a6aa05bf0 -flutter_service_worker.js,1679999429661,43f2c642b4b9d4a7d6b9c4fcc9fe8e96398aef898b19cb82ef26ef64b91d2186 -index.html,1679999426431,7ea96f51966558abfe1402d4994602f55f2217679e8500439d7f494c76cc13d9 -flutter.js,1679999314403,4ac95ce2f44eacd0bda65849a413c7f16fac0f00d2cbc60b9b07709129ea6c17 -version.json,1679999425666,37e04484b27a7e8440fa00571d48fdaab09471c56a83a487e249c681347366e1 -assets/AssetManifest.json,1679999426171,04b56e8190a0824eae7e2c0520cd252710e301b4092786bd0117aa0cd0744221 -assets/FontManifest.json,1679999426191,bf469bb73d2a494a5b8c9a9106449218ae61ed5138aac681e3e1181f947b49ff -assets/NOTICES,1679999426196,6ea1e70fe410f1ede12860c8f1d8cf31ee14d0bbcfee2ccae2227274157a8d47 -main.dart.js,1679999422511,2d5e0e21495f73f8a797cdb9d156039b3a4fa1029b660a9047512a7db8e9501b diff --git a/.firebaserc b/.firebaserc index 57d6a5e..807e90a 100644 --- a/.firebaserc +++ b/.firebaserc @@ -1,5 +1,5 @@ { "projects": { - "default": "ramadan-remainder" + "default": "ramadanplannerbd" } } diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml new file mode 100644 index 0000000..b4b1146 --- /dev/null +++ b/.github/workflows/firebase-hosting-merge.yml @@ -0,0 +1,20 @@ +# This file was auto-generated by the Firebase CLI +# https://github.com/firebase/firebase-tools + +name: Deploy to Firebase Hosting on merge +on: + push: + branches: + - master +jobs: + build_and_deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: npm ci && npm run build + - uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: ${{ secrets.GITHUB_TOKEN }} + firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_RAMADANPLANNERBD }} + channelId: live + projectId: ramadanplannerbd diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml new file mode 100644 index 0000000..a0ef892 --- /dev/null +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -0,0 +1,21 @@ +# This file was auto-generated by the Firebase CLI +# https://github.com/firebase/firebase-tools + +name: Deploy to Firebase Hosting on PR +on: pull_request +permissions: + checks: write + contents: read + pull-requests: write +jobs: + build_and_preview: + if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: npm ci && npm run build + - uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: ${{ secrets.GITHUB_TOKEN }} + firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_RAMADANPLANNERBD }} + projectId: ramadanplannerbd diff --git a/android/app/build.gradle b/android/app/build.gradle index ede4c95..108dc5d 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -22,6 +22,9 @@ if (flutterVersionName == null) { } apply plugin: 'com.android.application' +// START: FlutterFire Configuration +apply plugin: 'com.google.gms.google-services' +// END: FlutterFire Configuration apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" diff --git a/android/app/google-services.json b/android/app/google-services.json index b974d08..cf17662 100644 --- a/android/app/google-services.json +++ b/android/app/google-services.json @@ -1,36 +1,26 @@ { "project_info": { - "project_number": "897038968699", - "project_id": "ramadan-remainder", - "storage_bucket": "ramadan-remainder.appspot.com" + "project_number": "123081775898", + "project_id": "ramadanplannerbd", + "storage_bucket": "ramadanplannerbd.appspot.com" }, "client": [ { "client_info": { - "mobilesdk_app_id": "1:897038968699:android:6eb05b44cddca28b737fde", + "mobilesdk_app_id": "1:123081775898:android:3790bdec5a64dec58a6aa3", "android_client_info": { "package_name": "com.ababildev.ramadanplanner" } }, - "oauth_client": [ - { - "client_id": "897038968699-8ltat0magdapep6r3p4dbsuip7jfb0d6.apps.googleusercontent.com", - "client_type": 3 - } - ], + "oauth_client": [], "api_key": [ { - "current_key": "AIzaSyBSPLR8RGF3atQIix__ypgfWoNEAksVjN0" + "current_key": "AIzaSyB5l4HwLkylYvk7_9P0aQk95zGXv4lbGFQ" } ], "services": { "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "897038968699-8ltat0magdapep6r3p4dbsuip7jfb0d6.apps.googleusercontent.com", - "client_type": 3 - } - ] + "other_platform_oauth_client": [] } } } diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index 0de8d4e..6509602 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -1,12 +1,12 @@ - + - + --> + diff --git a/android/build.gradle b/android/build.gradle index 6c42fd6..d3218fa 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -6,6 +6,9 @@ buildscript { } dependencies { + // START: FlutterFire Configuration + classpath 'com.google.gms:google-services:4.3.15' + // END: FlutterFire Configuration classpath 'com.android.tools.build:gradle:7.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.20" classpath 'com.android.tools.build:gradle:4.2.2' diff --git a/firebase.json b/firebase.json index 0d25a77..9fd720a 100644 --- a/firebase.json +++ b/firebase.json @@ -1,10 +1,37 @@ { + "flutter": { + "platforms": { + "android": { + "default": { + "projectId": "ramadanplannerbd", + "appId": "1:123081775898:android:3790bdec5a64dec58a6aa3", + "fileOutput": "android/app/google-services.json" + } + }, + "dart": { + "lib/firebase_options.dart": { + "projectId": "ramadanplannerbd", + "configurations": { + "android": "1:123081775898:android:3790bdec5a64dec58a6aa3", + "ios": "1:123081775898:ios:14596f687d7ec5058a6aa3", + "web": "1:123081775898:web:8407066bc5eb1f158a6aa3" + } + } + } + } + }, "hosting": { - "public": "build/web", + "public": "public", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" + ], + "rewrites": [ + { + "source": "**", + "destination": "/index.html" + } ] } } diff --git a/lib/app/modules/fastscreen/controllers/fastscreen_controller.dart b/lib/app/modules/fastscreen/controllers/fastscreen_controller.dart index b146725..cf05ef2 100644 --- a/lib/app/modules/fastscreen/controllers/fastscreen_controller.dart +++ b/lib/app/modules/fastscreen/controllers/fastscreen_controller.dart @@ -1,16 +1,17 @@ import 'dart:convert'; - import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:get/get.dart'; import 'package:hive/hive.dart'; +import 'package:ramadanplanner/app/data/dinerkaj.dart'; import 'package:ramadanplanner/app/model/locationmodel.dart'; import 'package:ramadanplanner/app/routes/app_pages.dart'; -import 'package:ramadanplanner/app/service/notification/firebasenotification.dart'; +// import 'package:ramadanplanner/app/service/notification/firebasenotification.dart'; +import 'package:ramadanplanner/app/service/notification/notification_service_mobile.dart'; class FastscreenController extends GetxController { - final FirebaseNotificationService firebasenotificationService = FirebaseNotificationService(); - + final NotificationService notificationService = NotificationService(); + final TextEditingController name = TextEditingController(); List locationList = []; LocationModel? selectedLocation; @@ -58,17 +59,26 @@ class FastscreenController extends GetxController { } @override - void onInit() { - Future.delayed( const Duration( - milliseconds: 10, - ), () { - screenChange(); - firebasenotificationService.requestNotificationPermissions(); + void onInit() { + Future.delayed( + const Duration( + milliseconds: 100, + ), () { + screenChange(); + update(); + NotificationService().dalyscheduleNotifications( + payLoad: 'DailyTask', + title: "আস-সালামু আলাইকুম \n আজকের দিনের কাজ হলো", + body: "${dinerkaj[DateTime.now().day - 1]}", + timeSlots: [ + {'hour': 6, 'minute': 0}, + {'hour': 17, 'minute': 0}, + ], + ); + fetchLocations(); }); super.onInit(); - - fetchLocations(); } @override diff --git a/lib/app/modules/home/controllers/home_controller.dart b/lib/app/modules/home/controllers/home_controller.dart index 032fbf1..e44bb5a 100644 --- a/lib/app/modules/home/controllers/home_controller.dart +++ b/lib/app/modules/home/controllers/home_controller.dart @@ -17,7 +17,7 @@ import 'package:sizer/sizer.dart'; import 'package:timezone/data/latest.dart' as tz; import 'package:timezone/timezone.dart' as tz; import '../../../../Util/app_colors.dart'; -import '../../../service/notification/notification.dart'; +import '../../../service/notification/notification_service_mobile.dart'; import '../../../data/dinerkaj.dart'; import '../../../data/hadis.dart'; import 'package:http/http.dart' as http; diff --git a/lib/app/modules/praytime/views/praytime_view.dart b/lib/app/modules/praytime/views/praytime_view.dart index f8f764c..588006f 100644 --- a/lib/app/modules/praytime/views/praytime_view.dart +++ b/lib/app/modules/praytime/views/praytime_view.dart @@ -117,12 +117,12 @@ class PraytimeView extends GetView { icon: 'assets/icon/Icon_Fajr.svg', ), prayTime( - title: 'Sunrise', + title: 'সূর্যোদয়', time: controller.getSunRiceTime(), icon: 'assets/icon/Sunrise.svg', ), prayTime( - title: 'সূর্যোদয়', + title: 'যুহর', time: controller.getdhuhrTime(), icon: 'assets/icon/Icon_Dhuhr.svg', ), diff --git a/lib/app/service/notification/firebasenotification.dart b/lib/app/service/notification/firebasenotification.dart index 97501c6..c3200ee 100644 --- a/lib/app/service/notification/firebasenotification.dart +++ b/lib/app/service/notification/firebasenotification.dart @@ -19,6 +19,8 @@ class FirebaseNotificationService { await Firebase.initializeApp(); _initializeLocalNotifications(); _setupFirebaseMessaging(); + requestNotificationPermissions(); + } // Initialize local notifications diff --git a/lib/app/service/notification/notification.dart b/lib/app/service/notification/notification.dart deleted file mode 100644 index 5ed44ef..0000000 --- a/lib/app/service/notification/notification.dart +++ /dev/null @@ -1,115 +0,0 @@ -import 'package:flutter_local_notifications/flutter_local_notifications.dart'; -import 'package:get/get.dart'; -import 'package:permission_handler/permission_handler.dart'; -import 'package:ramadanplanner/app/data/dinerkaj.dart'; -import 'package:ramadanplanner/app/routes/app_pages.dart'; -import 'package:timezone/data/latest.dart' as tz; -import 'package:timezone/timezone.dart' as tz; - -class NotificationService extends GetxService { - final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = - FlutterLocalNotificationsPlugin(); - - Future init() async { - // Initialize the flutter_local_notifications plugin - const AndroidInitializationSettings initializationSettingsAndroid = - AndroidInitializationSettings('@mipmap/ic_launcher'); - const InitializationSettings initializationSettings = InitializationSettings( - android: initializationSettingsAndroid, - ); - - await flutterLocalNotificationsPlugin.initialize( - initializationSettings, - onDidReceiveNotificationResponse: (details) { - // Handle notification tap - Get.toNamed(Routes.DAILY_TRACKING); - }, - ); - - // Initialize time zone data - tz.initializeTimeZones(); - - // Request notification permissions - await requestPermissions(); - - // Schedule daily notifications - scheduleDailyNotifications(); - - return this; - } - - Future requestPermissions() async { - final status = await Permission.notification.status; - if (status.isDenied) { - // Request permission - final result = await Permission.notification.request(); - if (result.isDenied) { - // Handle the case when permission is denied - Get.snackbar( - 'Permission Denied', - 'Notification permissions are required to receive notifications.', - snackPosition: SnackPosition.bottom, - ); - } else if (result.isPermanentlyDenied) { - // Handle the case when permission is permanently denied - Get.snackbar( - 'Permission Required', - 'Notification permissions are required. Please enable them in app settings.', - snackPosition: SnackPosition.bottom, - ); - // Redirect to app settings - openAppSettings(); - } - } else if (status.isPermanentlyDenied) { - // Handle the case when permission is permanently denied - Get.snackbar( - 'Permission Required', - 'Notification permissions are required. Please enable them in app settings.', - snackPosition: SnackPosition.bottom, - ); - // Redirect to app settings - openAppSettings(); - } - } - - void scheduleDailyNotifications() { - // Schedule 6 PM notification - _scheduleNotification(18, 0, 'আস-সালামু আলাইকুম', "আজকের দিনের কাজ \n ${dinerkaj[DateTime.now().day]}"); - - // Schedule 8 AM notification - _scheduleNotification(8, 0, 'আস-সালামু আলাইকুম', "আজকের দিনের কাজ \n ${dinerkaj[DateTime.now().day]}"); - } - - void _scheduleNotification(int hour, int minute, String title, String body) { - final tz.TZDateTime now = tz.TZDateTime.now(tz.local); - final tz.TZDateTime scheduledDate = tz.TZDateTime( - tz.local, - now.year, - now.month, - now.day, - hour, - minute, - ); - - flutterLocalNotificationsPlugin.zonedSchedule( - 0, - title, - body, - scheduledDate.isBefore(now) - ? scheduledDate.add(const Duration(days: 1)) - : scheduledDate, - const NotificationDetails( - android: AndroidNotificationDetails( - 'your_channel_id', - 'your_channel_name', - importance: Importance.max, - priority: Priority.high, - ), - ), - androidAllowWhileIdle: true, - uiLocalNotificationDateInterpretation: - UILocalNotificationDateInterpretation.wallClockTime, - matchDateTimeComponents: DateTimeComponents.time, // Repeat daily - ); - } -} diff --git a/lib/app/service/notification/notification_service.dart b/lib/app/service/notification/notification_service.dart new file mode 100644 index 0000000..14bdb06 --- /dev/null +++ b/lib/app/service/notification/notification_service.dart @@ -0,0 +1,5 @@ +// lib/app/service/notification/notification_service.dart +import 'package:flutter/foundation.dart'; + +export 'notification_service_mobile.dart' + if (kIsWeb) 'notification_service_web.dart'; \ No newline at end of file diff --git a/lib/app/service/notification/notification_service_mobile.dart b/lib/app/service/notification/notification_service_mobile.dart new file mode 100644 index 0000000..bcaac55 --- /dev/null +++ b/lib/app/service/notification/notification_service_mobile.dart @@ -0,0 +1,191 @@ + + +// lib/app/service/notification/notification_service_mobile.dart +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:flutter_local_notifications/flutter_local_notifications.dart'; +import 'package:get/get.dart'; +import 'package:permission_handler/permission_handler.dart'; +import 'package:ramadanplanner/app/routes/app_pages.dart'; +import 'package:timezone/data/latest.dart' as tz; +import 'package:timezone/timezone.dart' as tz; + +class NotificationService { + final FlutterLocalNotificationsPlugin notificationsPlugin = + FlutterLocalNotificationsPlugin(); + + Future initNotification() async { + tz.initializeTimeZones(); + + AndroidInitializationSettings initializationSettingsAndroid = + const AndroidInitializationSettings('@mipmap/ic_launcher'); + + await requestPermissions(); + + var initializationSettingsIOS = DarwinInitializationSettings( + requestAlertPermission: true, + requestBadgePermission: true, + requestSoundPermission: true, + defaultPresentAlert: true, + defaultPresentBadge: true, + defaultPresentSound: true, + onDidReceiveLocalNotification: + (int id, String? title, String? body, String? payload) async {}, + ); + + var initializationSettings = InitializationSettings( + android: initializationSettingsAndroid, + iOS: initializationSettingsIOS, + ); + + await notificationsPlugin.initialize( + initializationSettings, + onDidReceiveNotificationResponse: (NotificationResponse details) { + Get.offNamed(Routes.DAILY_TRACKING); + }, + + ); + + const AndroidNotificationChannel channel = AndroidNotificationChannel( + 'channelId', + 'channelName', + importance: Importance.max, + enableLights: true, + playSound: true, + enableVibration: true, + ledColor: Colors.red, + ); + + await notificationsPlugin + .resolvePlatformSpecificImplementation< + AndroidFlutterLocalNotificationsPlugin>()! + .createNotificationChannel(channel); + } + + Future requestPermissions() async { + if (Platform.isAndroid) { + final status = await Permission.notification.status; + if (status.isDenied) { + final result = await Permission.notification.request(); + if (result.isDenied) { + Get.snackbar( + 'Permission Denied', + 'Notification permissions are required to receive notifications.', + snackPosition: SnackPosition.bottom, + ); + } else if (result.isPermanentlyDenied) { + Get.snackbar( + 'Permission Required', + 'Notification permissions are required. Please enable them in app settings.', + snackPosition: SnackPosition.bottom, + ); + openAppSettings(); + } + } else if (status.isPermanentlyDenied) { + Get.snackbar( + 'Permission Required', + 'Notification permissions are required. Please enable them in app settings.', + snackPosition: SnackPosition.bottom, + ); + openAppSettings(); + } + } else if (Platform.isIOS) { + final status = await Permission.notification.status; + if (!status.isGranted) { + await Permission.notification.request(); + } + } + } + + NotificationDetails notificationDetails() { + return const NotificationDetails( + android: AndroidNotificationDetails( + 'channelId', + 'channelName', + importance: Importance.max, + priority: Priority.high, + visibility: NotificationVisibility.public, + color: Colors.green, + playSound: true, + enableVibration: true, + icon: '@mipmap/ic_launcher', + fullScreenIntent: true, + showWhen: true, + showProgress: true, + ledColor: Colors.red, + ledOnMs: 1000, + ledOffMs: 500, + autoCancel: true, + enableLights: true, + ), + iOS: DarwinNotificationDetails(), + ); + } + + Future showNotification({ + int id = 0, + String? title, + String? body, + }) async { + return notificationsPlugin.show(id, title, body, notificationDetails()); + } + + Future scheduleNotification({ + int id = 0, + String? title, + String? body, + int? hour, + int? minute, + String? payLoad, + }) async { + return notificationsPlugin.zonedSchedule( + id, + title, + body, + nextInstanceOfOneAm(hour!, minute!), + notificationDetails(), + uiLocalNotificationDateInterpretation: + UILocalNotificationDateInterpretation.absoluteTime, + androidScheduleMode: AndroidScheduleMode.exactAllowWhileIdle, + ); + } + + Future dalyscheduleNotifications({ + int id = 0, + String? title, + String? body, + String? payLoad, + required List> timeSlots, + }) async { + for (var timeSlot in timeSlots) { + int hour = timeSlot['hour']!; + int minute = timeSlot['minute']!; + + await notificationsPlugin.zonedSchedule( + id++, + title, + body, + payload: payLoad, + nextInstanceOfOneAm(hour, minute), + notificationDetails(), + uiLocalNotificationDateInterpretation: + UILocalNotificationDateInterpretation.absoluteTime, + androidScheduleMode: AndroidScheduleMode.exactAllowWhileIdle, + ); + } + + print("Notification Scheduled ${nextInstanceOfOneAm(6, 0)})}"); + } + + tz.TZDateTime nextInstanceOfOneAm(int hour, int minute) { + final tz.TZDateTime now = tz.TZDateTime.now(tz.local); + tz.TZDateTime scheduledDate = + tz.TZDateTime(tz.local, now.year, now.month, now.day, hour, minute); + if (scheduledDate.isBefore(now)) { + scheduledDate = scheduledDate.add(const Duration(days: 1)); + } + + print("Notification Scheduled ${scheduledDate}"); + return scheduledDate; + } +} diff --git a/lib/app/service/notification/notification_service_web.dart b/lib/app/service/notification/notification_service_web.dart new file mode 100644 index 0000000..232d9e6 --- /dev/null +++ b/lib/app/service/notification/notification_service_web.dart @@ -0,0 +1,47 @@ +// lib/app/service/notification/notification_service_web.dart +import 'dart:html' as html; + +class NotificationService { + Future initNotification() async { + // Web-specific initialization + } + + Future _showWebNotification(String? title, String? body) async { + if (html.Notification.supported) { + html.Notification.requestPermission().then((permission) { + if (permission == 'granted') { + html.Notification(title ?? 'Notification', body: body ?? ''); + } + }); + } + } + + Future showNotification({ + int id = 0, + String? title, + String? body, + }) async { + _showWebNotification(title, body); + } + + Future scheduleNotification({ + int id = 0, + String? title, + String? body, + int? hour, + int? minute, + String? payLoad, + }) async { + _showWebNotification(title, body); + } + + Future dalyscheduleNotifications({ + int id = 0, + String? title, + String? body, + String? payLoad, + required List> timeSlots, + }) async { + _showWebNotification(title, body); + } +} diff --git a/lib/firebase_options.dart b/lib/firebase_options.dart index 21e81dc..de5d61e 100644 --- a/lib/firebase_options.dart +++ b/lib/firebase_options.dart @@ -1,5 +1,5 @@ // File generated by FlutterFire CLI. -// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members +// ignore_for_file: type=lint import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; import 'package:flutter/foundation.dart' show defaultTargetPlatform, kIsWeb, TargetPlatform; @@ -47,29 +47,29 @@ class DefaultFirebaseOptions { } static const FirebaseOptions web = FirebaseOptions( - apiKey: 'AIzaSyCWLqgrYlPluoD1xHlU_WXhpcilCAxyRwI', - appId: '1:897038968699:web:d91e97b68bdb07b8737fde', - messagingSenderId: '897038968699', - projectId: 'ramadan-remainder', - authDomain: 'ramadan-remainder.firebaseapp.com', - storageBucket: 'ramadan-remainder.appspot.com', + apiKey: 'AIzaSyC2U6xN8mASwR5Qa0SR6WT4gs58BjjiRJg', + appId: '1:123081775898:web:8407066bc5eb1f158a6aa3', + messagingSenderId: '123081775898', + projectId: 'ramadanplannerbd', + authDomain: 'ramadanplannerbd.firebaseapp.com', + storageBucket: 'ramadanplannerbd.appspot.com', + measurementId: 'G-0RB8B28120', ); static const FirebaseOptions android = FirebaseOptions( - apiKey: 'AIzaSyBSPLR8RGF3atQIix__ypgfWoNEAksVjN0', - appId: '1:897038968699:android:6eb05b44cddca28b737fde', - messagingSenderId: '897038968699', - projectId: 'ramadan-remainder', - storageBucket: 'ramadan-remainder.appspot.com', + apiKey: 'AIzaSyB5l4HwLkylYvk7_9P0aQk95zGXv4lbGFQ', + appId: '1:123081775898:android:3790bdec5a64dec58a6aa3', + messagingSenderId: '123081775898', + projectId: 'ramadanplannerbd', + storageBucket: 'ramadanplannerbd.appspot.com', ); static const FirebaseOptions ios = FirebaseOptions( - apiKey: 'AIzaSyA7UIJPv-uFEILS-V0gLpa2MxjWiV-GDb8', - appId: '1:897038968699:ios:e1f4e5d5b8cee1b3737fde', - messagingSenderId: '897038968699', - projectId: 'ramadan-remainder', - storageBucket: 'ramadan-remainder.appspot.com', - iosClientId: '897038968699-d82cgtpp82kopf1tvqgs8pbpjm8slhrk.apps.googleusercontent.com', + apiKey: 'AIzaSyDVhmublVOOxovziiXqbwonZvGnKJVESaU', + appId: '1:123081775898:ios:14596f687d7ec5058a6aa3', + messagingSenderId: '123081775898', + projectId: 'ramadanplannerbd', + storageBucket: 'ramadanplannerbd.appspot.com', iosBundleId: 'com.ababildev.ramadanplanner', ); } diff --git a/lib/main.dart b/lib/main.dart index 81a70ea..680c62b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -11,27 +11,31 @@ import 'app/data/hivaData.dart'; import 'app/routes/app_pages.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:timezone/data/latest.dart' as tz; - -import 'app/service/notification/notification.dart'; +import 'package:flutter/foundation.dart'; +import 'app/service/notification/notification_service_mobile.dart'; import 'firebase_options.dart'; void main() async { + final NotificationService notificationService = NotificationService(); WidgetsFlutterBinding.ensureInitialized(); + notificationService.initNotification(); + // await FlutterBackgroundService.initialize(onStart); await hiveData(); // Initialize NotificationService - - tz.initializeTimeZones(); + + tz.initializeTimeZones(); await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, ); await Firebase.initializeApp(); - FirebaseNotificationService().initialize(); - await NotificationService().init(); - // Register background message handler - FirebaseMessaging.onBackgroundMessage(FirebaseNotificationService.backgroundMessageHandler); + FirebaseNotificationService().initialize(); + + // Register background message handler + FirebaseMessaging.onBackgroundMessage( + FirebaseNotificationService.backgroundMessageHandler); runApp(const MyApp()); } @@ -68,11 +72,9 @@ class _MyAppState extends State { scaffoldBackgroundColor: AppColors.primaryColor, primarySwatch: Colors.green, ), - defaultTransition: Transition.noTransition, + defaultTransition: Transition.noTransition, ); }, ); } } - - diff --git a/public/404.html b/public/404.html new file mode 100644 index 0000000..829eda8 --- /dev/null +++ b/public/404.html @@ -0,0 +1,33 @@ + + + + + + Page Not Found + + + + +
+

404

+

Page Not Found

+

The specified file was not found on this website. Please check the URL for mistakes and try again.

+

Why am I seeing this?

+

This page was generated by the Firebase Command-Line Interface. To modify it, edit the 404.html file in your project's configured public directory.

+
+ + diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..1d52c3b --- /dev/null +++ b/public/index.html @@ -0,0 +1,89 @@ + + + + + + Welcome to Firebase Hosting + + + + + + + + + + + + + + + + + + + +
+

Welcome

+

Firebase Hosting Setup Complete

+

You're seeing this because you've successfully setup Firebase Hosting. Now it's time to go build something extraordinary!

+ Open Hosting Documentation +
+

Firebase SDK Loading…

+ + + + diff --git a/pubspec.lock b/pubspec.lock index 7d08f93..7f78eee 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -355,14 +355,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.4.1" - flutter_compass_v2: - dependency: transitive - description: - name: flutter_compass_v2 - sha256: c17b1533a43f5192e73d2f475ec2c142cc1e193eba6a9b49433d1ab68d70606b - url: "https://pub.dev" - source: hosted - version: "1.0.3" flutter_lints: dependency: "direct dev" description: @@ -395,14 +387,6 @@ packages: url: "https://pub.dev" source: hosted version: "7.2.0" - flutter_qiblah: - dependency: "direct main" - description: - name: flutter_qiblah - sha256: "6840caf98f8023d5d3eba3e57a80260ee2c9ed1a7054bc54785b529302f04835" - url: "https://pub.dev" - source: hosted - version: "3.0.3" flutter_svg: dependency: "direct main" description: @@ -493,54 +477,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.15.2" - geolocator: - dependency: transitive - description: - name: geolocator - sha256: "6cb9fb6e5928b58b9a84bdf85012d757fd07aab8215c5205337021c4999bad27" - url: "https://pub.dev" - source: hosted - version: "11.1.0" - geolocator_android: - dependency: transitive - description: - name: geolocator_android - sha256: "7aefc530db47d90d0580b552df3242440a10fe60814496a979aa67aa98b1fd47" - url: "https://pub.dev" - source: hosted - version: "4.6.1" - geolocator_apple: - dependency: transitive - description: - name: geolocator_apple - sha256: bc2aca02423ad429cb0556121f56e60360a2b7d694c8570301d06ea0c00732fd - url: "https://pub.dev" - source: hosted - version: "2.3.7" - geolocator_platform_interface: - dependency: transitive - description: - name: geolocator_platform_interface - sha256: "386ce3d9cce47838355000070b1d0b13efb5bc430f8ecda7e9238c8409ace012" - url: "https://pub.dev" - source: hosted - version: "4.2.4" - geolocator_web: - dependency: transitive - description: - name: geolocator_web - sha256: "49d8f846ebeb5e2b6641fe477a7e97e5dd73f03cbfef3fd5c42177b7300fb0ed" - url: "https://pub.dev" - source: hosted - version: "3.0.0" - geolocator_windows: - dependency: transitive - description: - name: geolocator_windows - sha256: "53da08937d07c24b0d9952eb57a3b474e29aae2abf9dd717f7e1230995f13f0e" - url: "https://pub.dev" - source: hosted - version: "0.2.3" get: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index d4964be..e6661de 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -25,7 +25,7 @@ dependencies: animated_notch_bottom_bar: ^1.0.3 flutter_svg: ^2.0.10+1 # home_widget: ^0.7.0 - flutter_qiblah: ^3.0.3 + # flutter_qiblah: ^3.0.3 # geolocator: ^11.1.0 flutter_widget_from_html: ^0.15.2 url_launcher: ^6.3.0 diff --git a/web_entrypoint.dart b/web_entrypoint.dart new file mode 100644 index 0000000..e69de29