예제 #1
0
 private void OnRtmMessageReceived(RtmMessage rtmMessage, string peerId)
 {
     foreach (RtmClientListener listener in _listenerList)
     {
         listener.OnMessageReceived(rtmMessage, peerId);
     }
 }
예제 #2
0
        /**
         * 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;
        }
예제 #4
0
        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);
            });
        }
예제 #5
0
        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);
                }
            });
        }
예제 #6
0
        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);
 }
예제 #9
0
        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);
        }
예제 #12
0
 /**
  * API CALL: send message to a channel
  */
 private void SendChannelMessage(RtmMessage message)
 {
     _rtmChannel.SendMessage(message, _sendMessageChannelCallback);
 }
예제 #13
0
 /**
  * API CALL: send message to peer
  */
 private void SendPeerMessage(RtmMessage message)
 {
     rtmClient.SendMessageToPeer(_peerId, message, _chatManager.SendMessageOptions, _sendMessageClientCallback);
 }