private void OnRtmMessageReceived(RtmMessage rtmMessage, string peerId) { foreach (RtmClientListener listener in _listenerList) { listener.OnMessageReceived(rtmMessage, peerId); } }
/** * API CALL: send message to a channel */ private void SendChannelMessage(string content) { // step 1: create a message RtmMessage message = rtmClient.CreateMessage(); message.Text = content; // step 2: send message to channel _rtmChannel.SendMessage(message, _sendMessageChannelCallback); }
public void InsertOfflineMessage(RtmMessage rtmMessage, string peerId) { var messageList = new List <RtmMessage>(); if (_offlineMessageMap.ContainsKey(peerId)) { messageList = _offlineMessageMap[peerId]; } messageList.Add(rtmMessage); _offlineMessageMap[peerId] = messageList; }
private void OnMessageReceived(RtmMessage message, RtmChannelMember fromMember) { var account = fromMember.UserId; MessageBean messageBean = new MessageBean(account, message, false) { Background = GetMessageColor(account) }; RunOnUiThread(() => { _messageBeanList.Add(messageBean); _messageAdapter.NotifyItemRangeChanged(_messageBeanList.Count, 1); _recyclerView.ScrollToPosition(_messageBeanList.Count - 1); }); }
private void OnRtmMessageReceived(RtmMessage message, string peerId) { RunOnUiThread(() => { if (_peerId.Equals(peerId)) { MessageBean messageBean = new MessageBean(peerId, message, false) { Background = GetMessageColor(peerId) }; _messageBeanList.Add(messageBean); _messageAdapter.NotifyItemRangeChanged(_messageBeanList.Count, 1); _recyclerView.ScrollToPosition(_messageBeanList.Count - 1); } else { MessageUtil.AddMessageBean(peerId, message); } }); }
public static void AddMessageBean(string account, RtmMessage msg) { MessageBean messageBean = new MessageBean(account, msg, false); int ret = ExistMessageListBean(account); if (ret == -1) { // account not exist new messagelistbean messageBean.Background = ColorList[RandomGenerator.NextInt(ColorList.Count)]; List <MessageBean> messageBeanList = new List <MessageBean> { messageBean }; _messageListBeanList.Add(new MessageListBean(account, messageBeanList)); } else { // account exist get messagelistbean MessageListBean bean = _messageListBeanList[ret]; List <MessageBean> messageBeanList = bean.MessageBeanList; if (messageBeanList.Count > 0) { messageBean.Background = messageBeanList[0].Background; } else { messageBean.Background = ColorList[RandomGenerator.NextInt(ColorList.Count)]; } messageBeanList.Add(messageBean); bean.MessageBeanList = messageBeanList; } }
public void OnMessageReceived(RtmMessage message, RtmChannelMember member) { OnMessageReceivedAction?.Invoke(message, member); }
public void OnMessageReceived(RtmMessage message, string peerId) { MessageReceived?.Invoke(message, peerId); }
public void OnMessageReceived(RtmMessage message, string peerId) { var signalData = JsonConvert.DeserializeObject <SignalMessage>(message.Text); OnSignalReceived?.Invoke(signalData); }
public MessageBean(string account, RtmMessage message, bool beSelf) { Message = message; BeSelf = beSelf; Account = account; }
public void OnMessageReceived(RtmMessage message, RtmChannelMember p1) { var signalData = JsonConvert.DeserializeObject <SignalMessage>(message.Text); OnSignalReceived?.Invoke(signalData); }
/** * API CALL: send message to a channel */ private void SendChannelMessage(RtmMessage message) { _rtmChannel.SendMessage(message, _sendMessageChannelCallback); }
/** * API CALL: send message to peer */ private void SendPeerMessage(RtmMessage message) { rtmClient.SendMessageToPeer(_peerId, message, _chatManager.SendMessageOptions, _sendMessageClientCallback); }