Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
493776e3dd |
|||
|
25afcf4acd |
3 changed files with 14 additions and 6 deletions
|
|
@ -122,16 +122,18 @@ class ClientController extends AsyncNotifier<int> {
|
|||
}
|
||||
}
|
||||
|
||||
Future<(Event, RoomMetadata)> handlePush(Map<String, dynamic> data) async {
|
||||
Future<(Event, RoomMetadata)?> handlePush(Map<String, dynamic> data) async {
|
||||
final response = await callGomuksMethod(
|
||||
data,
|
||||
(handle, data) async => GomuksHandlePush(handle, data),
|
||||
);
|
||||
|
||||
return (
|
||||
Event.fromJson(response["event"]),
|
||||
RoomMetadata.fromJson(response["room"]),
|
||||
);
|
||||
return response == null
|
||||
? null
|
||||
: (
|
||||
Event.fromJson(response["event"]),
|
||||
RoomMetadata.fromJson(response["room"]),
|
||||
);
|
||||
}
|
||||
|
||||
Future<dynamic> _sendCommand(
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import "package:m3e_buttons/m3e_buttons.dart";
|
|||
import "package:nexus/controllers/account_data.dart";
|
||||
import "package:nexus/controllers/client.dart";
|
||||
import "package:nexus/controllers/client_state.dart";
|
||||
import "package:nexus/controllers/init_complete.dart";
|
||||
import "package:nexus/controllers/notification.dart";
|
||||
import "package:nexus/controllers/settings.dart";
|
||||
import "package:nexus/controllers/unified_push.dart";
|
||||
|
|
@ -277,6 +278,7 @@ class SettingsSectionsController
|
|||
.read(UnifiedPushController.provider.notifier)
|
||||
.deregister()
|
||||
.onError(showError);
|
||||
container.invalidate(InitCompleteController.provider);
|
||||
await container
|
||||
.read(ClientController.provider.notifier)
|
||||
.logout()
|
||||
|
|
|
|||
|
|
@ -63,10 +63,14 @@ class UnifiedPushController extends AsyncNotifier<bool> {
|
|||
"Failed to decrypt notification. Try toggling off and on UnifiedPush in settings.",
|
||||
);
|
||||
}
|
||||
final (event, roomMetadata) = await ref
|
||||
final pushResponse = await ref
|
||||
.read(ClientController.provider.notifier)
|
||||
.handlePush(json.decode(String.fromCharCodes(message.content)));
|
||||
|
||||
if (pushResponse == null) return;
|
||||
|
||||
final (event, roomMetadata) = pushResponse;
|
||||
|
||||
if (event.unreadType?.shouldNotify() != true ||
|
||||
(!isInBackground &&
|
||||
await windowManager.isFocused().onError((_, _) => true) &&
|
||||
|
|
|
|||
Loading…
Reference in a new issue