android: OTA fallback using the browser

Co-Authored-By: Frans de Jonge <fransdejonge@gmail.com>
This commit is contained in:
Martín Fernández
2020-01-04 20:59:52 +01:00
parent 419b42cf2c
commit 51ed411ee4
2 changed files with 12 additions and 5 deletions

View File

@@ -261,11 +261,18 @@ function OTAManager:fetchAndProcessUpdate()
ok_callback = function()
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."), BD.filename(ota_package)))
-- try to download the package
local ok = android.download(link, 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
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
elseif Device:isSDL() then
Device:openLink(link)