forked from immich-app/immich
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show curated asset's location in search page (immich-app#55)
* Added Tab Navigation Observer to trigger event handling for tab page navigation * Added query to get access with distinct location * Showed places in search page as a horizontal list * Showed location search result on tapped
- Loading branch information
1 parent
348d395
commit 8c7080e
Showing
15 changed files
with
434 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
mobile/lib/modules/search/models/curated_location.model.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import 'dart:convert'; | ||
|
||
class CuratedLocation { | ||
final String id; | ||
final String city; | ||
final String resizePath; | ||
final String deviceAssetId; | ||
final String deviceId; | ||
|
||
CuratedLocation({ | ||
required this.id, | ||
required this.city, | ||
required this.resizePath, | ||
required this.deviceAssetId, | ||
required this.deviceId, | ||
}); | ||
|
||
CuratedLocation copyWith({ | ||
String? id, | ||
String? city, | ||
String? resizePath, | ||
String? deviceAssetId, | ||
String? deviceId, | ||
}) { | ||
return CuratedLocation( | ||
id: id ?? this.id, | ||
city: city ?? this.city, | ||
resizePath: resizePath ?? this.resizePath, | ||
deviceAssetId: deviceAssetId ?? this.deviceAssetId, | ||
deviceId: deviceId ?? this.deviceId, | ||
); | ||
} | ||
|
||
Map<String, dynamic> toMap() { | ||
return { | ||
'id': id, | ||
'city': city, | ||
'resizePath': resizePath, | ||
'deviceAssetId': deviceAssetId, | ||
'deviceId': deviceId, | ||
}; | ||
} | ||
|
||
factory CuratedLocation.fromMap(Map<String, dynamic> map) { | ||
return CuratedLocation( | ||
id: map['id'] ?? '', | ||
city: map['city'] ?? '', | ||
resizePath: map['resizePath'] ?? '', | ||
deviceAssetId: map['deviceAssetId'] ?? '', | ||
deviceId: map['deviceId'] ?? '', | ||
); | ||
} | ||
|
||
String toJson() => json.encode(toMap()); | ||
|
||
factory CuratedLocation.fromJson(String source) => CuratedLocation.fromMap(json.decode(source)); | ||
|
||
@override | ||
String toString() { | ||
return 'CuratedLocation(id: $id, city: $city, resizePath: $resizePath, deviceAssetId: $deviceAssetId, deviceId: $deviceId)'; | ||
} | ||
|
||
@override | ||
bool operator ==(Object other) { | ||
if (identical(this, other)) return true; | ||
|
||
return other is CuratedLocation && | ||
other.id == id && | ||
other.city == city && | ||
other.resizePath == resizePath && | ||
other.deviceAssetId == deviceAssetId && | ||
other.deviceId == deviceId; | ||
} | ||
|
||
@override | ||
int get hashCode { | ||
return id.hashCode ^ city.hashCode ^ resizePath.hashCode ^ deviceAssetId.hashCode ^ deviceId.hashCode; | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
mobile/lib/modules/search/models/search_page_state.model.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:collection/collection.dart'; | ||
|
||
class SearchPageState { | ||
final String searchTerm; | ||
final bool isSearchEnabled; | ||
final List<String> searchSuggestion; | ||
final List<String> userSuggestedSearchTerms; | ||
|
||
SearchPageState({ | ||
required this.searchTerm, | ||
required this.isSearchEnabled, | ||
required this.searchSuggestion, | ||
required this.userSuggestedSearchTerms, | ||
}); | ||
|
||
SearchPageState copyWith({ | ||
String? searchTerm, | ||
bool? isSearchEnabled, | ||
List<String>? searchSuggestion, | ||
List<String>? userSuggestedSearchTerms, | ||
}) { | ||
return SearchPageState( | ||
searchTerm: searchTerm ?? this.searchTerm, | ||
isSearchEnabled: isSearchEnabled ?? this.isSearchEnabled, | ||
searchSuggestion: searchSuggestion ?? this.searchSuggestion, | ||
userSuggestedSearchTerms: userSuggestedSearchTerms ?? this.userSuggestedSearchTerms, | ||
); | ||
} | ||
|
||
Map<String, dynamic> toMap() { | ||
return { | ||
'searchTerm': searchTerm, | ||
'isSearchEnabled': isSearchEnabled, | ||
'searchSuggestion': searchSuggestion, | ||
'userSuggestedSearchTerms': userSuggestedSearchTerms, | ||
}; | ||
} | ||
|
||
factory SearchPageState.fromMap(Map<String, dynamic> map) { | ||
return SearchPageState( | ||
searchTerm: map['searchTerm'] ?? '', | ||
isSearchEnabled: map['isSearchEnabled'] ?? false, | ||
searchSuggestion: List<String>.from(map['searchSuggestion']), | ||
userSuggestedSearchTerms: List<String>.from(map['userSuggestedSearchTerms']), | ||
); | ||
} | ||
|
||
String toJson() => json.encode(toMap()); | ||
|
||
factory SearchPageState.fromJson(String source) => SearchPageState.fromMap(json.decode(source)); | ||
|
||
@override | ||
String toString() { | ||
return 'SearchPageState(searchTerm: $searchTerm, isSearchEnabled: $isSearchEnabled, searchSuggestion: $searchSuggestion, userSuggestedSearchTerms: $userSuggestedSearchTerms)'; | ||
} | ||
|
||
@override | ||
bool operator ==(Object other) { | ||
if (identical(this, other)) return true; | ||
final listEquals = const DeepCollectionEquality().equals; | ||
|
||
return other is SearchPageState && | ||
other.searchTerm == searchTerm && | ||
other.isSearchEnabled == isSearchEnabled && | ||
listEquals(other.searchSuggestion, searchSuggestion) && | ||
listEquals(other.userSuggestedSearchTerms, userSuggestedSearchTerms); | ||
} | ||
|
||
@override | ||
int get hashCode { | ||
return searchTerm.hashCode ^ | ||
isSearchEnabled.hashCode ^ | ||
searchSuggestion.hashCode ^ | ||
userSuggestedSearchTerms.hashCode; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.