From bf37bf82a061d15548eeedb774a503f87f8582ba Mon Sep 17 00:00:00 2001 From: Krille Date: Fri, 31 Jan 2025 11:04:24 +0100 Subject: [PATCH] refactor: Add missing versions to supportedVersions and use warning instead of blocking --- lib/src/client.dart | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/lib/src/client.dart b/lib/src/client.dart index e27bf246..cd937449 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -548,10 +548,10 @@ class Client extends MatrixApi { final versions = await getVersions(); if (!versions.versions .any((version) => supportedVersions.contains(version))) { - throw BadServerVersionsException( - versions.versions.toSet(), - supportedVersions, + Logs().w( + 'Server supports the versions: ${versions.toString()} but this application is only compatible with ${supportedVersions.toString()}.', ); + assert(false); } final loginTypes = await getLoginFlows() ?? []; @@ -1640,7 +1640,22 @@ class Client extends MatrixApi { return pushrules != null ? TryGetPushRule.tryFromJson(pushrules) : null; } - static const Set supportedVersions = {'v1.1', 'v1.2'}; + static const Set 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 supportedDirectEncryptionAlgorithms = [ AlgorithmTypes.olmV1Curve25519AesSha2, ]; @@ -3988,16 +4003,6 @@ enum SyncStatus { error, } -class BadServerVersionsException implements Exception { - final Set 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 { final Set serverLoginTypes, supportedLoginTypes;