{
public readonly ChatComponents.User _user = new ChatComponents.User("06c33e8b-e835-4736-80f4-63f44b66666c");
private List<ChatComponents.Message> _messages = new List<ChatComponents.Message>();
private List<ChatComponents.Message> init_messages = new List<ChatComponents.Message>();
private bool isReached = false;
public override void initState()
private void _addMessage(ChatComponents.Message message)
private void _addMessage(int index, ChatComponents.Message message)
_messages.Insert(0, message);
_messages.Insert(index, message);
});
}
text: message.text
);
_addMessage(textMessage);
_addMessage(0, textMessage);
private Future _handleEndReached()
setState(()=> {
_messages.AddRange(_messages);
_page = _page + 1;
return Future.value();
private void _loadMessages()
public List<ChatComponents.Message> InitMessages()
List<ChatComponents.Message> results = new List<ChatComponents.Message>();
TextAsset info = Resources.Load<TextAsset>("assets/messages");
status: ChatRoomUtils.getStatusFromString(_message.status),
text: _message.text
)
return results;
if (!isReached)
isReached = true;
if (init_messages.isEmpty())
init_messages = InitMessages();
return Future.delayed(TimeSpan.FromMilliseconds(1000), () =>
foreach (var message in init_messages)
_addMessage(_messages.Count, message);
isReached = false;
else
List<ChatComponents.Message> results = InitMessages();
setState(() => { _messages = results; });