示例#1
0
        public void AddPollsPostView()
        {
            if (PostCollection.Options != null)
            {
                var count = PostCollection.Options.Count;
                if (count > 0)
                {
                    foreach (var poll in PostCollection.Options)
                    {
                        PostModelResolver.PreparePoll(poll);

                        poll.PostId = PostCollection.Id;
                        poll.RelatedToPollsCount = count;

                        var i = new AdapterModelsClass
                        {
                            TypeView = PostModelType.PollPost,
                            Id       = int.Parse((int)PostModelType.PollPost + PostCollection.Id),

                            PostData          = PostCollection,
                            IsDefaultFeedPost = true,
                            PollId            = poll.Id,
                            PollsOption       = poll,
                            PollOwnerUserId   = PostCollection.Publisher?.UserId
                        };
                        PostList.Add(i);
                    }
                }
            }
        }
示例#2
0
        public void AddJobPost()
        {
            if (PostCollection.Job != null)
            {
                PostModelResolver.PrepareJob(PostCollection);

                var i = new AdapterModelsClass
                {
                    TypeView = PostModelType.JobPostSection1,
                    Id       = int.Parse((int)PostModelType.JobPostSection1 + PostCollection.Id),

                    PostData          = PostCollection,
                    IsDefaultFeedPost = true
                };
                var i2 = new AdapterModelsClass
                {
                    TypeView = PostModelType.JobPostSection2,
                    Id       = int.Parse((int)PostModelType.JobPostSection2 + PostCollection.Id),

                    PostData          = PostCollection,
                    IsDefaultFeedPost = true
                };

                PostList.Add(i);
                PostList.Add(i2);
            }
        }
        private void DestroyBasic()
        {
            try
            {
                MAdView?.Destroy();
                RewardedVideoAd?.OnDestroy(this);

                MAdapter           = null;
                SwipeRefreshLayout = null;
                MRecycler          = null;
                EmptyStateLayout   = null;
                Inflated           = null;
                RewardedVideoAd    = null;
                MAdView            = null;
                AdapterModelsClass = null;
                FollowersModel     = null;
                GroupsModel        = null;
                PagesModel         = null;
                ImagesModel        = null;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
示例#4
0
        public void AddPostCommentAbility()
        {
            if (PostCollection == null || PostCollection.PostComments == "0" || PostCollection.GetPostComments.Count == 0)
            {
                return;
            }

            var check = PostCollection.GetPostComments.FirstOrDefault(banjo => string.IsNullOrEmpty(banjo.CFile) && string.IsNullOrEmpty(banjo.Record));

            if (check == null)
            {
                return;
            }

            var item1 = new AdapterModelsClass
            {
                TypeView          = PostModelType.CommentSection,
                Id                = int.Parse((int)PostModelType.CommentSection + PostCollection?.Id),
                PostData          = PostCollection,
                IsDefaultFeedPost = true
            };

            PostList.Add(item1);

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

            PostList.Add(item);
        }
示例#5
0
        public void AddPostHeader(bool isSharing = false)
        {
            if (isSharing)
            {
                var collection = PostCollection.SharedInfo.SharedInfoClass;
                PostModelResolver.PrepareHeader(collection);
                var item = new AdapterModelsClass
                {
                    TypeView          = PostModelType.SharedHeaderPost,
                    Id                = int.Parse((int)PostModelType.SharedHeaderPost + collection.Id),
                    PostData          = collection,
                    IsDefaultFeedPost = true,
                };
                PostList.Add(item);
            }
            else
            {
                PostModelResolver.PrepareHeader(PostCollection);
                var item = new AdapterModelsClass
                {
                    TypeView = PostModelType.HeaderPost,

                    Id                       = int.Parse((int)PostModelType.HeaderPost + PostCollection.Id),
                    PostData                 = PostCollection,
                    IsDefaultFeedPost        = true,
                    PostDataDecoratedContent = TextDecorator.SetupStrings(PostCollection, MainContext),
                };
                PostList.Add(item);
            }
        }
示例#6
0
        private void LoadFriendsLayout(List <UserDataObject> followers, string friendsCounter)
        {
            try
            {
                var time = Methods.Time.TimeAgo(Convert.ToInt32(followers.FirstOrDefault()?.Time ?? "0"), false);

                var followersClass = new FollowersModelClass
                {
                    TitleHead     = GetText(Resource.String.Lbl_Friendversaries) + " " + time,
                    FollowersList = new List <UserDataObject>(followers),
                    More          = friendsCounter
                };

                var followersBox = new AdapterModelsClass
                {
                    TypeView       = PostModelType.FollowersBox,
                    Id             = 1111111111,
                    FollowersModel = followersClass
                };

                PostFeedAdapter.ListDiffer.Insert(0, followersBox);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
示例#7
0
        private void DestroyBasic()
        {
            try
            {
                MAdView?.Destroy();


                MAdapter           = null !;
                SwipeRefreshLayout = null !;
                MRecycler          = null !;
                EmptyStateLayout   = null !;
                Inflated           = null !;

                MAdView            = null !;
                AdapterModelsClass = null !;
                FollowersModel     = null !;
                GroupsModel        = null !;
                PagesModel         = null !;
                ImagesModel        = null !;
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
示例#8
0
        private async Task LoadMemories(string type = "all")
        {
            if (Methods.CheckConnectivity())
            {
                var(apiStatus, respond) = await RequestsAsync.Posts.FetchMemoriesPost(type);

                if (apiStatus.Equals(200))
                {
                    if (respond is FetchMemoriesObject result)
                    {
                        var respondListFriends = result.Data.Friends.Count;
                        if (respondListFriends > 0)
                        {
                            LoadFriendsLayout(result.Data.Friends, Methods.FunString.FormatPriceValue(result.Data.Friends.Count));
                        }

                        if (result.Data.Posts.Count > 0)
                        {
                            var time    = Methods.Time.TimeAgo(Convert.ToInt32(result.Data.Posts.FirstOrDefault()?.Time ?? "0"), false);
                            var section = new AdapterModelsClass
                            {
                                Id         = 000001010101,
                                AboutModel = new AboutModelClass
                                {
                                    TitleHead = GetText(Resource.String.Lbl_Post) + " " + time
                                },
                                TypeView = PostModelType.Section
                            };

                            PostFeedAdapter.ListDiffer.Add(section);
                            PostFeedAdapter.NotifyDataSetChanged();
                        }

                        MainRecyclerView.ApiPostAsync.LoadMemoriesDataApi(apiStatus, respond, PostFeedAdapter.ListDiffer);
                    }
                }
                else
                {
                    Methods.DisplayReportResult(this, respond);
                }

                RunOnUiThread(ShowEmptyPage);
            }
            else
            {
                Inflated = EmptyStateLayout.Inflate();
                EmptyStateInflater x = new EmptyStateInflater();
                x.InflateLayout(Inflated, EmptyStateInflater.Type.NoConnection);
                if (!x.EmptyStateButton.HasOnClickListeners)
                {
                    x.EmptyStateButton.Click += null !;
                    x.EmptyStateButton.Click += EmptyStateButtonOnClick;
                }

                Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show();
            }
        }
示例#9
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);
            }
        }
示例#10
0
        public void SearchForPostsView(string type, PostDataObject postData = null)
        {
            var item = new AdapterModelsClass
            {
                TypeView = PostModelType.SearchForPosts,
                TypePost = type,
                Id       = 2321,
                PostData = postData
            };

            PostList.Add(item);
            AddPostDivider();
        }
示例#11
0
        private void InsertOnTopPostFooter()
        {
            var item = new AdapterModelsClass
            {
                TypeView          = PostModelType.BottomPostPart,
                Id                = int.Parse((int)PostModelType.BottomPostPart + PostCollection.Id),
                PostData          = PostCollection,
                IsDefaultFeedPost = true
            };

            CountIndex++;
            PostList.Insert(CountIndex, item);
        }
示例#12
0
        public void InsertOnTopPostPromote(bool isSharing = false)
        {
            bool isPromoted = false;

            if (isSharing)
            {
                var collection = PostCollection.SharedInfo.SharedInfoClass;

                if (collection.IsPostBoosted == "1" || collection.SharedInfo.SharedInfoClass != null && collection.SharedInfo.SharedInfoClass?.IsPostBoosted == "1")
                {
                    isPromoted = true;
                }

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

                    CountIndex++;
                    PostList.Insert(CountIndex, item);
                }
            }
            else
            {
                if (PostCollection.IsPostBoosted == "1" || PostCollection.SharedInfo.SharedInfoClass != null && PostCollection.SharedInfo.SharedInfoClass?.IsPostBoosted == "1")
                {
                    isPromoted = true;
                }

                if (isPromoted)
                {
                    var item = new AdapterModelsClass
                    {
                        TypeView                 = PostModelType.PromotePost,
                        Id                       = int.Parse((int)PostModelType.PromotePost + PostCollection.Id),
                        PostData                 = PostCollection,
                        IsDefaultFeedPost        = true,
                        PostDataDecoratedContent = TextDecorator.SetupStrings(PostCollection, MainContext),
                    };
                    CountIndex++;
                    PostList.Insert(CountIndex, item);
                }
            }
        }
示例#13
0
        public void AddStoryPostView()
        {
            if (AppSettings.ShowStory)
            {
                var story = new AdapterModelsClass
                {
                    TypeView  = PostModelType.Story,
                    StoryList = new ObservableCollection <GetUserStoriesObject.StoryObject>(),
                    Id        = 545454545
                };

                PostList.Add(story);
                AddPostDivider();
            }
        }
示例#14
0
        public void AddPostPrevBottom()
        {
            PostModelResolver.PreparePostPrevBottom(PostCollection);

            var item = new AdapterModelsClass
            {
                TypeView = PostModelType.PrevBottomPostPart,
                Id       = int.Parse((int)PostModelType.PrevBottomPostPart + PostCollection.Id),

                PostData          = PostCollection,
                IsDefaultFeedPost = true
            };

            PostList.Add(item);
        }
示例#15
0
        public void AddPostPromote(bool isSharing = false)
        {
            bool isPromoted = false;

            if (isSharing)
            {
                var collection = PostCollection.SharedInfo.SharedInfoClass;

                if (collection.IsPostBoosted == "1" || collection.SharedInfo.SharedInfoClass != null && collection.SharedInfo.SharedInfoClass?.IsPostBoosted == "1")
                {
                    isPromoted = true;
                }

                if (isPromoted)
                {
                    var item = new AdapterModelsClass
                    {
                        TypeView          = PostModelType.PromotePost,
                        Id                = int.Parse((int)PostModelType.PromotePost + collection.Id),
                        PostData          = collection,
                        IsDefaultFeedPost = true,
                    };
                    PostList.Add(item);
                }
            }
            else
            {
                if (PostCollection.IsPostBoosted == "1" || PostCollection.SharedInfo.SharedInfoClass != null && PostCollection.SharedInfo.SharedInfoClass?.IsPostBoosted == "1")
                {
                    isPromoted = true;
                }

                if (isPromoted)
                {
                    var item = new AdapterModelsClass
                    {
                        TypeView = PostModelType.PromotePost,

                        Id                = int.Parse((int)PostModelType.PromotePost + PostCollection.Id),
                        PostData          = PostCollection,
                        IsDefaultFeedPost = true,
                    };
                    PostList.Add(item);
                }
            }
        }
        public AdapterModelsClass SetFindMoreAlert(string type)
        {
            try
            {
                var alertModel1 = new AlertModelClass();
                if (type == "Groups")
                {
                    alertModel1 = new AlertModelClass
                    {
                        TitleHead     = MainContext.GetString(Resource.String.Lbl_Groups),
                        SubText       = MainContext.GetString(Resource.String.Lbl_FindMoreAler_TextGroups),
                        TypeAlert     = "Groups",
                        ImageDrawable = Resource.Drawable.image2,
                        IconImage     = Resource.Drawable.shareGroup,
                    };
                }
                else if (type == "Pages")
                {
                    alertModel1 = new AlertModelClass
                    {
                        TitleHead     = MainContext.GetString(Resource.String.Lbl_Pages),
                        SubText       = MainContext.GetString(Resource.String.Lbl_FindMoreAler_TextPages),
                        TypeAlert     = "Pages",
                        ImageDrawable = Resource.Drawable.image1,
                        IconImage     = Resource.Drawable.sharePage,
                    };
                }

                var addAlertJoinBox = new AdapterModelsClass
                {
                    TypeView   = PostModelType.AlertJoinBox,
                    Id         = DateTime.Now.Millisecond,
                    AlertModel = alertModel1
                };

                return(addAlertJoinBox);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(null);
            }
        }
示例#17
0
        public void FollowersBoxPostView(FollowersModelClass modelClass, int index)
        {
            var item = new AdapterModelsClass
            {
                TypeView       = PostModelType.FollowersBox,
                Id             = 1111111111,
                FollowersModel = modelClass
            };

            if (index == -1)
            {
                PostList.Add(item);
                AddPostDivider();
            }
            else
            {
                PostList.Insert(index, item);
                AddPostDivider(PostList.IndexOf(item) + 1);
            }
        }
示例#18
0
        public void AddPostDivider(int index = -1)
        {
            var item = new AdapterModelsClass
            {
                TypeView = PostModelType.Divider,
                Id       = int.Parse((int)PostModelType.Divider + PostCollection?.Id),

                PostData          = PostCollection,
                IsDefaultFeedPost = true
            };

            if (index == -1)
            {
                PostList.Add(item);
            }
            else
            {
                PostList.Insert(index, item);
            }
        }
示例#19
0
        public void SocialLinksBoxPostView(SocialLinksModelClass modelClass, int index)
        {
            var item = new AdapterModelsClass
            {
                TypeView         = PostModelType.SocialLinks,
                Id               = 0023,
                SocialLinksModel = modelClass,
            };

            if (index == -1)
            {
                PostList.Add(item);
                AddPostDivider();
            }
            else
            {
                PostList.Insert(index, item);
                AddPostDivider(PostList.IndexOf(item) + 1);
            }
        }
示例#20
0
        public void AddPostBoxPostView(string typePost, int index, PostDataObject postData = null)
        {
            var item = new AdapterModelsClass
            {
                TypeView = PostModelType.AddPostBox,
                TypePost = typePost,
                Id       = 959595959,
                PostData = postData
            };

            if (index == -1)
            {
                PostList.Add(item);
                AddPostDivider();
            }
            else
            {
                PostList.Insert(index, item);
                AddPostDivider(index);
            }
        }
示例#21
0
        public void AddPostFooter()
        {
            bool isSharing  = false;
            var  collection = PostCollection.SharedInfo.SharedInfoClass;

            if (collection != null)
            {
                isSharing = true;
            }

            var item = new AdapterModelsClass
            {
                TypeView          = PostModelType.BottomPostPart,
                Id                = int.Parse((int)PostModelType.BottomPostPart + PostCollection.Id),
                IsSharingPost     = isSharing,
                PostData          = PostCollection,
                IsDefaultFeedPost = true
            };

            PostList.Add(item);
        }
        private void ShowEmptyPage()
        {
            try
            {
                SwipeRefreshLayout.Refreshing = false;

                var emptyStateCheck = NativeFeedAdapter.ListDiffer.FirstOrDefault(a => a.PostData != null && a.TypeView != PostModelType.AddPostBox && a.TypeView != PostModelType.FilterSection && a.TypeView != PostModelType.SearchForPosts);
                if (emptyStateCheck != null)
                {
                    var emptyStateChecker = NativeFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.EmptyState);
                    if (emptyStateChecker != null && NativeFeedAdapter.ListDiffer.Count > 1)
                    {
                        MainRecyclerView.RemoveByRowIndex(emptyStateChecker);
                    }
                }
                else
                {
                    var emptyStateChecker = NativeFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.EmptyState);
                    switch (emptyStateChecker)
                    {
                    case null:
                    {
                        var data = new AdapterModelsClass
                        {
                            TypeView = PostModelType.EmptyState,
                            Id       = 744747447,
                        };
                        NativeFeedAdapter.ListDiffer.Add(data);
                        NativeFeedAdapter.NotifyItemInserted(NativeFeedAdapter.ListDiffer.IndexOf(data));
                        break;
                    }
                    }
                }
            }
            catch (Exception e)
            {
                SwipeRefreshLayout.Refreshing = false;
                Methods.DisplayReportResultTrack(e);
            }
        }
        public AdapterModelsClass SetFindMoreAlert(string type)
        {
            try
            {
                var alertModel1 = type switch
                {
                    "Groups" => new AlertModelClass
                    {
                        TitleHead     = MainContext.GetString(Resource.String.Lbl_Groups),
                        SubText       = MainContext.GetString(Resource.String.Lbl_FindMoreAler_TextGroups),
                        TypeAlert     = "Groups",
                        ImageDrawable = Resource.Drawable.image2,
                        IconImage     = Resource.Drawable.shareGroup,
                    },
                    "Pages" => new AlertModelClass
                    {
                        TitleHead     = MainContext.GetString(Resource.String.Lbl_Pages),
                        SubText       = MainContext.GetString(Resource.String.Lbl_FindMoreAler_TextPages),
                        TypeAlert     = "Pages",
                        ImageDrawable = Resource.Drawable.image1,
                        IconImage     = Resource.Drawable.sharePage,
                    },
                    _ => new AlertModelClass()
                };

                var addAlertJoinBox = new AdapterModelsClass
                {
                    TypeView   = PostModelType.AlertJoinBox,
                    Id         = DateTime.Now.Millisecond,
                    AlertModel = alertModel1
                };

                return(addAlertJoinBox);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
                return(null !);
            }
        }
示例#24
0
        public void SetAnnouncementAlertView(string subText, string color, int?resource = null)
        {
            var item = new AdapterModelsClass
            {
                TypeView   = PostModelType.AlertBoxAnnouncement,
                Id         = 66655666,
                AlertModel = new AlertModelClass
                {
                    TitleHead  = MainContext.GetText(Resource.String.Lbl_Announcement),
                    SubText    = subText,
                    LinerColor = color
                }
            };

            if (resource.HasValue)
            {
                item.AlertModel.ImageDrawable = resource.Value;
            }

            PostList.Insert(0, item);
            AddPostDivider(PostList.IndexOf(item) + 1);
        }
示例#25
0
        public void AboutBoxPostView(string description, int index)
        {
            var item = new AdapterModelsClass
            {
                TypeView   = PostModelType.AboutBox,
                Id         = 0000,
                AboutModel = new AboutModelClass {
                    Description = description
                },
            };

            if (index == -1)
            {
                PostList.Add(item);
                AddPostDivider();
            }
            else
            {
                PostList.Insert(index, item);
                AddPostDivider(PostList.IndexOf(item) + 1);
            }
        }
示例#26
0
        public void AddAdsPostView(PostModelType modelType)
        {
            if (modelType == PostModelType.AdMob)
            {
                var adMobBox = new AdapterModelsClass
                {
                    TypeView = PostModelType.AdMob,
                    Id       = 2222019
                };
                PostList.Add(adMobBox);
            }
            else
            {
                var adMobBox = new AdapterModelsClass
                {
                    TypeView = PostModelType.FbAdNative,
                    Id       = 2222220
                };
                PostList.Add(adMobBox);
            }

            AddPostDivider();
        }
        public AdapterModelsClass PrepareGreetingAlert()
        {
            try
            {
                //afternoon_system
                var afternoonSystem = ListUtils.SettingsSiteList?.AfternoonSystem;
                if (afternoonSystem == "1")
                {
                    var    data = ListUtils.MyProfileList.FirstOrDefault();
                    string name = data != null?WoWonderTools.GetNameFinal(data) : UserDetails.Username;

                    var alertModel = new AlertModelClass();

                    var c         = Calendar.Instance;
                    var timeOfDay = c.Get(CalendarField.HourOfDay);

                    if (timeOfDay >= 0 && timeOfDay < 12)
                    {
                        alertModel = new AlertModelClass
                        {
                            TitleHead     = MainContext.GetString(Resource.String.Lbl_GoodMorning) + ", " + name,
                            SubText       = MainContext.GetString(Resource.String.Lbl_GoodMorning_Text),
                            LinerColor    = "#ffc107",
                            ImageDrawable = Resource.Drawable.ic_post_park
                        };
                    }
                    else if (timeOfDay >= 12 && timeOfDay < 16)
                    {
                        alertModel = new AlertModelClass
                        {
                            TitleHead     = MainContext.GetString(Resource.String.Lbl_GoodAfternoon) + ", " + name,
                            SubText       = MainContext.GetString(Resource.String.Lbl_GoodAfternoon_Text),
                            LinerColor    = "#ffc107",
                            ImageDrawable = Resource.Drawable.ic_post_desert
                        };
                    }
                    else if (timeOfDay >= 16 && timeOfDay < 21)
                    {
                        alertModel = new AlertModelClass
                        {
                            TitleHead     = MainContext.GetString(Resource.String.Lbl_GoodEvening) + ", " + name,
                            SubText       = MainContext.GetString(Resource.String.Lbl_GoodEvening_Text),
                            LinerColor    = "#ffc107",
                            ImageDrawable = Resource.Drawable.ic_post_sea
                        };
                    }
                    else if (timeOfDay >= 21 && timeOfDay < 24)
                    {
                        alertModel = new AlertModelClass
                        {
                            TitleHead     = MainContext.GetString(Resource.String.Lbl_GoodEvening) + ", " + name,
                            SubText       = MainContext.GetString(Resource.String.Lbl_GoodEvening_Text),
                            LinerColor    = "#ffc107",
                            ImageDrawable = Resource.Drawable.ic_post_sea
                        };
                    }

                    var alertBox = new AdapterModelsClass
                    {
                        TypeView   = PostModelType.AlertBox,
                        AlertModel = alertModel,
                        Id         = 333333333
                    };

                    return(alertBox);
                }
                return(null);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(null);
            }
        }
示例#28
0
        public AdapterModelsClass PrepareGreetingAlert()
        {
            try
            {
                //afternoon_system
                var afternoonSystem = ListUtils.SettingsSiteList?.AfternoonSystem;
                if (afternoonSystem == "1")
                {
                    var    data = ListUtils.MyProfileList?.FirstOrDefault();
                    string name = data != null?WoWonderTools.GetNameFinal(data) : UserDetails.Username;

                    var alertModel = new AlertModelClass();

                    if ((int)Build.VERSION.SdkInt >= 24)
                    {
                        #pragma warning disable 618
                        var locale = (int)Build.VERSION.SdkInt < 25 ? MainContext?.Resources?.Configuration?.Locale : MainContext?.Resources?.Configuration?.Locales?.Get(0) ?? MainContext?.Resources?.Configuration?.Locale;
                        #pragma warning restore 618

                        var c         = Calendar.GetInstance(locale);
                        var timeOfDay = c?.Get(CalendarField.HourOfDay);

                        if (timeOfDay >= 0 && timeOfDay < 12)
                        {
                            alertModel = new AlertModelClass
                            {
                                TitleHead     = MainContext.GetString(Resource.String.Lbl_GoodMorning) + ", " + name,
                                SubText       = MainContext.GetString(Resource.String.Lbl_GoodMorning_Text),
                                LinerColor    = "#ffc107",
                                ImageDrawable = Resource.Drawable.ic_post_park
                            };
                        }
                        else if (timeOfDay >= 12 && timeOfDay < 16)
                        {
                            alertModel = new AlertModelClass
                            {
                                TitleHead     = MainContext.GetString(Resource.String.Lbl_GoodAfternoon) + ", " + name,
                                SubText       = MainContext.GetString(Resource.String.Lbl_GoodAfternoon_Text),
                                LinerColor    = "#ffc107",
                                ImageDrawable = Resource.Drawable.ic_post_desert
                            };
                        }
                        else if (timeOfDay >= 16 && timeOfDay < 21)
                        {
                            alertModel = new AlertModelClass
                            {
                                TitleHead     = MainContext.GetString(Resource.String.Lbl_GoodEvening) + ", " + name,
                                SubText       = MainContext.GetString(Resource.String.Lbl_GoodEvening_Text),
                                LinerColor    = "#ffc107",
                                ImageDrawable = Resource.Drawable.ic_post_sea
                            };
                        }
                        else if (timeOfDay >= 21 && timeOfDay < 24)
                        {
                            alertModel = new AlertModelClass
                            {
                                TitleHead     = MainContext.GetString(Resource.String.Lbl_GoodEvening) + ", " + name,
                                SubText       = MainContext.GetString(Resource.String.Lbl_GoodEvening_Text),
                                LinerColor    = "#ffc107",
                                ImageDrawable = Resource.Drawable.ic_post_sea
                            };
                        }

                        var alertBox = new AdapterModelsClass
                        {
                            TypeView   = PostModelType.AlertBox,
                            AlertModel = alertModel,
                            Id         = 333333333
                        };
                        return(alertBox);
                    }
                }
                return(null !);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
                return(null !);
            }
        }
        private void SetData()
        {
            try
            {
                var item = Intent.GetStringExtra("itemObject");
                if (string.IsNullOrEmpty(item))
                {
                    return;
                }

                switch (Type)
                {
                case "MangedGroupsModel":
                case "MangedPagesModel":
                {
                    if (MAdapter is SearchGroupAdapter adapter1)
                    {
                        GroupsModel = JsonConvert.DeserializeObject <GroupsModelClass>(item);
                        if (GroupsModel != null)
                        {
                            adapter1.GroupList = new ObservableCollection <GroupClass>(GroupsModel.GroupsList);
                            adapter1.NotifyDataSetChanged();
                        }
                    }
                    else if (MAdapter is SearchPageAdapter adapter2)
                    {
                        PagesModel = JsonConvert.DeserializeObject <PagesModelClass>(item);
                        if (PagesModel != null)
                        {
                            adapter2.PageList = new ObservableCollection <PageClass>(PagesModel.PagesList);
                            adapter2.NotifyDataSetChanged();
                        }
                    }

                    break;
                }

                case "StoryModel":
                case "FollowersModel":
                case "GroupsModel":
                case "PagesModel":
                case "ImagesModel":
                {
                    if (MAdapter is SearchGroupAdapter adapter1)
                    {
                        GroupsModel = JsonConvert.DeserializeObject <GroupsModelClass>(item);
                        if (GroupsModel != null)
                        {
                            adapter1.GroupList = new ObservableCollection <GroupClass>(GroupsModel.GroupsList);
                            adapter1.NotifyDataSetChanged();
                        }
                    }
                    else if (MAdapter is SearchPageAdapter adapter2)
                    {
                        PagesModel = JsonConvert.DeserializeObject <PagesModelClass>(item);
                        if (PagesModel != null)
                        {
                            adapter2.PageList = new ObservableCollection <PageClass>(PagesModel.PagesList);
                            adapter2.NotifyDataSetChanged();
                        }
                    }
                    else if (MAdapter is ContactsAdapter adapter3)
                    {
                        FollowersModel = JsonConvert.DeserializeObject <FollowersModelClass>(item);
                        if (FollowersModel != null)
                        {
                            adapter3.UserList = new ObservableCollection <UserDataObject>(FollowersModel.FollowersList);
                            adapter3.NotifyDataSetChanged();
                        }
                    }
                    else if (MAdapter is RowStoryAdapter adapter4)
                    {
                        AdapterModelsClass = JsonConvert.DeserializeObject <AdapterModelsClass>(item);
                        if (AdapterModelsClass != null)
                        {
                            adapter4.StoryList = new ObservableCollection <GetUserStoriesObject.StoryObject>(AdapterModelsClass.StoryList);
                            adapter4.StoryList.Remove(adapter4.StoryList.FirstOrDefault(a => a.Type == "Your"));
                            adapter4.NotifyDataSetChanged();
                        }
                    }
                    else if (MAdapter is UserPhotosAdapter adapter5)
                    {
                        ImagesModel = JsonConvert.DeserializeObject <ImagesModelClass>(item);
                        if (ImagesModel != null)
                        {
                            adapter5.UserPhotosList = new ObservableCollection <PostDataObject>(ImagesModel.ImagesList);
                            adapter5.NotifyDataSetChanged();
                        }
                    }
                    break;
                }
                }

                if (MAdapter?.ItemCount > 0)
                {
                    MRecycler.Visibility        = ViewStates.Visible;
                    EmptyStateLayout.Visibility = ViewStates.Gone;
                }
                else
                {
                    ShowEmptyPage();
                }

                SwipeRefreshLayout.Refreshing = false;
                SwipeRefreshLayout.Enabled    = false;

                StartApiService();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                SwipeRefreshLayout.Refreshing = false;
                SwipeRefreshLayout.Enabled    = false;
            }
        }
        //Result
        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            try
            {
                base.OnActivityResult(requestCode, resultCode, data);
                //If its from Camera or Gallery
                if (requestCode == CropImage.CropImageActivityRequestCode)
                {
                    var result = CropImage.GetActivityResult(data);

                    if (resultCode == Result.Ok)
                    {
                        if (result.IsSuccessful)
                        {
                            var resultUri = result.Uri;

                            if (!string.IsNullOrEmpty(resultUri.Path))
                            {
                                string pathImg;
                                if (ImageType == "Cover")
                                {
                                    pathImg = resultUri.Path;
                                    UpdateImageGroup_Api(ImageType, pathImg);
                                }
                                else if (ImageType == "Avatar")
                                {
                                    pathImg = resultUri.Path;
                                    UpdateImageGroup_Api(ImageType, pathImg);
                                }
                            }
                            else
                            {
                                Toast.MakeText(this, GetText(Resource.String.Lbl_something_went_wrong), ToastLength.Long).Show();
                            }
                        }
                    }
                }
                else if (requestCode == 2500 && resultCode == Result.Ok)//add post
                {
                    if (!string.IsNullOrEmpty(data.GetStringExtra("itemObject")))
                    {
                        var postData = JsonConvert.DeserializeObject <PostDataObject>(data.GetStringExtra("itemObject"));
                        if (postData != null)
                        {
                            var countList = PostFeedAdapter.ItemCount;

                            var combine = new FeedCombiner(postData, PostFeedAdapter.ListDiffer, this);
                            combine.CombineDefaultPostSections("Top");

                            int countIndex = 1;
                            var model1     = PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.Story);
                            var model2     = PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.AddPostBox);
                            var model3     = PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.AlertBox);
                            var model4     = PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.SearchForPosts);

                            if (model4 != null)
                            {
                                countIndex += PostFeedAdapter.ListDiffer.IndexOf(model4) + 1;
                            }
                            else if (model3 != null)
                            {
                                countIndex += PostFeedAdapter.ListDiffer.IndexOf(model3) + 1;
                            }
                            else if (model2 != null)
                            {
                                countIndex += PostFeedAdapter.ListDiffer.IndexOf(model2) + 1;
                            }
                            else if (model1 != null)
                            {
                                countIndex += PostFeedAdapter.ListDiffer.IndexOf(model1) + 1;
                            }
                            else
                            {
                                countIndex = 0;
                            }

                            PostFeedAdapter.NotifyItemRangeInserted(countIndex, PostFeedAdapter.ListDiffer.Count - countList);
                        }
                    }
                    else
                    {
                        PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                            () => MainRecyclerView.FetchNewsFeedApiPosts()
                        });
                    }
                }
                else if (requestCode == 3950 && resultCode == Result.Ok) //Edit post
                {
                    var postId   = data.GetStringExtra("PostId") ?? "";
                    var postText = data.GetStringExtra("PostText") ?? "";
                    var diff     = PostFeedAdapter.ListDiffer;
                    List <AdapterModelsClass> dataGlobal = diff.Where(a => a.PostData?.Id == postId).ToList();
                    if (dataGlobal.Count > 0)
                    {
                        foreach (var postData in dataGlobal)
                        {
                            postData.PostData.Orginaltext = postText;
                            var index = diff.IndexOf(postData);
                            if (index > -1)
                            {
                                PostFeedAdapter.NotifyItemChanged(index);
                            }
                        }

                        var checkTextSection = dataGlobal.FirstOrDefault(w => w.TypeView == PostModelType.TextSectionPostPart);
                        if (checkTextSection == null)
                        {
                            var collection = dataGlobal.FirstOrDefault()?.PostData;
                            var item       = new AdapterModelsClass
                            {
                                TypeView          = PostModelType.TextSectionPostPart,
                                Id                = int.Parse((int)PostModelType.TextSectionPostPart + collection?.Id),
                                PostData          = collection,
                                IsDefaultFeedPost = true
                            };

                            var headerPostIndex = diff.IndexOf(dataGlobal.FirstOrDefault(w => w.TypeView == PostModelType.HeaderPost));
                            if (headerPostIndex > -1)
                            {
                                diff.Insert(headerPostIndex + 1, item);
                                PostFeedAdapter.NotifyItemInserted(headerPostIndex + 1);
                            }
                        }
                    }
                }
                else if (requestCode == 3500 && resultCode == Result.Ok) //Edit post product
                {
                    if (string.IsNullOrEmpty(data.GetStringExtra("itemData")))
                    {
                        return;
                    }
                    var item = JsonConvert.DeserializeObject <ProductDataObject>(data.GetStringExtra("itemData"));
                    if (item != null)
                    {
                        var diff       = PostFeedAdapter.ListDiffer;
                        var dataGlobal = diff.Where(a => a.PostData?.Id == item.PostId).ToList();
                        if (dataGlobal.Count > 0)
                        {
                            foreach (var postData in dataGlobal)
                            {
                                var index = diff.IndexOf(postData);
                                if (index > -1)
                                {
                                    var productUnion = postData.PostData.Product?.ProductClass;
                                    if (productUnion != null)
                                    {
                                        productUnion.Id = item.Id;
                                    }
                                    productUnion = item;
                                    Console.WriteLine(productUnion);

                                    PostFeedAdapter.NotifyItemChanged(PostFeedAdapter.ListDiffer.IndexOf(postData));
                                }
                            }
                        }
                    }
                }
                else if (requestCode == 2005 && resultCode == Result.Ok)
                {
                    string result = data.GetStringExtra("groupItem");
                    var    item   = JsonConvert.DeserializeObject <GroupClass>(result);
                    if (item != null)
                    {
                        LoadPassedData(item);
                    }
                }
                else if (requestCode == 2019 && resultCode == Result.Ok)
                {
                    var manged        = GroupsActivity.GetInstance().MAdapter.SocialList.FirstOrDefault(a => a.TypeView == SocialModelType.MangedGroups);
                    var dataListGroup = manged?.MangedGroupsModel.GroupsList?.FirstOrDefault(a => a.GroupId == GroupId);
                    if (dataListGroup != null)
                    {
                        manged.MangedGroupsModel.GroupsList.Remove(dataListGroup);
                        GroupsActivity.GetInstance().MAdapter.NotifyDataSetChanged();

                        ListUtils.MyGroupList.Remove(dataListGroup);
                    }
                    Finish();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }