diff --git a/.gradle/8.1.1/checksums/checksums.lock b/.gradle/8.1.1/checksums/checksums.lock new file mode 100644 index 0000000..b0e50e9 Binary files /dev/null and b/.gradle/8.1.1/checksums/checksums.lock differ diff --git a/.gradle/8.1.1/dependencies-accessors/dependencies-accessors.lock b/.gradle/8.1.1/dependencies-accessors/dependencies-accessors.lock new file mode 100644 index 0000000..34f1fe5 Binary files /dev/null and b/.gradle/8.1.1/dependencies-accessors/dependencies-accessors.lock differ diff --git a/.gradle/8.1.1/dependencies-accessors/gc.properties b/.gradle/8.1.1/dependencies-accessors/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.gradle/8.1.1/executionHistory/executionHistory.lock b/.gradle/8.1.1/executionHistory/executionHistory.lock new file mode 100644 index 0000000..f827d4a Binary files /dev/null and b/.gradle/8.1.1/executionHistory/executionHistory.lock differ diff --git a/.gradle/8.1.1/fileChanges/last-build.bin b/.gradle/8.1.1/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/.gradle/8.1.1/fileChanges/last-build.bin differ diff --git a/.gradle/8.1.1/fileHashes/fileHashes.lock b/.gradle/8.1.1/fileHashes/fileHashes.lock new file mode 100644 index 0000000..dca5ee9 Binary files /dev/null and b/.gradle/8.1.1/fileHashes/fileHashes.lock differ diff --git a/.gradle/8.1.1/gc.properties b/.gradle/8.1.1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 557a19a..ec889f3 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties index f410b38..fb0e48f 100644 --- a/.gradle/buildOutputCleanup/cache.properties +++ b/.gradle/buildOutputCleanup/cache.properties @@ -1,2 +1,2 @@ -#Sat Jun 08 20:35:59 IST 2024 -gradle.version=7.5.1 +#Wed Jun 12 11:38:18 IST 2024 +gradle.version=8.1.1 diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin deleted file mode 100644 index 01551ee..0000000 Binary files a/.gradle/buildOutputCleanup/outputFiles.bin and /dev/null differ diff --git a/lib/home_page.dart b/lib/home_page.dart index e66aa4c..4924df6 100644 --- a/lib/home_page.dart +++ b/lib/home_page.dart @@ -1,6 +1,5 @@ import 'dart:ui'; import 'package:flutter_screenutil/flutter_screenutil.dart'; - import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:opso/opso_timeline.dart'; @@ -17,7 +16,7 @@ import 'package:opso/widgets/book_mark_screen.dart'; import 'package:adaptive_theme/adaptive_theme.dart'; import 'package:opso/widgets/faq.dart'; import 'dart:math' as math; - +import 'package:awesome_notifications/awesome_notifications.dart'; import 'about.dart'; class HomePage extends StatefulWidget { @@ -30,7 +29,7 @@ class HomePage extends StatefulWidget { class _HomePageState extends State { @override void initState() { - showNotification(); + // showNotification(); super.initState(); _getInitialThemeMode(); } @@ -250,8 +249,7 @@ class _HomePageState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => - FAQPage(), + builder: (context) => FAQPage(), ), ); }, diff --git a/lib/main.dart b/lib/main.dart index bd0cf86..87e2cd7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -12,7 +12,7 @@ import 'package:opso/programs%20screen/social_winter_of_code.dart'; import 'package:opso/services/notificationService.dart'; import 'home_page.dart'; import 'package:adaptive_theme/adaptive_theme.dart'; -import 'splash_screen.dart'; +import 'splash_screen.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -35,7 +35,7 @@ class OpSoApp extends StatelessWidget { dark: ThemeData.dark(), initial: AdaptiveThemeMode.system, builder: (theme, darkTheme) => MaterialApp( - initialRoute: '/splash_screen', + initialRoute: '/splash_screen', routes: { "/progarm_page": (context) => const HomePage(), "/girl_script_summer_of_code": (context) => const GSSOCScreen(), @@ -50,7 +50,7 @@ class OpSoApp extends StatelessWidget { const MajorLeagueHackingFellowship(), "/linux_foundation": (context) => const LinuxFoundation(), "/landing_page": (context) => const LandingPage(), - '/splash_screen': (context) => SplashScreen(), + '/splash_screen': (context) => SplashScreen(), }, title: 'OpSo', debugShowCheckedModeBanner: false, @@ -60,10 +60,9 @@ class OpSoApp extends StatelessWidget { // primarySwatch: Colors.blue, // visualDensity: VisualDensity.adaptivePlatformDensity, // ), - home: const HomePage(), - + // home: const HomePage(), ), ); }); } -} \ No newline at end of file +} diff --git a/lib/services/notificationService.dart b/lib/services/notificationService.dart index a42fb6f..5dbda2b 100644 --- a/lib/services/notificationService.dart +++ b/lib/services/notificationService.dart @@ -29,10 +29,10 @@ class NotificationService { debug: true, ); - bool isAllowed = await AwesomeNotifications().isNotificationAllowed(); - if (!isAllowed) { - await AwesomeNotifications().requestPermissionToSendNotifications(); - } + // bool isAllowed = await AwesomeNotifications().isNotificationAllowed(); + // if (!isAllowed) { + // await AwesomeNotifications().requestPermissionToSendNotifications(); + // } await AwesomeNotifications().setListeners( onActionReceivedMethod: onActionReceivedMethod, @@ -70,7 +70,7 @@ class NotificationService { } } - static Future showNotification( + static Future showNotification( {required final String title, required final String body, final String? summary, @@ -83,29 +83,61 @@ class NotificationService { final bool scheduled = false, final int? interval}) async { assert(!scheduled || (scheduled && interval != null)); - await AwesomeNotifications().createNotification( - content: NotificationContent( - id: -1, - channelKey: 'high_importance_channel', - title: title, - body: body, - actionType: actionType, - notificationLayout: notificationLayout, - summary: summary, - category: category, - payload: payload, - bigPicture: bigPicture, - ), - actionButtons: actionButtons, - schedule: scheduled - ? NotificationInterval( - interval: interval, - timeZone: - await AwesomeNotifications().getLocalTimeZoneIdentifier(), - preciseAlarm: true, - ) - : null, - ); + bool allowed = + await AwesomeNotifications().requestPermissionToSendNotifications(); + if (allowed) { + await AwesomeNotifications().createNotification( + content: NotificationContent( + id: -1, + channelKey: 'high_importance_channel', + title: title, + body: body, + actionType: actionType, + notificationLayout: notificationLayout, + summary: summary, + category: category, + payload: payload, + bigPicture: bigPicture, + ), + actionButtons: actionButtons, + schedule: scheduled + ? NotificationInterval( + interval: interval, + timeZone: + await AwesomeNotifications().getLocalTimeZoneIdentifier(), + preciseAlarm: true, + ) + : null, + ); + } else { + allowed = await AwesomeNotifications().isNotificationAllowed(); + if (allowed) { + await AwesomeNotifications().createNotification( + content: NotificationContent( + id: -1, + channelKey: 'high_importance_channel', + title: title, + body: body, + actionType: actionType, + notificationLayout: notificationLayout, + summary: summary, + category: category, + payload: payload, + bigPicture: bigPicture, + ), + actionButtons: actionButtons, + schedule: scheduled + ? NotificationInterval( + interval: interval, + timeZone: + await AwesomeNotifications().getLocalTimeZoneIdentifier(), + preciseAlarm: true, + ) + : null, + ); + } + } + return allowed; } static Future scheduleNotificationsForEvent( @@ -132,17 +164,35 @@ class NotificationService { ); } - static Future _scheduleNotification( + static Future _scheduleNotification( String description, String body, DateTime dateTime) async { - await AwesomeNotifications().createNotification( - content: NotificationContent( - id: DateTime.now().millisecondsSinceEpoch.remainder(100000), - channelKey: 'high_importance_channel', - title: description, - body: body, - notificationLayout: NotificationLayout.Default, - ), - schedule: NotificationCalendar.fromDate(date: dateTime), - ); + if (await AwesomeNotifications().isNotificationAllowed()) { + await AwesomeNotifications().createNotification( + content: NotificationContent( + id: DateTime.now().millisecondsSinceEpoch.remainder(100000), + channelKey: 'high_importance_channel', + title: description, + body: body, + notificationLayout: NotificationLayout.Default, + ), + schedule: NotificationCalendar.fromDate(date: dateTime), + ); + return true; + } else { + bool allowed = await AwesomeNotifications().isNotificationAllowed(); + if (allowed) { + await AwesomeNotifications().createNotification( + content: NotificationContent( + id: DateTime.now().millisecondsSinceEpoch.remainder(100000), + channelKey: 'high_importance_channel', + title: description, + body: body, + notificationLayout: NotificationLayout.Default, + ), + schedule: NotificationCalendar.fromDate(date: dateTime), + ); + } + return allowed; + } } } diff --git a/pubspec.lock b/pubspec.lock index c36028c..6cc3be2 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -260,26 +260,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" url: "https://pub.dev" source: hosted - version: "10.0.4" + version: "10.0.0" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "2.0.1" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "2.0.1" lints: dependency: transitive description: @@ -308,10 +308,10 @@ packages: dependency: transitive description: name: meta - sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.12.0" + version: "1.11.0" multi_select_flutter: dependency: "direct main" description: @@ -396,10 +396,10 @@ packages: dependency: transitive description: name: shared_preferences_android - sha256: "93d0ec9dd902d85f326068e6a899487d1f65ffcd5798721a95330b26c8131577" + sha256: "1ee8bf911094a1b592de7ab29add6f826a7331fb854273d55918693d5364a1f2" url: "https://pub.dev" source: hosted - version: "2.2.3" + version: "2.2.2" shared_preferences_foundation: dependency: transitive description: @@ -489,10 +489,10 @@ packages: dependency: transitive description: name: test_api - sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.7.0" + version: "0.6.1" timeline_tile: dependency: "direct main" description: @@ -521,10 +521,10 @@ packages: dependency: transitive description: name: url_launcher_android - sha256: ceb2625f0c24ade6ef6778d1de0b2e44f2db71fded235eb52295247feba8c5cf + sha256: "17cd5e205ea615e2c6ea7a77323a11712dffa0720a8a90540db57a01347f9ad9" url: "https://pub.dev" source: hosted - version: "6.3.3" + version: "6.3.2" url_launcher_ios: dependency: transitive description: @@ -609,10 +609,10 @@ packages: dependency: transitive description: name: vm_service - sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 url: "https://pub.dev" source: hosted - version: "14.2.1" + version: "13.0.0" web: dependency: transitive description: @@ -625,10 +625,10 @@ packages: dependency: transitive description: name: win32 - sha256: a79dbe579cb51ecd6d30b17e0cae4e0ea15e2c0e66f69ad4198f22a6789e94f4 + sha256: "0eaf06e3446824099858367950a813472af675116bf63f008a4c2a75ae13e9cb" url: "https://pub.dev" source: hosted - version: "5.5.1" + version: "5.5.0" xdg_directories: dependency: transitive description: @@ -654,5 +654,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.4.0 <4.0.0" - flutter: ">=3.22.0" + dart: ">=3.3.3 <4.0.0" + flutter: ">=3.19.0"