Fix person controller not responding to provider change in pref

This commit is contained in:
Ming Ming 2023-12-14 00:50:00 +08:00
parent f848f612ea
commit 0af86944d0

View file

@ -32,9 +32,17 @@ class PersonsController {
this._c, {
required this.account,
required this.accountPrefController,
});
}) {
_subscriptions
.add(accountPrefController.personProvider.distinct().listen((event) {
reload();
}));
}
void dispose() {
for (final s in _subscriptions) {
s.cancel();
}
_personStreamContorller.close();
}
@ -83,6 +91,8 @@ class PersonsController {
final Account account;
final AccountPrefController accountPrefController;
final _subscriptions = <StreamSubscription>[];
var _isPersonStreamInited = false;
final _personStreamContorller = BehaviorSubject.seeded(
const PersonStreamEvent(data: [], hasNext: true),