add gs
This commit is contained in:
+56
@@ -0,0 +1,56 @@
|
||||
local Modules = script.Parent.Parent.Parent
|
||||
local Components = Modules.Components
|
||||
|
||||
local DialogComponents = require(Components.DialogComponents)
|
||||
local ConversationActions = require(Modules.Actions.ConversationActions)
|
||||
local ResponseIndicator = require(Components.ResponseIndicator)
|
||||
|
||||
local EditChatGroupNameDialog = {}
|
||||
|
||||
function EditChatGroupNameDialog.new(appState, titleLocalizationKey, maxChar, conversation)
|
||||
local self = {}
|
||||
setmetatable(self, {__index = EditChatGroupNameDialog})
|
||||
|
||||
self.dialog = DialogComponents.TextInputDialog.new(appState, titleLocalizationKey, maxChar)
|
||||
|
||||
-- Setup ResponseIndicator
|
||||
self.responseIndicator = ResponseIndicator.new(appState)
|
||||
self.responseIndicator:SetVisible(false)
|
||||
self.responseIndicator.rbx.Parent = self.dialog.rbx
|
||||
|
||||
self.conversation = conversation
|
||||
|
||||
self:UpdateGroupName()
|
||||
|
||||
-- Define saved action
|
||||
self.savedConnection = self.dialog.saved:connect(function(newName)
|
||||
self.responseIndicator:SetVisible(true)
|
||||
local callback = function()
|
||||
self.responseIndicator:SetVisible(false)
|
||||
end
|
||||
local action = ConversationActions.RenameGroupConversation(self.conversation.id, newName, callback)
|
||||
appState.store:dispatch(action)
|
||||
end)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function EditChatGroupNameDialog:UpdateGroupName()
|
||||
local groupName = ""
|
||||
|
||||
if not self.conversation.isDefaultTitle then
|
||||
groupName = self.conversation.title
|
||||
end
|
||||
|
||||
self.dialog:Update(groupName)
|
||||
end
|
||||
|
||||
function EditChatGroupNameDialog:Destruct()
|
||||
if self.savedConnection then
|
||||
self.savedConnection:disconnect()
|
||||
end
|
||||
self.responseIndicator:Destruct()
|
||||
self.dialog:Destruct()
|
||||
end
|
||||
|
||||
return EditChatGroupNameDialog
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
local GenericDialogType = {
|
||||
EditChatGroupNameDialog = "EditChatGroupNameDialog",
|
||||
LeaveGroupDialog = "LeaveGroupDialog",
|
||||
ParticipantDialog = "ParticipantDialog",
|
||||
RemoveUserDialog = "RemoveUserDialog",
|
||||
}
|
||||
|
||||
return GenericDialogType
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
local Players = game:GetService("Players")
|
||||
|
||||
local Modules = script.Parent.Parent.Parent
|
||||
local Components = Modules.Components
|
||||
|
||||
local DialogComponents = require(Components.DialogComponents)
|
||||
local ConversationActions = require(Modules.Actions.ConversationActions)
|
||||
|
||||
local LeaveGroupDialog = {}
|
||||
|
||||
function LeaveGroupDialog.new(appState, titleKey, messageKey, cancelTitleKey, confirmTitleKey, conversation)
|
||||
local self = {}
|
||||
setmetatable(self, {__index = LeaveGroupDialog})
|
||||
|
||||
self.dialog = DialogComponents.ConfirmationDialog.new(appState, titleKey, messageKey, cancelTitleKey, confirmTitleKey)
|
||||
|
||||
self.conversation = conversation
|
||||
|
||||
self.dialogConnection = self.dialog.saved:connect(function()
|
||||
local userId = tostring(Players.LocalPlayer.UserId)
|
||||
local convoId = self.conversation.id
|
||||
local action = ConversationActions.RemoveUserFromConversation(userId, convoId)
|
||||
appState.store:dispatch(action)
|
||||
end)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function LeaveGroupDialog:Destruct()
|
||||
if self.dialogConnection then
|
||||
self.dialogConnection:disconnect()
|
||||
end
|
||||
self.dialog:Destruct()
|
||||
end
|
||||
|
||||
return LeaveGroupDialog
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
local Players = game:GetService("Players")
|
||||
local GuiService = game:GetService("GuiService")
|
||||
local CoreGui = game:GetService("CoreGui")
|
||||
|
||||
local LuaApp = CoreGui.RobloxGui.Modules.LuaApp
|
||||
local LuaChat = CoreGui.RobloxGui.Modules.LuaChat
|
||||
|
||||
local GenericDialogType = require(LuaChat.Components.GroupDetailDialogs.GenericDialogType)
|
||||
local DialogComponents = require(LuaChat.Components.DialogComponents)
|
||||
local WebApi = require(LuaChat.WebApi)
|
||||
local ConversationModel = require(LuaChat.Models.Conversation)
|
||||
local SetRoute = require(LuaChat.Actions.SetRoute)
|
||||
local DialogInfo = require(LuaChat.DialogInfo)
|
||||
|
||||
local NotificationType = require(LuaApp.Enum.NotificationType)
|
||||
|
||||
local Intent = DialogInfo.Intent
|
||||
|
||||
local PARTICIPANT_VIEW = 1
|
||||
local PARTICIPANT_REPORT = 2
|
||||
local PARTICIPANT_REMOVE = 3
|
||||
|
||||
local ParticipantDialog = {}
|
||||
|
||||
function ParticipantDialog.new(appState, titleKey, options, conversationId, conversation, userId)
|
||||
local self = {}
|
||||
setmetatable(self, {__index = ParticipantDialog})
|
||||
|
||||
self.appState = appState
|
||||
self.dialog = DialogComponents.OptionDialog.new(appState, titleKey, options, userId)
|
||||
|
||||
self.conversationId = conversationId
|
||||
self.conversation = conversation
|
||||
|
||||
if conversation ~= nil then
|
||||
if conversation.initiator == tostring(Players.LocalPlayer.UserId)
|
||||
and conversation.conversationType == ConversationModel.Type.MULTI_USER_CONVERSATION then
|
||||
self.dialog.optionGuis[PARTICIPANT_REMOVE].Visible = true
|
||||
else
|
||||
self.dialog.optionGuis[PARTICIPANT_REMOVE].Visible = false
|
||||
end
|
||||
self.dialog:Resize()
|
||||
end
|
||||
|
||||
self.dialogConnection = self.dialog.selected:connect(function(optionId, userIdSelected)
|
||||
local user = self.appState.store:getState().Users[userIdSelected]
|
||||
if user == nil then
|
||||
return
|
||||
end
|
||||
|
||||
if optionId == PARTICIPANT_VIEW then
|
||||
if user and user.id and (type(user.id) == 'string' or type(user.id) == 'number') then
|
||||
GuiService:BroadcastNotification(WebApi.MakeUserProfileUrl(user.id),
|
||||
NotificationType.VIEW_PROFILE)
|
||||
else
|
||||
print("Bad input to RequestNativeView, show error prompt here")
|
||||
end
|
||||
elseif optionId == PARTICIPANT_REPORT then
|
||||
if user and user.id and (type(user.id) == 'string' or type(user.id) == 'number') then
|
||||
GuiService:BroadcastNotification(WebApi.MakeReportUserUrl(user.id, conversationId),
|
||||
NotificationType.REPORT_ABUSE)
|
||||
else
|
||||
print("Bad input to RequestNativeView, show error prompt here")
|
||||
end
|
||||
elseif optionId == PARTICIPANT_REMOVE then
|
||||
local messageArguments = {
|
||||
USERNAME = user.name,
|
||||
}
|
||||
self.appState.store:dispatch(SetRoute(Intent.GenericDialog, {
|
||||
dialog = GenericDialogType.RemoveUserDialog,
|
||||
dialogParameters = {
|
||||
titleKey = "Feature.Chat.Action.RemoveUser",
|
||||
messageKey = "Feature.Chat.Message.RemoveUser",
|
||||
cancelTitleKey = "Feature.Chat.Action.Cancel",
|
||||
confirmationTitleKey = "Feature.Chat.Action.Remove",
|
||||
conversation = self.conversation,
|
||||
user = user,
|
||||
messageArguments = messageArguments
|
||||
}
|
||||
}
|
||||
))
|
||||
|
||||
end
|
||||
end)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function ParticipantDialog:Destruct()
|
||||
if self.dialogConnection then
|
||||
self.dialogConnection:disconnect()
|
||||
end
|
||||
self.dialog:Destruct()
|
||||
end
|
||||
|
||||
return ParticipantDialog
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
local Modules = script.Parent.Parent.Parent
|
||||
local Components = Modules.Components
|
||||
|
||||
local DialogComponents = require(Components.DialogComponents)
|
||||
local ConversationActions = require(Modules.Actions.ConversationActions)
|
||||
local ResponseIndicator = require(Components.ResponseIndicator)
|
||||
|
||||
local RemoveUserDialog = {}
|
||||
|
||||
function RemoveUserDialog.new(appState, titleKey, messageKey, cancelTitleKey, confirmTitleKey, conversation)
|
||||
local self = {}
|
||||
setmetatable(self, {__index = RemoveUserDialog})
|
||||
|
||||
self.appState = appState
|
||||
self.dialog = DialogComponents.ConfirmationDialog.new(appState, titleKey, messageKey, cancelTitleKey, confirmTitleKey)
|
||||
|
||||
-- Setup ResponseIndicator
|
||||
self.responseIndicator = ResponseIndicator.new(appState)
|
||||
self.responseIndicator:SetVisible(false)
|
||||
self.responseIndicator.rbx.Parent = self.dialog.rbx
|
||||
|
||||
self.conversation = conversation
|
||||
|
||||
self.dialogConnection = self.dialog.saved:connect(function(user)
|
||||
local userId = user.id
|
||||
local convoId = self.conversation.id
|
||||
|
||||
self.responseIndicator.rbx.Parent = self.rbx
|
||||
self.responseIndicator:SetVisible(true)
|
||||
|
||||
local action = ConversationActions.RemoveUserFromConversation(userId, convoId, function()
|
||||
self.responseIndicator:SetVisible(false)
|
||||
end)
|
||||
self.appState.store:dispatch(action)
|
||||
end)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function RemoveUserDialog:Destruct()
|
||||
if self.dialogConnection then
|
||||
self.dialogConnection:disconnect()
|
||||
end
|
||||
self.responseIndicator:Destruct()
|
||||
self.dialog:Destruct()
|
||||
end
|
||||
|
||||
return RemoveUserDialog
|
||||
Reference in New Issue
Block a user