mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
add 'Check update' menu and OTA update functionality
This commit is contained in:
@@ -2,8 +2,10 @@ local InputContainer = require("ui/widget/container/inputcontainer")
|
||||
local CenterContainer = require("ui/widget/container/centercontainer")
|
||||
local InfoMessage = require("ui/widget/infomessage")
|
||||
local InputDialog = require("ui/widget/inputdialog")
|
||||
local ConfirmBox = require("ui/widget/confirmbox")
|
||||
local TouchMenu = require("ui/widget/touchmenu")
|
||||
local GestureRange = require("ui/gesturerange")
|
||||
local OTAManager = require("ui/otamanager")
|
||||
local UIManager = require("ui/uimanager")
|
||||
local Device = require("ui/device")
|
||||
local Geom = require("ui/geometry")
|
||||
@@ -136,6 +138,26 @@ function ReaderMenu:setUpdateItemTable()
|
||||
table.insert(self.tab_item_table.setting, Language:getLangMenuTable())
|
||||
|
||||
-- info tab
|
||||
table.insert(self.tab_item_table.info, {
|
||||
text = _("Check update"),
|
||||
callback = function()
|
||||
local ota_version = OTAManager:checkUpdate()
|
||||
if ota_version == 0 then
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = _("Your koreader is updated."),
|
||||
})
|
||||
elseif ota_version == nil then
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = _("OTA server is not available."),
|
||||
})
|
||||
elseif ota_version then
|
||||
UIManager:show(ConfirmBox:new{
|
||||
text = _("Do you want to update to version ")..ota_version.."?",
|
||||
ok_callback = function() OTAManager:zsync() end
|
||||
})
|
||||
end
|
||||
end
|
||||
})
|
||||
table.insert(self.tab_item_table.info, {
|
||||
text = _("Version"),
|
||||
callback = function()
|
||||
|
||||
Reference in New Issue
Block a user