Compare commits

..

No commits in common. "9fcc50fcc3b1bcb60ade91c44177b8d5e1751d1a" and "ee1638e1dda4437959fc7858dfce348fb455202f" have entirely different histories.

2 changed files with 6 additions and 27 deletions

View File

@ -10,8 +10,6 @@ class Mount with ChangeNotifier {
final MountConfig mountConfig;
final MountList? _mountList;
bool _isMounting = false;
bool _isRefreshing = false;
Mount(this.mountConfig, this._mountList, {isAdd = false}) {
if (isAdd) {
return;
@ -44,11 +42,8 @@ class Mount with ChangeNotifier {
return;
}
if (_isMounting) {
return;
}
mountConfig.updateSettings(jsonDecode(response.body));
notifyListeners();
} catch (e) {
debugPrint('$e');
@ -74,10 +69,6 @@ class Mount with ChangeNotifier {
return;
}
if (_isMounting) {
return;
}
mountConfig.updateStatus(jsonDecode(response.body));
notifyListeners();
} catch (e) {
@ -92,11 +83,6 @@ class Mount with ChangeNotifier {
mountConfig.mounted = null;
notifyListeners();
var count = 0;
while (_isRefreshing && count++ < 10) {
await Future.delayed(Duration(seconds: 1));
}
final response = await http.post(
Uri.parse(
Uri.encodeFull(
@ -126,20 +112,12 @@ class Mount with ChangeNotifier {
}
Future<void> refresh({bool force = false}) async {
if (!force && (_isMounting || _isRefreshing)) {
if (!force && _isMounting) {
return;
}
_isRefreshing = true;
try {
await _fetch();
await _fetchStatus();
} catch (e) {
debugPrint('$e');
}
_isRefreshing = false;
await _fetch();
return _fetchStatus();
}
Future<void> setValue(String key, String value) async {

View File

@ -102,6 +102,7 @@ class _MountWidgetState extends State<MountWidget> {
}
final success = await mount.mount(mount.mounted!, location: location);
if (success ||
mount.mounted! ||
constants.navigatorKey.currentContext == null ||
@ -110,7 +111,7 @@ class _MountWidgetState extends State<MountWidget> {
}
displayErrorMessage(context, "Mount location is not available");
cleanup();
return cleanup();
}
: null;
}