Кэширование ID пользователей из чатов (на 24 часа)
This commit is contained in:
@@ -283,10 +283,12 @@ class ChatMessageBubble extends StatelessWidget {
|
||||
if (originalSenderId != null && cache != null) {
|
||||
final originalSenderContact = cache[originalSenderId];
|
||||
forwardedSenderName =
|
||||
originalSenderContact?.name ?? 'Участник $originalSenderId';
|
||||
originalSenderContact?.name ?? 'ID $originalSenderId';
|
||||
forwardedSenderAvatarUrl ??= originalSenderContact?.photoBaseUrl;
|
||||
} else if (originalSenderId != null) {
|
||||
forwardedSenderName = 'ID $originalSenderId';
|
||||
} else {
|
||||
forwardedSenderName = 'Неизвестный';
|
||||
forwardedSenderName = 'Пользователь';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -613,8 +615,8 @@ class ChatMessageBubble extends StatelessWidget {
|
||||
child: Text(
|
||||
replySenderId != null
|
||||
? (contactDetailsCache?[replySenderId]?.name ??
|
||||
'Участник $replySenderId')
|
||||
: 'Неизвестный',
|
||||
'ID $replySenderId')
|
||||
: 'Пользователь',
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -1294,7 +1296,7 @@ class ChatMessageBubble extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 2.0, bottom: 2.0),
|
||||
child: Text(
|
||||
senderName ?? 'Неизвестный',
|
||||
senderName!,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: _getUserColor(
|
||||
@@ -3623,7 +3625,7 @@ class ChatMessageBubble extends StatelessWidget {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 2.0, bottom: 2.0),
|
||||
child: Text(
|
||||
senderName ?? 'Неизвестный',
|
||||
senderName!,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: _getUserColor(
|
||||
|
||||
@@ -26,7 +26,8 @@ class ControlMessageChip extends StatelessWidget {
|
||||
);
|
||||
|
||||
final eventType = controlAttach['event'];
|
||||
final senderName = contacts[message.senderId]?.name ?? 'Неизвестный';
|
||||
final senderName =
|
||||
contacts[message.senderId]?.name ?? 'ID ${message.senderId}';
|
||||
final isMe = message.senderId == myId;
|
||||
final senderDisplayName = isMe ? 'Вы' : senderName;
|
||||
|
||||
@@ -297,7 +298,14 @@ class MessagePreviewDialog {
|
||||
orElse: () => myId,
|
||||
);
|
||||
final contact = contacts[otherParticipantId];
|
||||
return contact?.name ?? "Неизвестный чат";
|
||||
|
||||
if (contact != null) {
|
||||
return contact.name;
|
||||
} else if (chat.title?.isNotEmpty == true) {
|
||||
return chat.title!;
|
||||
} else {
|
||||
return "ID $otherParticipantId";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -544,7 +552,8 @@ class MessagePreviewDialog {
|
||||
contacts[message.senderId];
|
||||
final senderName = isMe
|
||||
? 'Вы'
|
||||
: (senderContact?.name ?? 'Неизвестный');
|
||||
: (senderContact?.name ??
|
||||
'ID ${message.senderId}');
|
||||
|
||||
String? forwardedFrom;
|
||||
String? forwardedFromAvatarUrl;
|
||||
|
||||
@@ -23,7 +23,9 @@ class PinnedMessageWidget extends StatelessWidget {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
final senderName =
|
||||
contacts[pinnedMessage.senderId]?.name ??
|
||||
(pinnedMessage.senderId == myId ? 'Вы' : 'Неизвестный');
|
||||
(pinnedMessage.senderId == myId
|
||||
? 'Вы'
|
||||
: 'ID ${pinnedMessage.senderId}');
|
||||
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(left: 8, right: 8, top: 4, bottom: 0),
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gwid/services/avatar_cache_service.dart';
|
||||
|
||||
|
||||
|
||||
|
||||
class UserProfilePanel extends StatefulWidget {
|
||||
final int userId;
|
||||
final String? name;
|
||||
@@ -37,16 +34,16 @@ class UserProfilePanel extends StatefulWidget {
|
||||
class _UserProfilePanelState extends State<UserProfilePanel> {
|
||||
final ScrollController _nameScrollController = ScrollController();
|
||||
|
||||
|
||||
|
||||
String get _displayName {
|
||||
if (widget.firstName != null || widget.lastName != null) {
|
||||
final firstName = widget.firstName ?? '';
|
||||
final lastName = widget.lastName ?? '';
|
||||
final fullName = '$firstName $lastName'.trim();
|
||||
return fullName.isNotEmpty ? fullName : (widget.name ?? 'Неизвестный');
|
||||
return fullName.isNotEmpty
|
||||
? fullName
|
||||
: (widget.name ?? 'ID ${widget.userId}');
|
||||
}
|
||||
return widget.name ?? 'Неизвестный';
|
||||
return widget.name ?? 'ID ${widget.userId}';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -108,122 +105,6 @@ class _UserProfilePanelState extends State<UserProfilePanel> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
|
||||
Reference in New Issue
Block a user