mirror of
https://github.com/immich-app/immich.git
synced 2026-02-04 17:01:13 +03:00
* fix(mobile): bring back map settings * chore: styling --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: Alex <alex.tran1502@gmail.com>
31 lines
1.3 KiB
Dart
31 lines
1.3 KiB
Dart
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:immich_mobile/domain/services/map.service.dart';
|
|
import 'package:immich_mobile/infrastructure/repositories/map.repository.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 mapRepositoryProvider = Provider<DriftMapRepository>((ref) => DriftMapRepository(ref.watch(driftProvider)));
|
|
|
|
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 mapService = ref.watch(mapFactoryProvider).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 [],
|
|
);
|
|
|
|
final mapFactoryProvider = Provider<MapFactory>((ref) => MapFactory(mapRepository: ref.watch(mapRepositoryProvider)));
|