mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
refactor: remove riverpod generator (#27874)
Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
@@ -1,17 +1,22 @@
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/models/activities/activity.model.dart';
|
||||
import 'package:immich_mobile/providers/activity_service.provider.dart';
|
||||
import 'package:immich_mobile/providers/activity_statistics.provider.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'activity.provider.g.dart';
|
||||
|
||||
// ignore: unintended_html_in_doc_comment
|
||||
/// Maintains the current list of all activities for <share-album-id, asset>
|
||||
@riverpod
|
||||
class AlbumActivity extends _$AlbumActivity {
|
||||
|
||||
final albumActivityProvider = AsyncNotifierProvider.autoDispose
|
||||
.family<AlbumActivity, List<Activity>, (String albumId, String? assetId)>(AlbumActivity.new);
|
||||
|
||||
class AlbumActivity extends AutoDisposeFamilyAsyncNotifier<List<Activity>, (String albumId, String? assetId)> {
|
||||
late String albumId;
|
||||
late String? assetId;
|
||||
|
||||
@override
|
||||
Future<List<Activity>> build(String albumId, [String? assetId]) async {
|
||||
Future<List<Activity>> build((String albumId, String? assetId) args) async {
|
||||
albumId = args.$1;
|
||||
assetId = args.$2;
|
||||
return ref.watch(activityServiceProvider).getAllActivities(albumId, assetId: assetId);
|
||||
}
|
||||
|
||||
@@ -23,14 +28,7 @@ class AlbumActivity extends _$AlbumActivity {
|
||||
}
|
||||
|
||||
if (assetId != null) {
|
||||
ref.read(albumActivityProvider(albumId).notifier)._removeFromState(id);
|
||||
}
|
||||
|
||||
if (removedActivity.type == ActivityType.comment) {
|
||||
ref.watch(activityStatisticsProvider(albumId, assetId).notifier).removeActivity();
|
||||
if (assetId != null) {
|
||||
ref.watch(activityStatisticsProvider(albumId).notifier).removeActivity();
|
||||
}
|
||||
ref.read(albumActivityProvider((albumId, assetId)).notifier)._removeFromState(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,7 +38,7 @@ class AlbumActivity extends _$AlbumActivity {
|
||||
if (activity.hasValue) {
|
||||
_addToState(activity.requireValue);
|
||||
if (assetId != null) {
|
||||
ref.read(albumActivityProvider(albumId).notifier)._addToState(activity.requireValue);
|
||||
ref.read(albumActivityProvider((albumId, assetId)).notifier)._addToState(activity.requireValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,13 +51,7 @@ class AlbumActivity extends _$AlbumActivity {
|
||||
if (activity.hasValue) {
|
||||
_addToState(activity.requireValue);
|
||||
if (assetId != null) {
|
||||
ref.read(albumActivityProvider(albumId).notifier)._addToState(activity.requireValue);
|
||||
}
|
||||
ref.watch(activityStatisticsProvider(albumId, assetId).notifier).addActivity();
|
||||
// The previous addActivity call would increase the count of an asset if assetId != null
|
||||
// To also increase the activity count of the album, calling it once again with assetId set to null
|
||||
if (assetId != null) {
|
||||
ref.watch(activityStatisticsProvider(albumId).notifier).addActivity();
|
||||
ref.read(albumActivityProvider((albumId, assetId)).notifier)._addToState(activity.requireValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,6 +79,3 @@ class AlbumActivity extends _$AlbumActivity {
|
||||
return activity;
|
||||
}
|
||||
}
|
||||
|
||||
/// Mock class for testing
|
||||
abstract class AlbumActivityInternal extends _$AlbumActivity {}
|
||||
|
||||
-194
@@ -1,194 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'activity.provider.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$albumActivityHash() => r'154e8ae98da3efc142369eae46d4005468fd67da';
|
||||
|
||||
/// Copied from Dart SDK
|
||||
class _SystemHash {
|
||||
_SystemHash._();
|
||||
|
||||
static int combine(int hash, int value) {
|
||||
// ignore: parameter_assignments
|
||||
hash = 0x1fffffff & (hash + value);
|
||||
// ignore: parameter_assignments
|
||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
||||
return hash ^ (hash >> 6);
|
||||
}
|
||||
|
||||
static int finish(int hash) {
|
||||
// ignore: parameter_assignments
|
||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
||||
// ignore: parameter_assignments
|
||||
hash = hash ^ (hash >> 11);
|
||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _$AlbumActivity
|
||||
extends BuildlessAutoDisposeAsyncNotifier<List<Activity>> {
|
||||
late final String albumId;
|
||||
late final String? assetId;
|
||||
|
||||
FutureOr<List<Activity>> build(String albumId, [String? assetId]);
|
||||
}
|
||||
|
||||
/// Maintains the current list of all activities for <share-album-id, asset>
|
||||
///
|
||||
/// Copied from [AlbumActivity].
|
||||
@ProviderFor(AlbumActivity)
|
||||
const albumActivityProvider = AlbumActivityFamily();
|
||||
|
||||
/// Maintains the current list of all activities for <share-album-id, asset>
|
||||
///
|
||||
/// Copied from [AlbumActivity].
|
||||
class AlbumActivityFamily extends Family<AsyncValue<List<Activity>>> {
|
||||
/// Maintains the current list of all activities for <share-album-id, asset>
|
||||
///
|
||||
/// Copied from [AlbumActivity].
|
||||
const AlbumActivityFamily();
|
||||
|
||||
/// Maintains the current list of all activities for <share-album-id, asset>
|
||||
///
|
||||
/// Copied from [AlbumActivity].
|
||||
AlbumActivityProvider call(String albumId, [String? assetId]) {
|
||||
return AlbumActivityProvider(albumId, assetId);
|
||||
}
|
||||
|
||||
@override
|
||||
AlbumActivityProvider getProviderOverride(
|
||||
covariant AlbumActivityProvider provider,
|
||||
) {
|
||||
return call(provider.albumId, provider.assetId);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
|
||||
@override
|
||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
||||
|
||||
@override
|
||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
||||
_allTransitiveDependencies;
|
||||
|
||||
@override
|
||||
String? get name => r'albumActivityProvider';
|
||||
}
|
||||
|
||||
/// Maintains the current list of all activities for <share-album-id, asset>
|
||||
///
|
||||
/// Copied from [AlbumActivity].
|
||||
class AlbumActivityProvider
|
||||
extends
|
||||
AutoDisposeAsyncNotifierProviderImpl<AlbumActivity, List<Activity>> {
|
||||
/// Maintains the current list of all activities for <share-album-id, asset>
|
||||
///
|
||||
/// Copied from [AlbumActivity].
|
||||
AlbumActivityProvider(String albumId, [String? assetId])
|
||||
: this._internal(
|
||||
() => AlbumActivity()
|
||||
..albumId = albumId
|
||||
..assetId = assetId,
|
||||
from: albumActivityProvider,
|
||||
name: r'albumActivityProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$albumActivityHash,
|
||||
dependencies: AlbumActivityFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
AlbumActivityFamily._allTransitiveDependencies,
|
||||
albumId: albumId,
|
||||
assetId: assetId,
|
||||
);
|
||||
|
||||
AlbumActivityProvider._internal(
|
||||
super._createNotifier, {
|
||||
required super.name,
|
||||
required super.dependencies,
|
||||
required super.allTransitiveDependencies,
|
||||
required super.debugGetCreateSourceHash,
|
||||
required super.from,
|
||||
required this.albumId,
|
||||
required this.assetId,
|
||||
}) : super.internal();
|
||||
|
||||
final String albumId;
|
||||
final String? assetId;
|
||||
|
||||
@override
|
||||
FutureOr<List<Activity>> runNotifierBuild(covariant AlbumActivity notifier) {
|
||||
return notifier.build(albumId, assetId);
|
||||
}
|
||||
|
||||
@override
|
||||
Override overrideWith(AlbumActivity Function() create) {
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
override: AlbumActivityProvider._internal(
|
||||
() => create()
|
||||
..albumId = albumId
|
||||
..assetId = assetId,
|
||||
from: from,
|
||||
name: null,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
debugGetCreateSourceHash: null,
|
||||
albumId: albumId,
|
||||
assetId: assetId,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
AutoDisposeAsyncNotifierProviderElement<AlbumActivity, List<Activity>>
|
||||
createElement() {
|
||||
return _AlbumActivityProviderElement(this);
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return other is AlbumActivityProvider &&
|
||||
other.albumId == albumId &&
|
||||
other.assetId == assetId;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
||||
hash = _SystemHash.combine(hash, albumId.hashCode);
|
||||
hash = _SystemHash.combine(hash, assetId.hashCode);
|
||||
|
||||
return _SystemHash.finish(hash);
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
mixin AlbumActivityRef on AutoDisposeAsyncNotifierProviderRef<List<Activity>> {
|
||||
/// The parameter `albumId` of this provider.
|
||||
String get albumId;
|
||||
|
||||
/// The parameter `assetId` of this provider.
|
||||
String? get assetId;
|
||||
}
|
||||
|
||||
class _AlbumActivityProviderElement
|
||||
extends
|
||||
AutoDisposeAsyncNotifierProviderElement<AlbumActivity, List<Activity>>
|
||||
with AlbumActivityRef {
|
||||
_AlbumActivityProviderElement(super.provider);
|
||||
|
||||
@override
|
||||
String get albumId => (origin as AlbumActivityProvider).albumId;
|
||||
@override
|
||||
String? get assetId => (origin as AlbumActivityProvider).assetId;
|
||||
}
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
@@ -3,13 +3,11 @@ import 'package:immich_mobile/providers/infrastructure/asset.provider.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/timeline.provider.dart';
|
||||
import 'package:immich_mobile/repositories/activity_api.repository.dart';
|
||||
import 'package:immich_mobile/services/activity.service.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'activity_service.provider.g.dart';
|
||||
|
||||
@riverpod
|
||||
ActivityService activityService(Ref ref) => ActivityService(
|
||||
ref.watch(activityApiRepositoryProvider),
|
||||
ref.watch(timelineFactoryProvider),
|
||||
ref.watch(assetServiceProvider),
|
||||
);
|
||||
final activityServiceProvider = Provider.autoDispose<ActivityService>((ref) {
|
||||
return ActivityService(
|
||||
ref.watch(activityApiRepositoryProvider),
|
||||
ref.watch(timelineFactoryProvider),
|
||||
ref.watch(assetServiceProvider),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'activity_service.provider.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$activityServiceHash() => r'3ce0eb33948138057cc63f07a7598047b99e7599';
|
||||
|
||||
/// See also [activityService].
|
||||
@ProviderFor(activityService)
|
||||
final activityServiceProvider = AutoDisposeProvider<ActivityService>.internal(
|
||||
activityService,
|
||||
name: r'activityServiceProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$activityServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
typedef ActivityServiceRef = AutoDisposeProviderRef<ActivityService>;
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
@@ -1,22 +0,0 @@
|
||||
import 'package:immich_mobile/providers/activity_service.provider.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'activity_statistics.provider.g.dart';
|
||||
|
||||
// ignore: unintended_html_in_doc_comment
|
||||
/// Maintains the current number of comments by <shared-album, asset>
|
||||
@riverpod
|
||||
class ActivityStatistics extends _$ActivityStatistics {
|
||||
@override
|
||||
int build(String albumId, [String? assetId]) {
|
||||
ref.watch(activityServiceProvider).getStatistics(albumId, assetId: assetId).then((stats) => state = stats.comments);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void addActivity() => state = state + 1;
|
||||
|
||||
void removeActivity() => state = state - 1;
|
||||
}
|
||||
|
||||
/// Mock class for testing
|
||||
abstract class ActivityStatisticsInternal extends _$ActivityStatistics {}
|
||||
@@ -1,191 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'activity_statistics.provider.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$activityStatisticsHash() =>
|
||||
r'1f43f0bcb11c754ca3cb586a13570db25023b9a8';
|
||||
|
||||
/// Copied from Dart SDK
|
||||
class _SystemHash {
|
||||
_SystemHash._();
|
||||
|
||||
static int combine(int hash, int value) {
|
||||
// ignore: parameter_assignments
|
||||
hash = 0x1fffffff & (hash + value);
|
||||
// ignore: parameter_assignments
|
||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
||||
return hash ^ (hash >> 6);
|
||||
}
|
||||
|
||||
static int finish(int hash) {
|
||||
// ignore: parameter_assignments
|
||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
||||
// ignore: parameter_assignments
|
||||
hash = hash ^ (hash >> 11);
|
||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _$ActivityStatistics extends BuildlessAutoDisposeNotifier<int> {
|
||||
late final String albumId;
|
||||
late final String? assetId;
|
||||
|
||||
int build(String albumId, [String? assetId]);
|
||||
}
|
||||
|
||||
/// Maintains the current number of comments by <shared-album, asset>
|
||||
///
|
||||
/// Copied from [ActivityStatistics].
|
||||
@ProviderFor(ActivityStatistics)
|
||||
const activityStatisticsProvider = ActivityStatisticsFamily();
|
||||
|
||||
/// Maintains the current number of comments by <shared-album, asset>
|
||||
///
|
||||
/// Copied from [ActivityStatistics].
|
||||
class ActivityStatisticsFamily extends Family<int> {
|
||||
/// Maintains the current number of comments by <shared-album, asset>
|
||||
///
|
||||
/// Copied from [ActivityStatistics].
|
||||
const ActivityStatisticsFamily();
|
||||
|
||||
/// Maintains the current number of comments by <shared-album, asset>
|
||||
///
|
||||
/// Copied from [ActivityStatistics].
|
||||
ActivityStatisticsProvider call(String albumId, [String? assetId]) {
|
||||
return ActivityStatisticsProvider(albumId, assetId);
|
||||
}
|
||||
|
||||
@override
|
||||
ActivityStatisticsProvider getProviderOverride(
|
||||
covariant ActivityStatisticsProvider provider,
|
||||
) {
|
||||
return call(provider.albumId, provider.assetId);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
|
||||
@override
|
||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
||||
|
||||
@override
|
||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
||||
_allTransitiveDependencies;
|
||||
|
||||
@override
|
||||
String? get name => r'activityStatisticsProvider';
|
||||
}
|
||||
|
||||
/// Maintains the current number of comments by <shared-album, asset>
|
||||
///
|
||||
/// Copied from [ActivityStatistics].
|
||||
class ActivityStatisticsProvider
|
||||
extends AutoDisposeNotifierProviderImpl<ActivityStatistics, int> {
|
||||
/// Maintains the current number of comments by <shared-album, asset>
|
||||
///
|
||||
/// Copied from [ActivityStatistics].
|
||||
ActivityStatisticsProvider(String albumId, [String? assetId])
|
||||
: this._internal(
|
||||
() => ActivityStatistics()
|
||||
..albumId = albumId
|
||||
..assetId = assetId,
|
||||
from: activityStatisticsProvider,
|
||||
name: r'activityStatisticsProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$activityStatisticsHash,
|
||||
dependencies: ActivityStatisticsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
ActivityStatisticsFamily._allTransitiveDependencies,
|
||||
albumId: albumId,
|
||||
assetId: assetId,
|
||||
);
|
||||
|
||||
ActivityStatisticsProvider._internal(
|
||||
super._createNotifier, {
|
||||
required super.name,
|
||||
required super.dependencies,
|
||||
required super.allTransitiveDependencies,
|
||||
required super.debugGetCreateSourceHash,
|
||||
required super.from,
|
||||
required this.albumId,
|
||||
required this.assetId,
|
||||
}) : super.internal();
|
||||
|
||||
final String albumId;
|
||||
final String? assetId;
|
||||
|
||||
@override
|
||||
int runNotifierBuild(covariant ActivityStatistics notifier) {
|
||||
return notifier.build(albumId, assetId);
|
||||
}
|
||||
|
||||
@override
|
||||
Override overrideWith(ActivityStatistics Function() create) {
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
override: ActivityStatisticsProvider._internal(
|
||||
() => create()
|
||||
..albumId = albumId
|
||||
..assetId = assetId,
|
||||
from: from,
|
||||
name: null,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
debugGetCreateSourceHash: null,
|
||||
albumId: albumId,
|
||||
assetId: assetId,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
AutoDisposeNotifierProviderElement<ActivityStatistics, int> createElement() {
|
||||
return _ActivityStatisticsProviderElement(this);
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return other is ActivityStatisticsProvider &&
|
||||
other.albumId == albumId &&
|
||||
other.assetId == assetId;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
||||
hash = _SystemHash.combine(hash, albumId.hashCode);
|
||||
hash = _SystemHash.combine(hash, assetId.hashCode);
|
||||
|
||||
return _SystemHash.finish(hash);
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
mixin ActivityStatisticsRef on AutoDisposeNotifierProviderRef<int> {
|
||||
/// The parameter `albumId` of this provider.
|
||||
String get albumId;
|
||||
|
||||
/// The parameter `assetId` of this provider.
|
||||
String? get assetId;
|
||||
}
|
||||
|
||||
class _ActivityStatisticsProviderElement
|
||||
extends AutoDisposeNotifierProviderElement<ActivityStatistics, int>
|
||||
with ActivityStatisticsRef {
|
||||
_ActivityStatisticsProviderElement(super.provider);
|
||||
|
||||
@override
|
||||
String get albumId => (origin as ActivityStatisticsProvider).albumId;
|
||||
@override
|
||||
String? get assetId => (origin as ActivityStatisticsProvider).assetId;
|
||||
}
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
@@ -1,8 +1,4 @@
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/services/api.service.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'api.provider.g.dart';
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
ApiService apiService(Ref _) => ApiService();
|
||||
final apiServiceProvider = Provider((_) => ApiService());
|
||||
|
||||
Generated
-27
@@ -1,27 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'api.provider.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$apiServiceHash() => r'187a7de59b064fab1104c23717f18ce0ae3e426c';
|
||||
|
||||
/// See also [apiService].
|
||||
@ProviderFor(apiService)
|
||||
final apiServiceProvider = Provider<ApiService>.internal(
|
||||
apiService,
|
||||
name: r'apiServiceProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$apiServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
typedef ApiServiceRef = ProviderRef<ApiService>;
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
@@ -1,8 +1,4 @@
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/services/app_settings.service.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'app_settings.provider.g.dart';
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
AppSettingsService appSettingsService(Ref _) => const AppSettingsService();
|
||||
final appSettingsServiceProvider = Provider((_) => const AppSettingsService());
|
||||
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'app_settings.provider.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$appSettingsServiceHash() =>
|
||||
r'89cece3a19e06612f5639ae290120e854a0c5a31';
|
||||
|
||||
/// See also [appSettingsService].
|
||||
@ProviderFor(appSettingsService)
|
||||
final appSettingsServiceProvider = Provider<AppSettingsService>.internal(
|
||||
appSettingsService,
|
||||
name: r'appSettingsServiceProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$appSettingsServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
typedef AppSettingsServiceRef = ProviderRef<AppSettingsService>;
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
@@ -2,7 +2,6 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
||||
import 'package:immich_mobile/providers/asset_viewer/video_player_provider.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/asset.provider.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
class AssetViewerState {
|
||||
final double backgroundOpacity;
|
||||
|
||||
@@ -2,13 +2,9 @@ import 'dart:convert';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'immich_logo_provider.g.dart';
|
||||
|
||||
@riverpod
|
||||
Future<Uint8List> immichLogo(Ref _) async {
|
||||
final immichLogoProvider = FutureProvider.autoDispose<Uint8List>((ref) async {
|
||||
final json = await rootBundle.loadString('assets/immich-logo.json');
|
||||
final j = jsonDecode(json);
|
||||
return base64Decode(j['content']);
|
||||
}
|
||||
});
|
||||
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'immich_logo_provider.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$immichLogoHash() => r'6de7fcca1ef9acef6ab7398eb0c664080747e0ea';
|
||||
|
||||
/// See also [immichLogo].
|
||||
@ProviderFor(immichLogo)
|
||||
final immichLogoProvider = AutoDisposeFutureProvider<Uint8List>.internal(
|
||||
immichLogo,
|
||||
name: r'immichLogoProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$immichLogoHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
typedef ImmichLogoRef = AutoDisposeFutureProviderRef<Uint8List>;
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
@@ -3,6 +3,7 @@ import 'dart:async';
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:background_downloader/background_downloader.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/constants/enums.dart';
|
||||
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
||||
import 'package:immich_mobile/domain/models/asset_edit.model.dart';
|
||||
@@ -22,7 +23,6 @@ import 'package:immich_mobile/services/foreground_upload.service.dart';
|
||||
import 'package:immich_mobile/widgets/asset_grid/delete_dialog.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:openapi/api.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
final actionProvider = NotifierProvider<ActionNotifier, void>(ActionNotifier.new, dependencies: [multiSelectProvider]);
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/domain/models/memory.model.dart';
|
||||
import 'package:immich_mobile/domain/services/memory.service.dart';
|
||||
import 'package:immich_mobile/infrastructure/repositories/memory.repository.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/db.provider.dart';
|
||||
import 'package:immich_mobile/providers/user.provider.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
final driftMemoryRepositoryProvider = Provider<DriftMemoryRepository>(
|
||||
(ref) => DriftMemoryRepository(ref.watch(driftProvider)),
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/domain/models/user.model.dart';
|
||||
import 'package:immich_mobile/domain/services/partner.service.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/user.provider.dart';
|
||||
import 'package:immich_mobile/providers/user.provider.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
class PartnerNotifier extends Notifier<List<PartnerUserDto>> {
|
||||
late DriftPartnerService _driftPartnerService;
|
||||
|
||||
@@ -8,7 +8,6 @@ import 'package:immich_mobile/models/albums/album_search.model.dart';
|
||||
import 'package:immich_mobile/providers/album/album_sort_by_options.provider.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/album.provider.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
class RemoteAlbumState {
|
||||
final List<RemoteAlbum> albums;
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/domain/services/store.service.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'store.provider.g.dart';
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
StoreService storeService(Ref _) => StoreService.I;
|
||||
final storeServiceProvider = Provider((_) => StoreService.I);
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'store.provider.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$storeServiceHash() => r'250e10497c42df360e9e1f9a618d0b19c1b5b0a0';
|
||||
|
||||
/// See also [storeService].
|
||||
@ProviderFor(storeService)
|
||||
final storeServiceProvider = Provider<StoreService>.internal(
|
||||
storeService,
|
||||
name: r'storeServiceProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$storeServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
typedef StoreServiceRef = ProviderRef<StoreService>;
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
@@ -9,16 +9,15 @@ import 'package:immich_mobile/providers/infrastructure/db.provider.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/partner.provider.dart';
|
||||
import 'package:immich_mobile/providers/infrastructure/store.provider.dart';
|
||||
import 'package:immich_mobile/repositories/partner_api.repository.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'user.provider.g.dart';
|
||||
final userApiRepositoryProvider = Provider((ref) => UserApiRepository(ref.watch(apiServiceProvider).usersApi));
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
UserApiRepository userApiRepository(Ref ref) => UserApiRepository(ref.watch(apiServiceProvider).usersApi);
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
UserService userService(Ref ref) =>
|
||||
UserService(userApiRepository: ref.watch(userApiRepositoryProvider), storeService: ref.watch(storeServiceProvider));
|
||||
final userServiceProvider = Provider(
|
||||
(ref) => UserService(
|
||||
userApiRepository: ref.watch(userApiRepositoryProvider),
|
||||
storeService: ref.watch(storeServiceProvider),
|
||||
),
|
||||
);
|
||||
|
||||
/// Drifts
|
||||
final driftPartnerRepositoryProvider = Provider<DriftPartnerRepository>(
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'user.provider.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$userApiRepositoryHash() => r'8a7340ca4544c8c6b20225c65bff2abb9e96baa2';
|
||||
|
||||
/// See also [userApiRepository].
|
||||
@ProviderFor(userApiRepository)
|
||||
final userApiRepositoryProvider = Provider<UserApiRepository>.internal(
|
||||
userApiRepository,
|
||||
name: r'userApiRepositoryProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$userApiRepositoryHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
typedef UserApiRepositoryRef = ProviderRef<UserApiRepository>;
|
||||
String _$userServiceHash() => r'47e607f3b484b51bcb634d47e3cbf1f6ef25da97';
|
||||
|
||||
/// See also [userService].
|
||||
@ProviderFor(userService)
|
||||
final userServiceProvider = Provider<UserService>.internal(
|
||||
userService,
|
||||
name: r'userServiceProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$userServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
typedef UserServiceRef = ProviderRef<UserService>;
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
@@ -2,12 +2,8 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/models/map/map_marker.model.dart';
|
||||
import 'package:immich_mobile/providers/map/map_service.provider.dart';
|
||||
import 'package:immich_mobile/providers/map/map_state.provider.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'map_marker.provider.g.dart';
|
||||
|
||||
@riverpod
|
||||
Future<List<MapMarker>> mapMarkers(Ref ref) async {
|
||||
final mapMarkersProvider = FutureProvider.autoDispose<List<MapMarker>>((ref) async {
|
||||
final service = ref.read(mapServiceProvider);
|
||||
final mapState = ref.read(mapStateNotifierProvider);
|
||||
DateTime? fileCreatedAfter;
|
||||
@@ -31,4 +27,4 @@ Future<List<MapMarker>> mapMarkers(Ref ref) async {
|
||||
);
|
||||
|
||||
return markers.toList();
|
||||
}
|
||||
});
|
||||
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'map_marker.provider.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$mapMarkersHash() => r'a0c129fcddbf1b9bce4aafcd2e47a858ab6ef1c9';
|
||||
|
||||
/// See also [mapMarkers].
|
||||
@ProviderFor(mapMarkers)
|
||||
final mapMarkersProvider = AutoDisposeFutureProvider<List<MapMarker>>.internal(
|
||||
mapMarkers,
|
||||
name: r'mapMarkersProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$mapMarkersHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
typedef MapMarkersRef = AutoDisposeFutureProviderRef<List<MapMarker>>;
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
@@ -1,9 +1,5 @@
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/services/map.service.dart';
|
||||
import 'package:immich_mobile/providers/api.provider.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:immich_mobile/services/map.service.dart';
|
||||
|
||||
part 'map_service.provider.g.dart';
|
||||
|
||||
@riverpod
|
||||
MapService mapService(Ref ref) => MapService(ref.watch(apiServiceProvider));
|
||||
final mapServiceProvider = Provider.autoDispose<MapService>((ref) => MapService(ref.watch(apiServiceProvider)));
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'map_service.provider.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$mapServiceHash() => r'ffc8f38b726083452b9df236ed58903879348987';
|
||||
|
||||
/// See also [mapService].
|
||||
@ProviderFor(mapService)
|
||||
final mapServiceProvider = AutoDisposeProvider<MapService>.internal(
|
||||
mapService,
|
||||
name: r'mapServiceProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$mapServiceHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
typedef MapServiceRef = AutoDisposeProviderRef<MapService>;
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
@@ -1,14 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/models/map/map_state.model.dart';
|
||||
import 'package:immich_mobile/providers/app_settings.provider.dart';
|
||||
import 'package:immich_mobile/providers/server_info.provider.dart';
|
||||
import 'package:immich_mobile/services/app_settings.service.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'map_state.provider.g.dart';
|
||||
final mapStateNotifierProvider = NotifierProvider<MapStateNotifier, MapState>(MapStateNotifier.new);
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
class MapStateNotifier extends _$MapStateNotifier {
|
||||
class MapStateNotifier extends Notifier<MapState> {
|
||||
@override
|
||||
MapState build() {
|
||||
final appSettingsProvider = ref.read(appSettingsServiceProvider);
|
||||
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'map_state.provider.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$mapStateNotifierHash() => r'22e4e571bd0730dbc34b109255a62b920e9c7d66';
|
||||
|
||||
/// See also [MapStateNotifier].
|
||||
@ProviderFor(MapStateNotifier)
|
||||
final mapStateNotifierProvider =
|
||||
NotifierProvider<MapStateNotifier, MapState>.internal(
|
||||
MapStateNotifier.new,
|
||||
name: r'mapStateNotifierProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$mapStateNotifierHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef _$MapStateNotifier = Notifier<MapState>;
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
@@ -1,27 +1,24 @@
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/domain/models/person.model.dart';
|
||||
import 'package:immich_mobile/services/person.service.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'people.provider.g.dart';
|
||||
|
||||
@riverpod
|
||||
Future<List<PersonDto>> getAllPeople(Ref ref) async {
|
||||
final getAllPeopleProvider = FutureProvider.autoDispose<List<PersonDto>>((ref) async {
|
||||
final PersonService personService = ref.read(personServiceProvider);
|
||||
|
||||
final people = await personService.getAllPeople();
|
||||
|
||||
return people;
|
||||
}
|
||||
});
|
||||
|
||||
@riverpod
|
||||
Future<bool> updatePersonName(Ref ref, String personId, String updatedName) async {
|
||||
final PersonService personService = ref.read(personServiceProvider);
|
||||
final person = await personService.updateName(personId, updatedName);
|
||||
final updatePersonNameProvider = FutureProvider.autoDispose(
|
||||
(ref) => (String personId, String updatedName) async {
|
||||
final PersonService personService = ref.read(personServiceProvider);
|
||||
final person = await personService.updateName(personId, updatedName);
|
||||
|
||||
if (person != null && person.name == updatedName) {
|
||||
ref.invalidate(getAllPeopleProvider);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (person != null && person.name == updatedName) {
|
||||
ref.invalidate(getAllPeopleProvider);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
);
|
||||
|
||||
-182
@@ -1,182 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'people.provider.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$getAllPeopleHash() => r'2c5e6a207683f15ab209650615fdf9cb7f76c736';
|
||||
|
||||
/// See also [getAllPeople].
|
||||
@ProviderFor(getAllPeople)
|
||||
final getAllPeopleProvider =
|
||||
AutoDisposeFutureProvider<List<PersonDto>>.internal(
|
||||
getAllPeople,
|
||||
name: r'getAllPeopleProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$getAllPeopleHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
typedef GetAllPeopleRef = AutoDisposeFutureProviderRef<List<PersonDto>>;
|
||||
String _$updatePersonNameHash() => r'45f7693172de522a227406d8198811434cf2bbbc';
|
||||
|
||||
/// Copied from Dart SDK
|
||||
class _SystemHash {
|
||||
_SystemHash._();
|
||||
|
||||
static int combine(int hash, int value) {
|
||||
// ignore: parameter_assignments
|
||||
hash = 0x1fffffff & (hash + value);
|
||||
// ignore: parameter_assignments
|
||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
||||
return hash ^ (hash >> 6);
|
||||
}
|
||||
|
||||
static int finish(int hash) {
|
||||
// ignore: parameter_assignments
|
||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
||||
// ignore: parameter_assignments
|
||||
hash = hash ^ (hash >> 11);
|
||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
||||
}
|
||||
}
|
||||
|
||||
/// See also [updatePersonName].
|
||||
@ProviderFor(updatePersonName)
|
||||
const updatePersonNameProvider = UpdatePersonNameFamily();
|
||||
|
||||
/// See also [updatePersonName].
|
||||
class UpdatePersonNameFamily extends Family<AsyncValue<bool>> {
|
||||
/// See also [updatePersonName].
|
||||
const UpdatePersonNameFamily();
|
||||
|
||||
/// See also [updatePersonName].
|
||||
UpdatePersonNameProvider call(String personId, String updatedName) {
|
||||
return UpdatePersonNameProvider(personId, updatedName);
|
||||
}
|
||||
|
||||
@override
|
||||
UpdatePersonNameProvider getProviderOverride(
|
||||
covariant UpdatePersonNameProvider provider,
|
||||
) {
|
||||
return call(provider.personId, provider.updatedName);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
|
||||
@override
|
||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
||||
|
||||
@override
|
||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
||||
_allTransitiveDependencies;
|
||||
|
||||
@override
|
||||
String? get name => r'updatePersonNameProvider';
|
||||
}
|
||||
|
||||
/// See also [updatePersonName].
|
||||
class UpdatePersonNameProvider extends AutoDisposeFutureProvider<bool> {
|
||||
/// See also [updatePersonName].
|
||||
UpdatePersonNameProvider(String personId, String updatedName)
|
||||
: this._internal(
|
||||
(ref) =>
|
||||
updatePersonName(ref as UpdatePersonNameRef, personId, updatedName),
|
||||
from: updatePersonNameProvider,
|
||||
name: r'updatePersonNameProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$updatePersonNameHash,
|
||||
dependencies: UpdatePersonNameFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
UpdatePersonNameFamily._allTransitiveDependencies,
|
||||
personId: personId,
|
||||
updatedName: updatedName,
|
||||
);
|
||||
|
||||
UpdatePersonNameProvider._internal(
|
||||
super._createNotifier, {
|
||||
required super.name,
|
||||
required super.dependencies,
|
||||
required super.allTransitiveDependencies,
|
||||
required super.debugGetCreateSourceHash,
|
||||
required super.from,
|
||||
required this.personId,
|
||||
required this.updatedName,
|
||||
}) : super.internal();
|
||||
|
||||
final String personId;
|
||||
final String updatedName;
|
||||
|
||||
@override
|
||||
Override overrideWith(
|
||||
FutureOr<bool> Function(UpdatePersonNameRef provider) create,
|
||||
) {
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
override: UpdatePersonNameProvider._internal(
|
||||
(ref) => create(ref as UpdatePersonNameRef),
|
||||
from: from,
|
||||
name: null,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
debugGetCreateSourceHash: null,
|
||||
personId: personId,
|
||||
updatedName: updatedName,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
AutoDisposeFutureProviderElement<bool> createElement() {
|
||||
return _UpdatePersonNameProviderElement(this);
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return other is UpdatePersonNameProvider &&
|
||||
other.personId == personId &&
|
||||
other.updatedName == updatedName;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
||||
hash = _SystemHash.combine(hash, personId.hashCode);
|
||||
hash = _SystemHash.combine(hash, updatedName.hashCode);
|
||||
|
||||
return _SystemHash.finish(hash);
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
mixin UpdatePersonNameRef on AutoDisposeFutureProviderRef<bool> {
|
||||
/// The parameter `personId` of this provider.
|
||||
String get personId;
|
||||
|
||||
/// The parameter `updatedName` of this provider.
|
||||
String get updatedName;
|
||||
}
|
||||
|
||||
class _UpdatePersonNameProviderElement
|
||||
extends AutoDisposeFutureProviderElement<bool>
|
||||
with UpdatePersonNameRef {
|
||||
_UpdatePersonNameProviderElement(super.provider);
|
||||
|
||||
@override
|
||||
String get personId => (origin as UpdatePersonNameProvider).personId;
|
||||
@override
|
||||
String get updatedName => (origin as UpdatePersonNameProvider).updatedName;
|
||||
}
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
@@ -1,28 +1,47 @@
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:immich_mobile/services/search.service.dart';
|
||||
import 'package:openapi/api.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'search_filter.provider.g.dart';
|
||||
class SearchSuggestionArgs {
|
||||
SearchSuggestionType type;
|
||||
final String? locationCountry;
|
||||
final String? locationState;
|
||||
final String? make;
|
||||
final String? model;
|
||||
|
||||
@riverpod
|
||||
Future<List<String>> getSearchSuggestions(
|
||||
Ref ref,
|
||||
SearchSuggestionType type, {
|
||||
String? locationCountry,
|
||||
String? locationState,
|
||||
String? make,
|
||||
String? model,
|
||||
}) async {
|
||||
SearchSuggestionArgs({required this.type, this.locationCountry, this.locationState, this.make, this.model});
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return other is SearchSuggestionArgs &&
|
||||
other.type == type &&
|
||||
other.locationCountry == locationCountry &&
|
||||
other.locationState == locationState &&
|
||||
other.make == make &&
|
||||
other.model == model;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return type.hashCode ^ locationCountry.hashCode ^ locationState.hashCode ^ make.hashCode ^ model.hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
final getSearchSuggestionsProvider = FutureProvider.autoDispose.family<List<String>, SearchSuggestionArgs>((
|
||||
ref,
|
||||
args,
|
||||
) async {
|
||||
final SearchService service = ref.read(searchServiceProvider);
|
||||
|
||||
final suggestions = await service.getSearchSuggestions(
|
||||
type,
|
||||
country: locationCountry,
|
||||
state: locationState,
|
||||
make: make,
|
||||
model: model,
|
||||
args.type,
|
||||
country: args.locationCountry,
|
||||
state: args.locationState,
|
||||
make: args.make,
|
||||
model: args.model,
|
||||
);
|
||||
|
||||
return suggestions ?? [];
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,231 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'search_filter.provider.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$getSearchSuggestionsHash() =>
|
||||
r'bc30a65e8fcb273cbd07bab876baf67bcc794737';
|
||||
|
||||
/// Copied from Dart SDK
|
||||
class _SystemHash {
|
||||
_SystemHash._();
|
||||
|
||||
static int combine(int hash, int value) {
|
||||
// ignore: parameter_assignments
|
||||
hash = 0x1fffffff & (hash + value);
|
||||
// ignore: parameter_assignments
|
||||
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
|
||||
return hash ^ (hash >> 6);
|
||||
}
|
||||
|
||||
static int finish(int hash) {
|
||||
// ignore: parameter_assignments
|
||||
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
|
||||
// ignore: parameter_assignments
|
||||
hash = hash ^ (hash >> 11);
|
||||
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
|
||||
}
|
||||
}
|
||||
|
||||
/// See also [getSearchSuggestions].
|
||||
@ProviderFor(getSearchSuggestions)
|
||||
const getSearchSuggestionsProvider = GetSearchSuggestionsFamily();
|
||||
|
||||
/// See also [getSearchSuggestions].
|
||||
class GetSearchSuggestionsFamily extends Family<AsyncValue<List<String>>> {
|
||||
/// See also [getSearchSuggestions].
|
||||
const GetSearchSuggestionsFamily();
|
||||
|
||||
/// See also [getSearchSuggestions].
|
||||
GetSearchSuggestionsProvider call(
|
||||
SearchSuggestionType type, {
|
||||
String? locationCountry,
|
||||
String? locationState,
|
||||
String? make,
|
||||
String? model,
|
||||
}) {
|
||||
return GetSearchSuggestionsProvider(
|
||||
type,
|
||||
locationCountry: locationCountry,
|
||||
locationState: locationState,
|
||||
make: make,
|
||||
model: model,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
GetSearchSuggestionsProvider getProviderOverride(
|
||||
covariant GetSearchSuggestionsProvider provider,
|
||||
) {
|
||||
return call(
|
||||
provider.type,
|
||||
locationCountry: provider.locationCountry,
|
||||
locationState: provider.locationState,
|
||||
make: provider.make,
|
||||
model: provider.model,
|
||||
);
|
||||
}
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _dependencies = null;
|
||||
|
||||
@override
|
||||
Iterable<ProviderOrFamily>? get dependencies => _dependencies;
|
||||
|
||||
static const Iterable<ProviderOrFamily>? _allTransitiveDependencies = null;
|
||||
|
||||
@override
|
||||
Iterable<ProviderOrFamily>? get allTransitiveDependencies =>
|
||||
_allTransitiveDependencies;
|
||||
|
||||
@override
|
||||
String? get name => r'getSearchSuggestionsProvider';
|
||||
}
|
||||
|
||||
/// See also [getSearchSuggestions].
|
||||
class GetSearchSuggestionsProvider
|
||||
extends AutoDisposeFutureProvider<List<String>> {
|
||||
/// See also [getSearchSuggestions].
|
||||
GetSearchSuggestionsProvider(
|
||||
SearchSuggestionType type, {
|
||||
String? locationCountry,
|
||||
String? locationState,
|
||||
String? make,
|
||||
String? model,
|
||||
}) : this._internal(
|
||||
(ref) => getSearchSuggestions(
|
||||
ref as GetSearchSuggestionsRef,
|
||||
type,
|
||||
locationCountry: locationCountry,
|
||||
locationState: locationState,
|
||||
make: make,
|
||||
model: model,
|
||||
),
|
||||
from: getSearchSuggestionsProvider,
|
||||
name: r'getSearchSuggestionsProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$getSearchSuggestionsHash,
|
||||
dependencies: GetSearchSuggestionsFamily._dependencies,
|
||||
allTransitiveDependencies:
|
||||
GetSearchSuggestionsFamily._allTransitiveDependencies,
|
||||
type: type,
|
||||
locationCountry: locationCountry,
|
||||
locationState: locationState,
|
||||
make: make,
|
||||
model: model,
|
||||
);
|
||||
|
||||
GetSearchSuggestionsProvider._internal(
|
||||
super._createNotifier, {
|
||||
required super.name,
|
||||
required super.dependencies,
|
||||
required super.allTransitiveDependencies,
|
||||
required super.debugGetCreateSourceHash,
|
||||
required super.from,
|
||||
required this.type,
|
||||
required this.locationCountry,
|
||||
required this.locationState,
|
||||
required this.make,
|
||||
required this.model,
|
||||
}) : super.internal();
|
||||
|
||||
final SearchSuggestionType type;
|
||||
final String? locationCountry;
|
||||
final String? locationState;
|
||||
final String? make;
|
||||
final String? model;
|
||||
|
||||
@override
|
||||
Override overrideWith(
|
||||
FutureOr<List<String>> Function(GetSearchSuggestionsRef provider) create,
|
||||
) {
|
||||
return ProviderOverride(
|
||||
origin: this,
|
||||
override: GetSearchSuggestionsProvider._internal(
|
||||
(ref) => create(ref as GetSearchSuggestionsRef),
|
||||
from: from,
|
||||
name: null,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
debugGetCreateSourceHash: null,
|
||||
type: type,
|
||||
locationCountry: locationCountry,
|
||||
locationState: locationState,
|
||||
make: make,
|
||||
model: model,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
AutoDisposeFutureProviderElement<List<String>> createElement() {
|
||||
return _GetSearchSuggestionsProviderElement(this);
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return other is GetSearchSuggestionsProvider &&
|
||||
other.type == type &&
|
||||
other.locationCountry == locationCountry &&
|
||||
other.locationState == locationState &&
|
||||
other.make == make &&
|
||||
other.model == model;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
var hash = _SystemHash.combine(0, runtimeType.hashCode);
|
||||
hash = _SystemHash.combine(hash, type.hashCode);
|
||||
hash = _SystemHash.combine(hash, locationCountry.hashCode);
|
||||
hash = _SystemHash.combine(hash, locationState.hashCode);
|
||||
hash = _SystemHash.combine(hash, make.hashCode);
|
||||
hash = _SystemHash.combine(hash, model.hashCode);
|
||||
|
||||
return _SystemHash.finish(hash);
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||
// ignore: unused_element
|
||||
mixin GetSearchSuggestionsRef on AutoDisposeFutureProviderRef<List<String>> {
|
||||
/// The parameter `type` of this provider.
|
||||
SearchSuggestionType get type;
|
||||
|
||||
/// The parameter `locationCountry` of this provider.
|
||||
String? get locationCountry;
|
||||
|
||||
/// The parameter `locationState` of this provider.
|
||||
String? get locationState;
|
||||
|
||||
/// The parameter `make` of this provider.
|
||||
String? get make;
|
||||
|
||||
/// The parameter `model` of this provider.
|
||||
String? get model;
|
||||
}
|
||||
|
||||
class _GetSearchSuggestionsProviderElement
|
||||
extends AutoDisposeFutureProviderElement<List<String>>
|
||||
with GetSearchSuggestionsRef {
|
||||
_GetSearchSuggestionsProviderElement(super.provider);
|
||||
|
||||
@override
|
||||
SearchSuggestionType get type =>
|
||||
(origin as GetSearchSuggestionsProvider).type;
|
||||
@override
|
||||
String? get locationCountry =>
|
||||
(origin as GetSearchSuggestionsProvider).locationCountry;
|
||||
@override
|
||||
String? get locationState =>
|
||||
(origin as GetSearchSuggestionsProvider).locationState;
|
||||
@override
|
||||
String? get make => (origin as GetSearchSuggestionsProvider).make;
|
||||
@override
|
||||
String? get model => (origin as GetSearchSuggestionsProvider).model;
|
||||
}
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package
|
||||
Reference in New Issue
Block a user