mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-24 04:59:26 +01:00
Merge branch 'soru/fix-tap-notification' into 'main'
fix: Tap on notification to open room in (hopefully) all cases See merge request famedly/fluffychat!386
This commit is contained in:
commit
d5bd969095
@ -108,8 +108,7 @@ class BackgroundPush {
|
|||||||
Future<void> fullInit() async {
|
Future<void> fullInit() async {
|
||||||
_onContextInit?.call();
|
_onContextInit?.call();
|
||||||
_onContextInit = null;
|
_onContextInit = null;
|
||||||
// ignore: unawaited_futures
|
await setupPush();
|
||||||
setupPush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleLoginStateChanged(LoginState state) {
|
void handleLoginStateChanged(LoginState state) {
|
||||||
@ -211,7 +210,10 @@ class BackgroundPush {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool _wentToRoomOnStartup = false;
|
||||||
|
|
||||||
Future<void> setupPush() async {
|
Future<void> setupPush() async {
|
||||||
|
await setupLocalNotificationsPlugin();
|
||||||
if (_loginState != LoginState.logged ||
|
if (_loginState != LoginState.logged ||
|
||||||
!PlatformInfos.isMobile ||
|
!PlatformInfos.isMobile ||
|
||||||
context == null) {
|
context == null) {
|
||||||
@ -223,6 +225,20 @@ class BackgroundPush {
|
|||||||
} else {
|
} else {
|
||||||
await setupFirebase();
|
await setupFirebase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ignore: unawaited_futures
|
||||||
|
_flutterLocalNotificationsPlugin
|
||||||
|
.getNotificationAppLaunchDetails()
|
||||||
|
.then((details) {
|
||||||
|
if (details == null ||
|
||||||
|
!details.didNotificationLaunchApp ||
|
||||||
|
_wentToRoomOnStartup ||
|
||||||
|
apl == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_wentToRoomOnStartup = true;
|
||||||
|
goToRoom(details.payload);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _noFcmWarning() async {
|
Future<void> _noFcmWarning() async {
|
||||||
@ -266,6 +282,7 @@ class BackgroundPush {
|
|||||||
|
|
||||||
Future<void> goToRoom(String roomId) async {
|
Future<void> goToRoom(String roomId) async {
|
||||||
try {
|
try {
|
||||||
|
Logs().v('[Push] Attempting to go to room $roomId...');
|
||||||
if (apl == null) {
|
if (apl == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -295,21 +312,10 @@ class BackgroundPush {
|
|||||||
await _flutterLocalNotificationsPlugin.initialize(initializationSettings,
|
await _flutterLocalNotificationsPlugin.initialize(initializationSettings,
|
||||||
onSelectNotification: goToRoom);
|
onSelectNotification: goToRoom);
|
||||||
|
|
||||||
// ignore: unawaited_futures
|
|
||||||
_flutterLocalNotificationsPlugin
|
|
||||||
.getNotificationAppLaunchDetails()
|
|
||||||
.then((details) {
|
|
||||||
if (details == null || !details.didNotificationLaunchApp) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
goToRoom(details.payload);
|
|
||||||
});
|
|
||||||
|
|
||||||
_notificationsPluginSetUp = true;
|
_notificationsPluginSetUp = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> setupUp() async {
|
Future<void> setupUp() async {
|
||||||
await setupLocalNotificationsPlugin();
|
|
||||||
if (!(await store.getItemBool(SettingKeys.unifiedPushRegistered, false))) {
|
if (!(await store.getItemBool(SettingKeys.unifiedPushRegistered, false))) {
|
||||||
Logs().i('[Push] UnifiedPush not registered, attempting to do so...');
|
Logs().i('[Push] UnifiedPush not registered, attempting to do so...');
|
||||||
await UnifiedPush.registerAppWithDialog();
|
await UnifiedPush.registerAppWithDialog();
|
||||||
|
Loading…
Reference in New Issue
Block a user