finished notification fix

This commit is contained in:
hihihaha
2024-03-10 17:38:22 +01:00
parent f6ff98c5ed
commit b8e4c4ea3a
13 changed files with 306 additions and 177 deletions

View File

@@ -10,6 +10,8 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:refilc/app.dart';
import 'package:flutter/services.dart';
import 'package:refilc/utils/navigation_service.dart';
import 'package:refilc/utils/service_locator.dart';
import 'package:refilc_mobile_ui/screens/error_screen.dart';
import 'package:refilc_mobile_ui/screens/error_report_screen.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
@@ -24,19 +26,22 @@ void main() async {
// ignore: deprecated_member_use
binding.renderView.automaticSystemUiAdjustment = false;
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
// navigation
setupLocator();
// Startup
Startup startup = Startup();
await startup.start();
// Custom error page
ErrorWidget.builder = errorBuilder;
BackgroundFetch.registerHeadlessTask(backgroundHeadlessTask);
// initialize stripe key
stripe.Stripe.publishableKey =
'pk_test_51Oo7iUBS0FxsTGxKjGZSQqzDKWHY5ZFYM9XeI0qSdIh2w8jWy6GhHlYpT7GLTzgpl1xhE5YP4BXpA4gMZqPmgMId00cGFYFzbh';
BackgroundFetch.registerHeadlessTask(backgroundHeadlessTask);
// Run App
runApp(App(
database: startup.database,
@@ -58,6 +63,9 @@ class Startup {
settings = await database.query.getSettings(database);
user = await database.query.getUsers(settings);
// Set all notification categories to seen to avoid having notifications that the user has already seen in the app
NotificationsHelper().setAllCategoriesSeen(user);
late FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin;
// Notifications setup
if (!kIsWeb) {
@@ -118,6 +126,7 @@ class Startup {
// Initialize notifications
await flutterLocalNotificationsPlugin.initialize(
initializationSettings,
onDidReceiveNotificationResponse: NotificationsHelper().onDidReceiveNotificationResponse,
);
}