TF-3769 Enable toggle thread detail feature in setting
TF-3769 Thread Detail fallback to single email when get thread fails TF-3769 Thread Detail fix font height thread TF-3769 Thread Detail init with get status TF-3769 Thread Detail fix font height email receiver and sender TF-3769 Thread Detail refactor reset thread detail ui action UpdatedThreadDetailSettingAction TF-3769 Thread Detail refresh settings on app lifecycle changed TF-3769 Thread Detail fix font height email receiver and sender TF-3769 Thread Detail fix scroll view exception of single email TF-3769 Thread Detail refactor local setting TF-3769 Thread Detail optimize get cache setting TF-3769 Thread Detail fix font height email receiver TF-3769 Thread Detail refactor local setting cache TF-3769 Thread Detail fix font height email receiver and sender TF-3769 Thread Detail use CacheExceptionThrower for ManageAccountDataSourceImpl TF-3769 Thread Detail fix changing email in tablet view TF-3769 Thread Detail refresh on setting changed TF-3769 Thread Detail fix receiver alignments TF-3769 Thread Detail fix receiver alignments TF-3769 Thread Detail default setting enabled TF-3769 Thread Detail fix font style email receiver and sender TF-3769 Thread Detail fix toggle setting when responsive TF-3769 Thread Detail adjust receive time position when single email TF-3769 Thread Detail revert initializeThreadDetailEmails to void TF-3769 Thread Detail fix CI on initializeThreadDetailEmails test TF-3769 Thread Detail fix spacing email sender TF-3769 Thread Detail update receiver color mobile TF-3769 Thread Detail update collapsed preview letter spacing TF-3769 Thread Detail update receiver color mobile TF-3769 Thread Detail fix receive time position TF-3769 Thread Detail add mark read button mobile collapsed email TF-3769 Thread Detail fix font style email receiver and sender TF-3769 Thread Detail update collapsed preview font weight TF-3769 Thread Detail fix position email receiver and sender
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/local_setting_options.dart';
|
||||
|
||||
abstract class ManageAccountDataSource {
|
||||
Future<void> persistLanguage(Locale localeCurrent);
|
||||
|
||||
Future<void> updateLocalSettings(
|
||||
Map<SupportedLocalSetting, LocalSettingOptions?> localSettings,
|
||||
);
|
||||
|
||||
Future<Map<SupportedLocalSetting, LocalSettingOptions?>> getLocalSettings(
|
||||
List<SupportedLocalSetting> supportedLocalSettings,
|
||||
);
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import 'dart:ui';
|
||||
|
||||
abstract class PreferencesDataSource {
|
||||
Future<void> persistLanguage(Locale localeCurrent);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:tmail_ui_user/features/manage_account/data/datasource/manage_account_datasource.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/data/local/language_cache_manager.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/data/local/local_setting_cache_manager.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/local_setting_options.dart';
|
||||
import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart';
|
||||
|
||||
class ManageAccountDataSourceImpl extends ManageAccountDataSource {
|
||||
|
||||
final LanguageCacheManager _languageCacheManager;
|
||||
final LocalSettingCacheManager _localSettingCacheManager;
|
||||
final ExceptionThrower _exceptionThrower;
|
||||
|
||||
ManageAccountDataSourceImpl(
|
||||
this._languageCacheManager,
|
||||
this._localSettingCacheManager,
|
||||
this._exceptionThrower
|
||||
);
|
||||
|
||||
@override
|
||||
Future<void> persistLanguage(Locale localeCurrent) {
|
||||
return Future.sync(() async {
|
||||
return await _languageCacheManager.persistLanguage(localeCurrent);
|
||||
}).catchError(_exceptionThrower.throwException);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> updateLocalSettings(
|
||||
Map<SupportedLocalSetting, LocalSettingOptions?> localSettings,
|
||||
) {
|
||||
return Future.sync(() async {
|
||||
return await _localSettingCacheManager.update(localSettings);
|
||||
}).catchError(_exceptionThrower.throwException);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<SupportedLocalSetting, LocalSettingOptions?>> getLocalSettings(
|
||||
List<SupportedLocalSetting> supportedLocalSettings,
|
||||
) {
|
||||
return Future.sync(() async {
|
||||
return await _localSettingCacheManager.get(supportedLocalSettings);
|
||||
}).catchError(_exceptionThrower.throwException);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:tmail_ui_user/features/manage_account/data/datasource/preferences_datasource.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/data/local/language_cache_manager.dart';
|
||||
import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart';
|
||||
|
||||
class PreferencesDataSourceImpl extends PreferencesDataSource {
|
||||
|
||||
final LanguageCacheManager _languageCacheManager;
|
||||
final ExceptionThrower _exceptionThrower;
|
||||
|
||||
PreferencesDataSourceImpl(
|
||||
this._languageCacheManager,
|
||||
this._exceptionThrower
|
||||
);
|
||||
|
||||
@override
|
||||
Future<void> persistLanguage(Locale localeCurrent) {
|
||||
return Future.sync(() async {
|
||||
return await _languageCacheManager.persistLanguage(localeCurrent);
|
||||
}).catchError(_exceptionThrower.throwException);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/local_setting_options.dart';
|
||||
|
||||
class LocalSettingCacheManager {
|
||||
const LocalSettingCacheManager(this._sharedPreferences);
|
||||
|
||||
final SharedPreferences _sharedPreferences;
|
||||
|
||||
Future<void> update(
|
||||
Map<SupportedLocalSetting, LocalSettingOptions?> localSettings,
|
||||
) async {
|
||||
await Future.wait(localSettings.entries.map((entry) async {
|
||||
if (entry.value == null) {
|
||||
await _sharedPreferences.remove(entry.key.name);
|
||||
return;
|
||||
}
|
||||
|
||||
await _sharedPreferences.setString(
|
||||
entry.key.name,
|
||||
jsonEncode(entry.value!.toJson()),
|
||||
);
|
||||
}));
|
||||
}
|
||||
|
||||
Future<Map<SupportedLocalSetting, LocalSettingOptions?>> get(
|
||||
List<SupportedLocalSetting> supportedLocalSettings,
|
||||
) async {
|
||||
await _sharedPreferences.reload();
|
||||
|
||||
return Map.fromEntries(supportedLocalSettings.map((supportedLocalSetting) {
|
||||
final data = _sharedPreferences.getString(supportedLocalSetting.name);
|
||||
|
||||
return MapEntry(
|
||||
supportedLocalSetting,
|
||||
data == null ? null : LocalSettingOptions.fromJson(jsonDecode(data)),
|
||||
);
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:tmail_ui_user/features/manage_account/data/datasource/manage_account_datasource.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/repository/manage_account_repository.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/local_setting_options.dart';
|
||||
|
||||
class ManageAccountRepositoryImpl extends ManageAccountRepository {
|
||||
|
||||
final ManageAccountDataSource dataSource;
|
||||
|
||||
ManageAccountRepositoryImpl(this.dataSource);
|
||||
|
||||
@override
|
||||
Future<void> persistLanguage(Locale localeCurrent) {
|
||||
return dataSource.persistLanguage(localeCurrent);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> updateLocalSettings(
|
||||
Map<SupportedLocalSetting, LocalSettingOptions?> localSettings,
|
||||
) {
|
||||
return dataSource.updateLocalSettings(localSettings);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<SupportedLocalSetting, LocalSettingOptions?>> getLocalSettings(
|
||||
List<SupportedLocalSetting> supportedLocalSettings,
|
||||
) {
|
||||
return dataSource.getLocalSettings(supportedLocalSettings);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:tmail_ui_user/features/manage_account/data/datasource/preferences_datasource.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/repository/preferences_repository.dart';
|
||||
|
||||
class PreferencesRepositoryImpl extends PreferencesRepository {
|
||||
|
||||
final PreferencesDataSource dataSource;
|
||||
|
||||
PreferencesRepositoryImpl(this.dataSource);
|
||||
|
||||
@override
|
||||
Future<void> persistLanguage(Locale localeCurrent) {
|
||||
return dataSource.persistLanguage(localeCurrent);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user