mirror of
https://github.com/immich-app/immich
synced 2026-08-22 13:13:05 +00:00
* chore(mobile): use Drift @DriftAccessor() and collapse some providers * Fix import order * Required formatting
26 lines
1.1 KiB
Dart
26 lines
1.1 KiB
Dart
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:immich_mobile/domain/services/map.service.dart';
|
|
import 'package:immich_mobile/presentation/widgets/map/map.state.dart';
|
|
import 'package:immich_mobile/providers/infrastructure/db.provider.dart';
|
|
import 'package:immich_mobile/providers/infrastructure/timeline.provider.dart';
|
|
import 'package:immich_mobile/providers/user.provider.dart';
|
|
|
|
final mapServiceProvider = Provider<MapService>(
|
|
(ref) {
|
|
final user = ref.watch(currentUserProvider);
|
|
if (user == null) {
|
|
throw Exception('User must be logged in to access map');
|
|
}
|
|
|
|
final users = ref.watch(mapStateProvider).withPartners
|
|
? ref.watch(timelineUsersProvider).valueOrNull ?? [user.id]
|
|
: [user.id];
|
|
|
|
final mapFactory = MapFactory(mapRepository: ref.watch(driftProvider).mapRepository);
|
|
final mapService = mapFactory.remote(users, ref.watch(mapStateProvider).toOptions());
|
|
return mapService;
|
|
},
|
|
// Empty dependencies to inform the framework that this provider
|
|
// might be used in a ProviderScope
|
|
dependencies: const [],
|
|
);
|