refactor: Converted message data to its own struct

This commit is contained in:
Gerard Gascón 2024-01-27 15:42:31 +01:00
parent 1fc809141c
commit 9dd340eeb7
10 changed files with 339 additions and 18 deletions

View file

@ -0,0 +1,25 @@
using System;
using UnityEngine;
using UnityEngine.Serialization;
namespace Messaging.Composer {
public class SendButton : MonoBehaviour {
[SerializeField] private InputField inputField;
private MessageManager _messageManager;
private void Awake() {
_messageManager = FindObjectOfType<MessageManager>();
}
public void SendEmojis() {
if (CanSendText()) {
_messageManager.CreateMessage(inputField.Text, true);
}
}
private bool CanSendText() {
return !string.IsNullOrEmpty(inputField.Text) && !string.IsNullOrWhiteSpace(inputField.Text);
}
}
}