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

Why do we need to create the ZimFileReader object and set it to the reader if we open the note for the file that is not currently opened in the reader. #4180

Open
MohitMaliFtechiz opened this issue Jan 20, 2025 · 3 comments · May be fixed by #4183
Assignees
Milestone

Comments

@MohitMaliFtechiz
Copy link
Collaborator

Describe the bug
Why do we need to create the ZimFileReader object and set it to the reader if we open the note for the file that is not currently opened in the reader? Since when opening the note user only wants to see or edit the current note. For this, we have all the things already available in the database like filePath, noteTitle, and ZimUrl, etc, and we only need these things to update the note so why are we creating the ZimFileReader object and setting it to the reader? IMHO, we should not create the ZimFileReader and set it to the current reader because the user only wants to open or edit the note, and creating the ZimFileReader is a resource-intensive task because there can be huge ZIM files. Also, it does not make sense to set the ZIM file in reader for the currently opened note because there is one more option "OPEN ARTICLE" which directly opens the ZIM file and loads the page of note.

See

Expected behavior
It should not create the ZimFileReader as it is a resource-intensive task and we are doing it for no reason.

Environment

  • Version of Kiwix Android : 3.13.0
@MohitMaliFtechiz
Copy link
Collaborator Author

@kelson42 While fixing the #3937 I found this issue. I see no good reason for creating ZimFileReader and setting it to the current reader. It was introduced very long ago do you think it is still a good idea?

@kelson42
Copy link
Collaborator

kelson42 commented Jan 21, 2025

@MohitMaliFtechiz Your remark seems legit to me at a first look.

@MohitMaliFtechiz
Copy link
Collaborator Author

@kelson42 Thanks for your feedback. I am refactoring the code to avoid creating the ZimFileReader while opening notes on the note screen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants