fix
This commit is contained in:
@@ -74,9 +74,8 @@ class Auth with ChangeNotifier {
|
|||||||
_authenticated = false;
|
_authenticated = false;
|
||||||
_key = SecureKey.random(constants.sodium, 32);
|
_key = SecureKey.random(constants.sodium, 32);
|
||||||
_user = "";
|
_user = "";
|
||||||
|
mountList?.clear(notify: false);
|
||||||
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|
||||||
mountList?.clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,11 +16,7 @@ class MountList with ChangeNotifier {
|
|||||||
|
|
||||||
MountList(this._auth) {
|
MountList(this._auth) {
|
||||||
_auth.mountList = this;
|
_auth.mountList = this;
|
||||||
_auth.addListener(() {
|
_auth.addListener(_listener);
|
||||||
if (_auth.authenticated) {
|
|
||||||
_fetch();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Mount> _mountList = [];
|
List<Mount> _mountList = [];
|
||||||
@@ -177,8 +173,12 @@ class MountList with ChangeNotifier {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear() {
|
void clear({bool notify = true}) {
|
||||||
_mountList = [];
|
_mountList = [];
|
||||||
|
if (!notify) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,4 +198,16 @@ class MountList with ChangeNotifier {
|
|||||||
|
|
||||||
Future.delayed(Duration(seconds: 1), _fetch);
|
Future.delayed(Duration(seconds: 1), _fetch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _listener() {
|
||||||
|
if (_auth.authenticated) {
|
||||||
|
_fetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_auth.removeListener(_listener);
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user