Example #1
0
        public async void GetHeadCommentReplies(InstaComment comment)
        {
            try
            {
                if (!comment.HasMoreHeadChildComments)
                {
                    return;
                }

                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
                {
                    if (comment.PaginationParameters == null)
                    {
                        comment.PaginationParameters = PaginationParameters.MaxPagesToLoad(1);
                    }

                    var result = await InstaApi.CommentProcessor.GetMediaRepliesCommentsAsync(MediaId, comment.Pk.ToString(), comment.PaginationParameters);
                    if (result.Succeeded)
                    {
                        if (result.Value.ChildComments?.Count > 0)
                        {
                            result.Value.ChildComments.Reverse();
                            result.Value.ChildComments.ForEach(cmt =>
                            {
                                cmt.IsCommentsDisabled = Media.IsCommentsDisabled;
                                comment.ChildComments.Add(cmt);
                            });
                        }
                        comment.NumTailChildComments     = result.Value.NumTailChildComments;
                        comment.HasMoreHeadChildComments = result.Value.HasMoreHeadChildComments;
                        comment.HasMoreTailChildComments = result.Value.HasMoreTailChildComments;
                    }
                });
            }
            catch { }
        }
 public CommentView(InstaComment comment, IInstaApi Api)
 {
     InitializeComponent();
     this.Comment = comment;
     this.Api     = Api;
 }