refactor: Don't create dummy User object just to start a new chat
This commit is contained in:
parent
3c47b16f22
commit
92755c07d3
|
|
@ -27,7 +27,6 @@ import '../../encryption.dart';
|
||||||
import '../client.dart';
|
import '../client.dart';
|
||||||
import '../event.dart';
|
import '../event.dart';
|
||||||
import '../room.dart';
|
import '../room.dart';
|
||||||
import '../user.dart';
|
|
||||||
|
|
||||||
enum UserVerifiedStatus { verified, unknown, unknownDevice }
|
enum UserVerifiedStatus { verified, unknown, unknownDevice }
|
||||||
|
|
||||||
|
|
@ -79,8 +78,7 @@ class DeviceKeysList {
|
||||||
Future<KeyVerification> startVerification() async {
|
Future<KeyVerification> startVerification() async {
|
||||||
if (userId != client.userID) {
|
if (userId != client.userID) {
|
||||||
// in-room verification with someone else
|
// in-room verification with someone else
|
||||||
final roomId =
|
final roomId = await client.startDirectChat(userId);
|
||||||
await User(userId, room: Room(client: client)).startDirectChat();
|
|
||||||
if (roomId == null) {
|
if (roomId == null) {
|
||||||
throw Exception('Unable to start new room');
|
throw Exception('Unable to start new room');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue