mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
Resolve merge conflict
This commit is contained in:
commit
e608c61ba5
12 changed files with 279 additions and 39 deletions
|
|
@ -12,11 +12,9 @@ import 'package:immich_mobile/shared/providers/backup.provider.dart';
|
|||
class ImmichSliverAppBar extends ConsumerWidget {
|
||||
const ImmichSliverAppBar({
|
||||
Key? key,
|
||||
required this.imageGridGroup,
|
||||
this.onPopBack,
|
||||
}) : super(key: key);
|
||||
|
||||
final List<Widget> imageGridGroup;
|
||||
final Function? onPopBack;
|
||||
|
||||
@override
|
||||
|
|
@ -46,7 +44,7 @@ class ImmichSliverAppBar extends ConsumerWidget {
|
|||
style: GoogleFonts.snowburstOne(
|
||||
textStyle: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18,
|
||||
fontSize: 22,
|
||||
color: Theme.of(context).primaryColor,
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -31,10 +31,6 @@ class HomePage extends HookConsumerWidget {
|
|||
return null;
|
||||
}, []);
|
||||
|
||||
onPopBackFromBackupPage() {
|
||||
// ref.read(assetProvider.notifier).getAllAsset();
|
||||
}
|
||||
|
||||
Widget _buildBody() {
|
||||
if (assetGroupByDateTime.isNotEmpty) {
|
||||
int? lastMonth;
|
||||
|
|
@ -88,10 +84,7 @@ class HomePage extends HookConsumerWidget {
|
|||
child: null,
|
||||
),
|
||||
)
|
||||
: ImmichSliverAppBar(
|
||||
imageGridGroup: _imageGridGroup,
|
||||
onPopBack: onPopBackFromBackupPage,
|
||||
),
|
||||
: const ImmichSliverAppBar(),
|
||||
duration: const Duration(milliseconds: 350),
|
||||
),
|
||||
..._imageGridGroup
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class LoginForm extends HookConsumerWidget {
|
|||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final usernameController = useTextEditingController(text: 'testuser@email.com');
|
||||
final passwordController = useTextEditingController(text: 'password');
|
||||
final serverEndpointController = useTextEditingController(text: 'http://192.168.1.103:2283');
|
||||
final serverEndpointController = useTextEditingController(text: 'http://192.168.1.216:2283');
|
||||
|
||||
return Center(
|
||||
child: ConstrainedBox(
|
||||
|
|
@ -124,7 +124,8 @@ class LoginButton extends ConsumerWidget {
|
|||
if (isAuthenicated) {
|
||||
// Resume backup (if enable) then navigate
|
||||
ref.watch(backupProvider.notifier).resumeBackup();
|
||||
AutoRouter.of(context).pushNamed("/home-page");
|
||||
// AutoRouter.of(context).pushNamed("/home-page");
|
||||
AutoRouter.of(context).pushNamed("/tab-controller-page");
|
||||
} else {
|
||||
ImmichToast.show(
|
||||
context: context,
|
||||
|
|
|
|||
|
|
@ -3,26 +3,47 @@ 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
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -31,6 +52,10 @@ class SearchPageState {
|
|||
'searchTerm': searchTerm,
|
||||
'isSearchEnabled': isSearchEnabled,
|
||||
'searchSuggestion': searchSuggestion,
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
'userSuggestedSearchTerms': userSuggestedSearchTerms,
|
||||
>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -39,6 +64,10 @@ class SearchPageState {
|
|||
searchTerm: map['searchTerm'] ?? '',
|
||||
isSearchEnabled: map['isSearchEnabled'] ?? false,
|
||||
searchSuggestion: List<String>.from(map['searchSuggestion']),
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
userSuggestedSearchTerms: List<String>.from(map['userSuggestedSearchTerms']),
|
||||
>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -47,8 +76,14 @@ 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) {
|
||||
|
|
@ -58,11 +93,25 @@ 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);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode {
|
||||
return searchTerm.hashCode ^
|
||||
isSearchEnabled.hashCode ^
|
||||
searchSuggestion.hashCode ^
|
||||
userSuggestedSearchTerms.hashCode;
|
||||
}
|
||||
>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
|
||||
}
|
||||
|
||||
class SearchPageStateNotifier extends StateNotifier<SearchPageState> {
|
||||
|
|
@ -72,9 +121,18 @@ class SearchPageStateNotifier extends StateNotifier<SearchPageState> {
|
|||
searchTerm: "",
|
||||
isSearchEnabled: false,
|
||||
searchSuggestion: [],
|
||||
<<<<<<< HEAD
|
||||
),
|
||||
);
|
||||
|
||||
=======
|
||||
userSuggestedSearchTerms: [],
|
||||
),
|
||||
);
|
||||
|
||||
final SearchService _searchService = SearchService();
|
||||
|
||||
>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
|
||||
void enableSearch() {
|
||||
state = state.copyWith(isSearchEnabled: true);
|
||||
}
|
||||
|
|
@ -90,7 +148,11 @@ 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));
|
||||
|
||||
|
|
@ -100,6 +162,15 @@ 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) {
|
||||
|
|
|
|||
20
mobile/lib/modules/search/services/search.service.dart
Normal file
20
mobile/lib/modules/search/services/search.service.dart
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:immich_mobile/shared/services/network.service.dart';
|
||||
|
||||
class SearchService {
|
||||
final NetworkService _networkService = NetworkService();
|
||||
|
||||
Future<List<String>?> getUserSuggestedSearchTerms() async {
|
||||
try {
|
||||
var res = await _networkService.getRequest(url: "asset/searchTerm");
|
||||
List<dynamic> decodedData = jsonDecode(res.toString());
|
||||
|
||||
return List.from(decodedData);
|
||||
} catch (e) {
|
||||
debugPrint("[ERROR] [getUserSuggestedSearchTerms] ${e.toString()}");
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -27,6 +27,10 @@ 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();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -16,10 +16,16 @@ 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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue