From 51ed411ee4576d7d8c004a9938faca6eece48e37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fern=C3=A1ndez?= Date: Sat, 4 Jan 2020 20:59:52 +0100 Subject: [PATCH] android: OTA fallback using the browser Co-Authored-By: Frans de Jonge --- frontend/ui/otamanager.lua | 15 +++++++++++---- platform/android/luajit-launcher | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/frontend/ui/otamanager.lua b/frontend/ui/otamanager.lua index ff51241c2..79d70a5e9 100644 --- a/frontend/ui/otamanager.lua +++ b/frontend/ui/otamanager.lua @@ -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) diff --git a/platform/android/luajit-launcher b/platform/android/luajit-launcher index e06b1089d..37ad1e4ac 160000 --- a/platform/android/luajit-launcher +++ b/platform/android/luajit-launcher @@ -1 +1 @@ -Subproject commit e06b1089daeca0e663690cc0aa75ecbbdfb4f22e +Subproject commit 37ad1e4aca9e8e2a97b36ad4796b8c897da75cbc