mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[Android] (re)enable update downloads using full apks (#4639)
This commit is contained in:
committed by
Frans de Jonge
parent
76028513ea
commit
0532d7a507
@@ -21,7 +21,7 @@ local Device = Generic:new{
|
||||
display_dpi = android.lib.AConfiguration_getDensity(android.app.config),
|
||||
hasClipboard = yes,
|
||||
hasColorScreen = yes,
|
||||
hasOTAUpdates = no,
|
||||
hasOTAUpdates = yes,
|
||||
}
|
||||
|
||||
function Device:init()
|
||||
|
||||
@@ -192,14 +192,14 @@ function OTAManager:checkUpdate()
|
||||
-- larger than the local package version
|
||||
if local_ok and ota_ok and ota_version and local_version and
|
||||
ota_version ~= local_version then
|
||||
return ota_version, local_version, link
|
||||
return ota_version, local_version, link, ota_package
|
||||
elseif ota_version and ota_version == local_version then
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
function OTAManager:fetchAndProcessUpdate()
|
||||
local ota_version, local_version, link = OTAManager:checkUpdate()
|
||||
local ota_version, local_version, link, ota_package = OTAManager:checkUpdate()
|
||||
|
||||
if ota_version == 0 then
|
||||
UIManager:show(InfoMessage:new{
|
||||
@@ -220,7 +220,15 @@ function OTAManager:fetchAndProcessUpdate()
|
||||
),
|
||||
ok_text = _("Update"),
|
||||
ok_callback = function()
|
||||
if Device:isSDL() then
|
||||
local isAndroid, android = pcall(require, "android")
|
||||
if isAndroid then
|
||||
-- download the package if not present.
|
||||
if android.download(link, ota_package) then
|
||||
android.notification(T(_("The file %1 already exists."), ota_package))
|
||||
else
|
||||
android.notification(T(_("Downloading %1"), ota_package))
|
||||
end
|
||||
elseif Device:isSDL() then
|
||||
os.execute("xdg-open '"..link.."'")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user