feat: работа с текстом

This commit is contained in:
Jganenokk
2026-07-26 12:32:38 +07:00
parent 6c084860b1
commit 310e1fdb4a
34 changed files with 2309 additions and 227 deletions
+6
View File
@@ -307,18 +307,22 @@ class ChatSearchHit {
class ChatMemberEntry {
final int id;
final String? name;
final String? fullName;
final String? avatarUrl;
final int? seenTime;
final int presenceStatus;
final bool blocked;
final bool isContact;
const ChatMemberEntry({
required this.id,
this.name,
this.fullName,
this.avatarUrl,
this.seenTime,
required this.presenceStatus,
this.blocked = false,
this.isContact = false,
});
bool get isOnline => presenceStatus == 1;
@@ -1865,10 +1869,12 @@ class ChatsModule {
ChatMemberEntry(
id: id,
name: name,
fullName: info.fullName,
avatarUrl: avatar,
seenTime: seen,
presenceStatus: status,
blocked: info.isDeleted,
isContact: info.isSavedContact,
),
);
}
+13 -4
View File
@@ -94,12 +94,21 @@ class AddContactResult {
class ContactsModule {
static final ValueNotifier<int> revision = ValueNotifier<int>(0);
static Future<PhoneLookupResult?> findByPhone(Api api, String phone) async {
static Future<PhoneLookupResult?> findByPhone(
Api api,
String phone, {
bool silent = false,
}) async {
final normalized = _normalizePhone(phone);
if (normalized == null) return null;
final packet = await api.sendRequest(Opcode.contactInfoByPhone, {
'phone': normalized,
});
final Packet packet;
try {
packet = await api.sendRequest(Opcode.contactInfoByPhone, {
'phone': normalized,
}, silent: silent);
} on PacketError {
return null;
}
if (packet.isError) return null;
final contact = (packet.payload as Map?)?['contact'];
if (contact is! Map) return null;
+3 -1
View File
@@ -31,7 +31,9 @@ abstract class LinkModule {
static Future<ResolvedLink?> resolve(Api api, String url) async {
final Packet response;
try {
response = await api.sendRequest(Opcode.linkInfo, {'link': url});
response = await api.sendRequest(Opcode.linkInfo, {
'link': url,
}, silent: true);
} on TimeoutException {
return const ResolvedLinkError('Превышено время ожидания');
} on PacketError catch (e) {