mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-23 05:58:26 +02:00
fix(android): bootstrap legacy APK updater
This commit is contained in:
@@ -1320,7 +1320,7 @@ local function buildHeader(imp, m)
|
||||
return y + math.floor(10 * m.s)
|
||||
end
|
||||
|
||||
-- The state of the self-updater, as a top-right control.
|
||||
-- The state of the self-updater, shown in the launcher footer.
|
||||
-- Returns status, label, action, glow.
|
||||
function LauncherView._updateControl(imp)
|
||||
if not imp.Check then return nil end
|
||||
|
||||
+15
-5
@@ -58,6 +58,13 @@ function Check.fullAssetName(version, osName, arch, port)
|
||||
return fullAssetName(version, osName, arch, port)
|
||||
end
|
||||
|
||||
-- A legacy Android APK can run a newer downloaded payload while still lacking
|
||||
-- the native bridge that installs future APK updates. It needs one manual
|
||||
-- package update even when that payload already reports the latest engine.
|
||||
function Check.androidNeedsInstallerBootstrap(osName, hasInstaller)
|
||||
return osName == "Android" and not hasInstaller
|
||||
end
|
||||
|
||||
local CMD = "update_check_cmd"
|
||||
local STATE = "update_check_state"
|
||||
|
||||
@@ -266,12 +273,15 @@ function Check.fullUpdateAction()
|
||||
local st = Check.state()
|
||||
if st.status ~= "needs_full" and st.status ~= "full_ready" then return nil end
|
||||
local osName = love and love.system and love.system.getOS and love.system.getOS() or ""
|
||||
if osName == "Android" and type(love.system.installApk) == "function"
|
||||
and type(st.full) == "table" and type(st.full.url) == "string" then
|
||||
if st.status == "full_ready" and type(st.full.path) == "string" then
|
||||
return { label = "Install Android update", kind = "install" }
|
||||
if osName == "Android" and type(st.full) == "table"
|
||||
and type(st.full.url) == "string" then
|
||||
if type(love.system.installApk) == "function" then
|
||||
if st.status == "full_ready" and type(st.full.path) == "string" then
|
||||
return { label = "Install Android update", kind = "install" }
|
||||
end
|
||||
return { label = "Download Android update", kind = "download" }
|
||||
end
|
||||
return { label = "Download Android update", kind = "download" }
|
||||
return { label = "Update app manually", url = st.full.url }
|
||||
end
|
||||
if osName == "iOS" then
|
||||
return { label = "Re-sideload app", url =
|
||||
|
||||
@@ -243,6 +243,12 @@ local function doCheck(target)
|
||||
return
|
||||
end
|
||||
|
||||
if Check.androidNeedsInstallerBootstrap(osName,
|
||||
type(love.system.installApk) == "function") then
|
||||
postFullRequirement(rel, "native_installer_missing")
|
||||
return
|
||||
end
|
||||
|
||||
if compareVersions(rel.version, currentEngine) <= 0 then
|
||||
-- We are now running a native shell at least as new as GitHub's latest
|
||||
-- release, so a former minShell/payloadHost prompt no longer applies.
|
||||
|
||||
Reference in New Issue
Block a user