FolioReader / FolioReader-Android

A Java ePub reader and parser framework for Android.
BSD 3-Clause "New" or "Revised" License
2.24k stars 710 forks source link

(Need Urgent Help) same epub file with new content is not showing new content, showing only old content #499

Open awaisabbasaa11 opened 3 years ago

awaisabbasaa11 commented 3 years ago

Issue / Feature - Issue FolioReader version -
FolioReader Stock / Modified - stock Android SDK - Mobile / Tablet / Emulator Info - Mobile Crash / Error -

FolioReader app is not loading the updated epub file with same file name, if the two file have a same name folio reader app will always show the content of first file that we opened with the folio reader with this same name, even clearing cache, data, and uninstalling app did not help

Steps to reproduce / Describe in detail -

1) Load xyz.epub file 2) open xyz in the folioReader application 3) change/edit/add content in the xyz.epub file 4) replace new xyz.epub with old file in raw/assets folder 5) run the app and open the xyz.epub file 6) app will show the old content new content will not be available

I notice if you change the file name for example xyz to abc then new content will be available but the highlights will be lost, can somebody help me fix this issue

amkrys commented 2 years ago

try changing file names

ngCarlos commented 2 years ago

Little too late, but hopefully this will help. You need to delete the temporary file created by the library.

fun deleteEpubFile(epubFileName: String): Boolean {
        try {
            File(getFolioEpubPath(epubFileName)).apply {
                return if (this.exists()) this.deleteRecursively() else false
            }
        } catch (iOE: IOException) {
            return false
        } catch (se: SecurityException) {
            return false
        }
    }

private fun getFolioEpubPath(epubFileName: String): String {
        return Environment.getExternalStorageDirectory().absolutePath + "/" + FOLIO_READER_ROOT + "/" + epubFileName
    }