implemented a comprehensive Nextcloud file sharing system with support for user, group, and public link shares with gating based on server-side permissions; added sharing management interfaces including a share sheet; updated the file list with visual badges for incoming shares and improved OCS API response handling.
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:hydrated_bloc/hydrated_bloc.dart';
|
||||
|
||||
import '../../../../../api/marianumcloud/capabilities/get_nextcloud_capabilities.dart';
|
||||
import 'nextcloud_capabilities_state.dart';
|
||||
|
||||
/// Holds the current user's Nextcloud `files_sharing` capabilities. Hydrated so
|
||||
/// the last known flags are available immediately on cold start (no
|
||||
/// feature-flicker) and offline. [load] refreshes them from the server after
|
||||
/// login. Same fail-safe contract as [CapabilitiesCubit]: a failed fetch keeps
|
||||
/// the cached flags and never silently grants a capability.
|
||||
class NextcloudCapabilitiesCubit
|
||||
extends HydratedCubit<NextcloudCapabilitiesState> {
|
||||
NextcloudCapabilitiesCubit() : super(const NextcloudCapabilitiesState());
|
||||
|
||||
/// Master switch — the user may create at least one kind of share.
|
||||
bool get canShareAtAll => state.apiEnabled;
|
||||
|
||||
/// User (person) shares are allowed whenever the share API is enabled;
|
||||
/// Nextcloud has no separate per-type toggle for them.
|
||||
bool get canShareWithUsers => state.apiEnabled;
|
||||
|
||||
bool get canShareWithGroups => state.apiEnabled && state.groupEnabled;
|
||||
|
||||
bool get canCreatePublicLinks => state.apiEnabled && state.publicEnabled;
|
||||
|
||||
bool get passwordEnforced => state.publicPasswordEnforced;
|
||||
|
||||
bool get expireEnforced =>
|
||||
state.publicExpireEnabled && state.publicExpireEnforced;
|
||||
|
||||
int? get expireDays => state.publicExpireDays;
|
||||
|
||||
bool get canReshare => state.resharing;
|
||||
|
||||
bool get allowsMultipleLinks => state.publicMultipleLinks;
|
||||
|
||||
bool get supportsFileDrop => state.publicUploadEnabled;
|
||||
|
||||
/// Human-readable summary of the server's link-password rules, or null if no
|
||||
/// rules are advertised. The breach-list ("non-common password") check is
|
||||
/// server-only and intentionally omitted — it can't be validated up front.
|
||||
String? get passwordPolicyHint {
|
||||
final parts = <String>[];
|
||||
final min = state.passwordMinLength;
|
||||
if (min != null && min > 0) parts.add('mind. $min Zeichen');
|
||||
if (state.passwordEnforceUpperLower) {
|
||||
parts.add('Groß- und Kleinbuchstaben');
|
||||
}
|
||||
if (state.passwordEnforceNumeric) parts.add('mind. eine Zahl');
|
||||
if (state.passwordEnforceSpecial) parts.add('mind. ein Sonderzeichen');
|
||||
if (parts.isEmpty) return null;
|
||||
return 'Anforderungen: ${parts.join(', ')}';
|
||||
}
|
||||
|
||||
/// Refreshes capabilities from the server. On any failure the previously
|
||||
/// hydrated flags are kept but the state is marked `loaded`.
|
||||
Future<void> load() async {
|
||||
try {
|
||||
final caps = await GetNextcloudCapabilities().run();
|
||||
emit(
|
||||
NextcloudCapabilitiesState(
|
||||
apiEnabled: caps.apiEnabled,
|
||||
publicEnabled: caps.publicEnabled,
|
||||
publicMultipleLinks: caps.publicMultipleLinks,
|
||||
publicUploadEnabled: caps.publicUploadEnabled,
|
||||
publicPasswordEnforced: caps.publicPasswordEnforced,
|
||||
publicExpireEnabled: caps.publicExpireEnabled,
|
||||
publicExpireDays: caps.publicExpireDays,
|
||||
publicExpireEnforced: caps.publicExpireEnforced,
|
||||
groupEnabled: caps.groupEnabled,
|
||||
resharing: caps.resharing,
|
||||
passwordMinLength: caps.passwordMinLength,
|
||||
passwordEnforceUpperLower: caps.passwordEnforceUpperLower,
|
||||
passwordEnforceNumeric: caps.passwordEnforceNumeric,
|
||||
passwordEnforceSpecial: caps.passwordEnforceSpecial,
|
||||
loaded: true,
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
log('Failed to load Nextcloud capabilities: $e');
|
||||
emit(state.copyWith(loaded: true));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> reset() async => emit(const NextcloudCapabilitiesState());
|
||||
|
||||
@override
|
||||
NextcloudCapabilitiesState fromJson(Map<String, dynamic> json) {
|
||||
try {
|
||||
return NextcloudCapabilitiesState.fromJson(json);
|
||||
} catch (_) {
|
||||
return const NextcloudCapabilitiesState();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, dynamic>? toJson(NextcloudCapabilitiesState state) =>
|
||||
state.toJson();
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'nextcloud_capabilities_state.freezed.dart';
|
||||
part 'nextcloud_capabilities_state.g.dart';
|
||||
|
||||
/// Hydrated snapshot of the user's Nextcloud `files_sharing` capabilities.
|
||||
/// Mirrors the fields the sharing UI gates on; see
|
||||
/// `NextcloudSharingCapabilities` for the per-field meaning.
|
||||
@freezed
|
||||
abstract class NextcloudCapabilitiesState with _$NextcloudCapabilitiesState {
|
||||
const factory NextcloudCapabilitiesState({
|
||||
@Default(false) bool apiEnabled,
|
||||
@Default(false) bool publicEnabled,
|
||||
@Default(false) bool publicMultipleLinks,
|
||||
@Default(false) bool publicUploadEnabled,
|
||||
@Default(false) bool publicPasswordEnforced,
|
||||
@Default(false) bool publicExpireEnabled,
|
||||
int? publicExpireDays,
|
||||
@Default(false) bool publicExpireEnforced,
|
||||
@Default(false) bool groupEnabled,
|
||||
@Default(false) bool resharing,
|
||||
int? passwordMinLength,
|
||||
@Default(false) bool passwordEnforceUpperLower,
|
||||
@Default(false) bool passwordEnforceNumeric,
|
||||
@Default(false) bool passwordEnforceSpecial,
|
||||
// Whether a capability response (or a definitive failure) has been observed
|
||||
// at least once this session.
|
||||
@Default(false) bool loaded,
|
||||
}) = _NextcloudCapabilitiesState;
|
||||
|
||||
factory NextcloudCapabilitiesState.fromJson(Map<String, Object?> json) =>
|
||||
_$NextcloudCapabilitiesStateFromJson(json);
|
||||
}
|
||||
+323
@@ -0,0 +1,323 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'nextcloud_capabilities_state.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$NextcloudCapabilitiesState {
|
||||
|
||||
bool get apiEnabled; bool get publicEnabled; bool get publicMultipleLinks; bool get publicUploadEnabled; bool get publicPasswordEnforced; bool get publicExpireEnabled; int? get publicExpireDays; bool get publicExpireEnforced; bool get groupEnabled; bool get resharing; int? get passwordMinLength; bool get passwordEnforceUpperLower; bool get passwordEnforceNumeric; bool get passwordEnforceSpecial;// Whether a capability response (or a definitive failure) has been observed
|
||||
// at least once this session.
|
||||
bool get loaded;
|
||||
/// Create a copy of NextcloudCapabilitiesState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$NextcloudCapabilitiesStateCopyWith<NextcloudCapabilitiesState> get copyWith => _$NextcloudCapabilitiesStateCopyWithImpl<NextcloudCapabilitiesState>(this as NextcloudCapabilitiesState, _$identity);
|
||||
|
||||
/// Serializes this NextcloudCapabilitiesState to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is NextcloudCapabilitiesState&&(identical(other.apiEnabled, apiEnabled) || other.apiEnabled == apiEnabled)&&(identical(other.publicEnabled, publicEnabled) || other.publicEnabled == publicEnabled)&&(identical(other.publicMultipleLinks, publicMultipleLinks) || other.publicMultipleLinks == publicMultipleLinks)&&(identical(other.publicUploadEnabled, publicUploadEnabled) || other.publicUploadEnabled == publicUploadEnabled)&&(identical(other.publicPasswordEnforced, publicPasswordEnforced) || other.publicPasswordEnforced == publicPasswordEnforced)&&(identical(other.publicExpireEnabled, publicExpireEnabled) || other.publicExpireEnabled == publicExpireEnabled)&&(identical(other.publicExpireDays, publicExpireDays) || other.publicExpireDays == publicExpireDays)&&(identical(other.publicExpireEnforced, publicExpireEnforced) || other.publicExpireEnforced == publicExpireEnforced)&&(identical(other.groupEnabled, groupEnabled) || other.groupEnabled == groupEnabled)&&(identical(other.resharing, resharing) || other.resharing == resharing)&&(identical(other.passwordMinLength, passwordMinLength) || other.passwordMinLength == passwordMinLength)&&(identical(other.passwordEnforceUpperLower, passwordEnforceUpperLower) || other.passwordEnforceUpperLower == passwordEnforceUpperLower)&&(identical(other.passwordEnforceNumeric, passwordEnforceNumeric) || other.passwordEnforceNumeric == passwordEnforceNumeric)&&(identical(other.passwordEnforceSpecial, passwordEnforceSpecial) || other.passwordEnforceSpecial == passwordEnforceSpecial)&&(identical(other.loaded, loaded) || other.loaded == loaded));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,apiEnabled,publicEnabled,publicMultipleLinks,publicUploadEnabled,publicPasswordEnforced,publicExpireEnabled,publicExpireDays,publicExpireEnforced,groupEnabled,resharing,passwordMinLength,passwordEnforceUpperLower,passwordEnforceNumeric,passwordEnforceSpecial,loaded);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'NextcloudCapabilitiesState(apiEnabled: $apiEnabled, publicEnabled: $publicEnabled, publicMultipleLinks: $publicMultipleLinks, publicUploadEnabled: $publicUploadEnabled, publicPasswordEnforced: $publicPasswordEnforced, publicExpireEnabled: $publicExpireEnabled, publicExpireDays: $publicExpireDays, publicExpireEnforced: $publicExpireEnforced, groupEnabled: $groupEnabled, resharing: $resharing, passwordMinLength: $passwordMinLength, passwordEnforceUpperLower: $passwordEnforceUpperLower, passwordEnforceNumeric: $passwordEnforceNumeric, passwordEnforceSpecial: $passwordEnforceSpecial, loaded: $loaded)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $NextcloudCapabilitiesStateCopyWith<$Res> {
|
||||
factory $NextcloudCapabilitiesStateCopyWith(NextcloudCapabilitiesState value, $Res Function(NextcloudCapabilitiesState) _then) = _$NextcloudCapabilitiesStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
bool apiEnabled, bool publicEnabled, bool publicMultipleLinks, bool publicUploadEnabled, bool publicPasswordEnforced, bool publicExpireEnabled, int? publicExpireDays, bool publicExpireEnforced, bool groupEnabled, bool resharing, int? passwordMinLength, bool passwordEnforceUpperLower, bool passwordEnforceNumeric, bool passwordEnforceSpecial, bool loaded
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$NextcloudCapabilitiesStateCopyWithImpl<$Res>
|
||||
implements $NextcloudCapabilitiesStateCopyWith<$Res> {
|
||||
_$NextcloudCapabilitiesStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final NextcloudCapabilitiesState _self;
|
||||
final $Res Function(NextcloudCapabilitiesState) _then;
|
||||
|
||||
/// Create a copy of NextcloudCapabilitiesState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? apiEnabled = null,Object? publicEnabled = null,Object? publicMultipleLinks = null,Object? publicUploadEnabled = null,Object? publicPasswordEnforced = null,Object? publicExpireEnabled = null,Object? publicExpireDays = freezed,Object? publicExpireEnforced = null,Object? groupEnabled = null,Object? resharing = null,Object? passwordMinLength = freezed,Object? passwordEnforceUpperLower = null,Object? passwordEnforceNumeric = null,Object? passwordEnforceSpecial = null,Object? loaded = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
apiEnabled: null == apiEnabled ? _self.apiEnabled : apiEnabled // ignore: cast_nullable_to_non_nullable
|
||||
as bool,publicEnabled: null == publicEnabled ? _self.publicEnabled : publicEnabled // ignore: cast_nullable_to_non_nullable
|
||||
as bool,publicMultipleLinks: null == publicMultipleLinks ? _self.publicMultipleLinks : publicMultipleLinks // ignore: cast_nullable_to_non_nullable
|
||||
as bool,publicUploadEnabled: null == publicUploadEnabled ? _self.publicUploadEnabled : publicUploadEnabled // ignore: cast_nullable_to_non_nullable
|
||||
as bool,publicPasswordEnforced: null == publicPasswordEnforced ? _self.publicPasswordEnforced : publicPasswordEnforced // ignore: cast_nullable_to_non_nullable
|
||||
as bool,publicExpireEnabled: null == publicExpireEnabled ? _self.publicExpireEnabled : publicExpireEnabled // ignore: cast_nullable_to_non_nullable
|
||||
as bool,publicExpireDays: freezed == publicExpireDays ? _self.publicExpireDays : publicExpireDays // ignore: cast_nullable_to_non_nullable
|
||||
as int?,publicExpireEnforced: null == publicExpireEnforced ? _self.publicExpireEnforced : publicExpireEnforced // ignore: cast_nullable_to_non_nullable
|
||||
as bool,groupEnabled: null == groupEnabled ? _self.groupEnabled : groupEnabled // ignore: cast_nullable_to_non_nullable
|
||||
as bool,resharing: null == resharing ? _self.resharing : resharing // ignore: cast_nullable_to_non_nullable
|
||||
as bool,passwordMinLength: freezed == passwordMinLength ? _self.passwordMinLength : passwordMinLength // ignore: cast_nullable_to_non_nullable
|
||||
as int?,passwordEnforceUpperLower: null == passwordEnforceUpperLower ? _self.passwordEnforceUpperLower : passwordEnforceUpperLower // ignore: cast_nullable_to_non_nullable
|
||||
as bool,passwordEnforceNumeric: null == passwordEnforceNumeric ? _self.passwordEnforceNumeric : passwordEnforceNumeric // ignore: cast_nullable_to_non_nullable
|
||||
as bool,passwordEnforceSpecial: null == passwordEnforceSpecial ? _self.passwordEnforceSpecial : passwordEnforceSpecial // ignore: cast_nullable_to_non_nullable
|
||||
as bool,loaded: null == loaded ? _self.loaded : loaded // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [NextcloudCapabilitiesState].
|
||||
extension NextcloudCapabilitiesStatePatterns on NextcloudCapabilitiesState {
|
||||
/// A variant of `map` that fallback to returning `orElse`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _NextcloudCapabilitiesState value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _NextcloudCapabilitiesState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// Callbacks receives the raw object, upcasted.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case final Subclass2 value:
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _NextcloudCapabilitiesState value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _NextcloudCapabilitiesState():
|
||||
return $default(_that);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `map` that fallback to returning `null`.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case final Subclass value:
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _NextcloudCapabilitiesState value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _NextcloudCapabilitiesState() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool apiEnabled, bool publicEnabled, bool publicMultipleLinks, bool publicUploadEnabled, bool publicPasswordEnforced, bool publicExpireEnabled, int? publicExpireDays, bool publicExpireEnforced, bool groupEnabled, bool resharing, int? passwordMinLength, bool passwordEnforceUpperLower, bool passwordEnforceNumeric, bool passwordEnforceSpecial, bool loaded)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _NextcloudCapabilitiesState() when $default != null:
|
||||
return $default(_that.apiEnabled,_that.publicEnabled,_that.publicMultipleLinks,_that.publicUploadEnabled,_that.publicPasswordEnforced,_that.publicExpireEnabled,_that.publicExpireDays,_that.publicExpireEnforced,_that.groupEnabled,_that.resharing,_that.passwordMinLength,_that.passwordEnforceUpperLower,_that.passwordEnforceNumeric,_that.passwordEnforceSpecial,_that.loaded);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool apiEnabled, bool publicEnabled, bool publicMultipleLinks, bool publicUploadEnabled, bool publicPasswordEnforced, bool publicExpireEnabled, int? publicExpireDays, bool publicExpireEnforced, bool groupEnabled, bool resharing, int? passwordMinLength, bool passwordEnforceUpperLower, bool passwordEnforceNumeric, bool passwordEnforceSpecial, bool loaded) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _NextcloudCapabilitiesState():
|
||||
return $default(_that.apiEnabled,_that.publicEnabled,_that.publicMultipleLinks,_that.publicUploadEnabled,_that.publicPasswordEnforced,_that.publicExpireEnabled,_that.publicExpireDays,_that.publicExpireEnforced,_that.groupEnabled,_that.resharing,_that.passwordMinLength,_that.passwordEnforceUpperLower,_that.passwordEnforceNumeric,_that.passwordEnforceSpecial,_that.loaded);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool apiEnabled, bool publicEnabled, bool publicMultipleLinks, bool publicUploadEnabled, bool publicPasswordEnforced, bool publicExpireEnabled, int? publicExpireDays, bool publicExpireEnforced, bool groupEnabled, bool resharing, int? passwordMinLength, bool passwordEnforceUpperLower, bool passwordEnforceNumeric, bool passwordEnforceSpecial, bool loaded)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _NextcloudCapabilitiesState() when $default != null:
|
||||
return $default(_that.apiEnabled,_that.publicEnabled,_that.publicMultipleLinks,_that.publicUploadEnabled,_that.publicPasswordEnforced,_that.publicExpireEnabled,_that.publicExpireDays,_that.publicExpireEnforced,_that.groupEnabled,_that.resharing,_that.passwordMinLength,_that.passwordEnforceUpperLower,_that.passwordEnforceNumeric,_that.passwordEnforceSpecial,_that.loaded);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _NextcloudCapabilitiesState implements NextcloudCapabilitiesState {
|
||||
const _NextcloudCapabilitiesState({this.apiEnabled = false, this.publicEnabled = false, this.publicMultipleLinks = false, this.publicUploadEnabled = false, this.publicPasswordEnforced = false, this.publicExpireEnabled = false, this.publicExpireDays, this.publicExpireEnforced = false, this.groupEnabled = false, this.resharing = false, this.passwordMinLength, this.passwordEnforceUpperLower = false, this.passwordEnforceNumeric = false, this.passwordEnforceSpecial = false, this.loaded = false});
|
||||
factory _NextcloudCapabilitiesState.fromJson(Map<String, dynamic> json) => _$NextcloudCapabilitiesStateFromJson(json);
|
||||
|
||||
@override@JsonKey() final bool apiEnabled;
|
||||
@override@JsonKey() final bool publicEnabled;
|
||||
@override@JsonKey() final bool publicMultipleLinks;
|
||||
@override@JsonKey() final bool publicUploadEnabled;
|
||||
@override@JsonKey() final bool publicPasswordEnforced;
|
||||
@override@JsonKey() final bool publicExpireEnabled;
|
||||
@override final int? publicExpireDays;
|
||||
@override@JsonKey() final bool publicExpireEnforced;
|
||||
@override@JsonKey() final bool groupEnabled;
|
||||
@override@JsonKey() final bool resharing;
|
||||
@override final int? passwordMinLength;
|
||||
@override@JsonKey() final bool passwordEnforceUpperLower;
|
||||
@override@JsonKey() final bool passwordEnforceNumeric;
|
||||
@override@JsonKey() final bool passwordEnforceSpecial;
|
||||
// Whether a capability response (or a definitive failure) has been observed
|
||||
// at least once this session.
|
||||
@override@JsonKey() final bool loaded;
|
||||
|
||||
/// Create a copy of NextcloudCapabilitiesState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$NextcloudCapabilitiesStateCopyWith<_NextcloudCapabilitiesState> get copyWith => __$NextcloudCapabilitiesStateCopyWithImpl<_NextcloudCapabilitiesState>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$NextcloudCapabilitiesStateToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _NextcloudCapabilitiesState&&(identical(other.apiEnabled, apiEnabled) || other.apiEnabled == apiEnabled)&&(identical(other.publicEnabled, publicEnabled) || other.publicEnabled == publicEnabled)&&(identical(other.publicMultipleLinks, publicMultipleLinks) || other.publicMultipleLinks == publicMultipleLinks)&&(identical(other.publicUploadEnabled, publicUploadEnabled) || other.publicUploadEnabled == publicUploadEnabled)&&(identical(other.publicPasswordEnforced, publicPasswordEnforced) || other.publicPasswordEnforced == publicPasswordEnforced)&&(identical(other.publicExpireEnabled, publicExpireEnabled) || other.publicExpireEnabled == publicExpireEnabled)&&(identical(other.publicExpireDays, publicExpireDays) || other.publicExpireDays == publicExpireDays)&&(identical(other.publicExpireEnforced, publicExpireEnforced) || other.publicExpireEnforced == publicExpireEnforced)&&(identical(other.groupEnabled, groupEnabled) || other.groupEnabled == groupEnabled)&&(identical(other.resharing, resharing) || other.resharing == resharing)&&(identical(other.passwordMinLength, passwordMinLength) || other.passwordMinLength == passwordMinLength)&&(identical(other.passwordEnforceUpperLower, passwordEnforceUpperLower) || other.passwordEnforceUpperLower == passwordEnforceUpperLower)&&(identical(other.passwordEnforceNumeric, passwordEnforceNumeric) || other.passwordEnforceNumeric == passwordEnforceNumeric)&&(identical(other.passwordEnforceSpecial, passwordEnforceSpecial) || other.passwordEnforceSpecial == passwordEnforceSpecial)&&(identical(other.loaded, loaded) || other.loaded == loaded));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,apiEnabled,publicEnabled,publicMultipleLinks,publicUploadEnabled,publicPasswordEnforced,publicExpireEnabled,publicExpireDays,publicExpireEnforced,groupEnabled,resharing,passwordMinLength,passwordEnforceUpperLower,passwordEnforceNumeric,passwordEnforceSpecial,loaded);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'NextcloudCapabilitiesState(apiEnabled: $apiEnabled, publicEnabled: $publicEnabled, publicMultipleLinks: $publicMultipleLinks, publicUploadEnabled: $publicUploadEnabled, publicPasswordEnforced: $publicPasswordEnforced, publicExpireEnabled: $publicExpireEnabled, publicExpireDays: $publicExpireDays, publicExpireEnforced: $publicExpireEnforced, groupEnabled: $groupEnabled, resharing: $resharing, passwordMinLength: $passwordMinLength, passwordEnforceUpperLower: $passwordEnforceUpperLower, passwordEnforceNumeric: $passwordEnforceNumeric, passwordEnforceSpecial: $passwordEnforceSpecial, loaded: $loaded)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$NextcloudCapabilitiesStateCopyWith<$Res> implements $NextcloudCapabilitiesStateCopyWith<$Res> {
|
||||
factory _$NextcloudCapabilitiesStateCopyWith(_NextcloudCapabilitiesState value, $Res Function(_NextcloudCapabilitiesState) _then) = __$NextcloudCapabilitiesStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
bool apiEnabled, bool publicEnabled, bool publicMultipleLinks, bool publicUploadEnabled, bool publicPasswordEnforced, bool publicExpireEnabled, int? publicExpireDays, bool publicExpireEnforced, bool groupEnabled, bool resharing, int? passwordMinLength, bool passwordEnforceUpperLower, bool passwordEnforceNumeric, bool passwordEnforceSpecial, bool loaded
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$NextcloudCapabilitiesStateCopyWithImpl<$Res>
|
||||
implements _$NextcloudCapabilitiesStateCopyWith<$Res> {
|
||||
__$NextcloudCapabilitiesStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _NextcloudCapabilitiesState _self;
|
||||
final $Res Function(_NextcloudCapabilitiesState) _then;
|
||||
|
||||
/// Create a copy of NextcloudCapabilitiesState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? apiEnabled = null,Object? publicEnabled = null,Object? publicMultipleLinks = null,Object? publicUploadEnabled = null,Object? publicPasswordEnforced = null,Object? publicExpireEnabled = null,Object? publicExpireDays = freezed,Object? publicExpireEnforced = null,Object? groupEnabled = null,Object? resharing = null,Object? passwordMinLength = freezed,Object? passwordEnforceUpperLower = null,Object? passwordEnforceNumeric = null,Object? passwordEnforceSpecial = null,Object? loaded = null,}) {
|
||||
return _then(_NextcloudCapabilitiesState(
|
||||
apiEnabled: null == apiEnabled ? _self.apiEnabled : apiEnabled // ignore: cast_nullable_to_non_nullable
|
||||
as bool,publicEnabled: null == publicEnabled ? _self.publicEnabled : publicEnabled // ignore: cast_nullable_to_non_nullable
|
||||
as bool,publicMultipleLinks: null == publicMultipleLinks ? _self.publicMultipleLinks : publicMultipleLinks // ignore: cast_nullable_to_non_nullable
|
||||
as bool,publicUploadEnabled: null == publicUploadEnabled ? _self.publicUploadEnabled : publicUploadEnabled // ignore: cast_nullable_to_non_nullable
|
||||
as bool,publicPasswordEnforced: null == publicPasswordEnforced ? _self.publicPasswordEnforced : publicPasswordEnforced // ignore: cast_nullable_to_non_nullable
|
||||
as bool,publicExpireEnabled: null == publicExpireEnabled ? _self.publicExpireEnabled : publicExpireEnabled // ignore: cast_nullable_to_non_nullable
|
||||
as bool,publicExpireDays: freezed == publicExpireDays ? _self.publicExpireDays : publicExpireDays // ignore: cast_nullable_to_non_nullable
|
||||
as int?,publicExpireEnforced: null == publicExpireEnforced ? _self.publicExpireEnforced : publicExpireEnforced // ignore: cast_nullable_to_non_nullable
|
||||
as bool,groupEnabled: null == groupEnabled ? _self.groupEnabled : groupEnabled // ignore: cast_nullable_to_non_nullable
|
||||
as bool,resharing: null == resharing ? _self.resharing : resharing // ignore: cast_nullable_to_non_nullable
|
||||
as bool,passwordMinLength: freezed == passwordMinLength ? _self.passwordMinLength : passwordMinLength // ignore: cast_nullable_to_non_nullable
|
||||
as int?,passwordEnforceUpperLower: null == passwordEnforceUpperLower ? _self.passwordEnforceUpperLower : passwordEnforceUpperLower // ignore: cast_nullable_to_non_nullable
|
||||
as bool,passwordEnforceNumeric: null == passwordEnforceNumeric ? _self.passwordEnforceNumeric : passwordEnforceNumeric // ignore: cast_nullable_to_non_nullable
|
||||
as bool,passwordEnforceSpecial: null == passwordEnforceSpecial ? _self.passwordEnforceSpecial : passwordEnforceSpecial // ignore: cast_nullable_to_non_nullable
|
||||
as bool,loaded: null == loaded ? _self.loaded : loaded // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,48 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'nextcloud_capabilities_state.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_NextcloudCapabilitiesState _$NextcloudCapabilitiesStateFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _NextcloudCapabilitiesState(
|
||||
apiEnabled: json['apiEnabled'] as bool? ?? false,
|
||||
publicEnabled: json['publicEnabled'] as bool? ?? false,
|
||||
publicMultipleLinks: json['publicMultipleLinks'] as bool? ?? false,
|
||||
publicUploadEnabled: json['publicUploadEnabled'] as bool? ?? false,
|
||||
publicPasswordEnforced: json['publicPasswordEnforced'] as bool? ?? false,
|
||||
publicExpireEnabled: json['publicExpireEnabled'] as bool? ?? false,
|
||||
publicExpireDays: (json['publicExpireDays'] as num?)?.toInt(),
|
||||
publicExpireEnforced: json['publicExpireEnforced'] as bool? ?? false,
|
||||
groupEnabled: json['groupEnabled'] as bool? ?? false,
|
||||
resharing: json['resharing'] as bool? ?? false,
|
||||
passwordMinLength: (json['passwordMinLength'] as num?)?.toInt(),
|
||||
passwordEnforceUpperLower:
|
||||
json['passwordEnforceUpperLower'] as bool? ?? false,
|
||||
passwordEnforceNumeric: json['passwordEnforceNumeric'] as bool? ?? false,
|
||||
passwordEnforceSpecial: json['passwordEnforceSpecial'] as bool? ?? false,
|
||||
loaded: json['loaded'] as bool? ?? false,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$NextcloudCapabilitiesStateToJson(
|
||||
_NextcloudCapabilitiesState instance,
|
||||
) => <String, dynamic>{
|
||||
'apiEnabled': instance.apiEnabled,
|
||||
'publicEnabled': instance.publicEnabled,
|
||||
'publicMultipleLinks': instance.publicMultipleLinks,
|
||||
'publicUploadEnabled': instance.publicUploadEnabled,
|
||||
'publicPasswordEnforced': instance.publicPasswordEnforced,
|
||||
'publicExpireEnabled': instance.publicExpireEnabled,
|
||||
'publicExpireDays': instance.publicExpireDays,
|
||||
'publicExpireEnforced': instance.publicExpireEnforced,
|
||||
'groupEnabled': instance.groupEnabled,
|
||||
'resharing': instance.resharing,
|
||||
'passwordMinLength': instance.passwordMinLength,
|
||||
'passwordEnforceUpperLower': instance.passwordEnforceUpperLower,
|
||||
'passwordEnforceNumeric': instance.passwordEnforceNumeric,
|
||||
'passwordEnforceSpecial': instance.passwordEnforceSpecial,
|
||||
'loaded': instance.loaded,
|
||||
};
|
||||
Reference in New Issue
Block a user