1
0
mirror of https://github.com/immich-app/immich.git synced 2024-11-24 08:52:28 +02:00

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

* add option for showing partner images on the map

* renaming of iswithPartners variable
This commit is contained in:
Stefan H 2024-04-06 16:04:40 +02:00 committed by GitHub
parent a2e38270e4
commit ab97f03cb5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 40 additions and 2 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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