mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[UX] Offer to restart KOReader after update (#5150)
Adding the option to restart KOReader after update. Close: #5144
This commit is contained in:
@@ -46,6 +46,33 @@ local ota_channels = {
|
||||
nightly = _("Development"),
|
||||
}
|
||||
|
||||
local function showRestartMessage()
|
||||
UIManager:show(ConfirmBox:new{
|
||||
text = _("KOReader will be updated on next restart.\nWould you like to restart now?"),
|
||||
ok_text = _("Restart"),
|
||||
ok_callback = function()
|
||||
local savequit_caller
|
||||
local save_quit = function()
|
||||
Device:saveSettings()
|
||||
UIManager:quit()
|
||||
UIManager._exit_code = 85
|
||||
end
|
||||
|
||||
local FileManager = require("apps/filemanager/filemanager")
|
||||
if FileManager.instance then
|
||||
savequit_caller = FileManager.instance.menu
|
||||
end
|
||||
|
||||
local ReaderUI = require("apps/reader/readerui")
|
||||
local readerui_instance = ReaderUI:_getRunningInstance()
|
||||
if readerui_instance then
|
||||
savequit_caller = readerui_instance.menu
|
||||
end
|
||||
savequit_caller:exitOrRestart(save_quit)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- Try to detect WARIO+ Kindle boards (i.MX6 & i.MX7)
|
||||
function OTAManager:_isKindleWarioOrMore()
|
||||
local cpu_hw = nil
|
||||
@@ -251,9 +278,7 @@ function OTAManager:fetchAndProcessUpdate()
|
||||
})
|
||||
UIManager:scheduleIn(1, function()
|
||||
if OTAManager:zsync() == 0 then
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = _("KOReader will be updated on next restart."),
|
||||
})
|
||||
showRestartMessage()
|
||||
-- Make it clear that zsync is done
|
||||
if self.can_pretty_print then
|
||||
os.execute("./fbink -q -y -7 -pm ' ' ' '")
|
||||
@@ -277,9 +302,7 @@ function OTAManager:fetchAndProcessUpdate()
|
||||
-- And then relaunch zsync in full download mode...
|
||||
UIManager:scheduleIn(1, function()
|
||||
if OTAManager:zsync(true) == 0 then
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = _("KOReader will be updated on next restart."),
|
||||
})
|
||||
showRestartMessage()
|
||||
-- Make it clear that zsync is done
|
||||
if self.can_pretty_print then
|
||||
os.execute("./fbink -q -y -7 -pm ' ' ' '")
|
||||
|
||||
Reference in New Issue
Block a user