mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-18 02:42:34 +01:00
fix: Unlock the mutex
This commit is contained in:
parent
5429697cff
commit
5789a86b2b
@ -94,6 +94,8 @@ class Store {
|
|||||||
return await secureStorage.read(key: key);
|
return await secureStorage.read(key: key);
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
return null;
|
return null;
|
||||||
|
} finally {
|
||||||
|
_mutex.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,8 +113,12 @@ class Store {
|
|||||||
await _setupLocalStorage();
|
await _setupLocalStorage();
|
||||||
return await storage.setItem(key, value);
|
return await storage.setItem(key, value);
|
||||||
}
|
}
|
||||||
await _mutex.lock();
|
try {
|
||||||
return await secureStorage.write(key: key, value: value);
|
await _mutex.lock();
|
||||||
|
return await secureStorage.write(key: key, value: value);
|
||||||
|
} finally {
|
||||||
|
_mutex.unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> setItemBool(String key, bool value) async {
|
Future<void> setItemBool(String key, bool value) async {
|
||||||
@ -124,7 +130,11 @@ class Store {
|
|||||||
await _setupLocalStorage();
|
await _setupLocalStorage();
|
||||||
return await storage.deleteItem(key);
|
return await storage.deleteItem(key);
|
||||||
}
|
}
|
||||||
await _mutex.lock();
|
try {
|
||||||
return await secureStorage.delete(key: key);
|
await _mutex.lock();
|
||||||
|
return await secureStorage.delete(key: key);
|
||||||
|
} finally {
|
||||||
|
_mutex.unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user