mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-22 13:21:38 +00:00
Genericize popup state
This commit is contained in:
parent
7c1afd5aa9
commit
de33cf0e55
1 changed files with 8 additions and 8 deletions
|
|
@ -67,7 +67,7 @@ function App:init()
|
||||||
guiEnabled = false,
|
guiEnabled = false,
|
||||||
notifications = {},
|
notifications = {},
|
||||||
toolbarIcon = Assets.Images.PluginButton,
|
toolbarIcon = Assets.Images.PluginButton,
|
||||||
permissionPopups = {},
|
popups = {},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -212,7 +212,7 @@ function App:requestPermission(source: string, name: string, apis: {string}, ini
|
||||||
local responseEvent = Instance.new("BindableEvent")
|
local responseEvent = Instance.new("BindableEvent")
|
||||||
|
|
||||||
self:setState(function(state)
|
self:setState(function(state)
|
||||||
state.permissionPopups[source] = {
|
state.popups[source] = {
|
||||||
responseEvent = responseEvent,
|
responseEvent = responseEvent,
|
||||||
initialState = initialState,
|
initialState = initialState,
|
||||||
name = name,
|
name = name,
|
||||||
|
|
@ -234,7 +234,7 @@ function App:requestPermission(source: string, name: string, apis: {string}, ini
|
||||||
responseEvent:Destroy()
|
responseEvent:Destroy()
|
||||||
|
|
||||||
self:setState(function(state)
|
self:setState(function(state)
|
||||||
state.permissionPopups[source] = nil
|
state.popups[source] = nil
|
||||||
return state
|
return state
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
@ -403,9 +403,9 @@ function App:render()
|
||||||
return e(Page, props)
|
return e(Page, props)
|
||||||
end
|
end
|
||||||
|
|
||||||
local permissionPopups = {}
|
local popups = {}
|
||||||
for id, popup in self.state.permissionPopups do
|
for id, popup in self.state.popups do
|
||||||
permissionPopups["Rojo_"..id] = e(StudioPluginGui, {
|
popups["Rojo_"..id] = e(StudioPluginGui, {
|
||||||
id = id,
|
id = id,
|
||||||
title = popup.name .. " Permissions",
|
title = popup.name .. " Permissions",
|
||||||
active = true,
|
active = true,
|
||||||
|
|
@ -423,7 +423,7 @@ function App:render()
|
||||||
popup.responseEvent:Destroy()
|
popup.responseEvent:Destroy()
|
||||||
|
|
||||||
self:setState(function(state)
|
self:setState(function(state)
|
||||||
state[id] = nil
|
state.popups[id] = nil
|
||||||
return state
|
return state
|
||||||
end)
|
end)
|
||||||
end,
|
end,
|
||||||
|
|
@ -446,7 +446,7 @@ function App:render()
|
||||||
}, {
|
}, {
|
||||||
e(Theme.StudioProvider, nil, {
|
e(Theme.StudioProvider, nil, {
|
||||||
e(Tooltip.Provider, nil, {
|
e(Tooltip.Provider, nil, {
|
||||||
permissionPopups = Roact.createFragment(permissionPopups),
|
popups = Roact.createFragment(popups),
|
||||||
|
|
||||||
gui = e(StudioPluginGui, {
|
gui = e(StudioPluginGui, {
|
||||||
id = pluginName,
|
id = pluginName,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue