diff --git a/mobile/lib/modules/search/providers/search_page_state.provider.dart b/mobile/lib/modules/search/providers/search_page_state.provider.dart index d286004f3038e..544c6b184fa5f 100644 --- a/mobile/lib/modules/search/providers/search_page_state.provider.dart +++ b/mobile/lib/modules/search/providers/search_page_state.provider.dart @@ -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 searchSuggestion; -<<<<<<< HEAD -======= final List userSuggestedSearchTerms; ->>>>>>> bfde3084924e247bc8f7004babf38605fe341a18 SearchPageState({ required this.searchTerm, required this.isSearchEnabled, required this.searchSuggestion, -<<<<<<< HEAD -======= required this.userSuggestedSearchTerms, ->>>>>>> bfde3084924e247bc8f7004babf38605fe341a18 }); SearchPageState copyWith({ String? searchTerm, bool? isSearchEnabled, List? searchSuggestion, -<<<<<<< HEAD -======= List? 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.from(map['searchSuggestion']), -<<<<<<< HEAD -======= userSuggestedSearchTerms: List.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 { @@ -121,18 +87,12 @@ class SearchPageStateNotifier extends StateNotifier { 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 { } 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 { state = state.copyWith(searchSuggestion: []); } } -<<<<<<< HEAD -======= void getSuggestedSearchTerms() async { var userSuggestedSearchTerms = await _searchService.getUserSuggestedSearchTerms(); state = state.copyWith(userSuggestedSearchTerms: userSuggestedSearchTerms); } ->>>>>>> bfde3084924e247bc8f7004babf38605fe341a18 } final searchPageStateProvider = StateNotifierProvider((ref) { diff --git a/mobile/lib/modules/search/ui/search_bar.dart b/mobile/lib/modules/search/ui/search_bar.dart index a7be32a7de65f..a8dbebd31ae46 100644 --- a/mobile/lib/modules/search/ui/search_bar.dart +++ b/mobile/lib/modules/search/ui/search_bar.dart @@ -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(); }, diff --git a/mobile/lib/modules/search/views/search_page.dart b/mobile/lib/modules/search/views/search_page.dart index 4f1b6527d5a9b..373fd70b1240d 100644 --- a/mobile/lib/modules/search/views/search_page.dart +++ b/mobile/lib/modules/search/views/search_page.dart @@ -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(