From ea8f62dea63d6e2779674e1240ecb4c41889dd56 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Fri, 14 Jun 2024 17:38:45 -0400 Subject: [PATCH] #497 exit app if it is unloaded --- pocket/pocket.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pocket/pocket.lua b/pocket/pocket.lua index f32ef1a..0afc068 100644 --- a/pocket/pocket.lua +++ b/pocket/pocket.lua @@ -275,17 +275,23 @@ function pocket.init_nav(render_queue) -- unload api-dependent apps function nav.unload_api() - for _, app in pairs(self.apps) do + for id, app in pairs(self.apps) do local _, api = app.check_requires() - if app.loaded and api then app.unload() end + if app.loaded and api then + if id == self.cur_app then nav.open_app(APP_ID.ROOT) end + app.unload() + end end end -- unload supervisor-dependent apps function nav.unload_sv() - for _, app in pairs(self.apps) do + for id, app in pairs(self.apps) do local sv, _ = app.check_requires() - if app.loaded and sv then app.unload() end + if app.loaded and sv then + if id == self.cur_app then nav.open_app(APP_ID.ROOT) end + app.unload() + end end end