refactor: Add missing versions to supportedVersions and use warning instead of blocking
This commit is contained in:
parent
2f1e423416
commit
bf37bf82a0
|
|
@ -548,10 +548,10 @@ class Client extends MatrixApi {
|
||||||
final versions = await getVersions();
|
final versions = await getVersions();
|
||||||
if (!versions.versions
|
if (!versions.versions
|
||||||
.any((version) => supportedVersions.contains(version))) {
|
.any((version) => supportedVersions.contains(version))) {
|
||||||
throw BadServerVersionsException(
|
Logs().w(
|
||||||
versions.versions.toSet(),
|
'Server supports the versions: ${versions.toString()} but this application is only compatible with ${supportedVersions.toString()}.',
|
||||||
supportedVersions,
|
|
||||||
);
|
);
|
||||||
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
final loginTypes = await getLoginFlows() ?? [];
|
final loginTypes = await getLoginFlows() ?? [];
|
||||||
|
|
@ -1640,7 +1640,22 @@ class Client extends MatrixApi {
|
||||||
return pushrules != null ? TryGetPushRule.tryFromJson(pushrules) : null;
|
return pushrules != null ? TryGetPushRule.tryFromJson(pushrules) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const Set<String> supportedVersions = {'v1.1', 'v1.2'};
|
static const Set<String> supportedVersions = {
|
||||||
|
'v1.1',
|
||||||
|
'v1.2',
|
||||||
|
'v1.3',
|
||||||
|
'v1.4',
|
||||||
|
'v1.5',
|
||||||
|
'v1.6',
|
||||||
|
'v1.7',
|
||||||
|
'v1.8',
|
||||||
|
'v1.9',
|
||||||
|
'v1.10',
|
||||||
|
'v1.11',
|
||||||
|
'v1.12',
|
||||||
|
'v1.13',
|
||||||
|
};
|
||||||
|
|
||||||
static const List<String> supportedDirectEncryptionAlgorithms = [
|
static const List<String> supportedDirectEncryptionAlgorithms = [
|
||||||
AlgorithmTypes.olmV1Curve25519AesSha2,
|
AlgorithmTypes.olmV1Curve25519AesSha2,
|
||||||
];
|
];
|
||||||
|
|
@ -3988,16 +4003,6 @@ enum SyncStatus {
|
||||||
error,
|
error,
|
||||||
}
|
}
|
||||||
|
|
||||||
class BadServerVersionsException implements Exception {
|
|
||||||
final Set<String> serverVersions, supportedVersions;
|
|
||||||
|
|
||||||
BadServerVersionsException(this.serverVersions, this.supportedVersions);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() =>
|
|
||||||
'Server supports the versions: ${serverVersions.toString()} but this application is only compatible with ${supportedVersions.toString()}.';
|
|
||||||
}
|
|
||||||
|
|
||||||
class BadServerLoginTypesException implements Exception {
|
class BadServerLoginTypesException implements Exception {
|
||||||
final Set<String> serverLoginTypes, supportedLoginTypes;
|
final Set<String> serverLoginTypes, supportedLoginTypes;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue