diff --git a/.github/workflows/build-ios.yml b/.github/workflows/build-ios.yml
index 29c898b..38db764 100644
--- a/.github/workflows/build-ios.yml
+++ b/.github/workflows/build-ios.yml
@@ -54,9 +54,7 @@ jobs:
- platform-application
get-task-allow
- com.apple.private.security.no-container
PLIST
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 2735665..4ab092f 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -5,6 +5,10 @@
+
+
+
+
{
- 'mt_instanceid': await DeviceIdentity.instanceId(),
+ 'mt_instanceid': instanceId,
'userAgent': _userAgent,
- 'clientSessionId': DeviceIdentity.clientSessionId,
+ 'clientSessionId': clientSessionId,
'deviceId': deviceId,
};
diff --git a/lib/backend/modules/messages.dart b/lib/backend/modules/messages.dart
index 6108dcb..e893153 100644
--- a/lib/backend/modules/messages.dart
+++ b/lib/backend/modules/messages.dart
@@ -5,6 +5,7 @@ import '../api.dart';
import '../../core/protocol/opcode_map.dart';
import '../../core/protocol/packet.dart';
import '../../core/storage/app_database.dart';
+import '../../core/utils/logger.dart';
import '../../models/attachment.dart';
import 'chats.dart' show ChatsModule;
@@ -24,7 +25,8 @@ class ContactCache {
static String? get(int id) => _nameCache[id];
static String? getAvatar(int id) => _avatarCache[id];
static Set? getOptions(int id) => _optionsCache[id];
- static bool isOfficial(int id) => _optionsCache[id]?.contains('OFFICIAL') ?? false;
+ static bool isOfficial(int id) =>
+ _optionsCache[id]?.contains('OFFICIAL') ?? false;
static void clear() {
_nameCache.clear();
@@ -81,13 +83,13 @@ class FileHistoryEntry {
});
Map toJson() => {
- 'fileId': fileId,
- if (url != null) 'url': url,
- if (token != null) 'token': token,
- if (filename != null) 'filename': filename,
- if (size != null) 'size': size,
- 'sentAt': sentAt.millisecondsSinceEpoch,
- };
+ 'fileId': fileId,
+ if (url != null) 'url': url,
+ if (token != null) 'token': token,
+ if (filename != null) 'filename': filename,
+ if (size != null) 'size': size,
+ 'sentAt': sentAt.millisecondsSinceEpoch,
+ };
static FileHistoryEntry? fromJson(Map j) {
final id = j['fileId'];
@@ -108,8 +110,9 @@ class FileHistoryCache {
static const _prefKey = 'file_history_v1';
static const _maxEntries = 50;
- static final ValueNotifier> notifier =
- ValueNotifier(const []);
+ static final ValueNotifier> notifier = ValueNotifier(
+ const [],
+ );
static List get history => notifier.value;
static bool get isEmpty => notifier.value.isEmpty;
@@ -135,7 +138,10 @@ class FileHistoryCache {
}
static void add(FileHistoryEntry entry) {
- final next = [entry, ...notifier.value.where((e) => e.fileId != entry.fileId)];
+ final next = [
+ entry,
+ ...notifier.value.where((e) => e.fileId != entry.fileId),
+ ];
if (next.length > _maxEntries) next.removeRange(_maxEntries, next.length);
notifier.value = next;
_persist();
@@ -223,15 +229,24 @@ class CachedMessage {
return CachedMessage(
id: row['id']?.toString() ?? '',
- accountId: row['account_id'] is int ? row['account_id'] as int : int.tryParse(row['account_id']?.toString() ?? '') ?? 0,
- chatId: row['chat_id'] is int ? row['chat_id'] as int : int.tryParse(row['chat_id']?.toString() ?? '') ?? 0,
- senderId: row['sender_id'] is int ? row['sender_id'] as int : int.tryParse(row['sender_id']?.toString() ?? '') ?? 0,
+ accountId: row['account_id'] is int
+ ? row['account_id'] as int
+ : int.tryParse(row['account_id']?.toString() ?? '') ?? 0,
+ chatId: row['chat_id'] is int
+ ? row['chat_id'] as int
+ : int.tryParse(row['chat_id']?.toString() ?? '') ?? 0,
+ senderId: row['sender_id'] is int
+ ? row['sender_id'] as int
+ : int.tryParse(row['sender_id']?.toString() ?? '') ?? 0,
text: row['text']?.toString(),
- time: row['time'] is int ? row['time'] as int : int.tryParse(row['time']?.toString() ?? '') ?? 0,
+ time: row['time'] is int
+ ? row['time'] as int
+ : int.tryParse(row['time']?.toString() ?? '') ?? 0,
status: row['status']?.toString(),
payload: payload,
attachments: attachments,
- isControl: attachments?.any((a) => a.type == AttachmentType.control) ?? false,
+ isControl:
+ attachments?.any((a) => a.type == AttachmentType.control) ?? false,
);
}
@@ -252,8 +267,7 @@ class CachedMessage {
if (attaches is List && attaches.isNotEmpty) {
attachments = attaches
.whereType