Exemplo n.º 1
0
 public FeedCombiner(PostDataObject post, List <AdapterModelsClass> diffList, Context context)
 {
     MainContext       = context;
     PostFeedType      = PostFunctions.GetAdapterType(post);
     PostModelResolver = new PostModelResolver(context, PostFeedType);
     PostCollection    = post;
     PostList          = diffList;
     TextDecorator     = new WoTextDecorator();
 }
Exemplo n.º 2
0
        private void InsertOnTopPostTextSection(bool isSharing = false)
        {
            if (isSharing)
            {
                var collection = PostCollection.SharedInfo.SharedInfoClass;

                var getSharedPostType = PostFunctions.GetAdapterType(collection);
                if (getSharedPostType == PostModelType.ColorPost)
                {
                    return;
                }


                if (string.IsNullOrEmpty(collection.Orginaltext))
                {
                    return;
                }

                PostModelResolver.PrepareTextSection(collection);

                var item = new AdapterModelsClass
                {
                    TypeView          = PostModelType.TextSectionPostPart,
                    Id                = int.Parse((int)PostModelType.TextSectionPostPart + collection.Id),
                    PostData          = collection,
                    IsDefaultFeedPost = true
                };

                CountIndex++;
                PostList.Insert(CountIndex, item);
            }
            else
            {
                if (PostFeedType == PostModelType.ColorPost)
                {
                    return;
                }

                if (string.IsNullOrEmpty(PostCollection.Orginaltext))
                {
                    return;
                }

                PostModelResolver.PrepareTextSection(PostCollection);

                var item = new AdapterModelsClass
                {
                    TypeView          = PostModelType.TextSectionPostPart,
                    Id                = int.Parse((int)PostModelType.TextSectionPostPart + PostCollection.Id),
                    PostData          = PostCollection,
                    IsDefaultFeedPost = true
                };
                CountIndex++;
                PostList.Insert(CountIndex, item);
            }
        }
Exemplo n.º 3
0
        public void NewPostTest()
        {
            LoginPage loginPage = new LoginPage(driver);

            Post post = TestPostGenerator.GeneratePost();

            PostFunctions postFunc = new PostFunctions(driver);

            postFunc.Post(post);

            NewPostPage newpost = new NewPostPage(driver);

            //Проверка, что пост создан успешно
            driver.Navigate().GoToUrl("http://192.168.99.100:3030");
            Assert.IsTrue(newpost.isNewPostPerformedSuccessfully(), "New post failed");
        }
Exemplo n.º 4
0
        public void PostLoad(XmlElement el, FDMExecutive fdmex, string prefix = "")
        {
            // Load model post-functions, if any
            XmlNodeList elemList = el.GetElementsByTagName("function");

            foreach (XmlNode node in elemList)
            {
                if (node.NodeType == XmlNodeType.Element)
                {
                    XmlElement function = node as XmlElement;
                    if (function.GetAttribute("type") == "post")
                    {
                        PostFunctions.Add(new Function(fdmex, function, prefix));
                    }
                }
            }
        }
Exemplo n.º 5
0
        public void OnClick(View v)
        {
            try
            {
                var postType = PostFunctions.GetAdapterType(PostObject);

                if (v.Id == Username.Id)
                {
                    PostClickListener.ProfilePostClick(new ProfileClickEventArgs {
                        NewsFeedClass = PostObject, View = MainView
                    }, "NewsFeedClass", "Username");
                }
                else if (v.Id == UserAvatar.Id)
                {
                    PostClickListener.ProfilePostClick(new ProfileClickEventArgs {
                        NewsFeedClass = PostObject, View = MainView
                    }, "NewsFeedClass", "UserAvatar");
                }
                else if (v.Id == MoreIcon.Id)
                {
                    PostClickListener.MorePostIconClick(new GlobalClickEventArgs {
                        NewsFeedClass = PostObject, View = MainView
                    });
                }
                else if (v.Id == LikeButton.Id)
                {
                    LikeButton.ClickLikeAndDisLike(new GlobalClickEventArgs {
                        NewsFeedClass = PostObject, View = MainView
                    }, null);
                }
                else if (v.Id == CommentLinearLayout.Id)
                {
                    PostClickListener.CommentPostClick(new GlobalClickEventArgs {
                        NewsFeedClass = PostObject, View = MainView
                    });
                }
                else if (v.Id == ShareLinearLayout.Id)
                {
                    PostClickListener.SharePostClick(new GlobalClickEventArgs {
                        NewsFeedClass = PostObject, View = MainView
                    }, postType);
                }
                else if (v.Id == SecondReactionButton.Id)
                {
                    PostClickListener.SecondReactionButtonClick(new GlobalClickEventArgs {
                        NewsFeedClass = PostObject, View = MainView
                    });
                }
                else if (v.Id == LikeCount.Id)
                {
                    PostClickListener.DataItemPostClick(new GlobalClickEventArgs {
                        NewsFeedClass = PostObject, View = MainView
                    });
                }
                else if (v.Id == CommentCount.Id)
                {
                    PostClickListener.CommentPostClick(new GlobalClickEventArgs {
                        NewsFeedClass = PostObject, View = MainView
                    });
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Exemplo n.º 6
0
        //public SpannableString SetupStrings(PostDataObject item, Context mainContext)
        //{
        //    try
        //    {
        //        if (item == null)
        //            return null!;

        //        UserDataObject publisher = item.Publisher ?? item.UserData;

        //        var username = Methods.FunString.DecodeString(WoWonderTools.GetNameFinal(publisher));
        //        var textHighLighter = username;
        //        var textIsPro = string.Empty;
        //        var textFeelings = string.Empty;
        //        var textTraveling = string.Empty;
        //        var textWatching = string.Empty;
        //        var textPlaying = string.Empty;
        //        var textListening = string.Empty;
        //        var textProduct = string.Empty;
        //        var textArticle = string.Empty;
        //        var textEvent = string.Empty;
        //        var textPurpleFund = string.Empty;
        //        var textOffer = string.Empty;
        //        var textFundData = string.Empty;
        //        var textLocation = string.Empty;
        //        var textAlbumName = string.Empty;
        //        var textImageChange = string.Empty;
        //        var textShare = string.Empty;
        //        var textGroupRecipient = string.Empty;
        //        var textUserRecipient = string.Empty;

        //        if (publisher.Verified == "1")
        //            textHighLighter += " " + IonIconsFonts.CheckmarkCircle;

        //        if (publisher.IsPro == "1")
        //        {
        //            textIsPro = " " + IonIconsFonts.Flash;
        //            textHighLighter += textIsPro;
        //        }

        //        if (!string.IsNullOrEmpty(item.PostFeeling) && item.SharedInfo.SharedInfoClass == null)
        //        {
        //            textFeelings = " " + mainContext.GetString(Resource.String.Lbl_IsFeeling) + " " + PostFunctions.GetFeelingTypeIcon(item.PostFeeling) + " " + PostFunctions.GetFeelingTypeTextString(item.PostFeeling, mainContext);
        //            textHighLighter += textFeelings;
        //        }

        //        if (!string.IsNullOrEmpty(item.PostTraveling))
        //        {
        //            textTraveling = "  " + IonIconsFonts.Plane + " " + mainContext.GetText(Resource.String.Lbl_IsTravelingTo) + " " + item.PostTraveling;
        //            textHighLighter += textTraveling;
        //        }

        //        if (!string.IsNullOrEmpty(item.PostWatching))
        //        {
        //            textWatching = "  " + IonIconsFonts.Eye + " " + mainContext.GetText(Resource.String.Lbl_IsWatching) + " " + item.PostWatching;
        //            textHighLighter += textWatching;
        //        }

        //        if (!string.IsNullOrEmpty(item.PostPlaying))
        //        {
        //            textPlaying = "  " + IonIconsFonts.LogoGameControllerB + " " + mainContext.GetText(Resource.String.Lbl_IsPlaying) + " " + item.PostPlaying;
        //            textHighLighter += textPlaying;
        //        }

        //        if (!string.IsNullOrEmpty(item.PostListening))
        //        {
        //            textListening = "  " + IonIconsFonts.Headphone + " " + mainContext.GetText(Resource.String.Lbl_IsListeningTo) + " " + item.PostListening;
        //            textHighLighter += textListening;
        //        }

        //        if (!string.IsNullOrEmpty(item.PostMap))
        //        {
        //            textLocation = "  " + IonIconsFonts.Pin + " " + item.PostMap.Replace("/", "");
        //            textHighLighter += textLocation;
        //        }

        //        if (item.PostType == "profile_cover_picture" && item.SharedInfo.SharedInfoClass == null)
        //        {
        //            textImageChange += " " + mainContext.GetText(Resource.String.Lbl_ChangedProfileCover) + " ";
        //            textHighLighter += textImageChange;
        //        }

        //        if (item.PostType == "profile_picture" && item.SharedInfo.SharedInfoClass == null)
        //        {
        //            textImageChange += " " + mainContext.GetText(Resource.String.Lbl_ChangedProfilePicture) + " ";
        //            textHighLighter += textImageChange;
        //        }

        //        if (!string.IsNullOrEmpty(item.PostType) && item.PostType == "live" && !string.IsNullOrEmpty(item.StreamName))
        //        {
        //            textImageChange += " " + mainContext.GetText(Resource.String.Lbl_WasLive) + " ";
        //            textHighLighter += textImageChange;
        //        }

        //        if (item.Product != null && item.SharedInfo.SharedInfoClass == null)
        //        {
        //            textProduct = " " + mainContext.GetText(Resource.String.Lbl_AddedNewProductForSell) + " ";
        //            textHighLighter += textProduct;
        //        }

        //        if (item.Blog != null && item.SharedInfo.SharedInfoClass == null)
        //        {
        //            textArticle = " " + mainContext.GetText(Resource.String.Lbl_CreatedNewArticle) + " ";
        //            textHighLighter += textArticle;
        //        }

        //        if (item.Event?.EventClass != null && item.SharedInfo.SharedInfoClass == null)
        //        {
        //            textEvent = "  " + IonIconsFonts.ArrowRightC + " " + mainContext.GetText(Resource.String.Lbl_CreatedNewEvent) + " ";
        //            textHighLighter += textEvent;
        //        }

        //        if (!string.IsNullOrEmpty(item.AlbumName) && item.AlbumName != null && item.SharedInfo.SharedInfoClass == null)
        //        {
        //            textAlbumName = " " + mainContext.GetText(Resource.String.Lbl_addedNewPhotosTo) + " " + Methods.FunString.DecodeString(item.AlbumName);
        //            textHighLighter += textAlbumName;
        //        }

        //        if (item.FundData?.FundDataClass != null && item.SharedInfo.SharedInfoClass == null)
        //        {
        //            textFundData = " " + mainContext.GetText(Resource.String.Lbl_CreatedNewFund) + " ";
        //            textHighLighter += textFundData;
        //        }

        //        if (item.Fund?.PurpleFund != null && item.SharedInfo.SharedInfoClass == null)
        //        {
        //            textPurpleFund = " " + mainContext.GetText(Resource.String.Lbl_DonatedRequestFund) + " ";
        //            textHighLighter += textPurpleFund;
        //        }

        //        if (item.Offer != null && item.PostType == "offer")
        //        {
        //            textOffer = " " + mainContext.GetText(Resource.String.Lbl_OfferPostAdded) + " ";
        //            textHighLighter += textOffer;
        //        }

        //        if (item.ParentId != "0")
        //        {
        //            textShare += " " + mainContext.GetText(Resource.String.Lbl_SharedPost) + " ";

        //            //if (item.SharedInfo.SharedInfoClass?.Publisher != null)
        //            //    textShare += WoWonderTools.GetNameFinal(item.SharedInfo.SharedInfoClass.Publisher);

        //            textHighLighter += textShare;
        //        }

        //        if (item.GroupRecipientExists != null && item.GroupRecipientExists.Value && !string.IsNullOrEmpty(item.GroupRecipient.GroupName))
        //        {
        //            textUserRecipient += " " + IonIconsFonts.ArrowRightC + " " + Methods.FunString.DecodeString(item.GroupRecipient.GroupName);
        //            textHighLighter += textUserRecipient;
        //        }
        //        else if (item.RecipientExists != null && item.RecipientExists.Value && item.Recipient.RecipientClass != null)
        //        {
        //            textUserRecipient += " " + IonIconsFonts.ArrowRightC + " " + Methods.FunString.DecodeString(WoWonderTools.GetNameFinal(item.Recipient.RecipientClass));
        //            textHighLighter += textUserRecipient;
        //        }

        //        Content = textHighLighter;
        //        DecoratedContent = new SpannableString(textHighLighter);

        //        SetTextStyle(username, TypefaceStyle.Bold);

        //        if (publisher.Verified == "1")
        //            SetTextColor(IonIconsFonts.CheckmarkCircle, "#55acee");

        //        if (publisher.IsPro == "1")
        //            SetTextColor(textIsPro, "#888888");

        //        if (!string.IsNullOrEmpty(item.PostFeeling))
        //            SetTextColor(textFeelings, "#888888");

        //        if (!string.IsNullOrEmpty(item.PostTraveling))
        //        {
        //            SetTextColor(textTraveling, "#888888");
        //            SetTextColor(IonIconsFonts.Plane, "#3F51B5");
        //            SetRelativeSize(IonIconsFonts.Plane, 1.3f);
        //        }

        //        if (!string.IsNullOrEmpty(item.PostWatching))
        //        {
        //            SetTextColor(textWatching, "#888888");
        //            SetTextColor(IonIconsFonts.Eye, "#E91E63");
        //            SetRelativeSize(IonIconsFonts.Eye, 1.3f);
        //        }

        //        if (!string.IsNullOrEmpty(item.PostPlaying))
        //        {
        //            SetTextColor(textPlaying, "#888888");
        //            SetTextColor(IonIconsFonts.LogoGameControllerB, "#FF9800");
        //            SetRelativeSize(IonIconsFonts.LogoGameControllerB, 1.3f);
        //        }

        //        if (!string.IsNullOrEmpty(item.PostListening))
        //        {
        //            SetTextColor(textListening, "#888888");
        //            SetTextColor(IonIconsFonts.Headphone, "#03A9F4");
        //            SetRelativeSize(IonIconsFonts.Headphone, 1.3f);
        //        }

        //        if (!string.IsNullOrEmpty(item.PostMap))
        //        {
        //            SetTextColor(textLocation, "#888888");
        //            SetTextColor(IonIconsFonts.Pin, "#E91E63");
        //            SetRelativeSize(IonIconsFonts.Pin, 1.3f);
        //        }

        //        if (item.PostType == "profile_cover_picture" || item.PostType == "profile_picture")
        //            SetTextColor(textImageChange, "#888888");

        //        if (item.Product != null)
        //            SetTextColor(textProduct, "#888888");

        //        if (item.Blog != null)
        //            SetTextColor(textArticle, "#888888");

        //        if (item.Event?.EventClass != null)
        //        {
        //            SetTextColor(textEvent, "#888888");
        //            SetRelativeSize(IonIconsFonts.ArrowRightC, 1.0f);
        //        }

        //        if (item.FundData?.FundDataClass != null)
        //            SetTextColor(textFundData, "#888888");

        //        if (item.Fund?.PurpleFund != null)
        //            SetTextColor(textPurpleFund, "#888888");

        //        if (item.Offer.HasValue && item.PostType == "offer")
        //            SetTextColor(textOffer, "#888888");

        //        if (item.ParentId != "0")
        //            SetTextColor(textShare, "#888888");

        //        if (item.GroupRecipientExists != null && item.GroupRecipientExists.Value)
        //        {
        //            SetTextColor(textShare, "#888888");
        //            SetTextStyle(textGroupRecipient, TypefaceStyle.Bold);
        //            SetRelativeSize(IonIconsFonts.ArrowRightC, 1.0f);
        //        }
        //        else if (item.RecipientExists != null && item.RecipientExists.Value)
        //        {
        //            SetTextStyle(textUserRecipient, TypefaceStyle.Bold);
        //            SetRelativeSize(IonIconsFonts.ArrowRightC, 1.0f);
        //        }

        //        if (!string.IsNullOrEmpty(item.AlbumName) && item.AlbumName != null)
        //            SetTextColor(textAlbumName, "#888888");

        //        return DecoratedContent;
        //    }
        //    catch (Exception e)
        //    {
        //        Methods.DisplayReportResultTrack(e);
        //        return DecoratedContent;
        //    }
        //}

        #endregion

        public SpannableString SetupStrings(PostDataObject item, Context mainContext)
        {
            try
            {
                if (item == null)
                {
                    return(null !);
                }

                UserDataObject publisher = item.Publisher ?? item.UserData;

                var    username        = Methods.FunString.DecodeString(WoWonderTools.GetNameFinal(publisher));
                var    textHighLighter = username;
                string textEvent;
                string textImageChange = string.Empty, textShare = string.Empty;

                if (publisher.Verified == "1")
                {
                    textHighLighter += " " + "[img src=icon_checkmark_small_vector/]";
                }

                if (publisher.IsPro == "1")
                {
                    var textIsPro = " " + "[img src=post_icon_flash/]";
                    textHighLighter += textIsPro;
                }

                if (!string.IsNullOrEmpty(item.PostFeeling) && item.SharedInfo.SharedInfoClass == null)
                {
                    var textFeelings = " " + mainContext.GetString(Resource.String.Lbl_IsFeeling) + " " + PostFunctions.GetFeelingTypeIcon(item.PostFeeling) + " " + PostFunctions.GetFeelingTypeTextString(item.PostFeeling, mainContext);
                    textHighLighter += textFeelings;
                }

                if (!string.IsNullOrEmpty(item.PostTraveling))
                {
                    var textTraveling = "  " + "[img src=post_icon_airplane/]" + " " + mainContext.GetText(Resource.String.Lbl_IsTravelingTo) + " " + item.PostTraveling;
                    textHighLighter += textTraveling;
                }

                if (!string.IsNullOrEmpty(item.PostWatching))
                {
                    var textWatching = "  " + "[img src=post_icon_eye/]" + " " + mainContext.GetText(Resource.String.Lbl_IsWatching) + " " + item.PostWatching;
                    textHighLighter += textWatching;
                }

                if (!string.IsNullOrEmpty(item.PostPlaying))
                {
                    var textPlaying = "  " + "[img src=post_icon_game_controller_b/]" + " " + mainContext.GetText(Resource.String.Lbl_IsPlaying) + " " + item.PostPlaying;
                    textHighLighter += textPlaying;
                }

                if (!string.IsNullOrEmpty(item.PostListening))
                {
                    var textListening = "  " + "[img src=post_icon_musical_notes/]" + " " + mainContext.GetText(Resource.String.Lbl_IsListeningTo) + " " + item.PostListening;
                    textHighLighter += textListening;
                }

                if (!string.IsNullOrEmpty(item.PostMap))
                {
                    var textLocation = "  " + "[img src=post_icon_pin/]" + " " + item.PostMap.Replace("/", "");
                    textHighLighter += textLocation;
                }

                if (item.PostType == "profile_cover_picture" && item.SharedInfo.SharedInfoClass == null)
                {
                    textImageChange += " " + mainContext.GetText(Resource.String.Lbl_ChangedProfileCover) + " ";
                    textHighLighter += textImageChange;
                }

                if (item.PostType == "profile_picture" && item.SharedInfo.SharedInfoClass == null)
                {
                    textImageChange += " " + mainContext.GetText(Resource.String.Lbl_ChangedProfilePicture) + " ";
                    textHighLighter += textImageChange;
                }

                if (!string.IsNullOrEmpty(item.PostType) && item.PostType == "live" && !string.IsNullOrEmpty(item.StreamName))
                {
                    if (item?.LiveTime != null && item.LiveTime.Value > 0)
                    {
                        textImageChange += " " + mainContext.GetText(Resource.String.Lbl_IsLiveNow) + " ";
                    }
                    else
                    {
                        textImageChange += " " + mainContext.GetText(Resource.String.Lbl_WasLive) + " ";
                    }

                    textHighLighter += textImageChange;
                }

                if (item.Product != null && item.SharedInfo.SharedInfoClass == null)
                {
                    var textProduct = " " + mainContext.GetText(Resource.String.Lbl_AddedNewProductForSell) + " ";
                    textHighLighter += textProduct;
                }

                if (item.Blog != null && item.SharedInfo.SharedInfoClass == null)
                {
                    var textArticle = " " + mainContext.GetText(Resource.String.Lbl_CreatedNewArticle) + " ";
                    textHighLighter += textArticle;
                }

                if (item.Event?.EventClass != null && item.SharedInfo.SharedInfoClass == null && Convert.ToInt32(item.PageEventId) > 0)
                {
                    textEvent        = " " + "[img src=post_icon_arrow_forward/]" + " " + mainContext.GetText(Resource.String.Lbl_CreatedNewEvent) + " "; //IonIconsFonts.ArrowRightC
                    textHighLighter += textEvent;
                }

                if (item.Event?.EventClass != null && item.SharedInfo.SharedInfoClass == null && Convert.ToInt32(item.EventId) > 0)
                {
                    textEvent        = " " + "[img src=post_icon_arrow_forward/]" + " " + Methods.FunString.DecodeString(item.Event?.EventClass.Name); //IonIconsFonts.ArrowRightC
                    textHighLighter += textEvent;
                }

                if (!string.IsNullOrEmpty(item.AlbumName) && item.AlbumName != null && item.SharedInfo.SharedInfoClass == null)
                {
                    var textAlbumName = " " + mainContext.GetText(Resource.String.Lbl_addedNewPhotosTo) + " " + Methods.FunString.DecodeString(item.AlbumName);
                    textHighLighter += textAlbumName;
                }

                if (item.FundData?.FundDataClass != null && item.SharedInfo.SharedInfoClass == null)
                {
                    var textFundData = " " + mainContext.GetText(Resource.String.Lbl_CreatedNewFund) + " ";
                    textHighLighter += textFundData;
                }

                if (item.Fund?.PurpleFund != null && item.SharedInfo.SharedInfoClass == null)
                {
                    var textPurpleFund = " " + mainContext.GetText(Resource.String.Lbl_DonatedRequestFund) + " ";
                    textHighLighter += textPurpleFund;
                }

                if (item.Offer != null && item.PostType == "offer")
                {
                    var textOffer = " " + mainContext.GetText(Resource.String.Lbl_OfferPostAdded) + " ";
                    textHighLighter += textOffer;
                }

                if (item.ParentId != "0")
                {
                    if (item.GroupRecipientExists != null && item.GroupRecipientExists.Value && !string.IsNullOrEmpty(item.GroupRecipient.GroupName))
                    {
                        textShare       += " " + "[img src=post_icon_arrow_forward/]" + " " + Methods.FunString.DecodeString(item.GroupRecipient.GroupName); //IonIconsFonts.ArrowRightC
                        textHighLighter += textShare;
                    }
                    else if (item.RecipientExists != null && item.RecipientExists.Value && item.Recipient.RecipientClass != null)
                    {
                        textShare       += " " + "[img src=post_icon_arrow_forward/]" + " " + WoWonderTools.GetNameFinal(item.Recipient.RecipientClass); //IonIconsFonts.ArrowRightC
                        textHighLighter += textShare;
                    }
                    else
                    {
                        textShare += " " + mainContext.GetText(Resource.String.Lbl_SharedPost) + " ";

                        //if (item.SharedInfo.SharedInfoClass?.Publisher != null)
                        //    textShare += WoWonderTools.GetNameFinal(item.SharedInfo.SharedInfoClass.Publisher);

                        textHighLighter += textShare;
                    }
                }
                else
                {
                    if (item.GroupRecipientExists != null && item.GroupRecipientExists.Value && !string.IsNullOrEmpty(item.GroupRecipient.GroupName))
                    {
                        textShare       += " " + "[img src=post_icon_arrow_forward/]" + " " + Methods.FunString.DecodeString(item.GroupRecipient.GroupName); //IonIconsFonts.ArrowRightC
                        textHighLighter += textShare;
                    }
                    else if (item.RecipientExists != null && item.RecipientExists.Value && item.Recipient.RecipientClass != null)
                    {
                        textShare       += " " + "[img src=post_icon_arrow_forward/]" + " " + WoWonderTools.GetNameFinal(item.Recipient.RecipientClass); //IonIconsFonts.ArrowRightC
                        textHighLighter += textShare;
                    }
                }

                Content          = textHighLighter;
                DecoratedContent = new SpannableString(textHighLighter);

                //SetTextStyle(username, TypefaceStyle.Bold);
                TextViewWithImages.Publisher = publisher;
                DecoratedContent             = TextViewWithImages.GetTextWithImages(item, mainContext, new Java.Lang.String(textHighLighter.ToArray(), 0, textHighLighter.Length));

                return(DecoratedContent);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
                return(null !);
            }
        }
Exemplo n.º 7
0
        // Insert Post
        //=====================================
        private void InsertOnTopAutoSection(bool isSharing = false)
        {
            try
            {
                if (isSharing)
                {
                    var getSharedPostType = PostFunctions.GetAdapterType(PostCollection.SharedInfo.SharedInfoClass);

                    var collection = PostCollection.SharedInfo.SharedInfoClass;

                    switch (getSharedPostType)
                    {
                    case PostModelType.BlogPost:
                        PostModelResolver.PrepareBlog(collection);
                        break;

                    case PostModelType.EventPost:
                        PostModelResolver.PrepareEvent(collection);
                        if (Convert.ToInt32(collection.EventId) > 0)
                        {
                            return;
                        }
                        break;

                    case PostModelType.ColorPost:
                        PostModelResolver.PrepareColorBox(collection);
                        break;

                    case PostModelType.LinkPost:
                        PostModelResolver.PrepareLink(collection);
                        break;

                    case PostModelType.ProductPost:
                        PostModelResolver.PrepareProduct(collection);
                        break;

                    case PostModelType.FundingPost:
                        PostModelResolver.PrepareFunding(collection);
                        break;

                    case PostModelType.OfferPost:
                        PostModelResolver.PrepareOffer(collection);
                        break;

                    case PostModelType.MapPost:
                        PostModelResolver.PrepareMapPost(collection);
                        break;

                    case PostModelType.PollPost:
                    case PostModelType.AdsPost:
                    case PostModelType.AdMob:
                    case PostModelType.FbAdNative:
                        return;

                    case PostModelType.VideoPost:
                        WRecyclerView.GetInstance()?.CacheVideosFiles(Uri.Parse(collection.PostFileFull));
                        break;

                    case PostModelType.JobPost:
                        AddJobPost();
                        return;
                    }

                    var item = new AdapterModelsClass
                    {
                        TypeView          = getSharedPostType,
                        Id                = int.Parse((int)getSharedPostType + collection.Id),
                        PostData          = collection,
                        IsDefaultFeedPost = true
                    };

                    CountIndex++;
                    PostList.Insert(CountIndex, item);
                }
                else
                {
                    switch (PostFeedType)
                    {
                    case PostModelType.BlogPost:
                        PostModelResolver.PrepareBlog(PostCollection);
                        break;

                    case PostModelType.EventPost:
                        PostModelResolver.PrepareEvent(PostCollection);
                        if (Convert.ToInt32(PostCollection.EventId) > 0)
                        {
                            return;
                        }
                        break;

                    case PostModelType.ColorPost:
                        PostModelResolver.PrepareColorBox(PostCollection);
                        break;

                    case PostModelType.LinkPost:
                        PostModelResolver.PrepareLink(PostCollection);
                        break;

                    case PostModelType.ProductPost:
                        PostModelResolver.PrepareProduct(PostCollection);
                        break;

                    case PostModelType.FundingPost:
                        PostModelResolver.PrepareFunding(PostCollection);
                        break;

                    case PostModelType.OfferPost:
                        PostModelResolver.PrepareOffer(PostCollection);
                        break;

                    case PostModelType.MapPost:
                        PostModelResolver.PrepareMapPost(PostCollection);
                        break;

                    case PostModelType.PollPost:
                    case PostModelType.AdsPost:
                    case PostModelType.AdMob:
                    case PostModelType.FbAdNative:
                        return;

                    case PostModelType.VideoPost:
                        WRecyclerView.GetInstance()?.CacheVideosFiles(Uri.Parse(PostCollection.PostFileFull));
                        break;

                    case PostModelType.JobPost:
                        AddJobPost();
                        return;

                    case PostModelType.SharedPost:
                        InsertOnTopSharedPost();
                        return;
                    }

                    var item = new AdapterModelsClass
                    {
                        TypeView                 = PostFeedType,
                        Id                       = int.Parse((int)PostFeedType + PostCollection.Id),
                        PostData                 = PostCollection,
                        IsDefaultFeedPost        = true,
                        PostDataDecoratedContent = TextDecorator.SetupStrings(PostCollection, MainContext),
                    };

                    CountIndex++;
                    PostList.Insert(CountIndex, item);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }