refactor: remove riverpod generator (#27874)

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong 2026-04-17 20:01:44 +05:30 committed by GitHub
parent a456a05052
commit 2070f775d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
43 changed files with 128 additions and 1362 deletions

View File

@ -5,11 +5,11 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/domain/models/album/album.model.dart';
import 'package:immich_mobile/extensions/asyncvalue_extensions.dart';
import 'package:immich_mobile/extensions/build_context_extensions.dart';
import 'package:immich_mobile/widgets/activities/comment_bubble.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/like_activity_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/album/drift_activity_text_field.dart';
import 'package:immich_mobile/providers/activity.provider.dart';
import 'package:immich_mobile/providers/infrastructure/current_album.provider.dart';
import 'package:immich_mobile/widgets/activities/comment_bubble.dart';
@RoutePage()
class DriftActivitiesPage extends HookConsumerWidget {
@ -21,8 +21,8 @@ class DriftActivitiesPage extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final activityNotifier = ref.read(albumActivityProvider(album.id, assetId).notifier);
final activities = ref.watch(albumActivityProvider(album.id, assetId));
final activityNotifier = ref.read(albumActivityProvider((album.id, assetId)).notifier);
final activities = ref.watch(albumActivityProvider((album.id, assetId)));
final listViewScrollController = useScrollController();
void scrollToBottom() {

View File

@ -23,7 +23,7 @@ class LikeActivityActionButton extends ConsumerWidget {
final asset = ref.watch(assetViewerProvider.select((s) => s.currentAsset)) as RemoteAsset?;
final user = ref.watch(currentUserProvider);
final activities = ref.watch(albumActivityProvider(album?.id ?? "", asset?.id));
final activities = ref.watch(albumActivityProvider((album?.id ?? "", asset?.id)));
onTap(Activity? liked) async {
if (user == null) {
@ -31,12 +31,12 @@ class LikeActivityActionButton extends ConsumerWidget {
}
if (liked != null) {
await ref.read(albumActivityProvider(album?.id ?? "", asset?.id).notifier).removeActivity(liked.id);
await ref.read(albumActivityProvider((album?.id ?? "", asset?.id)).notifier).removeActivity(liked.id);
} else {
await ref.read(albumActivityProvider(album?.id ?? "", asset?.id).notifier).addLike();
await ref.read(albumActivityProvider((album?.id ?? "", asset?.id)).notifier).addLike();
}
ref.invalidate(albumActivityProvider(album?.id ?? "", asset?.id));
ref.invalidate(albumActivityProvider((album?.id ?? "", asset?.id)));
}
return activities.when(

View File

@ -4,17 +4,17 @@ 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/extensions/build_context_extensions.dart';
import 'package:immich_mobile/routing/router.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/favorite_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/motion_photo_action_button.widget.dart';
import 'package:immich_mobile/presentation/widgets/action_buttons/unfavorite_action_button.widget.dart';
import 'package:immich_mobile/providers/asset_viewer/asset_viewer.provider.dart';
import 'package:immich_mobile/presentation/widgets/asset_viewer/viewer_kebab_menu.widget.dart';
import 'package:immich_mobile/providers/activity.provider.dart';
import 'package:immich_mobile/providers/asset_viewer/asset_viewer.provider.dart';
import 'package:immich_mobile/providers/infrastructure/current_album.provider.dart';
import 'package:immich_mobile/providers/infrastructure/readonly_mode.provider.dart';
import 'package:immich_mobile/providers/routes.provider.dart';
import 'package:immich_mobile/providers/user.provider.dart';
import 'package:immich_mobile/routing/router.dart';
class ViewerTopAppBar extends ConsumerWidget implements PreferredSizeWidget {
const ViewerTopAppBar({super.key});
@ -36,7 +36,7 @@ class ViewerTopAppBar extends ConsumerWidget implements PreferredSizeWidget {
final showingDetails = ref.watch(assetViewerProvider.select((state) => state.showingDetails));
if (album != null && album.isActivityEnabled && album.isShared && asset is RemoteAsset) {
ref.watch(albumActivityProvider(album.id, asset.id));
ref.watch(albumActivityProvider((album.id, asset.id)));
}
final showingControls = ref.watch(assetViewerProvider.select((s) => s.showingControls));

View File

@ -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 {}

View File

@ -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

View File

@ -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),
);
});

View File

@ -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

View File

@ -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 {}

View File

@ -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

View File

@ -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());

View File

@ -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

View File

@ -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());

View File

@ -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

View File

@ -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;

View File

@ -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']);
}
});

View File

@ -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

View File

@ -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]);

View File

@ -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)),

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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>(

View File

@ -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

View File

@ -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();
}
});

View File

@ -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

View File

@ -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)));

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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;
},
);

View File

@ -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

View File

@ -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 ?? [];
}
});

View File

@ -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

View File

@ -24,7 +24,6 @@ import 'package:immich_mobile/utils/timezone.dart';
import 'package:immich_mobile/widgets/common/date_time_picker.dart';
import 'package:immich_mobile/widgets/common/location_picker.dart';
import 'package:maplibre_gl/maplibre_gl.dart' as maplibre;
import 'package:riverpod_annotation/riverpod_annotation.dart';
final actionServiceProvider = Provider<ActionService>(
(ref) => ActionService(

View File

@ -28,14 +28,6 @@ class ActivityService with ErrorLoggerMixin {
);
}
Future<ActivityStats> getStatistics(String albumId, {String? assetId}) async {
return logError(
() => _activityApiRepository.getStats(albumId, assetId: assetId),
defaultValue: const ActivityStats(comments: 0),
errorMessage: "Failed to statistics for album $albumId",
);
}
Future<bool> removeActivity(String id) async {
return logError(
() async {

View File

@ -2,12 +2,10 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/domain/models/person.model.dart';
import 'package:immich_mobile/repositories/person_api.repository.dart';
import 'package:logging/logging.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'person.service.g.dart';
@riverpod
PersonService personService(Ref ref) => PersonService(ref.watch(personApiRepositoryProvider));
final personServiceProvider = Provider.autoDispose<PersonService>(
(ref) => PersonService(ref.watch(personApiRepositoryProvider)),
);
class PersonService {
final Logger _log = Logger("PersonService");

View File

@ -1,27 +0,0 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'person.service.dart';
// **************************************************************************
// RiverpodGenerator
// **************************************************************************
String _$personServiceHash() => r'646e38d764c52e63d9fca86992e440f34196d519';
/// See also [personService].
@ProviderFor(personService)
final personServiceProvider = AutoDisposeProvider<PersonService>.internal(
personService,
name: r'personServiceProvider',
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$personServiceHash,
dependencies: null,
allTransitiveDependencies: null,
);
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
typedef PersonServiceRef = AutoDisposeProviderRef<PersonService>;
// 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

View File

@ -29,7 +29,7 @@ class CommentBubble extends ConsumerWidget {
final bgColor = isOwn ? context.colorScheme.primaryContainer : context.colorScheme.surfaceContainer;
final activityNotifier = ref.read(
albumActivityProvider(album.id, isAssetActivity ? activity.assetId : null).notifier,
albumActivityProvider((album.id, isAssetActivity ? activity.assetId : null)).notifier,
);
Future<void> openAssetViewer() async {

View File

@ -21,9 +21,13 @@ class CameraPicker extends HookConsumerWidget {
final selectedMake = useState<String?>(filter?.make);
final selectedModel = useState<String?>(filter?.model);
final make = ref.watch(getSearchSuggestionsProvider(SearchSuggestionType.cameraMake));
final make = ref.watch(getSearchSuggestionsProvider(SearchSuggestionArgs(type: SearchSuggestionType.cameraMake)));
final models = ref.watch(getSearchSuggestionsProvider(SearchSuggestionType.cameraModel, make: selectedMake.value));
final models = ref.watch(
getSearchSuggestionsProvider(
SearchSuggestionArgs(type: SearchSuggestionType.cameraModel, make: selectedMake.value),
),
);
final makeWidget = SearchDropdown(
dropdownMenuEntries: switch (make) {

View File

@ -25,25 +25,31 @@ class LocationPicker extends HookConsumerWidget {
final countries = ref.watch(
getSearchSuggestionsProvider(
SearchSuggestionType.country,
locationCountry: selectedCountry.value,
locationState: selectedState.value,
SearchSuggestionArgs(
type: SearchSuggestionType.country,
locationCountry: selectedCountry.value,
locationState: selectedState.value,
),
),
);
final states = ref.watch(
getSearchSuggestionsProvider(
SearchSuggestionType.state,
locationCountry: selectedCountry.value,
locationState: selectedState.value,
SearchSuggestionArgs(
type: SearchSuggestionType.state,
locationCountry: selectedCountry.value,
locationState: selectedState.value,
),
),
);
final cities = ref.watch(
getSearchSuggestionsProvider(
SearchSuggestionType.city,
locationCountry: selectedCountry.value,
locationState: selectedState.value,
SearchSuggestionArgs(
type: SearchSuggestionType.city,
locationCountry: selectedCountry.value,
locationState: selectedState.value,
),
),
);

View File

@ -17,14 +17,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "7.3.0"
analyzer_plugin:
dependency: transitive
description:
name: analyzer_plugin
sha256: b3075265c5ab222f8b3188342dcb50b476286394a40323e85d1fa725035d40a4
url: "https://pub.dev"
source: hosted
version: "0.13.0"
ansicolor:
dependency: transitive
description:
@ -233,14 +225,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.3"
ci:
dependency: transitive
description:
name: ci
sha256: "145d095ce05cddac4d797a158bc4cf3b6016d1fe63d8c3d2fbd7212590adca13"
url: "https://pub.dev"
source: hosted
version: "0.1.0"
cli_util:
dependency: transitive
description:
@ -338,38 +322,6 @@ packages:
url: "https://github.com/mertalev/http"
source: git
version: "3.0.0-wip"
custom_lint:
dependency: "direct dev"
description:
name: custom_lint
sha256: "409c485fd14f544af1da965d5a0d160ee57cd58b63eeaa7280a4f28cf5bda7f1"
url: "https://pub.dev"
source: hosted
version: "0.7.5"
custom_lint_builder:
dependency: transitive
description:
name: custom_lint_builder
sha256: "107e0a43606138015777590ee8ce32f26ba7415c25b722ff0908a6f5d7a4c228"
url: "https://pub.dev"
source: hosted
version: "0.7.5"
custom_lint_core:
dependency: transitive
description:
name: custom_lint_core
sha256: "31110af3dde9d29fb10828ca33f1dce24d2798477b167675543ce3d208dee8be"
url: "https://pub.dev"
source: hosted
version: "0.7.5"
custom_lint_visitor:
dependency: transitive
description:
name: custom_lint_visitor
sha256: "36282d85714af494ee2d7da8c8913630aa6694da99f104fb2ed4afcf8fc857d8"
url: "https://pub.dev"
source: hosted
version: "1.0.0+7.3.0"
dart_style:
dependency: transitive
description:
@ -724,14 +676,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "8.2.12"
freezed_annotation:
dependency: transitive
description:
name: freezed_annotation
sha256: c87ff004c8aa6af2d531668b46a4ea379f7191dc6dfa066acd53d506da6e044b
url: "https://pub.dev"
source: hosted
version: "3.0.0"
frontend_server_client:
dependency: transitive
description:
@ -849,14 +793,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.6.1"
hotreloader:
dependency: transitive
description:
name: hotreloader
sha256: bc167a1163807b03bada490bfe2df25b0d744df359227880220a5cbd04e5734b
url: "https://pub.dev"
source: hosted
version: "4.3.0"
html:
dependency: transitive
description:
@ -1486,38 +1422,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.6.1"
riverpod_analyzer_utils:
dependency: transitive
description:
name: riverpod_analyzer_utils
sha256: "03a17170088c63aab6c54c44456f5ab78876a1ddb6032ffde1662ddab4959611"
url: "https://pub.dev"
source: hosted
version: "0.5.10"
riverpod_annotation:
dependency: "direct main"
description:
name: riverpod_annotation
sha256: e14b0bf45b71326654e2705d462f21b958f987087be850afd60578fcd502d1b8
url: "https://pub.dev"
source: hosted
version: "2.6.1"
riverpod_generator:
dependency: "direct dev"
description:
name: riverpod_generator
sha256: "44a0992d54473eb199ede00e2260bd3c262a86560e3c6f6374503d86d0580e36"
url: "https://pub.dev"
source: hosted
version: "2.6.5"
riverpod_lint:
dependency: "direct dev"
description:
name: riverpod_lint
sha256: "89a52b7334210dbff8605c3edf26cfe69b15062beed5cbfeff2c3812c33c9e35"
url: "https://pub.dev"
source: hosted
version: "2.6.5"
rxdart:
dependency: transitive
description:

View File

@ -62,7 +62,6 @@ dependencies:
photo_manager: ^3.7.1
pinput: ^5.0.2
punycode: ^1.0.0
riverpod_annotation: ^2.6.1
scroll_date_picker: ^3.8.0
scrollable_positioned_list: ^0.3.8
share_handler: ^0.0.25
@ -94,7 +93,6 @@ dependencies:
dev_dependencies:
auto_route_generator: ^9.0.0
build_runner: ^2.4.8
custom_lint: ^0.7.5
# Drift generator
drift_dev: ^2.26.0
fake_async: ^1.3.3
@ -109,8 +107,6 @@ dev_dependencies:
mocktail: ^1.0.4
# Type safe platform code
pigeon: ^26.0.2
riverpod_generator: ^2.6.1
riverpod_lint: ^2.6.1
dependency_overrides:
drift: