protected override void OnActivate()
        {
            base.OnActivate();

            MTProtoService.GetBlockedAsync(new TLInt(0), new TLInt(int.MaxValue),
                                           result =>
            {
                var contacts = result as TLContactsBlocked;
                if (contacts != null)
                {
                    var count = contacts.Blocked.Count;

                    UpdateBlockedUsersString(count);
                }
            },
                                           error => Execute.ShowDebugMessage("contacts.getBlocked error " + error));

            MTProtoService.GetAccountTTLAsync(
                result =>
            {
                var days = result.Days.Value;

                UpdateAccountTTLString(days);
            },
                error => Execute.ShowDebugMessage("account.getAccountTTL error " + error));

            MTProtoService.GetPrivacyAsync(new TLInputPrivacyKeyStatusTimestamp(),
                                           result =>
            {
                UpdateLastSeenString(result);
            },
                                           error => Execute.ShowDebugMessage("account.getPrivacy error " + error));
        }
Пример #2
0
        protected override void OnActivate()
        {
            base.OnActivate();

            MTProtoService.GetBlockedAsync(new TLInt(0), new TLInt(int.MaxValue),
                                           result =>
            {
                var contacts = result as TLContactsBlocked;
                if (contacts != null)
                {
                    var count = contacts.Blocked.Count;

                    UpdateBlockedUsersString(count);
                }
            },
                                           error => Execute.ShowDebugMessage("contacts.getBlocked error " + error));

            MTProtoService.GetAccountTTLAsync(
                result =>
            {
                var days = result.Days.Value;

                UpdateAccountTTLString(days);
            },
                error => Execute.ShowDebugMessage("account.getAccountTTL error " + error));

            MTProtoService.GetPrivacyAsync(new TLInputPrivacyKeyStatusTimestamp(),
                                           result =>
            {
                LastSeenSubtitle = GetPrivacyString(result, out _lastSeenPrivacyRules);
            },
                                           error => Execute.ShowDebugMessage("account.getPrivacy error " + error));

            MTProtoService.GetPrivacyAsync(new TLInputPrivacyKeyPhoneCall(),
                                           result =>
            {
                PhoneCallsSubtitle = GetPrivacyString(result, out _phoneCallsPrivacyRules);
            },
                                           error => Execute.ShowDebugMessage("account.getPrivacy error " + error));

            MTProtoService.GetPrivacyAsync(new TLInputPrivacyKeyChatInvite(),
                                           result =>
            {
                GroupsSubtitle = GetPrivacyString(result, out _chatInvitePrivacyRules);
            },
                                           error => Execute.ShowDebugMessage("account.getPrivacy error " + error));

            Execute.BeginOnThreadPool(() =>
            {
                var isSecretChatEnabled = TLUtils.OpenObjectFromMTProtoFile <TLBool>(SecretChatsViewModel.LinkPreviewsSyncRoot, Constants.WebPagePreviewsFileName);

                if (isSecretChatEnabled == null || !isSecretChatEnabled.Value)
                {
                    _secretChatsEnabled  = true;
                    IsSecretChatsEnabled = true;
                }
                else
                {
                    _secretChatsEnabled = false;
                }
            });
        }