feat(lua): add app navigation history

Make sys.launch push the current path and argument, sys.replace switch without pushing, and sys.back restore the previous route. The status-bar chevron uses the same back action, failed child apps return to their caller, and history is capped at eight routes. Remove the redundant Settings back card.
This commit is contained in:
2026-08-02 13:30:12 -04:00
parent 01dfc4b458
commit 0ca1fd9842
11 changed files with 147 additions and 75 deletions
+5 -4
View File
@@ -26,8 +26,8 @@ local device = {
freeHeap = 200000,
totalHeap = 320000,
connected = nil, -- last wifi.connect()
exited = false,
launched = nil, -- last sys.launch(), {path, arg}
backed = false,
launched = nil, -- last sys.launch()/replace(), {path, arg, replace}
saveFails = false, -- make every persisting call report failure
}
@@ -62,7 +62,7 @@ function device.install()
sys = {
getMillis = function() return device.now end,
exit = function() device.exited = true end,
back = function() device.backed = true end,
getAppName = function() return device.appName end,
setAppName = function(name) device.appName = name end,
getMemory = function() return device.freeHeap, device.totalHeap end,
@@ -71,7 +71,8 @@ function device.install()
assert(ms == 0 or on_tick, "setTickInterval without on_tick")
device.tickInterval = ms
end,
launch = function(path, arg) device.launched = {path = path, arg = arg} end,
launch = function(path, arg) device.launched = {path = path, arg = arg, replace = false} end,
replace = function(path, arg) device.launched = {path = path, arg = arg, replace = true} end,
}
settings = {