reworked pocket app loader
This commit is contained in:
parent
170cba702c
commit
9bb3f59496
@ -36,7 +36,8 @@ iocontrol.LINK_STATE = LINK_STATE
|
||||
---@class pocket_ioctl
|
||||
local io = {
|
||||
version = "unknown", -- pocket version
|
||||
ps = psil.create() -- pocket PSIL
|
||||
ps = psil.create(), -- pocket PSIL
|
||||
loader_require = { sv = false, api = false }
|
||||
}
|
||||
|
||||
local config = nil ---@type pkt_config
|
||||
|
||||
@ -278,7 +278,14 @@ function pocket.init_nav(smem)
|
||||
|
||||
local app = self.apps[app_id]
|
||||
if app then
|
||||
if app.requires_conn() and not smem.pkt_sys.pocket_comms.is_linked() then
|
||||
local p_comms = smem.pkt_sys.pocket_comms
|
||||
local req_sv, req_api = app.check_requires()
|
||||
|
||||
if (req_sv and not p_comms.is_sv_linked()) or (req_api and not p_comms.is_api_linked()) then
|
||||
-- report required connction(s)
|
||||
iocontrol.get_db().loader_require = { sv = req_sv, api = req_api }
|
||||
iocontrol.get_db().ps.toggle("loader_reqs")
|
||||
|
||||
-- bring up the app loader
|
||||
self.loader_return = app_id
|
||||
app_id = APP_ID.LOADER
|
||||
|
||||
@ -32,16 +32,29 @@ local function create_pages(root)
|
||||
|
||||
local root_pane = MultiPane{parent=main,x=1,y=1,panes={conn_sv_wait,conn_api_wait,main_pane}}
|
||||
|
||||
root_pane.register(db.ps, "link_state", function (state)
|
||||
if state == LINK_STATE.UNLINKED or state == LINK_STATE.API_LINK_ONLY then
|
||||
local function update()
|
||||
local state = db.ps.get("link_state")
|
||||
|
||||
if state == LINK_STATE.UNLINKED then
|
||||
root_pane.set_value(1)
|
||||
elseif state == LINK_STATE.API_LINK_ONLY then
|
||||
if not db.loader_require.sv then
|
||||
root_pane.set_value(3)
|
||||
db.nav.on_loader_connected()
|
||||
else root_pane.set_value(1) end
|
||||
elseif state == LINK_STATE.SV_LINK_ONLY then
|
||||
root_pane.set_value(2)
|
||||
if not db.loader_require.api then
|
||||
root_pane.set_value(3)
|
||||
db.nav.on_loader_connected()
|
||||
else root_pane.set_value(2) end
|
||||
else
|
||||
root_pane.set_value(3)
|
||||
db.nav.on_loader_connected()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
root_pane.register(db.ps, "link_state", update)
|
||||
root_pane.register(db.ps, "loader_reqs", update)
|
||||
|
||||
TextBox{parent=main_pane,text="Connected!",x=1,y=6,alignment=core.ALIGN.CENTER}
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user