public void SyncGroup(TLChannelFull channelFull)
        {
            SavedStickers.Remove(_groupSet);

            if (channelFull.HasStickerSet)
            {
                _groupSet.Set.Id = channelFull.Id;

                Execute.BeginOnThreadPool(() =>
                {
                    var result = _stickersService.GetGroupStickerSetById(channelFull.StickerSet);
                    if (result != null)
                    {
                        Execute.BeginOnUIThread(() =>
                        {
                            _groupSet.Documents = new TLVector <TLDocumentBase>(result.Documents);

                            if (_groupSet.Documents != null && _groupSet.Documents.Count > 0)
                            {
                                SavedStickers.Add(_groupSet);
                            }
                            else
                            {
                                SavedStickers.Remove(_groupSet);
                            }
                        });
                    }
                });
            }
        }
Example #2
0
        public async Task<List<TLChannelFull>> GetFullInfoCannelsAsync()
        {
            _fullInfoCannels.Clear();
            var dialogs = (TLDialogsSlice)await _client.GetUserDialogsAsync();

            foreach (var item in dialogs.Chats)
            {
                if (item is TLChannel)
                {
                    try
                    {
                        TLChannel chat = item as TLChannel;

                        if (chat.Creator)
                        {
                            var chan = await _client.SendRequestAsync<TLChatFull>(new TLRequestGetFullChannel()
                            {
                                Channel = new TLInputChannel()
                                { ChannelId = chat.Id, AccessHash = (long)chat.AccessHash }
                            });

                            TLChannelFull tLChannelFull = chan.FullChat as TLChannelFull;
                            tLChannelFull.About = chat.Title;
                            _fullInfoCannels.Add(tLChannelFull);
                        }
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine(ex.Message + "\n" + ex.StackTrace);
                    }
                }
            }
            return _fullInfoCannels;
        }
Example #3
0
        public void HideGroup(TLChannelFull channelFull)
        {
            var appData = ApplicationData.Current.LocalSettings.CreateContainer("Channels", ApplicationDataCreateDisposition.Always);

            appData.Values["Stickers" + channelFull.Id] = channelFull.StickerSet?.Id ?? 0;

            SavedStickers.Remove(_groupSet);
        }
        public override async Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state)
        {
            // SHOULD NOT CALL BASE!

            Item = null;
            Full = null;

            var channel = parameter as TLChannel;
            var peer    = parameter as TLPeerChannel;

            if (peer != null)
            {
                channel = CacheService.GetChat(peer.ChannelId) as TLChannel;
            }

            if (channel != null)
            {
                Item = channel;

                var full = CacheService.GetFullChat(channel.Id) as TLChannelFull;
                if (full == null)
                {
                    var response = await ProtoService.GetFullChannelAsync(channel.ToInputChannel());

                    if (response.IsSucceeded)
                    {
                        full = response.Result.FullChat as TLChannelFull;
                    }
                }

                if (full != null)
                {
                    Full = full;

                    if (_item.IsMegaGroup)
                    {
                        Participants = new ItemsCollection(ProtoService, channel.ToInputChannel(), null, full.ParticipantsCount);
                    }

                    RaisePropertyChanged(() => IsMuted);
                    RaisePropertyChanged(() => Participants);

                    Aggregator.Subscribe(this);
                }
            }
        }
Example #5
0
        public void SyncGroup(TLChannelFull channelFull)
        {
            SavedStickers.Remove(_groupSet);

            var update = true;

            var appData = ApplicationData.Current.LocalSettings.CreateContainer("Channels", ApplicationDataCreateDisposition.Always);

            if (appData.Values.TryGetValue("Stickers" + channelFull.Id, out object stickersObj))
            {
                var stickersId = (long)stickersObj;
                if (stickersId == channelFull.StickerSet?.Id)
                {
                    update = false;
                }
            }

            if (channelFull.HasStickerSet && update)
            {
                _groupSet.With = CacheService.GetChat(channelFull.Id) as TLChannel;
                _groupSet.Full = channelFull;

                Execute.BeginOnThreadPool(() =>
                {
                    var result = _stickersService.GetGroupStickerSetById(channelFull.StickerSet);
                    if (result != null)
                    {
                        Execute.BeginOnUIThread(() =>
                        {
                            _groupSet.Documents = new TLVector <TLDocumentBase>(result.Documents);

                            if (_groupSet.Documents != null && _groupSet.Documents.Count > 0)
                            {
                                SavedStickers.Add(_groupSet);
                            }
                            else
                            {
                                SavedStickers.Remove(_groupSet);
                            }
                        });
                    }
                });
            }
        }
        public async Task <List <TLChannelFull> > GetFullInfoCannelsAsync()
        {
            _fullInfoCannels.Clear();
            var dialogs = (TLDialogs)await _client.GetUserDialogsAsync();

            foreach (var item in dialogs.Chats)
            {
                if (item is TLChannel)
                {
                    TLChannel chat = item as TLChannel;
                    var       chan = await _client.SendRequestAsync <TLChatFull>(new TLRequestGetFullChannel()
                    {
                        Channel = new TLInputChannel()
                        {
                            ChannelId = chat.Id, AccessHash = (long)chat.AccessHash
                        }
                    });

                    TLChannelFull tLChannelFull = chan.FullChat as TLChannelFull;
                    _fullInfoCannels.Add(tLChannelFull);
                }
            }
            return(_fullInfoCannels);
        }