This commit is contained in:
2025-09-06 13:55:20 -05:00
parent a1cd963683
commit 1c759c2f7e
2 changed files with 19 additions and 8 deletions

View File

@@ -74,9 +74,8 @@ class Auth with ChangeNotifier {
_authenticated = false;
_key = SecureKey.random(constants.sodium, 32);
_user = "";
mountList?.clear(notify: false);
notifyListeners();
mountList?.clear();
}
}

View File

@@ -16,11 +16,7 @@ class MountList with ChangeNotifier {
MountList(this._auth) {
_auth.mountList = this;
_auth.addListener(() {
if (_auth.authenticated) {
_fetch();
}
});
_auth.addListener(_listener);
}
List<Mount> _mountList = [];
@@ -177,8 +173,12 @@ class MountList with ChangeNotifier {
return ret;
}
void clear() {
void clear({bool notify = true}) {
_mountList = [];
if (!notify) {
return;
}
notifyListeners();
}
@@ -198,4 +198,16 @@ class MountList with ChangeNotifier {
Future.delayed(Duration(seconds: 1), _fetch);
}
void _listener() {
if (_auth.authenticated) {
_fetch();
}
}
@override
void dispose() {
_auth.removeListener(_listener);
super.dispose();
}
}