mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-25 07:06:12 +00:00
Make sync reminder more detailed (#987)
This commit is contained in:
@@ -29,6 +29,7 @@
|
|||||||
* Added experimental setting for Auto Connect in playtests ([#840])
|
* Added experimental setting for Auto Connect in playtests ([#840])
|
||||||
* Improved settings UI ([#886])
|
* Improved settings UI ([#886])
|
||||||
* `Open Scripts Externally` option can now be changed while syncing ([#911])
|
* `Open Scripts Externally` option can now be changed while syncing ([#911])
|
||||||
|
* The sync reminder notification will now tell you what was last synced and when ([#987])
|
||||||
* Projects may now specify rules for syncing files as if they had a different file extension. ([#813])
|
* Projects may now specify rules for syncing files as if they had a different file extension. ([#813])
|
||||||
This is specified via a new field on project files, `syncRules`:
|
This is specified via a new field on project files, `syncRules`:
|
||||||
|
|
||||||
@@ -87,6 +88,7 @@
|
|||||||
[#911]: https://github.com/rojo-rbx/rojo/pull/911
|
[#911]: https://github.com/rojo-rbx/rojo/pull/911
|
||||||
[#915]: https://github.com/rojo-rbx/rojo/pull/915
|
[#915]: https://github.com/rojo-rbx/rojo/pull/915
|
||||||
[#974]: https://github.com/rojo-rbx/rojo/pull/974
|
[#974]: https://github.com/rojo-rbx/rojo/pull/974
|
||||||
|
[#987]: https://github.com/rojo-rbx/rojo/pull/987
|
||||||
|
|
||||||
## [7.4.3] - August 6th, 2024
|
## [7.4.3] - August 6th, 2024
|
||||||
* Fixed issue with building binary files introduced in 7.4.2
|
* Fixed issue with building binary files introduced in 7.4.2
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ local App = Roact.Component:extend("App")
|
|||||||
function App:init()
|
function App:init()
|
||||||
preloadAssets()
|
preloadAssets()
|
||||||
|
|
||||||
local priorHost, priorPort = self:getPriorEndpoint()
|
local priorSyncInfo = self:getPriorSyncInfo()
|
||||||
self.host, self.setHost = Roact.createBinding(priorHost or "")
|
self.host, self.setHost = Roact.createBinding(priorSyncInfo.host or "")
|
||||||
self.port, self.setPort = Roact.createBinding(priorPort or "")
|
self.port, self.setPort = Roact.createBinding(priorSyncInfo.port or "")
|
||||||
|
|
||||||
self.confirmationBindable = Instance.new("BindableEvent")
|
self.confirmationBindable = Instance.new("BindableEvent")
|
||||||
self.confirmationEvent = self.confirmationBindable.Event
|
self.confirmationEvent = self.confirmationBindable.Event
|
||||||
@@ -145,28 +145,38 @@ function App:init()
|
|||||||
if
|
if
|
||||||
Settings:get("syncReminder")
|
Settings:get("syncReminder")
|
||||||
and self.serveSession == nil
|
and self.serveSession == nil
|
||||||
and self:getLastSyncTimestamp()
|
and self:getPriorSyncInfo().timestamp ~= nil
|
||||||
and (self:isSyncLockAvailable())
|
and (self:isSyncLockAvailable())
|
||||||
then
|
then
|
||||||
self:addNotification("You've previously synced this place. Would you like to reconnect?", 300, {
|
local syncInfo = self:getPriorSyncInfo()
|
||||||
Connect = {
|
local timeSinceSync = timeUtil.elapsedToText(os.time() - syncInfo.timestamp)
|
||||||
text = "Connect",
|
local syncDetail = if syncInfo.projectName
|
||||||
style = "Solid",
|
then `project '{syncInfo.projectName}'`
|
||||||
layoutOrder = 1,
|
else `{syncInfo.host or Config.defaultHost}:{syncInfo.port or Config.defaultPort}`
|
||||||
onClick = function(notification)
|
|
||||||
notification:dismiss()
|
self:addNotification(
|
||||||
self:startSession()
|
`You synced {syncDetail} to this place {timeSinceSync}. Would you like to reconnect?`,
|
||||||
end,
|
300,
|
||||||
},
|
{
|
||||||
Dismiss = {
|
Connect = {
|
||||||
text = "Dismiss",
|
text = "Connect",
|
||||||
style = "Bordered",
|
style = "Solid",
|
||||||
layoutOrder = 2,
|
layoutOrder = 1,
|
||||||
onClick = function(notification)
|
onClick = function(notification)
|
||||||
notification:dismiss()
|
notification:dismiss()
|
||||||
end,
|
self:startSession()
|
||||||
},
|
end,
|
||||||
})
|
},
|
||||||
|
Dismiss = {
|
||||||
|
text = "Dismiss",
|
||||||
|
style = "Bordered",
|
||||||
|
layoutOrder = 2,
|
||||||
|
onClick = function(notification)
|
||||||
|
notification:dismiss()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -274,54 +284,32 @@ function App:checkForUpdates()
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function App:getPriorEndpoint()
|
function App:getPriorSyncInfo(): { host: string?, port: string?, projectName: string?, timestamp: number? }
|
||||||
local priorEndpoints = Settings:get("priorEndpoints")
|
local priorSyncInfos = Settings:get("priorEndpoints")
|
||||||
if not priorEndpoints then
|
if not priorSyncInfos then
|
||||||
return
|
return {}
|
||||||
end
|
end
|
||||||
|
|
||||||
local id = tostring(game.PlaceId)
|
local id = tostring(game.PlaceId)
|
||||||
if ignorePlaceIds[id] then
|
if ignorePlaceIds[id] then
|
||||||
return
|
return {}
|
||||||
end
|
end
|
||||||
|
|
||||||
local place = priorEndpoints[id]
|
return priorSyncInfos[id] or {}
|
||||||
if not place then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
return place.host, place.port
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function App:getLastSyncTimestamp()
|
function App:setPriorSyncInfo(host: string, port: string, projectName: string)
|
||||||
local priorEndpoints = Settings:get("priorEndpoints")
|
local priorSyncInfos = Settings:get("priorEndpoints")
|
||||||
if not priorEndpoints then
|
if not priorSyncInfos then
|
||||||
return
|
priorSyncInfos = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
local id = tostring(game.PlaceId)
|
local now = os.time()
|
||||||
if ignorePlaceIds[id] then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local place = priorEndpoints[id]
|
|
||||||
if not place then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
return place.timestamp
|
|
||||||
end
|
|
||||||
|
|
||||||
function App:setPriorEndpoint(host: string, port: string)
|
|
||||||
local priorEndpoints = Settings:get("priorEndpoints")
|
|
||||||
if not priorEndpoints then
|
|
||||||
priorEndpoints = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Clear any stale saves to avoid disc bloat
|
-- Clear any stale saves to avoid disc bloat
|
||||||
for placeId, endpoint in priorEndpoints do
|
for placeId, syncInfo in priorSyncInfos do
|
||||||
if os.time() - endpoint.timestamp > 12_960_000 then
|
if now - (syncInfo.timestamp or now) > 12_960_000 then
|
||||||
priorEndpoints[placeId] = nil
|
priorSyncInfos[placeId] = nil
|
||||||
Log.trace("Cleared stale saved endpoint for {}", placeId)
|
Log.trace("Cleared stale saved endpoint for {}", placeId)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -331,14 +319,15 @@ function App:setPriorEndpoint(host: string, port: string)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
priorEndpoints[id] = {
|
priorSyncInfos[id] = {
|
||||||
host = if host ~= Config.defaultHost then host else nil,
|
host = if host ~= Config.defaultHost then host else nil,
|
||||||
port = if port ~= Config.defaultPort then port else nil,
|
port = if port ~= Config.defaultPort then port else nil,
|
||||||
timestamp = os.time(),
|
projectName = projectName,
|
||||||
|
timestamp = now,
|
||||||
}
|
}
|
||||||
Log.trace("Saved last used endpoint for {}", game.PlaceId)
|
Log.trace("Saved last used endpoint for {}", game.PlaceId)
|
||||||
|
|
||||||
Settings:set("priorEndpoints", priorEndpoints)
|
Settings:set("priorEndpoints", priorSyncInfos)
|
||||||
end
|
end
|
||||||
|
|
||||||
function App:getHostAndPort()
|
function App:getHostAndPort()
|
||||||
@@ -533,8 +522,6 @@ function App:startSession()
|
|||||||
|
|
||||||
serveSession:onStatusChanged(function(status, details)
|
serveSession:onStatusChanged(function(status, details)
|
||||||
if status == ServeSession.Status.Connecting then
|
if status == ServeSession.Status.Connecting then
|
||||||
self:setPriorEndpoint(host, port)
|
|
||||||
|
|
||||||
self:setState({
|
self:setState({
|
||||||
appStatus = AppStatus.Connecting,
|
appStatus = AppStatus.Connecting,
|
||||||
toolbarIcon = Assets.Images.PluginButton,
|
toolbarIcon = Assets.Images.PluginButton,
|
||||||
@@ -542,6 +529,7 @@ function App:startSession()
|
|||||||
self:addNotification("Connecting to session...")
|
self:addNotification("Connecting to session...")
|
||||||
elseif status == ServeSession.Status.Connected then
|
elseif status == ServeSession.Status.Connected then
|
||||||
self.knownProjects[details] = true
|
self.knownProjects[details] = true
|
||||||
|
self:setPriorSyncInfo(host, port, details)
|
||||||
self:setRunningConnectionInfo(baseUrl)
|
self:setRunningConnectionInfo(baseUrl)
|
||||||
|
|
||||||
local address = ("%s:%s"):format(host, port)
|
local address = ("%s:%s"):format(host, port)
|
||||||
|
|||||||
Reference in New Issue
Block a user