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

fix persistent text preview fragment in the background #11937

Closed
wants to merge 1 commit into from

Conversation

parneet-guraya
Copy link
Contributor

Solves: #11836

Before.mp4
After.mp4

What this PR includes?

  • Solve the issue by removing this method which was causing the new fragment launch and end up having two same fragments.
  • That method was originally added to solve this issue and here's the PR, But now removing this call does not reproduce that same issue also. You can see below -->
issue_not_reproduce.mp4
  • Tests written, or not not needed

@parneet-guraya
Copy link
Contributor Author

Hi, I solved this issue, Here's what was causing it -->

Actual Behaviour ->

  • OCFileListFragment which is the main view when launched, starts with fragment transaction (add) without call to addToBackStack(), It means no reverse transaction can happen thus pressing back exits the app (fragment goes in to onStop()).

  • While launching PreviewTextStringFragment which opens when clicked upon Readme.md (preview at the top) adapter item , with transaction (replace) with addToBackStack(), so replace cause the OCFileListFragment to Destroy and PreviewTextStringFragment launches.

  • This line else if (leftFragment instanceof PreviewTextStringFragment) { createMinFragments(null); } is the main issue first of all it's not calling super.onBackPressed(); which lead to non reversal of replace transaction, so neither the current PreviewTextStringFragment destroys nor OCFileListFragment gets created.

  • What createMinFragments(Bundle savedInstanceState) method doing is creating new OCFileListFragment with fragment transaction (add) without addToBackStack(), so no reversals.

  • So, now when user click on Preview and it opens up and upon pressing back it does not destroy the Preview Fragment and also create new OCFileListFragment, which shows us the Preview Fragment in the fragment and the new OCFileListFragment on top of it that's why we are seeing persistent Readme file in the background.

But, In fact we should be calling onBackPressed() as well as not calling the createMinFragments(null); since it's creating the new OCFileListFragment and because if we call this one at this point (along with onBackPressed()) then we will end up with two OCFileListFragment showing since one is from reversal transaction and other one is created by function.

And this is what right now we're seeing is the persistent Preview Fragment (due to not calling onBackPressed) and the function creating a new one on top of it.

Thanks!

@github-actions
Copy link

Codacy

Lint

TypemasterPR
Warnings8080
Errors00

SpotBugs

CategoryBaseNew
Bad practice2626
Correctness8585
Dodgy code434434
Experimental22
Internationalization99
Malicious code vulnerability22
Multithreaded correctness99
Performance5959
Security1818
Total644644

@github-actions
Copy link

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/11937.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

@github-actions
Copy link

@parneet-guraya
Copy link
Contributor Author

Closing as this solution is now part of this #11965 PR.

@parneet-guraya parneet-guraya deleted the readme-dir-not-clearing branch October 24, 2023 21:47
@joshtrichards joshtrichards linked an issue Dec 1, 2023 that may be closed by this pull request
Copy link

github-actions bot commented Apr 3, 2024

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!

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.

README.md from root directory not clearing Folder information (rich workspaces) display bug
2 participants