🐛 Bug fixes

This commit is contained in:
2024-05-11 23:22:35 +08:00
parent 5ce6543275
commit 08d0a99b10
2 changed files with 27 additions and 32 deletions

View File

@ -32,22 +32,12 @@ class _NotificationNotifierState extends State<NotificationNotifier> {
final nty = context.read<NotifyProvider>();
if (await auth.isAuthorized()) {
if (auth.client == null) {
await auth.loadClient();
}
nty.fetch(auth);
nty.connect(auth).then((snapshot) {
snapshot!.stream.listen(
(event) {
final result = NetworkPackage.fromJson(jsonDecode(event));
switch (result.method) {
case 'notifications.new':
final result = model.Notification.fromJson(jsonDecode(event));
nty.onRemoteMessage(result);
nty.notifyMessage(result.subject, result.content);
}
},
onError: (_, __) => connect(),
onDone: () => connect(),
);
});
nty.connect(auth);
}
notify.close();