add gs
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(user)
|
||||
return {
|
||||
user = user,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,14 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(id, participants, title, lastUpdated)
|
||||
return {
|
||||
conversationId = id,
|
||||
participants = participants,
|
||||
title = title,
|
||||
lastUpdated = lastUpdated,
|
||||
}
|
||||
end)
|
||||
+1075
File diff suppressed because it is too large
Load Diff
+9
@@ -0,0 +1,9 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function()
|
||||
return {}
|
||||
end)
|
||||
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(alert)
|
||||
return {
|
||||
alert = alert,
|
||||
}
|
||||
end)
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function()
|
||||
return {}
|
||||
end)
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(placeIds)
|
||||
return {
|
||||
placeIds = placeIds,
|
||||
}
|
||||
end)
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(imageToken)
|
||||
return {
|
||||
imageToken = imageToken,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,19 @@
|
||||
local LuaChat = script.Parent.Parent
|
||||
local WebApi = require(LuaChat.WebApi)
|
||||
local SetChatEnabled = require(LuaChat.Actions.SetChatEnabled)
|
||||
|
||||
return function(onSuccess)
|
||||
return function(store)
|
||||
spawn(function()
|
||||
local status, response = WebApi.GetChatSettings()
|
||||
if status ~= WebApi.Status.OK then
|
||||
warn("Failure in WebApi.GetChatSettings", status)
|
||||
return
|
||||
end
|
||||
store:dispatch(SetChatEnabled(response.chatEnabled))
|
||||
if onSuccess then
|
||||
onSuccess(response.chatEnabled)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,24 @@
|
||||
local LuaChat = script.Parent.Parent
|
||||
local WebApi = require(LuaChat.WebApi)
|
||||
local FetchChatSettingsStarted = require(LuaChat.Actions.FetchChatSettingsStarted)
|
||||
local FetchChatSettingsCompleted = require(LuaChat.Actions.FetchChatSettingsCompleted)
|
||||
local FetchChatSettingsFailed = require(LuaChat.Actions.FetchChatSettingsFailed)
|
||||
|
||||
return function(onSuccess)
|
||||
return function(store)
|
||||
store:dispatch(FetchChatSettingsStarted())
|
||||
|
||||
spawn(function()
|
||||
local status, response = WebApi.GetChatSettings()
|
||||
if status ~= WebApi.Status.OK then
|
||||
store:dispatch(FetchChatSettingsFailed(status))
|
||||
warn("Failure in WebApi.GetChatSettings", status)
|
||||
return
|
||||
end
|
||||
store:dispatch(FetchChatSettingsCompleted(response))
|
||||
if onSuccess then
|
||||
onSuccess(response)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(settings)
|
||||
return {
|
||||
settings = settings,
|
||||
}
|
||||
end)
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(status)
|
||||
return {
|
||||
status = status,
|
||||
}
|
||||
end)
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function()
|
||||
return {}
|
||||
end)
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function()
|
||||
return {}
|
||||
end)
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(isFetchedOldestConversation)
|
||||
return {
|
||||
value = isFetchedOldestConversation,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,12 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(conversationId, isFetchedOldestMessage)
|
||||
return {
|
||||
conversationId = conversationId,
|
||||
fetchedOldestMessage = isFetchedOldestMessage,
|
||||
}
|
||||
end)
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function()
|
||||
return {}
|
||||
end)
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(conversationId, isFetchingOlderMessages)
|
||||
return {
|
||||
conversationId = conversationId,
|
||||
fetchingOlderMessages = isFetchingOlderMessages,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,13 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
local RetrievalStatus = require(Modules.LuaApp.Enum.RetrievalStatus)
|
||||
|
||||
return Action(script.Name, function(userId)
|
||||
return {
|
||||
userId = userId,
|
||||
status = RetrievalStatus.Fetching,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(conversationId)
|
||||
return {
|
||||
conversationId = conversationId,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(conversationId)
|
||||
return {
|
||||
conversationId = conversationId,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,18 @@
|
||||
local Modules = script.Parent.Parent
|
||||
|
||||
local WebApi = require(Modules.WebApi)
|
||||
|
||||
local SetFriendCount = require(Modules.Actions.SetFriendCount)
|
||||
|
||||
return function()
|
||||
return function(store)
|
||||
spawn(function()
|
||||
local status, totalCount = WebApi.GetFriendCount()
|
||||
if status ~= WebApi.Status.OK then
|
||||
store:dispatch(SetFriendCount(0)) -- Remember to come back and add status instead of setting to zero
|
||||
else
|
||||
store:dispatch(SetFriendCount(totalCount))
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local LuaChat = Modules.LuaChat
|
||||
|
||||
local WebApi = require(LuaChat.WebApi)
|
||||
local PlaceInfoModel = require(LuaChat.Models.PlaceInfoModel)
|
||||
|
||||
local RequestMultiplePlaceInfos = require(LuaChat.Actions.RequestMultiplePlaceInfos)
|
||||
local FailedToFetchMultiplePlaceInfos = require(LuaChat.Actions.FailedToFetchMultiplePlaceInfos)
|
||||
local ReceivedMultiplePlaceInfos = require(LuaChat.Actions.ReceivedMultiplePlaceInfos)
|
||||
|
||||
return function(placeIdList)
|
||||
return function(store)
|
||||
local state = store:getState()
|
||||
local placesToFetch = {}
|
||||
|
||||
if state.ChatAppReducer.PlaceInfos then
|
||||
for _, placeId in pairs(placeIdList) do
|
||||
if not state.ChatAppReducer.PlaceInfosAsync[placeId] then
|
||||
table.insert(placesToFetch, placeId)
|
||||
end
|
||||
end
|
||||
if #placesToFetch == 0 then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
store:dispatch(RequestMultiplePlaceInfos(placesToFetch))
|
||||
|
||||
spawn(function()
|
||||
local status, result = WebApi.GetMultiplePlaceInfos(placesToFetch)
|
||||
|
||||
if status ~= WebApi.Status.OK then
|
||||
warn("WebApi failure in GetMultiplePlaceInfos")
|
||||
store:dispatch(FailedToFetchMultiplePlaceInfos(placesToFetch))
|
||||
return
|
||||
end
|
||||
|
||||
local placeInfos = {}
|
||||
for _, placeInfoData in pairs(result) do
|
||||
table.insert(placeInfos, PlaceInfoModel.fromWeb(placeInfoData))
|
||||
end
|
||||
store:dispatch(ReceivedMultiplePlaceInfos(placeInfos))
|
||||
end)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,52 @@
|
||||
local Modules = script.Parent.Parent
|
||||
|
||||
local WebApi = require(Modules.WebApi)
|
||||
local ThumbnailModel = require(Modules.Models.ThumbnailModel)
|
||||
|
||||
local RequestPlaceThumbnail = require(Modules.Actions.RequestPlaceThumbnail)
|
||||
local ReceivedPlaceThumbnail = require(Modules.Actions.ReceivedPlaceThumbnail)
|
||||
local FailedToFetchPlaceThumbnail = require(Modules.Actions.FailedToFetchPlaceThumbnail)
|
||||
|
||||
local RETRY_COUNT = 3
|
||||
local WAIT_TIME = 2
|
||||
|
||||
return function(imageToken, width, height)
|
||||
return function(store)
|
||||
local state = store:getState()
|
||||
if state.ChatAppReducer.PlaceThumbnailsAsync[imageToken] then
|
||||
return
|
||||
end
|
||||
store:dispatch(RequestPlaceThumbnail(imageToken))
|
||||
|
||||
spawn(function()
|
||||
local thumbnail = ''
|
||||
local retryCount = RETRY_COUNT
|
||||
local waitTime = WAIT_TIME
|
||||
|
||||
while (retryCount > 0) do
|
||||
local status, result = WebApi.GetPlaceThumbnail(imageToken, width, height)
|
||||
if status ~= WebApi.Status.OK then
|
||||
warn("WebApi failure in GetPlaceThumbnail")
|
||||
store:dispatch(FailedToFetchPlaceThumbnail(imageToken))
|
||||
break
|
||||
else
|
||||
local placeThumbnailData = result[1]
|
||||
if placeThumbnailData.final == true then
|
||||
thumbnail = placeThumbnailData.url
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
retryCount = retryCount - 1
|
||||
if retryCount > 0 then
|
||||
wait(waitTime)
|
||||
waitTime = waitTime * 2
|
||||
end
|
||||
end
|
||||
|
||||
local thumbnailModel = ThumbnailModel.fromWeb(thumbnail)
|
||||
store:dispatch(ReceivedPlaceThumbnail(imageToken, thumbnailModel))
|
||||
|
||||
end)
|
||||
end
|
||||
end
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function()
|
||||
return {}
|
||||
end)
|
||||
@@ -0,0 +1,12 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(conversationId, messageId)
|
||||
return {
|
||||
conversationId = conversationId,
|
||||
messageId = messageId,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,12 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(conversationId, messageId)
|
||||
return {
|
||||
conversationId = conversationId,
|
||||
messageId = messageId,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(conversationId)
|
||||
return {
|
||||
conversationId = conversationId,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(conversationId)
|
||||
return {
|
||||
conversationId = conversationId,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,185 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local LuaChat = Modules.LuaChat
|
||||
local Actions = LuaChat.Actions
|
||||
|
||||
local Constants = require(LuaChat.Constants)
|
||||
local PlaceInfoModel = require(LuaChat.Models.PlaceInfoModel)
|
||||
local ToastModel = require(LuaChat.Models.ToastModel)
|
||||
local WebApi = require(LuaChat.WebApi)
|
||||
|
||||
local FailedToFetchedMostRecentlyPlayedGames = require(Actions.FailedToFetchMostRecentlyPlayedGames)
|
||||
local FailedToFetchMultiplePlaceInfos = require(Actions.FailedToFetchMultiplePlaceInfos)
|
||||
local FetchedMostRecentlyPlayedGames = require(Actions.FetchedMostRecentlyPlayedGames)
|
||||
local FetchingMostRecentlyPlayedGames = require(Actions.FetchingMostRecentlyPlayedGames)
|
||||
local GameFailedToPin = require(Actions.GameFailedToPin)
|
||||
local GameFailedToUnpin = require(Actions.GameFailedToUnpin)
|
||||
local PinnedGame = require(Actions.PinnedGame)
|
||||
local PinningGame = require(Actions.PinningGame)
|
||||
local ReceivedMultiplePlaceInfos = require(Actions.ReceivedMultiplePlaceInfos)
|
||||
local RequestMultiplePlaceInfos = require(Actions.RequestMultiplePlaceInfos)
|
||||
local SetMostRecentlyPlayedGamesForUser = require(Actions.SetMostRecentlyPlayedGamesForUser)
|
||||
local SetMostRecentlyPlayedPlayableGameForUser = require(Actions.SetMostRecentlyPlayedPlayableGameForUser)
|
||||
local SetPinnedGameForConversation = require(Actions.SetPinnedGameForConversation)
|
||||
local ShowToast = require(Actions.ShowToast)
|
||||
local UnpinnedGame = require(Actions.UnpinnedGame)
|
||||
local UnpinningGame = require(Actions.UnpinningGame)
|
||||
|
||||
local PlayTogetherActions = {}
|
||||
|
||||
local HOME_GAMES_SORTS = "HomeSorts"
|
||||
local MOST_RECENTLY_PLAYED_GAMES = "MyRecent"
|
||||
|
||||
function PlayTogetherActions.PinGame(conversationId, universeId)
|
||||
return function(store)
|
||||
if universeId == store:getState().ChatAppReducer.Conversations[conversationId].pinnedGame.universeId then
|
||||
local messageKey = "Feature.Chat.Message.AlreadyPinnedGame"
|
||||
local toastModel = ToastModel.new(Constants.ToastIDs.PIN_PINNED_GAME, messageKey)
|
||||
store:dispatch(ShowToast(toastModel))
|
||||
return
|
||||
end
|
||||
|
||||
if store:getState().ChatAppReducer.PlayTogetherAsync.pinningGames[conversationId] then
|
||||
return
|
||||
end
|
||||
|
||||
store:dispatch(PinningGame(conversationId))
|
||||
|
||||
spawn(function()
|
||||
local status, _ = WebApi.PinGame(conversationId, universeId)
|
||||
if status == WebApi.Status.OK then
|
||||
store:dispatch(PinnedGame(conversationId))
|
||||
else
|
||||
store:dispatch(GameFailedToPin(conversationId))
|
||||
|
||||
local messageKey = "Feature.Chat.Message.PinFailed"
|
||||
local toastModel = ToastModel.new(Constants.ToastIDs.PIN_GAME_FAILED, messageKey)
|
||||
store:dispatch(ShowToast(toastModel))
|
||||
|
||||
warn("Game could not be pinned.")
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function PlayTogetherActions.UnpinGame(conversationId)
|
||||
return function(store)
|
||||
if store:getState().ChatAppReducer.PlayTogetherAsync.unPinningGames[conversationId] then
|
||||
return
|
||||
end
|
||||
|
||||
store:dispatch(UnpinningGame(conversationId))
|
||||
|
||||
spawn(function()
|
||||
local status, _ = WebApi.UnpinGame(conversationId)
|
||||
if status == WebApi.Status.OK then
|
||||
store:dispatch(UnpinnedGame(conversationId))
|
||||
else
|
||||
store:dispatch(GameFailedToUnpin(conversationId))
|
||||
|
||||
local messageKey = "Feature.Chat.Message.UnpinFailed"
|
||||
local toastModel = ToastModel.new(Constants.ToastIDs.UNPIN_GAME_FAILED, messageKey)
|
||||
store:dispatch(ShowToast(toastModel))
|
||||
|
||||
warn("Game could not be unpinned.")
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function PlayTogetherActions.SetPinnedGameForConversation(universeId, rootPlaceId, conversationId)
|
||||
return function(store)
|
||||
spawn(function()
|
||||
store:dispatch(SetPinnedGameForConversation(
|
||||
universeId,
|
||||
rootPlaceId,
|
||||
conversationId
|
||||
))
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function PlayTogetherActions.GetMostRecentlyPlayedGames()
|
||||
return function(store)
|
||||
spawn(function()
|
||||
if store:getState().ChatAppReducer.PlayTogetherAsync.fetchingMostRecentlyPlayedGames then
|
||||
return
|
||||
end
|
||||
|
||||
store:dispatch(FetchingMostRecentlyPlayedGames())
|
||||
|
||||
local gameSorts = WebApi.GetGamesSorts(HOME_GAMES_SORTS)
|
||||
if not gameSorts then
|
||||
warn("Failed to get game sorts")
|
||||
store:dispatch(FailedToFetchedMostRecentlyPlayedGames())
|
||||
return
|
||||
end
|
||||
|
||||
for _, sort in pairs(gameSorts) do
|
||||
if sort.name == MOST_RECENTLY_PLAYED_GAMES then
|
||||
local games = WebApi.GetMostRecentlyPlayedGames(sort.token)
|
||||
if games then
|
||||
store:dispatch(FetchedMostRecentlyPlayedGames())
|
||||
store:dispatch(SetMostRecentlyPlayedGamesForUser(games))
|
||||
else
|
||||
warn("No most recently played games found")
|
||||
store:dispatch(FailedToFetchedMostRecentlyPlayedGames())
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
warn("No most recently played game sort")
|
||||
store:dispatch(FailedToFetchedMostRecentlyPlayedGames())
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function PlayTogetherActions.GetMostRecentlyPlayedPlayableGame()
|
||||
return function(store)
|
||||
local mostRecentlyPlayedGames = store:getState().ChatAppReducer.MostRecentlyPlayedGames.games
|
||||
if not mostRecentlyPlayedGames or #mostRecentlyPlayedGames == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
spawn(function()
|
||||
local mostRecentlyPlayedPlayableGamePlaceId = nil
|
||||
for _, game in pairs(mostRecentlyPlayedGames) do
|
||||
local placeId = tostring(game.placeId)
|
||||
local placeInfo = store:getState().ChatAppReducer.PlaceInfos[placeId]
|
||||
|
||||
if (placeInfo == nil) and (not store:getState().ChatAppReducer.PlaceInfosAsync[placeId]) then
|
||||
local placeIds = { placeId }
|
||||
store:dispatch(RequestMultiplePlaceInfos(placeIds))
|
||||
|
||||
local status, result = WebApi.GetMultiplePlaceInfos(placeIds)
|
||||
|
||||
if status ~= WebApi.Status.OK then
|
||||
warn("WebApi failure in GetMostRecentlyPlayedPlayableGame")
|
||||
store:dispatch(FailedToFetchMultiplePlaceInfos(placeIds))
|
||||
else
|
||||
local placeInfos = {}
|
||||
for _, placeInfoData in pairs(result) do
|
||||
table.insert(placeInfos, PlaceInfoModel.fromWeb(placeInfoData))
|
||||
end
|
||||
store:dispatch(ReceivedMultiplePlaceInfos(placeInfos))
|
||||
end
|
||||
break
|
||||
end
|
||||
|
||||
if placeInfo and placeInfo.isPlayable then
|
||||
mostRecentlyPlayedPlayableGamePlaceId = placeId
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if mostRecentlyPlayedPlayableGamePlaceId then
|
||||
store:dispatch(SetMostRecentlyPlayedPlayableGameForUser(mostRecentlyPlayedPlayableGamePlaceId))
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
return PlayTogetherActions
|
||||
@@ -0,0 +1,9 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function()
|
||||
return {}
|
||||
end)
|
||||
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(conversationId)
|
||||
return {
|
||||
conversationId = conversationId,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,7 @@
|
||||
local Modules = game:GetService("CoreGui").RobloxGui.Modules
|
||||
|
||||
local Action = require(Modules.Common.Action)
|
||||
|
||||
return Action(script.Name, function()
|
||||
return {}
|
||||
end)
|
||||
@@ -0,0 +1,9 @@
|
||||
-----------------------------------------------------------------------------
|
||||
--- ---
|
||||
--- Under Migration to CorePackages ---
|
||||
--- ---
|
||||
--- Please put your changes in AppTempCommon. ---
|
||||
--- NOTE: You will have to rebuild for changes to kick in ---
|
||||
-----------------------------------------------------------------------------
|
||||
local CorePackages = game:GetService("CorePackages")
|
||||
return require(CorePackages.AppTempCommon.LuaChat.Actions.ReceivedConversation)
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
local Modules = game:GetService("CoreGui").RobloxGui.Modules
|
||||
|
||||
local Action = require(Modules.Common.Action)
|
||||
|
||||
return Action(script.Name, function()
|
||||
return {}
|
||||
end)
|
||||
@@ -0,0 +1,15 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(conversationId, messages, shouldMarkConversationUnread, messageId)
|
||||
return {
|
||||
conversationId = conversationId,
|
||||
messages = messages,
|
||||
shouldMarkConversationUnread = shouldMarkConversationUnread,
|
||||
exclusiveStartMessageId = messageId,
|
||||
}
|
||||
end
|
||||
)
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
-----------------------------------------------------------------------------
|
||||
--- ---
|
||||
--- Under Migration to CorePackages ---
|
||||
--- ---
|
||||
--- Please put your changes in AppTempCommon. ---
|
||||
--- NOTE: You will have to rebuild for changes to kick in ---
|
||||
-----------------------------------------------------------------------------
|
||||
local CorePackages = game:GetService("CorePackages")
|
||||
return require(CorePackages.AppTempCommon.LuaChat.Actions.ReceivedMultiplePlaceInfos)
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
local Modules = game:GetService("CoreGui").RobloxGui.Modules
|
||||
|
||||
local Action = require(Modules.Common.Action)
|
||||
|
||||
return Action(script.Name, function(value)
|
||||
return {
|
||||
value = value,
|
||||
}
|
||||
end)
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
local Modules = game:GetService("CoreGui").RobloxGui.Modules
|
||||
|
||||
local Action = require(Modules.Common.Action)
|
||||
|
||||
return Action(script.Name, function()
|
||||
return {}
|
||||
end)
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(imageToken, thumbnail)
|
||||
return {
|
||||
imageToken = imageToken,
|
||||
thumbnail = thumbnail,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,9 @@
|
||||
-----------------------------------------------------------------------------
|
||||
--- ---
|
||||
--- Under Migration to CorePackages ---
|
||||
--- ---
|
||||
--- Please put your changes in AppTempCommon. ---
|
||||
--- NOTE: You will have to rebuild for changes to kick in ---
|
||||
-----------------------------------------------------------------------------
|
||||
local CorePackages = game:GetService("CorePackages")
|
||||
return require(CorePackages.AppTempCommon.LuaChat.Actions.ReceivedUserPresence)
|
||||
@@ -0,0 +1,24 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local LuaChat = Modules.LuaChat
|
||||
local SetUserTyping = require(LuaChat.Actions.SetUserTyping)
|
||||
|
||||
local typingCount = 0
|
||||
|
||||
return function(conversationId, userId)
|
||||
return function(store)
|
||||
spawn(function()
|
||||
typingCount = typingCount + 1
|
||||
local thisTypingCount = typingCount
|
||||
|
||||
store:dispatch(SetUserTyping(conversationId, userId, true))
|
||||
|
||||
wait(5)
|
||||
|
||||
if typingCount == thisTypingCount then
|
||||
store:dispatch(SetUserTyping(conversationId, userId, false))
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(intent)
|
||||
return {
|
||||
intent = intent,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(conversationId)
|
||||
return {
|
||||
conversationId = conversationId,
|
||||
}
|
||||
end)
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(conversationId, title, isDefaultTitle, lastUpdated)
|
||||
return {
|
||||
conversationId = conversationId,
|
||||
title = title,
|
||||
isDefaultTitle = isDefaultTitle,
|
||||
lastUpdated = lastUpdated,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,7 @@
|
||||
local Modules = game:GetService("CoreGui").RobloxGui.Modules
|
||||
|
||||
local Action = require(Modules.Common.Action)
|
||||
|
||||
return Action(script.Name, function()
|
||||
return {}
|
||||
end)
|
||||
@@ -0,0 +1,7 @@
|
||||
local Modules = game:GetService("CoreGui").RobloxGui.Modules
|
||||
|
||||
local Action = require(Modules.Common.Action)
|
||||
|
||||
return Action(script.Name, function()
|
||||
return {}
|
||||
end)
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(placeIds)
|
||||
return {
|
||||
placeIds = placeIds,
|
||||
}
|
||||
end)
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
local Modules = game:GetService("CoreGui").RobloxGui.Modules
|
||||
|
||||
local Action = require(Modules.Common.Action)
|
||||
|
||||
return Action(script.Name, function()
|
||||
return {}
|
||||
end)
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(imageToken)
|
||||
return {
|
||||
imageToken = imageToken,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,9 @@
|
||||
local Modules = game:GetService("CoreGui").RobloxGui.Modules
|
||||
|
||||
local Action = require(Modules.Common.Action)
|
||||
|
||||
return Action(script.Name, function(userId)
|
||||
return {
|
||||
userId = userId
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,12 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(conversationId, message)
|
||||
return {
|
||||
conversationId = conversationId,
|
||||
message = message
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,12 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(conversationId, messageId)
|
||||
return {
|
||||
conversationId = conversationId,
|
||||
messageId = messageId
|
||||
}
|
||||
end)
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(conversationId)
|
||||
return {
|
||||
conversationId = conversationId,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(isLoaded)
|
||||
return {
|
||||
value = isLoaded,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(isEnabled)
|
||||
return {
|
||||
value = isEnabled,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(connectionState)
|
||||
return {
|
||||
connectionState = connectionState;
|
||||
}
|
||||
end)
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(convoId, conversationLoadingState)
|
||||
return {
|
||||
conversationId = convoId,
|
||||
value = conversationLoadingState
|
||||
}
|
||||
end)
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(isFetchingConversations)
|
||||
return {
|
||||
value = isFetchingConversations,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(formFactor)
|
||||
return {
|
||||
formFactor = formFactor,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(count)
|
||||
return {
|
||||
count = count,
|
||||
}
|
||||
end)
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(games)
|
||||
return {
|
||||
games = games,
|
||||
}
|
||||
end)
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(placeId)
|
||||
return {
|
||||
placeId = placeId,
|
||||
}
|
||||
end)
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(universeId, rootPlaceId, conversationId)
|
||||
return {
|
||||
universeId = universeId,
|
||||
rootPlaceId = rootPlaceId,
|
||||
conversationId = conversationId,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,13 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(intent, parameters, popToIntent)
|
||||
return {
|
||||
intent = intent,
|
||||
parameters = parameters or {},
|
||||
popToIntent = popToIntent,
|
||||
}
|
||||
end)
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(unreadConversationCount)
|
||||
return {
|
||||
count = unreadConversationCount,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,12 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(userId, isFriend)
|
||||
return {
|
||||
isFriend = isFriend,
|
||||
userId = userId,
|
||||
}
|
||||
end)
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(conversationId, isLeaving)
|
||||
return {
|
||||
id = conversationId,
|
||||
isLeaving = isLeaving,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,14 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(conversationId, userId, isUserTyping)
|
||||
return {
|
||||
conversationId = conversationId,
|
||||
userId = userId,
|
||||
value = isUserTyping,
|
||||
}
|
||||
end)
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(gameSortName, placeIds)
|
||||
return {
|
||||
name = gameSortName,
|
||||
placeIds = placeIds or {},
|
||||
}
|
||||
end)
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(games)
|
||||
return {
|
||||
games = games,
|
||||
}
|
||||
end)
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function()
|
||||
return {}
|
||||
end)
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(gameSortName)
|
||||
return {
|
||||
gameSortName = gameSortName,
|
||||
}
|
||||
end)
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function()
|
||||
return {}
|
||||
end)
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(gameSortName)
|
||||
return {
|
||||
gameSortName = gameSortName,
|
||||
}
|
||||
end)
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(gameSortName)
|
||||
return {
|
||||
gameSortName = gameSortName,
|
||||
}
|
||||
end)
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function()
|
||||
return {}
|
||||
end)
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function()
|
||||
return {}
|
||||
end)
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
local Modules = game:GetService("CoreGui").RobloxGui.Modules
|
||||
local LuaApp = Modules.LuaApp
|
||||
local LuaChat = Modules.LuaChat
|
||||
local ShareGameToChatActions = LuaChat.Actions.ShareGameToChatFromChat
|
||||
|
||||
local AddGamesBySort = require(ShareGameToChatActions.AddGamesBySortShareGameToChatFromChat)
|
||||
local AddGamesInformation = require(ShareGameToChatActions.AddGamesInformationShareGameToChatFromChat)
|
||||
local Constants = require(LuaChat.Constants)
|
||||
local ClearAllGamesInSorts = require(ShareGameToChatActions.ClearAllGamesInSortsShareGameToChatFromChat)
|
||||
local FailedToFetchGamesBySort = require(ShareGameToChatActions.FailedToFetchGamesBySortShareGameToChatFromChat)
|
||||
local FailedToShareGameToChat = require(ShareGameToChatActions.FailedToShareGameToChatFromChat)
|
||||
local FetchedGamesBySort = require(ShareGameToChatActions.FetchedGamesBySortShareGameToChatFromChat)
|
||||
local FetchingGamesBySort = require(ShareGameToChatActions.FetchingGamesBySortShareGameToChatFromChat)
|
||||
local PopRoute = require(LuaChat.Actions.PopRoute)
|
||||
local ResetShareGame = require(ShareGameToChatActions.ResetShareGameToChatFromChat)
|
||||
local ResetShareGameToChatAsync = require(ShareGameToChatActions.ResetShareGameToChatFromChatAsync)
|
||||
local SharedGameToChat = require(ShareGameToChatActions.SharedGameToChatFromChat)
|
||||
local SharingGameToChat = require(ShareGameToChatActions.SharingGameToChatFromChat)
|
||||
local ShowToast = require(LuaChat.Actions.ShowToast)
|
||||
local ToastModel = require(LuaChat.Models.ToastModel)
|
||||
local SetGameThumbnails = require(LuaApp.Actions.SetGameThumbnails)
|
||||
local UpdateGameSortsTokens = require(ShareGameToChatActions.UpdateGameSortsTokensShareGameToChatFromChat)
|
||||
local WebApi = require(LuaChat.WebApi)
|
||||
|
||||
local SHARED_GAMES_SORT = "GamesAllSorts"
|
||||
|
||||
local ShareGameToChatFromChatThunks = {}
|
||||
|
||||
function ShareGameToChatFromChatThunks.FetchGames(gameSortName, fetchedThumbnailSize)
|
||||
return function(store)
|
||||
spawn(function()
|
||||
if store:getState().ChatAppReducer.ShareGameToChatAsync.fetchingGamesBySort[gameSortName] then
|
||||
return
|
||||
end
|
||||
|
||||
store:dispatch(FetchingGamesBySort(gameSortName))
|
||||
|
||||
if not store:getState().ChatAppReducer.SharedGameSorts[gameSortName]
|
||||
or not store:getState().ChatAppReducer.SharedGameSorts[gameSortName].tokenExpiry
|
||||
or store:getState().ChatAppReducer.SharedGameSorts[gameSortName].tokenExpiry < tick() then
|
||||
local gameSorts = WebApi.GetGamesSorts(SHARED_GAMES_SORT)
|
||||
if not gameSorts then
|
||||
store:dispatch(FailedToFetchGamesBySort(gameSortName))
|
||||
warn("Failed to get game sorts")
|
||||
return
|
||||
end
|
||||
|
||||
store:dispatch(UpdateGameSortsTokens(gameSorts))
|
||||
end
|
||||
|
||||
local gamesList = nil
|
||||
if store:getState().ChatAppReducer.SharedGameSorts[gameSortName] and
|
||||
store:getState().ChatAppReducer.SharedGameSorts[gameSortName].token then
|
||||
gamesList = WebApi.GetGamesInSortByToken(store:getState().ChatAppReducer.SharedGameSorts[gameSortName].token)
|
||||
end
|
||||
|
||||
if gamesList then
|
||||
local placeIds = {}
|
||||
local newPlaceIds = {}
|
||||
local games = {}
|
||||
|
||||
for _, game in pairs(gamesList) do
|
||||
table.insert(placeIds, game.placeId)
|
||||
if not store:getState().ChatAppReducer.SharedGamesInfo[game.placeId] then
|
||||
games[game.placeId] = game
|
||||
end
|
||||
|
||||
if not store:getState().ChatAppReducer.SharedGamesInfo[game.placeId] or
|
||||
not store:getState().ChatAppReducer.SharedGamesInfo[game.placeId].url then
|
||||
table.insert(newPlaceIds, game.placeId)
|
||||
end
|
||||
end
|
||||
|
||||
if #newPlaceIds > 0 then
|
||||
local _, placesInfo = WebApi.GetMultiplePlaceInfos(newPlaceIds)
|
||||
local imageTokens = {}
|
||||
for _, placeInfo in pairs(placesInfo) do
|
||||
games[placeInfo.placeId].url = placeInfo.url
|
||||
games[placeInfo.placeId].isPlayable = placeInfo.isPlayable
|
||||
table.insert(imageTokens, placeInfo.imageToken)
|
||||
end
|
||||
|
||||
store:dispatch(AddGamesInformation(games))
|
||||
|
||||
local thumbnails = WebApi.GetPlacesThumbnails(imageTokens, fetchedThumbnailSize, fetchedThumbnailSize)
|
||||
store:dispatch(SetGameThumbnails(thumbnails))
|
||||
end
|
||||
|
||||
store:dispatch(FetchedGamesBySort(gameSortName))
|
||||
store:dispatch(AddGamesBySort(gameSortName, placeIds))
|
||||
else
|
||||
store:dispatch(AddGamesBySort(gameSortName, nil))
|
||||
store:dispatch(FailedToFetchGamesBySort(gameSortName))
|
||||
warn("No " .. gameSortName .. " games found")
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function ShareGameToChatFromChatThunks.HasGameFetchRequestCompleted(sortName, shareGameToChatAsync)
|
||||
return shareGameToChatAsync.fetchedGamesBySort[sortName] or
|
||||
shareGameToChatAsync.failedToFetchGamesBySort[sortName]
|
||||
end
|
||||
|
||||
function ShareGameToChatFromChatThunks.Sharing(store)
|
||||
store:dispatch(SharingGameToChat())
|
||||
end
|
||||
|
||||
function ShareGameToChatFromChatThunks.Shared(store)
|
||||
store:dispatch(PopRoute())
|
||||
store:dispatch(SharedGameToChat())
|
||||
|
||||
store:dispatch(ResetShareGame())
|
||||
store:dispatch(ClearAllGamesInSorts())
|
||||
store:dispatch(ResetShareGameToChatAsync())
|
||||
end
|
||||
|
||||
function ShareGameToChatFromChatThunks.FailedToShare(store)
|
||||
local messageKey = "Feature.Chat.ShareGameToChat.FailedToShareTheGame"
|
||||
local toastModel = ToastModel.new(Constants.ToastIDs.GAME_NOT_SHAREABLE, messageKey)
|
||||
|
||||
store:dispatch(ShowToast(toastModel))
|
||||
store:dispatch(FailedToShareGameToChat())
|
||||
end
|
||||
|
||||
return ShareGameToChatFromChatThunks
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function()
|
||||
return {}
|
||||
end)
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function()
|
||||
return {}
|
||||
end)
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(gameSorts)
|
||||
return {
|
||||
gameSorts = gameSorts,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(alert)
|
||||
return {
|
||||
alert = alert,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(toast)
|
||||
return {
|
||||
toast = toast,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(toast)
|
||||
return {
|
||||
toast = toast,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(isPaused)
|
||||
return {
|
||||
value = isPaused,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(conversationId)
|
||||
return {
|
||||
conversationId = conversationId,
|
||||
}
|
||||
end)
|
||||
@@ -0,0 +1,11 @@
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local Modules = CoreGui.RobloxGui.Modules
|
||||
local Common = Modules.Common
|
||||
local Action = require(Common.Action)
|
||||
|
||||
return Action(script.Name, function(conversationId)
|
||||
return {
|
||||
conversationId = conversationId,
|
||||
}
|
||||
end)
|
||||
Reference in New Issue
Block a user