android: OTA fallback using the browser

Co-Authored-By: Frans de Jonge <fransdejonge@gmail.com>
reviewable/pr5743/r1
Martín Fernández 4 years ago
parent 419b42cf2c
commit 51ed411ee4

@ -261,11 +261,18 @@ function OTAManager:fetchAndProcessUpdate()
ok_callback = function() ok_callback = function()
local isAndroid, android = pcall(require, "android") local isAndroid, android = pcall(require, "android")
if isAndroid then if isAndroid then
-- download the package if not present. -- try to download the package
if android.download(link, ota_package) then local ok = android.download(link, ota_package)
android.notification(T(_("The file %1 already exists."), BD.filename(ota_package))) if ok == 1 then
android.notification(T(_("The file %1 already exists."), ota_package))
elseif ok == 0 then
android.notification(T(_("Downloading %1"), ota_package))
else else
android.notification(T(_("Downloading %1"), BD.filename(ota_package))) UIManager:show(ConfirmBox:new{
text = _("Your device seems to be unable to download packages.\nRetry using the browser?"),
ok_text = _("Retry"),
ok_callback = function() Device:openLink(link) end,
})
end end
elseif Device:isSDL() then elseif Device:isSDL() then
Device:openLink(link) Device:openLink(link)

@ -1 +1 @@
Subproject commit e06b1089daeca0e663690cc0aa75ecbbdfb4f22e Subproject commit 37ad1e4aca9e8e2a97b36ad4796b8c897da75cbc
Loading…
Cancel
Save