|
|
|
@ -141,34 +141,34 @@ function OTAManager:getOTAMenuTable()
|
|
|
|
|
callback = function()
|
|
|
|
|
if NetworkMgr:getWifiStatus() == false then
|
|
|
|
|
NetworkMgr:promptWifiOn()
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
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()
|
|
|
|
|
UIManager:show(InfoMessage:new{
|
|
|
|
|
text = _("Downloading may take several minutes..."),
|
|
|
|
|
timeout = 3,
|
|
|
|
|
})
|
|
|
|
|
UIManager:scheduleIn(1, function()
|
|
|
|
|
if OTAManager:zsync() == 0 then
|
|
|
|
|
UIManager:show(InfoMessage:new{
|
|
|
|
|
text = _("Koreader will be updated on next restart."),
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
})
|
|
|
|
|
else
|
|
|
|
|
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()
|
|
|
|
|
UIManager:show(InfoMessage:new{
|
|
|
|
|
text = _("Downloading may take several minutes..."),
|
|
|
|
|
timeout = 3,
|
|
|
|
|
})
|
|
|
|
|
UIManager:scheduleIn(1, function()
|
|
|
|
|
if OTAManager:zsync() == 0 then
|
|
|
|
|
UIManager:show(InfoMessage:new{
|
|
|
|
|
text = _("Koreader will be updated on next restart."),
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
},
|
|
|
|
|