Beispiel #1
0
        private void MediaExecute()
        {
            if (_item == null)
            {
                return;
            }

            NavigationService.Navigate(typeof(DialogSharedMediaPage), _item.ToInputPeer());
        }
Beispiel #2
0
        private async void ToggleMuteExecute()
        {
            if (_item == null || _full == null)
            {
                return;
            }

            var notifySettings = _full.NotifySettings as TLPeerNotifySettings;

            if (notifySettings != null)
            {
                var muteUntil = notifySettings.MuteUntil == int.MaxValue ? 0 : int.MaxValue;
                var settings  = new TLInputPeerNotifySettings
                {
                    MuteUntil      = muteUntil,
                    IsShowPreviews = notifySettings.IsShowPreviews,
                    IsSilent       = notifySettings.IsSilent,
                    Sound          = notifySettings.Sound
                };

                var response = await ProtoService.UpdateNotifySettingsAsync(new TLInputNotifyPeer { Peer = _item.ToInputPeer() }, settings);

                if (response.IsSucceeded)
                {
                    if (_item == null || _full == null)
                    {
                        return;
                    }

                    notifySettings.MuteUntil = muteUntil;
                    RaisePropertyChanged(() => AreNotificationsEnabled);
                    Full.RaisePropertyChanged(() => Full.NotifySettings);

                    var dialog = CacheService.GetDialog(_item.ToPeer());
                    if (dialog != null)
                    {
                        dialog.NotifySettings = _full.NotifySettings;
                        dialog.RaisePropertyChanged(() => dialog.NotifySettings);
                        dialog.RaisePropertyChanged(() => dialog.IsMuted);
                        dialog.RaisePropertyChanged(() => dialog.Self);
                    }

                    CacheService.Commit();
                }
            }
        }