Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mobile][photos] refactor albums tab to remove uncessary checks

Priyanshu Dangare3ced0f72d579
diff --git a/mobile/apps/photos/lib/ui/tabs/albums_tab.dart b/mobile/apps/photos/lib/ui/tabs/albums_tab.dart
index 2f920e6d7e..52fbfd8347 100644
--- a/mobile/apps/photos/lib/ui/tabs/albums_tab.dart
+++ b/mobile/apps/photos/lib/ui/tabs/albums_tab.dart
@@ -237,11 +237,8 @@ class _AlbumsTabState extends State<AlbumsTab>
await Future.wait([_loadEnteCollections(), _loadSharedCollections()]);
}
- bool get _isLocalGalleryMode =>
- isLocalGalleryMode && !Configuration.instance.hasConfiguredAccount();
-
_AlbumsFilter get _effectiveFilter =>
- _isLocalGalleryMode ? _AlbumsFilter.onDevice : _filter.value;
+ isLocalGalleryMode ? _AlbumsFilter.onDevice : _filter.value;
bool get _hasSearchQuery => _searchQuery.trim().isNotEmpty;
@@ -285,7 +282,7 @@ class _AlbumsTabState extends State<AlbumsTab>
}
void _selectFilter(_AlbumsFilter filter) {
- if (_isLocalGalleryMode && filter != _AlbumsFilter.onDevice) return;
+ if (isLocalGalleryMode && filter != _AlbumsFilter.onDevice) return;
if (_filter.value == filter) return;
widget.selectedAlbums?.clearAll();
_resetScrollForNextContent();
@@ -463,7 +460,7 @@ class _AlbumsTabState extends State<AlbumsTab>
}
Widget _buildGlobalSearchResultsSliver(StringsLocalizations strings) {
- if (_isLocalGalleryMode) {
+ if (isLocalGalleryMode) {
return SliverMainAxisGroup(
slivers: [
DeviceFolderVerticalGridSliver(
@@ -762,7 +759,6 @@ class _AlbumsTabState extends State<AlbumsTab>
final textTheme = getEnteTextTheme(context);
final strings = context.strings;
final selectedAlbums = widget.selectedAlbums;
- final localGalleryMode = _isLocalGalleryMode;
final albumsOptionsButton = Builder(
builder: (buttonContext) => IconButtonComponent(
variant: IconButtonComponentVariant.primary,
@@ -883,7 +879,7 @@ class _AlbumsTabState extends State<AlbumsTab>
duration: _kSearchTransitionDuration,
switchInCurve: Curves.easeOutCubic,
switchOutCurve: Curves.easeInCubic,
- child: _isSearchActive || localGalleryMode
+ child: _isSearchActive || isLocalGalleryMode
? const SizedBox.shrink(key: ValueKey("hidden_filters"))
: Padding(
key: const ValueKey("album_filters"),
@@ -897,7 +893,7 @@ class _AlbumsTabState extends State<AlbumsTab>
child: ValueListenableBuilder<_AlbumsFilter>(
valueListenable: _filter,
builder: (context, selected, _) {
- final effectiveFilter = localGalleryMode
+ final effectiveFilter = isLocalGalleryMode
? _AlbumsFilter.onDevice
: selected;
return Stack(
@@ -911,7 +907,7 @@ class _AlbumsTabState extends State<AlbumsTab>
),
child: Row(
children: [
- if (!localGalleryMode) ...[
+ if (!isLocalGalleryMode) ...[
_AlbumsFilterChip(
label: strings.ente,
selected:
@@ -932,7 +928,7 @@ class _AlbumsTabState extends State<AlbumsTab>
_AlbumsFilter.onDevice,
),
),
- if (!localGalleryMode) ...[
+ if (!isLocalGalleryMode) ...[
const SizedBox(width: 8),
_AlbumsFilterChip(
label: