Merge pull request #1905 from famedly/krille/use-auth-media-if-unstable-features

refactor: Also use authenticated media if unstable features claim support
This commit is contained in:
Krille-chan 2024-08-21 15:13:24 +02:00 committed by GitHub
commit 4e0f05702a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -1164,11 +1164,11 @@ class Client extends MatrixApi {
GetVersionsResponse? _versionsCache; GetVersionsResponse? _versionsCache;
Future<bool> authenticatedMediaSupported() async { Future<bool> authenticatedMediaSupported() async {
_versionsCache ??= await getVersions(); final versionsResponse = _versionsCache ??= await getVersions();
return _versionsCache?.versions.any( return versionsResponse.versions.any(
(v) => isVersionGreaterThanOrEqualTo(v, 'v1.11'), (v) => isVersionGreaterThanOrEqualTo(v, 'v1.11'),
) ?? ) ||
false; versionsResponse.unstableFeatures?['org.matrix.msc3916.stable'] == true;
} }
final _serverConfigCache = AsyncCache<ServerConfig>(const Duration(hours: 1)); final _serverConfigCache = AsyncCache<ServerConfig>(const Duration(hours: 1));