Add Address and ProjectName when connected

This commit is contained in:
boatbomber 2022-09-25 17:10:30 -04:00
parent 4832035a18
commit be89259bbd
2 changed files with 10 additions and 0 deletions

View file

@ -268,6 +268,10 @@ function App:startSession(host: string?, port: string?)
serveSession:onStatusChanged(function(status, details)
self.headlessAPI.Connected = status == ServeSession.Status.Connected
if not self.headlessAPI.Connected then
self.headlessAPI.Address = nil
self.headlessAPI.ProjectName = nil
end
if status == ServeSession.Status.Connecting then
self:setPriorEndpoint(host, port)
@ -279,6 +283,10 @@ function App:startSession(host: string?, port: string?)
self:addNotification("Connecting to session...")
elseif status == ServeSession.Status.Connected then
local address = string.format("%s:%s", host :: string, port :: string)
self.headlessAPI.Address = address
self.headlessAPI.ProjectName = details
self:setState({
appStatus = AppStatus.Connected,
projectName = details,

View file

@ -4,6 +4,8 @@ function API.new(app, config, settings)
local Rojo = {}
Rojo.Connected = if app.serveSession then app.serveSession:getStatus() == "Connected" else false
Rojo.Address = nil
Rojo.ProjectName = nil
Rojo.Version = table.clone(config.version)
Rojo.ProtocolVersion = config.protocolVersion