Skip to content

Conversation

PhilLab
Copy link
Contributor

@PhilLab PhilLab commented Sep 21, 2025

  • Tests written, or not not needed

Fixes #15636.

  1. The patch added in Finish PreviewImageActivity After Image Deletion #14782 prevented that the callback onRemoteOperationFinish() was ever called.
    The changes were removed. I was not able to reproduce the end-to-end encryption issue, so this seems fine.
    • @alperozturk96 if you could try yourself, as you had originally worked on that issue?
  2. the manual update of adapter and pager is only needed if user is not present. When user is present, the initViewPager() takes care of everything.
  3. The next image was inconsistent between user present yes/no

Copy link

github-actions bot commented Oct 6, 2025

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

The patch added in nextcloud#14782 prevented that the callback
onRemoteOperationFinish() was ever called.

Secondly, the manual update of adapter and pager is only needed if user
is not present. When user is present, the initViewPager() takes care
of everything.

Signed-off-by: Philipp Hasper <vcs@hasper.info>
In that case, deleting the currently viewed file had the following issues:
1. When deleting the first image, the UI just stayed with it.
2. When deleting another image, the UI switched to the previous image,
   instead of the next one, which is inconsistent to the behavior when
   user is available
3. When switching to the next image, the title shown at the top did
   not correctly update

Signed-off-by: Philipp Hasper <vcs@hasper.info>
@alperozturk96 alperozturk96 force-pushed the fix_15636_deleting_from_slideshow branch from 94917e8 to 3143bb7 Compare October 6, 2025 07:26
Copy link
Collaborator

@alperozturk96 alperozturk96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello

I tested changes for encrypted folder as well. I didn't come across any problem. Besides three small things, PR looks okay.

Codacy:

Screenshot 2025-10-06 at 09 44 25

Thank you for the PR 👍

// Re-init the view pager, which will advance to the next image
initViewPager(user.get())
} else if (result.isSuccess) {
// If deletion was successful, update adapter and display next image
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove comments and extract else if (result.isSuccess) { logic to the separate function, e.g. updateViewPagerAfterDeletion() thus it will be also clear without comments.

override fun getItemId(position: Int): Long {
// The item ID function is needed to detect whether the deletion of the current item needs a UI update
// Use the OCFile id, fallback to position if not available
return imageFiles.getOrNull(position)?.fileId?.toLong() ?: position.toLong()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getItemId() is part of androidx.viewpager2.adapter.FragmentStateAdapter. No need to add an explanation here since the method is already documented in the official API.

Additionally, please remove unnecessary toLong() cast for fileId since fileId is already Long.

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.

Slideshow is left when deleting file

3 participants