add gs
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user