-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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): Added "jump to date" functionality to the memory view #7323
feat(mobile): Added "jump to date" functionality to the memory view #7323
Conversation
mobile/lib/modules/home/ui/asset_grid/immich_asset_grid_view.dart
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for working on this PR. I'm sure a lot of users would find this useful. Can you please address the review comments. Also, Can we change the button to an IconButton
instead? Choose any icon you find appropriate for now and we can change it later. open_in_new
,move_down
or timeline
seems appropriate to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great and is super useful!
mobile/lib/modules/home/ui/asset_grid/immich_asset_grid_view.dart
Outdated
Show resolved
Hide resolved
…us/7323
- Added index bound checks - Handled edge cases when scrolling to the very bottom of the grid-view - removing the listener on dispose
I tested the PR and when clicking on the button to jump to timeline, it doesn't do anything 🤔 |
Well that's kind of embarassing, i had left an offset in the scroll index from when i was testing... Did the memory view at least close when you clicked the button, @alextran1502 ? |
Hello, yes, when clicking on the button, it dismisses the memory view |
I'm kinda stumped, i added another toast, in case the date that the listener receives is somehow null... Are you testing this on the demo instance by any chance? |
I tested it on my instance and it works, hides the memory view and jumps to the correct date |
…-jump-to-asset
Hey @arnolicious, I just tested again on my prod instance. When I clicked on the link, I got this error |
Hm, an index of -1 would indicate no item in the list matching the date was found, which shouldn't happen, since if that memory exists, it should also exist in the timeline. The check looks right to me, at first i suspected timezones to possibly be the cause of this, but I couldn't replicate it. final index = widget.renderList.elements.indexWhere(
(e) =>
e.date.year == date.year &&
e.date.month == date.month &&
e.date.day == date.day,
); Is the date in the error message correct, is that the date of the memory you clicked on? |
Oh, didn't know that was a thing lol Gonna look into it, thanks for pointing that out! (Edit: Yeah, that causes the error, lets hope Alex had the timeline setting grouped to month, so it is the same issue :D ) |
You should also gracefully handle the index not found case. In the ideal case, we'd hide the button entirely. But we can also show a nicely formatted error that we can't find the day in the timeline. Maybe we can do something even better? |
I'm not sure how feasible or necessary hiding the button would be, since it really shouldn't happen, once this bug is fixed. I will make the toast error more user friendly tho. The question now is rather, what should happen when the timeline is grouped by month? |
…-jump-to-asset
Added a "Jump to date" Button in the bottom Info bar of the memory view.
It was somewhat mentioned here, but it is mainly a feature I've found myself wanting quite often.
As to the implementation, I don't have much Flutter experience, so my approach to communicate between the two components (the button in the memory view, and the Timeline list that needs to scroll) was with events, for which I've added the event package
If there's a better/more "fluttery" way to do this, let me know!
And for the UI, at first I wanted to add an IconButton, however I couldn't really find a fitting Icon for this action (the closest I could come up with, was the
open_in_new
Icon), so I settled on a TextButton, and added the text to the languages I speak.Here's a demo of what it looks like, on a very choppy emulator :D
https://github.com/immich-app/immich/assets/46051866/289750d1-d2b5-4619-8441-2c77295dd57b