refactor: remove literal boolean comparisons leftover from nullsafety conversion

This commit is contained in:
Nicolas Werner 2021-10-28 14:40:02 +02:00
parent 6e20c53b01
commit 7d78233bf0
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
4 changed files with 9 additions and 14 deletions

View File

@ -56,7 +56,7 @@ class KeyVerificationManager {
Future<void> handleToDeviceEvent(ToDeviceEvent event) async {
if (!event.type.startsWith('m.key.verification.') ||
client.verificationMethods.isEmpty != false) {
client.verificationMethods.isEmpty) {
return;
}
// we have key verification going on!
@ -95,7 +95,7 @@ class KeyVerificationManager {
: event['content']['msgtype'];
if (type == null ||
!type.startsWith('m.key.verification.') ||
client.verificationMethods.isEmpty != false) {
client.verificationMethods.isEmpty) {
return;
}
if (type == EventTypes.KeyVerificationRequest) {

View File

@ -57,8 +57,7 @@ class OlmManager {
await olm.init();
_olmAccount = olm.Account();
_olmAccount!.create();
if (await uploadKeys(uploadDeviceKeys: true, updateDatabase: false) ==
false) {
if (!await uploadKeys(uploadDeviceKeys: true, updateDatabase: false)) {
throw ('Upload key failed');
}
} catch (_) {
@ -359,7 +358,7 @@ class OlmManager {
if (session.session == null) {
continue;
}
if (type == 0 && session.session!.matches_inbound(body) == true) {
if (type == 0 && session.session!.matches_inbound(body)) {
try {
plaintext = session.session!.decrypt(type, body);
} catch (e) {

View File

@ -152,10 +152,8 @@ class KeyVerification {
List<String> get knownVerificationMethods {
final methods = <String>[];
if (client.verificationMethods.contains(KeyVerificationMethod.numbers) ==
true ||
client.verificationMethods.contains(KeyVerificationMethod.emoji) ==
true) {
if (client.verificationMethods.contains(KeyVerificationMethod.numbers) ||
client.verificationMethods.contains(KeyVerificationMethod.emoji)) {
methods.add('m.sas.v1');
}
return methods;
@ -672,13 +670,11 @@ class _KeyVerificationMethodSas extends _KeyVerificationMethod {
List<String> get knownAuthentificationTypes {
final types = <String>[];
if (request.client.verificationMethods
.contains(KeyVerificationMethod.emoji) ==
true) {
.contains(KeyVerificationMethod.emoji)) {
types.add('emoji');
}
if (request.client.verificationMethods
.contains(KeyVerificationMethod.numbers) ==
true) {
.contains(KeyVerificationMethod.numbers)) {
types.add('decimal');
}
return types;

View File

@ -464,7 +464,7 @@ class Client extends MatrixApi {
@Deprecated('Deprecated in favour of identifier.') String? medium,
@Deprecated('Deprecated in favour of identifier.') String? address,
}) async {
if (homeserver == null && user != null && user.isValidMatrixId == true) {
if (homeserver == null && user != null && user.isValidMatrixId) {
await checkHomeserver(user.domain);
}
final response = await super.login(