Remove async function for SessionStorageManager

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2025-07-16 10:42:49 +07:00
committed by Dat H. Pham
parent ee39f16102
commit 6f87058459
3 changed files with 12 additions and 12 deletions
@@ -7,11 +7,11 @@ class SessionStorageManager {
final html.Storage sessionStorage = html.window.sessionStorage;
Future<void> save(String key, String value) async {
return sessionStorage.addAll({key: value});
void save(String key, String value) {
sessionStorage.addAll({key: value});
}
Future<String> get(String key) async {
String get(String key) {
final entry = sessionStorage
.entries
.firstWhereOrNull((entry) => entry.key == key);
@@ -23,7 +23,7 @@ class SessionStorageManager {
}
}
Future<void> remove(String key) async {
void remove(String key) {
if (sessionStorage.containsKey(key)) {
sessionStorage.remove(key);
}
@@ -217,8 +217,8 @@ class EmailSessionStorageDatasourceImpl extends EmailDataSource {
@override
Future<void> storePreviewEMLContentToSessionStorage(EMLPreviewer emlPreviewer) {
return Future.sync(() async {
return await _sessionStorageManager.save(
return Future.sync(() {
return _sessionStorageManager.save(
emlPreviewer.id,
jsonEncode(emlPreviewer.toJson()),
);
@@ -232,8 +232,8 @@ class EmailSessionStorageDatasourceImpl extends EmailDataSource {
@override
Future<EMLPreviewer> getPreviewEMLContentInMemory(String keyStored) {
return Future.sync(() async {
final data = await _sessionStorageManager.get(keyStored);
return Future.sync(() {
final data = _sessionStorageManager.get(keyStored);
return EMLPreviewer.fromJson(jsonDecode(data));
}).catchError(_exceptionThrower.throwException);
}
@@ -140,8 +140,8 @@ class AuthenticationOIDCDataSourceImpl extends AuthenticationOIDCDataSource {
@override
Future<String> getAuthenticationInfo() {
return Future.sync(() async {
return await _sessionStorageManager.get(
return Future.sync(() {
return _sessionStorageManager.get(
OIDCConstant.authResponseKey,
);
}).catchError(_cacheExceptionThrower.throwException);
@@ -156,8 +156,8 @@ class AuthenticationOIDCDataSourceImpl extends AuthenticationOIDCDataSource {
@override
Future<void> removeAuthDestinationUrl() {
return Future.sync(() async {
return await _sessionStorageManager.remove(
return Future.sync(() {
return _sessionStorageManager.remove(
LoginConstants.AUTH_DESTINATION_KEY,
);
}).catchError(_cacheExceptionThrower.throwException);