refactor: Refactor profile management. Remove profile cache provider, implement profile provider with async fetching and updating, and integrate profile editing functionality in the UI.
···11+// coverage:ignore-file
22+// GENERATED CODE - DO NOT MODIFY BY HAND
33+// ignore_for_file: type=lint
44+// 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
55+66+part of 'profile_with_galleries.dart';
77+88+// **************************************************************************
99+// FreezedGenerator
1010+// **************************************************************************
1111+1212+T _$identity<T>(T value) => value;
1313+1414+final _privateConstructorUsedError = UnsupportedError(
1515+ '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#adding-getters-and-methods-to-our-models',
1616+);
1717+1818+ProfileWithGalleries _$ProfileWithGalleriesFromJson(Map<String, dynamic> json) {
1919+ return _ProfileWithGalleries.fromJson(json);
2020+}
2121+2222+/// @nodoc
2323+mixin _$ProfileWithGalleries {
2424+ Profile get profile => throw _privateConstructorUsedError;
2525+ List<Gallery> get galleries => throw _privateConstructorUsedError;
2626+2727+ /// Serializes this ProfileWithGalleries to a JSON map.
2828+ Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
2929+3030+ /// Create a copy of ProfileWithGalleries
3131+ /// with the given fields replaced by the non-null parameter values.
3232+ @JsonKey(includeFromJson: false, includeToJson: false)
3333+ $ProfileWithGalleriesCopyWith<ProfileWithGalleries> get copyWith =>
3434+ throw _privateConstructorUsedError;
3535+}
3636+3737+/// @nodoc
3838+abstract class $ProfileWithGalleriesCopyWith<$Res> {
3939+ factory $ProfileWithGalleriesCopyWith(
4040+ ProfileWithGalleries value,
4141+ $Res Function(ProfileWithGalleries) then,
4242+ ) = _$ProfileWithGalleriesCopyWithImpl<$Res, ProfileWithGalleries>;
4343+ @useResult
4444+ $Res call({Profile profile, List<Gallery> galleries});
4545+4646+ $ProfileCopyWith<$Res> get profile;
4747+}
4848+4949+/// @nodoc
5050+class _$ProfileWithGalleriesCopyWithImpl<
5151+ $Res,
5252+ $Val extends ProfileWithGalleries
5353+>
5454+ implements $ProfileWithGalleriesCopyWith<$Res> {
5555+ _$ProfileWithGalleriesCopyWithImpl(this._value, this._then);
5656+5757+ // ignore: unused_field
5858+ final $Val _value;
5959+ // ignore: unused_field
6060+ final $Res Function($Val) _then;
6161+6262+ /// Create a copy of ProfileWithGalleries
6363+ /// with the given fields replaced by the non-null parameter values.
6464+ @pragma('vm:prefer-inline')
6565+ @override
6666+ $Res call({Object? profile = null, Object? galleries = null}) {
6767+ return _then(
6868+ _value.copyWith(
6969+ profile: null == profile
7070+ ? _value.profile
7171+ : profile // ignore: cast_nullable_to_non_nullable
7272+ as Profile,
7373+ galleries: null == galleries
7474+ ? _value.galleries
7575+ : galleries // ignore: cast_nullable_to_non_nullable
7676+ as List<Gallery>,
7777+ )
7878+ as $Val,
7979+ );
8080+ }
8181+8282+ /// Create a copy of ProfileWithGalleries
8383+ /// with the given fields replaced by the non-null parameter values.
8484+ @override
8585+ @pragma('vm:prefer-inline')
8686+ $ProfileCopyWith<$Res> get profile {
8787+ return $ProfileCopyWith<$Res>(_value.profile, (value) {
8888+ return _then(_value.copyWith(profile: value) as $Val);
8989+ });
9090+ }
9191+}
9292+9393+/// @nodoc
9494+abstract class _$$ProfileWithGalleriesImplCopyWith<$Res>
9595+ implements $ProfileWithGalleriesCopyWith<$Res> {
9696+ factory _$$ProfileWithGalleriesImplCopyWith(
9797+ _$ProfileWithGalleriesImpl value,
9898+ $Res Function(_$ProfileWithGalleriesImpl) then,
9999+ ) = __$$ProfileWithGalleriesImplCopyWithImpl<$Res>;
100100+ @override
101101+ @useResult
102102+ $Res call({Profile profile, List<Gallery> galleries});
103103+104104+ @override
105105+ $ProfileCopyWith<$Res> get profile;
106106+}
107107+108108+/// @nodoc
109109+class __$$ProfileWithGalleriesImplCopyWithImpl<$Res>
110110+ extends _$ProfileWithGalleriesCopyWithImpl<$Res, _$ProfileWithGalleriesImpl>
111111+ implements _$$ProfileWithGalleriesImplCopyWith<$Res> {
112112+ __$$ProfileWithGalleriesImplCopyWithImpl(
113113+ _$ProfileWithGalleriesImpl _value,
114114+ $Res Function(_$ProfileWithGalleriesImpl) _then,
115115+ ) : super(_value, _then);
116116+117117+ /// Create a copy of ProfileWithGalleries
118118+ /// with the given fields replaced by the non-null parameter values.
119119+ @pragma('vm:prefer-inline')
120120+ @override
121121+ $Res call({Object? profile = null, Object? galleries = null}) {
122122+ return _then(
123123+ _$ProfileWithGalleriesImpl(
124124+ profile: null == profile
125125+ ? _value.profile
126126+ : profile // ignore: cast_nullable_to_non_nullable
127127+ as Profile,
128128+ galleries: null == galleries
129129+ ? _value._galleries
130130+ : galleries // ignore: cast_nullable_to_non_nullable
131131+ as List<Gallery>,
132132+ ),
133133+ );
134134+ }
135135+}
136136+137137+/// @nodoc
138138+@JsonSerializable()
139139+class _$ProfileWithGalleriesImpl implements _ProfileWithGalleries {
140140+ const _$ProfileWithGalleriesImpl({
141141+ required this.profile,
142142+ required final List<Gallery> galleries,
143143+ }) : _galleries = galleries;
144144+145145+ factory _$ProfileWithGalleriesImpl.fromJson(Map<String, dynamic> json) =>
146146+ _$$ProfileWithGalleriesImplFromJson(json);
147147+148148+ @override
149149+ final Profile profile;
150150+ final List<Gallery> _galleries;
151151+ @override
152152+ List<Gallery> get galleries {
153153+ if (_galleries is EqualUnmodifiableListView) return _galleries;
154154+ // ignore: implicit_dynamic_type
155155+ return EqualUnmodifiableListView(_galleries);
156156+ }
157157+158158+ @override
159159+ String toString() {
160160+ return 'ProfileWithGalleries(profile: $profile, galleries: $galleries)';
161161+ }
162162+163163+ @override
164164+ bool operator ==(Object other) {
165165+ return identical(this, other) ||
166166+ (other.runtimeType == runtimeType &&
167167+ other is _$ProfileWithGalleriesImpl &&
168168+ (identical(other.profile, profile) || other.profile == profile) &&
169169+ const DeepCollectionEquality().equals(
170170+ other._galleries,
171171+ _galleries,
172172+ ));
173173+ }
174174+175175+ @JsonKey(includeFromJson: false, includeToJson: false)
176176+ @override
177177+ int get hashCode => Object.hash(
178178+ runtimeType,
179179+ profile,
180180+ const DeepCollectionEquality().hash(_galleries),
181181+ );
182182+183183+ /// Create a copy of ProfileWithGalleries
184184+ /// with the given fields replaced by the non-null parameter values.
185185+ @JsonKey(includeFromJson: false, includeToJson: false)
186186+ @override
187187+ @pragma('vm:prefer-inline')
188188+ _$$ProfileWithGalleriesImplCopyWith<_$ProfileWithGalleriesImpl>
189189+ get copyWith =>
190190+ __$$ProfileWithGalleriesImplCopyWithImpl<_$ProfileWithGalleriesImpl>(
191191+ this,
192192+ _$identity,
193193+ );
194194+195195+ @override
196196+ Map<String, dynamic> toJson() {
197197+ return _$$ProfileWithGalleriesImplToJson(this);
198198+ }
199199+}
200200+201201+abstract class _ProfileWithGalleries implements ProfileWithGalleries {
202202+ const factory _ProfileWithGalleries({
203203+ required final Profile profile,
204204+ required final List<Gallery> galleries,
205205+ }) = _$ProfileWithGalleriesImpl;
206206+207207+ factory _ProfileWithGalleries.fromJson(Map<String, dynamic> json) =
208208+ _$ProfileWithGalleriesImpl.fromJson;
209209+210210+ @override
211211+ Profile get profile;
212212+ @override
213213+ List<Gallery> get galleries;
214214+215215+ /// Create a copy of ProfileWithGalleries
216216+ /// with the given fields replaced by the non-null parameter values.
217217+ @override
218218+ @JsonKey(includeFromJson: false, includeToJson: false)
219219+ _$$ProfileWithGalleriesImplCopyWith<_$ProfileWithGalleriesImpl>
220220+ get copyWith => throw _privateConstructorUsedError;
221221+}
+23
lib/models/profile_with_galleries.g.dart
···11+// GENERATED CODE - DO NOT MODIFY BY HAND
22+33+part of 'profile_with_galleries.dart';
44+55+// **************************************************************************
66+// JsonSerializableGenerator
77+// **************************************************************************
88+99+_$ProfileWithGalleriesImpl _$$ProfileWithGalleriesImplFromJson(
1010+ Map<String, dynamic> json,
1111+) => _$ProfileWithGalleriesImpl(
1212+ profile: Profile.fromJson(json['profile'] as Map<String, dynamic>),
1313+ galleries: (json['galleries'] as List<dynamic>)
1414+ .map((e) => Gallery.fromJson(e as Map<String, dynamic>))
1515+ .toList(),
1616+);
1717+1818+Map<String, dynamic> _$$ProfileWithGalleriesImplToJson(
1919+ _$ProfileWithGalleriesImpl instance,
2020+) => <String, dynamic>{
2121+ 'profile': instance.profile,
2222+ 'galleries': instance.galleries,
2323+};
+5
lib/providers/gallery_cache_provider.dart
···27272828 Gallery? getGallery(String uri) => state[uri];
29293030+ void setGalleriesForActor(String did, List<Gallery> galleries) {
3131+ setGalleries(galleries);
3232+ // Optionally, you could keep a mapping of actor DID to gallery URIs if needed
3333+ }
3434+3035 Future<void> toggleFavorite(String uri) async {
3136 // Fetch the latest gallery from the API to ensure up-to-date favorite state
3237 final latestGallery = await apiService.getGallery(uri: uri);
+1-1
lib/providers/gallery_cache_provider.g.dart
···66// RiverpodGenerator
77// **************************************************************************
8899-String _$galleryCacheHash() => r'dc64ef86246ea4ac742837cfcc8a9353375f2144';
99+String _$galleryCacheHash() => r'24f705b282f56332ab62705a6b29eb3f3c80142b';
10101111/// Holds a cache of galleries by URI.
1212///