Browse Source

perf(nextcloud): improve notes version supported performance

Signed-off-by: Nikolas Rimikis <leptopoda@users.noreply.github.com>
pull/874/head
Nikolas Rimikis 1 year ago
parent
commit
68a479041a
No known key found for this signature in database
GPG Key ID: 85ED1DE9786A4FF2
  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