diff --git a/mobile/assets/i18n/en-US.json b/mobile/assets/i18n/en-US.json index c29e842faf..c81ebdfe63 100644 --- a/mobile/assets/i18n/en-US.json +++ b/mobile/assets/i18n/en-US.json @@ -167,8 +167,5 @@ "version_announcement_overlay_text_3": " and ensure your docker-compose and .env setup is up-to-date to prevent any misconfigurations, especially if you use WatchTower or any mechanism that handles updating your server application automatically.", "version_announcement_overlay_title": "New Server Version Available \uD83C\uDF89", "experimental_settings_title": "Experimental", - "experimental_settings_subtitle": "Use at your own risk!", - "experimental_settings_new_asset_list_title": "Enable experimental photo grid", - "experimental_settings_new_asset_list_subtitle": "Work in progress", - "settings_require_restart": "Please restart Immich to apply this setting" + "experimental_settings_subtitle": "Use at your own risk!" } \ No newline at end of file diff --git a/mobile/lib/modules/album/views/album_viewer_page.dart b/mobile/lib/modules/album/views/album_viewer_page.dart index 5ebd2a11d1..59f66d997d 100644 --- a/mobile/lib/modules/album/views/album_viewer_page.dart +++ b/mobile/lib/modules/album/views/album_viewer_page.dart @@ -5,8 +5,8 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:immich_mobile/modules/home/ui/asset_list_v2/asset_grid_data_structure.dart'; -import 'package:immich_mobile/modules/home/ui/asset_list_v2/immich_asset_grid.dart'; +import 'package:immich_mobile/modules/home/ui/asset_grid/asset_grid_data_structure.dart'; +import 'package:immich_mobile/modules/home/ui/asset_grid/immich_asset_grid.dart'; import 'package:immich_mobile/modules/login/providers/authentication.provider.dart'; import 'package:immich_mobile/modules/album/models/asset_selection_page_result.model.dart'; import 'package:immich_mobile/modules/album/providers/asset_selection.provider.dart'; diff --git a/mobile/lib/modules/home/providers/home_page_render_list_provider.dart b/mobile/lib/modules/home/providers/home_page_render_list_provider.dart index 4ad6be68f0..707f98fb7d 100644 --- a/mobile/lib/modules/home/providers/home_page_render_list_provider.dart +++ b/mobile/lib/modules/home/providers/home_page_render_list_provider.dart @@ -1,7 +1,7 @@ import 'dart:math'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:immich_mobile/modules/home/ui/asset_list_v2/asset_grid_data_structure.dart'; +import 'package:immich_mobile/modules/home/ui/asset_grid/asset_grid_data_structure.dart'; import 'package:immich_mobile/modules/settings/providers/app_settings.provider.dart'; import 'package:immich_mobile/modules/settings/services/app_settings.service.dart'; import 'package:immich_mobile/shared/providers/asset.provider.dart'; diff --git a/mobile/lib/modules/home/providers/home_page_state.provider.dart b/mobile/lib/modules/home/providers/home_page_state.provider.dart index 974706d361..ff4f8cfd93 100644 --- a/mobile/lib/modules/home/providers/home_page_state.provider.dart +++ b/mobile/lib/modules/home/providers/home_page_state.provider.dart @@ -1,4 +1,3 @@ -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/models/home_page_state.model.dart'; diff --git a/mobile/lib/modules/home/ui/asset_list_v2/asset_grid_data_structure.dart b/mobile/lib/modules/home/ui/asset_grid/asset_grid_data_structure.dart similarity index 100% rename from mobile/lib/modules/home/ui/asset_list_v2/asset_grid_data_structure.dart rename to mobile/lib/modules/home/ui/asset_grid/asset_grid_data_structure.dart diff --git a/mobile/lib/modules/home/ui/asset_list_v2/daily_title_text.dart b/mobile/lib/modules/home/ui/asset_grid/daily_title_text.dart similarity index 100% rename from mobile/lib/modules/home/ui/asset_list_v2/daily_title_text.dart rename to mobile/lib/modules/home/ui/asset_grid/daily_title_text.dart diff --git a/mobile/lib/modules/home/ui/asset_list_v2/draggable_scrollbar_custom.dart b/mobile/lib/modules/home/ui/asset_grid/draggable_scrollbar_custom.dart similarity index 100% rename from mobile/lib/modules/home/ui/asset_list_v2/draggable_scrollbar_custom.dart rename to mobile/lib/modules/home/ui/asset_grid/draggable_scrollbar_custom.dart diff --git a/mobile/lib/modules/home/ui/asset_list_v2/immich_asset_grid.dart b/mobile/lib/modules/home/ui/asset_grid/immich_asset_grid.dart similarity index 96% rename from mobile/lib/modules/home/ui/asset_list_v2/immich_asset_grid.dart rename to mobile/lib/modules/home/ui/asset_grid/immich_asset_grid.dart index d45c7d73c0..7ff4a78905 100644 --- a/mobile/lib/modules/home/ui/asset_list_v2/immich_asset_grid.dart +++ b/mobile/lib/modules/home/ui/asset_grid/immich_asset_grid.dart @@ -7,13 +7,12 @@ import 'package:flutter/material.dart'; import 'package:flutter/src/widgets/framework.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:immich_mobile/modules/home/ui/asset_list_v2/daily_title_text.dart'; -import 'package:immich_mobile/modules/home/ui/asset_list_v2/draggable_scrollbar_custom.dart'; +import 'package:immich_mobile/modules/home/ui/thumbnail_image.dart'; import 'package:openapi/api.dart'; import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; - -import '../thumbnail_image.dart'; import 'asset_grid_data_structure.dart'; +import 'daily_title_text.dart'; +import 'draggable_scrollbar_custom.dart'; class ImmichAssetGrid extends HookConsumerWidget { final ItemScrollController _itemScrollController = ItemScrollController(); diff --git a/mobile/lib/modules/home/views/home_page.dart b/mobile/lib/modules/home/views/home_page.dart index a1d8f46b2f..ebfc55680f 100644 --- a/mobile/lib/modules/home/views/home_page.dart +++ b/mobile/lib/modules/home/views/home_page.dart @@ -3,22 +3,16 @@ import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:immich_mobile/modules/home/providers/home_page_render_list_provider.dart'; import 'package:immich_mobile/modules/home/providers/home_page_state.provider.dart'; +import 'package:immich_mobile/modules/home/ui/asset_grid/immich_asset_grid.dart'; import 'package:immich_mobile/modules/home/ui/control_bottom_app_bar.dart'; -import 'package:immich_mobile/modules/home/ui/daily_title_text.dart'; import 'package:immich_mobile/modules/home/ui/disable_multi_select_button.dart'; -import 'package:immich_mobile/modules/home/ui/draggable_scrollbar.dart'; -import 'package:immich_mobile/modules/home/ui/image_grid.dart'; -import 'package:immich_mobile/modules/home/ui/asset_list_v2/immich_asset_grid.dart'; import 'package:immich_mobile/modules/home/ui/immich_sliver_appbar.dart'; -import 'package:immich_mobile/modules/home/ui/monthly_title_text.dart'; import 'package:immich_mobile/modules/home/ui/profile_drawer/profile_drawer.dart'; import 'package:immich_mobile/modules/settings/providers/app_settings.provider.dart'; import 'package:immich_mobile/modules/settings/services/app_settings.service.dart'; - import 'package:immich_mobile/shared/providers/asset.provider.dart'; import 'package:immich_mobile/shared/providers/server_info.provider.dart'; import 'package:immich_mobile/shared/providers/websocket.provider.dart'; -import 'package:openapi/api.dart'; class HomePage extends HookConsumerWidget { const HomePage({Key? key}) : super(key: key); @@ -29,19 +23,9 @@ class HomePage extends HookConsumerWidget { var renderList = ref.watch(renderListProvider); - ScrollController scrollController = useScrollController(); - var assetGroupByDateTime = ref.watch(assetGroupByDateTimeProvider); - List imageGridGroup = []; var isMultiSelectEnable = ref.watch(homePageStateProvider).isMultiSelectEnable; var homePageState = ref.watch(homePageStateProvider); - List sortedAssetList = []; - // set sorted List - for (var group in assetGroupByDateTime.values) { - for (var value in group) { - sortedAssetList.add(value); - } - } useEffect( () { @@ -57,61 +41,15 @@ class HomePage extends HookConsumerWidget { ref.read(assetProvider.notifier).getAllAsset(); } - _buildSelectedItemCountIndicator() { + buildSelectedItemCountIndicator() { return DisableMultiSelectButton( onPressed: ref.watch(homePageStateProvider.notifier).disableMultiSelect, selectedItemCount: homePageState.selectedItems.length, ); } - Widget _buildBody() { - if (assetGroupByDateTime.isNotEmpty) { - int? lastMonth; - - assetGroupByDateTime.forEach((dateGroup, immichAssetList) { - try { - DateTime parseDateGroup = DateTime.parse(dateGroup); - int currentMonth = parseDateGroup.month; - - if (lastMonth != null) { - if (currentMonth - lastMonth! != 0) { - imageGridGroup.add( - MonthlyTitleText( - isoDate: dateGroup, - ), - ); - } - } - - imageGridGroup.add( - DailyTitleText( - key: Key('${dateGroup.toString()}title'), - isoDate: dateGroup, - assetGroup: immichAssetList, - ), - ); - - imageGridGroup.add( - ImageGrid( - assetGroup: immichAssetList, - sortedAssetGroup: sortedAssetList, - tilesPerRow: - appSettingService.getSetting(AppSettingsEnum.tilesPerRow), - showStorageIndicator: appSettingService - .getSetting(AppSettingsEnum.storageIndicator), - ), - ); - - lastMonth = currentMonth; - } catch (e) { - debugPrint( - "[ERROR] Cannot parse $dateGroup - Wrong create date format : ${immichAssetList.map((asset) => asset.createdAt).toList()}", - ); - } - }); - } - - _buildSliverAppBar() { + Widget buildBody() { + buildSliverAppBar() { return isMultiSelectEnable ? const SliverToBoxAdapter( child: SizedBox( @@ -124,31 +62,6 @@ class HomePage extends HookConsumerWidget { ); } - _buildAssetGrid() { - if (appSettingService - .getSetting(AppSettingsEnum.useExperimentalAssetGrid)) { - return ImmichAssetGrid( - renderList: renderList, - assetsPerRow: - appSettingService.getSetting(AppSettingsEnum.tilesPerRow), - showStorageIndicator: appSettingService - .getSetting(AppSettingsEnum.storageIndicator), - ); - } else { - return DraggableScrollbar.semicircle( - backgroundColor: Theme.of(context).hintColor, - controller: scrollController, - heightScrollThumb: 48.0, - child: CustomScrollView( - controller: scrollController, - slivers: [ - ...imageGridGroup, - ], - ), - ); - } - } - return SafeArea( bottom: !isMultiSelectEnable, top: !isMultiSelectEnable, @@ -156,15 +69,21 @@ class HomePage extends HookConsumerWidget { children: [ CustomScrollView( slivers: [ - _buildSliverAppBar(), + buildSliverAppBar(), ], ), Padding( padding: const EdgeInsets.only(top: 60.0, bottom: 0.0), - child: _buildAssetGrid(), + child: ImmichAssetGrid( + renderList: renderList, + assetsPerRow: + appSettingService.getSetting(AppSettingsEnum.tilesPerRow), + showStorageIndicator: appSettingService + .getSetting(AppSettingsEnum.storageIndicator), + ), ), if (isMultiSelectEnable) ...[ - _buildSelectedItemCountIndicator(), + buildSelectedItemCountIndicator(), const ControlBottomAppBar(), ], ], @@ -174,7 +93,7 @@ class HomePage extends HookConsumerWidget { return Scaffold( drawer: const ProfileDrawer(), - body: _buildBody(), + body: buildBody(), ); } } diff --git a/mobile/lib/modules/search/providers/search_result_page.provider.dart b/mobile/lib/modules/search/providers/search_result_page.provider.dart index b52c172f60..c152be25e6 100644 --- a/mobile/lib/modules/search/providers/search_result_page.provider.dart +++ b/mobile/lib/modules/search/providers/search_result_page.provider.dart @@ -1,6 +1,6 @@ import 'package:collection/collection.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:immich_mobile/modules/home/ui/asset_list_v2/asset_grid_data_structure.dart'; +import 'package:immich_mobile/modules/home/ui/asset_grid/asset_grid_data_structure.dart'; import 'package:immich_mobile/modules/search/models/search_result_page_state.model.dart'; import 'package:immich_mobile/modules/search/services/search.service.dart'; diff --git a/mobile/lib/modules/search/views/search_result_page.dart b/mobile/lib/modules/search/views/search_result_page.dart index 850de5cd96..5f213cdce0 100644 --- a/mobile/lib/modules/search/views/search_result_page.dart +++ b/mobile/lib/modules/search/views/search_result_page.dart @@ -4,13 +4,12 @@ import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:flutter_spinkit/flutter_spinkit.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:immich_mobile/modules/home/ui/asset_list_v2/immich_asset_grid.dart'; +import 'package:immich_mobile/modules/home/ui/asset_grid/immich_asset_grid.dart'; import 'package:immich_mobile/modules/search/providers/search_page_state.provider.dart'; import 'package:immich_mobile/modules/search/providers/search_result_page.provider.dart'; import 'package:immich_mobile/modules/search/ui/search_suggestion_list.dart'; import 'package:immich_mobile/modules/settings/providers/app_settings.provider.dart'; import 'package:immich_mobile/modules/settings/services/app_settings.service.dart'; -import 'package:openapi/api.dart'; class SearchResultPage extends HookConsumerWidget { const SearchResultPage({Key? key, required this.searchTerm}) diff --git a/mobile/lib/modules/settings/ui/experimental_settings/experimental_settings.dart b/mobile/lib/modules/settings/ui/experimental_settings/experimental_settings.dart index 2043d0d24b..f6db82494f 100644 --- a/mobile/lib/modules/settings/ui/experimental_settings/experimental_settings.dart +++ b/mobile/lib/modules/settings/ui/experimental_settings/experimental_settings.dart @@ -1,11 +1,6 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_hooks/flutter_hooks.dart'; -import 'package:fluttertoast/fluttertoast.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:immich_mobile/modules/settings/providers/app_settings.provider.dart'; -import 'package:immich_mobile/modules/settings/services/app_settings.service.dart'; -import 'package:immich_mobile/shared/ui/immich_toast.dart'; class ExperimentalSettings extends HookConsumerWidget { const ExperimentalSettings({ @@ -14,33 +9,6 @@ class ExperimentalSettings extends HookConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final appSettingService = ref.watch(appSettingsServiceProvider); - - final useExperimentalAssetGrid = useState(false); - - useEffect( - () { - useExperimentalAssetGrid.value = appSettingService - .getSetting(AppSettingsEnum.useExperimentalAssetGrid); - return null; - }, - [], - ); - - void changeUseExperimentalAssetGrid(bool status) { - useExperimentalAssetGrid.value = status; - appSettingService.setSetting( - AppSettingsEnum.useExperimentalAssetGrid, - status, - ); - - ImmichToast.show( - context: context, - msg: "settings_require_restart".tr(), - gravity: ToastGravity.BOTTOM, - ); - } - return ExpansionTile( textColor: Theme.of(context).primaryColor, title: const Text( @@ -55,25 +23,25 @@ class ExperimentalSettings extends HookConsumerWidget { fontSize: 13, ), ).tr(), - children: [ - SwitchListTile.adaptive( - activeColor: Theme.of(context).primaryColor, - title: const Text( - "experimental_settings_new_asset_list_title", - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - ), - ).tr(), - subtitle: const Text( - "experimental_settings_new_asset_list_subtitle", - style: TextStyle( - fontSize: 12, - ), - ).tr(), - value: useExperimentalAssetGrid.value, - onChanged: changeUseExperimentalAssetGrid, - ), + children: const [ + // SwitchListTile.adaptive( + // activeColor: Theme.of(context).primaryColor, + // title: const Text( + // "experimental_settings_new_asset_list_title", + // style: TextStyle( + // fontSize: 12, + // fontWeight: FontWeight.bold, + // ), + // ).tr(), + // subtitle: const Text( + // "experimental_settings_new_asset_list_subtitle", + // style: TextStyle( + // fontSize: 12, + // ), + // ).tr(), + // value: useExperimentalAssetGrid.value, + // onChanged: changeUseExperimentalAssetGrid, + // ), ], ); } diff --git a/mobile/lib/modules/settings/views/settings_page.dart b/mobile/lib/modules/settings/views/settings_page.dart index 4176629dd2..9a16793429 100644 --- a/mobile/lib/modules/settings/views/settings_page.dart +++ b/mobile/lib/modules/settings/views/settings_page.dart @@ -43,7 +43,7 @@ class SettingsPage extends HookConsumerWidget { const ThemeSetting(), const AssetListSettings(), if (Platform.isAndroid) const NotificationSetting(), - const ExperimentalSettings(), + //const ExperimentalSettings(), ], ).toList(), ], diff --git a/mobile/test/asset_grid_data_structure_test.dart b/mobile/test/asset_grid_data_structure_test.dart index 87ea203233..94d646ea07 100644 --- a/mobile/test/asset_grid_data_structure_test.dart +++ b/mobile/test/asset_grid_data_structure_test.dart @@ -1,5 +1,5 @@ import 'package:flutter_test/flutter_test.dart'; -import 'package:immich_mobile/modules/home/ui/asset_list_v2/asset_grid_data_structure.dart'; +import 'package:immich_mobile/modules/home/ui/asset_grid/asset_grid_data_structure.dart'; import 'package:openapi/api.dart'; void main() {