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,63 @@
local CoreGui = game:GetService("CoreGui")
local Modules = CoreGui.RobloxGui.Modules
local LuaChat = Modules.LuaChat
local Components = LuaChat.Components
local BaseScreen = require(LuaChat.Views.Phone.BaseScreen)
local BrowseGamesComponent = require(Components.BrowseGames)
local PopRoute = require(LuaChat.Actions.PopRoute)
local BrowseGames = BaseScreen:Template()
BrowseGames.__index = BrowseGames
function BrowseGames.new(appState, route)
local self = {
appState = appState,
route = route,
connections = {};
}
setmetatable(self, BrowseGames)
self.BrowseGamesComponent = BrowseGamesComponent.new(appState)
self.rbx = self.BrowseGamesComponent.rbx
local backButtonPressedConnection = self.BrowseGamesComponent.BackButtonPressed:connect(function()
self.appState.store:dispatch(PopRoute())
end)
table.insert(self.connections, backButtonPressedConnection)
return self
end
function BrowseGames:Start()
BaseScreen.Start(self)
do
local connection = self.appState.store.changed:connect(function(current, previous)
self:Update(current, previous)
end)
table.insert(self.connections, connection)
end
end
function BrowseGames:Stop()
for _, connection in pairs(self.connections) do
connection:disconnect()
end
self.connections = {}
BaseScreen.Stop(self)
end
function BrowseGames:Destruct()
self.BrowseGamesComponent:Destruct()
self.BrowseGamesComponent = nil
BaseScreen.Destruct(self)
end
function BrowseGames:Update(current, previous)
self.BrowseGamesComponent:Update(current, previous)
end
return BrowseGames
@@ -0,0 +1,73 @@
local Modules = game:GetService("CoreGui").RobloxGui.Modules
local LuaChat = Modules.LuaChat
local Components = LuaChat.Components
local DialogInfo = require(LuaChat.DialogInfo)
local BaseScreen = require(LuaChat.Views.Phone.BaseScreen)
local createChatComponent = require(Components.CreateChat)
local PopRoute = require(LuaChat.Actions.PopRoute)
local SetRoute = require(LuaChat.Actions.SetRoute)
local Intent = DialogInfo.Intent
local CreateChat = BaseScreen:Template()
CreateChat.__index = CreateChat
function CreateChat.new(appState, route)
local self = {
appState = appState,
route = route,
connections = {};
}
setmetatable(self, CreateChat)
self.createChatComponent = createChatComponent.new(appState)
self.rbx = self.createChatComponent.rbx
local backButtonPressedConnection = self.createChatComponent.BackButtonPressed:connect(function()
self.appState.store:dispatch(PopRoute())
end)
table.insert(self.connections, backButtonPressedConnection)
local conversationSavedConnection = self.createChatComponent.ConversationSaved:connect(function(id)
self.appState.store:dispatch(SetRoute(Intent.Conversation, {conversationId = id}, Intent.ConversationHub))
end)
table.insert(self.connections, conversationSavedConnection)
return self
end
function CreateChat:Start()
BaseScreen.Start(self)
do
local connection = self.appState.store.changed:connect(function(current, previous)
self:Update(current, previous)
end)
table.insert(self.connections, connection)
end
end
function CreateChat:Stop()
for _, connection in pairs(self.connections) do
connection:disconnect()
end
self.connections = {}
BaseScreen.Stop(self)
end
function CreateChat:Destruct()
self.createChatComponent:Destruct()
self.createChatComponent = nil
BaseScreen.Destruct(self)
end
function CreateChat:Update(current, previous)
self.createChatComponent:Update(current, previous)
end
return CreateChat
@@ -0,0 +1,223 @@
local TweenService = game:GetService("TweenService")
local Modules = script.Parent.Parent
local BaseScreen = require(Modules.Views.Phone.BaseScreen)
local Create = require(Modules.Create)
local Constants = require(Modules.Constants)
local DialogInfo = require(Modules.DialogInfo)
local DefaultScreenComponent = require(Modules.Components.DefaultScreen)
local DialogFrame = BaseScreen:Template()
DialogFrame.__index = DialogFrame
local LuaChatNewPageSlidingTransition = settings():GetFFlag("LuaChatNewPageSlidingTransition")
--Constants
local RIGHT_SIDE_POS = UDim2.new(1, 0, 0, 0)
local LEFT_SIDE_POS = UDim2.new(LuaChatNewPageSlidingTransition and -0.5 or -1, 0, 0, 0)
local CENTERED_POS = UDim2.new(0, 0, 0, 0)
DialogFrame.TransitionType = {
Start = "Start",
Stop = "Stop",
Resume = "Resume",
Pause = "Pause",
}
function DialogFrame.new(appState, route)
local self = {}
self.appState = appState
self.route = route
setmetatable(self, DialogFrame)
self.rbx = Instance.new("ScreenGui")
self.rbx.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
self.rbx.Name = "ChatScreen"
--Offseting the display order by 2 in hopes of working around
--un-reproducable bug where the AE screenGui isn't being de-parented
self.rbx.DisplayOrder = 3
self.baseFrame = Create.new "Frame" {
Visible = false,
Name = "BaseFrame",
Size = UDim2.new(1, 0, 1, 0),
BackgroundColor3 = Constants.Color.GRAY6,
BorderSizePixel = 0,
Create.new "Frame" {
Name = "LeftHandFrame",
Size = UDim2.new(0.37, 0, 1, 0),
BackgroundTransparency = 1.0,
},
Create.new "Frame" {
Name = "RightHandFrame",
Size = UDim2.new(0.63, 0, 1, 0),
Position = UDim2.new(0.37, 0, 0, 0),
BackgroundTransparency = 1.0,
},
Create.new "Frame" {
Name = "Divider",
BackgroundColor3 = Constants.Color.GRAY1,
BackgroundTransparency = Constants.Color.ALPHA_SHADOW_HOVER,
BorderSizePixel = 0.0,
Size = UDim2.new(0, 1, 1, 0),
Position = UDim2.new(0.37, 0, 0, 0),
},
Create.new "Frame" {
Name = "ModalFrameBase",
Size = UDim2.new(1, 0, 1, 0),
Position = UDim2.new(0, 0, 0, 0),
BackgroundColor3 = Color3.fromRGB(0, 0, 0),
BackgroundTransparency = Constants.Color.ALPHA_SHADOW_PRIMARY,
Visible = false,
Create.new "TextButton" {
Name = "TapBlocker",
Size = UDim2.new(1, 0, 1, 0),
Position = UDim2.new(0, 0, 0, 0),
BackgroundTransparency = 1
},
Create.new "ImageLabel" {
Name = "ModalFrame",
AnchorPoint = Vector2.new(0.5, 0.5),
Size = UDim2.new(1, -360, 1, -36 -36),
Position = UDim2.new(0.5, 0, 0.5, 0),
BackgroundTransparency = 1,
ScaleType = Enum.ScaleType.Slice,
SliceCenter = Rect.new(5,5,6,6),
Image = "rbxasset://textures/ui/LuaChat/9-slice/modal.png",
Create.new "UIPadding" {
PaddingBottom = UDim.new(0, Constants.ModalDialog.CLEARANCE_CORNER_ROUNDING)
}
}
}
}
self.baseFrame.Parent = self.rbx
self.leftHandFrame = self.baseFrame.LeftHandFrame
self.rightHandFrame = self.baseFrame.RightHandFrame
self.modalFrameBase = self.baseFrame.ModalFrameBase
self.modalFrame = self.modalFrameBase.ModalFrame
self.initialized = false
return self
end
function DialogFrame:Initialize()
self.baseFrame.Visible = true
self.initialized = true
local defaultScreen = DefaultScreenComponent.new(self.appState)
defaultScreen.rbx.Parent = self.rightHandFrame
end
function DialogFrame:AddDialogFrame(intent)
if not self.initialized then
self:Initialize()
end
local dialogType = DialogInfo.GetTypeBasedOnIntent(self.appState.store:getState().FormFactor, intent)
local newFrame = Create.new "Frame" {
Size = UDim2.new(1, 0, 1, 0),
BackgroundTransparency = 1.0,
}
if dialogType == DialogInfo.DialogType.Centered then
newFrame.Parent = self.baseFrame
elseif dialogType == DialogInfo.DialogType.Left then
newFrame.Parent = self.leftHandFrame
elseif dialogType == DialogInfo.DialogType.Right then
newFrame.Parent = self.rightHandFrame
elseif dialogType == DialogInfo.DialogType.Modal then
newFrame.Parent = self.modalFrame
elseif dialogType == DialogInfo.DialogType.Popup then
newFrame.Parent = self.baseFrame
end
self:ConfigureModalFrame()
return newFrame
end
function DialogFrame:ConfigureModalFrame()
local hasGuis = false
for _, child in pairs(self.modalFrame:GetChildren()) do
if child:IsA("GuiBase") then
hasGuis = true
break
end
end
if hasGuis then
self.modalFrameBase.Visible = true
else
self.modalFrameBase.Visible = false
end
end
function DialogFrame:TransitionDialogFrame(frame, intent, otherIntent, transitionType, callback)
if (not self.appState) or (not intent) or (not otherIntent) then
if callback ~= nil then
callback(Enum.PlaybackState.Completed)
end
return
end
local dialogType = DialogInfo.GetTypeBasedOnIntent(self.appState.store:getState().FormFactor, intent)
local otherDialogType = DialogInfo.GetTypeBasedOnIntent(self.appState.store:getState().FormFactor, otherIntent)
if dialogType ~= DialogInfo.DialogType.Centered or otherDialogType ~= DialogInfo.DialogType.Centered then
if callback ~= nil then
callback(Enum.PlaybackState.Completed)
end
return
end
local startingPos
local endingPos
if transitionType == self.TransitionType.Start then
startingPos = RIGHT_SIDE_POS
endingPos = CENTERED_POS
elseif transitionType == self.TransitionType.Stop then
startingPos = CENTERED_POS
endingPos = RIGHT_SIDE_POS
elseif transitionType == self.TransitionType.Resume then
startingPos = LEFT_SIDE_POS
endingPos = CENTERED_POS
elseif transitionType == self.TransitionType.Pause then
startingPos = CENTERED_POS
endingPos = LEFT_SIDE_POS
end
frame.rbx.Position = startingPos
local tweenPosition = TweenService:Create(
frame.rbx,
TweenInfo.new(
Constants.Tween.DEFAULT_TWEEN_TIME,
Constants.Tween.DEFAULT_TWEEN_STYLE,
Constants.Tween.DEFAULT_TWEEN_EASING_DIRECTION
),
{
Position = endingPos,
}
)
tweenPosition:Play()
if callback then
spawn(function()
local playbackState = tweenPosition.Completed:wait()
callback(playbackState)
end)
end
end
return DialogFrame
@@ -0,0 +1,99 @@
local Modules = script.Parent.Parent
local Components = Modules.Components
local BaseScreen = require(Modules.Views.Phone.BaseScreen)
local GenericDialogType = require(Components.GroupDetailDialogs.GenericDialogType)
local EditChatGroupNameDialog = require(Components.GroupDetailDialogs.EditChatGroupNameDialog)
local LeaveGroupDialog = require(Components.GroupDetailDialogs.LeaveGroupDialog)
local ParticipantDialog = require(Components.GroupDetailDialogs.ParticipantDialog)
local RemoveUserDialog = require(Components.GroupDetailDialogs.RemoveUserDialog)
local GenericDialog = BaseScreen:Template()
GenericDialog.__index = GenericDialog
function GenericDialog.new(appState, route)
local self = {
appState = appState,
route = route,
connections = {},
}
setmetatable(self, GenericDialog)
self.dialogComponent = self.route.parameters.dialog
self.parameters = self.route.parameters.dialogParameters
if self.route.parameters.dialog == GenericDialogType.EditChatGroupNameDialog then
self.currentDialog = EditChatGroupNameDialog.new(
self.appState,
self.parameters.titleLocalizationKey,
self.parameters.maxChar,
self.parameters.conversation
)
self.rbx = self.currentDialog.dialog.rbx
self.textBoxToFocus = self.currentDialog.dialog.textInputComponent.textBoxComponent
elseif self.route.parameters.dialog == GenericDialogType.LeaveGroupDialog then
self.currentDialog = LeaveGroupDialog.new(
self.appState,
self.parameters.titleKey,
self.parameters.messageKey,
self.parameters.cancelTitleKey,
self.parameters.confirmationTitleKey,
self.parameters.conversation
)
self.rbx = self.currentDialog.dialog.rbx
elseif self.route.parameters.dialog == GenericDialogType.ParticipantDialog then
self.currentDialog = ParticipantDialog.new(
self.appState,
self.parameters.titleKey,
self.parameters.options,
self.parameters.conversationId,
self.parameters.conversation,
self.parameters.userId
)
self.rbx = self.currentDialog.dialog.rbx
elseif self.route.parameters.dialog == GenericDialogType.RemoveUserDialog then
self.currentDialog = RemoveUserDialog.new(
self.appState,
self.parameters.titleKey,
self.parameters.messageKey,
self.parameters.cancelTitleKey,
self.parameters.confirmationTitleKey,
self.parameters.conversation
)
self.currentDialog.dialog:Update(self.parameters.messageKey, self.parameters.user, self.parameters.messageArguments)
self.rbx = self.currentDialog.dialog.rbx
else
print("Attempting to open unknown type of Dialog: ", self.route.parameters.dialog)
end
return self
end
function GenericDialog:Start()
self.rbx.Visible = true
if self.textBoxToFocus then
self.textBoxToFocus:CaptureFocus()
end
end
function GenericDialog:Stop()
self.rbx.Visible = false
self.rbx.Parent = nil
self.currentDialog:Destruct()
self.textBoxToFocus = nil
end
function GenericDialog:Resume()
end
function GenericDialog:Pause()
end
function GenericDialog:Update(current, previous)
self.dialogComponent:Update(current, previous)
end
return GenericDialog
@@ -0,0 +1,66 @@
local Modules = script.Parent.Parent.Parent
local Components = Modules.Components
local BaseScreen = require(Modules.Views.Phone.BaseScreen)
local Create = require(Modules.Create)
local AlertModel = require(Modules.Models.Alert)
local DialogComponents = require(Components.DialogComponents)
local DeleteAlert = require(Modules.Actions.DeleteAlert)
local Alert = BaseScreen:Template()
function Alert.new(appState, route)
local self = {
appState = appState,
route = route,
alerts = {},
}
setmetatable(self, {__index = Alert})
self.rbx = Create.new"Frame" {
Size = UDim2.new(1, 0, 1, 0),
BackgroundTransparency = 1,
}
self.alertDialog = DialogComponents.AlertDialog.new(appState, nil, nil)
self.alertDialog.rbx.Parent = self.rbx
self.alerts = nil
self.alert = nil
self.alertDialog.accepted.Event:Connect(function()
if self.alert ~= nil then
self.appState.store:dispatch(DeleteAlert(self.alert))
end
end)
self.appState.store.changed:connect(function(current, previous)
if current ~= previous then
self:Update(current.ChatAppReducer.AppState.alerts)
end
end)
return self
end
function Alert:Update(alerts)
if alerts and alerts ~= self.alerts then
if #(alerts.keys) >= 1 then
local alertId = alerts.keys[1]
local alert = alerts.values[alertId]
if alert.type == AlertModel.AlertType.DIALOG then
self.alertDialog:Update(alert)
self.alertDialog:Prompt()
else
warn("Unhandled AlertType")
end
self.alert = alert
end
self.alerts = alerts
end
end
return Alert
@@ -0,0 +1,35 @@
--[[
Defines a set of tweens and default lifecycle handlers appropriate for this
platform.
]]
local BaseScreen = {}
function BaseScreen:Get(...)
return self.new(...)
end
function BaseScreen:Template()
local class = {}
for key, value in pairs(self) do
class[key] = value
end
return class
end
function BaseScreen:Start()
end
function BaseScreen:Stop()
end
function BaseScreen:Resume()
end
function BaseScreen:Pause()
end
function BaseScreen:Destruct()
end
return BaseScreen
@@ -0,0 +1,109 @@
local LuaChat = script.Parent.Parent.Parent
local BaseScreen = require(script.Parent.BaseScreen)
local Components = LuaChat.Components
local ConversationComponent = require(Components.Conversation)
local DialogInfo = require(LuaChat.DialogInfo)
local PopRoute = require(LuaChat.Actions.PopRoute)
local SetRoute = require(LuaChat.Actions.SetRoute)
local Intent = DialogInfo.Intent
local ConversationView = BaseScreen:Template()
ConversationView.__index = ConversationView
ConversationView.viewCache = {}
function ConversationView:Get(appState, route)
if self.viewCache[route.parameters.conversationId] then
return self.viewCache[route.parameters.conversationId]
end
local view = self.new(appState, route)
self.viewCache[route.parameters.conversationId] = view
return view
end
function ConversationView.new(appState, route)
local self = {}
self.route = route
self.conversationId = route.parameters.conversationId
self.appState = appState
self.connections = {}
setmetatable(self, ConversationView)
self.conversationComponent = ConversationComponent.new(appState)
self.rbx = self.conversationComponent.rbx
return self
end
function ConversationView:Start()
BaseScreen.Start(self)
local backButtonConnection = self.conversationComponent.BackButtonPressed:connect(function()
self.appState.store:dispatch(PopRoute())
end)
table.insert(self.connections, backButtonConnection)
local groupDetailConnection = self.conversationComponent.GroupDetailsButtonPressed:connect(function()
self.appState.store:dispatch(SetRoute(
Intent.GroupDetail,
{
conversationId = self.conversationId,
}
))
end)
table.insert(self.connections, groupDetailConnection)
do
local connection = self.appState.store.changed:connect(function(state, oldState)
local conversation = state.ChatAppReducer.Conversations[self.conversationId]
if not conversation then
if self.appState.screenManager:GetCurrentView() == self then
self.appState.store:dispatch(SetRoute(
nil,
{},
Intent.ConversationHub
))
end
self:Stop()
self.viewCache[self.conversationId] = nil
return
end
self.conversationComponent:Update(state, oldState)
end)
table.insert(self.connections, connection)
end
self.conversationComponent:Start()
end
function ConversationView:Stop()
BaseScreen.Stop(self)
self.conversationComponent:Stop()
for _, connection in ipairs(self.connections) do
connection:disconnect()
end
self.connections = {}
end
function ConversationView:Pause()
BaseScreen.Pause(self)
self.conversationComponent:Pause()
end
function ConversationView:Resume()
BaseScreen.Resume(self)
self.conversationComponent:Resume()
end
return ConversationView
@@ -0,0 +1,99 @@
local UserInputService = game:GetService("UserInputService")
local Modules = game:GetService("CoreGui").RobloxGui.Modules
local LuaApp = Modules.LuaApp
local LuaChat = Modules.LuaChat
local BaseScreen = require(LuaChat.Views.Phone.BaseScreen)
local Create = require(LuaChat.Create)
local ConversationHubComponent = require(LuaChat.Components.ConversationHub)
local DialogInfo = require(LuaChat.DialogInfo)
local Constants = require(LuaChat.Constants)
local ConversationActions = require(LuaChat.Actions.ConversationActions)
local SetRoute = require(LuaChat.Actions.SetRoute)
local SetTabBarVisible = require(LuaApp.Actions.SetTabBarVisible)
local Intent = DialogInfo.Intent
local ConversationHub = BaseScreen:Template()
ConversationHub.__index = ConversationHub
function ConversationHub.new(appState, route)
local self = {}
setmetatable(self, ConversationHub)
self.appState = appState
self.route = route
self.ConversationHubComponent = ConversationHubComponent.new(appState)
self.rbx = self.ConversationHubComponent.rbx
local spacer = Create.new "Frame" {
Name = "Spacer",
Size = UDim2.new(1, 0, 0, UserInputService.BottomBarSize.Y),
BackgroundColor3 = Constants.Color.WHITE,
BorderColor3 = Constants.Color.WHITE,
BackgroundTransparency = 0,
LayoutOrder = 3,
}
spacer.Parent = self.rbx
self.ConversationHubComponent.ConversationTapped:connect(function(convoId)
if self.appState.screenManager:GetCurrentView() ~= self then
return
end
local conversation = self.appState.store:getState().ChatAppReducer.Conversations[convoId]
if conversation == nil then
return
end
if conversation.serverState == Constants.ServerState.NONE then
self.appState.store:dispatch(ConversationActions.StartOneToOneConversation(conversation, function(id)
self.appState.store:dispatch(SetRoute(Intent.Conversation, {conversationId = id}))
end))
else
self.appState.store:dispatch(SetRoute(Intent.Conversation, {conversationId = convoId}))
end
end)
self.ConversationHubComponent.CreateChatButtonPressed:connect(function()
self.appState.store:dispatch(SetRoute(Intent.CreateChat, {}))
end)
return self
end
function ConversationHub:Start()
BaseScreen.Start(self)
self.ConversationHubComponent:Start()
self.appState.store:dispatch(SetTabBarVisible(true))
end
function ConversationHub:Stop()
BaseScreen.Stop(self)
self.ConversationHubComponent:Stop()
self.appState.store:dispatch(SetTabBarVisible(false))
end
function ConversationHub:Resume()
BaseScreen.Resume(self)
self.appState.store:dispatch(SetTabBarVisible(true))
end
function ConversationHub:Pause()
BaseScreen.Pause(self)
self.appState.store:dispatch(SetTabBarVisible(false))
end
function ConversationHub:Update(state, oldState)
self.ConversationHubComponent:Update(state, oldState)
end
return ConversationHub
@@ -0,0 +1,81 @@
local Modules = script.Parent.Parent.Parent
local Components = Modules.Components
local Constants = require(Modules.Constants)
local BaseScreen = require(Modules.Views.Phone.BaseScreen)
local EditChatGroupComponent = require(Components.EditChatGroup)
local DialogInfo = require(Modules.DialogInfo)
local Intent = DialogInfo.Intent
local PopRoute = require(Modules.Actions.PopRoute)
local SetRoute = require(Modules.Actions.SetRoute)
local EditChatGroup = BaseScreen:Template()
EditChatGroup.__index = EditChatGroup
function EditChatGroup.new(appState, route)
local self = {
appState = appState,
route = route,
convoId = route.parameters.conversationId,
connections = {},
}
setmetatable(self, EditChatGroup)
local participantCount = #appState.store:getState().ChatAppReducer.Conversations[self.convoId].participants
local maxSize = Constants.MAX_PARTICIPANT_COUNT + 1 - participantCount
self.editChatGroupComponent = EditChatGroupComponent.new(appState, maxSize, self.convoId)
self.rbx = self.editChatGroupComponent.rbx
local backButtonConnection = self.editChatGroupComponent.BackButtonPressed:connect(function()
self.appState.store:dispatch(PopRoute())
end)
table.insert(self.connections, backButtonConnection)
return self
end
function EditChatGroup:Start()
BaseScreen.Start(self)
do
local connection = self.appState.store.changed:connect(function(current, previous)
local currentConversationId = current.ChatAppReducer.Location.current.parameters.conversationId
local conversation = current.ChatAppReducer.Conversations[currentConversationId]
if current ~= previous and conversation then
self:Update(current, previous)
else
if self.appState.screenManager:GetCurrentView() == self then
self.appState.store:dispatch(SetRoute(nil, {}, Intent.ConversationHub))
end
end
self:Update(current, previous)
end)
table.insert(self.connections, connection)
end
end
function EditChatGroup:Stop()
for _, connection in ipairs(self.connections) do
connection:disconnect()
end
self.connections = {}
BaseScreen.Stop(self)
end
function EditChatGroup:Destruct()
self.editChatGroupComponent:Destruct()
self.editChatGroupComponent = nil
BaseScreen.Destruct(self)
end
function EditChatGroup:Update(current, previous)
self.editChatGroupComponent:Update(current, previous)
end
return EditChatGroup
@@ -0,0 +1,66 @@
local Modules = game:GetService("CoreGui").RobloxGui.Modules
local LuaApp = Modules.LuaApp
local LuaChat = Modules.LuaChat
local BaseScreen = require(LuaChat.Views.Phone.BaseScreen)
local Create = require(LuaChat.Create)
local Constants = require(LuaChat.Constants)
local GameShareComponent = require(LuaChat.Components.GameShareComponent)
local SetTabBarVisible = require(LuaApp.Actions.SetTabBarVisible)
local GameShareView = BaseScreen:Template()
GameShareView.__index = GameShareView
function GameShareView.new(appState, route)
local self = {}
self.appState = appState
self.route = route
setmetatable(self, GameShareView)
local innerFrame = Create.new"Frame" {
Name = "InnerFrame",
Size = UDim2.new(1, 0, 1, 0),
Position = UDim2.new(0.5, 0, 0, 0),
AnchorPoint = Vector2.new(0.5, 0),
BackgroundColor3 = Constants.Color.GRAY5,
BackgroundTransparency = 1,
BorderSizePixel = 0,
LayoutOrder = 2,
Create.new("UIListLayout") {
Name = "ListLayout",
SortOrder = Enum.SortOrder.LayoutOrder,
},
}
self.gameShareComponent = GameShareComponent.new(appState, route.parameters.placeId, innerFrame)
self.rbx = self.gameShareComponent.rbx
return self
end
function GameShareView:Start()
self.gameShareComponent:Start()
self.prevTabBarVisibility = self.appState.store:getState().TabBarVisible
BaseScreen.Start(self)
self.appState.store:dispatch(SetTabBarVisible(false))
end
function GameShareView:Stop()
self.gameShareComponent:Stop()
BaseScreen.Stop(self)
self.appState.store:dispatch(SetTabBarVisible(self.prevTabBarVisibility))
end
function GameShareView:Destruct()
self.gameShareComponent:Destruct()
BaseScreen.Destruct(self)
end
return GameShareView
@@ -0,0 +1,118 @@
local Modules = game:GetService("CoreGui").RobloxGui.Modules
local LuaChat = Modules.LuaChat
local BaseScreen = require(LuaChat.Views.Phone.BaseScreen)
local Constants = require(LuaChat.Constants)
local ToastModel = require(LuaChat.Models.ToastModel)
local DialogInfo = require(LuaChat.DialogInfo)
local GroupDetailComponent = require(LuaChat.Components.GroupDetail)
local PopRoute = require(LuaChat.Actions.PopRoute)
local SetRoute = require(LuaChat.Actions.SetRoute)
local ShowToast = require(LuaChat.Actions.ShowToast)
local Intent = DialogInfo.Intent
local GroupDetail = BaseScreen:Template()
GroupDetail.__index = GroupDetail
function GroupDetail.new(appState, route)
local self = {}
self.appState = appState
self.route = route
self.groupDetailComponent = GroupDetailComponent.new(appState, route.parameters.conversationId)
self.rbx = self.groupDetailComponent.rbx
self.connections = {}
setmetatable(self, GroupDetail)
local backButtonConnection = self.groupDetailComponent.BackButtonPressed:connect(function()
self.appState.store:dispatch(PopRoute())
end)
table.insert(self.connections, backButtonConnection)
local addFriendsConnection = self.groupDetailComponent.AddFriendsPressed:connect(function()
if self.appState.screenManager:GetCurrentView() ~= self then
return
end
local participantCount = #self.groupDetailComponent.conversation.participants
if participantCount >= Constants.MAX_PARTICIPANT_COUNT + 1 then
local messageKey = "Feature.Chat.Message.ToastText"
local messageArguments = {
friendNum = tostring(Constants.MAX_PARTICIPANT_COUNT+1),
}
local toastModel = ToastModel.new(Constants.ToastIDs.TOO_MANY_PEOPLE, messageKey, messageArguments)
self.appState.store:dispatch(ShowToast(toastModel))
else
self.appState.store:dispatch(SetRoute(Intent.EditChatGroup, {
conversationId = self.groupDetailComponent.conversation.id
}))
end
end)
table.insert(self.connections, addFriendsConnection)
return self
end
function GroupDetail:Start()
BaseScreen.Start(self)
do
local connection = self.appState.store.changed:connect(function(current, previous)
local currentConversationId = current.ChatAppReducer.Location.current.parameters.conversationId
local conversation = current.ChatAppReducer.Conversations[currentConversationId]
if current ~= previous and conversation then
self.groupDetailComponent:Update(current, previous)
else
if self.appState.screenManager:GetCurrentView() == self then
self.appState.store:dispatch(SetRoute(nil, {}, Intent.ConversationHub))
end
end
end)
table.insert(self.connections, connection)
end
end
-- GroupDetail does not need to slide off-screen when spawning Dialogs.
function GroupDetail:Pause()
local state = self.appState.store:getState()
local dialogType = DialogInfo.GetTypeBasedOnIntent(
self.appState.store:getState().FormFactor,
state.ChatAppReducer.Location.current.intent
)
if dialogType == DialogInfo.DialogType.Popup then
self.isNextPageGenericDialog = true
else
self.isNextPageGenericDialog = false
BaseScreen.Pause(self)
end
end
function GroupDetail:Resume()
if self.isNextPageGenericDialog == nil or self.isNextPageGenericDialog == false then
BaseScreen.Resume(self)
end
self.isNextPageGenericDialog = false
end
function GroupDetail:Stop()
BaseScreen.Stop(self)
for _, connection in ipairs(self.connections) do
connection:disconnect()
end
self.connections = {}
self.groupDetailComponent:Stop()
end
function GroupDetail:Destruct()
self.groupDetailComponent:Destruct()
end
return GroupDetail
@@ -0,0 +1,72 @@
local Modules = script.Parent.Parent.Parent
local Components = Modules.Components
local DialogInfo = require(Modules.DialogInfo)
local BaseScreen = require(Modules.Views.Phone.BaseScreen)
local NewChatGroupComponent = require(Components.NewChatGroup)
local PopRoute = require(Modules.Actions.PopRoute)
local SetRoute = require(Modules.Actions.SetRoute)
local Intent = DialogInfo.Intent
local NewChatGroup = BaseScreen:Template()
NewChatGroup.__index = NewChatGroup
function NewChatGroup.new(appState, route)
local self = {
appState = appState,
route = route,
connections = {};
}
setmetatable(self, NewChatGroup)
self.newChatGroupComponent = NewChatGroupComponent.new(appState)
self.rbx = self.newChatGroupComponent.rbx
local backButtonPressedConnection = self.newChatGroupComponent.BackButtonPressed:connect(function()
self.appState.store:dispatch(PopRoute())
end)
table.insert(self.connections, backButtonPressedConnection)
local conversationSavedConnection = self.newChatGroupComponent.ConversationSaved:connect(function(id)
self.appState.store:dispatch(SetRoute(Intent.Conversation, {conversationId = id}, Intent.ConversationHub))
end)
table.insert(self.connections, conversationSavedConnection)
return self
end
function NewChatGroup:Start()
BaseScreen.Start(self)
do
local connection = self.appState.store.changed:connect(function(current, previous)
self:Update(current, previous)
end)
table.insert(self.connections, connection)
end
end
function NewChatGroup:Stop()
for _, connection in ipairs(self.connections) do
connection:disconnect()
end
self.connections = {}
BaseScreen.Stop(self)
end
function NewChatGroup:Destruct()
self.newChatGroupComponent:Destruct()
self.newChatGroupComponent = nil
BaseScreen.Destruct(self)
end
function NewChatGroup:Update(current, previous)
self.newChatGroupComponent:Update(current, previous)
end
return NewChatGroup
@@ -0,0 +1,92 @@
local LuaChat = script.Parent.Parent.Parent
local Constants = require(LuaChat.Constants)
local ConversationActions = require(LuaChat.Actions.ConversationActions)
local DialogInfo = require(LuaChat.DialogInfo)
local BaseScreen = require(script.Parent.Parent.Phone.BaseScreen)
local ConversationHubComponent = require(LuaChat.Components.ConversationHub)
local ConversationComponent = require(LuaChat.Components.Conversation)
local SetRoute = require(LuaChat.Actions.SetRoute)
local Intent = DialogInfo.Intent
local ConversationHub = BaseScreen:Template()
ConversationHub.__index = ConversationHub
ConversationHub.conversationCache = {}
function ConversationHub.new(appState, route)
local self = {
appState = appState,
route = route,
connections = {},
}
setmetatable(self, ConversationHub)
self.conversationHubComponent = ConversationHubComponent.new(appState)
self.rbx = self.conversationHubComponent.rbx
self.conversationToGroupDetailsConnection = nil
self.conversationComponent = ConversationComponent.new(appState)
self.conversationToGroupDetailsConnection = self.conversationComponent.GroupDetailsButtonPressed:connect(function()
self.appState.store:dispatch(SetRoute(Intent.GroupDetail, {
conversationId = self.conversationComponent.conversationId,
}))
end)
self.conversationHubComponent.ConversationTapped:connect(function(convoId)
local conversation = self.appState.store:getState().ChatAppReducer.Conversations[convoId]
if conversation == nil then
return
end
if conversation.serverState == Constants.ServerState.NONE then
self.appState.store:dispatch(ConversationActions.StartOneToOneConversation(conversation,
function(id)
self.appState.store:dispatch(SetRoute(
Intent.Conversation,
{conversationId = id},
Intent.ConversationHub
))
end)
)
else
self.appState.store:dispatch(SetRoute(
Intent.Conversation,
{conversationId = convoId},
Intent.ConversationHub
))
end
end)
self.conversationHubComponent.CreateChatButtonPressed:connect(function()
self.appState.store:dispatch(SetRoute(Intent.CreateChat, {}))
end)
return self
end
function ConversationHub:Start()
BaseScreen.Start(self)
self.conversationHubComponent:Start()
self.conversationComponent:Start()
end
function ConversationHub:Stop()
BaseScreen.Start(self)
self.conversationHubComponent:Stop()
self.conversationComponent:Stop()
for _, connection in ipairs(self.connections) do
connection:disconnect()
end
self.connections = {}
end
return ConversationHub
@@ -0,0 +1,78 @@
local Modules = game:GetService("CoreGui").RobloxGui.Modules
local LuaApp = Modules.LuaApp
local LuaChat = Modules.LuaChat
local BaseScreen = require(LuaChat.Views.Phone.BaseScreen)
local Create = require(LuaChat.Create)
local Constants = require(LuaChat.Constants)
local GameShareComponent = require(LuaChat.Components.GameShareComponent)
local SetTabBarVisible = require(LuaApp.Actions.SetTabBarVisible)
local GameShareView = BaseScreen:Template()
GameShareView.__index = GameShareView
function GameShareView.new(appState, route)
local self = {}
self.appState = appState
self.route = route
setmetatable(self, GameShareView)
local dividerHeight = Constants.GameShareView.TABLET_HORIZONTAL_DIVIDER_HEIGHT
local viewWidth = Constants.GameShareView.TABLET_VIEW_WIDTH
local tabletDivider = Create.new"Frame" {
Name = "TabletDivider",
BackgroundColor3 = Constants.Color.GRAY5,
BorderSizePixel = 0,
Size = UDim2.new(1, 0, 0, dividerHeight),
LayoutOrder = 1,
}
local innerFrame = Create.new"Frame" {
Name = "InnerFrame",
Size = UDim2.new(0, viewWidth, 1, -dividerHeight),
Position = UDim2.new(0.5, 0, 0, 0),
AnchorPoint = Vector2.new(0.5, 0),
BackgroundColor3 = Constants.Color.GRAY5,
BackgroundTransparency = 1,
BorderSizePixel = 0,
LayoutOrder = 2,
Create.new("UIListLayout") {
Name = "ListLayout",
SortOrder = Enum.SortOrder.LayoutOrder,
},
tabletDivider,
}
self.gameShareComponent = GameShareComponent.new(appState, route.parameters.placeId, innerFrame)
self.rbx = self.gameShareComponent.rbx
return self
end
function GameShareView:Start()
self.gameShareComponent:Start()
BaseScreen.Start(self)
self.appState.store:dispatch(SetTabBarVisible(false))
end
function GameShareView:Stop()
self.gameShareComponent:Stop()
BaseScreen.Stop(self)
self.appState.store:dispatch(SetTabBarVisible(true))
end
function GameShareView:Destruct()
self.gameShareComponent:Destruct()
BaseScreen.Destruct(self)
end
return GameShareView
@@ -0,0 +1,22 @@
local Modules = script.Parent.Parent
local Components = Modules.Components
local ToastComponent = require(Components.ToastComponent)
local BaseScreen = require(Modules.Views.Phone.BaseScreen)
local ToastView = BaseScreen:Template()
ToastView.__index = ToastView
function ToastView.new(appState, route)
local self = {}
self.appState = appState
self.route = route
setmetatable(self, ToastView)
self.ToastComponent = ToastComponent.new(appState, route)
self.rbx = self.ToastComponent.rbx
return self
end
return ToastView