From d158ccb2eb7c829bfafd331d073dfef11bff90b5 Mon Sep 17 00:00:00 2001 From: boatbomber Date: Wed, 4 Jan 2023 18:59:53 -0500 Subject: [PATCH] Simplify popup handling --- plugin/src/App/init.lua | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/plugin/src/App/init.lua b/plugin/src/App/init.lua index 846dcf90..3d4c0c16 100644 --- a/plugin/src/App/init.lua +++ b/plugin/src/App/init.lua @@ -213,10 +213,7 @@ function App:requestPermission(source: string, name: string, apis: {string}, ini self:setState(function(state) state.popups[source] = { - responseEvent = responseEvent, - initialState = initialState, name = name, - apis = apis, content = e(PermissionPopup, { responseEvent = responseEvent, initialState = initialState, @@ -226,6 +223,10 @@ function App:requestPermission(source: string, name: string, apis: {string}, ini apiDescriptions = self.headlessAPI._apiDescriptions, transparency = Roact.createBinding(0), }), + onClose = function() + responseEvent:Fire(initialState) + responseEvent:Destroy() + end, } return state end) @@ -418,15 +419,7 @@ function App:render() zIndexBehavior = Enum.ZIndexBehavior.Sibling, - onClose = function() - popup.responseEvent:Fire(popup.initialState) - popup.responseEvent:Destroy() - - self:setState(function(state) - state.popups[id] = nil - return state - end) - end, + onClose = popup.onClose, }, { Content = popup.content,