Browse Source

Merge pull request #874 from nextcloud/perf/nextcloud/notes_version_supported

improve notes version supported performance
pull/585/head
Nikolas Rimikis 1 year ago committed by GitHub
parent
commit
151d7e6beb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      packages/nextcloud/lib/src/version_supported.dart

6
packages/nextcloud/lib/src/version_supported.dart

@ -1,3 +1,4 @@
import 'package:collection/collection.dart';
import 'package:nextcloud/src/api/core.openapi.dart';
import 'package:nextcloud/src/api/news.openapi.dart';
import 'package:nextcloud/src/api/notes.openapi.dart';
@ -51,9 +52,8 @@ extension NotesVersionSupported on NotesClient {
(bool, int) isSupported(final CoreOcsGetCapabilitiesResponseApplicationJson_Ocs_Data capabilities) => (
capabilities.capabilities.notesCapabilities?.notes.apiVersion
?.map(Version.parse)
.where((final version) => version.major == notesSupportedVersion)
.isNotEmpty ??
false,
.firstWhereOrNull((final version) => version.major == notesSupportedVersion) !=
null,
notesSupportedVersion,
);
}

Loading…
Cancel
Save