TF-1913 Fix thread view keeps reloading
(cherry picked from commit fc7ecd17f685b82bac98d808af450000e0f02c47)
This commit is contained in:
@@ -21,7 +21,7 @@ class StateDataSourceImpl extends StateDataSource {
|
||||
@override
|
||||
Future<State?> getState(AccountId accountId, UserName userName, StateType stateType) {
|
||||
return Future.sync(() async {
|
||||
final stateKey = TupleKey(stateType.value, accountId.asString, userName.value).encodeKey;
|
||||
final stateKey = TupleKey(stateType.name, accountId.asString, userName.value).encodeKey;
|
||||
final stateCache = await _stateCacheClient.getItem(stateKey);
|
||||
return stateCache?.toState();
|
||||
}).catchError(_exceptionThrower.throwException);
|
||||
@@ -31,7 +31,7 @@ class StateDataSourceImpl extends StateDataSource {
|
||||
Future<void> saveState(AccountId accountId, UserName userName, StateCache stateCache) {
|
||||
return Future.sync(() async {
|
||||
final stateCacheExist = await _stateCacheClient.isExistTable();
|
||||
final stateKey = TupleKey(stateCache.type.value, accountId.asString, userName.value).encodeKey;
|
||||
final stateKey = TupleKey(stateCache.type.name, accountId.asString, userName.value).encodeKey;
|
||||
if (stateCacheExist) {
|
||||
return await _stateCacheClient.updateItem(stateKey, stateCache);
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/user_name.dart';
|
||||
import 'package:model/extensions/account_id_extensions.dart';
|
||||
import 'package:tmail_ui_user/features/caching/utils/cache_utils.dart';
|
||||
import 'package:tmail_ui_user/features/caching/utils/caching_constants.dart';
|
||||
|
||||
part 'state_type.g.dart';
|
||||
@@ -11,16 +15,9 @@ enum StateType {
|
||||
mailbox,
|
||||
|
||||
@HiveField(1)
|
||||
email
|
||||
}
|
||||
email;
|
||||
|
||||
extension StateTypeExtension on StateType {
|
||||
String get value {
|
||||
switch(this) {
|
||||
case StateType.mailbox:
|
||||
return 'mailbox';
|
||||
case StateType.email:
|
||||
return 'email';
|
||||
}
|
||||
String getTupleKeyStored(AccountId accountId, UserName userName) {
|
||||
return TupleKey(name, accountId.asString, userName.value).encodeKey;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user