ReaderUI: fix status and history (#9993)

This commit is contained in:
hius07
2023-01-07 08:09:16 +02:00
committed by GitHub
parent 5c1305719a
commit d5a4ac14e1

View File

@@ -455,6 +455,19 @@ function ReaderUI:init()
-- Book information).
self.doc_settings:saveSetting("doc_props", self.document:getProps())
-- Set "reading" status if there is no status.
local summary = self.doc_settings:readSetting("summary")
if not (summary and summary.status) then
if not summary then
summary = {}
end
summary.status = "reading"
summary.modified = os.date("%Y-%m-%d", os.time())
self.doc_settings:saveSetting("summary", summary)
end
require("readhistory"):addItem(self.document.file) -- (will update "lastfile")
-- After initialisation notify that document is loaded and rendered
-- CREngine only reports correct page count after rendering is done
-- Need the same event for PDF document
@@ -626,7 +639,6 @@ function ReaderUI:doShowReader(file, provider)
end
end
end
require("readhistory"):addItem(file) -- (will update "lastfile")
local reader = ReaderUI:new{
dimen = Screen:getSize(),
covers_fullscreen = true, -- hint for UIManager:_repaint()
@@ -794,10 +806,6 @@ function ReaderUI:dealWithLoadDocumentFailure()
-- We can't do much more than crash properly here (still better than
-- going on and segfaulting when calling other methods on unitiliazed
-- _document)
-- We must still remove it from lastfile and history (as it has
-- already been added there) so that koreader don't crash again
-- at next launch...
require("readhistory"):removeItemByPath(self.document.file) -- (will update "lastfile")
-- As we are in a coroutine, we can pause and show an InfoMessage before exiting
local _coroutine = coroutine.running()
if coroutine then