Exemplo n.º 1
0
        public async Task <IEnumerable <long> > SendMessage(long chatId, OutMessage message)
        {
            var attachments = new List <MediaAttachment>(message.Attachments.Count);

            foreach (var attachment in message.Attachments)
            {
                MediaAttachment vkAttachment = attachment.Type switch
                {
                    AttachmentType.Audio => await UploadAudio(chatId, attachment).ConfigureAwait(false),
                    AttachmentType.Voice => await UploadAudio(chatId, attachment).ConfigureAwait(false),
                    AttachmentType.Photo => await UploadPhoto(chatId, attachment).ConfigureAwait(false),
                    _ => await UploadDocument(chatId, attachment).ConfigureAwait(false)
                };
                attachments.Add(vkAttachment);
            }

            var result = new List <long>
            {
                await _api.Messages.SendAsync(new MessagesSendParams
                {
                    PeerId   = chatId,
                    RandomId = DateTime.Now.Millisecond,
                    Message  = message.Text,
                    Keyboard = message.Keyboard switch
                    {
                        InlineKeyboard inlineKeyboard => VkConverter.ToVkKeyboard(inlineKeyboard),
                        ReplyKeyboard replyKeyboard => VkConverter.ToVkKeyboard(replyKeyboard),
                        _ => message.RemoveReplyKeyboard
                            ? new MessageKeyboard
                        {
                            Buttons = new IEnumerable <MessageKeyboardButton> [0]
                        }
                            : null
                    },
Exemplo n.º 2
0
        public long Send(
            long id,
            bool isChat,
            string message,
            string title = "",
            MediaAttachment attachment            = null,
            IEnumerable <long> forwardMessagedIds = null,
            bool fromChat     = false,
            double?latitude   = null,
            double?longitude  = null,
            long?randomId     = null,
            long?captchaSid   = null,
            string captchaKey = null)
        {
            var parameters = new MessagesSendParams
            {
                UserId          = (isChat ? (long?)null : id),
                Message         = message,
                ForwardMessages = forwardMessagedIds,
                Lat             = latitude,
                Attachments     = attachment == null ? null : new List <MediaAttachment> {
                    attachment
                },
                RandomId   = randomId,
                CaptchaKey = captchaKey,
                CaptchaSid = captchaSid,
                Longitude  = longitude,
                ChatId     = (isChat ? (long?)null : id)
            };

            return(Send(parameters));
        }
Exemplo n.º 3
0
        private async Task <DynamicImageResponse> ExtractAttachment(Video item, MediaAttachment attachmentStream, MediaSourceInfo mediaSource, CancellationToken cancellationToken)
        {
            var extension = string.IsNullOrEmpty(attachmentStream.MimeType)
                ? Path.GetExtension(attachmentStream.FileName)
                : MimeTypes.ToExtension(attachmentStream.MimeType);

            if (string.IsNullOrEmpty(extension))
            {
                extension = ".jpg";
            }

            ImageFormat format = extension switch
            {
                ".bmp" => ImageFormat.Bmp,
                ".gif" => ImageFormat.Gif,
                ".jpg" => ImageFormat.Jpg,
                ".png" => ImageFormat.Png,
                ".webp" => ImageFormat.Webp,
                _ => ImageFormat.Jpg
            };

            string extractedAttachmentPath =
                await _mediaEncoder.ExtractVideoImage(item.Path, item.Container, mediaSource, null, attachmentStream.Index, format, cancellationToken)
                .ConfigureAwait(false);

            return(new DynamicImageResponse
            {
                Format = format,
                HasImage = true,
                Path = extractedAttachmentPath,
                Protocol = MediaProtocol.File
            });
        }
Exemplo n.º 4
0
 private async Task<Stream> GetAttachmentStream(
     MediaSourceInfo mediaSource,
     MediaAttachment mediaAttachment,
     CancellationToken cancellationToken)
 {
     var attachmentPath = await GetReadableFile(mediaSource.Path, mediaSource.Path, mediaSource, mediaAttachment, cancellationToken).ConfigureAwait(false);
     return AsyncFile.OpenRead(attachmentPath);
 }
Exemplo n.º 5
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            IAttachment result     = default(IAttachment);;
            JObject     attachment = JObject.Load(reader);
            string      type       = (attachment["type"] as JValue).Value.ToString();

            switch (type)
            {
            case "image":
                result = new MediaAttachment(MediaType.Image);
                break;

            case "audio":
                result = new MediaAttachment(MediaType.Audio);
                break;

            case "video":
                result = new MediaAttachment(MediaType.Video);
                break;

            case "file":
                result = new MediaAttachment(MediaType.File);
                break;

            case "location":
                result = new LocationAttachment();
                break;

            case "fallback":
                result = new FallbackAttachment();
                break;

            case "template":
                string templateType = (attachment["payload"]["template_type"] as JValue).Value.ToString();
                switch (templateType)
                {
                case "generic":
                    result = new GenericTemplateAttachment();
                    break;

                case "button":
                    result = new ButtonTemplateAttachment();
                    break;

                case "receipt":
                    result = new ReceiptTemplateAttachment();
                    break;
                }
                break;
            }
            serializer.Populate(attachment.CreateReader(), result);
            return(result);
        }
Exemplo n.º 6
0
        private async Task<string> GetReadableFile(
            string mediaPath,
            string inputFile,
            MediaSourceInfo mediaSource,
            MediaAttachment mediaAttachment,
            CancellationToken cancellationToken)
        {
            var outputPath = GetAttachmentCachePath(mediaPath, mediaSource, mediaAttachment.Index);
            await ExtractAttachment(inputFile, mediaSource, mediaAttachment.Index, outputPath, cancellationToken)
                .ConfigureAwait(false);

            return outputPath;
        }
Exemplo n.º 7
0
 public void Invite()
 {
     if (GetSocial.IsInitialized)
     {
         var linkParams = new LinkParams();
         linkParams.Add("invite", "invite_value");
         var inviteContent = InviteContent.CreateBuilder()
                             .WithMediaAttachment(MediaAttachment.Image(image))
                             .Build();
         GetSocialUi.CreateInvitesView().SetCustomInviteContent(inviteContent).SetInviteCallbacks(
             onComplete: (channelId) => { Debug.Log("Invitation was sent via " + channelId); InitScript.Instance.ShowReward(); },
             onCancel: (channelId) => Debug.Log("Invitation via " + channelId + " was cancelled"),
             onFailure: (channelId, error) => Debug.LogError("Invitation via" + channelId + "failed, error: " + error.Message)
             ).Show();
     }
 }
Exemplo n.º 8
0
    IEnumerator ShareDelay()
    {
        yield return(new WaitForEndOfFrame());

        Texture2D captureScreenshotAsTexture = ScreenCapture.CaptureScreenshotAsTexture();

        if (GetSocial.IsInitialized)
        {
            var inviteContent = InviteContent.CreateBuilder()
                                .WithText("Try to beat me in this game [APP_INVITE_URL]") // NOTE: if you customize the text [APP_INVITE_URL] placeholder have to be used
                                .WithMediaAttachment(MediaAttachment.Image(captureScreenshotAsTexture))
                                .Build();
            bool wasShown = GetSocialUi.CreateInvitesView()
                            .SetCustomInviteContent(inviteContent)
                            .SetInviteCallbacks(
                onComplete: (channelId) => Debug.Log("Invitation was sent via " + channelId),
                onCancel: (channelId) => Debug.Log("Invitation via " + channelId + " was cancelled"),
                onFailure: (channelId, error) => Debug.LogError("Invitation via" + channelId + "failed, error: " + error.Message)
                )
                            .Show();
        }
    }
    ActivityPostContent GetPost()
    {
        var mediaAttachment = _postImage ? MediaAttachment.Image(Image)
            : _postVideo?MediaAttachment.Video(Video)
                                  : null;

#pragma warning disable 0618
        var content = ActivityPostContent.CreateBuilder()
                      .WithText("My awesome post")
                      .WithButton("Awesome Button", "action_id")
                      .WithMediaAttachment(mediaAttachment);
#pragma warning restore 0618

        if (_action != null)
        {
            var action = GetSocialAction.CreateBuilder(_action)
                         .AddActionData(_actionData.ToDictionary(data => data.Key, data => data.Val))
                         .Build();

            content.WithButton("Awesome Button", action);
        }

        return(content.Build());
    }
Exemplo n.º 10
0
        protected override void DrawSectionBody()
        {
            DemoGuiUtils.DrawRow(() =>
            {
                GUILayout.Label("Notification Title: ", GSStyles.NormalLabelText);
                _title = GUILayout.TextField(_title, GSStyles.TextField);
            });

            DemoGuiUtils.DrawRow(() =>
            {
                GUILayout.Label("Notification Text: ", GSStyles.NormalLabelText);
                _text = GUILayout.TextField(_text, GSStyles.TextField);
            });

            DemoGuiUtils.DrawRow(() =>
            {
                GUILayout.Label("Image url: ", GSStyles.NormalLabelText);
            });
            DemoGuiUtils.DrawRow(() =>
            {
                _imageUrl = GUILayout.TextField(_imageUrl, GSStyles.TextField);
            });

            DemoGuiUtils.DrawRow(() =>
            {
                GUILayout.Label("Video url: ", GSStyles.NormalLabelText);
            });
            DemoGuiUtils.DrawRow(() =>
            {
                _videoUrl = GUILayout.TextField(_videoUrl, GSStyles.TextField);
            });

            DemoGuiUtils.DrawRow(() =>
            {
                _useCustomImage = GUILayout.Toggle(_useCustomImage, "", GSStyles.Toggle);
                GUILayout.Label("Send Custom Image", GSStyles.NormalLabelText, GUILayout.Width(Screen.width * 0.25f));
            });

            DemoGuiUtils.DrawRow(() =>
            {
                _useCustomVideo = GUILayout.Toggle(_useCustomVideo, "", GSStyles.Toggle);
                GUILayout.Label("Send Custom Video", GSStyles.NormalLabelText, GUILayout.Width(Screen.width * 0.25f));
            });

            DemoGuiUtils.DrawRow(() =>
            {
                GUILayout.Label("Background image: ", GSStyles.NormalLabelText);
            });
            DemoGuiUtils.DrawRow(() =>
            {
                _backgroundImageConfiguration = GUILayout.TextField(_backgroundImageConfiguration, GSStyles.TextField);
            });

            DemoGuiUtils.DrawRow(() =>
            {
                GUILayout.Label("Title color: ", GSStyles.NormalLabelText);
                _titleColor = GUILayout.TextField(_titleColor, GSStyles.TextField);
            });

            DemoGuiUtils.DrawRow(() =>
            {
                GUILayout.Label("Text color: ", GSStyles.NormalLabelText);
                _textColor = GUILayout.TextField(_textColor, GSStyles.TextField);
            });

            DemoGuiUtils.DrawRow(() =>
            {
                Placeholders.Keys.ToList().ForEach(key =>
                {
                    if (GUILayout.Button(key, GSStyles.Button))
                    {
                        _text += Placeholders[key];
                    }
                });
            });

            GUILayout.Label("Action: " + (_action ?? "Default"), GSStyles.NormalLabelText);
            DemoGuiUtils.DrawRow(() =>
            {
                if (GUILayout.Button("Default", GSStyles.ShortButton))
                {
                    _action = null;
                }

                var actions = new[] { GetSocialActionType.Custom, GetSocialActionType.OpenProfile, GetSocialActionType.OpenActivity, GetSocialActionType.OpenInvites, GetSocialActionType.OpenUrl, GetSocialActionType.AddFriend };
                actions.ToList().ForEach(action =>
                {
                    if (GUILayout.Button(action, GSStyles.ShortButton))
                    {
                        _action = action;
                    }
                });
            });

            DemoGuiUtils.DynamicRowFor(_actionData, "Action Data");
            DemoGuiUtils.DynamicRowFor(_actionButtons, "Action Buttons");

            DemoGuiUtils.DrawRow(() =>
            {
                GUILayout.Label("Template Name: ", GSStyles.NormalLabelText);
                _templateName = GUILayout.TextField(_templateName, GSStyles.TextField);
            });

            DemoGuiUtils.DynamicRowFor(_templatePlaceholders, "Template Placeholders");

            GUILayout.Label("Recipients:", GSStyles.NormalLabelText);

            DemoGuiUtils.DrawRow(() =>
            {
                _referrer = GUILayout.Toggle(_referrer, "", GSStyles.Toggle);
                GUILayout.Label("Referrer", GSStyles.NormalLabelText);
            });
            DemoGuiUtils.DrawRow(() =>
            {
                _referredUsers = GUILayout.Toggle(_referredUsers, "Referred Users", GSStyles.Toggle);
                GUILayout.Label("Referred Users", GSStyles.NormalLabelText);
            });
            DemoGuiUtils.DrawRow(() =>
            {
                _friends = GUILayout.Toggle(_friends, "Friends", GSStyles.Toggle);
                GUILayout.Label("Friends", GSStyles.NormalLabelText);
            });
            DemoGuiUtils.DrawRow(() =>
            {
                _me = GUILayout.Toggle(_me, "Me", GSStyles.Toggle);
                GUILayout.Label("Me", GSStyles.NormalLabelText);
            });

            DemoGuiUtils.DynamicRowFor(_userIds, "Custom Users ID");

            DemoGuiUtils.DrawRow(() =>
            {
                _sendBadgeValue = GUILayout.Toggle(_sendBadgeValue, "", GSStyles.Toggle);
                if (_sendBadgeValue)
                {
                    _sendBadgeIncrease = false;
                    _badgeIncrease     = "";
                }
                GUILayout.Label("Badge Count", GSStyles.NormalLabelText);
            });

            if (_sendBadgeValue)
            {
                _badgeValue = GUILayout.TextField(_badgeValue, GSStyles.TextField);
            }

            DemoGuiUtils.DrawRow(() =>
            {
                _sendBadgeIncrease = GUILayout.Toggle(_sendBadgeIncrease, "", GSStyles.Toggle);
                if (_sendBadgeIncrease)
                {
                    _sendBadgeValue = false;
                    _badgeValue     = "";
                }
                GUILayout.Label("Badge Increase", GSStyles.NormalLabelText);
            });

            if (_sendBadgeIncrease)
            {
                _badgeIncrease = GUILayout.TextField(_badgeIncrease, GSStyles.TextField);
            }

            if (GUILayout.Button("Send", GSStyles.Button))
            {
                var recipients = _userIds.ConvertAll(user => user.UserIdString);
                if (_referrer)
                {
                    recipients.Add(SendNotificationPlaceholders.Receivers.Referrer);
                }
                if (_referredUsers)
                {
                    recipients.Add(SendNotificationPlaceholders.Receivers.ReferredUsers);
                }
                if (_friends)
                {
                    recipients.Add(SendNotificationPlaceholders.Receivers.Friends);
                }
                if (_me)
                {
                    recipients.Add(GetSocial.User.Id);
                }

                if (GetSocialActionType.AddFriend.Equals(_action) && string.IsNullOrEmpty(_text) && string.IsNullOrEmpty(_templateName))
                {
                    var addFriend = NotificationContent.NotificationWithText(
                        SendNotificationPlaceholders.CustomText.SenderDisplayName + " wants to become friends.")
                                    .WithTitle("Friend request")
                                    .WithAction(GetSocialAction.CreateBuilder(_action)
                                                .AddActionData(GetSocialActionKeys.AddFriend.UserId, GetSocial.User.Id)
                                                .AddActionData("user_name", GetSocial.User.DisplayName)
                                                .Build());


                    GetSocial.User.SendNotification(recipients,
                                                    addFriend,
                                                    summary => _console.LogD("Sent " + summary.SuccessfullySentCount + " notifications"),
                                                    error => _console.LogE("Error: " + error.Message)
                                                    );
                    return;
                }
                var mediaAttachment = _imageUrl.Length > 0 ? MediaAttachment.ImageUrl(_imageUrl)
                    : _videoUrl.Length > 0 ? MediaAttachment.VideoUrl(_videoUrl)
                    : _useCustomImage?MediaAttachment.Image(Resources.Load <Texture2D>("activityImage"))
                                          : _useCustomVideo?MediaAttachment.Video(DemoUtils.LoadSampleVideoBytes())
                                              : null;

                var customization = NotificationCustomization
                                    .WithBackgroundImageConfiguration(_backgroundImageConfiguration.ToNullIfEmpty())
                                    .WithTitleColor(_titleColor.ToNullIfEmpty())
                                    .WithTextColor(_textColor.ToNullIfEmpty());
                var content = NotificationContent.NotificationWithText(_text)
                              .WithTitle(_title)
                              .WithTemplateName(_templateName)
                              .AddTemplatePlaceholders(_templatePlaceholders.ToDictionary(data => data.Key, data => data.Val))
                              .WithMediaAttachment(mediaAttachment)
                              .WithCustomization(customization)
                              .AddActionButtons(_actionButtons.ConvertAll(item => ActionButton.Create(item.Key, item.Val))
                                                );

                if (_sendBadgeValue)
                {
                    content.WithBadge(Badge.SetTo(int.Parse(_badgeValue)));
                }
                else if (_sendBadgeIncrease)
                {
                    content.WithBadge(Badge.IncreaseBy(int.Parse(_badgeIncrease)));
                }

                if (_action != null)
                {
                    var action = GetSocialAction.CreateBuilder(_action)
                                 .AddActionData(_actionData.ToDictionary(data => data.Key, data => data.Val))
                                 .Build();
                    content.WithAction(action);
                }

                GetSocial.User.SendNotification(recipients,
                                                content,
                                                summary => _console.LogD("Sent " + summary.SuccessfullySentCount + " notifications"),
                                                error => _console.LogE("Error: " + error.Message)
                                                );
            }
        }
Exemplo n.º 11
0
        public async Task ProcessAttachment(MediaAttachment mediaAttachment, int number, DirectoryInfo workDir, CancellationToken token, ILog log)
        {
            switch (mediaAttachment)
            {
            case VkNet.Model.Attachments.Photo photo:
                await downloadQueueProvider.EnqueueAll(photo.ToDownloads(number, filesystemTools, workDir, log), token);

                await photo.SaveText(number, filesystemTools, workDir, token, log);

                break;

            case VkNet.Model.Attachments.Audio audio:
                await downloadQueueProvider.EnqueueAll(audio.ToDownloads(number, filesystemTools, workDir, log), token);

                await audio.SaveLyrics(number, vkApi, filesystemTools, workDir, token, log);

                break;

            case VkNet.Model.Attachments.Document document:
                await downloadQueueProvider.EnqueueAll(document.ToDownloads(number, filesystemTools, workDir, log), token);

                break;

            case VkNet.Model.Attachments.Poll poll:
                await downloadQueueProvider.EnqueueAll(poll.ToDownloads(number, filesystemTools, workDir, log), token);

                await poll.SaveHumanReadableText(number, filesystemTools, workDir, token, log);

                break;

            case VkNet.Model.Attachments.Link link:
                await downloadQueueProvider.EnqueueAll(link.ToDownloads(number, filesystemTools, workDir, log), token);

                await link.SaveHumanReadableText(number, filesystemTools, workDir, token, log);

                break;

            case VkNet.Model.Attachments.AudioPlaylist audioPlaylist:
                var playlistWithAudio = await vkApiUtils.ExpandPlaylist(audioPlaylist, token, log);

                var playlistHandler = ServiceProvider.GetRequiredService <IHandler <PlaylistWithAudio> >();
                await playlistHandler.Process(playlistWithAudio, workDir, token, log);

                break;

            case VkNet.Model.Attachments.Album album:
                var albumWithPhoto = await vkApiUtils.ExpandAlbum(album, token, log);

                var albumHandler = ServiceProvider.GetRequiredService <IHandler <AlbumWithPhoto> >();
                await albumHandler.Process(albumWithPhoto, workDir, token, log);

                break;

            case VkNet.Model.Attachments.Video video:
                await downloadQueueProvider.EnqueueAll(video.ToDownloads(number, filesystemTools, workDir, log), token);

                break;

            case VkNet.Model.Attachments.Note note:      // note и page похожи
            case VkNet.Model.Attachments.Page page:



            // остальное похоже на хлам
            case VkNet.Model.Attachments.ApplicationContent applicationContent:
            case VkNet.Model.Attachments.AudioMessage audioMessage:
            case VkNet.Model.Attachments.Gift gift:
            case VkNet.Model.Attachments.Graffiti graffiti:
            case VkNet.Model.Attachments.MarketAlbum marketAlbum:
            case VkNet.Model.Attachments.PrettyCards prettyCards:
            case VkNet.Model.Attachments.Sticker sticker:
            case VkNet.Model.Attachments.StringLink stringLink:
            case VkNet.Model.Attachments.WallReply wallReply:
            default:
                log.Warn($"Not yet supported: attachment [{mediaAttachment.GetType().FullName}] {JsonConvert.SerializeObject(mediaAttachment)}");
                break;
            }
        }
    protected override void DrawSectionBody()
    {
        DemoGuiUtils.DrawRow(() =>
        {
            GUILayout.Label("Text: ", GSStyles.NormalLabelText);
            _text = GUILayout.TextField(_text, GSStyles.TextField);
        });

        DemoGuiUtils.DrawRow(() =>
        {
            GUILayout.Label("Image url: ", GSStyles.NormalLabelText);
        });
        DemoGuiUtils.DrawRow(() =>
        {
            _imageUrl = GUILayout.TextField(_imageUrl, GSStyles.TextField);
        });

        DemoGuiUtils.DrawRow(() =>
        {
            GUILayout.Label("Video url: ", GSStyles.NormalLabelText);
        });
        DemoGuiUtils.DrawRow(() =>
        {
            _videoUrl = GUILayout.TextField(_videoUrl, GSStyles.TextField);
        });

        DemoGuiUtils.DrawRow(() =>
        {
            _useCustomImage = GUILayout.Toggle(_useCustomImage, "", GSStyles.Toggle);
            GUILayout.Label("Send Custom Image", GSStyles.NormalLabelText, GUILayout.Width(Screen.width * 0.25f));
        });

        DemoGuiUtils.DrawRow(() =>
        {
            _useCustomVideo = GUILayout.Toggle(_useCustomVideo, "", GSStyles.Toggle);
            GUILayout.Label("Send Custom Video", GSStyles.NormalLabelText, GUILayout.Width(Screen.width * 0.25f));
        });


        DemoGuiUtils.DrawRow(() => GUILayout.Label("Button", GSStyles.NormalLabelText));
        DemoGuiUtils.DrawRow(() =>
        {
            GUILayout.Label("Title: ", GSStyles.NormalLabelText);
            _title = GUILayout.TextField(_title, GSStyles.TextField);
        });
        GUILayout.Label("Action: " + (_action ?? "Default"), GSStyles.NormalLabelText);
        DemoGuiUtils.DrawRow(() =>
        {
            if (GUILayout.Button("Default", GSStyles.ShortButton))
            {
                _action = null;
            }

            var actions = new[] { GetSocialActionType.Custom, GetSocialActionType.OpenProfile, GetSocialActionType.OpenActivity, GetSocialActionType.OpenInvites, GetSocialActionType.OpenUrl, GetSocialActionType.AddFriend };
            actions.ToList().ForEach(action =>
            {
                if (GUILayout.Button(action, GSStyles.ShortButton))
                {
                    _action = action;
                }
            });
        });

        DemoGuiUtils.DynamicRowFor(_actionData, "Action Data");
        DemoGuiUtils.DynamicRowFor(_properties, "Properties");

        if (GUILayout.Button("Post", GSStyles.Button))
        {
            var content = new ActivityContent();
            content.Text = _text;

            if (_action != null && _title != null && _title.Length != 0)
            {
                var action = GetSocialAction.Create(_action, _actionData.ToDictionary(data => data.Key, data => data.Val));
                content.Button = ActivityButton.Create(_title, action);
            }
            if (_imageUrl.Length > 0)
            {
                content.AddMediaAttachment(MediaAttachment.WithImageUrl(_imageUrl));
            }
            if (_videoUrl.Length > 0)
            {
                content.AddMediaAttachment(MediaAttachment.WithVideoUrl(_videoUrl));
            }
            if (_useCustomImage)
            {
                content.AddMediaAttachment(MediaAttachment.WithImage(Resources.Load <Texture2D>("activityImage")));
            }
            if (_useCustomVideo)
            {
                content.AddMediaAttachment(MediaAttachment.WithVideo(DemoUtils.LoadSampleVideoBytes()));
            }
            content.AddProperties(_properties.ToDictionary(data => data.Key, data => data.Val));

            if (Activity == null)
            {
                Communities.PostActivity(content, Target, posted =>
                {
                    _console.LogD("Posted: " + posted);
                }, error =>
                {
                    _console.LogE("Failed to post: " + error);
                });
            }
            else
            {
                Communities.UpdateActivity(Activity, content, posted =>
                {
                    _console.LogD("Updated: " + posted);
                }, error =>
                {
                    _console.LogE("Failed to update: " + error);
                });
            }
        }
    }