This commit is contained in:
lx
2026-07-06 14:01:11 -04:00
commit c4f97d729d
16468 changed files with 935321 additions and 0 deletions
@@ -0,0 +1,69 @@
local Modules = game:GetService("CoreGui").RobloxGui.Modules
local ShellModules = Modules:FindFirstChild("Shell")
local MakeSafeAsyncRodux = require(ShellModules:FindFirstChild("SafeAsyncRodux"))
local PlayersService = game:GetService("Players")
local FetchUserThumbnail = require(ShellModules.Actions.FetchUserThumbnail)
local SetUserThumbnail = require(ShellModules.Actions.SetUserThumbnail)
local ContentProvider = game:GetService("ContentProvider")
local TEMPLATE_DECAL = Instance.new("Decal")
local function preloadThumbnailAsync(assetId)
TEMPLATE_DECAL.Texture = assetId
ContentProvider:PreloadAsync({ TEMPLATE_DECAL })
end
local GetUserThumbnailAsync = function(store, rbxuid, thumbnailType, thumbnailSize, retryTime)
MakeSafeAsyncRodux({
asyncFunc = function(store, rbxuid, thumbnailType, thumbnailSize)
local imageUrl = nil
local isFinal = nil
local success = pcall(function()
imageUrl, isFinal = PlayersService:GetUserThumbnailAsync(rbxuid, thumbnailType, thumbnailSize)
end)
if success and isFinal and imageUrl then
preloadThumbnailAsync(imageUrl)
else
imageUrl = nil
end
return {
success = success,
rbxuid = rbxuid,
thumbnailType = thumbnailType,
thumbnailSize = thumbnailSize,
imageUrl = imageUrl,
isFinal = isFinal,
timestamp = tick()
}
end,
callback = function(store, result)
store:dispatch(SetUserThumbnail(result))
end,
retries = retryTime,
retryFunc = function(store, result)
return not (result.success and result.isFinal)
end,
userRelated = true
})(store, rbxuid, thumbnailType, thumbnailSize)
end
return function(rbxuid, thumbnailType, thumbnailSize, retryTime, forceUpdate)
return function(store)
local state = store:getState()
local userThumbnailsState = state.UserThumbnails
local thumbnailId = table.concat{ rbxuid, thumbnailType.Name, thumbnailSize.Name }
local thumbnailData = userThumbnailsState[thumbnailId]
--TODO: may use lastUpdated timestamp to determine whether to refetch
if thumbnailData then
if thumbnailData.isFetching then
return
end
if thumbnailData.imageUrl and not forceUpdate then
return
end
end
store:dispatch(FetchUserThumbnail({ rbxuid = rbxuid, thumbnailType = thumbnailType, thumbnailSize = thumbnailSize }))
spawn(function()
GetUserThumbnailAsync(store, rbxuid, thumbnailType, thumbnailSize, retryTime)
end)
end
end
@@ -0,0 +1,70 @@
local Modules = game:GetService("CoreGui").RobloxGui.Modules
local ShellModules = Modules:FindFirstChild("Shell")
local Http = require(ShellModules:FindFirstChild("Http"))
local MakeSafeAsyncRodux = require(ShellModules:FindFirstChild('SafeAsyncRodux'))
local RequestCrossPlayEnabled = require(ShellModules.Actions.RequestCrossPlayEnabled)
local SetCrossPlayEnabled = require(ShellModules.Actions.SetCrossPlayEnabled)
local GetCrossPlayEnabledFailed = require(ShellModules.Actions.GetCrossPlayEnabledFailed)
local PostCrossPlayEnabledFailed = require(ShellModules.Actions.PostCrossPlayEnabledFailed)
local AddError = require(ShellModules.Actions.AddError)
local Errors = require(ShellModules:FindFirstChild('Errors'))
local GetCrossplayEnabledStatusAsync = MakeSafeAsyncRodux({
asyncFunc = function(store)
local jsonobject = Http.GetCrossplayEnabledStatusAsync()
if jsonobject ~= nil then
return jsonobject.isEnabled
end
end,
callback = function(store, enabled)
if enabled ~= nil then
store:dispatch(SetCrossPlayEnabled(enabled, tick()))
else
store:dispatch(GetCrossPlayEnabledFailed())
store:dispatch(AddError(Errors.CPPSettingError.SetCPPSettingError, tick()))
end
end,
userRelated = true
})
local PostCrossplayEnabledStatusAsync = MakeSafeAsyncRodux({
asyncFunc = function(store, val)
if Http.PostCrossplayStatusAsync(val) then
return val
end
end,
callback = function(store, enabled)
if enabled ~= nil then
store:dispatch(SetCrossPlayEnabled(enabled, tick()))
else
store:dispatch(PostCrossPlayEnabledFailed())
end
end,
userRelated = true
})
return function(method)
return function(store)
local state = store:getState()
local crossPlayEnabledState = state.CrossPlayEnabledState
local isRequesting = crossPlayEnabledState.isRequesting
if method == "GET" then
if not isRequesting then
store:dispatch(RequestCrossPlayEnabled())
spawn(function()
GetCrossplayEnabledStatusAsync(store)
end)
end
elseif method == "POST" then
local crossPlayEnabled = crossPlayEnabledState.enabled
if not isRequesting and crossPlayEnabled ~= nil then
store:dispatch(RequestCrossPlayEnabled())
local targetVal = not crossPlayEnabled
spawn(function()
PostCrossplayEnabledStatusAsync(store, targetVal)
end)
end
end
end
end
@@ -0,0 +1,56 @@
local Modules = game:GetService("CoreGui").RobloxGui.Modules
local ShellModules = Modules:FindFirstChild("Shell")
local MakeSafeAsyncRodux = require(ShellModules:FindFirstChild('SafeAsyncRodux'))
local PlatformService = nil
pcall(function() PlatformService = game:GetService('PlatformService') end)
local FetchPrivilegeSettings = require(ShellModules.Actions.FetchPrivilegeSettings)
local SetPrivilegeSettings = require(ShellModules.Actions.SetPrivilegeSettings)
local Privileges =
{
USER_CREATED_CONTENT = 247,
MULTIPLAYER_SESSIONS = 254
}
local GetPrivilegeSettingsAsync = MakeSafeAsyncRodux({
asyncFunc = function(store)
local newPrivilegeSettings = {}
local success = pcall(function()
local multiplayerSettings = PlatformService:BeginCheckXboxPrivilege(Privileges.MULTIPLAYER_SESSIONS)
local sharedContentSettings = PlatformService:BeginCheckXboxPrivilege(Privileges.USER_CREATED_CONTENT)
newPrivilegeSettings.Multiplayer =
{
hasPrivilege = multiplayerSettings.CanJoinGame,
status = multiplayerSettings.PrivilegeCheckResult,
}
newPrivilegeSettings.SharedContent =
{
hasPrivilege = sharedContentSettings.CanJoinGame,
status = sharedContentSettings.PrivilegeCheckResult,
}
end)
if not success then
newPrivilegeSettings.Multiplayer = { hasPrivilege = false, status = "Error"}
newPrivilegeSettings.SharedContent = { hasPrivilege = false, status = "Error"}
end
newPrivilegeSettings.timestamp = tick()
return newPrivilegeSettings
end,
callback = function(store, newPrivilegeSettings)
store:dispatch(SetPrivilegeSettings(newPrivilegeSettings))
end,
userRelated = true
})
return function()
return function(store)
--Note: we don't check isRequesting state for privilege settings update,
--as we always want to fetch the latest privilege settings
store:dispatch(FetchPrivilegeSettings())
spawn(function()
GetPrivilegeSettingsAsync(store)
end)
end
end