догрузка сообщений в чатах при прокрутке вверх

This commit is contained in:
jganenok
2025-12-04 08:40:13 +07:00
parent 9fa633dafb
commit 6463a3b016
5 changed files with 285 additions and 94 deletions

View File

@@ -248,23 +248,17 @@ extension ApiServiceContacts on ApiService {
}
Future<int?> getChatIdByUserId(int userId) async {
// Используем формулу: chatId = userId1 ^ userId2
// где userId1 - наш ID, userId2 - ID собеседника
// ПИДОРИСТИЧЕСКАЯ ФОРМУЛА ОТ ДЕДА chatId = userId1 ^ userId2
if (_userId == null) {
print('⚠️ Не удалось вычислить chatId: наш userId не установлен');
return null;
}
final chatId = _userId! ^ userId;
print('✅ Вычислен chatId для диалога: наш userId=$_userId, собеседник userId=$userId, chatId=$chatId');
return chatId;
}
Future<List<Contact>> fetchContactsByIds(List<int> contactIds) async {
if (contactIds.isEmpty) {
print(
'⚠️ [fetchContactsByIds] Пустой список contactIds - пропускаем запрос',
);
return [];
}