コード例 #1
0
        public void Handle(TLUpdateNotifySettings message)
        {
            var notifyPeer = message.Peer as TLNotifyPeer;

            if (notifyPeer != null)
            {
                var peer = notifyPeer.Peer;
                if (peer is TLPeerUser && peer.Id == Item.Id)
                {
                    BeginOnUIThread(() =>
                    {
                        Full.NotifySettings = message.NotifySettings;
                        Full.RaisePropertyChanged(() => Full.NotifySettings);
                        RaisePropertyChanged(() => IsMuted);

                        //var notifySettings = updateNotifySettings.NotifySettings as TLPeerNotifySettings;
                        //if (notifySettings != null)
                        //{
                        //    _suppressUpdating = true;
                        //    MuteUntil = notifySettings.MuteUntil.Value;
                        //    _suppressUpdating = false;
                        //}
                    });
                }
            }
        }
コード例 #2
0
ファイル: ChannelDetailsViewModel.cs プロジェクト: Fart03/lau
        public void Handle(TLUpdateNotifySettings update)
        {
            var notifyPeer = update.Peer as TLNotifyPeer;

            if (notifyPeer != null)
            {
                var peer = notifyPeer.Peer;
                if (peer is TLPeerChannel && peer.Id == Item.Id)
                {
                    Execute.BeginOnUIThread(() =>
                    {
                        Full.NotifySettings = update.NotifySettings;
                        Full.RaisePropertyChanged(() => Full.NotifySettings);
                        RaisePropertyChanged(() => AreNotificationsEnabled);

                        //var notifySettings = updateNotifySettings.NotifySettings as TLPeerNotifySettings;
                        //if (notifySettings != null)
                        //{
                        //    _suppressUpdating = true;
                        //    MuteUntil = notifySettings.MuteUntil.Value;
                        //    _suppressUpdating = false;
                        //}
                    });
                }
            }
        }
コード例 #3
0
        public void Handle(TLUpdateNotifySettings notifySettings)
        {
            var notifyPeer = notifySettings.Peer as TLNotifyPeer;

            if (notifyPeer != null)
            {
                Execute.BeginOnUIThread(() =>
                {
                    for (var i = 0; i < Items.Count; i++)
                    {
                        var dialog = Items[i] as TLDialog;
                        if (dialog != null &&
                            dialog.Peer != null &&
                            dialog.Peer.Id.Value == notifyPeer.Peer.Id.Value &&
                            dialog.Peer.GetType() == notifyPeer.Peer.GetType())
                        {
                            dialog.NotifyOfPropertyChange(() => dialog.NotifySettings);
                            dialog.NotifyOfPropertyChange(() => dialog.Self);
                            break;
                        }
                    }
                });
            }

            var notifyUsers = notifySettings.Peer as TLNotifyUsers;

            if (notifyUsers != null)
            {
                var peerNotifySettings = notifySettings.NotifySettings as TLPeerNotifySettings;
                if (peerNotifySettings != null)
                {
                    var settings = StateService.GetNotifySettings();
                    settings.ContactAlert          = peerNotifySettings.MuteUntil == null || peerNotifySettings.MuteUntil.Value == 0;
                    settings.ContactMessagePreview = peerNotifySettings.ShowPreviews != null && peerNotifySettings.ShowPreviews.Value;
                    settings.ContactSound          = peerNotifySettings.Sound != null?peerNotifySettings.Sound.ToString() : "default";

                    StateService.SaveNotifySettingsAsync(settings);
                }
            }

            var notifyChats = notifySettings.Peer as TLNotifyChats;

            if (notifyChats != null)
            {
                var peerNotifySettings = notifySettings.NotifySettings as TLPeerNotifySettings;
                if (peerNotifySettings != null)
                {
                    var settings = StateService.GetNotifySettings();
                    settings.GroupAlert          = peerNotifySettings.MuteUntil == null || peerNotifySettings.MuteUntil.Value == 0;
                    settings.GroupMessagePreview = peerNotifySettings.ShowPreviews != null && peerNotifySettings.ShowPreviews.Value;
                    settings.GroupSound          = peerNotifySettings.Sound != null?peerNotifySettings.Sound.ToString() : "default";

                    StateService.SaveNotifySettingsAsync(settings);
                }
            }
        }
コード例 #4
0
        public void Handle(TLUpdateNotifySettings notifySettings)
        {
            var notifyPeer = notifySettings.Peer as TLNotifyPeer;

            if (notifyPeer != null)
            {
                Execute.BeginOnUIThread(() =>
                {
                    for (var i = 0; i < Items.Count; i++)
                    {
                        var dialog = Items[i] as TLDialog;
                        if (dialog != null &&
                            dialog.Peer != null &&
                            dialog.Peer.Id.Value == notifyPeer.Peer.Id.Value &&
                            dialog.Peer.GetType() == notifyPeer.Peer.GetType())
                        {
                            dialog.NotifyOfPropertyChange(() => dialog.NotifySettings);
                            break;
                        }
                    }
                });
            }
        }
コード例 #5
0
        public void Handle(TLUpdateNotifySettings updateNotifySettings)
        {
            var notifyPeer = updateNotifySettings.Peer as TLNotifyPeer;

            if (notifyPeer != null)
            {
                var peer = notifyPeer.Peer;
                if (peer is TLPeerChat &&
                    peer.Id.Value == CurrentContact.Index)
                {
                    Execute.BeginOnUIThread(() =>
                    {
                        CurrentContact.NotifySettings = updateNotifySettings.NotifySettings;
                        var notifySettings            = updateNotifySettings.NotifySettings as TLPeerNotifySettings;
                        if (notifySettings != null)
                        {
                            _suppressUpdating = true;
                            MuteUntil         = notifySettings.MuteUntil != null ? notifySettings.MuteUntil.Value : (StateService.GetNotifySettings().ContactAlert ? 0 : int.MaxValue);
                            _suppressUpdating = false;
                        }
                    });
                }
            }
        }
コード例 #6
0
        public void Handle(TLUpdateNotifySettings updateNotifySettings)
        {
            var notifyPeer = updateNotifySettings.Peer as TLNotifyPeer;

            if (notifyPeer != null)
            {
                var peer = notifyPeer.Peer;
                if (peer is TLPeerChat &&
                    peer.Id.Value == CurrentItem.Index)
                {
                    Execute.BeginOnUIThread(() =>
                    {
                        CurrentItem.NotifySettings = updateNotifySettings.NotifySettings;
                        var notifySettings         = updateNotifySettings.NotifySettings as TLPeerNotifySettings;
                        if (notifySettings != null)
                        {
                            _suppressUpdating = true;
                            MuteUntil         = notifySettings.MuteUntil.Value;
                            _suppressUpdating = false;
                        }
                    });
                }
            }
        }
コード例 #7
0
        public void Handle(TLUpdateNotifySettings updateNotifySettings)
        {
            // threadpool
            var notifyPeer = updateNotifySettings.Peer as TLNotifyPeer;

            if (notifyPeer != null)
            {
                var peer    = notifyPeer.Peer;
                var chat    = With as TLChatBase;
                var user    = With as TLUserBase;
                var channel = With as TLChannel;

                if (peer is TLPeerChat &&
                    chat != null &&
                    peer.Id.Value == chat.Index)
                {
                    chat.NotifySettings = updateNotifySettings.NotifySettings;
                    With.NotifyOfPropertyChange(() => chat.NotifySettings);
                }
                else if (peer is TLPeerUser &&
                         user != null &&
                         peer.Id.Value == user.Index)
                {
                    user.NotifySettings = updateNotifySettings.NotifySettings;
                    With.NotifyOfPropertyChange(() => chat.NotifySettings);
                }
                else if (peer is TLPeerChannel &&
                         channel != null &&
                         peer.Id.Value == channel.Index)
                {
                    channel.NotifySettings = updateNotifySettings.NotifySettings;
                    With.NotifyOfPropertyChange(() => channel.NotifySettings);
                    NotifyOfPropertyChange(() => AppBarCommandString);
                }
            }
        }