mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
android: avoid downloading the APK again if there's one download in progress + fix signature error (#7657)
This commit is contained in:
@@ -85,6 +85,7 @@ local Device = Generic:new{
|
||||
isHapticFeedbackEnabled = yes,
|
||||
hasClipboard = yes,
|
||||
hasOTAUpdates = android.ota.isEnabled,
|
||||
hasOTARunning = function() return android.ota.isRunning end,
|
||||
hasFastWifiStatusQuery = yes,
|
||||
hasSystemFonts = yes,
|
||||
canOpenLink = yes,
|
||||
@@ -216,6 +217,7 @@ function Device:init()
|
||||
local Event = require("ui/event")
|
||||
UIManager:broadcastEvent(Event:new("NotCharging"))
|
||||
elseif ev.code == C.AEVENT_DOWNLOAD_COMPLETE then
|
||||
android.ota.isRunning = false
|
||||
if android.isResumed() then
|
||||
self:install()
|
||||
else
|
||||
|
||||
@@ -103,6 +103,9 @@ local Device = {
|
||||
-- set to yes on devices that support over-the-air incremental updates.
|
||||
hasOTAUpdates = no,
|
||||
|
||||
-- For devices that have non-blocking OTA updates, this function will return true if the download is currently running.
|
||||
hasOTARunning = no,
|
||||
|
||||
-- set to yes on devices that have a non-blocking isWifiOn implementation
|
||||
-- (c.f., https://github.com/koreader/koreader/pull/5211#issuecomment-521304139)
|
||||
hasFastWifiStatusQuery = no,
|
||||
|
||||
@@ -208,6 +208,13 @@ function OTAManager:checkUpdate()
|
||||
end
|
||||
|
||||
function OTAManager:fetchAndProcessUpdate()
|
||||
if Device:hasOTARunning() then
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = _("Download already scheduled. You'll be notified when it's ready."),
|
||||
})
|
||||
return
|
||||
end
|
||||
|
||||
local ota_version, local_version, link, ota_package = OTAManager:checkUpdate()
|
||||
|
||||
if ota_version == 0 then
|
||||
@@ -247,6 +254,7 @@ function OTAManager:fetchAndProcessUpdate()
|
||||
if ok == C.ADOWNLOAD_EXISTS then
|
||||
Device:install()
|
||||
elseif ok == C.ADOWNLOAD_OK then
|
||||
android.ota.isRunning = true
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = wait_for_download,
|
||||
timeout = 3,
|
||||
|
||||
Submodule platform/android/luajit-launcher updated: 77ce2b7e63...76f10d206a
Reference in New Issue
Block a user