Merge pull request #3763 from kiwix/Fix#3762

Fixed: Opening ZIM file from history that does not exist in fileSystem leads to execpected UI behavior (When already a ZIM file opened in the reader).
This commit is contained in:
Kelson 2024-03-22 03:27:39 +01:00 committed by GitHub
commit c439e304b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -113,6 +113,12 @@ class KiwixReaderFragment : CoreReaderFragment() {
) )
if (filePath == null || !File(filePath).isFileExist()) { if (filePath == null || !File(filePath).isFileExist()) {
// Close the previously opened book in the reader. Since this file is not found,
// it will not be set in the zimFileReader. The previously opened ZIM file
// will be saved when we move between fragments. If we return to the reader again,
// it will attempt to open the last opened ZIM file with the last loaded URL,
// which is inside the non-existing ZIM file. This leads to unexpected behavior.
exitBook()
activity.toast(R.string.error_file_not_found) activity.toast(R.string.error_file_not_found)
return return
} }