Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
c2ebeffb76 |
|||
|
a90bf00f18 |
2 changed files with 25 additions and 2 deletions
|
|
@ -68,6 +68,8 @@ class NotificationController
|
|||
);
|
||||
}
|
||||
});
|
||||
|
||||
ref.onDispose(() => notificationChannel.setMethodCallHandler(null));
|
||||
}
|
||||
|
||||
return notifications;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import "dart:async";
|
||||
import "dart:convert";
|
||||
import "dart:io";
|
||||
|
||||
|
|
@ -78,10 +79,30 @@ class UnifiedPushController extends AsyncNotifier<bool> {
|
|||
return;
|
||||
}
|
||||
|
||||
final room = ref.read(
|
||||
RoomsController.provider.select((rooms) => rooms[event.roomId]),
|
||||
final provider = RoomsController.provider.select(
|
||||
(rooms) => rooms[event.roomId],
|
||||
);
|
||||
|
||||
if (ref.read(provider)?.metadata != null) return;
|
||||
|
||||
final completer = Completer<void>();
|
||||
|
||||
final subscription = ref.listen(provider, (previous, next) {
|
||||
if (next?.metadata != null && !completer.isCompleted) {
|
||||
completer.complete();
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
await completer.future.timeout(const .new(seconds: 10));
|
||||
} on TimeoutException {
|
||||
// metadata didn't show up in time
|
||||
} finally {
|
||||
subscription.close();
|
||||
}
|
||||
|
||||
final room = ref.read(provider);
|
||||
|
||||
final avatar = room?.metadata?.avatar;
|
||||
final icon = avatar == null
|
||||
? null
|
||||
|
|
|
|||
Loading…
Reference in a new issue