патч
This commit is contained in:
@@ -352,7 +352,9 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||||||
contactProfile['id'] != null &&
|
contactProfile['id'] != null &&
|
||||||
contactProfile['id'] != 0) {
|
contactProfile['id'] != 0) {
|
||||||
_actualMyId = contactProfile['id'];
|
_actualMyId = contactProfile['id'];
|
||||||
print('✅ ID пользователя успешно получен из ApiService: $_actualMyId');
|
print(
|
||||||
|
'✅ [_initializeChat] ID пользователя получен из ApiService: $_actualMyId',
|
||||||
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final myContact = Contact.fromJson(contactProfile);
|
final myContact = Contact.fromJson(contactProfile);
|
||||||
@@ -365,9 +367,13 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||||||
'⚠️ [_initializeChat] Не удалось добавить собственный профиль в кэш: $e',
|
'⚠️ [_initializeChat] Не удалось добавить собственный профиль в кэш: $e',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (_actualMyId == null) {
|
||||||
_actualMyId = widget.myId;
|
_actualMyId = widget.myId;
|
||||||
print('ПРЕДУПРЕЖДЕНИЕ: Используется ID из виджета: $_actualMyId');
|
print(
|
||||||
|
'⚠️ [_initializeChat] ID не найден, используется из виджета: $_actualMyId',
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
print('✅ [_initializeChat] Используется ID из кэша: $_actualMyId');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!widget.isGroupChat && !widget.isChannel) {
|
if (!widget.isGroupChat && !widget.isChannel) {
|
||||||
@@ -1810,6 +1816,13 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||||||
if (chatContacts != null && chatContacts.isNotEmpty) {
|
if (chatContacts != null && chatContacts.isNotEmpty) {
|
||||||
for (final contact in chatContacts) {
|
for (final contact in chatContacts) {
|
||||||
_contactDetailsCache[contact.id] = contact;
|
_contactDetailsCache[contact.id] = contact;
|
||||||
|
|
||||||
|
if (contact.id == widget.myId && _actualMyId == null) {
|
||||||
|
_actualMyId = contact.id;
|
||||||
|
print(
|
||||||
|
'✅ [_loadCachedContacts] Собственный ID восстановлен из кэша: $_actualMyId (${contact.name})',
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print(
|
print(
|
||||||
'✅ Загружено ${_contactDetailsCache.length} контактов из кэша чата ${widget.chatId}',
|
'✅ Загружено ${_contactDetailsCache.length} контактов из кэша чата ${widget.chatId}',
|
||||||
@@ -1822,6 +1835,13 @@ class _ChatScreenState extends State<ChatScreen> {
|
|||||||
if (cachedContacts != null && cachedContacts.isNotEmpty) {
|
if (cachedContacts != null && cachedContacts.isNotEmpty) {
|
||||||
for (final contact in cachedContacts) {
|
for (final contact in cachedContacts) {
|
||||||
_contactDetailsCache[contact.id] = contact;
|
_contactDetailsCache[contact.id] = contact;
|
||||||
|
|
||||||
|
if (contact.id == widget.myId && _actualMyId == null) {
|
||||||
|
_actualMyId = contact.id;
|
||||||
|
print(
|
||||||
|
'✅ [_loadCachedContacts] Собственный ID восстановлен из глобального кэша: $_actualMyId (${contact.name})',
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print(
|
print(
|
||||||
'✅ Загружено ${_contactDetailsCache.length} контактов из глобального кэша',
|
'✅ Загружено ${_contactDetailsCache.length} контактов из глобального кэша',
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
|
|
||||||
|
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
import 'package:msgpack_dart/msgpack_dart.dart';
|
import 'package:msgpack_dart/msgpack_dart.dart';
|
||||||
import 'package:es_compression/lz4.dart';
|
import 'package:es_compression/lz4.dart';
|
||||||
|
|
||||||
final lz4Codec = Lz4Codec();
|
final lz4Codec = Lz4Codec();
|
||||||
|
|
||||||
|
|
||||||
Uint8List packPacket({
|
Uint8List packPacket({
|
||||||
required int ver,
|
required int ver,
|
||||||
required int cmd,
|
required int cmd,
|
||||||
@@ -49,7 +46,6 @@ Uint8List packPacket({
|
|||||||
return builder.toBytes();
|
return builder.toBytes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Map<String, dynamic>? unpackPacket(Uint8List data) {
|
Map<String, dynamic>? unpackPacket(Uint8List data) {
|
||||||
if (data.length < 10) {
|
if (data.length < 10) {
|
||||||
print("Ошибка распаковки: Пакет слишком короткий для заголовка.");
|
print("Ошибка распаковки: Пакет слишком короткий для заголовка.");
|
||||||
@@ -83,8 +79,6 @@ Map<String, dynamic>? unpackPacket(Uint8List data) {
|
|||||||
try {
|
try {
|
||||||
final compressedData = payloadBytes.sublist(4);
|
final compressedData = payloadBytes.sublist(4);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
payloadBytes = Uint8List.fromList(lz4Codec.decode(compressedData));
|
payloadBytes = Uint8List.fromList(lz4Codec.decode(compressedData));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print("Ошибка распаковки LZ4: $e");
|
print("Ошибка распаковки LZ4: $e");
|
||||||
|
|||||||
12
pubspec.lock
12
pubspec.lock
@@ -253,10 +253,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: es_compression
|
name: es_compression
|
||||||
sha256: "174d2cee4e182d1a8df92712eaa6ee56a0adf83d4b8a14838c66380caa4e65a7"
|
sha256: c1ff7af54802631cf5c3942cb67bb99daadcc087f573ca99a9de91002d1a7ece
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.14"
|
version: "2.0.15"
|
||||||
fake_async:
|
fake_async:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -809,10 +809,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: meta
|
name: meta
|
||||||
sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
|
sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.17.0"
|
version: "1.16.0"
|
||||||
mime:
|
mime:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -1318,10 +1318,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_api
|
name: test_api
|
||||||
sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55
|
sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.7"
|
version: "0.7.6"
|
||||||
timezone:
|
timezone:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|||||||
Reference in New Issue
Block a user