Skip to content

High performance self-hosted photo and video management solution.

feat(mobile): include partner's photos on map (#8553)

Stefan Hab97f03cb58b
diff --git a/mobile/assets/i18n/en-US.json b/mobile/assets/i18n/en-US.json
index b182b879ac..f9ac99edb3 100644
--- a/mobile/assets/i18n/en-US.json
+++ b/mobile/assets/i18n/en-US.json
@@ -283,6 +283,7 @@
"map_settings_dialog_save": "Save",
"map_settings_dialog_title": "Map Settings",
"map_settings_include_show_archived": "Include Archived",
+ "map_settings_include_show_partners": "Include Partners",
"map_settings_only_relative_range": "Date range",
"map_settings_only_show_favorites": "Show Favorite Only",
"map_settings_theme_settings": "Map Theme",
@@ -507,4 +508,4 @@
"viewer_remove_from_stack": "Remove from Stack",
"viewer_stack_use_as_main_asset": "Use as Main Asset",
"viewer_unstack": "Un-Stack"
-}
\ No newline at end of file
+}
diff --git a/mobile/lib/modules/map/models/map_state.model.dart b/mobile/lib/modules/map/models/map_state.model.dart
index 85a3e3f37f..973b925aa8 100644
--- a/mobile/lib/modules/map/models/map_state.model.dart
+++ b/mobile/lib/modules/map/models/map_state.model.dart
@@ -5,6 +5,7 @@ class MapState {
final ThemeMode themeMode;
final bool showFavoriteOnly;
final bool includeArchived;
+ final bool withPartners;
final int relativeTime;
final bool shouldRefetchMarkers;
final AsyncValue<String> lightStyleFetched;
@@ -14,6 +15,7 @@ class MapState {
this.themeMode = ThemeMode.system,
this.showFavoriteOnly = false,
this.includeArchived = false,
+ this.withPartners = false,
this.relativeTime = 0,
this.shouldRefetchMarkers = false,
this.lightStyleFetched = const AsyncLoading(),
@@ -24,6 +26,7 @@ class MapState {
ThemeMode? themeMode,
bool? showFavoriteOnly,
bool? includeArchived,
+ bool? withPartners,
int? relativeTime,
bool? shouldRefetchMarkers,
AsyncValue<String>? lightStyleFetched,
@@ -33,6 +36,7 @@ class MapState {
themeMode: themeMode ?? this.themeMode,
showFavoriteOnly: showFavoriteOnly ?? this.showFavoriteOnly,
includeArchived: includeArchived ?? this.includeArchived,
+ withPartners: withPartners ?? this.withPartners,
relativeTime: relativeTime ?? this.relativeTime,
shouldRefetchMarkers: shouldRefetchMarkers ?? this.shouldRefetchMarkers,
lightStyleFetched: lightStyleFetched ?? this.lightStyleFetched,
@@ -42,7 +46,7 @@ class MapState {
@override
String toString() {
- return 'MapState(themeMode: $themeMode, showFavoriteOnly: $showFavoriteOnly, includeArchived: $includeArchived, relativeTime: $relativeTime, shouldRefetchMarkers: $shouldRefetchMarkers, lightStyleFetched: $lightStyleFetched, darkStyleFetched: $darkStyleFetched)';
+ return 'MapState(themeMode: $themeMode, showFavoriteOnly: $showFavoriteOnly, includeArchived: $includeArchived, withPartners: $withPartners, relativeTime: $relativeTime, shouldRefetchMarkers: $shouldRefetchMarkers, lightStyleFetched: $lightStyleFetched, darkStyleFetched: $darkStyleFetched)';
}
@override
@@ -52,6 +56,7 @@ class MapState {
return other.themeMode == themeMode &&
other.showFavoriteOnly == showFavoriteOnly &&
other.includeArchived == includeArchived &&
+ other.withPartners == withPartners &&
other.relativeTime == relativeTime &&
other.shouldRefetchMarkers == shouldRefetchMarkers &&
other.lightStyleFetched == lightStyleFetched &&
@@ -63,6 +68,7 @@ class MapState {
return themeMode.hashCode ^
showFavoriteOnly.hashCode ^
includeArchived.hashCode ^
+ withPartners.hashCode ^
relativeTime.hashCode ^
shouldRefetchMarkers.hashCode ^
lightStyleFetched.hashCode ^
diff --git a/mobile/lib/modules/map/providers/map_marker.provider.dart b/mobile/lib/modules/map/providers/map_marker.provider.dart
index fec7708b38..469e827cda 100644
--- a/mobile/lib/modules/map/providers/map_marker.provider.dart
+++ b/mobile/lib/modules/map/providers/map_marker.provider.dart
@@ -12,6 +12,7 @@ Future<List<MapMarker>> mapMarkers(MapMarkersRef ref) async {
DateTime? fileCreatedAfter;
bool? isFavorite;
bool? isIncludeArchived;
+ bool? isWithPartners;
if (mapState.relativeTime != 0) {
fileCreatedAfter =
@@ -26,9 +27,14 @@ Future<List<MapMarker>> mapMarkers(MapMarkersRef ref) async {
isIncludeArchived = false;
}
+ if (mapState.withPartners) {
+ isWithPartners = true;
+ }
+
final markers = await service.getMapMarkers(
isFavorite: isFavorite,
withArchived: isIncludeArchived,
+ withPartners: isWithPartners,
fileCreatedAfter: fileCreatedAfter,
);
diff --git a/mobile/lib/modules/map/providers/map_state.provider.dart b/mobile/lib/modules/map/providers/map_state.provider.dart
index f1d1a4dde4..92041ad47b 100644
--- a/mobile/lib/modules/map/providers/map_state.provider.dart
+++ b/mobile/lib/modules/map/providers/map_state.provider.dart
@@ -30,6 +30,8 @@ class MapStateNotifier extends _$MapStateNotifier {
.getSetting<bool>(AppSettingsEnum.mapShowFavoriteOnly),
includeArchived: appSettingsProvider
.getSetting<bool>(AppSettingsEnum.mapIncludeArchived),
+ withPartners: appSettingsProvider
+ .getSetting<bool>(AppSettingsEnum.mapwithPartners),
relativeTime:
appSettingsProvider.getSetting<int>(AppSettingsEnum.mapRelativeDate),
);
@@ -114,6 +116,7 @@ class MapStateNotifier extends _$MapStateNotifier {
state = state.copyWith(shouldRefetchMarkers: shouldRefetch);
}
+
void switchIncludeArchived(bool isIncludeArchived) {
ref.read(appSettingsServiceProvider).setSetting(
AppSettingsEnum.mapIncludeArchived,
@@ -125,6 +128,17 @@ class MapStateNotifier extends _$MapStateNotifier {
);
}
+ void switchWithPartners(bool isWithPartners) {
+ ref.read(appSettingsServiceProvider).setSetting(
+ AppSettingsEnum.mapwithPartners,
+ isWithPartners,
+ );
+ state = state.copyWith(
+ withPartners: isWithPartners,
+ shouldRefetchMarkers: true,
+ );
+ }
+
void setRelativeTime(int relativeTime) {
ref.read(appSettingsServiceProvider).setSetting(
AppSettingsEnum.mapRelativeDate,
diff --git a/mobile/lib/modules/map/services/map.service.dart b/mobile/lib/modules/map/services/map.service.dart
index 0a5036056a..3e24f0f020 100644
--- a/mobile/lib/modules/map/services/map.service.dart
+++ b/mobile/lib/modules/map/services/map.service.dart
@@ -13,6 +13,7 @@ class MapSerivce with ErrorLoggerMixin {
Future<Iterable<MapMarker>> getMapMarkers({
bool? isFavorite,
bool? withArchived,
+ bool? withPartners,
DateTime? fileCreatedAfter,
DateTime? fileCreatedBefore,
}) async {
@@ -21,6 +22,7 @@ class MapSerivce with ErrorLoggerMixin {
final markers = await _apiService.assetApi.getMapMarkers(
isFavorite: isFavorite,
isArchived: withArchived,
+ withPartners: withPartners,
fileCreatedAfter: fileCreatedAfter,
fileCreatedBefore: fileCreatedBefore,
);
diff --git a/mobile/lib/modules/map/widgets/map_settings_sheet.dart b/mobile/lib/modules/map/widgets/map_settings_sheet.dart
index 4fe53fd0e4..3f47afe3c6 100644
--- a/mobile/lib/modules/map/widgets/map_settings_sheet.dart
+++ b/mobile/lib/modules/map/widgets/map_settings_sheet.dart
@@ -45,6 +45,13 @@ class MapSettingsSheet extends HookConsumerWidget {
.read(mapStateNotifierProvider.notifier)
.switchIncludeArchived(includeArchive),
),
+ MapSettingsListTile(
+ title: "map_settings_include_show_partners",
+ selected: mapState.withPartners,
+ onChanged: (withPartners) => ref
+ .read(mapStateNotifierProvider.notifier)
+ .switchWithPartners(withPartners),
+ ),
MapTimeDropDown(
relativeTime: mapState.relativeTime,
onTimeChange: (time) => ref
diff --git a/mobile/lib/modules/settings/services/app_settings.service.dart b/mobile/lib/modules/settings/services/app_settings.service.dart
index 5432215cc6..98e8464425 100644
--- a/mobile/lib/modules/settings/services/app_settings.service.dart
+++ b/mobile/lib/modules/settings/services/app_settings.service.dart
@@ -49,6 +49,7 @@ enum AppSettingsEnum<T> {
mapThemeMode<int>(StoreKey.mapThemeMode, null, 0),
mapShowFavoriteOnly<bool>(StoreKey.mapShowFavoriteOnly, null, false),
mapIncludeArchived<bool>(StoreKey.mapIncludeArchived, null, false),
+ mapwithPartners<bool>(StoreKey.mapwithPartners, null, false),
mapRelativeDate<int>(StoreKey.mapRelativeDate, null, 0),
allowSelfSignedSSLCert<bool>(StoreKey.selfSignedCert, null, false),
ignoreIcloudAssets<bool>(StoreKey.ignoreIcloudAssets, null, false),
diff --git a/mobile/lib/shared/models/store.dart b/mobile/lib/shared/models/store.dart
index f38345e5e5..b1f28ec0f0 100644
--- a/mobile/lib/shared/models/store.dart
+++ b/mobile/lib/shared/models/store.dart
@@ -190,6 +190,7 @@ enum StoreKey<T> {
ignoreIcloudAssets<bool>(122, type: bool),
selectedAlbumSortReverse<bool>(123, type: bool),
mapThemeMode<int>(124, type: int),
+ mapwithPartners<bool>(125, type: bool),
;
const StoreKey(