fixing analyzer

This commit is contained in:
otsmr 2025-11-01 14:58:02 +01:00
parent 72dca4d4b4
commit 9eea69b3dd
6 changed files with 37 additions and 25 deletions

View file

@ -67,14 +67,16 @@ class GroupsDao extends DatabaseAccessor<TwonlyDB> with _$GroupsDaoMixin {
) async {
await (update(groupMembers)
..where(
(c) => c.groupId.equals(groupId) & c.contactId.equals(contactId)))
(c) => c.groupId.equals(groupId) & c.contactId.equals(contactId),
))
.write(updates);
}
Future<void> removeMember(String groupId, int contactId) async {
await (delete(groupMembers)
..where(
(c) => c.groupId.equals(groupId) & c.contactId.equals(contactId)))
(c) => c.groupId.equals(groupId) & c.contactId.equals(contactId),
))
.go();
}

View file

@ -44,7 +44,7 @@ part 'twonly.db.g.dart';
SignalContactPreKeys,
SignalContactSignedPreKeys,
MessageActions,
GroupHistories
GroupHistories,
],
daos: [
MessagesDao,

View file

@ -1,4 +1,5 @@
import 'dart:async';
import 'package:drift/drift.dart';
import 'package:hashlib/random.dart';
import 'package:mutex/mutex.dart';
@ -11,15 +12,15 @@ import 'package:twonly/src/model/protobuf/api/websocket/client_to_server.pb.dart
import 'package:twonly/src/model/protobuf/api/websocket/server_to_client.pb.dart'
as server;
import 'package:twonly/src/model/protobuf/client/generated/messages.pb.dart';
import 'package:twonly/src/services/api/client2client/groups.c2c.dart';
import 'package:twonly/src/services/api/messages.dart';
import 'package:twonly/src/services/api/client2client/contact.c2c.dart';
import 'package:twonly/src/services/api/client2client/groups.c2c.dart';
import 'package:twonly/src/services/api/client2client/media.c2c.dart';
import 'package:twonly/src/services/api/client2client/messages.c2c.dart';
import 'package:twonly/src/services/api/client2client/prekeys.c2c.dart';
import 'package:twonly/src/services/api/client2client/pushkeys.c2c.dart';
import 'package:twonly/src/services/api/client2client/reaction.c2c.dart';
import 'package:twonly/src/services/api/client2client/text_message.c2c.dart';
import 'package:twonly/src/services/api/messages.dart';
import 'package:twonly/src/services/signal/encryption.signal.dart';
import 'package:twonly/src/utils/log.dart';
import 'package:twonly/src/utils/misc.dart';

View file

@ -161,14 +161,20 @@ Future<bool> fetchGroupState(Group group) async {
final groupStateServer = GroupState.fromBuffer(response.bodyBytes);
final envelope = EncryptedGroupStateEnvelop.fromBuffer(
groupStateServer.encryptedGroupState);
groupStateServer.encryptedGroupState,
);
final chacha20 = FlutterChacha20.poly1305Aead();
final secretBox = SecretBox(envelope.encryptedGroupState,
nonce: envelope.nonce, mac: Mac(envelope.mac));
final secretBox = SecretBox(
envelope.encryptedGroupState,
nonce: envelope.nonce,
mac: Mac(envelope.mac),
);
final encryptedGroupStateRaw = await chacha20.decrypt(secretBox,
secretKey: SecretKey(group.stateEncryptionKey!));
final encryptedGroupStateRaw = await chacha20.decrypt(
secretBox,
secretKey: SecretKey(group.stateEncryptionKey!),
);
final encryptedGroupState =
EncryptedGroupState.fromBuffer(encryptedGroupStateRaw);

View file

@ -36,7 +36,9 @@ class _GroupCreateSelectGroupNameViewState
await createNewGroup(textFieldGroupName.text, widget.selectedUsers);
if (wasSuccess) {
// POP
if (mounted) {
Navigator.popUntil(context, (route) => route.isFirst);
}
return;
}

View file

@ -150,7 +150,8 @@ class _StartNewChatView extends State<GroupCreateSelectMembersView> {
);
}).toList(),
);
}),
},
),
),
);
}
@ -241,7 +242,7 @@ class _Chip extends StatelessWidget {
FontAwesomeIcons.xmark,
color: Colors.grey,
size: 12,
)
),
],
),
),