Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(mobile): Folder View for mobile #15047

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

arnolicious
Copy link
Contributor

General Idea

  • Folder navigation with one page per folder (like for example nextcloud app)
  • Shows subfolders and assets in that page
  • Nice to have: switch between List view and Tile view

Implementation Idea

My rough Idea was to have one single state representing the entire folder structure, since that can be derived from a single api call.
And then, whenever a folder gets navigated to, the assets for that specific folder could get fetched, and also saved in that state.

That way (I hope) you could navigate out and back in again without having to refetch the assets, since they would still be saved in state.

So far

Since I have basically no experience with complex Flutter projects or Flutter State Management, this is gonna be rough, but i've hacked together a somewhat functional prototype that fetches the folders and lets you navigate through them.

Asset loading is not yet implemented, since I am sure there are already plenty of basic improvements that could be made at this stage from more experience devs regarding the entire state and fetching logic.

@arnolicious
Copy link
Contributor Author

Thanks for the feedback Alex, I implemented your suggested fixes as well as I could.

I have now tried to implement the loading of assets by creating a new Provider, however something is not working yet.
I think the problem is the passing from the current folder to the provider, so that it can return the correct assets.
There's only a empty list returned, and re-navigating to a previously visited folder also doesn't trigger the provider to refetch...

@arnolicious
Copy link
Contributor Author

arnolicious commented Jan 25, 2025

Thanks again for your fix @shenlong-tanwen <3

I have now implemented:

  • Displaying assets in a list view with thumbnail, filename, size and createdDate
  • Using the RenderList to allow the assets to be tapped and opened in the regular GalleryViewer
  • Very rudimentary sorting:
    • one single toggle sort order button in the top bar
    • which correctly toggles the sorting order of the assets in the current folder
    • and toggles the general order of all folders, but this isn't reactive yet (not sure why)

What's missing for a "beta" release:

  • Fix the sorting reactivity for folders

Improvements, which could potentially be saved for a follow-up PR:

  • Toggling from a list view to a grid view
  • Handling asset actions and selections (not sure how much effort this would be, maybe this would be better suited for a follow-up PR)
  • Figure out a better way to handle back navigation:
    • currently the pages just keep stacking on top of eachother when navigating through nested folders. That means that if you're 10 layers deep and you want to get back to the immich timeline for example, you gotta go back 10 screens, which is very un-ergonomic. Anyone got an idea of how this could be handled better (on a UX level)?

@arnolicious
Copy link
Contributor Author

Alrighty, I've got it to a working and imo acceptable state in my testing, I think we could start testing and if not critical bugs are gound, we could merge this.

The additional improvements mentioned above would be for a follow up PR

@arnolicious arnolicious marked this pull request as ready for review February 1, 2025 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants