From e8f85729d2b70fdce606c44500564d9aadb7288b Mon Sep 17 00:00:00 2001 From: CodeDoctorDE Date: Mon, 13 Nov 2023 15:09:29 +0100 Subject: [PATCH 01/14] Add notebook model --- api/lib/converters/ical.dart | 5 +- api/lib/models/cached.dart | 5 + api/lib/models/cached.freezed.dart | 74 +++-- api/lib/models/cached.g.dart | 11 +- api/lib/models/event/item/model.freezed.dart | 133 ++++----- api/lib/models/event/item/model.g.dart | 24 +- api/lib/models/event/model.freezed.dart | 39 +-- api/lib/models/event/model.g.dart | 5 +- api/lib/models/extra.freezed.dart | 47 ++-- api/lib/models/extra.g.dart | 8 +- api/lib/models/group/model.freezed.dart | 39 +-- api/lib/models/group/model.g.dart | 5 +- api/lib/models/label/model.freezed.dart | 39 +-- api/lib/models/label/model.g.dart | 5 +- api/lib/models/model.freezed.dart | 39 +-- api/lib/models/note/model.dart | 25 +- api/lib/models/note/model.freezed.dart | 275 ++++++++++++++++--- api/lib/models/note/model.g.dart | 48 ++-- api/lib/models/place/model.freezed.dart | 39 +-- api/lib/models/place/model.g.dart | 5 +- api/lib/models/user/model.freezed.dart | 38 +-- api/lib/models/user/model.g.dart | 5 +- api/pubspec.yaml | 2 +- app/lib/api/storage/remote/caldav.dart | 15 +- 24 files changed, 615 insertions(+), 315 deletions(-) diff --git a/api/lib/converters/ical.dart b/api/lib/converters/ical.dart index 62e1bbfd749..48df23dd5f2 100644 --- a/api/lib/converters/ical.dart +++ b/api/lib/converters/ical.dart @@ -9,7 +9,7 @@ class ICalConverter { ICalConverter([this.data]); - void read(List lines, [Event? event]) { + void read(List lines, {Event? event, Notebook? notebook}) { final offset = lines.indexWhere((element) => element.trim() == 'BEGIN:VCALENDAR'); if (offset == -1) { @@ -19,6 +19,7 @@ class ICalConverter { Note? currentNote; final items = List.from(data?.items ?? []); var currentEvent = event ?? Event(id: createUniqueMultihash()); + var currentNotebook = notebook ?? Notebook(id: createUniqueMultihash()); final notes = List.from(data?.notes ?? []); for (int i = offset; i < lines.length; i++) { final line = lines[i]; @@ -73,7 +74,7 @@ class ICalConverter { eventId: currentEvent.id, ); } else if (value == 'VTODO') { - currentNote = Note(); + currentNote = Note(notebookId: currentNotebook.id!); } continue; case 'END': diff --git a/api/lib/models/cached.dart b/api/lib/models/cached.dart index 98cf71b1700..96ce97e3f98 100644 --- a/api/lib/models/cached.dart +++ b/api/lib/models/cached.dart @@ -14,6 +14,7 @@ class CachedData with _$CachedData { const factory CachedData({ DateTime? lastUpdated, @Default([]) List events, + @Default([]) List notebooks, @Default([]) List items, @Default([]) List notes, }) = _CachedData; @@ -28,6 +29,10 @@ class CachedData with _$CachedData { ...events, ...other.events.where((e) => !events.any((e2) => e2.id == e.id)) ], + notebooks: [ + ...notebooks, + ...other.notebooks.where((e) => !notebooks.any((e2) => e2.id == e.id)) + ], items: [ ...items, ...other.items.where((e) => !items.any((e2) => e2.id == e.id)) diff --git a/api/lib/models/cached.freezed.dart b/api/lib/models/cached.freezed.dart index 1367aa6c894..e0419f555f7 100644 --- a/api/lib/models/cached.freezed.dart +++ b/api/lib/models/cached.freezed.dart @@ -22,6 +22,7 @@ CachedData _$CachedDataFromJson(Map json) { mixin _$CachedData { DateTime? get lastUpdated => throw _privateConstructorUsedError; List get events => throw _privateConstructorUsedError; + List get notebooks => throw _privateConstructorUsedError; List get items => throw _privateConstructorUsedError; List get notes => throw _privateConstructorUsedError; @@ -40,6 +41,7 @@ abstract class $CachedDataCopyWith<$Res> { $Res call( {DateTime? lastUpdated, List events, + List notebooks, List items, List notes}); } @@ -59,6 +61,7 @@ class _$CachedDataCopyWithImpl<$Res, $Val extends CachedData> $Res call({ Object? lastUpdated = freezed, Object? events = null, + Object? notebooks = null, Object? items = null, Object? notes = null, }) { @@ -71,6 +74,10 @@ class _$CachedDataCopyWithImpl<$Res, $Val extends CachedData> ? _value.events : events // ignore: cast_nullable_to_non_nullable as List, + notebooks: null == notebooks + ? _value.notebooks + : notebooks // ignore: cast_nullable_to_non_nullable + as List, items: null == items ? _value.items : items // ignore: cast_nullable_to_non_nullable @@ -84,26 +91,27 @@ class _$CachedDataCopyWithImpl<$Res, $Val extends CachedData> } /// @nodoc -abstract class _$$_CachedDataCopyWith<$Res> +abstract class _$$CachedDataImplCopyWith<$Res> implements $CachedDataCopyWith<$Res> { - factory _$$_CachedDataCopyWith( - _$_CachedData value, $Res Function(_$_CachedData) then) = - __$$_CachedDataCopyWithImpl<$Res>; + factory _$$CachedDataImplCopyWith( + _$CachedDataImpl value, $Res Function(_$CachedDataImpl) then) = + __$$CachedDataImplCopyWithImpl<$Res>; @override @useResult $Res call( {DateTime? lastUpdated, List events, + List notebooks, List items, List notes}); } /// @nodoc -class __$$_CachedDataCopyWithImpl<$Res> - extends _$CachedDataCopyWithImpl<$Res, _$_CachedData> - implements _$$_CachedDataCopyWith<$Res> { - __$$_CachedDataCopyWithImpl( - _$_CachedData _value, $Res Function(_$_CachedData) _then) +class __$$CachedDataImplCopyWithImpl<$Res> + extends _$CachedDataCopyWithImpl<$Res, _$CachedDataImpl> + implements _$$CachedDataImplCopyWith<$Res> { + __$$CachedDataImplCopyWithImpl( + _$CachedDataImpl _value, $Res Function(_$CachedDataImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -111,10 +119,11 @@ class __$$_CachedDataCopyWithImpl<$Res> $Res call({ Object? lastUpdated = freezed, Object? events = null, + Object? notebooks = null, Object? items = null, Object? notes = null, }) { - return _then(_$_CachedData( + return _then(_$CachedDataImpl( lastUpdated: freezed == lastUpdated ? _value.lastUpdated : lastUpdated // ignore: cast_nullable_to_non_nullable @@ -123,6 +132,10 @@ class __$$_CachedDataCopyWithImpl<$Res> ? _value._events : events // ignore: cast_nullable_to_non_nullable as List, + notebooks: null == notebooks + ? _value._notebooks + : notebooks // ignore: cast_nullable_to_non_nullable + as List, items: null == items ? _value._items : items // ignore: cast_nullable_to_non_nullable @@ -137,19 +150,21 @@ class __$$_CachedDataCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$_CachedData extends _CachedData { - const _$_CachedData( +class _$CachedDataImpl extends _CachedData { + const _$CachedDataImpl( {this.lastUpdated, final List events = const [], + final List notebooks = const [], final List items = const [], final List notes = const []}) : _events = events, + _notebooks = notebooks, _items = items, _notes = notes, super._(); - factory _$_CachedData.fromJson(Map json) => - _$$_CachedDataFromJson(json); + factory _$CachedDataImpl.fromJson(Map json) => + _$$CachedDataImplFromJson(json); @override final DateTime? lastUpdated; @@ -162,6 +177,15 @@ class _$_CachedData extends _CachedData { return EqualUnmodifiableListView(_events); } + final List _notebooks; + @override + @JsonKey() + List get notebooks { + if (_notebooks is EqualUnmodifiableListView) return _notebooks; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_notebooks); + } + final List _items; @override @JsonKey() @@ -182,17 +206,19 @@ class _$_CachedData extends _CachedData { @override String toString() { - return 'CachedData(lastUpdated: $lastUpdated, events: $events, items: $items, notes: $notes)'; + return 'CachedData(lastUpdated: $lastUpdated, events: $events, notebooks: $notebooks, items: $items, notes: $notes)'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$_CachedData && + other is _$CachedDataImpl && (identical(other.lastUpdated, lastUpdated) || other.lastUpdated == lastUpdated) && const DeepCollectionEquality().equals(other._events, _events) && + const DeepCollectionEquality() + .equals(other._notebooks, _notebooks) && const DeepCollectionEquality().equals(other._items, _items) && const DeepCollectionEquality().equals(other._notes, _notes)); } @@ -203,18 +229,19 @@ class _$_CachedData extends _CachedData { runtimeType, lastUpdated, const DeepCollectionEquality().hash(_events), + const DeepCollectionEquality().hash(_notebooks), const DeepCollectionEquality().hash(_items), const DeepCollectionEquality().hash(_notes)); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$_CachedDataCopyWith<_$_CachedData> get copyWith => - __$$_CachedDataCopyWithImpl<_$_CachedData>(this, _$identity); + _$$CachedDataImplCopyWith<_$CachedDataImpl> get copyWith => + __$$CachedDataImplCopyWithImpl<_$CachedDataImpl>(this, _$identity); @override Map toJson() { - return _$$_CachedDataToJson( + return _$$CachedDataImplToJson( this, ); } @@ -224,23 +251,26 @@ abstract class _CachedData extends CachedData { const factory _CachedData( {final DateTime? lastUpdated, final List events, + final List notebooks, final List items, - final List notes}) = _$_CachedData; + final List notes}) = _$CachedDataImpl; const _CachedData._() : super._(); factory _CachedData.fromJson(Map json) = - _$_CachedData.fromJson; + _$CachedDataImpl.fromJson; @override DateTime? get lastUpdated; @override List get events; @override + List get notebooks; + @override List get items; @override List get notes; @override @JsonKey(ignore: true) - _$$_CachedDataCopyWith<_$_CachedData> get copyWith => + _$$CachedDataImplCopyWith<_$CachedDataImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/api/lib/models/cached.g.dart b/api/lib/models/cached.g.dart index 58a09f8819c..c119556320a 100644 --- a/api/lib/models/cached.g.dart +++ b/api/lib/models/cached.g.dart @@ -6,8 +6,8 @@ part of 'cached.dart'; // JsonSerializableGenerator // ************************************************************************** -_$_CachedData _$$_CachedDataFromJson(Map json) => - _$_CachedData( +_$CachedDataImpl _$$CachedDataImplFromJson(Map json) => + _$CachedDataImpl( lastUpdated: json['lastUpdated'] == null ? null : DateTime.parse(json['lastUpdated'] as String), @@ -15,6 +15,10 @@ _$_CachedData _$$_CachedDataFromJson(Map json) => ?.map((e) => Event.fromJson(e as Map)) .toList() ?? const [], + notebooks: (json['notebooks'] as List?) + ?.map((e) => Notebook.fromJson(e as Map)) + .toList() ?? + const [], items: (json['items'] as List?) ?.map((e) => CalendarItem.fromJson(e as Map)) .toList() ?? @@ -25,10 +29,11 @@ _$_CachedData _$$_CachedDataFromJson(Map json) => const [], ); -Map _$$_CachedDataToJson(_$_CachedData instance) => +Map _$$CachedDataImplToJson(_$CachedDataImpl instance) => { 'lastUpdated': instance.lastUpdated?.toIso8601String(), 'events': instance.events, + 'notebooks': instance.notebooks, 'items': instance.items, 'notes': instance.notes, }; diff --git a/api/lib/models/event/item/model.freezed.dart b/api/lib/models/event/item/model.freezed.dart index c896970eb00..b7b2d50ce3e 100644 --- a/api/lib/models/event/item/model.freezed.dart +++ b/api/lib/models/event/item/model.freezed.dart @@ -278,11 +278,11 @@ class _$CalendarItemCopyWithImpl<$Res, $Val extends CalendarItem> } /// @nodoc -abstract class _$$FixedCalendarItemCopyWith<$Res> +abstract class _$$FixedCalendarItemImplCopyWith<$Res> implements $CalendarItemCopyWith<$Res> { - factory _$$FixedCalendarItemCopyWith( - _$FixedCalendarItem value, $Res Function(_$FixedCalendarItem) then) = - __$$FixedCalendarItemCopyWithImpl<$Res>; + factory _$$FixedCalendarItemImplCopyWith(_$FixedCalendarItemImpl value, + $Res Function(_$FixedCalendarItemImpl) then) = + __$$FixedCalendarItemImplCopyWithImpl<$Res>; @override @useResult $Res call( @@ -297,11 +297,11 @@ abstract class _$$FixedCalendarItemCopyWith<$Res> } /// @nodoc -class __$$FixedCalendarItemCopyWithImpl<$Res> - extends _$CalendarItemCopyWithImpl<$Res, _$FixedCalendarItem> - implements _$$FixedCalendarItemCopyWith<$Res> { - __$$FixedCalendarItemCopyWithImpl( - _$FixedCalendarItem _value, $Res Function(_$FixedCalendarItem) _then) +class __$$FixedCalendarItemImplCopyWithImpl<$Res> + extends _$CalendarItemCopyWithImpl<$Res, _$FixedCalendarItemImpl> + implements _$$FixedCalendarItemImplCopyWith<$Res> { + __$$FixedCalendarItemImplCopyWithImpl(_$FixedCalendarItemImpl _value, + $Res Function(_$FixedCalendarItemImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -316,7 +316,7 @@ class __$$FixedCalendarItemCopyWithImpl<$Res> Object? start = freezed, Object? end = freezed, }) { - return _then(_$FixedCalendarItem( + return _then(_$FixedCalendarItemImpl( id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable @@ -355,8 +355,8 @@ class __$$FixedCalendarItemCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$FixedCalendarItem extends FixedCalendarItem { - const _$FixedCalendarItem( +class _$FixedCalendarItemImpl extends FixedCalendarItem { + const _$FixedCalendarItemImpl( {@MultihashConverter() this.id, this.name = '', this.description = '', @@ -369,8 +369,8 @@ class _$FixedCalendarItem extends FixedCalendarItem { : $type = $type ?? 'fixed', super._(); - factory _$FixedCalendarItem.fromJson(Map json) => - _$$FixedCalendarItemFromJson(json); + factory _$FixedCalendarItemImpl.fromJson(Map json) => + _$$FixedCalendarItemImplFromJson(json); @override @MultihashConverter() @@ -409,7 +409,7 @@ class _$FixedCalendarItem extends FixedCalendarItem { bool operator ==(dynamic other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$FixedCalendarItem && + other is _$FixedCalendarItemImpl && (identical(other.id, id) || other.id == id) && (identical(other.name, name) || other.name == name) && (identical(other.description, description) || @@ -430,8 +430,9 @@ class _$FixedCalendarItem extends FixedCalendarItem { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$FixedCalendarItemCopyWith<_$FixedCalendarItem> get copyWith => - __$$FixedCalendarItemCopyWithImpl<_$FixedCalendarItem>(this, _$identity); + _$$FixedCalendarItemImplCopyWith<_$FixedCalendarItemImpl> get copyWith => + __$$FixedCalendarItemImplCopyWithImpl<_$FixedCalendarItemImpl>( + this, _$identity); @override @optionalTypeArgs @@ -613,7 +614,7 @@ class _$FixedCalendarItem extends FixedCalendarItem { @override Map toJson() { - return _$$FixedCalendarItemToJson( + return _$$FixedCalendarItemImplToJson( this, ); } @@ -628,11 +629,11 @@ abstract class FixedCalendarItem extends CalendarItem { @MultihashConverter() final Multihash? eventId, final EventStatus status, @DateTimeConverter() final DateTime? start, - @DateTimeConverter() final DateTime? end}) = _$FixedCalendarItem; + @DateTimeConverter() final DateTime? end}) = _$FixedCalendarItemImpl; const FixedCalendarItem._() : super._(); factory FixedCalendarItem.fromJson(Map json) = - _$FixedCalendarItem.fromJson; + _$FixedCalendarItemImpl.fromJson; @override @MultihashConverter() @@ -656,16 +657,17 @@ abstract class FixedCalendarItem extends CalendarItem { DateTime? get end; @override @JsonKey(ignore: true) - _$$FixedCalendarItemCopyWith<_$FixedCalendarItem> get copyWith => + _$$FixedCalendarItemImplCopyWith<_$FixedCalendarItemImpl> get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class _$$RepeatingCalendarItemCopyWith<$Res> +abstract class _$$RepeatingCalendarItemImplCopyWith<$Res> implements $CalendarItemCopyWith<$Res> { - factory _$$RepeatingCalendarItemCopyWith(_$RepeatingCalendarItem value, - $Res Function(_$RepeatingCalendarItem) then) = - __$$RepeatingCalendarItemCopyWithImpl<$Res>; + factory _$$RepeatingCalendarItemImplCopyWith( + _$RepeatingCalendarItemImpl value, + $Res Function(_$RepeatingCalendarItemImpl) then) = + __$$RepeatingCalendarItemImplCopyWithImpl<$Res>; @override @useResult $Res call( @@ -686,11 +688,11 @@ abstract class _$$RepeatingCalendarItemCopyWith<$Res> } /// @nodoc -class __$$RepeatingCalendarItemCopyWithImpl<$Res> - extends _$CalendarItemCopyWithImpl<$Res, _$RepeatingCalendarItem> - implements _$$RepeatingCalendarItemCopyWith<$Res> { - __$$RepeatingCalendarItemCopyWithImpl(_$RepeatingCalendarItem _value, - $Res Function(_$RepeatingCalendarItem) _then) +class __$$RepeatingCalendarItemImplCopyWithImpl<$Res> + extends _$CalendarItemCopyWithImpl<$Res, _$RepeatingCalendarItemImpl> + implements _$$RepeatingCalendarItemImplCopyWith<$Res> { + __$$RepeatingCalendarItemImplCopyWithImpl(_$RepeatingCalendarItemImpl _value, + $Res Function(_$RepeatingCalendarItemImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -711,7 +713,7 @@ class __$$RepeatingCalendarItemCopyWithImpl<$Res> Object? until = freezed, Object? exceptions = null, }) { - return _then(_$RepeatingCalendarItem( + return _then(_$RepeatingCalendarItemImpl( id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable @@ -774,8 +776,8 @@ class __$$RepeatingCalendarItemCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$RepeatingCalendarItem extends RepeatingCalendarItem { - const _$RepeatingCalendarItem( +class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { + const _$RepeatingCalendarItemImpl( {@MultihashConverter() this.id, this.name = '', this.description = '', @@ -795,8 +797,8 @@ class _$RepeatingCalendarItem extends RepeatingCalendarItem { $type = $type ?? 'repeating', super._(); - factory _$RepeatingCalendarItem.fromJson(Map json) => - _$$RepeatingCalendarItemFromJson(json); + factory _$RepeatingCalendarItemImpl.fromJson(Map json) => + _$$RepeatingCalendarItemImplFromJson(json); @override @MultihashConverter() @@ -858,7 +860,7 @@ class _$RepeatingCalendarItem extends RepeatingCalendarItem { bool operator ==(dynamic other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$RepeatingCalendarItem && + other is _$RepeatingCalendarItemImpl && (identical(other.id, id) || other.id == id) && (identical(other.name, name) || other.name == name) && (identical(other.description, description) || @@ -903,9 +905,9 @@ class _$RepeatingCalendarItem extends RepeatingCalendarItem { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$RepeatingCalendarItemCopyWith<_$RepeatingCalendarItem> get copyWith => - __$$RepeatingCalendarItemCopyWithImpl<_$RepeatingCalendarItem>( - this, _$identity); + _$$RepeatingCalendarItemImplCopyWith<_$RepeatingCalendarItemImpl> + get copyWith => __$$RepeatingCalendarItemImplCopyWithImpl< + _$RepeatingCalendarItemImpl>(this, _$identity); @override @optionalTypeArgs @@ -1088,7 +1090,7 @@ class _$RepeatingCalendarItem extends RepeatingCalendarItem { @override Map toJson() { - return _$$RepeatingCalendarItemToJson( + return _$$RepeatingCalendarItemImplToJson( this, ); } @@ -1109,11 +1111,11 @@ abstract class RepeatingCalendarItem extends CalendarItem { final int variation, final int count, @DateTimeConverter() final DateTime? until, - final List exceptions}) = _$RepeatingCalendarItem; + final List exceptions}) = _$RepeatingCalendarItemImpl; const RepeatingCalendarItem._() : super._(); factory RepeatingCalendarItem.fromJson(Map json) = - _$RepeatingCalendarItem.fromJson; + _$RepeatingCalendarItemImpl.fromJson; @override @MultihashConverter() @@ -1144,16 +1146,16 @@ abstract class RepeatingCalendarItem extends CalendarItem { List get exceptions; @override @JsonKey(ignore: true) - _$$RepeatingCalendarItemCopyWith<_$RepeatingCalendarItem> get copyWith => - throw _privateConstructorUsedError; + _$$RepeatingCalendarItemImplCopyWith<_$RepeatingCalendarItemImpl> + get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class _$$AutoCalendarItemCopyWith<$Res> +abstract class _$$AutoCalendarItemImplCopyWith<$Res> implements $CalendarItemCopyWith<$Res> { - factory _$$AutoCalendarItemCopyWith( - _$AutoCalendarItem value, $Res Function(_$AutoCalendarItem) then) = - __$$AutoCalendarItemCopyWithImpl<$Res>; + factory _$$AutoCalendarItemImplCopyWith(_$AutoCalendarItemImpl value, + $Res Function(_$AutoCalendarItemImpl) then) = + __$$AutoCalendarItemImplCopyWithImpl<$Res>; @override @useResult $Res call( @@ -1171,11 +1173,11 @@ abstract class _$$AutoCalendarItemCopyWith<$Res> } /// @nodoc -class __$$AutoCalendarItemCopyWithImpl<$Res> - extends _$CalendarItemCopyWithImpl<$Res, _$AutoCalendarItem> - implements _$$AutoCalendarItemCopyWith<$Res> { - __$$AutoCalendarItemCopyWithImpl( - _$AutoCalendarItem _value, $Res Function(_$AutoCalendarItem) _then) +class __$$AutoCalendarItemImplCopyWithImpl<$Res> + extends _$CalendarItemCopyWithImpl<$Res, _$AutoCalendarItemImpl> + implements _$$AutoCalendarItemImplCopyWith<$Res> { + __$$AutoCalendarItemImplCopyWithImpl(_$AutoCalendarItemImpl _value, + $Res Function(_$AutoCalendarItemImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -1193,7 +1195,7 @@ class __$$AutoCalendarItemCopyWithImpl<$Res> Object? searchStart = freezed, Object? autoDuration = null, }) { - return _then(_$AutoCalendarItem( + return _then(_$AutoCalendarItemImpl( id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable @@ -1244,8 +1246,8 @@ class __$$AutoCalendarItemCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$AutoCalendarItem extends AutoCalendarItem { - const _$AutoCalendarItem( +class _$AutoCalendarItemImpl extends AutoCalendarItem { + const _$AutoCalendarItemImpl( {@MultihashConverter() this.id, this.name = '', this.description = '', @@ -1261,8 +1263,8 @@ class _$AutoCalendarItem extends AutoCalendarItem { : $type = $type ?? 'auto', super._(); - factory _$AutoCalendarItem.fromJson(Map json) => - _$$AutoCalendarItemFromJson(json); + factory _$AutoCalendarItemImpl.fromJson(Map json) => + _$$AutoCalendarItemImplFromJson(json); @override @MultihashConverter() @@ -1310,7 +1312,7 @@ class _$AutoCalendarItem extends AutoCalendarItem { bool operator ==(dynamic other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$AutoCalendarItem && + other is _$AutoCalendarItemImpl && (identical(other.id, id) || other.id == id) && (identical(other.name, name) || other.name == name) && (identical(other.description, description) || @@ -1337,8 +1339,9 @@ class _$AutoCalendarItem extends AutoCalendarItem { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$AutoCalendarItemCopyWith<_$AutoCalendarItem> get copyWith => - __$$AutoCalendarItemCopyWithImpl<_$AutoCalendarItem>(this, _$identity); + _$$AutoCalendarItemImplCopyWith<_$AutoCalendarItemImpl> get copyWith => + __$$AutoCalendarItemImplCopyWithImpl<_$AutoCalendarItemImpl>( + this, _$identity); @override @optionalTypeArgs @@ -1521,7 +1524,7 @@ class _$AutoCalendarItem extends AutoCalendarItem { @override Map toJson() { - return _$$AutoCalendarItemToJson( + return _$$AutoCalendarItemImplToJson( this, ); } @@ -1539,11 +1542,11 @@ abstract class AutoCalendarItem extends CalendarItem { @DateTimeConverter() final DateTime? end, @MultihashConverter() final Multihash? autoGroupId, @DateTimeConverter() final DateTime? searchStart, - final int autoDuration}) = _$AutoCalendarItem; + final int autoDuration}) = _$AutoCalendarItemImpl; const AutoCalendarItem._() : super._(); factory AutoCalendarItem.fromJson(Map json) = - _$AutoCalendarItem.fromJson; + _$AutoCalendarItemImpl.fromJson; @override @MultihashConverter() @@ -1572,6 +1575,6 @@ abstract class AutoCalendarItem extends CalendarItem { int get autoDuration; @override @JsonKey(ignore: true) - _$$AutoCalendarItemCopyWith<_$AutoCalendarItem> get copyWith => + _$$AutoCalendarItemImplCopyWith<_$AutoCalendarItemImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/api/lib/models/event/item/model.g.dart b/api/lib/models/event/item/model.g.dart index e382aebf57c..5a702c0b663 100644 --- a/api/lib/models/event/item/model.g.dart +++ b/api/lib/models/event/item/model.g.dart @@ -6,8 +6,9 @@ part of 'model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$FixedCalendarItem _$$FixedCalendarItemFromJson(Map json) => - _$FixedCalendarItem( +_$FixedCalendarItemImpl _$$FixedCalendarItemImplFromJson( + Map json) => + _$FixedCalendarItemImpl( id: _$JsonConverterFromJson, Multihash>( json['id'], const MultihashConverter().fromJson), name: json['name'] as String? ?? '', @@ -22,7 +23,8 @@ _$FixedCalendarItem _$$FixedCalendarItemFromJson(Map json) => $type: json['runtimeType'] as String?, ); -Map _$$FixedCalendarItemToJson(_$FixedCalendarItem instance) => +Map _$$FixedCalendarItemImplToJson( + _$FixedCalendarItemImpl instance) => { 'id': _$JsonConverterToJson, Multihash>( instance.id, const MultihashConverter().toJson), @@ -55,9 +57,9 @@ Json? _$JsonConverterToJson( ) => value == null ? null : toJson(value); -_$RepeatingCalendarItem _$$RepeatingCalendarItemFromJson( +_$RepeatingCalendarItemImpl _$$RepeatingCalendarItemImplFromJson( Map json) => - _$RepeatingCalendarItem( + _$RepeatingCalendarItemImpl( id: _$JsonConverterFromJson, Multihash>( json['id'], const MultihashConverter().fromJson), name: json['name'] as String? ?? '', @@ -83,8 +85,8 @@ _$RepeatingCalendarItem _$$RepeatingCalendarItemFromJson( $type: json['runtimeType'] as String?, ); -Map _$$RepeatingCalendarItemToJson( - _$RepeatingCalendarItem instance) => +Map _$$RepeatingCalendarItemImplToJson( + _$RepeatingCalendarItemImpl instance) => { 'id': _$JsonConverterToJson, Multihash>( instance.id, const MultihashConverter().toJson), @@ -112,8 +114,9 @@ const _$RepeatTypeEnumMap = { RepeatType.yearly: 'yearly', }; -_$AutoCalendarItem _$$AutoCalendarItemFromJson(Map json) => - _$AutoCalendarItem( +_$AutoCalendarItemImpl _$$AutoCalendarItemImplFromJson( + Map json) => + _$AutoCalendarItemImpl( id: _$JsonConverterFromJson, Multihash>( json['id'], const MultihashConverter().fromJson), name: json['name'] as String? ?? '', @@ -133,7 +136,8 @@ _$AutoCalendarItem _$$AutoCalendarItemFromJson(Map json) => $type: json['runtimeType'] as String?, ); -Map _$$AutoCalendarItemToJson(_$AutoCalendarItem instance) => +Map _$$AutoCalendarItemImplToJson( + _$AutoCalendarItemImpl instance) => { 'id': _$JsonConverterToJson, Multihash>( instance.id, const MultihashConverter().toJson), diff --git a/api/lib/models/event/model.freezed.dart b/api/lib/models/event/model.freezed.dart index ebf0d66b58f..82760b57317 100644 --- a/api/lib/models/event/model.freezed.dart +++ b/api/lib/models/event/model.freezed.dart @@ -121,9 +121,10 @@ class _$EventCopyWithImpl<$Res, $Val extends Event> } /// @nodoc -abstract class _$$_EventCopyWith<$Res> implements $EventCopyWith<$Res> { - factory _$$_EventCopyWith(_$_Event value, $Res Function(_$_Event) then) = - __$$_EventCopyWithImpl<$Res>; +abstract class _$$EventImplCopyWith<$Res> implements $EventCopyWith<$Res> { + factory _$$EventImplCopyWith( + _$EventImpl value, $Res Function(_$EventImpl) then) = + __$$EventImplCopyWithImpl<$Res>; @override @useResult $Res call( @@ -139,9 +140,11 @@ abstract class _$$_EventCopyWith<$Res> implements $EventCopyWith<$Res> { } /// @nodoc -class __$$_EventCopyWithImpl<$Res> extends _$EventCopyWithImpl<$Res, _$_Event> - implements _$$_EventCopyWith<$Res> { - __$$_EventCopyWithImpl(_$_Event _value, $Res Function(_$_Event) _then) +class __$$EventImplCopyWithImpl<$Res> + extends _$EventCopyWithImpl<$Res, _$EventImpl> + implements _$$EventImplCopyWith<$Res> { + __$$EventImplCopyWithImpl( + _$EventImpl _value, $Res Function(_$EventImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -157,7 +160,7 @@ class __$$_EventCopyWithImpl<$Res> extends _$EventCopyWithImpl<$Res, _$_Event> Object? location = null, Object? extra = freezed, }) { - return _then(_$_Event( + return _then(_$EventImpl( id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable @@ -200,8 +203,8 @@ class __$$_EventCopyWithImpl<$Res> extends _$EventCopyWithImpl<$Res, _$_Event> /// @nodoc @JsonSerializable() -class _$_Event extends _Event { - const _$_Event( +class _$EventImpl extends _Event { + const _$EventImpl( {@MultihashConverter() this.id, @MultihashConverter() this.parentId, @MultihashConverter() this.groupId, @@ -213,8 +216,8 @@ class _$_Event extends _Event { this.extra}) : super._(); - factory _$_Event.fromJson(Map json) => - _$$_EventFromJson(json); + factory _$EventImpl.fromJson(Map json) => + _$$EventImplFromJson(json); @override @MultihashConverter() @@ -252,7 +255,7 @@ class _$_Event extends _Event { bool operator ==(dynamic other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$_Event && + other is _$EventImpl && (identical(other.id, id) || other.id == id) && (identical(other.parentId, parentId) || other.parentId == parentId) && @@ -275,12 +278,12 @@ class _$_Event extends _Event { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$_EventCopyWith<_$_Event> get copyWith => - __$$_EventCopyWithImpl<_$_Event>(this, _$identity); + _$$EventImplCopyWith<_$EventImpl> get copyWith => + __$$EventImplCopyWithImpl<_$EventImpl>(this, _$identity); @override Map toJson() { - return _$$_EventToJson( + return _$$EventImplToJson( this, ); } @@ -296,10 +299,10 @@ abstract class _Event extends Event implements DescriptiveModel { final String name, final String description, final String location, - final String? extra}) = _$_Event; + final String? extra}) = _$EventImpl; const _Event._() : super._(); - factory _Event.fromJson(Map json) = _$_Event.fromJson; + factory _Event.fromJson(Map json) = _$EventImpl.fromJson; @override @MultihashConverter() @@ -325,6 +328,6 @@ abstract class _Event extends Event implements DescriptiveModel { String? get extra; @override @JsonKey(ignore: true) - _$$_EventCopyWith<_$_Event> get copyWith => + _$$EventImplCopyWith<_$EventImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/api/lib/models/event/model.g.dart b/api/lib/models/event/model.g.dart index 54ccd0a58a9..ab0b7218828 100644 --- a/api/lib/models/event/model.g.dart +++ b/api/lib/models/event/model.g.dart @@ -6,7 +6,7 @@ part of 'model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$_Event _$$_EventFromJson(Map json) => _$_Event( +_$EventImpl _$$EventImplFromJson(Map json) => _$EventImpl( id: _$JsonConverterFromJson, Multihash>( json['id'], const MultihashConverter().fromJson), parentId: _$JsonConverterFromJson, Multihash>( @@ -22,7 +22,8 @@ _$_Event _$$_EventFromJson(Map json) => _$_Event( extra: json['extra'] as String?, ); -Map _$$_EventToJson(_$_Event instance) => { +Map _$$EventImplToJson(_$EventImpl instance) => + { 'id': _$JsonConverterToJson, Multihash>( instance.id, const MultihashConverter().toJson), 'parentId': _$JsonConverterToJson, Multihash>( diff --git a/api/lib/models/extra.freezed.dart b/api/lib/models/extra.freezed.dart index e8686c38a74..a86dcd2b09d 100644 --- a/api/lib/models/extra.freezed.dart +++ b/api/lib/models/extra.freezed.dart @@ -99,22 +99,23 @@ class _$ExtraPropertiesCopyWithImpl<$Res, $Val extends ExtraProperties> } /// @nodoc -abstract class _$$CalDavExtraPropertiesCopyWith<$Res> +abstract class _$$CalDavExtraPropertiesImplCopyWith<$Res> implements $ExtraPropertiesCopyWith<$Res> { - factory _$$CalDavExtraPropertiesCopyWith(_$CalDavExtraProperties value, - $Res Function(_$CalDavExtraProperties) then) = - __$$CalDavExtraPropertiesCopyWithImpl<$Res>; + factory _$$CalDavExtraPropertiesImplCopyWith( + _$CalDavExtraPropertiesImpl value, + $Res Function(_$CalDavExtraPropertiesImpl) then) = + __$$CalDavExtraPropertiesImplCopyWithImpl<$Res>; @override @useResult $Res call({String etag, String path}); } /// @nodoc -class __$$CalDavExtraPropertiesCopyWithImpl<$Res> - extends _$ExtraPropertiesCopyWithImpl<$Res, _$CalDavExtraProperties> - implements _$$CalDavExtraPropertiesCopyWith<$Res> { - __$$CalDavExtraPropertiesCopyWithImpl(_$CalDavExtraProperties _value, - $Res Function(_$CalDavExtraProperties) _then) +class __$$CalDavExtraPropertiesImplCopyWithImpl<$Res> + extends _$ExtraPropertiesCopyWithImpl<$Res, _$CalDavExtraPropertiesImpl> + implements _$$CalDavExtraPropertiesImplCopyWith<$Res> { + __$$CalDavExtraPropertiesImplCopyWithImpl(_$CalDavExtraPropertiesImpl _value, + $Res Function(_$CalDavExtraPropertiesImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -123,7 +124,7 @@ class __$$CalDavExtraPropertiesCopyWithImpl<$Res> Object? etag = null, Object? path = null, }) { - return _then(_$CalDavExtraProperties( + return _then(_$CalDavExtraPropertiesImpl( etag: null == etag ? _value.etag : etag // ignore: cast_nullable_to_non_nullable @@ -138,11 +139,11 @@ class __$$CalDavExtraPropertiesCopyWithImpl<$Res> /// @nodoc @JsonSerializable() -class _$CalDavExtraProperties implements CalDavExtraProperties { - const _$CalDavExtraProperties({required this.etag, required this.path}); +class _$CalDavExtraPropertiesImpl implements CalDavExtraProperties { + const _$CalDavExtraPropertiesImpl({required this.etag, required this.path}); - factory _$CalDavExtraProperties.fromJson(Map json) => - _$$CalDavExtraPropertiesFromJson(json); + factory _$CalDavExtraPropertiesImpl.fromJson(Map json) => + _$$CalDavExtraPropertiesImplFromJson(json); @override final String etag; @@ -158,7 +159,7 @@ class _$CalDavExtraProperties implements CalDavExtraProperties { bool operator ==(dynamic other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$CalDavExtraProperties && + other is _$CalDavExtraPropertiesImpl && (identical(other.etag, etag) || other.etag == etag) && (identical(other.path, path) || other.path == path)); } @@ -170,9 +171,9 @@ class _$CalDavExtraProperties implements CalDavExtraProperties { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$CalDavExtraPropertiesCopyWith<_$CalDavExtraProperties> get copyWith => - __$$CalDavExtraPropertiesCopyWithImpl<_$CalDavExtraProperties>( - this, _$identity); + _$$CalDavExtraPropertiesImplCopyWith<_$CalDavExtraPropertiesImpl> + get copyWith => __$$CalDavExtraPropertiesImplCopyWithImpl< + _$CalDavExtraPropertiesImpl>(this, _$identity); @override @optionalTypeArgs @@ -232,7 +233,7 @@ class _$CalDavExtraProperties implements CalDavExtraProperties { @override Map toJson() { - return _$$CalDavExtraPropertiesToJson( + return _$$CalDavExtraPropertiesImplToJson( this, ); } @@ -241,10 +242,10 @@ class _$CalDavExtraProperties implements CalDavExtraProperties { abstract class CalDavExtraProperties implements ExtraProperties { const factory CalDavExtraProperties( {required final String etag, - required final String path}) = _$CalDavExtraProperties; + required final String path}) = _$CalDavExtraPropertiesImpl; factory CalDavExtraProperties.fromJson(Map json) = - _$CalDavExtraProperties.fromJson; + _$CalDavExtraPropertiesImpl.fromJson; @override String get etag; @@ -252,6 +253,6 @@ abstract class CalDavExtraProperties implements ExtraProperties { String get path; @override @JsonKey(ignore: true) - _$$CalDavExtraPropertiesCopyWith<_$CalDavExtraProperties> get copyWith => - throw _privateConstructorUsedError; + _$$CalDavExtraPropertiesImplCopyWith<_$CalDavExtraPropertiesImpl> + get copyWith => throw _privateConstructorUsedError; } diff --git a/api/lib/models/extra.g.dart b/api/lib/models/extra.g.dart index bbe324a4b62..71a9409c83a 100644 --- a/api/lib/models/extra.g.dart +++ b/api/lib/models/extra.g.dart @@ -6,15 +6,15 @@ part of 'extra.dart'; // JsonSerializableGenerator // ************************************************************************** -_$CalDavExtraProperties _$$CalDavExtraPropertiesFromJson( +_$CalDavExtraPropertiesImpl _$$CalDavExtraPropertiesImplFromJson( Map json) => - _$CalDavExtraProperties( + _$CalDavExtraPropertiesImpl( etag: json['etag'] as String, path: json['path'] as String, ); -Map _$$CalDavExtraPropertiesToJson( - _$CalDavExtraProperties instance) => +Map _$$CalDavExtraPropertiesImplToJson( + _$CalDavExtraPropertiesImpl instance) => { 'etag': instance.etag, 'path': instance.path, diff --git a/api/lib/models/group/model.freezed.dart b/api/lib/models/group/model.freezed.dart index e217de1975f..914c20015d6 100644 --- a/api/lib/models/group/model.freezed.dart +++ b/api/lib/models/group/model.freezed.dart @@ -84,9 +84,10 @@ class _$GroupCopyWithImpl<$Res, $Val extends Group> } /// @nodoc -abstract class _$$_GroupCopyWith<$Res> implements $GroupCopyWith<$Res> { - factory _$$_GroupCopyWith(_$_Group value, $Res Function(_$_Group) then) = - __$$_GroupCopyWithImpl<$Res>; +abstract class _$$GroupImplCopyWith<$Res> implements $GroupCopyWith<$Res> { + factory _$$GroupImplCopyWith( + _$GroupImpl value, $Res Function(_$GroupImpl) then) = + __$$GroupImplCopyWithImpl<$Res>; @override @useResult $Res call( @@ -97,9 +98,11 @@ abstract class _$$_GroupCopyWith<$Res> implements $GroupCopyWith<$Res> { } /// @nodoc -class __$$_GroupCopyWithImpl<$Res> extends _$GroupCopyWithImpl<$Res, _$_Group> - implements _$$_GroupCopyWith<$Res> { - __$$_GroupCopyWithImpl(_$_Group _value, $Res Function(_$_Group) _then) +class __$$GroupImplCopyWithImpl<$Res> + extends _$GroupCopyWithImpl<$Res, _$GroupImpl> + implements _$$GroupImplCopyWith<$Res> { + __$$GroupImplCopyWithImpl( + _$GroupImpl _value, $Res Function(_$GroupImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -110,7 +113,7 @@ class __$$_GroupCopyWithImpl<$Res> extends _$GroupCopyWithImpl<$Res, _$_Group> Object? description = null, Object? parentId = freezed, }) { - return _then(_$_Group( + return _then(_$GroupImpl( id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable @@ -133,16 +136,16 @@ class __$$_GroupCopyWithImpl<$Res> extends _$GroupCopyWithImpl<$Res, _$_Group> /// @nodoc @JsonSerializable() -class _$_Group extends _Group { - const _$_Group( +class _$GroupImpl extends _Group { + const _$GroupImpl( {@MultihashConverter() this.id, this.name = '', this.description = '', @MultihashConverter() this.parentId}) : super._(); - factory _$_Group.fromJson(Map json) => - _$$_GroupFromJson(json); + factory _$GroupImpl.fromJson(Map json) => + _$$GroupImplFromJson(json); @override @MultihashConverter() @@ -166,7 +169,7 @@ class _$_Group extends _Group { bool operator ==(dynamic other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$_Group && + other is _$GroupImpl && (identical(other.id, id) || other.id == id) && (identical(other.name, name) || other.name == name) && (identical(other.description, description) || @@ -182,12 +185,12 @@ class _$_Group extends _Group { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$_GroupCopyWith<_$_Group> get copyWith => - __$$_GroupCopyWithImpl<_$_Group>(this, _$identity); + _$$GroupImplCopyWith<_$GroupImpl> get copyWith => + __$$GroupImplCopyWithImpl<_$GroupImpl>(this, _$identity); @override Map toJson() { - return _$$_GroupToJson( + return _$$GroupImplToJson( this, ); } @@ -198,10 +201,10 @@ abstract class _Group extends Group implements DescriptiveModel { {@MultihashConverter() final Multihash? id, final String name, final String description, - @MultihashConverter() final Multihash? parentId}) = _$_Group; + @MultihashConverter() final Multihash? parentId}) = _$GroupImpl; const _Group._() : super._(); - factory _Group.fromJson(Map json) = _$_Group.fromJson; + factory _Group.fromJson(Map json) = _$GroupImpl.fromJson; @override @MultihashConverter() @@ -215,6 +218,6 @@ abstract class _Group extends Group implements DescriptiveModel { Multihash? get parentId; @override @JsonKey(ignore: true) - _$$_GroupCopyWith<_$_Group> get copyWith => + _$$GroupImplCopyWith<_$GroupImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/api/lib/models/group/model.g.dart b/api/lib/models/group/model.g.dart index 7a6406d6844..5c3f130d936 100644 --- a/api/lib/models/group/model.g.dart +++ b/api/lib/models/group/model.g.dart @@ -6,7 +6,7 @@ part of 'model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$_Group _$$_GroupFromJson(Map json) => _$_Group( +_$GroupImpl _$$GroupImplFromJson(Map json) => _$GroupImpl( id: _$JsonConverterFromJson, Multihash>( json['id'], const MultihashConverter().fromJson), name: json['name'] as String? ?? '', @@ -15,7 +15,8 @@ _$_Group _$$_GroupFromJson(Map json) => _$_Group( json['parentId'], const MultihashConverter().fromJson), ); -Map _$$_GroupToJson(_$_Group instance) => { +Map _$$GroupImplToJson(_$GroupImpl instance) => + { 'id': _$JsonConverterToJson, Multihash>( instance.id, const MultihashConverter().toJson), 'name': instance.name, diff --git a/api/lib/models/label/model.freezed.dart b/api/lib/models/label/model.freezed.dart index 17bb2c5b374..0a636a64348 100644 --- a/api/lib/models/label/model.freezed.dart +++ b/api/lib/models/label/model.freezed.dart @@ -83,9 +83,10 @@ class _$LabelCopyWithImpl<$Res, $Val extends Label> } /// @nodoc -abstract class _$$_LabelCopyWith<$Res> implements $LabelCopyWith<$Res> { - factory _$$_LabelCopyWith(_$_Label value, $Res Function(_$_Label) then) = - __$$_LabelCopyWithImpl<$Res>; +abstract class _$$LabelImplCopyWith<$Res> implements $LabelCopyWith<$Res> { + factory _$$LabelImplCopyWith( + _$LabelImpl value, $Res Function(_$LabelImpl) then) = + __$$LabelImplCopyWithImpl<$Res>; @override @useResult $Res call( @@ -96,9 +97,11 @@ abstract class _$$_LabelCopyWith<$Res> implements $LabelCopyWith<$Res> { } /// @nodoc -class __$$_LabelCopyWithImpl<$Res> extends _$LabelCopyWithImpl<$Res, _$_Label> - implements _$$_LabelCopyWith<$Res> { - __$$_LabelCopyWithImpl(_$_Label _value, $Res Function(_$_Label) _then) +class __$$LabelImplCopyWithImpl<$Res> + extends _$LabelCopyWithImpl<$Res, _$LabelImpl> + implements _$$LabelImplCopyWith<$Res> { + __$$LabelImplCopyWithImpl( + _$LabelImpl _value, $Res Function(_$LabelImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -109,7 +112,7 @@ class __$$_LabelCopyWithImpl<$Res> extends _$LabelCopyWithImpl<$Res, _$_Label> Object? description = null, Object? color = null, }) { - return _then(_$_Label( + return _then(_$LabelImpl( id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable @@ -132,16 +135,16 @@ class __$$_LabelCopyWithImpl<$Res> extends _$LabelCopyWithImpl<$Res, _$_Label> /// @nodoc @JsonSerializable() -class _$_Label extends _Label { - const _$_Label( +class _$LabelImpl extends _Label { + const _$LabelImpl( {@MultihashConverter() this.id, this.name = '', this.description = '', this.color = kColorBlack}) : super._(); - factory _$_Label.fromJson(Map json) => - _$$_LabelFromJson(json); + factory _$LabelImpl.fromJson(Map json) => + _$$LabelImplFromJson(json); @override @MultihashConverter() @@ -165,7 +168,7 @@ class _$_Label extends _Label { bool operator ==(dynamic other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$_Label && + other is _$LabelImpl && (identical(other.id, id) || other.id == id) && (identical(other.name, name) || other.name == name) && (identical(other.description, description) || @@ -180,12 +183,12 @@ class _$_Label extends _Label { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$_LabelCopyWith<_$_Label> get copyWith => - __$$_LabelCopyWithImpl<_$_Label>(this, _$identity); + _$$LabelImplCopyWith<_$LabelImpl> get copyWith => + __$$LabelImplCopyWithImpl<_$LabelImpl>(this, _$identity); @override Map toJson() { - return _$$_LabelToJson( + return _$$LabelImplToJson( this, ); } @@ -196,10 +199,10 @@ abstract class _Label extends Label implements DescriptiveModel { {@MultihashConverter() final Multihash? id, final String name, final String description, - final int color}) = _$_Label; + final int color}) = _$LabelImpl; const _Label._() : super._(); - factory _Label.fromJson(Map json) = _$_Label.fromJson; + factory _Label.fromJson(Map json) = _$LabelImpl.fromJson; @override @MultihashConverter() @@ -212,6 +215,6 @@ abstract class _Label extends Label implements DescriptiveModel { int get color; @override @JsonKey(ignore: true) - _$$_LabelCopyWith<_$_Label> get copyWith => + _$$LabelImplCopyWith<_$LabelImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/api/lib/models/label/model.g.dart b/api/lib/models/label/model.g.dart index 89a5117add7..2d57bb0f1c0 100644 --- a/api/lib/models/label/model.g.dart +++ b/api/lib/models/label/model.g.dart @@ -6,7 +6,7 @@ part of 'model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$_Label _$$_LabelFromJson(Map json) => _$_Label( +_$LabelImpl _$$LabelImplFromJson(Map json) => _$LabelImpl( id: _$JsonConverterFromJson, Multihash>( json['id'], const MultihashConverter().fromJson), name: json['name'] as String? ?? '', @@ -14,7 +14,8 @@ _$_Label _$$_LabelFromJson(Map json) => _$_Label( color: json['color'] as int? ?? kColorBlack, ); -Map _$$_LabelToJson(_$_Label instance) => { +Map _$$LabelImplToJson(_$LabelImpl instance) => + { 'id': _$JsonConverterToJson, Multihash>( instance.id, const MultihashConverter().toJson), 'name': instance.name, diff --git a/api/lib/models/model.freezed.dart b/api/lib/models/model.freezed.dart index 4c5d732e4e4..4d582bd44af 100644 --- a/api/lib/models/model.freezed.dart +++ b/api/lib/models/model.freezed.dart @@ -64,22 +64,22 @@ class _$ConnectedModelCopyWithImpl +abstract class _$$ConnectedModelImplCopyWith implements $ConnectedModelCopyWith { - factory _$$_ConnectedModelCopyWith(_$_ConnectedModel value, - $Res Function(_$_ConnectedModel) then) = - __$$_ConnectedModelCopyWithImpl; + factory _$$ConnectedModelImplCopyWith(_$ConnectedModelImpl value, + $Res Function(_$ConnectedModelImpl) then) = + __$$ConnectedModelImplCopyWithImpl; @override @useResult $Res call({A source, B model}); } /// @nodoc -class __$$_ConnectedModelCopyWithImpl - extends _$ConnectedModelCopyWithImpl> - implements _$$_ConnectedModelCopyWith { - __$$_ConnectedModelCopyWithImpl(_$_ConnectedModel _value, - $Res Function(_$_ConnectedModel) _then) +class __$$ConnectedModelImplCopyWithImpl + extends _$ConnectedModelCopyWithImpl> + implements _$$ConnectedModelImplCopyWith { + __$$ConnectedModelImplCopyWithImpl(_$ConnectedModelImpl _value, + $Res Function(_$ConnectedModelImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -88,7 +88,7 @@ class __$$_ConnectedModelCopyWithImpl Object? source = freezed, Object? model = freezed, }) { - return _then(_$_ConnectedModel( + return _then(_$ConnectedModelImpl( freezed == source ? _value.source : source // ignore: cast_nullable_to_non_nullable @@ -103,8 +103,8 @@ class __$$_ConnectedModelCopyWithImpl /// @nodoc -class _$_ConnectedModel extends _ConnectedModel { - const _$_ConnectedModel(this.source, this.model) : super._(); +class _$ConnectedModelImpl extends _ConnectedModel { + const _$ConnectedModelImpl(this.source, this.model) : super._(); @override final A source; @@ -120,7 +120,7 @@ class _$_ConnectedModel extends _ConnectedModel { bool operator ==(dynamic other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$_ConnectedModel && + other is _$ConnectedModelImpl && const DeepCollectionEquality().equals(other.source, source) && const DeepCollectionEquality().equals(other.model, model)); } @@ -134,14 +134,15 @@ class _$_ConnectedModel extends _ConnectedModel { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$_ConnectedModelCopyWith> get copyWith => - __$$_ConnectedModelCopyWithImpl>( - this, _$identity); + _$$ConnectedModelImplCopyWith> + get copyWith => + __$$ConnectedModelImplCopyWithImpl>( + this, _$identity); } abstract class _ConnectedModel extends ConnectedModel { const factory _ConnectedModel(final A source, final B model) = - _$_ConnectedModel; + _$ConnectedModelImpl; const _ConnectedModel._() : super._(); @override @@ -150,6 +151,6 @@ abstract class _ConnectedModel extends ConnectedModel { B get model; @override @JsonKey(ignore: true) - _$$_ConnectedModelCopyWith> get copyWith => - throw _privateConstructorUsedError; + _$$ConnectedModelImplCopyWith> + get copyWith => throw _privateConstructorUsedError; } diff --git a/api/lib/models/note/model.dart b/api/lib/models/note/model.dart index 6cab44a1550..15e738f2a9e 100644 --- a/api/lib/models/note/model.dart +++ b/api/lib/models/note/model.dart @@ -7,14 +7,37 @@ import '../model.dart'; part 'model.freezed.dart'; part 'model.g.dart'; +@freezed +class Notebook with _$Notebook { + const Notebook._(); + + @Implements() + const factory Notebook({ + @MultihashConverter() Multihash? id, + @Default('') String name, + @Default('') String description, + }) = _Notebook; + + factory Notebook.fromJson(Map json) => + _$NotebookFromJson(json); + + factory Notebook.fromDatabase(Map row) => Notebook.fromJson({ + ...row, + }); + + Map toDatabase() => { + ...toJson(), + }; +} + @freezed class Note with _$Note { const Note._(); @Implements() const factory Note({ + @MultihashConverter() required Multihash notebookId, @MultihashConverter() Multihash? id, - @MultihashConverter() Multihash? parentId, @Default('') String name, @Default('') String description, NoteStatus? status, diff --git a/api/lib/models/note/model.freezed.dart b/api/lib/models/note/model.freezed.dart index 21d52539089..3d23035ca2d 100644 --- a/api/lib/models/note/model.freezed.dart +++ b/api/lib/models/note/model.freezed.dart @@ -14,6 +14,187 @@ T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); +Notebook _$NotebookFromJson(Map json) { + return _Notebook.fromJson(json); +} + +/// @nodoc +mixin _$Notebook { + @MultihashConverter() + Multihash? get id => throw _privateConstructorUsedError; + String get name => throw _privateConstructorUsedError; + String get description => throw _privateConstructorUsedError; + + Map toJson() => throw _privateConstructorUsedError; + @JsonKey(ignore: true) + $NotebookCopyWith get copyWith => + throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class $NotebookCopyWith<$Res> { + factory $NotebookCopyWith(Notebook value, $Res Function(Notebook) then) = + _$NotebookCopyWithImpl<$Res, Notebook>; + @useResult + $Res call( + {@MultihashConverter() Multihash? id, String name, String description}); +} + +/// @nodoc +class _$NotebookCopyWithImpl<$Res, $Val extends Notebook> + implements $NotebookCopyWith<$Res> { + _$NotebookCopyWithImpl(this._value, this._then); + + // ignore: unused_field + final $Val _value; + // ignore: unused_field + final $Res Function($Val) _then; + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = freezed, + Object? name = null, + Object? description = null, + }) { + return _then(_value.copyWith( + id: freezed == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as Multihash?, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + description: null == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String, + ) as $Val); + } +} + +/// @nodoc +abstract class _$$NotebookImplCopyWith<$Res> + implements $NotebookCopyWith<$Res> { + factory _$$NotebookImplCopyWith( + _$NotebookImpl value, $Res Function(_$NotebookImpl) then) = + __$$NotebookImplCopyWithImpl<$Res>; + @override + @useResult + $Res call( + {@MultihashConverter() Multihash? id, String name, String description}); +} + +/// @nodoc +class __$$NotebookImplCopyWithImpl<$Res> + extends _$NotebookCopyWithImpl<$Res, _$NotebookImpl> + implements _$$NotebookImplCopyWith<$Res> { + __$$NotebookImplCopyWithImpl( + _$NotebookImpl _value, $Res Function(_$NotebookImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? id = freezed, + Object? name = null, + Object? description = null, + }) { + return _then(_$NotebookImpl( + id: freezed == id + ? _value.id + : id // ignore: cast_nullable_to_non_nullable + as Multihash?, + name: null == name + ? _value.name + : name // ignore: cast_nullable_to_non_nullable + as String, + description: null == description + ? _value.description + : description // ignore: cast_nullable_to_non_nullable + as String, + )); + } +} + +/// @nodoc +@JsonSerializable() +class _$NotebookImpl extends _Notebook { + const _$NotebookImpl( + {@MultihashConverter() this.id, this.name = '', this.description = ''}) + : super._(); + + factory _$NotebookImpl.fromJson(Map json) => + _$$NotebookImplFromJson(json); + + @override + @MultihashConverter() + final Multihash? id; + @override + @JsonKey() + final String name; + @override + @JsonKey() + final String description; + + @override + String toString() { + return 'Notebook(id: $id, name: $name, description: $description)'; + } + + @override + bool operator ==(dynamic other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$NotebookImpl && + (identical(other.id, id) || other.id == id) && + (identical(other.name, name) || other.name == name) && + (identical(other.description, description) || + other.description == description)); + } + + @JsonKey(ignore: true) + @override + int get hashCode => Object.hash(runtimeType, id, name, description); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$NotebookImplCopyWith<_$NotebookImpl> get copyWith => + __$$NotebookImplCopyWithImpl<_$NotebookImpl>(this, _$identity); + + @override + Map toJson() { + return _$$NotebookImplToJson( + this, + ); + } +} + +abstract class _Notebook extends Notebook implements DescriptiveModel { + const factory _Notebook( + {@MultihashConverter() final Multihash? id, + final String name, + final String description}) = _$NotebookImpl; + const _Notebook._() : super._(); + + factory _Notebook.fromJson(Map json) = + _$NotebookImpl.fromJson; + + @override + @MultihashConverter() + Multihash? get id; + @override + String get name; + @override + String get description; + @override + @JsonKey(ignore: true) + _$$NotebookImplCopyWith<_$NotebookImpl> get copyWith => + throw _privateConstructorUsedError; +} + Note _$NoteFromJson(Map json) { return _Note.fromJson(json); } @@ -21,9 +202,9 @@ Note _$NoteFromJson(Map json) { /// @nodoc mixin _$Note { @MultihashConverter() - Multihash? get id => throw _privateConstructorUsedError; + Multihash get notebookId => throw _privateConstructorUsedError; @MultihashConverter() - Multihash? get parentId => throw _privateConstructorUsedError; + Multihash? get id => throw _privateConstructorUsedError; String get name => throw _privateConstructorUsedError; String get description => throw _privateConstructorUsedError; NoteStatus? get status => throw _privateConstructorUsedError; @@ -40,8 +221,8 @@ abstract class $NoteCopyWith<$Res> { _$NoteCopyWithImpl<$Res, Note>; @useResult $Res call( - {@MultihashConverter() Multihash? id, - @MultihashConverter() Multihash? parentId, + {@MultihashConverter() Multihash notebookId, + @MultihashConverter() Multihash? id, String name, String description, NoteStatus? status, @@ -61,22 +242,22 @@ class _$NoteCopyWithImpl<$Res, $Val extends Note> @pragma('vm:prefer-inline') @override $Res call({ + Object? notebookId = null, Object? id = freezed, - Object? parentId = freezed, Object? name = null, Object? description = null, Object? status = freezed, Object? priority = null, }) { return _then(_value.copyWith( + notebookId: null == notebookId + ? _value.notebookId + : notebookId // ignore: cast_nullable_to_non_nullable + as Multihash, id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable as Multihash?, - parentId: freezed == parentId - ? _value.parentId - : parentId // ignore: cast_nullable_to_non_nullable - as Multihash?, name: null == name ? _value.name : name // ignore: cast_nullable_to_non_nullable @@ -98,14 +279,15 @@ class _$NoteCopyWithImpl<$Res, $Val extends Note> } /// @nodoc -abstract class _$$_NoteCopyWith<$Res> implements $NoteCopyWith<$Res> { - factory _$$_NoteCopyWith(_$_Note value, $Res Function(_$_Note) then) = - __$$_NoteCopyWithImpl<$Res>; +abstract class _$$NoteImplCopyWith<$Res> implements $NoteCopyWith<$Res> { + factory _$$NoteImplCopyWith( + _$NoteImpl value, $Res Function(_$NoteImpl) then) = + __$$NoteImplCopyWithImpl<$Res>; @override @useResult $Res call( - {@MultihashConverter() Multihash? id, - @MultihashConverter() Multihash? parentId, + {@MultihashConverter() Multihash notebookId, + @MultihashConverter() Multihash? id, String name, String description, NoteStatus? status, @@ -113,30 +295,31 @@ abstract class _$$_NoteCopyWith<$Res> implements $NoteCopyWith<$Res> { } /// @nodoc -class __$$_NoteCopyWithImpl<$Res> extends _$NoteCopyWithImpl<$Res, _$_Note> - implements _$$_NoteCopyWith<$Res> { - __$$_NoteCopyWithImpl(_$_Note _value, $Res Function(_$_Note) _then) +class __$$NoteImplCopyWithImpl<$Res> + extends _$NoteCopyWithImpl<$Res, _$NoteImpl> + implements _$$NoteImplCopyWith<$Res> { + __$$NoteImplCopyWithImpl(_$NoteImpl _value, $Res Function(_$NoteImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ + Object? notebookId = null, Object? id = freezed, - Object? parentId = freezed, Object? name = null, Object? description = null, Object? status = freezed, Object? priority = null, }) { - return _then(_$_Note( + return _then(_$NoteImpl( + notebookId: null == notebookId + ? _value.notebookId + : notebookId // ignore: cast_nullable_to_non_nullable + as Multihash, id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable as Multihash?, - parentId: freezed == parentId - ? _value.parentId - : parentId // ignore: cast_nullable_to_non_nullable - as Multihash?, name: null == name ? _value.name : name // ignore: cast_nullable_to_non_nullable @@ -159,24 +342,25 @@ class __$$_NoteCopyWithImpl<$Res> extends _$NoteCopyWithImpl<$Res, _$_Note> /// @nodoc @JsonSerializable() -class _$_Note extends _Note { - const _$_Note( - {@MultihashConverter() this.id, - @MultihashConverter() this.parentId, +class _$NoteImpl extends _Note { + const _$NoteImpl( + {@MultihashConverter() required this.notebookId, + @MultihashConverter() this.id, this.name = '', this.description = '', this.status, this.priority = 0}) : super._(); - factory _$_Note.fromJson(Map json) => _$$_NoteFromJson(json); + factory _$NoteImpl.fromJson(Map json) => + _$$NoteImplFromJson(json); @override @MultihashConverter() - final Multihash? id; + final Multihash notebookId; @override @MultihashConverter() - final Multihash? parentId; + final Multihash? id; @override @JsonKey() final String name; @@ -191,17 +375,17 @@ class _$_Note extends _Note { @override String toString() { - return 'Note(id: $id, parentId: $parentId, name: $name, description: $description, status: $status, priority: $priority)'; + return 'Note(notebookId: $notebookId, id: $id, name: $name, description: $description, status: $status, priority: $priority)'; } @override bool operator ==(dynamic other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$_Note && + other is _$NoteImpl && + (identical(other.notebookId, notebookId) || + other.notebookId == notebookId) && (identical(other.id, id) || other.id == id) && - (identical(other.parentId, parentId) || - other.parentId == parentId) && (identical(other.name, name) || other.name == name) && (identical(other.description, description) || other.description == description) && @@ -213,17 +397,17 @@ class _$_Note extends _Note { @JsonKey(ignore: true) @override int get hashCode => Object.hash( - runtimeType, id, parentId, name, description, status, priority); + runtimeType, notebookId, id, name, description, status, priority); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$_NoteCopyWith<_$_Note> get copyWith => - __$$_NoteCopyWithImpl<_$_Note>(this, _$identity); + _$$NoteImplCopyWith<_$NoteImpl> get copyWith => + __$$NoteImplCopyWithImpl<_$NoteImpl>(this, _$identity); @override Map toJson() { - return _$$_NoteToJson( + return _$$NoteImplToJson( this, ); } @@ -231,22 +415,22 @@ class _$_Note extends _Note { abstract class _Note extends Note implements DescriptiveModel { const factory _Note( - {@MultihashConverter() final Multihash? id, - @MultihashConverter() final Multihash? parentId, + {@MultihashConverter() required final Multihash notebookId, + @MultihashConverter() final Multihash? id, final String name, final String description, final NoteStatus? status, - final int priority}) = _$_Note; + final int priority}) = _$NoteImpl; const _Note._() : super._(); - factory _Note.fromJson(Map json) = _$_Note.fromJson; + factory _Note.fromJson(Map json) = _$NoteImpl.fromJson; @override @MultihashConverter() - Multihash? get id; + Multihash get notebookId; @override @MultihashConverter() - Multihash? get parentId; + Multihash? get id; @override String get name; @override @@ -257,5 +441,6 @@ abstract class _Note extends Note implements DescriptiveModel { int get priority; @override @JsonKey(ignore: true) - _$$_NoteCopyWith<_$_Note> get copyWith => throw _privateConstructorUsedError; + _$$NoteImplCopyWith<_$NoteImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/api/lib/models/note/model.g.dart b/api/lib/models/note/model.g.dart index fd9c0378510..08297d23c3b 100644 --- a/api/lib/models/note/model.g.dart +++ b/api/lib/models/note/model.g.dart @@ -6,26 +6,20 @@ part of 'model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$_Note _$$_NoteFromJson(Map json) => _$_Note( +_$NotebookImpl _$$NotebookImplFromJson(Map json) => + _$NotebookImpl( id: _$JsonConverterFromJson, Multihash>( json['id'], const MultihashConverter().fromJson), - parentId: _$JsonConverterFromJson, Multihash>( - json['parentId'], const MultihashConverter().fromJson), name: json['name'] as String? ?? '', description: json['description'] as String? ?? '', - status: $enumDecodeNullable(_$NoteStatusEnumMap, json['status']), - priority: json['priority'] as int? ?? 0, ); -Map _$$_NoteToJson(_$_Note instance) => { +Map _$$NotebookImplToJson(_$NotebookImpl instance) => + { 'id': _$JsonConverterToJson, Multihash>( instance.id, const MultihashConverter().toJson), - 'parentId': _$JsonConverterToJson, Multihash>( - instance.parentId, const MultihashConverter().toJson), 'name': instance.name, 'description': instance.description, - 'status': _$NoteStatusEnumMap[instance.status], - 'priority': instance.priority, }; Value? _$JsonConverterFromJson( @@ -34,14 +28,36 @@ Value? _$JsonConverterFromJson( ) => json == null ? null : fromJson(json as Json); -const _$NoteStatusEnumMap = { - NoteStatus.todo: 'todo', - NoteStatus.inProgress: 'inProgress', - NoteStatus.done: 'done', -}; - Json? _$JsonConverterToJson( Value? value, Json? Function(Value value) toJson, ) => value == null ? null : toJson(value); + +_$NoteImpl _$$NoteImplFromJson(Map json) => _$NoteImpl( + notebookId: + const MultihashConverter().fromJson(json['notebookId'] as List), + id: _$JsonConverterFromJson, Multihash>( + json['id'], const MultihashConverter().fromJson), + name: json['name'] as String? ?? '', + description: json['description'] as String? ?? '', + status: $enumDecodeNullable(_$NoteStatusEnumMap, json['status']), + priority: json['priority'] as int? ?? 0, + ); + +Map _$$NoteImplToJson(_$NoteImpl instance) => + { + 'notebookId': const MultihashConverter().toJson(instance.notebookId), + 'id': _$JsonConverterToJson, Multihash>( + instance.id, const MultihashConverter().toJson), + 'name': instance.name, + 'description': instance.description, + 'status': _$NoteStatusEnumMap[instance.status], + 'priority': instance.priority, + }; + +const _$NoteStatusEnumMap = { + NoteStatus.todo: 'todo', + NoteStatus.inProgress: 'inProgress', + NoteStatus.done: 'done', +}; diff --git a/api/lib/models/place/model.freezed.dart b/api/lib/models/place/model.freezed.dart index 8c1b24b1a28..52a04bf6653 100644 --- a/api/lib/models/place/model.freezed.dart +++ b/api/lib/models/place/model.freezed.dart @@ -83,9 +83,10 @@ class _$PlaceCopyWithImpl<$Res, $Val extends Place> } /// @nodoc -abstract class _$$_PlaceCopyWith<$Res> implements $PlaceCopyWith<$Res> { - factory _$$_PlaceCopyWith(_$_Place value, $Res Function(_$_Place) then) = - __$$_PlaceCopyWithImpl<$Res>; +abstract class _$$PlaceImplCopyWith<$Res> implements $PlaceCopyWith<$Res> { + factory _$$PlaceImplCopyWith( + _$PlaceImpl value, $Res Function(_$PlaceImpl) then) = + __$$PlaceImplCopyWithImpl<$Res>; @override @useResult $Res call( @@ -96,9 +97,11 @@ abstract class _$$_PlaceCopyWith<$Res> implements $PlaceCopyWith<$Res> { } /// @nodoc -class __$$_PlaceCopyWithImpl<$Res> extends _$PlaceCopyWithImpl<$Res, _$_Place> - implements _$$_PlaceCopyWith<$Res> { - __$$_PlaceCopyWithImpl(_$_Place _value, $Res Function(_$_Place) _then) +class __$$PlaceImplCopyWithImpl<$Res> + extends _$PlaceCopyWithImpl<$Res, _$PlaceImpl> + implements _$$PlaceImplCopyWith<$Res> { + __$$PlaceImplCopyWithImpl( + _$PlaceImpl _value, $Res Function(_$PlaceImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -109,7 +112,7 @@ class __$$_PlaceCopyWithImpl<$Res> extends _$PlaceCopyWithImpl<$Res, _$_Place> Object? description = null, Object? address = null, }) { - return _then(_$_Place( + return _then(_$PlaceImpl( id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable @@ -132,16 +135,16 @@ class __$$_PlaceCopyWithImpl<$Res> extends _$PlaceCopyWithImpl<$Res, _$_Place> /// @nodoc @JsonSerializable() -class _$_Place extends _Place { - const _$_Place( +class _$PlaceImpl extends _Place { + const _$PlaceImpl( {@MultihashConverter() this.id, this.name = '', this.description = '', this.address = ''}) : super._(); - factory _$_Place.fromJson(Map json) => - _$$_PlaceFromJson(json); + factory _$PlaceImpl.fromJson(Map json) => + _$$PlaceImplFromJson(json); @override @MultihashConverter() @@ -165,7 +168,7 @@ class _$_Place extends _Place { bool operator ==(dynamic other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$_Place && + other is _$PlaceImpl && (identical(other.id, id) || other.id == id) && (identical(other.name, name) || other.name == name) && (identical(other.description, description) || @@ -180,12 +183,12 @@ class _$_Place extends _Place { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$_PlaceCopyWith<_$_Place> get copyWith => - __$$_PlaceCopyWithImpl<_$_Place>(this, _$identity); + _$$PlaceImplCopyWith<_$PlaceImpl> get copyWith => + __$$PlaceImplCopyWithImpl<_$PlaceImpl>(this, _$identity); @override Map toJson() { - return _$$_PlaceToJson( + return _$$PlaceImplToJson( this, ); } @@ -196,10 +199,10 @@ abstract class _Place extends Place implements DescriptiveModel { {@MultihashConverter() final Multihash? id, final String name, final String description, - final String address}) = _$_Place; + final String address}) = _$PlaceImpl; const _Place._() : super._(); - factory _Place.fromJson(Map json) = _$_Place.fromJson; + factory _Place.fromJson(Map json) = _$PlaceImpl.fromJson; @override @MultihashConverter() @@ -212,6 +215,6 @@ abstract class _Place extends Place implements DescriptiveModel { String get address; @override @JsonKey(ignore: true) - _$$_PlaceCopyWith<_$_Place> get copyWith => + _$$PlaceImplCopyWith<_$PlaceImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/api/lib/models/place/model.g.dart b/api/lib/models/place/model.g.dart index f29b904aa3d..f3cf666d7f1 100644 --- a/api/lib/models/place/model.g.dart +++ b/api/lib/models/place/model.g.dart @@ -6,7 +6,7 @@ part of 'model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$_Place _$$_PlaceFromJson(Map json) => _$_Place( +_$PlaceImpl _$$PlaceImplFromJson(Map json) => _$PlaceImpl( id: _$JsonConverterFromJson, Multihash>( json['id'], const MultihashConverter().fromJson), name: json['name'] as String? ?? '', @@ -14,7 +14,8 @@ _$_Place _$$_PlaceFromJson(Map json) => _$_Place( address: json['address'] as String? ?? '', ); -Map _$$_PlaceToJson(_$_Place instance) => { +Map _$$PlaceImplToJson(_$PlaceImpl instance) => + { 'id': _$JsonConverterToJson, Multihash>( instance.id, const MultihashConverter().toJson), 'name': instance.name, diff --git a/api/lib/models/user/model.freezed.dart b/api/lib/models/user/model.freezed.dart index 64d2bc83e37..6c2bc554c7a 100644 --- a/api/lib/models/user/model.freezed.dart +++ b/api/lib/models/user/model.freezed.dart @@ -106,9 +106,10 @@ class _$UserCopyWithImpl<$Res, $Val extends User> } /// @nodoc -abstract class _$$_UserCopyWith<$Res> implements $UserCopyWith<$Res> { - factory _$$_UserCopyWith(_$_User value, $Res Function(_$_User) then) = - __$$_UserCopyWithImpl<$Res>; +abstract class _$$UserImplCopyWith<$Res> implements $UserCopyWith<$Res> { + factory _$$UserImplCopyWith( + _$UserImpl value, $Res Function(_$UserImpl) then) = + __$$UserImplCopyWithImpl<$Res>; @override @useResult $Res call( @@ -122,9 +123,10 @@ abstract class _$$_UserCopyWith<$Res> implements $UserCopyWith<$Res> { } /// @nodoc -class __$$_UserCopyWithImpl<$Res> extends _$UserCopyWithImpl<$Res, _$_User> - implements _$$_UserCopyWith<$Res> { - __$$_UserCopyWithImpl(_$_User _value, $Res Function(_$_User) _then) +class __$$UserImplCopyWithImpl<$Res> + extends _$UserCopyWithImpl<$Res, _$UserImpl> + implements _$$UserImplCopyWith<$Res> { + __$$UserImplCopyWithImpl(_$UserImpl _value, $Res Function(_$UserImpl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -138,7 +140,7 @@ class __$$_UserCopyWithImpl<$Res> extends _$UserCopyWithImpl<$Res, _$_User> Object? phone = null, Object? image = freezed, }) { - return _then(_$_User( + return _then(_$UserImpl( id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable @@ -173,8 +175,8 @@ class __$$_UserCopyWithImpl<$Res> extends _$UserCopyWithImpl<$Res, _$_User> /// @nodoc @JsonSerializable() -class _$_User extends _User { - const _$_User( +class _$UserImpl extends _User { + const _$UserImpl( {@MultihashConverter() this.id, @MultihashConverter() this.groupId, this.name = '', @@ -184,7 +186,8 @@ class _$_User extends _User { @Uint8ListConverter() this.image}) : super._(); - factory _$_User.fromJson(Map json) => _$$_UserFromJson(json); + factory _$UserImpl.fromJson(Map json) => + _$$UserImplFromJson(json); @override @MultihashConverter() @@ -217,7 +220,7 @@ class _$_User extends _User { bool operator ==(dynamic other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$_User && + other is _$UserImpl && (identical(other.id, id) || other.id == id) && (identical(other.groupId, groupId) || other.groupId == groupId) && (identical(other.name, name) || other.name == name) && @@ -236,12 +239,12 @@ class _$_User extends _User { @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$_UserCopyWith<_$_User> get copyWith => - __$$_UserCopyWithImpl<_$_User>(this, _$identity); + _$$UserImplCopyWith<_$UserImpl> get copyWith => + __$$UserImplCopyWithImpl<_$UserImpl>(this, _$identity); @override Map toJson() { - return _$$_UserToJson( + return _$$UserImplToJson( this, ); } @@ -255,10 +258,10 @@ abstract class _User extends User implements DescriptiveModel { final String email, final String description, final String phone, - @Uint8ListConverter() final Uint8List? image}) = _$_User; + @Uint8ListConverter() final Uint8List? image}) = _$UserImpl; const _User._() : super._(); - factory _User.fromJson(Map json) = _$_User.fromJson; + factory _User.fromJson(Map json) = _$UserImpl.fromJson; @override @MultihashConverter() @@ -279,5 +282,6 @@ abstract class _User extends User implements DescriptiveModel { Uint8List? get image; @override @JsonKey(ignore: true) - _$$_UserCopyWith<_$_User> get copyWith => throw _privateConstructorUsedError; + _$$UserImplCopyWith<_$UserImpl> get copyWith => + throw _privateConstructorUsedError; } diff --git a/api/lib/models/user/model.g.dart b/api/lib/models/user/model.g.dart index 86e2c04b83c..972e8dcf1ed 100644 --- a/api/lib/models/user/model.g.dart +++ b/api/lib/models/user/model.g.dart @@ -6,7 +6,7 @@ part of 'model.dart'; // JsonSerializableGenerator // ************************************************************************** -_$_User _$$_UserFromJson(Map json) => _$_User( +_$UserImpl _$$UserImplFromJson(Map json) => _$UserImpl( id: _$JsonConverterFromJson, Multihash>( json['id'], const MultihashConverter().fromJson), groupId: _$JsonConverterFromJson, Multihash>( @@ -19,7 +19,8 @@ _$_User _$$_UserFromJson(Map json) => _$_User( json['image'], const Uint8ListConverter().fromJson), ); -Map _$$_UserToJson(_$_User instance) => { +Map _$$UserImplToJson(_$UserImpl instance) => + { 'id': _$JsonConverterToJson, Multihash>( instance.id, const MultihashConverter().toJson), 'groupId': _$JsonConverterToJson, Multihash>( diff --git a/api/pubspec.yaml b/api/pubspec.yaml index f2001b0383b..9433ff6a1ad 100644 --- a/api/pubspec.yaml +++ b/api/pubspec.yaml @@ -24,4 +24,4 @@ dev_dependencies: freezed: ^2.4.2 json_serializable: ^6.7.0 lints: ^3.0.0 - test: ^1.24.4 + test: ^1.24.9 diff --git a/app/lib/api/storage/remote/caldav.dart b/app/lib/api/storage/remote/caldav.dart index 6ea35d16b2a..8b5e6152a3a 100644 --- a/app/lib/api/storage/remote/caldav.dart +++ b/app/lib/api/storage/remote/caldav.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'dart:convert'; +import 'package:flow_api/models/note/model.dart'; import 'package:http/http.dart' as http; import 'package:lib5/lib5.dart'; import 'package:flow_api/converters/ical.dart'; @@ -63,12 +64,16 @@ class CalDavRemoteService extends RemoteService { if (text == null) continue; final etag = prop?.getElement("d:getetag")?.innerText; if (etag == null) continue; + final name = href.substring(href.lastIndexOf('/') + 1); converter.read( - text.split('\n'), - Event( - name: href.substring(href.lastIndexOf('/') + 1), - id: createUniqueMultihash()) - .addExtra(ExtraProperties.calDav(etag: etag, path: href))); + text.split('\n'), + event: Event(name: name, id: createUniqueMultihash()) + .addExtra(ExtraProperties.calDav(etag: etag, path: href)), + notebook: Notebook( + id: createUniqueMultihash(), + name: name, + ), + ); } if (converter.data != null) import(converter.data!); } From 03f75404aac840d35db8016b4b5228b4c2d43a33 Mon Sep 17 00:00:00 2001 From: CodeDoctorDE Date: Fri, 12 Jan 2024 19:01:28 +0100 Subject: [PATCH 02/14] Make notebookId nullable --- api/lib/models/cached.freezed.dart | 2 +- api/lib/models/event/item/model.freezed.dart | 6 ++-- api/lib/models/event/model.freezed.dart | 2 +- api/lib/models/extra.freezed.dart | 2 +- api/lib/models/group/model.freezed.dart | 2 +- api/lib/models/label/model.freezed.dart | 2 +- api/lib/models/model.freezed.dart | 2 +- api/lib/models/note/model.dart | 2 +- api/lib/models/note/model.freezed.dart | 30 ++++++++++---------- api/lib/models/note/model.g.dart | 7 +++-- api/lib/models/place/model.freezed.dart | 2 +- api/lib/models/user/model.freezed.dart | 2 +- app/lib/api/storage/remote/ical.dart | 2 +- app/lib/pages/notes/page.dart | 4 +-- 14 files changed, 33 insertions(+), 34 deletions(-) diff --git a/api/lib/models/cached.freezed.dart b/api/lib/models/cached.freezed.dart index e0419f555f7..5f5199bb29d 100644 --- a/api/lib/models/cached.freezed.dart +++ b/api/lib/models/cached.freezed.dart @@ -210,7 +210,7 @@ class _$CachedDataImpl extends _CachedData { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CachedDataImpl && diff --git a/api/lib/models/event/item/model.freezed.dart b/api/lib/models/event/item/model.freezed.dart index b7b2d50ce3e..9167d590bad 100644 --- a/api/lib/models/event/item/model.freezed.dart +++ b/api/lib/models/event/item/model.freezed.dart @@ -406,7 +406,7 @@ class _$FixedCalendarItemImpl extends FixedCalendarItem { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$FixedCalendarItemImpl && @@ -857,7 +857,7 @@ class _$RepeatingCalendarItemImpl extends RepeatingCalendarItem { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$RepeatingCalendarItemImpl && @@ -1309,7 +1309,7 @@ class _$AutoCalendarItemImpl extends AutoCalendarItem { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$AutoCalendarItemImpl && diff --git a/api/lib/models/event/model.freezed.dart b/api/lib/models/event/model.freezed.dart index 82760b57317..583a4f11353 100644 --- a/api/lib/models/event/model.freezed.dart +++ b/api/lib/models/event/model.freezed.dart @@ -252,7 +252,7 @@ class _$EventImpl extends _Event { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$EventImpl && diff --git a/api/lib/models/extra.freezed.dart b/api/lib/models/extra.freezed.dart index a86dcd2b09d..9cfe43a6962 100644 --- a/api/lib/models/extra.freezed.dart +++ b/api/lib/models/extra.freezed.dart @@ -156,7 +156,7 @@ class _$CalDavExtraPropertiesImpl implements CalDavExtraProperties { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$CalDavExtraPropertiesImpl && diff --git a/api/lib/models/group/model.freezed.dart b/api/lib/models/group/model.freezed.dart index 914c20015d6..a0cde4b9ef5 100644 --- a/api/lib/models/group/model.freezed.dart +++ b/api/lib/models/group/model.freezed.dart @@ -166,7 +166,7 @@ class _$GroupImpl extends _Group { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$GroupImpl && diff --git a/api/lib/models/label/model.freezed.dart b/api/lib/models/label/model.freezed.dart index 0a636a64348..b289d072f4f 100644 --- a/api/lib/models/label/model.freezed.dart +++ b/api/lib/models/label/model.freezed.dart @@ -165,7 +165,7 @@ class _$LabelImpl extends _Label { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$LabelImpl && diff --git a/api/lib/models/model.freezed.dart b/api/lib/models/model.freezed.dart index 4d582bd44af..37bc2aacbe5 100644 --- a/api/lib/models/model.freezed.dart +++ b/api/lib/models/model.freezed.dart @@ -117,7 +117,7 @@ class _$ConnectedModelImpl extends _ConnectedModel { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ConnectedModelImpl && diff --git a/api/lib/models/note/model.dart b/api/lib/models/note/model.dart index 15e738f2a9e..25dd9d81414 100644 --- a/api/lib/models/note/model.dart +++ b/api/lib/models/note/model.dart @@ -36,7 +36,7 @@ class Note with _$Note { @Implements() const factory Note({ - @MultihashConverter() required Multihash notebookId, + @MultihashConverter() Multihash? notebookId, @MultihashConverter() Multihash? id, @Default('') String name, @Default('') String description, diff --git a/api/lib/models/note/model.freezed.dart b/api/lib/models/note/model.freezed.dart index 3d23035ca2d..b2be22413bb 100644 --- a/api/lib/models/note/model.freezed.dart +++ b/api/lib/models/note/model.freezed.dart @@ -144,7 +144,7 @@ class _$NotebookImpl extends _Notebook { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$NotebookImpl && @@ -202,7 +202,7 @@ Note _$NoteFromJson(Map json) { /// @nodoc mixin _$Note { @MultihashConverter() - Multihash get notebookId => throw _privateConstructorUsedError; + Multihash? get notebookId => throw _privateConstructorUsedError; @MultihashConverter() Multihash? get id => throw _privateConstructorUsedError; String get name => throw _privateConstructorUsedError; @@ -221,7 +221,7 @@ abstract class $NoteCopyWith<$Res> { _$NoteCopyWithImpl<$Res, Note>; @useResult $Res call( - {@MultihashConverter() Multihash notebookId, + {@MultihashConverter() Multihash? notebookId, @MultihashConverter() Multihash? id, String name, String description, @@ -242,7 +242,7 @@ class _$NoteCopyWithImpl<$Res, $Val extends Note> @pragma('vm:prefer-inline') @override $Res call({ - Object? notebookId = null, + Object? notebookId = freezed, Object? id = freezed, Object? name = null, Object? description = null, @@ -250,10 +250,10 @@ class _$NoteCopyWithImpl<$Res, $Val extends Note> Object? priority = null, }) { return _then(_value.copyWith( - notebookId: null == notebookId + notebookId: freezed == notebookId ? _value.notebookId : notebookId // ignore: cast_nullable_to_non_nullable - as Multihash, + as Multihash?, id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable @@ -286,7 +286,7 @@ abstract class _$$NoteImplCopyWith<$Res> implements $NoteCopyWith<$Res> { @override @useResult $Res call( - {@MultihashConverter() Multihash notebookId, + {@MultihashConverter() Multihash? notebookId, @MultihashConverter() Multihash? id, String name, String description, @@ -304,7 +304,7 @@ class __$$NoteImplCopyWithImpl<$Res> @pragma('vm:prefer-inline') @override $Res call({ - Object? notebookId = null, + Object? notebookId = freezed, Object? id = freezed, Object? name = null, Object? description = null, @@ -312,10 +312,10 @@ class __$$NoteImplCopyWithImpl<$Res> Object? priority = null, }) { return _then(_$NoteImpl( - notebookId: null == notebookId + notebookId: freezed == notebookId ? _value.notebookId : notebookId // ignore: cast_nullable_to_non_nullable - as Multihash, + as Multihash?, id: freezed == id ? _value.id : id // ignore: cast_nullable_to_non_nullable @@ -344,7 +344,7 @@ class __$$NoteImplCopyWithImpl<$Res> @JsonSerializable() class _$NoteImpl extends _Note { const _$NoteImpl( - {@MultihashConverter() required this.notebookId, + {@MultihashConverter() this.notebookId, @MultihashConverter() this.id, this.name = '', this.description = '', @@ -357,7 +357,7 @@ class _$NoteImpl extends _Note { @override @MultihashConverter() - final Multihash notebookId; + final Multihash? notebookId; @override @MultihashConverter() final Multihash? id; @@ -379,7 +379,7 @@ class _$NoteImpl extends _Note { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$NoteImpl && @@ -415,7 +415,7 @@ class _$NoteImpl extends _Note { abstract class _Note extends Note implements DescriptiveModel { const factory _Note( - {@MultihashConverter() required final Multihash notebookId, + {@MultihashConverter() final Multihash? notebookId, @MultihashConverter() final Multihash? id, final String name, final String description, @@ -427,7 +427,7 @@ abstract class _Note extends Note implements DescriptiveModel { @override @MultihashConverter() - Multihash get notebookId; + Multihash? get notebookId; @override @MultihashConverter() Multihash? get id; diff --git a/api/lib/models/note/model.g.dart b/api/lib/models/note/model.g.dart index 08297d23c3b..54680d702b9 100644 --- a/api/lib/models/note/model.g.dart +++ b/api/lib/models/note/model.g.dart @@ -35,8 +35,8 @@ Json? _$JsonConverterToJson( value == null ? null : toJson(value); _$NoteImpl _$$NoteImplFromJson(Map json) => _$NoteImpl( - notebookId: - const MultihashConverter().fromJson(json['notebookId'] as List), + notebookId: _$JsonConverterFromJson, Multihash>( + json['notebookId'], const MultihashConverter().fromJson), id: _$JsonConverterFromJson, Multihash>( json['id'], const MultihashConverter().fromJson), name: json['name'] as String? ?? '', @@ -47,7 +47,8 @@ _$NoteImpl _$$NoteImplFromJson(Map json) => _$NoteImpl( Map _$$NoteImplToJson(_$NoteImpl instance) => { - 'notebookId': const MultihashConverter().toJson(instance.notebookId), + 'notebookId': _$JsonConverterToJson, Multihash>( + instance.notebookId, const MultihashConverter().toJson), 'id': _$JsonConverterToJson, Multihash>( instance.id, const MultihashConverter().toJson), 'name': instance.name, diff --git a/api/lib/models/place/model.freezed.dart b/api/lib/models/place/model.freezed.dart index 52a04bf6653..deb4a9ae167 100644 --- a/api/lib/models/place/model.freezed.dart +++ b/api/lib/models/place/model.freezed.dart @@ -165,7 +165,7 @@ class _$PlaceImpl extends _Place { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$PlaceImpl && diff --git a/api/lib/models/user/model.freezed.dart b/api/lib/models/user/model.freezed.dart index 6c2bc554c7a..25ead2cd531 100644 --- a/api/lib/models/user/model.freezed.dart +++ b/api/lib/models/user/model.freezed.dart @@ -217,7 +217,7 @@ class _$UserImpl extends _User { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$UserImpl && diff --git a/app/lib/api/storage/remote/ical.dart b/app/lib/api/storage/remote/ical.dart index 267b88be58f..00f5bd94db7 100644 --- a/app/lib/api/storage/remote/ical.dart +++ b/app/lib/api/storage/remote/ical.dart @@ -24,7 +24,7 @@ class IcalRemoteService extends RemoteService { final converter = ICalConverter(); final name = remoteStorage.uri.host; converter.read(response.body.split('\n'), - Event(name: name, id: createUniqueMultihash())); + event: Event(name: name, id: createUniqueMultihash())); if (converter.data != null) import(converter.data!); } diff --git a/app/lib/pages/notes/page.dart b/app/lib/pages/notes/page.dart index 41e9b7233f7..e975b52733b 100644 --- a/app/lib/pages/notes/page.dart +++ b/app/lib/pages/notes/page.dart @@ -266,9 +266,7 @@ class _NotesBodyViewState extends State { onPressed: () => showDialog( context: context, builder: (context) => NoteDialog( - note: Note( - parentId: widget.parent?.model, - ), + note: const Note(), source: widget.parent?.source, create: true, )).then((_) => _controller.refresh()), From 7c5c4c3634bb805848ecc5582c885c7246354336 Mon Sep 17 00:00:00 2001 From: CodeDoctorDE Date: Sat, 13 Jan 2024 08:49:22 +0100 Subject: [PATCH 03/14] Add drawer --- api/lib/models/model.dart | 2 +- api/lib/models/note/model.dart | 25 ++++------ api/pubspec.yaml | 2 +- app/lib/l10n/app_en.arb | 3 +- app/lib/pages/notes/navigator/drawer.dart | 48 +++++++++++++++++++ .../pages/notes/{ => navigator}/labels.dart | 27 ++++------- app/lib/pages/notes/page.dart | 4 +- tools/pubspec.yaml | 2 +- 8 files changed, 73 insertions(+), 40 deletions(-) create mode 100644 app/lib/pages/notes/navigator/drawer.dart rename app/lib/pages/notes/{ => navigator}/labels.dart (85%) diff --git a/api/lib/models/model.dart b/api/lib/models/model.dart index cc04887c347..4051670382e 100644 --- a/api/lib/models/model.dart +++ b/api/lib/models/model.dart @@ -5,7 +5,7 @@ part 'model.freezed.dart'; const kColorBlack = 0xFF000000; -abstract class DescriptiveModel { +mixin DescriptiveModel { Multihash? get id; String get name; String get description; diff --git a/api/lib/models/note/model.dart b/api/lib/models/note/model.dart index 25dd9d81414..93de553f8b4 100644 --- a/api/lib/models/note/model.dart +++ b/api/lib/models/note/model.dart @@ -62,20 +62,15 @@ enum NoteStatus { } extension NoteStatusExtension on NoteStatus { - bool? get done { - switch (this) { - case NoteStatus.todo: - return false; - case NoteStatus.inProgress: - return null; - case NoteStatus.done: - return true; - } - } + bool? get done => switch (this) { + NoteStatus.todo => false, + NoteStatus.inProgress => null, + NoteStatus.done => true, + }; - static NoteStatus fromDone(bool? done) { - if (done == null) return NoteStatus.inProgress; - if (done) return NoteStatus.done; - return NoteStatus.todo; - } + static NoteStatus fromDone(bool? done) => switch (done) { + true => NoteStatus.done, + false => NoteStatus.todo, + null => NoteStatus.inProgress, + }; } diff --git a/api/pubspec.yaml b/api/pubspec.yaml index db90dec68bc..3737c1eea36 100644 --- a/api/pubspec.yaml +++ b/api/pubspec.yaml @@ -4,7 +4,7 @@ description: A starting point for Dart libraries or applications. # homepage: https://www.example.com environment: - sdk: '>=2.17.0 <3.0.0' + sdk: ">=3.0.0 <4.0.0" dependencies: meta: ^1.9.1 diff --git a/app/lib/l10n/app_en.arb b/app/lib/l10n/app_en.arb index 6646a411b8c..d3c5b5457cf 100644 --- a/app/lib/l10n/app_en.arb +++ b/app/lib/l10n/app_en.arb @@ -292,5 +292,6 @@ "compact": "Compact", "comfortable": "Comfortable", "standard": "Standard", - "highContrast": "High contrast" + "highContrast": "High contrast", + "labels": "Labels" } \ No newline at end of file diff --git a/app/lib/pages/notes/navigator/drawer.dart b/app/lib/pages/notes/navigator/drawer.dart new file mode 100644 index 00000000000..1940818fd19 --- /dev/null +++ b/app/lib/pages/notes/navigator/drawer.dart @@ -0,0 +1,48 @@ +import 'package:flow/cubits/flow.dart'; +import 'package:flow/helpers/sourced_paging_controller.dart'; +import 'package:flow/pages/notes/label.dart'; +import 'package:flow/widgets/builder_delegate.dart'; +import 'package:flow/widgets/color.dart'; +import 'package:flow_api/models/label/model.dart'; +import 'package:flow_api/models/model.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart'; +import 'package:lib5/lib5.dart'; +import 'package:material_leap/material_leap.dart'; +import 'package:phosphor_flutter/phosphor_flutter.dart'; + +part 'labels.dart'; + +class NotesNavigatorDrawer extends StatelessWidget { + final Multihash? selectedLabel; + final LabelChangedCallback? onLabelChanged; + + const NotesNavigatorDrawer({ + super.key, + this.selectedLabel, + this.onLabelChanged, + }); + + @override + Widget build(BuildContext context) { + return ListView( + children: [ + ExpansionPanelList.radio( + children: [ + ExpansionPanel( + headerBuilder: (context, isExpanded) => ListTile( + title: Text(AppLocalizations.of(context).labels), + ), + body: _NoteLabelsView( + onChanged: onLabelChanged, + selected: selectedLabel, + ), + ), + ], + ), + ], + ); + } +} diff --git a/app/lib/pages/notes/labels.dart b/app/lib/pages/notes/navigator/labels.dart similarity index 85% rename from app/lib/pages/notes/labels.dart rename to app/lib/pages/notes/navigator/labels.dart index 195b34a3887..c8f2847c73d 100644 --- a/app/lib/pages/notes/labels.dart +++ b/app/lib/pages/notes/navigator/labels.dart @@ -1,29 +1,18 @@ -import 'package:flow/helpers/sourced_paging_controller.dart'; -import 'package:flow/widgets/builder_delegate.dart'; -import 'package:flow/widgets/color.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; -import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart'; -import 'package:lib5/lib5.dart'; -import 'package:phosphor_flutter/phosphor_flutter.dart'; -import 'package:flow_api/models/label/model.dart'; -import 'package:flow_api/models/model.dart'; +part of 'drawer.dart'; -import '../../cubits/flow.dart'; -import 'label.dart'; +typedef LabelChangedCallback = void Function(SourcedModel