Skip to content

Commit 93ddf29

Browse files
committed
feat(nextcloud): Allow overriding the version check supported value
Signed-off-by: provokateurin <kate@provokateurin.de>
1 parent 0ffcab9 commit 93ddf29

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/nextcloud/lib/src/helpers/common.dart

+10-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ class VersionCheck {
1111
required this.versions,
1212
required this.minimumVersion,
1313
required int? maximumMajor,
14-
}) : maximumMajor = maximumMajor ?? minimumVersion.major;
14+
bool? isSupportedOverride,
15+
}) : maximumMajor = maximumMajor ?? minimumVersion.major,
16+
_isSupportedOverride = isSupportedOverride;
1517

1618
/// Current version of the app.
1719
final List<Version>? versions;
@@ -22,11 +24,18 @@ class VersionCheck {
2224
/// Maximum major version of the app.
2325
late final int maximumMajor;
2426

27+
/// Overrides the check if the current version is supported.
28+
final bool? _isSupportedOverride;
29+
2530
/// Whether the [versions] is allowed by the [minimumVersion] and [maximumMajor].
2631
///
2732
/// If [versions] is `null` or empty it is assumed that the app is supported.
2833
/// Only one of the [versions] has to be supported to return `true`.
2934
bool get isSupported {
35+
if (_isSupportedOverride != null) {
36+
return _isSupportedOverride!;
37+
}
38+
3039
if (versions == null || versions!.isEmpty) {
3140
return true;
3241
}

0 commit comments

Comments
 (0)