refactor: remove literal boolean comparisons leftover from nullsafety conversion
This commit is contained in:
parent
6e20c53b01
commit
7d78233bf0
|
|
@ -56,7 +56,7 @@ class KeyVerificationManager {
|
||||||
|
|
||||||
Future<void> handleToDeviceEvent(ToDeviceEvent event) async {
|
Future<void> handleToDeviceEvent(ToDeviceEvent event) async {
|
||||||
if (!event.type.startsWith('m.key.verification.') ||
|
if (!event.type.startsWith('m.key.verification.') ||
|
||||||
client.verificationMethods.isEmpty != false) {
|
client.verificationMethods.isEmpty) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// we have key verification going on!
|
// we have key verification going on!
|
||||||
|
|
@ -95,7 +95,7 @@ class KeyVerificationManager {
|
||||||
: event['content']['msgtype'];
|
: event['content']['msgtype'];
|
||||||
if (type == null ||
|
if (type == null ||
|
||||||
!type.startsWith('m.key.verification.') ||
|
!type.startsWith('m.key.verification.') ||
|
||||||
client.verificationMethods.isEmpty != false) {
|
client.verificationMethods.isEmpty) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (type == EventTypes.KeyVerificationRequest) {
|
if (type == EventTypes.KeyVerificationRequest) {
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,7 @@ class OlmManager {
|
||||||
await olm.init();
|
await olm.init();
|
||||||
_olmAccount = olm.Account();
|
_olmAccount = olm.Account();
|
||||||
_olmAccount!.create();
|
_olmAccount!.create();
|
||||||
if (await uploadKeys(uploadDeviceKeys: true, updateDatabase: false) ==
|
if (!await uploadKeys(uploadDeviceKeys: true, updateDatabase: false)) {
|
||||||
false) {
|
|
||||||
throw ('Upload key failed');
|
throw ('Upload key failed');
|
||||||
}
|
}
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
|
|
@ -359,7 +358,7 @@ class OlmManager {
|
||||||
if (session.session == null) {
|
if (session.session == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (type == 0 && session.session!.matches_inbound(body) == true) {
|
if (type == 0 && session.session!.matches_inbound(body)) {
|
||||||
try {
|
try {
|
||||||
plaintext = session.session!.decrypt(type, body);
|
plaintext = session.session!.decrypt(type, body);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
||||||
|
|
@ -152,10 +152,8 @@ class KeyVerification {
|
||||||
|
|
||||||
List<String> get knownVerificationMethods {
|
List<String> get knownVerificationMethods {
|
||||||
final methods = <String>[];
|
final methods = <String>[];
|
||||||
if (client.verificationMethods.contains(KeyVerificationMethod.numbers) ==
|
if (client.verificationMethods.contains(KeyVerificationMethod.numbers) ||
|
||||||
true ||
|
client.verificationMethods.contains(KeyVerificationMethod.emoji)) {
|
||||||
client.verificationMethods.contains(KeyVerificationMethod.emoji) ==
|
|
||||||
true) {
|
|
||||||
methods.add('m.sas.v1');
|
methods.add('m.sas.v1');
|
||||||
}
|
}
|
||||||
return methods;
|
return methods;
|
||||||
|
|
@ -672,13 +670,11 @@ class _KeyVerificationMethodSas extends _KeyVerificationMethod {
|
||||||
List<String> get knownAuthentificationTypes {
|
List<String> get knownAuthentificationTypes {
|
||||||
final types = <String>[];
|
final types = <String>[];
|
||||||
if (request.client.verificationMethods
|
if (request.client.verificationMethods
|
||||||
.contains(KeyVerificationMethod.emoji) ==
|
.contains(KeyVerificationMethod.emoji)) {
|
||||||
true) {
|
|
||||||
types.add('emoji');
|
types.add('emoji');
|
||||||
}
|
}
|
||||||
if (request.client.verificationMethods
|
if (request.client.verificationMethods
|
||||||
.contains(KeyVerificationMethod.numbers) ==
|
.contains(KeyVerificationMethod.numbers)) {
|
||||||
true) {
|
|
||||||
types.add('decimal');
|
types.add('decimal');
|
||||||
}
|
}
|
||||||
return types;
|
return types;
|
||||||
|
|
|
||||||
|
|
@ -464,7 +464,7 @@ class Client extends MatrixApi {
|
||||||
@Deprecated('Deprecated in favour of identifier.') String? medium,
|
@Deprecated('Deprecated in favour of identifier.') String? medium,
|
||||||
@Deprecated('Deprecated in favour of identifier.') String? address,
|
@Deprecated('Deprecated in favour of identifier.') String? address,
|
||||||
}) async {
|
}) async {
|
||||||
if (homeserver == null && user != null && user.isValidMatrixId == true) {
|
if (homeserver == null && user != null && user.isValidMatrixId) {
|
||||||
await checkHomeserver(user.domain);
|
await checkHomeserver(user.domain);
|
||||||
}
|
}
|
||||||
final response = await super.login(
|
final response = await super.login(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue