[mob] Potential fix for notification order
This commit is contained in:
committed by
Neeraj Gupta
parent
0af37e8cbe
commit
a10972319b
@@ -40,6 +40,7 @@ import 'package:photos/services/machine_learning/ml_service.dart';
|
||||
import 'package:photos/services/machine_learning/semantic_search/semantic_search_service.dart';
|
||||
import "package:photos/services/magic_cache_service.dart";
|
||||
import 'package:photos/services/memories_service.dart';
|
||||
import "package:photos/services/notification_service.dart";
|
||||
import 'package:photos/services/push_service.dart';
|
||||
import 'package:photos/services/remote_sync_service.dart';
|
||||
import 'package:photos/services/search_service.dart';
|
||||
@@ -209,6 +210,7 @@ Future<void> _init(bool isBackground, {String via = ''}) async {
|
||||
await _logFGHeartBeatInfo();
|
||||
_logger.info("_logFGHeartBeatInfo done");
|
||||
unawaited(_scheduleHeartBeat(preferences, isBackground));
|
||||
NotificationService.instance.init(preferences);
|
||||
AppLifecycleService.instance.init(preferences);
|
||||
if (isBackground) {
|
||||
AppLifecycleService.instance.onAppInBackground('init via: $via');
|
||||
|
||||
@@ -20,13 +20,15 @@ class NotificationService {
|
||||
FlutterLocalNotificationsPlugin();
|
||||
final _logger = Logger("NotificationService");
|
||||
|
||||
Future<void> init(
|
||||
void init(SharedPreferences preferences) {
|
||||
_preferences = preferences;
|
||||
}
|
||||
|
||||
Future<void> initialize(
|
||||
void Function(
|
||||
NotificationResponse notificationResponse,
|
||||
) onNotificationTapped,
|
||||
SharedPreferences preferences,
|
||||
) async {
|
||||
_preferences = preferences;
|
||||
const androidSettings = AndroidInitializationSettings('notification_icon');
|
||||
const iosSettings = DarwinInitializationSettings(
|
||||
requestAlertPermission: false,
|
||||
|
||||
@@ -57,7 +57,6 @@ import 'package:photos/ui/viewer/search_tab/search_tab.dart';
|
||||
import 'package:photos/utils/dialog_util.dart';
|
||||
import "package:photos/utils/navigation_util.dart";
|
||||
import 'package:receive_sharing_intent/receive_sharing_intent.dart';
|
||||
import "package:shared_preferences/shared_preferences.dart";
|
||||
import 'package:uni_links/uni_links.dart';
|
||||
|
||||
class HomeWidget extends StatefulWidget {
|
||||
@@ -105,6 +104,7 @@ class _HomeWidgetState extends State<HomeWidget> {
|
||||
@override
|
||||
void initState() {
|
||||
_logger.info("Building initstate");
|
||||
super.initState();
|
||||
_tabChangedEventSubscription =
|
||||
Bus.instance.on<TabChangedEvent>().listen((event) {
|
||||
_selectedTabIndex = event.selectedIndex;
|
||||
@@ -221,13 +221,9 @@ class _HomeWidgetState extends State<HomeWidget> {
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
SharedPreferences.getInstance().then((preferences) {
|
||||
NotificationService.instance
|
||||
.init(_onDidReceiveNotificationResponse, preferences);
|
||||
});
|
||||
|
||||
super.initState();
|
||||
NotificationService.instance
|
||||
.initialize(_onDidReceiveNotificationResponse)
|
||||
.ignore();
|
||||
}
|
||||
|
||||
Future<void> _autoLogoutAlert() async {
|
||||
|
||||
Reference in New Issue
Block a user