1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-25 10:43:13 +02:00

resolve merge conflict

This commit is contained in:
Alex Tran 2022-02-27 12:49:18 -06:00
parent e608c61ba5
commit bd34be92e6
3 changed files with 0 additions and 57 deletions

View File

@ -3,47 +3,32 @@ import 'dart:convert';
import 'package:collection/collection.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
<<<<<<< HEAD
=======
import 'package:immich_mobile/modules/search/services/search.service.dart';
>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
class SearchPageState {
final String searchTerm;
final bool isSearchEnabled;
final List<String> searchSuggestion;
<<<<<<< HEAD
=======
final List<String> userSuggestedSearchTerms;
>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
SearchPageState({
required this.searchTerm,
required this.isSearchEnabled,
required this.searchSuggestion,
<<<<<<< HEAD
=======
required this.userSuggestedSearchTerms,
>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
});
SearchPageState copyWith({
String? searchTerm,
bool? isSearchEnabled,
List<String>? searchSuggestion,
<<<<<<< HEAD
=======
List<String>? userSuggestedSearchTerms,
>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
}) {
return SearchPageState(
searchTerm: searchTerm ?? this.searchTerm,
isSearchEnabled: isSearchEnabled ?? this.isSearchEnabled,
searchSuggestion: searchSuggestion ?? this.searchSuggestion,
<<<<<<< HEAD
=======
userSuggestedSearchTerms: userSuggestedSearchTerms ?? this.userSuggestedSearchTerms,
>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
);
}
@ -52,10 +37,7 @@ class SearchPageState {
'searchTerm': searchTerm,
'isSearchEnabled': isSearchEnabled,
'searchSuggestion': searchSuggestion,
<<<<<<< HEAD
=======
'userSuggestedSearchTerms': userSuggestedSearchTerms,
>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
};
}
@ -64,10 +46,7 @@ class SearchPageState {
searchTerm: map['searchTerm'] ?? '',
isSearchEnabled: map['isSearchEnabled'] ?? false,
searchSuggestion: List<String>.from(map['searchSuggestion']),
<<<<<<< HEAD
=======
userSuggestedSearchTerms: List<String>.from(map['userSuggestedSearchTerms']),
>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
);
}
@ -76,14 +55,9 @@ class SearchPageState {
factory SearchPageState.fromJson(String source) => SearchPageState.fromMap(json.decode(source));
@override
<<<<<<< HEAD
String toString() =>
'SearchPageState(searchTerm: $searchTerm, isSearchEnabled: $isSearchEnabled, searchSuggestion: $searchSuggestion)';
=======
String toString() {
return 'SearchPageState(searchTerm: $searchTerm, isSearchEnabled: $isSearchEnabled, searchSuggestion: $searchSuggestion, userSuggestedSearchTerms: $userSuggestedSearchTerms)';
}
>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
@override
bool operator ==(Object other) {
@ -93,13 +67,6 @@ class SearchPageState {
return other is SearchPageState &&
other.searchTerm == searchTerm &&
other.isSearchEnabled == isSearchEnabled &&
<<<<<<< HEAD
listEquals(other.searchSuggestion, searchSuggestion);
}
@override
int get hashCode => searchTerm.hashCode ^ isSearchEnabled.hashCode ^ searchSuggestion.hashCode;
=======
listEquals(other.searchSuggestion, searchSuggestion) &&
listEquals(other.userSuggestedSearchTerms, userSuggestedSearchTerms);
}
@ -111,7 +78,6 @@ class SearchPageState {
searchSuggestion.hashCode ^
userSuggestedSearchTerms.hashCode;
}
>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
}
class SearchPageStateNotifier extends StateNotifier<SearchPageState> {
@ -121,18 +87,12 @@ class SearchPageStateNotifier extends StateNotifier<SearchPageState> {
searchTerm: "",
isSearchEnabled: false,
searchSuggestion: [],
<<<<<<< HEAD
),
);
=======
userSuggestedSearchTerms: [],
),
);
final SearchService _searchService = SearchService();
>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
void enableSearch() {
state = state.copyWith(isSearchEnabled: true);
}
@ -148,11 +108,7 @@ class SearchPageStateNotifier extends StateNotifier<SearchPageState> {
}
void _getSearchSuggestion(String searchTerm) {
<<<<<<< HEAD
var searchList = ['January', '01 2022', 'feburary', "February", 'home', '3413'];
=======
var searchList = state.userSuggestedSearchTerms;
>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
var newList = searchList.where((e) => e.toLowerCase().contains(searchTerm));
@ -162,15 +118,12 @@ class SearchPageStateNotifier extends StateNotifier<SearchPageState> {
state = state.copyWith(searchSuggestion: []);
}
}
<<<<<<< HEAD
=======
void getSuggestedSearchTerms() async {
var userSuggestedSearchTerms = await _searchService.getUserSuggestedSearchTerms();
state = state.copyWith(userSuggestedSearchTerms: userSuggestedSearchTerms);
}
>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
}
final searchPageStateProvider = StateNotifierProvider<SearchPageStateNotifier, SearchPageState>((ref) {

View File

@ -27,10 +27,7 @@ class SearchBar extends HookConsumerWidget with PreferredSizeWidget {
focusNode: searchFocusNode,
autofocus: false,
onTap: () {
<<<<<<< HEAD
=======
ref.watch(searchPageStateProvider.notifier).getSuggestedSearchTerms();
>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
ref.watch(searchPageStateProvider.notifier).enableSearch();
searchFocusNode.requestFocus();
},

View File

@ -16,16 +16,9 @@ class SearchPage extends HookConsumerWidget {
final isSearchEnabled = ref.watch(searchPageStateProvider).isSearchEnabled;
useEffect(() {
<<<<<<< HEAD
searchFocusNode = FocusNode();
return () {
searchFocusNode.dispose();
};
=======
print("search");
searchFocusNode = FocusNode();
return () => searchFocusNode.dispose();
>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
}, []);
return Scaffold(