mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-03 19:17:11 -05:00 
			
		
		
		
	Resolve merge conflict
This commit is contained in:
		
						commit
						e608c61ba5
					
				@ -12,11 +12,9 @@ import 'package:immich_mobile/shared/providers/backup.provider.dart';
 | 
				
			|||||||
class ImmichSliverAppBar extends ConsumerWidget {
 | 
					class ImmichSliverAppBar extends ConsumerWidget {
 | 
				
			||||||
  const ImmichSliverAppBar({
 | 
					  const ImmichSliverAppBar({
 | 
				
			||||||
    Key? key,
 | 
					    Key? key,
 | 
				
			||||||
    required this.imageGridGroup,
 | 
					 | 
				
			||||||
    this.onPopBack,
 | 
					    this.onPopBack,
 | 
				
			||||||
  }) : super(key: key);
 | 
					  }) : super(key: key);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  final List<Widget> imageGridGroup;
 | 
					 | 
				
			||||||
  final Function? onPopBack;
 | 
					  final Function? onPopBack;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
@ -46,7 +44,7 @@ class ImmichSliverAppBar extends ConsumerWidget {
 | 
				
			|||||||
        style: GoogleFonts.snowburstOne(
 | 
					        style: GoogleFonts.snowburstOne(
 | 
				
			||||||
          textStyle: TextStyle(
 | 
					          textStyle: TextStyle(
 | 
				
			||||||
            fontWeight: FontWeight.bold,
 | 
					            fontWeight: FontWeight.bold,
 | 
				
			||||||
            fontSize: 18,
 | 
					            fontSize: 22,
 | 
				
			||||||
            color: Theme.of(context).primaryColor,
 | 
					            color: Theme.of(context).primaryColor,
 | 
				
			||||||
          ),
 | 
					          ),
 | 
				
			||||||
        ),
 | 
					        ),
 | 
				
			||||||
 | 
				
			|||||||
@ -31,10 +31,6 @@ class HomePage extends HookConsumerWidget {
 | 
				
			|||||||
      return null;
 | 
					      return null;
 | 
				
			||||||
    }, []);
 | 
					    }, []);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    onPopBackFromBackupPage() {
 | 
					 | 
				
			||||||
      // ref.read(assetProvider.notifier).getAllAsset();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Widget _buildBody() {
 | 
					    Widget _buildBody() {
 | 
				
			||||||
      if (assetGroupByDateTime.isNotEmpty) {
 | 
					      if (assetGroupByDateTime.isNotEmpty) {
 | 
				
			||||||
        int? lastMonth;
 | 
					        int? lastMonth;
 | 
				
			||||||
@ -88,10 +84,7 @@ class HomePage extends HookConsumerWidget {
 | 
				
			|||||||
                              child: null,
 | 
					                              child: null,
 | 
				
			||||||
                            ),
 | 
					                            ),
 | 
				
			||||||
                          )
 | 
					                          )
 | 
				
			||||||
                        : ImmichSliverAppBar(
 | 
					                        : const ImmichSliverAppBar(),
 | 
				
			||||||
                            imageGridGroup: _imageGridGroup,
 | 
					 | 
				
			||||||
                            onPopBack: onPopBackFromBackupPage,
 | 
					 | 
				
			||||||
                          ),
 | 
					 | 
				
			||||||
                    duration: const Duration(milliseconds: 350),
 | 
					                    duration: const Duration(milliseconds: 350),
 | 
				
			||||||
                  ),
 | 
					                  ),
 | 
				
			||||||
                  ..._imageGridGroup
 | 
					                  ..._imageGridGroup
 | 
				
			||||||
 | 
				
			|||||||
@ -15,7 +15,7 @@ class LoginForm extends HookConsumerWidget {
 | 
				
			|||||||
  Widget build(BuildContext context, WidgetRef ref) {
 | 
					  Widget build(BuildContext context, WidgetRef ref) {
 | 
				
			||||||
    final usernameController = useTextEditingController(text: 'testuser@email.com');
 | 
					    final usernameController = useTextEditingController(text: 'testuser@email.com');
 | 
				
			||||||
    final passwordController = useTextEditingController(text: 'password');
 | 
					    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(
 | 
					    return Center(
 | 
				
			||||||
      child: ConstrainedBox(
 | 
					      child: ConstrainedBox(
 | 
				
			||||||
@ -124,7 +124,8 @@ class LoginButton extends ConsumerWidget {
 | 
				
			|||||||
          if (isAuthenicated) {
 | 
					          if (isAuthenicated) {
 | 
				
			||||||
            // Resume backup (if enable) then navigate
 | 
					            // Resume backup (if enable) then navigate
 | 
				
			||||||
            ref.watch(backupProvider.notifier).resumeBackup();
 | 
					            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 {
 | 
					          } else {
 | 
				
			||||||
            ImmichToast.show(
 | 
					            ImmichToast.show(
 | 
				
			||||||
                context: context,
 | 
					                context: context,
 | 
				
			||||||
 | 
				
			|||||||
@ -3,26 +3,47 @@ import 'dart:convert';
 | 
				
			|||||||
import 'package:collection/collection.dart';
 | 
					import 'package:collection/collection.dart';
 | 
				
			||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
 | 
					import 'package:hooks_riverpod/hooks_riverpod.dart';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<<<<<<< HEAD
 | 
				
			||||||
 | 
					=======
 | 
				
			||||||
 | 
					import 'package:immich_mobile/modules/search/services/search.service.dart';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
 | 
				
			||||||
class SearchPageState {
 | 
					class SearchPageState {
 | 
				
			||||||
  final String searchTerm;
 | 
					  final String searchTerm;
 | 
				
			||||||
  final bool isSearchEnabled;
 | 
					  final bool isSearchEnabled;
 | 
				
			||||||
  final List<String> searchSuggestion;
 | 
					  final List<String> searchSuggestion;
 | 
				
			||||||
 | 
					<<<<<<< HEAD
 | 
				
			||||||
 | 
					=======
 | 
				
			||||||
 | 
					  final List<String> userSuggestedSearchTerms;
 | 
				
			||||||
 | 
					>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SearchPageState({
 | 
					  SearchPageState({
 | 
				
			||||||
    required this.searchTerm,
 | 
					    required this.searchTerm,
 | 
				
			||||||
    required this.isSearchEnabled,
 | 
					    required this.isSearchEnabled,
 | 
				
			||||||
    required this.searchSuggestion,
 | 
					    required this.searchSuggestion,
 | 
				
			||||||
 | 
					<<<<<<< HEAD
 | 
				
			||||||
 | 
					=======
 | 
				
			||||||
 | 
					    required this.userSuggestedSearchTerms,
 | 
				
			||||||
 | 
					>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  SearchPageState copyWith({
 | 
					  SearchPageState copyWith({
 | 
				
			||||||
    String? searchTerm,
 | 
					    String? searchTerm,
 | 
				
			||||||
    bool? isSearchEnabled,
 | 
					    bool? isSearchEnabled,
 | 
				
			||||||
    List<String>? searchSuggestion,
 | 
					    List<String>? searchSuggestion,
 | 
				
			||||||
 | 
					<<<<<<< HEAD
 | 
				
			||||||
 | 
					=======
 | 
				
			||||||
 | 
					    List<String>? userSuggestedSearchTerms,
 | 
				
			||||||
 | 
					>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
 | 
				
			||||||
  }) {
 | 
					  }) {
 | 
				
			||||||
    return SearchPageState(
 | 
					    return SearchPageState(
 | 
				
			||||||
      searchTerm: searchTerm ?? this.searchTerm,
 | 
					      searchTerm: searchTerm ?? this.searchTerm,
 | 
				
			||||||
      isSearchEnabled: isSearchEnabled ?? this.isSearchEnabled,
 | 
					      isSearchEnabled: isSearchEnabled ?? this.isSearchEnabled,
 | 
				
			||||||
      searchSuggestion: searchSuggestion ?? this.searchSuggestion,
 | 
					      searchSuggestion: searchSuggestion ?? this.searchSuggestion,
 | 
				
			||||||
 | 
					<<<<<<< HEAD
 | 
				
			||||||
 | 
					=======
 | 
				
			||||||
 | 
					      userSuggestedSearchTerms: userSuggestedSearchTerms ?? this.userSuggestedSearchTerms,
 | 
				
			||||||
 | 
					>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -31,6 +52,10 @@ class SearchPageState {
 | 
				
			|||||||
      'searchTerm': searchTerm,
 | 
					      'searchTerm': searchTerm,
 | 
				
			||||||
      'isSearchEnabled': isSearchEnabled,
 | 
					      'isSearchEnabled': isSearchEnabled,
 | 
				
			||||||
      'searchSuggestion': searchSuggestion,
 | 
					      'searchSuggestion': searchSuggestion,
 | 
				
			||||||
 | 
					<<<<<<< HEAD
 | 
				
			||||||
 | 
					=======
 | 
				
			||||||
 | 
					      'userSuggestedSearchTerms': userSuggestedSearchTerms,
 | 
				
			||||||
 | 
					>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -39,6 +64,10 @@ class SearchPageState {
 | 
				
			|||||||
      searchTerm: map['searchTerm'] ?? '',
 | 
					      searchTerm: map['searchTerm'] ?? '',
 | 
				
			||||||
      isSearchEnabled: map['isSearchEnabled'] ?? false,
 | 
					      isSearchEnabled: map['isSearchEnabled'] ?? false,
 | 
				
			||||||
      searchSuggestion: List<String>.from(map['searchSuggestion']),
 | 
					      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));
 | 
					  factory SearchPageState.fromJson(String source) => SearchPageState.fromMap(json.decode(source));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
 | 
					<<<<<<< HEAD
 | 
				
			||||||
  String toString() =>
 | 
					  String toString() =>
 | 
				
			||||||
      'SearchPageState(searchTerm: $searchTerm, isSearchEnabled: $isSearchEnabled, searchSuggestion: $searchSuggestion)';
 | 
					      'SearchPageState(searchTerm: $searchTerm, isSearchEnabled: $isSearchEnabled, searchSuggestion: $searchSuggestion)';
 | 
				
			||||||
 | 
					=======
 | 
				
			||||||
 | 
					  String toString() {
 | 
				
			||||||
 | 
					    return 'SearchPageState(searchTerm: $searchTerm, isSearchEnabled: $isSearchEnabled, searchSuggestion: $searchSuggestion, userSuggestedSearchTerms: $userSuggestedSearchTerms)';
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
  bool operator ==(Object other) {
 | 
					  bool operator ==(Object other) {
 | 
				
			||||||
@ -58,11 +93,25 @@ class SearchPageState {
 | 
				
			|||||||
    return other is SearchPageState &&
 | 
					    return other is SearchPageState &&
 | 
				
			||||||
        other.searchTerm == searchTerm &&
 | 
					        other.searchTerm == searchTerm &&
 | 
				
			||||||
        other.isSearchEnabled == isSearchEnabled &&
 | 
					        other.isSearchEnabled == isSearchEnabled &&
 | 
				
			||||||
 | 
					<<<<<<< HEAD
 | 
				
			||||||
        listEquals(other.searchSuggestion, searchSuggestion);
 | 
					        listEquals(other.searchSuggestion, searchSuggestion);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
  int get hashCode => searchTerm.hashCode ^ isSearchEnabled.hashCode ^ searchSuggestion.hashCode;
 | 
					  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> {
 | 
					class SearchPageStateNotifier extends StateNotifier<SearchPageState> {
 | 
				
			||||||
@ -72,9 +121,18 @@ class SearchPageStateNotifier extends StateNotifier<SearchPageState> {
 | 
				
			|||||||
            searchTerm: "",
 | 
					            searchTerm: "",
 | 
				
			||||||
            isSearchEnabled: false,
 | 
					            isSearchEnabled: false,
 | 
				
			||||||
            searchSuggestion: [],
 | 
					            searchSuggestion: [],
 | 
				
			||||||
 | 
					<<<<<<< HEAD
 | 
				
			||||||
          ),
 | 
					          ),
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=======
 | 
				
			||||||
 | 
					            userSuggestedSearchTerms: [],
 | 
				
			||||||
 | 
					          ),
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  final SearchService _searchService = SearchService();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
 | 
				
			||||||
  void enableSearch() {
 | 
					  void enableSearch() {
 | 
				
			||||||
    state = state.copyWith(isSearchEnabled: true);
 | 
					    state = state.copyWith(isSearchEnabled: true);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@ -90,7 +148,11 @@ class SearchPageStateNotifier extends StateNotifier<SearchPageState> {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void _getSearchSuggestion(String searchTerm) {
 | 
					  void _getSearchSuggestion(String searchTerm) {
 | 
				
			||||||
 | 
					<<<<<<< HEAD
 | 
				
			||||||
    var searchList = ['January', '01 2022', 'feburary', "February", 'home', '3413'];
 | 
					    var searchList = ['January', '01 2022', 'feburary', "February", 'home', '3413'];
 | 
				
			||||||
 | 
					=======
 | 
				
			||||||
 | 
					    var searchList = state.userSuggestedSearchTerms;
 | 
				
			||||||
 | 
					>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var newList = searchList.where((e) => e.toLowerCase().contains(searchTerm));
 | 
					    var newList = searchList.where((e) => e.toLowerCase().contains(searchTerm));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -100,6 +162,15 @@ class SearchPageStateNotifier extends StateNotifier<SearchPageState> {
 | 
				
			|||||||
      state = state.copyWith(searchSuggestion: []);
 | 
					      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) {
 | 
					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,
 | 
					        focusNode: searchFocusNode,
 | 
				
			||||||
        autofocus: false,
 | 
					        autofocus: false,
 | 
				
			||||||
        onTap: () {
 | 
					        onTap: () {
 | 
				
			||||||
 | 
					<<<<<<< HEAD
 | 
				
			||||||
 | 
					=======
 | 
				
			||||||
 | 
					          ref.watch(searchPageStateProvider.notifier).getSuggestedSearchTerms();
 | 
				
			||||||
 | 
					>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
 | 
				
			||||||
          ref.watch(searchPageStateProvider.notifier).enableSearch();
 | 
					          ref.watch(searchPageStateProvider.notifier).enableSearch();
 | 
				
			||||||
          searchFocusNode.requestFocus();
 | 
					          searchFocusNode.requestFocus();
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
				
			|||||||
@ -16,10 +16,16 @@ class SearchPage extends HookConsumerWidget {
 | 
				
			|||||||
    final isSearchEnabled = ref.watch(searchPageStateProvider).isSearchEnabled;
 | 
					    final isSearchEnabled = ref.watch(searchPageStateProvider).isSearchEnabled;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    useEffect(() {
 | 
					    useEffect(() {
 | 
				
			||||||
 | 
					<<<<<<< HEAD
 | 
				
			||||||
      searchFocusNode = FocusNode();
 | 
					      searchFocusNode = FocusNode();
 | 
				
			||||||
      return () {
 | 
					      return () {
 | 
				
			||||||
        searchFocusNode.dispose();
 | 
					        searchFocusNode.dispose();
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
 | 
					=======
 | 
				
			||||||
 | 
					      print("search");
 | 
				
			||||||
 | 
					      searchFocusNode = FocusNode();
 | 
				
			||||||
 | 
					      return () => searchFocusNode.dispose();
 | 
				
			||||||
 | 
					>>>>>>> bfde3084924e247bc8f7004babf38605fe341a18
 | 
				
			||||||
    }, []);
 | 
					    }, []);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return Scaffold(
 | 
					    return Scaffold(
 | 
				
			||||||
 | 
				
			|||||||
@ -2,10 +2,12 @@ import 'package:auto_route/auto_route.dart';
 | 
				
			|||||||
import 'package:flutter/widgets.dart';
 | 
					import 'package:flutter/widgets.dart';
 | 
				
			||||||
import 'package:immich_mobile/modules/login/views/login_page.dart';
 | 
					import 'package:immich_mobile/modules/login/views/login_page.dart';
 | 
				
			||||||
import 'package:immich_mobile/modules/home/views/home_page.dart';
 | 
					import 'package:immich_mobile/modules/home/views/home_page.dart';
 | 
				
			||||||
 | 
					import 'package:immich_mobile/modules/search/views/search_page.dart';
 | 
				
			||||||
import 'package:immich_mobile/routing/auth_guard.dart';
 | 
					import 'package:immich_mobile/routing/auth_guard.dart';
 | 
				
			||||||
import 'package:immich_mobile/shared/models/immich_asset.model.dart';
 | 
					import 'package:immich_mobile/shared/models/immich_asset.model.dart';
 | 
				
			||||||
import 'package:immich_mobile/shared/views/backup_controller_page.dart';
 | 
					import 'package:immich_mobile/shared/views/backup_controller_page.dart';
 | 
				
			||||||
import 'package:immich_mobile/modules/asset_viewer/views/image_viewer_page.dart';
 | 
					import 'package:immich_mobile/modules/asset_viewer/views/image_viewer_page.dart';
 | 
				
			||||||
 | 
					import 'package:immich_mobile/shared/views/tab_controller_page.dart';
 | 
				
			||||||
import 'package:immich_mobile/shared/views/video_viewer_page.dart';
 | 
					import 'package:immich_mobile/shared/views/video_viewer_page.dart';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
part 'router.gr.dart';
 | 
					part 'router.gr.dart';
 | 
				
			||||||
@ -14,10 +16,17 @@ part 'router.gr.dart';
 | 
				
			|||||||
  replaceInRouteName: 'Page,Route',
 | 
					  replaceInRouteName: 'Page,Route',
 | 
				
			||||||
  routes: <AutoRoute>[
 | 
					  routes: <AutoRoute>[
 | 
				
			||||||
    AutoRoute(page: LoginPage, initial: true),
 | 
					    AutoRoute(page: LoginPage, initial: true),
 | 
				
			||||||
    AutoRoute(page: HomePage, guards: [AuthGuard]),
 | 
					    AutoRoute(
 | 
				
			||||||
    AutoRoute(page: BackupControllerPage, guards: [AuthGuard]),
 | 
					      page: TabControllerPage,
 | 
				
			||||||
 | 
					      guards: [AuthGuard],
 | 
				
			||||||
 | 
					      children: [
 | 
				
			||||||
 | 
					        AutoRoute(page: HomePage, guards: [AuthGuard]),
 | 
				
			||||||
 | 
					        AutoRoute(page: SearchPage, guards: [AuthGuard])
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					    ),
 | 
				
			||||||
    AutoRoute(page: ImageViewerPage, guards: [AuthGuard]),
 | 
					    AutoRoute(page: ImageViewerPage, guards: [AuthGuard]),
 | 
				
			||||||
    AutoRoute(page: VideoViewerPage, guards: [AuthGuard]),
 | 
					    AutoRoute(page: VideoViewerPage, guards: [AuthGuard]),
 | 
				
			||||||
 | 
					    AutoRoute(page: BackupControllerPage, guards: [AuthGuard]),
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
class AppRouter extends _$AppRouter {
 | 
					class AppRouter extends _$AppRouter {
 | 
				
			||||||
 | 
				
			|||||||
@ -25,13 +25,9 @@ class _$AppRouter extends RootStackRouter {
 | 
				
			|||||||
      return MaterialPageX<dynamic>(
 | 
					      return MaterialPageX<dynamic>(
 | 
				
			||||||
          routeData: routeData, child: const LoginPage());
 | 
					          routeData: routeData, child: const LoginPage());
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    HomeRoute.name: (routeData) {
 | 
					    TabControllerRoute.name: (routeData) {
 | 
				
			||||||
      return MaterialPageX<dynamic>(
 | 
					      return MaterialPageX<dynamic>(
 | 
				
			||||||
          routeData: routeData, child: const HomePage());
 | 
					          routeData: routeData, child: const TabControllerPage());
 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    BackupControllerRoute.name: (routeData) {
 | 
					 | 
				
			||||||
      return MaterialPageX<dynamic>(
 | 
					 | 
				
			||||||
          routeData: routeData, child: const BackupControllerPage());
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    ImageViewerRoute.name: (routeData) {
 | 
					    ImageViewerRoute.name: (routeData) {
 | 
				
			||||||
      final args = routeData.argsAs<ImageViewerRouteArgs>();
 | 
					      final args = routeData.argsAs<ImageViewerRouteArgs>();
 | 
				
			||||||
@ -49,19 +45,47 @@ class _$AppRouter extends RootStackRouter {
 | 
				
			|||||||
      return MaterialPageX<dynamic>(
 | 
					      return MaterialPageX<dynamic>(
 | 
				
			||||||
          routeData: routeData,
 | 
					          routeData: routeData,
 | 
				
			||||||
          child: VideoViewerPage(key: args.key, videoUrl: args.videoUrl));
 | 
					          child: VideoViewerPage(key: args.key, videoUrl: args.videoUrl));
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    BackupControllerRoute.name: (routeData) {
 | 
				
			||||||
 | 
					      return MaterialPageX<dynamic>(
 | 
				
			||||||
 | 
					          routeData: routeData, child: const BackupControllerPage());
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    HomeRoute.name: (routeData) {
 | 
				
			||||||
 | 
					      return MaterialPageX<dynamic>(
 | 
				
			||||||
 | 
					          routeData: routeData, child: const HomePage());
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    SearchRoute.name: (routeData) {
 | 
				
			||||||
 | 
					      final args = routeData.argsAs<SearchRouteArgs>(
 | 
				
			||||||
 | 
					          orElse: () => const SearchRouteArgs());
 | 
				
			||||||
 | 
					      return MaterialPageX<dynamic>(
 | 
				
			||||||
 | 
					          routeData: routeData, child: SearchPage(key: args.key));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
  List<RouteConfig> get routes => [
 | 
					  List<RouteConfig> get routes => [
 | 
				
			||||||
        RouteConfig(LoginRoute.name, path: '/'),
 | 
					        RouteConfig(LoginRoute.name, path: '/'),
 | 
				
			||||||
        RouteConfig(HomeRoute.name, path: '/home-page', guards: [authGuard]),
 | 
					        RouteConfig(TabControllerRoute.name,
 | 
				
			||||||
        RouteConfig(BackupControllerRoute.name,
 | 
					            path: '/tab-controller-page',
 | 
				
			||||||
            path: '/backup-controller-page', guards: [authGuard]),
 | 
					            guards: [
 | 
				
			||||||
 | 
					              authGuard
 | 
				
			||||||
 | 
					            ],
 | 
				
			||||||
 | 
					            children: [
 | 
				
			||||||
 | 
					              RouteConfig(HomeRoute.name,
 | 
				
			||||||
 | 
					                  path: 'home-page',
 | 
				
			||||||
 | 
					                  parent: TabControllerRoute.name,
 | 
				
			||||||
 | 
					                  guards: [authGuard]),
 | 
				
			||||||
 | 
					              RouteConfig(SearchRoute.name,
 | 
				
			||||||
 | 
					                  path: 'search-page',
 | 
				
			||||||
 | 
					                  parent: TabControllerRoute.name,
 | 
				
			||||||
 | 
					                  guards: [authGuard])
 | 
				
			||||||
 | 
					            ]),
 | 
				
			||||||
        RouteConfig(ImageViewerRoute.name,
 | 
					        RouteConfig(ImageViewerRoute.name,
 | 
				
			||||||
            path: '/image-viewer-page', guards: [authGuard]),
 | 
					            path: '/image-viewer-page', guards: [authGuard]),
 | 
				
			||||||
        RouteConfig(VideoViewerRoute.name,
 | 
					        RouteConfig(VideoViewerRoute.name,
 | 
				
			||||||
            path: '/video-viewer-page', guards: [authGuard])
 | 
					            path: '/video-viewer-page', guards: [authGuard]),
 | 
				
			||||||
 | 
					        RouteConfig(BackupControllerRoute.name,
 | 
				
			||||||
 | 
					            path: '/backup-controller-page', guards: [authGuard])
 | 
				
			||||||
      ];
 | 
					      ];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -74,20 +98,13 @@ class LoginRoute extends PageRouteInfo<void> {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// generated route for
 | 
					/// generated route for
 | 
				
			||||||
/// [HomePage]
 | 
					/// [TabControllerPage]
 | 
				
			||||||
class HomeRoute extends PageRouteInfo<void> {
 | 
					class TabControllerRoute extends PageRouteInfo<void> {
 | 
				
			||||||
  const HomeRoute() : super(HomeRoute.name, path: '/home-page');
 | 
					  const TabControllerRoute({List<PageRouteInfo>? children})
 | 
				
			||||||
 | 
					      : super(TabControllerRoute.name,
 | 
				
			||||||
 | 
					            path: '/tab-controller-page', initialChildren: children);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  static const String name = 'HomeRoute';
 | 
					  static const String name = 'TabControllerRoute';
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/// generated route for
 | 
					 | 
				
			||||||
/// [BackupControllerPage]
 | 
					 | 
				
			||||||
class BackupControllerRoute extends PageRouteInfo<void> {
 | 
					 | 
				
			||||||
  const BackupControllerRoute()
 | 
					 | 
				
			||||||
      : super(BackupControllerRoute.name, path: '/backup-controller-page');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  static const String name = 'BackupControllerRoute';
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// generated route for
 | 
					/// generated route for
 | 
				
			||||||
@ -158,3 +175,41 @@ class VideoViewerRouteArgs {
 | 
				
			|||||||
    return 'VideoViewerRouteArgs{key: $key, videoUrl: $videoUrl}';
 | 
					    return 'VideoViewerRouteArgs{key: $key, videoUrl: $videoUrl}';
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/// generated route for
 | 
				
			||||||
 | 
					/// [BackupControllerPage]
 | 
				
			||||||
 | 
					class BackupControllerRoute extends PageRouteInfo<void> {
 | 
				
			||||||
 | 
					  const BackupControllerRoute()
 | 
				
			||||||
 | 
					      : super(BackupControllerRoute.name, path: '/backup-controller-page');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  static const String name = 'BackupControllerRoute';
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/// generated route for
 | 
				
			||||||
 | 
					/// [HomePage]
 | 
				
			||||||
 | 
					class HomeRoute extends PageRouteInfo<void> {
 | 
				
			||||||
 | 
					  const HomeRoute() : super(HomeRoute.name, path: 'home-page');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  static const String name = 'HomeRoute';
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/// generated route for
 | 
				
			||||||
 | 
					/// [SearchPage]
 | 
				
			||||||
 | 
					class SearchRoute extends PageRouteInfo<SearchRouteArgs> {
 | 
				
			||||||
 | 
					  SearchRoute({Key? key})
 | 
				
			||||||
 | 
					      : super(SearchRoute.name,
 | 
				
			||||||
 | 
					            path: 'search-page', args: SearchRouteArgs(key: key));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  static const String name = 'SearchRoute';
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class SearchRouteArgs {
 | 
				
			||||||
 | 
					  const SearchRouteArgs({this.key});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  final Key? key;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @override
 | 
				
			||||||
 | 
					  String toString() {
 | 
				
			||||||
 | 
					    return 'SearchRouteArgs{key: $key}';
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										44
									
								
								mobile/lib/shared/views/tab_controller_page.dart
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								mobile/lib/shared/views/tab_controller_page.dart
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,44 @@
 | 
				
			|||||||
 | 
					import 'package:auto_route/auto_route.dart';
 | 
				
			||||||
 | 
					import 'package:flutter/material.dart';
 | 
				
			||||||
 | 
					import 'package:hooks_riverpod/hooks_riverpod.dart';
 | 
				
			||||||
 | 
					import 'package:immich_mobile/modules/home/providers/home_page_state.provider.dart';
 | 
				
			||||||
 | 
					import 'package:immich_mobile/routing/router.dart';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class TabControllerPage extends ConsumerWidget {
 | 
				
			||||||
 | 
					  const TabControllerPage({Key? key}) : super(key: key);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @override
 | 
				
			||||||
 | 
					  Widget build(BuildContext context, WidgetRef ref) {
 | 
				
			||||||
 | 
					    var isMultiSelectEnable = ref.watch(homePageStateProvider).isMultiSelectEnable;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return AutoTabsRouter(
 | 
				
			||||||
 | 
					      routes: [
 | 
				
			||||||
 | 
					        const HomeRoute(),
 | 
				
			||||||
 | 
					        SearchRoute(),
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					      builder: (context, child, animation) {
 | 
				
			||||||
 | 
					        final tabsRouter = AutoTabsRouter.of(context);
 | 
				
			||||||
 | 
					        return Scaffold(
 | 
				
			||||||
 | 
					          body: FadeTransition(
 | 
				
			||||||
 | 
					            opacity: animation,
 | 
				
			||||||
 | 
					            child: child,
 | 
				
			||||||
 | 
					          ),
 | 
				
			||||||
 | 
					          bottomNavigationBar: isMultiSelectEnable
 | 
				
			||||||
 | 
					              ? null
 | 
				
			||||||
 | 
					              : BottomNavigationBar(
 | 
				
			||||||
 | 
					                  selectedLabelStyle: const TextStyle(fontSize: 15, fontWeight: FontWeight.w600),
 | 
				
			||||||
 | 
					                  unselectedLabelStyle: const TextStyle(fontSize: 15, fontWeight: FontWeight.w600),
 | 
				
			||||||
 | 
					                  currentIndex: tabsRouter.activeIndex,
 | 
				
			||||||
 | 
					                  onTap: (index) {
 | 
				
			||||||
 | 
					                    tabsRouter.setActiveIndex(index);
 | 
				
			||||||
 | 
					                  },
 | 
				
			||||||
 | 
					                  items: const [
 | 
				
			||||||
 | 
					                    BottomNavigationBarItem(label: 'Photos', icon: Icon(Icons.photo)),
 | 
				
			||||||
 | 
					                    BottomNavigationBarItem(label: 'Seach', icon: Icon(Icons.search)),
 | 
				
			||||||
 | 
					                  ],
 | 
				
			||||||
 | 
					                ),
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -71,6 +71,11 @@ export class AssetController {
 | 
				
			|||||||
    return this.assetService.serveFile(authUser, query, res, headers);
 | 
					    return this.assetService.serveFile(authUser, query, res, headers);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @Get('/searchTerm')
 | 
				
			||||||
 | 
					  async getAssetSearchTerm(@GetAuthUser() authUser: AuthUserDto) {
 | 
				
			||||||
 | 
					    return this.assetService.getAssetSearchTerm(authUser);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @Get('/new')
 | 
					  @Get('/new')
 | 
				
			||||||
  async getNewAssets(@GetAuthUser() authUser: AuthUserDto, @Query(ValidationPipe) query: GetNewAssetQueryDto) {
 | 
					  async getNewAssets(@GetAuthUser() authUser: AuthUserDto, @Query(ValidationPipe) query: GetNewAssetQueryDto) {
 | 
				
			||||||
    return await this.assetService.getNewAssets(authUser, query.latestDate);
 | 
					    return await this.assetService.getNewAssets(authUser, query.latestDate);
 | 
				
			||||||
 | 
				
			|||||||
@ -67,7 +67,7 @@ export class AssetService {
 | 
				
			|||||||
        .orderBy('a."createdAt"::date', 'DESC')
 | 
					        .orderBy('a."createdAt"::date', 'DESC')
 | 
				
			||||||
        .getMany();
 | 
					        .getMany();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return assets;
 | 
					      return assets;
 | 
				
			||||||
    } catch (e) {
 | 
					    } catch (e) {
 | 
				
			||||||
      Logger.error(e, 'getAllAssets');
 | 
					      Logger.error(e, 'getAllAssets');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -243,4 +243,38 @@ export class AssetService {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    return result;
 | 
					    return result;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  async getAssetSearchTerm(authUser: AuthUserDto): Promise<String[]> {
 | 
				
			||||||
 | 
					    const possibleSearchTerm = new Set<String>();
 | 
				
			||||||
 | 
					    const rows = await this.assetRepository.query(
 | 
				
			||||||
 | 
					      `
 | 
				
			||||||
 | 
					      select distinct si.tags, e.orientation, e."lensModel", e.make, e.model , a.type
 | 
				
			||||||
 | 
					      from assets a
 | 
				
			||||||
 | 
					      left join exif e on a.id = e."assetId"
 | 
				
			||||||
 | 
					      left join smart_info si on a.id = si."assetId"
 | 
				
			||||||
 | 
					      where a."userId" = $1;
 | 
				
			||||||
 | 
					      `,
 | 
				
			||||||
 | 
					      [authUser.id],
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    rows.forEach((row) => {
 | 
				
			||||||
 | 
					      // tags
 | 
				
			||||||
 | 
					      row['tags']?.map((tag) => possibleSearchTerm.add(tag?.toLowerCase()));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      // asset's tyoe
 | 
				
			||||||
 | 
					      possibleSearchTerm.add(row['type']?.toLowerCase());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      // image orientation
 | 
				
			||||||
 | 
					      possibleSearchTerm.add(row['orientation']?.toLowerCase());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      // Lens model
 | 
				
			||||||
 | 
					      possibleSearchTerm.add(row['lensModel']?.toLowerCase());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      // Make and model
 | 
				
			||||||
 | 
					      possibleSearchTerm.add(row['make']?.toLowerCase());
 | 
				
			||||||
 | 
					      possibleSearchTerm.add(row['model']?.toLowerCase());
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return Array.from(possibleSearchTerm).filter((x) => x != null);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user