починил галочки, закрепленные чаты
This commit is contained in:
@@ -132,6 +132,7 @@ class ChatsModule {
|
||||
final chatsConfig = configMap['chats'] is Map
|
||||
? configMap['chats'] as Map
|
||||
: {};
|
||||
|
||||
// Presence for online statuses
|
||||
final presenceMap = data['presence'] is Map ? data['presence'] as Map : {};
|
||||
final cachedAt = DateTime.now().millisecondsSinceEpoch;
|
||||
@@ -272,6 +273,7 @@ class ChatsModule {
|
||||
dontDisturbUntil = (config['dontDisturbUntil'] as int?) ?? 0;
|
||||
}
|
||||
|
||||
|
||||
int seenTime = 0;
|
||||
bool isOnline = false;
|
||||
if (type == 'DIALOG' && otherId != null) {
|
||||
|
||||
@@ -29,7 +29,7 @@ class CachedContact {
|
||||
bool get isOfficial => options.contains('OFFICIAL');
|
||||
bool get isBot => options.contains('BOT');
|
||||
bool get isServiceAccount => options.contains('SERVICE_ACCOUNT');
|
||||
bool get isVerified => isOfficial || isBot || isServiceAccount;
|
||||
bool get isVerified => isOfficial;
|
||||
|
||||
factory CachedContact.fromDbRow(Map<String, dynamic> row) => CachedContact(
|
||||
id: row['id'] as int,
|
||||
|
||||
@@ -8,19 +8,19 @@ import '../../models/attachment.dart';
|
||||
class ContactCache {
|
||||
static final Map<int, String> _nameCache = {};
|
||||
static final Map<int, String> _avatarCache = {};
|
||||
static final Map<int, Set<String>> _optionsCache = {};
|
||||
|
||||
static void put(int id, String name) {
|
||||
_nameCache[id] = name;
|
||||
}
|
||||
static void put(int id, String name) => _nameCache[id] = name;
|
||||
|
||||
static void putAvatar(int id, String? baseUrl) {
|
||||
if (baseUrl != null) {
|
||||
_avatarCache[id] = baseUrl;
|
||||
}
|
||||
if (baseUrl != null) _avatarCache[id] = baseUrl;
|
||||
}
|
||||
|
||||
static void putOptions(int id, Set<String> opts) => _optionsCache[id] = opts;
|
||||
|
||||
static String? get(int id) => _nameCache[id];
|
||||
static String? getAvatar(int id) => _avatarCache[id];
|
||||
static bool isOfficial(int id) => _optionsCache[id]?.contains('OFFICIAL') ?? false;
|
||||
}
|
||||
|
||||
class TranscriptionResult {
|
||||
@@ -545,6 +545,11 @@ class MessagesModule {
|
||||
final baseUrl = contact['baseUrl'] as String?;
|
||||
ContactCache.putAvatar(contactId, baseUrl);
|
||||
|
||||
final rawOpts = contact['options'];
|
||||
if (rawOpts is List) {
|
||||
ContactCache.putOptions(contactId, rawOpts.whereType<String>().toSet());
|
||||
}
|
||||
|
||||
return fullName;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user