chore: Update dependencies (#372)

Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
PartyDonut 2025-06-07 18:36:17 +02:00 committed by GitHub
parent 4220c68ca3
commit 34c9c5bd9c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
65 changed files with 431 additions and 1910 deletions

View file

@ -4,9 +4,10 @@ import 'dart:developer';
import 'dart:io';
import 'package:dart_mappable/dart_mappable.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:fladder/jellyfin/jellyfin_open_api.swagger.dart';
import 'package:fladder/providers/service_provider.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'discovery_provider.g.dart';
part 'discovery_provider.mapper.dart';
@ -81,7 +82,7 @@ class ServerDiscovery extends _$ServerDiscovery {
}
}
@MappableClass()
@MappableClass(generateMethods: GenerateMethods.encode | GenerateMethods.decode)
class DiscoveryInfo with DiscoveryInfoMappable {
@MappableField(key: 'Id')
final String id;

View file

@ -73,58 +73,4 @@ mixin DiscoveryInfoMappable {
return DiscoveryInfoMapper.ensureInitialized()
.encodeMap<DiscoveryInfo>(this as DiscoveryInfo);
}
DiscoveryInfoCopyWith<DiscoveryInfo, DiscoveryInfo, DiscoveryInfo>
get copyWith => _DiscoveryInfoCopyWithImpl(
this as DiscoveryInfo, $identity, $identity);
@override
String toString() {
return DiscoveryInfoMapper.ensureInitialized()
.stringifyValue(this as DiscoveryInfo);
}
}
extension DiscoveryInfoValueCopy<$R, $Out>
on ObjectCopyWith<$R, DiscoveryInfo, $Out> {
DiscoveryInfoCopyWith<$R, DiscoveryInfo, $Out> get $asDiscoveryInfo =>
$base.as((v, t, t2) => _DiscoveryInfoCopyWithImpl(v, t, t2));
}
abstract class DiscoveryInfoCopyWith<$R, $In extends DiscoveryInfo, $Out>
implements ClassCopyWith<$R, $In, $Out> {
$R call({String? id, String? name, String? address, String? endPointAddress});
DiscoveryInfoCopyWith<$R2, $In, $Out2> $chain<$R2, $Out2>(Then<$Out2, $R2> t);
}
class _DiscoveryInfoCopyWithImpl<$R, $Out>
extends ClassCopyWithBase<$R, DiscoveryInfo, $Out>
implements DiscoveryInfoCopyWith<$R, DiscoveryInfo, $Out> {
_DiscoveryInfoCopyWithImpl(super.value, super.then, super.then2);
@override
late final ClassMapperBase<DiscoveryInfo> $mapper =
DiscoveryInfoMapper.ensureInitialized();
@override
$R call(
{String? id,
String? name,
String? address,
Object? endPointAddress = $none}) =>
$apply(FieldCopyWithData({
if (id != null) #id: id,
if (name != null) #name: name,
if (address != null) #address: address,
if (endPointAddress != $none) #endPointAddress: endPointAddress
}));
@override
DiscoveryInfo $make(CopyWithData data) => DiscoveryInfo(
id: data.get(#id, or: $value.id),
name: data.get(#name, or: $value.name),
address: data.get(#address, or: $value.address),
endPointAddress: data.get(#endPointAddress, or: $value.endPointAddress));
@override
DiscoveryInfoCopyWith<$R2, DiscoveryInfo, $Out2> $chain<$R2, $Out2>(
Then<$Out2, $R2> t) =>
_DiscoveryInfoCopyWithImpl($value, $cast, t);
}

View file

@ -45,7 +45,7 @@ enum LibraryViewType {
};
}
@Freezed(fromJson: false, toJson: false)
@Freezed(fromJson: false, toJson: false, copyWith: true)
class LibraryScreenModel with _$LibraryScreenModel {
factory LibraryScreenModel({
@Default([]) List<ViewModel> views,

View file

@ -234,32 +234,6 @@ class _$LibraryScreenModelImpl implements _LibraryScreenModel {
return 'LibraryScreenModel(views: $views, selectedViewModel: $selectedViewModel, viewType: $viewType, recommendations: $recommendations, genres: $genres, favourites: $favourites)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$LibraryScreenModelImpl &&
const DeepCollectionEquality().equals(other._views, _views) &&
(identical(other.selectedViewModel, selectedViewModel) ||
other.selectedViewModel == selectedViewModel) &&
const DeepCollectionEquality().equals(other._viewType, _viewType) &&
const DeepCollectionEquality()
.equals(other._recommendations, _recommendations) &&
const DeepCollectionEquality().equals(other._genres, _genres) &&
const DeepCollectionEquality()
.equals(other._favourites, _favourites));
}
@override
int get hashCode => Object.hash(
runtimeType,
const DeepCollectionEquality().hash(_views),
selectedViewModel,
const DeepCollectionEquality().hash(_viewType),
const DeepCollectionEquality().hash(_recommendations),
const DeepCollectionEquality().hash(_genres),
const DeepCollectionEquality().hash(_favourites));
/// Create a copy of LibraryScreenModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)

View file

@ -709,10 +709,14 @@ class LibrarySearchNotifier extends StateNotifier<LibrarySearchModel> {
ref.read(filterProvider.notifier).saveFilter(LibraryFiltersModel.fromLibrarySearch(newName, state));
void updateFilter(LibraryFiltersModel model) {
ref.read(filterProvider.notifier).saveFilter(LibraryFiltersModel.fromLibrarySearch(model.name, state).copyWith(
isFavourite: model.isFavourite,
id: model.id,
));
ref.read(filterProvider.notifier).saveFilter(
LibraryFiltersModel.fromLibrarySearch(
model.name,
state,
isFavourite: model.isFavourite,
id: model.id,
),
);
}
}

View file

@ -25,92 +25,6 @@ mixin _$SessionInfoModel {
/// Serializes this SessionInfoModel to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of SessionInfoModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$SessionInfoModelCopyWith<SessionInfoModel> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $SessionInfoModelCopyWith<$Res> {
factory $SessionInfoModelCopyWith(
SessionInfoModel value, $Res Function(SessionInfoModel) then) =
_$SessionInfoModelCopyWithImpl<$Res, SessionInfoModel>;
@useResult
$Res call({String? playbackModel, TranscodingInfo? transCodeInfo});
}
/// @nodoc
class _$SessionInfoModelCopyWithImpl<$Res, $Val extends SessionInfoModel>
implements $SessionInfoModelCopyWith<$Res> {
_$SessionInfoModelCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of SessionInfoModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? playbackModel = freezed,
Object? transCodeInfo = freezed,
}) {
return _then(_value.copyWith(
playbackModel: freezed == playbackModel
? _value.playbackModel
: playbackModel // ignore: cast_nullable_to_non_nullable
as String?,
transCodeInfo: freezed == transCodeInfo
? _value.transCodeInfo
: transCodeInfo // ignore: cast_nullable_to_non_nullable
as TranscodingInfo?,
) as $Val);
}
}
/// @nodoc
abstract class _$$SessionInfoModelImplCopyWith<$Res>
implements $SessionInfoModelCopyWith<$Res> {
factory _$$SessionInfoModelImplCopyWith(_$SessionInfoModelImpl value,
$Res Function(_$SessionInfoModelImpl) then) =
__$$SessionInfoModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String? playbackModel, TranscodingInfo? transCodeInfo});
}
/// @nodoc
class __$$SessionInfoModelImplCopyWithImpl<$Res>
extends _$SessionInfoModelCopyWithImpl<$Res, _$SessionInfoModelImpl>
implements _$$SessionInfoModelImplCopyWith<$Res> {
__$$SessionInfoModelImplCopyWithImpl(_$SessionInfoModelImpl _value,
$Res Function(_$SessionInfoModelImpl) _then)
: super(_value, _then);
/// Create a copy of SessionInfoModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? playbackModel = freezed,
Object? transCodeInfo = freezed,
}) {
return _then(_$SessionInfoModelImpl(
playbackModel: freezed == playbackModel
? _value.playbackModel
: playbackModel // ignore: cast_nullable_to_non_nullable
as String?,
transCodeInfo: freezed == transCodeInfo
? _value.transCodeInfo
: transCodeInfo // ignore: cast_nullable_to_non_nullable
as TranscodingInfo?,
));
}
}
/// @nodoc
@ -131,30 +45,6 @@ class _$SessionInfoModelImpl extends _SessionInfoModel {
return 'SessionInfoModel(playbackModel: $playbackModel, transCodeInfo: $transCodeInfo)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$SessionInfoModelImpl &&
(identical(other.playbackModel, playbackModel) ||
other.playbackModel == playbackModel) &&
(identical(other.transCodeInfo, transCodeInfo) ||
other.transCodeInfo == transCodeInfo));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType, playbackModel, transCodeInfo);
/// Create a copy of SessionInfoModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$SessionInfoModelImplCopyWith<_$SessionInfoModelImpl> get copyWith =>
__$$SessionInfoModelImplCopyWithImpl<_$SessionInfoModelImpl>(
this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$SessionInfoModelImplToJson(
@ -176,11 +66,4 @@ abstract class _SessionInfoModel extends SessionInfoModel {
String? get playbackModel;
@override
TranscodingInfo? get transCodeInfo;
/// Create a copy of SessionInfoModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$SessionInfoModelImplCopyWith<_$SessionInfoModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View file

@ -12,9 +12,18 @@ import 'package:fladder/util/update_checker.dart';
part 'update_provider.freezed.dart';
part 'update_provider.g.dart';
final hasNewUpdateProvider = Provider<bool>((ref) =>
ref.watch(clientSettingsProvider.select((value) => value.lastViewedUpdate)) !=
ref.watch(updateProvider.select((value) => value.latestRelease?.version)));
final hasNewUpdateProvider = Provider<bool>((ref) {
final latestRelease = ref.watch(updateProvider).latestRelease;
final lastViewedVersion = ref.watch(clientSettingsProvider.select((value) => value.lastViewedUpdate));
final latestVersion = latestRelease?.version;
if (latestVersion == null || lastViewedVersion == null) {
return false;
}
return latestVersion != lastViewedVersion;
});
@Riverpod(keepAlive: true)
class Update extends _$Update {
@ -60,7 +69,7 @@ class Update extends _$Update {
Future<List<ReleaseInfo>> _fetchLatest() async {
final latest = await updateChecker.fetchRecentReleases();
state = state.copyWith(
state = UpdatesModel(
lastRelease: latest,
);
return latest;

View file

@ -17,82 +17,6 @@ final _privateConstructorUsedError = UnsupportedError(
/// @nodoc
mixin _$UpdatesModel {
List<ReleaseInfo> get lastRelease => throw _privateConstructorUsedError;
/// Create a copy of UpdatesModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$UpdatesModelCopyWith<UpdatesModel> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $UpdatesModelCopyWith<$Res> {
factory $UpdatesModelCopyWith(
UpdatesModel value, $Res Function(UpdatesModel) then) =
_$UpdatesModelCopyWithImpl<$Res, UpdatesModel>;
@useResult
$Res call({List<ReleaseInfo> lastRelease});
}
/// @nodoc
class _$UpdatesModelCopyWithImpl<$Res, $Val extends UpdatesModel>
implements $UpdatesModelCopyWith<$Res> {
_$UpdatesModelCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of UpdatesModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? lastRelease = null,
}) {
return _then(_value.copyWith(
lastRelease: null == lastRelease
? _value.lastRelease
: lastRelease // ignore: cast_nullable_to_non_nullable
as List<ReleaseInfo>,
) as $Val);
}
}
/// @nodoc
abstract class _$$UpdatesModelImplCopyWith<$Res>
implements $UpdatesModelCopyWith<$Res> {
factory _$$UpdatesModelImplCopyWith(
_$UpdatesModelImpl value, $Res Function(_$UpdatesModelImpl) then) =
__$$UpdatesModelImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({List<ReleaseInfo> lastRelease});
}
/// @nodoc
class __$$UpdatesModelImplCopyWithImpl<$Res>
extends _$UpdatesModelCopyWithImpl<$Res, _$UpdatesModelImpl>
implements _$$UpdatesModelImplCopyWith<$Res> {
__$$UpdatesModelImplCopyWithImpl(
_$UpdatesModelImpl _value, $Res Function(_$UpdatesModelImpl) _then)
: super(_value, _then);
/// Create a copy of UpdatesModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? lastRelease = null,
}) {
return _then(_$UpdatesModelImpl(
lastRelease: null == lastRelease
? _value._lastRelease
: lastRelease // ignore: cast_nullable_to_non_nullable
as List<ReleaseInfo>,
));
}
}
/// @nodoc
@ -123,27 +47,6 @@ class _$UpdatesModelImpl extends _UpdatesModel with DiagnosticableTreeMixin {
..add(DiagnosticsProperty('type', 'UpdatesModel'))
..add(DiagnosticsProperty('lastRelease', lastRelease));
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$UpdatesModelImpl &&
const DeepCollectionEquality()
.equals(other._lastRelease, _lastRelease));
}
@override
int get hashCode => Object.hash(
runtimeType, const DeepCollectionEquality().hash(_lastRelease));
/// Create a copy of UpdatesModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$UpdatesModelImplCopyWith<_$UpdatesModelImpl> get copyWith =>
__$$UpdatesModelImplCopyWithImpl<_$UpdatesModelImpl>(this, _$identity);
}
abstract class _UpdatesModel extends UpdatesModel {
@ -153,11 +56,4 @@ abstract class _UpdatesModel extends UpdatesModel {
@override
List<ReleaseInfo> get lastRelease;
/// Create a copy of UpdatesModel
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$UpdatesModelImplCopyWith<_$UpdatesModelImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View file

@ -6,7 +6,7 @@ part of 'update_provider.dart';
// RiverpodGenerator
// **************************************************************************
String _$updateHash() => r'97f7aca4e255d654a9295e1e9e019536faf6455e';
String _$updateHash() => r'e22205cb13e6b43df1296de90e39059f09bb80a8';
/// See also [Update].
@ProviderFor(Update)

View file

@ -178,7 +178,9 @@ class User extends _$User {
if (e.id == model.id) {
return model;
} else {
return e.copyWith(isFavourite: model.isFavourite && model.containsSameIds(e.ids) ? false : e.isFavourite);
return e.copyWith(
isFavourite: model.isFavourite && model.containsSameIds(e.ids) ? false : e.isFavourite,
);
}
},
).toList());