Skip to content

Commit

Permalink
fixup! feat(tool,nextcloud): Add spreed
Browse files Browse the repository at this point in the history
  • Loading branch information
provokateurin committed Oct 30, 2023
1 parent 631c881 commit 9f65aff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions packages/nextcloud/lib/src/helpers/spreed.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:nextcloud/nextcloud.dart';
import 'package:nextcloud/src/api/core.openapi.dart' as core;
import 'package:nextcloud/src/api/spreed.openapi.dart' as spreed;
import 'package:version/version.dart';
Expand All @@ -10,11 +11,11 @@ extension SpreedVersionSupported on spreed.Client {
/// Checks whether the spreed app installed on the server is supported by this client.
///
/// Also returns the supported version number.
Future<(bool, int)> isSupported(final core.OcsGetCapabilitiesResponseApplicationJson_Ocs_Data capabilities) async {
VersionSupported<int> isSupported(final core.OcsGetCapabilitiesResponseApplicationJson_Ocs_Data capabilities) {
final version = capabilities.capabilities.spreedPublicCapabilities?.spreedPublicCapabilities0?.spreed.version;
return (
version != null && Version.parse(version).major == supportedVersion,
supportedVersion,
isSupported: version != null && Version.parse(version).major == supportedVersion,
minimumVersion: supportedVersion,
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/nextcloud/test/spreed_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ void main() {
expect(response.statusCode, 200);
expect(() => response.headers, isA<void>());

final (supported, _) = await client1.spreed.isSupported(response.body.ocs.data);
expect(supported, isTrue);
final result = client1.spreed.isSupported(response.body.ocs.data);
expect(result.isSupported, isTrue);
});

test('Participant permissions', () async {
Expand Down

0 comments on commit 9f65aff

Please sign in to comment.