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