diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 531d4a4..b809cac 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,55 +1,37 @@ +This XML file does not appear to have any style information associated with it. The document tree is shown below. - - + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - + In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. --> + + + + + + + \ No newline at end of file diff --git a/android/settings.gradle b/android/settings.gradle index a42444d..eb71b1f 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -19,7 +19,9 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "8.2.1" apply false - id "org.jetbrains.kotlin.android" version "1.8.22" apply false + id "org.jetbrains.kotlin.android" version "2.1.0" apply false + id("com.google.gms.google-services") version "4.4.2" apply false + } include ":app" diff --git a/lib/helpers/services/Firebase/firebase_messaging_service.dart b/lib/helpers/services/Firebase/firebase_messaging_service.dart new file mode 100644 index 0000000..9e9b9bb --- /dev/null +++ b/lib/helpers/services/Firebase/firebase_messaging_service.dart @@ -0,0 +1,53 @@ +import 'package:firebase_core/firebase_core.dart'; +import 'package:firebase_messaging/firebase_messaging.dart'; +import 'package:logger/logger.dart'; + +class FirebaseNotificationService { + final FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance; + final Logger _logger = Logger(); + + Future initialize() async { + await Firebase.initializeApp(); + _logger.i('Firebase initialized.'); + + NotificationSettings settings = await _firebaseMessaging.requestPermission(); + _logger.i('FCM permission status: ${settings.authorizationStatus}'); + + // Foreground messages + FirebaseMessaging.onMessage.listen((RemoteMessage message) { + _logger.i('🔔 Foreground Notification Received'); + _logNotificationDetails(message); + }); + + // When app is opened from background via notification + FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) { + _logger.i('📲 App opened via notification'); + _handleNotificationTap(message); + }); + + // Background handler registration + FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler); + } + + void _handleNotificationTap(RemoteMessage message) { + _logger.i('Notification tapped with data: ${message.data}'); + } + + void _logNotificationDetails(RemoteMessage message) { + _logger.i('Notification ID: ${message.messageId}'); + _logger.i('Title: ${message.notification?.title}'); + _logger.i('Body: ${message.notification?.body}'); + _logger.i('Data: ${message.data}'); + } +} + +// Background handler +Future _firebaseMessagingBackgroundHandler(RemoteMessage message) async { + await Firebase.initializeApp(); + final Logger _logger = Logger(); + _logger.i('🕓 Handling background notification...'); + _logger.i('Notification ID: ${message.messageId}'); + _logger.i('Title: ${message.notification?.title}'); + _logger.i('Body: ${message.notification?.body}'); + _logger.i('Data: ${message.data}'); +} diff --git a/lib/view/dashboard/dashboard_chart.dart b/lib/view/dashboard/dashboard_chart.dart index 5741fd5..405b50f 100644 --- a/lib/view/dashboard/dashboard_chart.dart +++ b/lib/view/dashboard/dashboard_chart.dart @@ -38,16 +38,56 @@ class AttendanceDashboardChart extends StatelessWidget { final Map _roleColorMap = {}; final List flatColors = [ - const Color(0xFFE57373), - const Color(0xFF64B5F6), - const Color(0xFF81C784), - const Color(0xFFFFB74D), - const Color(0xFFBA68C8), - const Color(0xFFFF8A65), - const Color(0xFF4DB6AC), - const Color(0xFFA1887F), - const Color(0xFFDCE775), - const Color(0xFF9575CD), + const Color(0xFFE57373), // Red + const Color(0xFF64B5F6), // Blue + const Color(0xFF81C784), // Green + const Color(0xFFFFB74D), // Orange + const Color(0xFFBA68C8), // Purple + const Color(0xFFFF8A65), // Deep Orange + const Color(0xFF4DB6AC), // Teal + const Color(0xFFA1887F), // Brown + const Color(0xFFDCE775), // Lime + const Color(0xFF9575CD), // Violet` + const Color(0xFF7986CB), // Indigo + const Color(0xFFAED581), // Light Green + const Color(0xFF4FC3F7), // Light Blue + const Color(0xFFF06292), // Pink + const Color(0xFFE0E0E0), // Grey + const Color(0xFFCE93D8), // Lavender + const Color(0xFFFFF176), // Yellow + const Color(0xFFA5D6A7), // Mint Green + const Color(0xFF90CAF9), // Sky Blue + const Color(0xFFFFAB91), // Salmon + const Color(0xFFE6EE9C), // Pale Lime + const Color(0xFFFFCC80), // Apricot + const Color(0xFFB39DDB), // Soft Purple + const Color(0xFF80DEEA), // Light Cyan + const Color(0xFFB0BEC5), // Blue Grey + const Color(0xFFEF9A9A), // Soft Red + const Color(0xFFFFCDD2), // Rose + const Color(0xFFC5CAE9), // Periwinkle + const Color(0xFFF8BBD0), // Baby Pink + const Color(0xFFD1C4E9), // Lilac + const Color(0xFFFFF9C4), // Pastel Yellow + const Color(0xFFC8E6C9), // Pastel Green + const Color(0xFFBBDEFB), // Pastel Blue + const Color(0xFFFFECB3), // Butter + const Color(0xFFE1BEE7), // Orchid + const Color(0xFFB2EBF2), // Powder Blue + const Color(0xFFCFD8DC), // Cool Grey + const Color(0xFFFBE9E7), // Peach Cream + const Color(0xFFF3E5F5), // Lavender Mist + const Color(0xFFFFFDE7), // Soft Sunlight + const Color(0xFFDCEDC8), // Soft Apple + const Color(0xFFB3E5FC), // Ice Blue + const Color(0xFFFFF3E0), // Cream + const Color(0xFFFCE4EC), // Candy Pink + const Color(0xFFEDE7F6), // Wisteria + const Color(0xFFE0F7FA), // Arctic Blue + const Color(0xFFECEFF1), // Frost + const Color(0xFFFFE0B2), // Sandy Orange + const Color(0xFFFFD54F), // Mango + const Color(0xFFFFA726), // Tangerine ]; Color _getRoleColor(String role) { diff --git a/pubspec.yaml b/pubspec.yaml index fef9493..7d7ed8d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -77,6 +77,9 @@ dependencies: html_editor_enhanced: ^2.7.0 flutter_quill_delta_from_html: ^1.5.2 quill_delta: ^3.0.0-nullsafety.2 + firebase_core: ^3.14.0 + firebase_messaging: ^15.2.7 + googleapis_auth: ^2.0.0 dev_dependencies: flutter_test: sdk: flutter