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:
parent
a2e38270e4
commit
ab97f03cb5
@ -283,6 +283,7 @@
|
|||||||
"map_settings_dialog_save": "Save",
|
"map_settings_dialog_save": "Save",
|
||||||
"map_settings_dialog_title": "Map Settings",
|
"map_settings_dialog_title": "Map Settings",
|
||||||
"map_settings_include_show_archived": "Include Archived",
|
"map_settings_include_show_archived": "Include Archived",
|
||||||
|
"map_settings_include_show_partners": "Include Partners",
|
||||||
"map_settings_only_relative_range": "Date range",
|
"map_settings_only_relative_range": "Date range",
|
||||||
"map_settings_only_show_favorites": "Show Favorite Only",
|
"map_settings_only_show_favorites": "Show Favorite Only",
|
||||||
"map_settings_theme_settings": "Map Theme",
|
"map_settings_theme_settings": "Map Theme",
|
||||||
|
@ -5,6 +5,7 @@ class MapState {
|
|||||||
final ThemeMode themeMode;
|
final ThemeMode themeMode;
|
||||||
final bool showFavoriteOnly;
|
final bool showFavoriteOnly;
|
||||||
final bool includeArchived;
|
final bool includeArchived;
|
||||||
|
final bool withPartners;
|
||||||
final int relativeTime;
|
final int relativeTime;
|
||||||
final bool shouldRefetchMarkers;
|
final bool shouldRefetchMarkers;
|
||||||
final AsyncValue<String> lightStyleFetched;
|
final AsyncValue<String> lightStyleFetched;
|
||||||
@ -14,6 +15,7 @@ class MapState {
|
|||||||
this.themeMode = ThemeMode.system,
|
this.themeMode = ThemeMode.system,
|
||||||
this.showFavoriteOnly = false,
|
this.showFavoriteOnly = false,
|
||||||
this.includeArchived = false,
|
this.includeArchived = false,
|
||||||
|
this.withPartners = false,
|
||||||
this.relativeTime = 0,
|
this.relativeTime = 0,
|
||||||
this.shouldRefetchMarkers = false,
|
this.shouldRefetchMarkers = false,
|
||||||
this.lightStyleFetched = const AsyncLoading(),
|
this.lightStyleFetched = const AsyncLoading(),
|
||||||
@ -24,6 +26,7 @@ class MapState {
|
|||||||
ThemeMode? themeMode,
|
ThemeMode? themeMode,
|
||||||
bool? showFavoriteOnly,
|
bool? showFavoriteOnly,
|
||||||
bool? includeArchived,
|
bool? includeArchived,
|
||||||
|
bool? withPartners,
|
||||||
int? relativeTime,
|
int? relativeTime,
|
||||||
bool? shouldRefetchMarkers,
|
bool? shouldRefetchMarkers,
|
||||||
AsyncValue<String>? lightStyleFetched,
|
AsyncValue<String>? lightStyleFetched,
|
||||||
@ -33,6 +36,7 @@ class MapState {
|
|||||||
themeMode: themeMode ?? this.themeMode,
|
themeMode: themeMode ?? this.themeMode,
|
||||||
showFavoriteOnly: showFavoriteOnly ?? this.showFavoriteOnly,
|
showFavoriteOnly: showFavoriteOnly ?? this.showFavoriteOnly,
|
||||||
includeArchived: includeArchived ?? this.includeArchived,
|
includeArchived: includeArchived ?? this.includeArchived,
|
||||||
|
withPartners: withPartners ?? this.withPartners,
|
||||||
relativeTime: relativeTime ?? this.relativeTime,
|
relativeTime: relativeTime ?? this.relativeTime,
|
||||||
shouldRefetchMarkers: shouldRefetchMarkers ?? this.shouldRefetchMarkers,
|
shouldRefetchMarkers: shouldRefetchMarkers ?? this.shouldRefetchMarkers,
|
||||||
lightStyleFetched: lightStyleFetched ?? this.lightStyleFetched,
|
lightStyleFetched: lightStyleFetched ?? this.lightStyleFetched,
|
||||||
@ -42,7 +46,7 @@ class MapState {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
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
|
@override
|
||||||
@ -52,6 +56,7 @@ class MapState {
|
|||||||
return other.themeMode == themeMode &&
|
return other.themeMode == themeMode &&
|
||||||
other.showFavoriteOnly == showFavoriteOnly &&
|
other.showFavoriteOnly == showFavoriteOnly &&
|
||||||
other.includeArchived == includeArchived &&
|
other.includeArchived == includeArchived &&
|
||||||
|
other.withPartners == withPartners &&
|
||||||
other.relativeTime == relativeTime &&
|
other.relativeTime == relativeTime &&
|
||||||
other.shouldRefetchMarkers == shouldRefetchMarkers &&
|
other.shouldRefetchMarkers == shouldRefetchMarkers &&
|
||||||
other.lightStyleFetched == lightStyleFetched &&
|
other.lightStyleFetched == lightStyleFetched &&
|
||||||
@ -63,6 +68,7 @@ class MapState {
|
|||||||
return themeMode.hashCode ^
|
return themeMode.hashCode ^
|
||||||
showFavoriteOnly.hashCode ^
|
showFavoriteOnly.hashCode ^
|
||||||
includeArchived.hashCode ^
|
includeArchived.hashCode ^
|
||||||
|
withPartners.hashCode ^
|
||||||
relativeTime.hashCode ^
|
relativeTime.hashCode ^
|
||||||
shouldRefetchMarkers.hashCode ^
|
shouldRefetchMarkers.hashCode ^
|
||||||
lightStyleFetched.hashCode ^
|
lightStyleFetched.hashCode ^
|
||||||
|
@ -12,6 +12,7 @@ Future<List<MapMarker>> mapMarkers(MapMarkersRef ref) async {
|
|||||||
DateTime? fileCreatedAfter;
|
DateTime? fileCreatedAfter;
|
||||||
bool? isFavorite;
|
bool? isFavorite;
|
||||||
bool? isIncludeArchived;
|
bool? isIncludeArchived;
|
||||||
|
bool? isWithPartners;
|
||||||
|
|
||||||
if (mapState.relativeTime != 0) {
|
if (mapState.relativeTime != 0) {
|
||||||
fileCreatedAfter =
|
fileCreatedAfter =
|
||||||
@ -26,9 +27,14 @@ Future<List<MapMarker>> mapMarkers(MapMarkersRef ref) async {
|
|||||||
isIncludeArchived = false;
|
isIncludeArchived = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mapState.withPartners) {
|
||||||
|
isWithPartners = true;
|
||||||
|
}
|
||||||
|
|
||||||
final markers = await service.getMapMarkers(
|
final markers = await service.getMapMarkers(
|
||||||
isFavorite: isFavorite,
|
isFavorite: isFavorite,
|
||||||
withArchived: isIncludeArchived,
|
withArchived: isIncludeArchived,
|
||||||
|
withPartners: isWithPartners,
|
||||||
fileCreatedAfter: fileCreatedAfter,
|
fileCreatedAfter: fileCreatedAfter,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -30,6 +30,8 @@ class MapStateNotifier extends _$MapStateNotifier {
|
|||||||
.getSetting<bool>(AppSettingsEnum.mapShowFavoriteOnly),
|
.getSetting<bool>(AppSettingsEnum.mapShowFavoriteOnly),
|
||||||
includeArchived: appSettingsProvider
|
includeArchived: appSettingsProvider
|
||||||
.getSetting<bool>(AppSettingsEnum.mapIncludeArchived),
|
.getSetting<bool>(AppSettingsEnum.mapIncludeArchived),
|
||||||
|
withPartners: appSettingsProvider
|
||||||
|
.getSetting<bool>(AppSettingsEnum.mapwithPartners),
|
||||||
relativeTime:
|
relativeTime:
|
||||||
appSettingsProvider.getSetting<int>(AppSettingsEnum.mapRelativeDate),
|
appSettingsProvider.getSetting<int>(AppSettingsEnum.mapRelativeDate),
|
||||||
);
|
);
|
||||||
@ -114,6 +116,7 @@ class MapStateNotifier extends _$MapStateNotifier {
|
|||||||
state = state.copyWith(shouldRefetchMarkers: shouldRefetch);
|
state = state.copyWith(shouldRefetchMarkers: shouldRefetch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void switchIncludeArchived(bool isIncludeArchived) {
|
void switchIncludeArchived(bool isIncludeArchived) {
|
||||||
ref.read(appSettingsServiceProvider).setSetting(
|
ref.read(appSettingsServiceProvider).setSetting(
|
||||||
AppSettingsEnum.mapIncludeArchived,
|
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) {
|
void setRelativeTime(int relativeTime) {
|
||||||
ref.read(appSettingsServiceProvider).setSetting(
|
ref.read(appSettingsServiceProvider).setSetting(
|
||||||
AppSettingsEnum.mapRelativeDate,
|
AppSettingsEnum.mapRelativeDate,
|
||||||
|
@ -13,6 +13,7 @@ class MapSerivce with ErrorLoggerMixin {
|
|||||||
Future<Iterable<MapMarker>> getMapMarkers({
|
Future<Iterable<MapMarker>> getMapMarkers({
|
||||||
bool? isFavorite,
|
bool? isFavorite,
|
||||||
bool? withArchived,
|
bool? withArchived,
|
||||||
|
bool? withPartners,
|
||||||
DateTime? fileCreatedAfter,
|
DateTime? fileCreatedAfter,
|
||||||
DateTime? fileCreatedBefore,
|
DateTime? fileCreatedBefore,
|
||||||
}) async {
|
}) async {
|
||||||
@ -21,6 +22,7 @@ class MapSerivce with ErrorLoggerMixin {
|
|||||||
final markers = await _apiService.assetApi.getMapMarkers(
|
final markers = await _apiService.assetApi.getMapMarkers(
|
||||||
isFavorite: isFavorite,
|
isFavorite: isFavorite,
|
||||||
isArchived: withArchived,
|
isArchived: withArchived,
|
||||||
|
withPartners: withPartners,
|
||||||
fileCreatedAfter: fileCreatedAfter,
|
fileCreatedAfter: fileCreatedAfter,
|
||||||
fileCreatedBefore: fileCreatedBefore,
|
fileCreatedBefore: fileCreatedBefore,
|
||||||
);
|
);
|
||||||
|
@ -45,6 +45,13 @@ class MapSettingsSheet extends HookConsumerWidget {
|
|||||||
.read(mapStateNotifierProvider.notifier)
|
.read(mapStateNotifierProvider.notifier)
|
||||||
.switchIncludeArchived(includeArchive),
|
.switchIncludeArchived(includeArchive),
|
||||||
),
|
),
|
||||||
|
MapSettingsListTile(
|
||||||
|
title: "map_settings_include_show_partners",
|
||||||
|
selected: mapState.withPartners,
|
||||||
|
onChanged: (withPartners) => ref
|
||||||
|
.read(mapStateNotifierProvider.notifier)
|
||||||
|
.switchWithPartners(withPartners),
|
||||||
|
),
|
||||||
MapTimeDropDown(
|
MapTimeDropDown(
|
||||||
relativeTime: mapState.relativeTime,
|
relativeTime: mapState.relativeTime,
|
||||||
onTimeChange: (time) => ref
|
onTimeChange: (time) => ref
|
||||||
|
@ -49,6 +49,7 @@ enum AppSettingsEnum<T> {
|
|||||||
mapThemeMode<int>(StoreKey.mapThemeMode, null, 0),
|
mapThemeMode<int>(StoreKey.mapThemeMode, null, 0),
|
||||||
mapShowFavoriteOnly<bool>(StoreKey.mapShowFavoriteOnly, null, false),
|
mapShowFavoriteOnly<bool>(StoreKey.mapShowFavoriteOnly, null, false),
|
||||||
mapIncludeArchived<bool>(StoreKey.mapIncludeArchived, null, false),
|
mapIncludeArchived<bool>(StoreKey.mapIncludeArchived, null, false),
|
||||||
|
mapwithPartners<bool>(StoreKey.mapwithPartners, null, false),
|
||||||
mapRelativeDate<int>(StoreKey.mapRelativeDate, null, 0),
|
mapRelativeDate<int>(StoreKey.mapRelativeDate, null, 0),
|
||||||
allowSelfSignedSSLCert<bool>(StoreKey.selfSignedCert, null, false),
|
allowSelfSignedSSLCert<bool>(StoreKey.selfSignedCert, null, false),
|
||||||
ignoreIcloudAssets<bool>(StoreKey.ignoreIcloudAssets, null, false),
|
ignoreIcloudAssets<bool>(StoreKey.ignoreIcloudAssets, null, false),
|
||||||
|
@ -190,6 +190,7 @@ enum StoreKey<T> {
|
|||||||
ignoreIcloudAssets<bool>(122, type: bool),
|
ignoreIcloudAssets<bool>(122, type: bool),
|
||||||
selectedAlbumSortReverse<bool>(123, type: bool),
|
selectedAlbumSortReverse<bool>(123, type: bool),
|
||||||
mapThemeMode<int>(124, type: int),
|
mapThemeMode<int>(124, type: int),
|
||||||
|
mapwithPartners<bool>(125, type: bool),
|
||||||
;
|
;
|
||||||
|
|
||||||
const StoreKey(
|
const StoreKey(
|
||||||
|
Loading…
Reference in New Issue
Block a user