예제 #1
0
        //TODO for now just doing initial 30 - must still do paging and caching of query
        public void ListGroupChannelMessages(ChannelInfo channelInfo)
        {
            //TODO check connection state and try to login again if connection closed

            GroupChannel ch = _cache.GetGroupChannelForUrl(channelInfo.ChannelUrl);

            List <BaseMessageInfo> _messages = new List <BaseMessageInfo>();

            PreviousMessageListQuery mPrevMessageListQuery = ch.CreatePreviousMessageListQuery();

            //100
            mPrevMessageListQuery.Load(30, false, (List <BaseMessage> messages, SendBirdException e) =>
            {
                if (e != null)
                {
                    HandleException(e);
                    return;
                }

                //_cache.GroupChannels.AddRange(list);
                //_cache.RefreshOrAddEntryInList


                _messages.AddRange(PojoConverter.Transform(messages));
                LogMessage("OnListGroupChannelMessages");
                _completionHandler.OnListGroupChannelMessages(_messages);
            });


            //self.groupChannel.getPreviousMessages(byTimestamp: timestamp, limit: 30, reverse: !initial, messageType: SBDMessageTypeFilter.all, customType: "")

            //ch.CreatePreviousMessageListQuery()
            // timestamp = Int64.max
            //ch.Create
            // MessageListQuery query = ch.CreateMessageListQuery();

            //  query.Load()


            //List<ChannelInfo> _channels = new List<ChannelInfo>();
            //GroupChannelListQuery mQuery = GroupChannel.CreateMyGroupChannelListQuery();
            //mQuery.IncludeEmpty = true;
            //mQuery.Next((List<GroupChannel> list, SendBirdException e1) =>
            //{

            //    if (e1 != null)
            //    {
            //        HandleException(e1);
            //        return; //TODO check if we need to flag an error event here - incase any waiting services
            //    }


            //    _channels.AddRange(PojoConverter.Transform(list));

            //    LogMessage("OnConnectionSuccess");
            //    _completionHandler.OnListGroupChannels(_channels);

            //});
        }