fixing avatar icon

This commit is contained in:
otsmr 2025-11-03 11:22:22 +01:00
parent 562d9cbb74
commit 48de7faaa2
30 changed files with 263 additions and 95 deletions

View file

@ -215,10 +215,10 @@ func getPushNotificationText(pushNotification: PushNotification) -> (String, Str
if systemLanguage.contains("de") { // German if systemLanguage.contains("de") { // German
title = "Jemand" title = "Jemand"
pushNotificationText = [ pushNotificationText = [
.text: "hat eine Nachricht gesendet.", .text: "hat eine Nachricht{inGroup} gesendet.",
.twonly: "hat ein twonly gesendet.", .twonly: "hat ein twonly{inGroup} gesendet.",
.video: "hat ein Video gesendet.", .video: "hat ein Video{inGroup} gesendet.",
.image: "hat ein Bild gesendet.", .image: "hat ein Bild{inGroup} gesendet.",
.contactRequest: "möchte sich mit dir vernetzen.", .contactRequest: "möchte sich mit dir vernetzen.",
.acceptRequest: "ist jetzt mit dir vernetzt.", .acceptRequest: "ist jetzt mit dir vernetzt.",
.storedMediaFile: "hat dein Bild gespeichert.", .storedMediaFile: "hat dein Bild gespeichert.",
@ -228,15 +228,15 @@ func getPushNotificationText(pushNotification: PushNotification) -> (String, Str
.reactionToVideo: "hat mit {{content}} auf dein Video reagiert.", .reactionToVideo: "hat mit {{content}} auf dein Video reagiert.",
.reactionToText: "hat mit {{content}} auf deinen Text reagiert.", .reactionToText: "hat mit {{content}} auf deinen Text reagiert.",
.reactionToImage: "hat mit {{content}} auf dein Bild reagiert.", .reactionToImage: "hat mit {{content}} auf dein Bild reagiert.",
.response: "hat dir geantwortet.", .response: "hat dir{inGroup} geantwortet.",
.addedToGroup: "hat dich zu \"{{content}}\" hinzugefügt." .addedToGroup: "hat dich zu \"{{content}}\" hinzugefügt."
] ]
} else { // Default to English } else { // Default to English
pushNotificationText = [ pushNotificationText = [
.text: "has sent you a message.", .text: "sent a message{inGroup}.",
.twonly: "has sent you a twonly.", .twonly: "sent a twonly{inGroup}.",
.video: "has sent you a video.", .video: "sent a video{inGroup}.",
.image: "has sent you an image.", .image: "sent a image{inGroup}.",
.contactRequest: "wants to connect with you.", .contactRequest: "wants to connect with you.",
.acceptRequest: "is now connected with you.", .acceptRequest: "is now connected with you.",
.storedMediaFile: "has stored your image.", .storedMediaFile: "has stored your image.",
@ -246,7 +246,7 @@ func getPushNotificationText(pushNotification: PushNotification) -> (String, Str
.reactionToVideo: "has reacted with {{content}} to your video.", .reactionToVideo: "has reacted with {{content}} to your video.",
.reactionToText: "has reacted with {{content}} to your text.", .reactionToText: "has reacted with {{content}} to your text.",
.reactionToImage: "has reacted with {{content}} to your image.", .reactionToImage: "has reacted with {{content}} to your image.",
.response: "has responded.", .response: "has responded{inGroup}.",
.addedToGroup: "has added you to \"{{content}}\"" .addedToGroup: "has added you to \"{{content}}\""
] ]
} }
@ -255,6 +255,8 @@ func getPushNotificationText(pushNotification: PushNotification) -> (String, Str
if pushNotification.hasAdditionalContent { if pushNotification.hasAdditionalContent {
content.replace("{{content}}", with: pushNotification.additionalContent) content.replace("{{content}}", with: pushNotification.additionalContent)
content.replace("{inGroup}", with: " in {inGroup}")
content.replace("{inGroup}", with: pushNotification.additionalContent)
} }
// Return the corresponding message or an empty string if not found // Return the corresponding message or an empty string if not found

View file

@ -1,3 +1,5 @@
import 'dart:ui';
import 'package:camera/camera.dart'; import 'package:camera/camera.dart';
import 'package:twonly/src/database/twonly.db.dart'; import 'package:twonly/src/database/twonly.db.dart';
import 'package:twonly/src/model/json/userdata.dart'; import 'package:twonly/src/model/json/userdata.dart';
@ -26,4 +28,6 @@ void Function() globalCallbackAppIsOutdated = () {};
void Function() globalCallbackNewDeviceRegistered = () {}; void Function() globalCallbackNewDeviceRegistered = () {};
void Function(String planId) globalCallbackUpdatePlan = (String planId) {}; void Function(String planId) globalCallbackUpdatePlan = (String planId) {};
Map<String, VoidCallback> globalUserDataChangedCallBack = {};
bool globalIsAppInBackground = true; bool globalIsAppInBackground = true;

View file

@ -20,6 +20,7 @@ import 'package:twonly/src/services/api/mediafiles/media_background.service.dart
import 'package:twonly/src/services/api/mediafiles/upload.service.dart'; import 'package:twonly/src/services/api/mediafiles/upload.service.dart';
import 'package:twonly/src/services/fcm.service.dart'; import 'package:twonly/src/services/fcm.service.dart';
import 'package:twonly/src/services/mediafiles/mediafile.service.dart'; import 'package:twonly/src/services/mediafiles/mediafile.service.dart';
import 'package:twonly/src/services/notifications/setup.notifications.dart';
import 'package:twonly/src/utils/log.dart'; import 'package:twonly/src/utils/log.dart';
import 'package:twonly/src/utils/storage.dart'; import 'package:twonly/src/utils/storage.dart';
@ -59,6 +60,7 @@ void main() async {
unawaited(finishStartedPreprocessing()); unawaited(finishStartedPreprocessing());
unawaited(MediaFileService.purgeTempFolder()); unawaited(MediaFileService.purgeTempFolder());
unawaited(createPushAvatars());
await twonlyDB.messagesDao.purgeMessageTable(); await twonlyDB.messagesDao.purgeMessageTable();
// await twonlyDB.messagesDao.resetPendingDownloadState(); // await twonlyDB.messagesDao.resetPendingDownloadState();

View file

@ -129,8 +129,10 @@ class GroupsDao extends DatabaseAccessor<TwonlyDB> with _$GroupsDaoMixin {
leftOuterJoin( leftOuterJoin(
groupMembers, groupMembers,
groupMembers.contactId.equalsExp(contacts.userId), groupMembers.contactId.equalsExp(contacts.userId),
useColumns: false,
), ),
]) ])
..orderBy([OrderingTerm.desc(groupMembers.lastMessage)])
..where(groupMembers.groupId.equals(groupId))); ..where(groupMembers.groupId.equals(groupId)));
return query.map((row) => row.readTable(contacts)).get(); return query.map((row) => row.readTable(contacts)).get();
} }
@ -140,8 +142,10 @@ class GroupsDao extends DatabaseAccessor<TwonlyDB> with _$GroupsDaoMixin {
leftOuterJoin( leftOuterJoin(
groupMembers, groupMembers,
groupMembers.contactId.equalsExp(contacts.userId), groupMembers.contactId.equalsExp(contacts.userId),
useColumns: false,
), ),
]) ])
..orderBy([OrderingTerm.desc(groupMembers.lastMessage)])
..where(groupMembers.groupId.equals(groupId))); ..where(groupMembers.groupId.equals(groupId)));
return query.map((row) => row.readTable(contacts)).watch(); return query.map((row) => row.readTable(contacts)).watch();
} }

View file

@ -381,6 +381,16 @@ class MessagesDao extends DatabaseAccessor<TwonlyDB> with _$MessagesDaoMixin {
), ),
); );
if (message.senderId.present) {
await twonlyDB.groupsDao.updateMember(
message.groupId.value,
message.senderId.value!,
GroupMembersCompanion(
lastMessage: Value(DateTime.now()),
),
);
}
return await (select(messages)..where((t) => t.rowId.equals(rowId))) return await (select(messages)..where((t) => t.rowId.equals(rowId)))
.getSingle(); .getSingle();
} catch (e) { } catch (e) {

View file

@ -60,6 +60,7 @@ class GroupMembers extends Table {
TextColumn get memberState => textEnum<MemberState>().nullable()(); TextColumn get memberState => textEnum<MemberState>().nullable()();
BlobColumn get groupPublicKey => blob().nullable()(); BlobColumn get groupPublicKey => blob().nullable()();
DateTimeColumn get lastMessage => dateTime().nullable()();
DateTimeColumn get createdAt => dateTime().withDefault(currentDateAndTime)(); DateTimeColumn get createdAt => dateTime().withDefault(currentDateAndTime)();
@override @override

View file

@ -3987,6 +3987,12 @@ class $GroupMembersTable extends GroupMembers
late final GeneratedColumn<Uint8List> groupPublicKey = late final GeneratedColumn<Uint8List> groupPublicKey =
GeneratedColumn<Uint8List>('group_public_key', aliasedName, true, GeneratedColumn<Uint8List>('group_public_key', aliasedName, true,
type: DriftSqlType.blob, requiredDuringInsert: false); type: DriftSqlType.blob, requiredDuringInsert: false);
static const VerificationMeta _lastMessageMeta =
const VerificationMeta('lastMessage');
@override
late final GeneratedColumn<DateTime> lastMessage = GeneratedColumn<DateTime>(
'last_message', aliasedName, true,
type: DriftSqlType.dateTime, requiredDuringInsert: false);
static const VerificationMeta _createdAtMeta = static const VerificationMeta _createdAtMeta =
const VerificationMeta('createdAt'); const VerificationMeta('createdAt');
@override @override
@ -3997,7 +4003,7 @@ class $GroupMembersTable extends GroupMembers
defaultValue: currentDateAndTime); defaultValue: currentDateAndTime);
@override @override
List<GeneratedColumn> get $columns => List<GeneratedColumn> get $columns =>
[groupId, contactId, memberState, groupPublicKey, createdAt]; [groupId, contactId, memberState, groupPublicKey, lastMessage, createdAt];
@override @override
String get aliasedName => _alias ?? actualTableName; String get aliasedName => _alias ?? actualTableName;
@override @override
@ -4026,6 +4032,12 @@ class $GroupMembersTable extends GroupMembers
groupPublicKey.isAcceptableOrUnknown( groupPublicKey.isAcceptableOrUnknown(
data['group_public_key']!, _groupPublicKeyMeta)); data['group_public_key']!, _groupPublicKeyMeta));
} }
if (data.containsKey('last_message')) {
context.handle(
_lastMessageMeta,
lastMessage.isAcceptableOrUnknown(
data['last_message']!, _lastMessageMeta));
}
if (data.containsKey('created_at')) { if (data.containsKey('created_at')) {
context.handle(_createdAtMeta, context.handle(_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta));
@ -4048,6 +4060,8 @@ class $GroupMembersTable extends GroupMembers
DriftSqlType.string, data['${effectivePrefix}member_state'])), DriftSqlType.string, data['${effectivePrefix}member_state'])),
groupPublicKey: attachedDatabase.typeMapping groupPublicKey: attachedDatabase.typeMapping
.read(DriftSqlType.blob, data['${effectivePrefix}group_public_key']), .read(DriftSqlType.blob, data['${effectivePrefix}group_public_key']),
lastMessage: attachedDatabase.typeMapping
.read(DriftSqlType.dateTime, data['${effectivePrefix}last_message']),
createdAt: attachedDatabase.typeMapping createdAt: attachedDatabase.typeMapping
.read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!,
); );
@ -4070,12 +4084,14 @@ class GroupMember extends DataClass implements Insertable<GroupMember> {
final int contactId; final int contactId;
final MemberState? memberState; final MemberState? memberState;
final Uint8List? groupPublicKey; final Uint8List? groupPublicKey;
final DateTime? lastMessage;
final DateTime createdAt; final DateTime createdAt;
const GroupMember( const GroupMember(
{required this.groupId, {required this.groupId,
required this.contactId, required this.contactId,
this.memberState, this.memberState,
this.groupPublicKey, this.groupPublicKey,
this.lastMessage,
required this.createdAt}); required this.createdAt});
@override @override
Map<String, Expression> toColumns(bool nullToAbsent) { Map<String, Expression> toColumns(bool nullToAbsent) {
@ -4089,6 +4105,9 @@ class GroupMember extends DataClass implements Insertable<GroupMember> {
if (!nullToAbsent || groupPublicKey != null) { if (!nullToAbsent || groupPublicKey != null) {
map['group_public_key'] = Variable<Uint8List>(groupPublicKey); map['group_public_key'] = Variable<Uint8List>(groupPublicKey);
} }
if (!nullToAbsent || lastMessage != null) {
map['last_message'] = Variable<DateTime>(lastMessage);
}
map['created_at'] = Variable<DateTime>(createdAt); map['created_at'] = Variable<DateTime>(createdAt);
return map; return map;
} }
@ -4103,6 +4122,9 @@ class GroupMember extends DataClass implements Insertable<GroupMember> {
groupPublicKey: groupPublicKey == null && nullToAbsent groupPublicKey: groupPublicKey == null && nullToAbsent
? const Value.absent() ? const Value.absent()
: Value(groupPublicKey), : Value(groupPublicKey),
lastMessage: lastMessage == null && nullToAbsent
? const Value.absent()
: Value(lastMessage),
createdAt: Value(createdAt), createdAt: Value(createdAt),
); );
} }
@ -4116,6 +4138,7 @@ class GroupMember extends DataClass implements Insertable<GroupMember> {
memberState: $GroupMembersTable.$convertermemberStaten memberState: $GroupMembersTable.$convertermemberStaten
.fromJson(serializer.fromJson<String?>(json['memberState'])), .fromJson(serializer.fromJson<String?>(json['memberState'])),
groupPublicKey: serializer.fromJson<Uint8List?>(json['groupPublicKey']), groupPublicKey: serializer.fromJson<Uint8List?>(json['groupPublicKey']),
lastMessage: serializer.fromJson<DateTime?>(json['lastMessage']),
createdAt: serializer.fromJson<DateTime>(json['createdAt']), createdAt: serializer.fromJson<DateTime>(json['createdAt']),
); );
} }
@ -4128,6 +4151,7 @@ class GroupMember extends DataClass implements Insertable<GroupMember> {
'memberState': serializer.toJson<String?>( 'memberState': serializer.toJson<String?>(
$GroupMembersTable.$convertermemberStaten.toJson(memberState)), $GroupMembersTable.$convertermemberStaten.toJson(memberState)),
'groupPublicKey': serializer.toJson<Uint8List?>(groupPublicKey), 'groupPublicKey': serializer.toJson<Uint8List?>(groupPublicKey),
'lastMessage': serializer.toJson<DateTime?>(lastMessage),
'createdAt': serializer.toJson<DateTime>(createdAt), 'createdAt': serializer.toJson<DateTime>(createdAt),
}; };
} }
@ -4137,6 +4161,7 @@ class GroupMember extends DataClass implements Insertable<GroupMember> {
int? contactId, int? contactId,
Value<MemberState?> memberState = const Value.absent(), Value<MemberState?> memberState = const Value.absent(),
Value<Uint8List?> groupPublicKey = const Value.absent(), Value<Uint8List?> groupPublicKey = const Value.absent(),
Value<DateTime?> lastMessage = const Value.absent(),
DateTime? createdAt}) => DateTime? createdAt}) =>
GroupMember( GroupMember(
groupId: groupId ?? this.groupId, groupId: groupId ?? this.groupId,
@ -4144,6 +4169,7 @@ class GroupMember extends DataClass implements Insertable<GroupMember> {
memberState: memberState.present ? memberState.value : this.memberState, memberState: memberState.present ? memberState.value : this.memberState,
groupPublicKey: groupPublicKey:
groupPublicKey.present ? groupPublicKey.value : this.groupPublicKey, groupPublicKey.present ? groupPublicKey.value : this.groupPublicKey,
lastMessage: lastMessage.present ? lastMessage.value : this.lastMessage,
createdAt: createdAt ?? this.createdAt, createdAt: createdAt ?? this.createdAt,
); );
GroupMember copyWithCompanion(GroupMembersCompanion data) { GroupMember copyWithCompanion(GroupMembersCompanion data) {
@ -4155,6 +4181,8 @@ class GroupMember extends DataClass implements Insertable<GroupMember> {
groupPublicKey: data.groupPublicKey.present groupPublicKey: data.groupPublicKey.present
? data.groupPublicKey.value ? data.groupPublicKey.value
: this.groupPublicKey, : this.groupPublicKey,
lastMessage:
data.lastMessage.present ? data.lastMessage.value : this.lastMessage,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
); );
} }
@ -4166,6 +4194,7 @@ class GroupMember extends DataClass implements Insertable<GroupMember> {
..write('contactId: $contactId, ') ..write('contactId: $contactId, ')
..write('memberState: $memberState, ') ..write('memberState: $memberState, ')
..write('groupPublicKey: $groupPublicKey, ') ..write('groupPublicKey: $groupPublicKey, ')
..write('lastMessage: $lastMessage, ')
..write('createdAt: $createdAt') ..write('createdAt: $createdAt')
..write(')')) ..write(')'))
.toString(); .toString();
@ -4173,7 +4202,7 @@ class GroupMember extends DataClass implements Insertable<GroupMember> {
@override @override
int get hashCode => Object.hash(groupId, contactId, memberState, int get hashCode => Object.hash(groupId, contactId, memberState,
$driftBlobEquality.hash(groupPublicKey), createdAt); $driftBlobEquality.hash(groupPublicKey), lastMessage, createdAt);
@override @override
bool operator ==(Object other) => bool operator ==(Object other) =>
identical(this, other) || identical(this, other) ||
@ -4183,6 +4212,7 @@ class GroupMember extends DataClass implements Insertable<GroupMember> {
other.memberState == this.memberState && other.memberState == this.memberState &&
$driftBlobEquality.equals( $driftBlobEquality.equals(
other.groupPublicKey, this.groupPublicKey) && other.groupPublicKey, this.groupPublicKey) &&
other.lastMessage == this.lastMessage &&
other.createdAt == this.createdAt); other.createdAt == this.createdAt);
} }
@ -4191,6 +4221,7 @@ class GroupMembersCompanion extends UpdateCompanion<GroupMember> {
final Value<int> contactId; final Value<int> contactId;
final Value<MemberState?> memberState; final Value<MemberState?> memberState;
final Value<Uint8List?> groupPublicKey; final Value<Uint8List?> groupPublicKey;
final Value<DateTime?> lastMessage;
final Value<DateTime> createdAt; final Value<DateTime> createdAt;
final Value<int> rowid; final Value<int> rowid;
const GroupMembersCompanion({ const GroupMembersCompanion({
@ -4198,6 +4229,7 @@ class GroupMembersCompanion extends UpdateCompanion<GroupMember> {
this.contactId = const Value.absent(), this.contactId = const Value.absent(),
this.memberState = const Value.absent(), this.memberState = const Value.absent(),
this.groupPublicKey = const Value.absent(), this.groupPublicKey = const Value.absent(),
this.lastMessage = const Value.absent(),
this.createdAt = const Value.absent(), this.createdAt = const Value.absent(),
this.rowid = const Value.absent(), this.rowid = const Value.absent(),
}); });
@ -4206,6 +4238,7 @@ class GroupMembersCompanion extends UpdateCompanion<GroupMember> {
required int contactId, required int contactId,
this.memberState = const Value.absent(), this.memberState = const Value.absent(),
this.groupPublicKey = const Value.absent(), this.groupPublicKey = const Value.absent(),
this.lastMessage = const Value.absent(),
this.createdAt = const Value.absent(), this.createdAt = const Value.absent(),
this.rowid = const Value.absent(), this.rowid = const Value.absent(),
}) : groupId = Value(groupId), }) : groupId = Value(groupId),
@ -4215,6 +4248,7 @@ class GroupMembersCompanion extends UpdateCompanion<GroupMember> {
Expression<int>? contactId, Expression<int>? contactId,
Expression<String>? memberState, Expression<String>? memberState,
Expression<Uint8List>? groupPublicKey, Expression<Uint8List>? groupPublicKey,
Expression<DateTime>? lastMessage,
Expression<DateTime>? createdAt, Expression<DateTime>? createdAt,
Expression<int>? rowid, Expression<int>? rowid,
}) { }) {
@ -4223,6 +4257,7 @@ class GroupMembersCompanion extends UpdateCompanion<GroupMember> {
if (contactId != null) 'contact_id': contactId, if (contactId != null) 'contact_id': contactId,
if (memberState != null) 'member_state': memberState, if (memberState != null) 'member_state': memberState,
if (groupPublicKey != null) 'group_public_key': groupPublicKey, if (groupPublicKey != null) 'group_public_key': groupPublicKey,
if (lastMessage != null) 'last_message': lastMessage,
if (createdAt != null) 'created_at': createdAt, if (createdAt != null) 'created_at': createdAt,
if (rowid != null) 'rowid': rowid, if (rowid != null) 'rowid': rowid,
}); });
@ -4233,6 +4268,7 @@ class GroupMembersCompanion extends UpdateCompanion<GroupMember> {
Value<int>? contactId, Value<int>? contactId,
Value<MemberState?>? memberState, Value<MemberState?>? memberState,
Value<Uint8List?>? groupPublicKey, Value<Uint8List?>? groupPublicKey,
Value<DateTime?>? lastMessage,
Value<DateTime>? createdAt, Value<DateTime>? createdAt,
Value<int>? rowid}) { Value<int>? rowid}) {
return GroupMembersCompanion( return GroupMembersCompanion(
@ -4240,6 +4276,7 @@ class GroupMembersCompanion extends UpdateCompanion<GroupMember> {
contactId: contactId ?? this.contactId, contactId: contactId ?? this.contactId,
memberState: memberState ?? this.memberState, memberState: memberState ?? this.memberState,
groupPublicKey: groupPublicKey ?? this.groupPublicKey, groupPublicKey: groupPublicKey ?? this.groupPublicKey,
lastMessage: lastMessage ?? this.lastMessage,
createdAt: createdAt ?? this.createdAt, createdAt: createdAt ?? this.createdAt,
rowid: rowid ?? this.rowid, rowid: rowid ?? this.rowid,
); );
@ -4261,6 +4298,9 @@ class GroupMembersCompanion extends UpdateCompanion<GroupMember> {
if (groupPublicKey.present) { if (groupPublicKey.present) {
map['group_public_key'] = Variable<Uint8List>(groupPublicKey.value); map['group_public_key'] = Variable<Uint8List>(groupPublicKey.value);
} }
if (lastMessage.present) {
map['last_message'] = Variable<DateTime>(lastMessage.value);
}
if (createdAt.present) { if (createdAt.present) {
map['created_at'] = Variable<DateTime>(createdAt.value); map['created_at'] = Variable<DateTime>(createdAt.value);
} }
@ -4277,6 +4317,7 @@ class GroupMembersCompanion extends UpdateCompanion<GroupMember> {
..write('contactId: $contactId, ') ..write('contactId: $contactId, ')
..write('memberState: $memberState, ') ..write('memberState: $memberState, ')
..write('groupPublicKey: $groupPublicKey, ') ..write('groupPublicKey: $groupPublicKey, ')
..write('lastMessage: $lastMessage, ')
..write('createdAt: $createdAt, ') ..write('createdAt: $createdAt, ')
..write('rowid: $rowid') ..write('rowid: $rowid')
..write(')')) ..write(')'))
@ -10870,6 +10911,7 @@ typedef $$GroupMembersTableCreateCompanionBuilder = GroupMembersCompanion
required int contactId, required int contactId,
Value<MemberState?> memberState, Value<MemberState?> memberState,
Value<Uint8List?> groupPublicKey, Value<Uint8List?> groupPublicKey,
Value<DateTime?> lastMessage,
Value<DateTime> createdAt, Value<DateTime> createdAt,
Value<int> rowid, Value<int> rowid,
}); });
@ -10879,6 +10921,7 @@ typedef $$GroupMembersTableUpdateCompanionBuilder = GroupMembersCompanion
Value<int> contactId, Value<int> contactId,
Value<MemberState?> memberState, Value<MemberState?> memberState,
Value<Uint8List?> groupPublicKey, Value<Uint8List?> groupPublicKey,
Value<DateTime?> lastMessage,
Value<DateTime> createdAt, Value<DateTime> createdAt,
Value<int> rowid, Value<int> rowid,
}); });
@ -10935,6 +10978,9 @@ class $$GroupMembersTableFilterComposer
column: $table.groupPublicKey, column: $table.groupPublicKey,
builder: (column) => ColumnFilters(column)); builder: (column) => ColumnFilters(column));
ColumnFilters<DateTime> get lastMessage => $composableBuilder(
column: $table.lastMessage, builder: (column) => ColumnFilters(column));
ColumnFilters<DateTime> get createdAt => $composableBuilder( ColumnFilters<DateTime> get createdAt => $composableBuilder(
column: $table.createdAt, builder: (column) => ColumnFilters(column)); column: $table.createdAt, builder: (column) => ColumnFilters(column));
@ -10995,6 +11041,9 @@ class $$GroupMembersTableOrderingComposer
column: $table.groupPublicKey, column: $table.groupPublicKey,
builder: (column) => ColumnOrderings(column)); builder: (column) => ColumnOrderings(column));
ColumnOrderings<DateTime> get lastMessage => $composableBuilder(
column: $table.lastMessage, builder: (column) => ColumnOrderings(column));
ColumnOrderings<DateTime> get createdAt => $composableBuilder( ColumnOrderings<DateTime> get createdAt => $composableBuilder(
column: $table.createdAt, builder: (column) => ColumnOrderings(column)); column: $table.createdAt, builder: (column) => ColumnOrderings(column));
@ -11055,6 +11104,9 @@ class $$GroupMembersTableAnnotationComposer
GeneratedColumn<Uint8List> get groupPublicKey => $composableBuilder( GeneratedColumn<Uint8List> get groupPublicKey => $composableBuilder(
column: $table.groupPublicKey, builder: (column) => column); column: $table.groupPublicKey, builder: (column) => column);
GeneratedColumn<DateTime> get lastMessage => $composableBuilder(
column: $table.lastMessage, builder: (column) => column);
GeneratedColumn<DateTime> get createdAt => GeneratedColumn<DateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column); $composableBuilder(column: $table.createdAt, builder: (column) => column);
@ -11126,6 +11178,7 @@ class $$GroupMembersTableTableManager extends RootTableManager<
Value<int> contactId = const Value.absent(), Value<int> contactId = const Value.absent(),
Value<MemberState?> memberState = const Value.absent(), Value<MemberState?> memberState = const Value.absent(),
Value<Uint8List?> groupPublicKey = const Value.absent(), Value<Uint8List?> groupPublicKey = const Value.absent(),
Value<DateTime?> lastMessage = const Value.absent(),
Value<DateTime> createdAt = const Value.absent(), Value<DateTime> createdAt = const Value.absent(),
Value<int> rowid = const Value.absent(), Value<int> rowid = const Value.absent(),
}) => }) =>
@ -11134,6 +11187,7 @@ class $$GroupMembersTableTableManager extends RootTableManager<
contactId: contactId, contactId: contactId,
memberState: memberState, memberState: memberState,
groupPublicKey: groupPublicKey, groupPublicKey: groupPublicKey,
lastMessage: lastMessage,
createdAt: createdAt, createdAt: createdAt,
rowid: rowid, rowid: rowid,
), ),
@ -11142,6 +11196,7 @@ class $$GroupMembersTableTableManager extends RootTableManager<
required int contactId, required int contactId,
Value<MemberState?> memberState = const Value.absent(), Value<MemberState?> memberState = const Value.absent(),
Value<Uint8List?> groupPublicKey = const Value.absent(), Value<Uint8List?> groupPublicKey = const Value.absent(),
Value<DateTime?> lastMessage = const Value.absent(),
Value<DateTime> createdAt = const Value.absent(), Value<DateTime> createdAt = const Value.absent(),
Value<int> rowid = const Value.absent(), Value<int> rowid = const Value.absent(),
}) => }) =>
@ -11150,6 +11205,7 @@ class $$GroupMembersTableTableManager extends RootTableManager<
contactId: contactId, contactId: contactId,
memberState: memberState, memberState: memberState,
groupPublicKey: groupPublicKey, groupPublicKey: groupPublicKey,
lastMessage: lastMessage,
createdAt: createdAt, createdAt: createdAt,
rowid: rowid, rowid: rowid,
), ),

View file

@ -774,10 +774,11 @@
"@twonlySafeRecoverDesc": {}, "@twonlySafeRecoverDesc": {},
"twonlySafeRecoverBtn": "Backup wiederherstellen", "twonlySafeRecoverBtn": "Backup wiederherstellen",
"@twonlySafeRecoverBtn": {}, "@twonlySafeRecoverBtn": {},
"notificationText": "hat eine Nachricht gesendet.", "notificationFillerIn": "in",
"notificationTwonly": "hat ein twonly gesendet.", "notificationText": "hat eine Nachricht{inGroup} gesendet.",
"notificationVideo": "hat ein Video gesendet.", "notificationTwonly": "hat ein twonly{inGroup} gesendet.",
"notificationImage": "hat ein Bild gesendet.", "notificationVideo": "hat ein Video{inGroup} gesendet.",
"notificationImage": "hat ein Bild{inGroup} gesendet.",
"notificationAddedToGroup": "hat dich zu \"{groupname}\" hinzugefügt.", "notificationAddedToGroup": "hat dich zu \"{groupname}\" hinzugefügt.",
"notificationContactRequest": "möchte sich mit dir vernetzen.", "notificationContactRequest": "möchte sich mit dir vernetzen.",
"notificationAcceptRequest": "ist jetzt mit dir vernetzt.", "notificationAcceptRequest": "ist jetzt mit dir vernetzt.",
@ -787,7 +788,7 @@
"notificationReactionToVideo": "hat mit {reaction} auf dein Video reagiert.", "notificationReactionToVideo": "hat mit {reaction} auf dein Video reagiert.",
"notificationReactionToText": "hat mit {reaction} auf deine Nachricht reagiert.", "notificationReactionToText": "hat mit {reaction} auf deine Nachricht reagiert.",
"notificationReactionToImage": "hat mit {reaction} auf dein Bild reagiert.", "notificationReactionToImage": "hat mit {reaction} auf dein Bild reagiert.",
"notificationResponse": "hat dir geantwortet.", "notificationResponse": "hat dir{inGroup} geantwortet.",
"notificationTitleUnknownUser": "Jemand", "notificationTitleUnknownUser": "Jemand",
"notificationCategoryMessageTitle": "Nachrichten", "notificationCategoryMessageTitle": "Nachrichten",
"notificationCategoryMessageDesc": "Nachrichten von anderen Benutzern." "notificationCategoryMessageDesc": "Nachrichten von anderen Benutzern."

View file

@ -553,10 +553,11 @@
"makerLeftGroup": "{maker} has left the group.", "makerLeftGroup": "{maker} has left the group.",
"groupActionYou": "you", "groupActionYou": "you",
"groupActionYour": "your", "groupActionYour": "your",
"notificationText": "sent a message.", "notificationFillerIn": "in",
"notificationTwonly": "sent a twonly.", "notificationText": "sent a message{inGroup}.",
"notificationVideo": "sent a video.", "notificationTwonly": "sent a twonly{inGroup}.",
"notificationImage": "sent a image.", "notificationVideo": "sent a video{inGroup}.",
"notificationImage": "sent a image{inGroup}.",
"notificationAddedToGroup": "has added you to \"{groupname}\"", "notificationAddedToGroup": "has added you to \"{groupname}\"",
"notificationContactRequest": "wants to connect with you.", "notificationContactRequest": "wants to connect with you.",
"notificationAcceptRequest": "is now connected with you.", "notificationAcceptRequest": "is now connected with you.",
@ -566,7 +567,7 @@
"notificationReactionToVideo": "has reacted with {reaction} to your video.", "notificationReactionToVideo": "has reacted with {reaction} to your video.",
"notificationReactionToText": "has reacted with {reaction} to your message.", "notificationReactionToText": "has reacted with {reaction} to your message.",
"notificationReactionToImage": "has reacted with {reaction} to your image.", "notificationReactionToImage": "has reacted with {reaction} to your image.",
"notificationResponse": "has responded.", "notificationResponse": "has responded{inGroup}.",
"notificationTitleUnknownUser": "Someone", "notificationTitleUnknownUser": "Someone",
"notificationCategoryMessageTitle": "Messages", "notificationCategoryMessageTitle": "Messages",
"notificationCategoryMessageDesc": "Messages from other users." "notificationCategoryMessageDesc": "Messages from other users."

View file

@ -2420,29 +2420,35 @@ abstract class AppLocalizations {
/// **'your'** /// **'your'**
String get groupActionYour; String get groupActionYour;
/// No description provided for @notificationFillerIn.
///
/// In en, this message translates to:
/// **'in'**
String get notificationFillerIn;
/// No description provided for @notificationText. /// No description provided for @notificationText.
/// ///
/// In en, this message translates to: /// In en, this message translates to:
/// **'sent a message.'** /// **'sent a message{inGroup}.'**
String get notificationText; String notificationText(Object inGroup);
/// No description provided for @notificationTwonly. /// No description provided for @notificationTwonly.
/// ///
/// In en, this message translates to: /// In en, this message translates to:
/// **'sent a twonly.'** /// **'sent a twonly{inGroup}.'**
String get notificationTwonly; String notificationTwonly(Object inGroup);
/// No description provided for @notificationVideo. /// No description provided for @notificationVideo.
/// ///
/// In en, this message translates to: /// In en, this message translates to:
/// **'sent a video.'** /// **'sent a video{inGroup}.'**
String get notificationVideo; String notificationVideo(Object inGroup);
/// No description provided for @notificationImage. /// No description provided for @notificationImage.
/// ///
/// In en, this message translates to: /// In en, this message translates to:
/// **'sent a image.'** /// **'sent a image{inGroup}.'**
String get notificationImage; String notificationImage(Object inGroup);
/// No description provided for @notificationAddedToGroup. /// No description provided for @notificationAddedToGroup.
/// ///
@ -2501,8 +2507,8 @@ abstract class AppLocalizations {
/// No description provided for @notificationResponse. /// No description provided for @notificationResponse.
/// ///
/// In en, this message translates to: /// In en, this message translates to:
/// **'has responded.'** /// **'has responded{inGroup}.'**
String get notificationResponse; String notificationResponse(Object inGroup);
/// No description provided for @notificationTitleUnknownUser. /// No description provided for @notificationTitleUnknownUser.
/// ///

View file

@ -1310,16 +1310,27 @@ class AppLocalizationsDe extends AppLocalizations {
String get groupActionYour => 'deine'; String get groupActionYour => 'deine';
@override @override
String get notificationText => 'hat eine Nachricht gesendet.'; String get notificationFillerIn => 'in';
@override @override
String get notificationTwonly => 'hat ein twonly gesendet.'; String notificationText(Object inGroup) {
return 'hat eine Nachricht$inGroup gesendet.';
}
@override @override
String get notificationVideo => 'hat ein Video gesendet.'; String notificationTwonly(Object inGroup) {
return 'hat ein twonly$inGroup gesendet.';
}
@override @override
String get notificationImage => 'hat ein Bild gesendet.'; String notificationVideo(Object inGroup) {
return 'hat ein Video$inGroup gesendet.';
}
@override
String notificationImage(Object inGroup) {
return 'hat ein Bild$inGroup gesendet.';
}
@override @override
String notificationAddedToGroup(Object groupname) { String notificationAddedToGroup(Object groupname) {
@ -1357,7 +1368,9 @@ class AppLocalizationsDe extends AppLocalizations {
} }
@override @override
String get notificationResponse => 'hat dir geantwortet.'; String notificationResponse(Object inGroup) {
return 'hat dir$inGroup geantwortet.';
}
@override @override
String get notificationTitleUnknownUser => 'Jemand'; String get notificationTitleUnknownUser => 'Jemand';

View file

@ -1303,16 +1303,27 @@ class AppLocalizationsEn extends AppLocalizations {
String get groupActionYour => 'your'; String get groupActionYour => 'your';
@override @override
String get notificationText => 'sent a message.'; String get notificationFillerIn => 'in';
@override @override
String get notificationTwonly => 'sent a twonly.'; String notificationText(Object inGroup) {
return 'sent a message$inGroup.';
}
@override @override
String get notificationVideo => 'sent a video.'; String notificationTwonly(Object inGroup) {
return 'sent a twonly$inGroup.';
}
@override @override
String get notificationImage => 'sent a image.'; String notificationVideo(Object inGroup) {
return 'sent a video$inGroup.';
}
@override
String notificationImage(Object inGroup) {
return 'sent a image$inGroup.';
}
@override @override
String notificationAddedToGroup(Object groupname) { String notificationAddedToGroup(Object groupname) {
@ -1350,7 +1361,9 @@ class AppLocalizationsEn extends AppLocalizations {
} }
@override @override
String get notificationResponse => 'has responded.'; String notificationResponse(Object inGroup) {
return 'has responded$inGroup.';
}
@override @override
String get notificationTitleUnknownUser => 'Someone'; String get notificationTitleUnknownUser => 'Someone';

View file

@ -237,11 +237,18 @@ AppLocalizations getLocalizations() {
String getPushNotificationText(PushNotification pushNotification) { String getPushNotificationText(PushNotification pushNotification) {
final lang = getLocalizations(); final lang = getLocalizations();
var inGroup = '';
if (pushNotification.hasAdditionalContent()) {
inGroup =
' ${lang.notificationFillerIn} ${pushNotification.additionalContent}';
}
final pushNotificationText = { final pushNotificationText = {
PushKind.text.name: lang.notificationText, PushKind.text.name: lang.notificationText(inGroup),
PushKind.twonly.name: lang.notificationTwonly, PushKind.twonly.name: lang.notificationTwonly(inGroup),
PushKind.video.name: lang.notificationVideo, PushKind.video.name: lang.notificationVideo(inGroup),
PushKind.image.name: lang.notificationImage, PushKind.image.name: lang.notificationImage(inGroup),
PushKind.contactRequest.name: lang.notificationContactRequest, PushKind.contactRequest.name: lang.notificationContactRequest,
PushKind.acceptRequest.name: lang.notificationAcceptRequest, PushKind.acceptRequest.name: lang.notificationAcceptRequest,
PushKind.storedMediaFile.name: lang.notificationStoredMediaFile, PushKind.storedMediaFile.name: lang.notificationStoredMediaFile,
@ -253,7 +260,7 @@ String getPushNotificationText(PushNotification pushNotification) {
lang.notificationReactionToText(pushNotification.additionalContent), lang.notificationReactionToText(pushNotification.additionalContent),
PushKind.reactionToImage.name: PushKind.reactionToImage.name:
lang.notificationReactionToImage(pushNotification.additionalContent), lang.notificationReactionToImage(pushNotification.additionalContent),
PushKind.response.name: lang.notificationResponse, PushKind.response.name: lang.notificationResponse(inGroup),
PushKind.addedToGroup.name: PushKind.addedToGroup.name:
lang.notificationAddedToGroup(pushNotification.additionalContent), lang.notificationAddedToGroup(pushNotification.additionalContent),
}; };

View file

@ -234,6 +234,10 @@ Future<PushNotification?> getPushNotificationFromEncryptedContent(
if (content.textMessage.hasQuoteMessageId()) { if (content.textMessage.hasQuoteMessageId()) {
kind = PushKind.response; kind = PushKind.response;
} }
final group = await twonlyDB.groupsDao.getGroup(content.groupId);
if (group != null && !group.isDirectChat) {
additionalContent = group.groupName;
}
} }
if (content.hasMedia()) { if (content.hasMedia()) {
switch (content.media.type) { switch (content.media.type) {
@ -248,6 +252,10 @@ Future<PushNotification?> getPushNotificationFromEncryptedContent(
if (content.media.requiresAuthentication) { if (content.media.requiresAuthentication) {
kind = PushKind.twonly; kind = PushKind.twonly;
} }
final group = await twonlyDB.groupsDao.getGroup(content.groupId);
if (group != null && !group.isDirectChat) {
additionalContent = group.groupName;
}
} }
if (content.hasContactRequest()) { if (content.hasContactRequest()) {

View file

@ -62,7 +62,7 @@ Future<void> createPushAvatars() async {
final contacts = await twonlyDB.contactsDao.getAllNotBlockedContacts(); final contacts = await twonlyDB.contactsDao.getAllNotBlockedContacts();
for (final contact in contacts) { for (final contact in contacts) {
if (contact.avatarSvgCompressed == null) return; if (contact.avatarSvgCompressed == null) continue;
final avatarSvg = getAvatarSvg(contact.avatarSvgCompressed!); final avatarSvg = getAvatarSvg(contact.avatarSvgCompressed!);

View file

@ -67,6 +67,16 @@ Uint8List getRandomUint8List(int length) {
return randomBytes; return randomBytes;
} }
const _chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890';
Random _rnd = Random();
String getRandomString(int length) => String.fromCharCodes(
Iterable.generate(
length,
(_) => _chars.codeUnitAt(_rnd.nextInt(_chars.length)),
),
);
String errorCodeToText(BuildContext context, ErrorCode code) { String errorCodeToText(BuildContext context, ErrorCode code) {
// ignore: exhaustive_cases // ignore: exhaustive_cases
switch (code) { switch (code) {

View file

@ -52,7 +52,7 @@ Mutex updateProtection = Mutex();
Future<UserData?> updateUserdata( Future<UserData?> updateUserdata(
UserData Function(UserData userData) updateUser, UserData Function(UserData userData) updateUser,
) async { ) async {
return updateProtection.protect<UserData?>(() async { final userData = await updateProtection.protect<UserData?>(() async {
final user = await getUser(); final user = await getUser();
if (user == null) return null; if (user == null) return null;
final updated = updateUser(user); final updated = updateUser(user);
@ -61,6 +61,14 @@ Future<UserData?> updateUserdata(
gUser = updated; gUser = updated;
return updated; return updated;
}); });
try {
for (final callBack in globalUserDataChangedCallBack.values) {
callBack();
}
} catch (e) {
Log.error(e);
}
return userData;
} }
Future<bool> deleteLocalUserData() async { Future<bool> deleteLocalUserData() async {

View file

@ -279,7 +279,7 @@ class ContactsListView extends StatelessWidget {
final contact = contacts[index]; final contact = contacts[index];
return ListTile( return ListTile(
title: Text(substringBy(contact.username, 25)), title: Text(substringBy(contact.username, 25)),
leading: AvatarIcon(contact: contact), leading: AvatarIcon(contactId: contact.userId),
trailing: Row( trailing: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: contact.requested children: contact.requested

View file

@ -123,7 +123,7 @@ class _ChatListViewState extends State<ChatListView> {
setState(() {}); // gUser has updated setState(() {}); // gUser has updated
}, },
child: AvatarIcon( child: AvatarIcon(
userData: gUser, myAvatar: true,
fontSize: 14, fontSize: 14,
color: context.color.onSurface.withAlpha(20), color: context.color.onSurface.withAlpha(20),
), ),

View file

@ -386,7 +386,7 @@ class _ChatMessagesViewState extends State<ChatMessagesView> {
children: messages[i].lastOpenedPosition!.map((w) { children: messages[i].lastOpenedPosition!.map((w) {
return AvatarIcon( return AvatarIcon(
key: GlobalKey(), key: GlobalKey(),
contact: w, contactId: w.userId,
fontSize: 12, fontSize: 12,
); );
}).toList(), }).toList(),

View file

@ -116,8 +116,8 @@ class _AllReactionsViewState extends State<AllReactionsView> {
child: Row( child: Row(
children: [ children: [
AvatarIcon( AvatarIcon(
contact: entry.$2, contactId: entry.$2?.userId,
userData: (entry.$2 == null) ? gUser : null, myAvatar: entry.$2 == null,
fontSize: 15, fontSize: 15,
), ),
const SizedBox(width: 6), const SizedBox(width: 6),

View file

@ -127,7 +127,7 @@ class _MessageInfoViewState extends State<MessageInfoView> {
child: Row( child: Row(
children: [ children: [
AvatarIcon( AvatarIcon(
contact: groupMember.$2, contactId: groupMember.$2.userId,
fontSize: 15, fontSize: 15,
), ),
const SizedBox(width: 6), const SizedBox(width: 6),

View file

@ -175,7 +175,7 @@ class UserList extends StatelessWidget {
], ],
), ),
leading: AvatarIcon( leading: AvatarIcon(
contact: user, contactId: user.userId,
fontSize: 13, fontSize: 13,
), ),
onTap: () async { onTap: () async {

View file

@ -1,24 +1,22 @@
import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart'; import 'package:flutter_svg/svg.dart';
import 'package:twonly/globals.dart'; import 'package:twonly/globals.dart';
import 'package:twonly/src/database/twonly.db.dart'; import 'package:twonly/src/database/twonly.db.dart';
import 'package:twonly/src/model/json/userdata.dart';
import 'package:twonly/src/utils/misc.dart'; import 'package:twonly/src/utils/misc.dart';
class AvatarIcon extends StatefulWidget { class AvatarIcon extends StatefulWidget {
const AvatarIcon({ const AvatarIcon({
super.key, super.key,
this.group, this.group,
this.contact,
this.contactId, this.contactId,
this.userData, this.myAvatar = false,
this.fontSize = 20, this.fontSize = 20,
this.color, this.color,
}); });
final Group? group; final Group? group;
final Contact? contact;
final int? contactId; final int? contactId;
final UserData? userData; final bool myAvatar;
final double? fontSize; final double? fontSize;
final Color? color; final Color? color;
@ -27,7 +25,12 @@ class AvatarIcon extends StatefulWidget {
} }
class _AvatarIconState extends State<AvatarIcon> { class _AvatarIconState extends State<AvatarIcon> {
final List<String> _avatarSVGs = []; List<String> _avatarSVGs = [];
String? _globalUserDataCallBackId;
StreamSubscription<List<Contact>>? groupStream;
StreamSubscription<List<Contact>>? contactsStream;
StreamSubscription<Contact?>? contactStream;
@override @override
void initState() { void initState() {
@ -35,32 +38,53 @@ class _AvatarIconState extends State<AvatarIcon> {
super.initState(); super.initState();
} }
@override
void dispose() {
groupStream?.cancel();
contactStream?.cancel();
contactsStream?.cancel();
if (_globalUserDataCallBackId != null) {
globalUserDataChangedCallBack.remove(_globalUserDataCallBackId);
}
super.dispose();
}
Future<void> initAsync() async { Future<void> initAsync() async {
if (widget.group != null) { if (widget.group != null) {
final contacts = groupStream = twonlyDB.groupsDao
await twonlyDB.groupsDao.getGroupContact(widget.group!.groupId); .watchGroupContact(widget.group!.groupId)
if (contacts.length == 1) { .listen((contacts) {
if (contacts.first.avatarSvgCompressed != null) { _avatarSVGs = [];
_avatarSVGs.add(getAvatarSvg(contacts.first.avatarSvgCompressed!)); if (contacts.length == 1) {
} if (contacts.first.avatarSvgCompressed != null) {
} else { _avatarSVGs.add(getAvatarSvg(contacts.first.avatarSvgCompressed!));
for (final contact in contacts) { }
if (contact.avatarSvgCompressed != null) { } else {
_avatarSVGs.add(getAvatarSvg(contact.avatarSvgCompressed!)); for (final contact in contacts) {
if (contact.avatarSvgCompressed != null) {
_avatarSVGs.add(getAvatarSvg(contact.avatarSvgCompressed!));
}
} }
} }
} setState(() {});
// avatarSvg = group!.avatarSvg; });
} else if (widget.userData?.avatarSvg != null) { } else if (widget.myAvatar) {
_avatarSVGs.add(widget.userData!.avatarSvg!); _globalUserDataCallBackId = 'avatar_${getRandomString(10)}';
} else if (widget.contact?.avatarSvgCompressed != null) { globalUserDataChangedCallBack[_globalUserDataCallBackId!] = () {
_avatarSVGs.add(getAvatarSvg(widget.contact!.avatarSvgCompressed!)); setState(() {
_avatarSVGs = [gUser.avatarSvg!];
});
};
_avatarSVGs.add(gUser.avatarSvg!);
} else if (widget.contactId != null) { } else if (widget.contactId != null) {
final contact = contactStream = twonlyDB.contactsDao
await twonlyDB.contactsDao.getContactById(widget.contactId!); .watchContact(widget.contactId!)
if (contact != null && contact.avatarSvgCompressed != null) { .listen((contact) {
_avatarSVGs.add(getAvatarSvg(contact.avatarSvgCompressed!)); if (contact != null && contact.avatarSvgCompressed != null) {
} _avatarSVGs = [getAvatarSvg(contact.avatarSvgCompressed!)];
setState(() {});
}
});
} }
if (mounted) setState(() {}); if (mounted) setState(() {});
} }

View file

@ -115,7 +115,7 @@ class _ContactViewState extends State<ContactView> {
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.all(10), padding: const EdgeInsets.all(10),
child: AvatarIcon(contact: contact, fontSize: 30), child: AvatarIcon(contactId: contact.userId, fontSize: 30),
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,

View file

@ -153,9 +153,8 @@ class _GroupViewState extends State<GroupView> {
), ),
BetterListTile( BetterListTile(
padding: const EdgeInsets.only(left: 13), padding: const EdgeInsets.only(left: 13),
leading: AvatarIcon( leading: const AvatarIcon(
key: GlobalKey(), myAvatar: true,
userData: gUser,
fontSize: 16, fontSize: 16,
), ),
text: context.lang.you, text: context.lang.you,
@ -177,8 +176,7 @@ class _GroupViewState extends State<GroupView> {
child: BetterListTile( child: BetterListTile(
padding: const EdgeInsets.only(left: 13), padding: const EdgeInsets.only(left: 13),
leading: AvatarIcon( leading: AvatarIcon(
key: GlobalKey(), contactId: member.$1.userId,
contact: member.$1,
fontSize: 16, fontSize: 16,
), ),
text: getContactDisplayName(member.$1, maxLength: 25), text: getContactDisplayName(member.$1, maxLength: 25),

View file

@ -114,7 +114,7 @@ class _GroupCreateSelectGroupNameViewState
], ],
), ),
leading: AvatarIcon( leading: AvatarIcon(
contact: user, contactId: user.userId,
fontSize: 13, fontSize: 13,
), ),
), ),

View file

@ -204,7 +204,7 @@ class _StartNewChatView extends State<GroupCreateSelectMembersView> {
? Text(context.lang.alreadyInGroup) ? Text(context.lang.alreadyInGroup)
: null, : null,
leading: AvatarIcon( leading: AvatarIcon(
contact: user, contactId: user.userId,
fontSize: 13, fontSize: 13,
), ),
trailing: Checkbox( trailing: Checkbox(
@ -256,7 +256,7 @@ class _Chip extends StatelessWidget {
child: Chip( child: Chip(
key: GlobalKey(), key: GlobalKey(),
avatar: AvatarIcon( avatar: AvatarIcon(
contact: contact, contactId: contact.userId,
fontSize: 10, fontSize: 10,
), ),
label: Row( label: Row(

View file

@ -112,7 +112,7 @@ class UserList extends StatelessWidget {
Text(getContactDisplayName(user)), Text(getContactDisplayName(user)),
], ],
), ),
leading: AvatarIcon(contact: user, fontSize: 15), leading: AvatarIcon(contactId: user.userId, fontSize: 15),
trailing: Checkbox( trailing: Checkbox(
value: user.blocked, value: user.blocked,
onChanged: (bool? value) async { onChanged: (bool? value) async {

View file

@ -55,8 +55,8 @@ class _SettingsMainViewState extends State<SettingsMainView> {
color: context.color.surface.withAlpha(0), color: context.color.surface.withAlpha(0),
child: Row( child: Row(
children: [ children: [
AvatarIcon( const AvatarIcon(
userData: gUser, myAvatar: true,
fontSize: 30, fontSize: 30,
), ),
Container(width: 20, color: Colors.transparent), Container(width: 20, color: Colors.transparent),