mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 09:28:41 +00:00
fixing analyzer
This commit is contained in:
parent
72dca4d4b4
commit
9eea69b3dd
6 changed files with 37 additions and 25 deletions
|
|
@ -67,14 +67,16 @@ class GroupsDao extends DatabaseAccessor<TwonlyDB> with _$GroupsDaoMixin {
|
||||||
) async {
|
) async {
|
||||||
await (update(groupMembers)
|
await (update(groupMembers)
|
||||||
..where(
|
..where(
|
||||||
(c) => c.groupId.equals(groupId) & c.contactId.equals(contactId)))
|
(c) => c.groupId.equals(groupId) & c.contactId.equals(contactId),
|
||||||
|
))
|
||||||
.write(updates);
|
.write(updates);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> removeMember(String groupId, int contactId) async {
|
Future<void> removeMember(String groupId, int contactId) async {
|
||||||
await (delete(groupMembers)
|
await (delete(groupMembers)
|
||||||
..where(
|
..where(
|
||||||
(c) => c.groupId.equals(groupId) & c.contactId.equals(contactId)))
|
(c) => c.groupId.equals(groupId) & c.contactId.equals(contactId),
|
||||||
|
))
|
||||||
.go();
|
.go();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ part 'twonly.db.g.dart';
|
||||||
SignalContactPreKeys,
|
SignalContactPreKeys,
|
||||||
SignalContactSignedPreKeys,
|
SignalContactSignedPreKeys,
|
||||||
MessageActions,
|
MessageActions,
|
||||||
GroupHistories
|
GroupHistories,
|
||||||
],
|
],
|
||||||
daos: [
|
daos: [
|
||||||
MessagesDao,
|
MessagesDao,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:drift/drift.dart';
|
import 'package:drift/drift.dart';
|
||||||
import 'package:hashlib/random.dart';
|
import 'package:hashlib/random.dart';
|
||||||
import 'package:mutex/mutex.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'
|
import 'package:twonly/src/model/protobuf/api/websocket/server_to_client.pb.dart'
|
||||||
as server;
|
as server;
|
||||||
import 'package:twonly/src/model/protobuf/client/generated/messages.pb.dart';
|
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/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/media.c2c.dart';
|
||||||
import 'package:twonly/src/services/api/client2client/messages.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/prekeys.c2c.dart';
|
||||||
import 'package:twonly/src/services/api/client2client/pushkeys.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/reaction.c2c.dart';
|
||||||
import 'package:twonly/src/services/api/client2client/text_message.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/services/signal/encryption.signal.dart';
|
||||||
import 'package:twonly/src/utils/log.dart';
|
import 'package:twonly/src/utils/log.dart';
|
||||||
import 'package:twonly/src/utils/misc.dart';
|
import 'package:twonly/src/utils/misc.dart';
|
||||||
|
|
|
||||||
|
|
@ -161,14 +161,20 @@ Future<bool> fetchGroupState(Group group) async {
|
||||||
|
|
||||||
final groupStateServer = GroupState.fromBuffer(response.bodyBytes);
|
final groupStateServer = GroupState.fromBuffer(response.bodyBytes);
|
||||||
final envelope = EncryptedGroupStateEnvelop.fromBuffer(
|
final envelope = EncryptedGroupStateEnvelop.fromBuffer(
|
||||||
groupStateServer.encryptedGroupState);
|
groupStateServer.encryptedGroupState,
|
||||||
|
);
|
||||||
final chacha20 = FlutterChacha20.poly1305Aead();
|
final chacha20 = FlutterChacha20.poly1305Aead();
|
||||||
|
|
||||||
final secretBox = SecretBox(envelope.encryptedGroupState,
|
final secretBox = SecretBox(
|
||||||
nonce: envelope.nonce, mac: Mac(envelope.mac));
|
envelope.encryptedGroupState,
|
||||||
|
nonce: envelope.nonce,
|
||||||
|
mac: Mac(envelope.mac),
|
||||||
|
);
|
||||||
|
|
||||||
final encryptedGroupStateRaw = await chacha20.decrypt(secretBox,
|
final encryptedGroupStateRaw = await chacha20.decrypt(
|
||||||
secretKey: SecretKey(group.stateEncryptionKey!));
|
secretBox,
|
||||||
|
secretKey: SecretKey(group.stateEncryptionKey!),
|
||||||
|
);
|
||||||
|
|
||||||
final encryptedGroupState =
|
final encryptedGroupState =
|
||||||
EncryptedGroupState.fromBuffer(encryptedGroupStateRaw);
|
EncryptedGroupState.fromBuffer(encryptedGroupStateRaw);
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,9 @@ class _GroupCreateSelectGroupNameViewState
|
||||||
await createNewGroup(textFieldGroupName.text, widget.selectedUsers);
|
await createNewGroup(textFieldGroupName.text, widget.selectedUsers);
|
||||||
if (wasSuccess) {
|
if (wasSuccess) {
|
||||||
// POP
|
// POP
|
||||||
Navigator.popUntil(context, (route) => route.isFirst);
|
if (mounted) {
|
||||||
|
Navigator.popUntil(context, (route) => route.isFirst);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -138,19 +138,20 @@ class _StartNewChatView extends State<GroupCreateSelectMembersView> {
|
||||||
),
|
),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
// Wrap will use the available width from constraints.maxWidth
|
// Wrap will use the available width from constraints.maxWidth
|
||||||
return Wrap(
|
return Wrap(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
children: selected.map((w) {
|
children: selected.map((w) {
|
||||||
return _Chip(
|
return _Chip(
|
||||||
contact: allContacts
|
contact: allContacts
|
||||||
.firstWhere((t) => t.userId == w),
|
.firstWhere((t) => t.userId == w),
|
||||||
onTap: toggleSelectedUser,
|
onTap: toggleSelectedUser,
|
||||||
);
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -241,7 +242,7 @@ class _Chip extends StatelessWidget {
|
||||||
FontAwesomeIcons.xmark,
|
FontAwesomeIcons.xmark,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
size: 12,
|
size: 12,
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue