public List<UserDataObject> RetrieveAllUsers(string Fid)
        {
            try
            {
                List<UserDataObject> listOut = new List<UserDataObject>();

                List<DataObject.UserDataObject> listReceived = BusinessLayer.Users.RetrieveAllUser(Fid);
                foreach (var item in listReceived)
                {
                    UserDataObject Data = new UserDataObject();
                    Data.AutoId = item.AutoId;
                    Data.City = item.City;
                    Data.Dob = item.Dob;
                    Data.EmailId = item.EmailId;
                    Data.Name = item.Name;
                    Data.PhoneNumber = item.PhoneNumber;
                    Data.Uid = item.Uid;
                    listOut.Add(Data);
                }
                return listOut;
            }
            catch (Exception ex)
            {
                MyCustomErrorDetail Error = new MyCustomErrorDetail("Unexpected Error caused by " + ex.Source, ex.Message);
                throw new WebFaultException<MyCustomErrorDetail>(Error, System.Net.HttpStatusCode.InternalServerError);
            }
        }
        public UserDataObject RetrieveUser(string userId)
        {
            try
            {
                DataObject.UserDataObject UserData = BusinessLayer.Users.RetrieveUser(userId);
                if (string.IsNullOrEmpty(UserData.AutoId))
                {
                    MyCustomErrorDetail Error = new MyCustomErrorDetail("No user found", "No User with such id was in the database");
                    throw new WebFaultException<MyCustomErrorDetail>(Error, System.Net.HttpStatusCode.NotFound);
                }
                else
                {
                    UserDataObject Data = new UserDataObject();
                    Data.AutoId = UserData.AutoId;
                    Data.City = UserData.City;
                    Data.Dob = UserData.Dob;
                    Data.EmailId = UserData.EmailId;
                    Data.Name = UserData.Name;
                    Data.PhoneNumber = UserData.PhoneNumber;
                    Data.Uid = UserData.Uid;

                    return Data;
                }
            }
            catch (Exception ex)
            {
                MyCustomErrorDetail Error = new MyCustomErrorDetail("Unexpected Error caused by " + ex.Source, ex.Message);
                throw new WebFaultException<MyCustomErrorDetail>(Error, System.Net.HttpStatusCode.InternalServerError);
            }
        }
 public static void OpenProfile(Activity activity, string userId, UserDataObject item)
 {
     try
     {
         if (userId != UserDetails.UserId)
         {
             try
             {
                 if (UserProfileActivity.SUserId != userId)
                 {
                     MainApplication.GetInstance()?.NavigateTo(activity, typeof(UserProfileActivity), item);
                 }
             }
             catch (Exception e)
             {
                 Methods.DisplayReportResultTrack(e);
                 var intent = new Intent(activity, typeof(UserProfileActivity));
                 intent.PutExtra("UserObject", JsonConvert.SerializeObject(item));
                 intent.PutExtra("UserId", item.UserId);
                 activity.StartActivity(intent);
             }
         }
         else
         {
             if (PostClickListener.OpenMyProfile)
             {
                 return;
             }
             var intent = new Intent(activity, typeof(MyProfileActivity));
             activity.StartActivity(intent);
         }
     }
     catch (Exception e)
     {
         Methods.DisplayReportResultTrack(e);
     }
 }
        private void MAdapterOnItemClick(object sender, InviteMembersAdapterClickEventArgs e)
        {
            try
            {
                if (!Methods.CheckConnectivity())
                {
                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show();
                    return;
                }

                ItemUser = MAdapter.GetItem(e.Position);
                if (ItemUser != null)
                {
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => RequestsAsync.Page.PageAdd(PageId, ItemUser.UserId)
                    });

                    Toast.MakeText(this, GetString(Resource.String.Lbl_Added), ToastLength.Short)?.Show();

                    var local = MAdapter.UserList.FirstOrDefault(a => a.UserId == ItemUser.UserId);
                    if (local != null)
                    {
                        MAdapter.UserList.Remove(local);
                        MAdapter.NotifyItemRemoved(MAdapter.UserList.IndexOf(local));
                    }

                    if (MAdapter.UserList.Count == 0)
                    {
                        ShowEmptyPage();
                    }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
        private async Task GetUserProfileApi()
        {
            if (Methods.CheckConnectivity())
            {
                (int respondCode, var respondString) = await RequestsAsync.User.FetchUserData(UserId);

                if (respondCode == 200)
                {
                    if (respondString is FetchUserDataObject result)
                    {
                        if (result.Data != null)
                        {
                            UserinfoData = result.Data;
                            Url          = UserinfoData.Url;
                            LoadUserData(result.Data);
                        }
                    }
                }
                else
                {
                    Methods.DisplayReportResult(Activity, respondString);
                }
            }
        }
Example #6
0
    void FillSummaryList()
    {
        Debug.Log(_currentTierData.fileName);
        Debug.Log(_currentTierData.tips);
        Debug.Log(_currentTierData.tips[1]);

        foreach (var exercise in _currentTierData.exercises)
        {
            textTimeExName.text = textAttemptsExName.text = textConfidenceExName.text = exercise.exerciseName;

            GameObject gameObjectTierExerciseTime       = Instantiate(exerciseTimeImage) as GameObject;
            GameObject gameObjectTierExerciseConfidence = Instantiate(exerciseConfidenceImage) as GameObject;
            GameObject gameObjectTierExerciseAttempts   = Instantiate(exerciseAttemptsImage) as GameObject;

            TierSummaryExerciseTimeImage summaryTimeImage =
                gameObjectTierExerciseTime.GetComponent <TierSummaryExerciseTimeImage>();
            TierSummaryExerciseConfidenceImage summaryConfidenceImage =
                gameObjectTierExerciseConfidence.GetComponent <TierSummaryExerciseConfidenceImage>();
            TierSummaryExerciseAttemptImage summaryAttemptImage =
                gameObjectTierExerciseAttempts.GetComponent <TierSummaryExerciseAttemptImage>();


            summaryTimeImage.avgTimeText.text = exercise.userTime.ToString("F1");
            summaryTimeImage.GetComponent <Image>().fillAmount = exercise.userTime / UserDataObject.GetCurrentTierAllExercisesHighestTime();

            summaryConfidenceImage.avgConfidence.text = exercise.confidence.ToString("F0");
            summaryConfidenceImage.GetComponent <Image>().fillAmount = exercise.confidence / 100;

            summaryAttemptImage.avgAttempt.text = exercise.attempts.ToString();
            summaryAttemptImage.GetComponent <Image>().fillAmount = exercise.attempts / UserDataObject.GetCurrentTierAllExercisesHighestAttempt();

            gameObjectTierExerciseTime.transform.SetParent(timeSpacer, false);
            gameObjectTierExerciseConfidence.transform.SetParent(confidenceSpacer, false);
            gameObjectTierExerciseAttempts.transform.SetParent(attemptsSpacer, false);
        }
    }
Example #7
0
        public JsonResult FetchUserInfo(int userid)
        {
            UserDataObject user = ProcessFactory.GetUserProcess().GetUser(userid);

            if (user == null)
            {
                user = new UserDataObject();
            }
            return(Json(
                       new
            {
                user.FirstName,
                user.LastName,
                user.Email,
                user.Phone,
                user.Company,
                user.FeatureAccess,
                user.Id,
                user.IsSubscriptionEnabled,
                user.IsActive,
                user.IsAccountActivated,
                user.Roles
            }));
        }
Example #8
0
        public int Add(UserDataObject userDataObject)
        {
            int userId = 0;

            using (var context = new IdeaPoolEntities())
            {
                User user = new User
                {
                    FirstName             = userDataObject.FirstName,
                    LastName              = userDataObject.LastName,
                    Company               = userDataObject.Company,
                    Email                 = userDataObject.Email,
                    Phone                 = userDataObject.Phone,
                    CreateDate            = DateTime.UtcNow,
                    IsSubscriptionEnabled = userDataObject.IsSubscriptionEnabled,
                    IsActive              = true
                };
                Role submitterRole = context.Roles.Single(x => x.Key == RoleKeys.SUBMITTER);

                // Add submitter role
                user.Roles.Add(submitterRole);
                context.Users.Add(user);
                context.SaveChanges();

                Login login = new Login
                {
                    UserId      = user.Id,
                    Password    = userDataObject.EncryptedPassword,
                    IsActivated = false
                };
                context.Logins.Add(login);
                context.SaveChanges();
                userId = user.Id;
            }
            return(userId);
        }
 public Result Register(UserDataObject user)
 {//registers new user
     try
     {
         UserBusinessLayer customerBusiness = new UserBusinessLayer();
         Result            res = customerBusiness.Register(user);
         return(res);
     }
     catch (Exception e)
     {
         if (e.Message == "wrongkey")
         {
             Result ErrorObj = new Result();
             ErrorObj.Status           = "Failure";
             ErrorObj.ExceptionDetails = "Invalid Api Key";
             ErrorObj.ExceptionType    = "AuthorizationException";
             throw new WebFaultException <Result>(ErrorObj, System.Net.HttpStatusCode.Unauthorized);
         }
         else if (e.Message.Contains("null"))
         {
             Result obj = new Result();
             obj.Status           = "Failure";
             obj.ExceptionType    = "RequiredFieldException";
             obj.ExceptionDetails = "Required Field Cannot be null";
             throw new WebFaultException <Result>(obj, System.Net.HttpStatusCode.InternalServerError);
         }
         else
         {
             Result obj = new Result();
             obj.Status           = "Failure";
             obj.ExceptionType    = e.GetType().ToString().Split('.')[1];
             obj.ExceptionDetails = e.Message;
             throw new WebFaultException <Result>(obj, System.Net.HttpStatusCode.InternalServerError);
         }
     }
 }
Example #10
0
        public async Task <IActionResult> Login(UserDataObject userData)
        {
            var user = await _unitOfWork.userRepository.Login(userData.Username, userData.Password);

            if (user == null)
            {
                return(StatusCode(401, "Username or password incorrect"));
            }


            var expiresAt        = DateTime.Now.AddDays(1);
            var userDataToReturn = new UserDataToReturn()
            {
                AccessToken = _userService.GenerateJWTToken(user, expiresAt),
                ExpiresAt   = expiresAt,
                User        = new BasicUser()
                {
                    Username = user.Username,
                    Role     = user.UserRole
                },
            };

            return(Ok(userDataToReturn));
        }
Example #11
0
    private void OutputData()
    {
        foreach (var repetition in UserDataObject.GetCurrentRepetitionsArray())
        {
            GameObject          timeGameObject   = Instantiate(timePanel);
            RepetitionTimePanel currentTimePanel = timeGameObject.GetComponent <RepetitionTimePanel>();

            GameObject confidenceGameObject = Instantiate(confidencePanel);
            RepetitionConfidencePanel currentConfidencePanel = confidenceGameObject.GetComponent <RepetitionConfidencePanel>();

            GameObject attemptsGameObject = Instantiate(attemptsPanel);
            RepetitionAttemptsPanel currentAttemptsPanel = attemptsGameObject.GetComponent <RepetitionAttemptsPanel>();

            int repetitionId = Array.IndexOf(UserDataObject.GetCurrentRepetitionsArray(), repetition) + 1;


            string reptitionText = repetitionId.ToString();
            switch (repetitionId)
            {
            case 1:
                reptitionText += "st rep";
                break;

            case 2:
                reptitionText += "nd rep";
                break;

            case 3:
                reptitionText += "rd rep";
                break;

            default:
                reptitionText += "th rep";
                break;
            }

            currentTimePanel.repetitionText.text = reptitionText;
            currentTimePanel.timeText.text       = repetition.userTime.ToString("F1");
//			currentTimePanel.GetComponent<Image>().fillAmount = repetition.userTime / UserDataObject.GetCurrentExerciseLongestRepetitionTime();
            imageTimeList.Add(currentTimePanel.GetComponent <Image>());
            imageTimeValue.Add(repetition.userTime / UserDataObject.GetCurrentExerciseLongestRepetitionTime());

            currentAttemptsPanel.repetitionText.text = reptitionText;
            currentAttemptsPanel.attemptsText.text   = repetition.attempts.ToString();
            imageAttemptsList.Add(currentAttemptsPanel.GetComponent <Image>());
            imageAttemptsValue.Add((float)repetition.attempts / UserDataObject.GetCurrentExerciseSideHighestAttempt());

            currentConfidencePanel.repetitionText.text = reptitionText;
            currentConfidencePanel.confidenceText.text = Mathf.Round(repetition.confidence).ToString();
//			currentConfidencePanel.GetComponent<Image>().fillAmount = repetition.confidence/100;
            imageConfidenceList.Add(currentConfidencePanel.GetComponent <Image>());
            imageConfidenceValue.Add(repetition.confidence / 100);


            attemptsGameObject.transform.SetParent(attemptsSpacer, false);
            timeGameObject.transform.SetParent(timeSpacer, false);
            confidenceGameObject.transform.SetParent(confidenceSpacer, false);
        }

        avgTimePanel.GetComponent <AverageTimePanel>().averageTimeText.text =
            UserDataObject.GetCurrentExerciseAverageRepetitionTime().ToString("F1") + " sec";

        avgAttemptsPanel.GetComponent <AverageAttemptsPanel>().avgAttemptsText.text =
            UserDataObject.GetCurrentExerciseAverageRepetitionAttempts().ToString("F1");

        avgConfidencePanel.GetComponent <AverageConfidencePanel>().averageConfidenceText.text =
            UserDataObject.GetCurrentExerciseAverageRepetitionConfidence().ToString("F1") + " %";

        startConfidenceAnim = true;
        startTimeAnim       = true;
        startAttemptsAnim   = true;
        startAnim           = true;
    }
        private void LoadDataUser(UserDataObject data)
        {
            try
            {
                //Cover
                GlideImageLoader.LoadImage(this, data.Cover, ImageUserCover, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);

                //profile_picture
                GlideImageLoader.LoadImage(this, data.Avatar, ImageUserProfile, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                TextSanitizer sanitizer = new TextSanitizer(TxtAbout, this);
                sanitizer.Load(WoWonderTools.GetAboutFinal(data));

                TxtFullname.Text = WoWonderTools.GetNameFinal(data);
                TxtUserName.Text = "@" + data.Username;

                if (data.Details.DetailsClass != null)
                {
                    var following = Methods.FunString.FormatPriceValue(Convert.ToInt32(data.Details.DetailsClass?.FollowingCount));
                    var followers = Methods.FunString.FormatPriceValue(Convert.ToInt32(data.Details.DetailsClass?.FollowersCount));

                    if (AppSettings.ConnectivitySystem == 1)
                    {
                        TxtFollowing.Visibility      = ViewStates.Visible;
                        TxtFollowingCount.Visibility = ViewStates.Visible;

                        TxtFollowers.Visibility      = ViewStates.Visible;
                        TxtFollowersCount.Visibility = ViewStates.Visible;

                        TxtFollowing.Text      = GetText(Resource.String.Lbl_Following);
                        TxtFollowingCount.Text = following;

                        TxtFollowers.Text      = GetText(Resource.String.Lbl_Followers);
                        TxtFollowersCount.Text = followers;
                    }
                    else
                    {
                        TxtFollowing.Visibility      = ViewStates.Visible;
                        TxtFollowingCount.Visibility = ViewStates.Visible;

                        TxtFollowers.Visibility      = ViewStates.Gone;
                        TxtFollowersCount.Visibility = ViewStates.Gone;

                        TxtFollowing.Text      = GetText(Resource.String.Lbl_Friends);
                        TxtFollowingCount.Text = following;
                    }
                }

                switch (data.IsFollowing)
                {
                // My Friend
                case "1":
                    AddFriendOrFollowButton.Visibility = ViewStates.Visible;
                    AddFriendOrFollowButton.SetColor(Color.ParseColor(AppSettings.MainColor));
                    AddFriendOrFollowButton.SetImageResource(Resource.Drawable.ic_tick);
                    AddFriendOrFollowButton.Tag = "friends";
                    break;

                // Request
                case "2":
                    AddFriendOrFollowButton.Visibility = ViewStates.Visible;
                    AddFriendOrFollowButton.SetColor(Color.ParseColor(AppSettings.MainColor));
                    AddFriendOrFollowButton.SetImageResource(Resource.Drawable.ic_requestAdd);
                    AddFriendOrFollowButton.Tag = "request";
                    break;

                //Not Friend
                case "0":
                    AddFriendOrFollowButton.Visibility = ViewStates.Visible;
                    AddFriendOrFollowButton.SetColor(Color.ParseColor("#8c8a8a"));
                    AddFriendOrFollowButton.SetImageResource(Resource.Drawable.ic_add);
                    AddFriendOrFollowButton.Tag = "Add";
                    break;
                }

                if (Methods.FunString.StringNullRemover(data.Gender) != "Empty")
                {
                    TxtGenderText.Text = data.Gender.ToLower() switch
                    {
                        "male" => GetText(Resource.String.Radio_Male),
                        "female" => GetText(Resource.String.Radio_Female),
                        _ => data.Gender
                    };

                    GenderLiner.Visibility = ViewStates.Visible;
                }
                else
                {
                    GenderLiner.Visibility = ViewStates.Gone;
                }

                if (Methods.FunString.StringNullRemover(data.Address) != "Empty")
                {
                    LocationLiner.Visibility = ViewStates.Visible;
                    TxtLocationText.Text     = data.Address;
                }
                else
                {
                    LocationLiner.Visibility = ViewStates.Gone;
                }

                if (AppSettings.EnableShowPhoneNumber)
                {
                    if (Methods.FunString.StringNullRemover(data.PhoneNumber) != "Empty")
                    {
                        MobileLiner.Visibility = ViewStates.Visible;
                        TxtMobileText.Text     = data.PhoneNumber;
                    }
                    else
                    {
                        MobileLiner.Visibility = ViewStates.Gone;
                    }
                }
                else
                {
                    MobileLiner.Visibility = ViewStates.Gone;
                }

                if (Methods.FunString.StringNullRemover(data.Website) != "Empty")
                {
                    WebsiteLiner.Visibility = ViewStates.Visible;
                    TxtWebsiteText.Text     = data.Website;
                }
                else
                {
                    WebsiteLiner.Visibility = ViewStates.Gone;
                }

                if (Methods.FunString.StringNullRemover(data.Working) != "Empty")
                {
                    WorkLiner.Visibility = ViewStates.Visible;
                    TxtWorkText.Text     = data.Working;
                }
                else
                {
                    WorkLiner.Visibility = ViewStates.Gone;
                }

                if (Methods.FunString.StringNullRemover(data.Facebook) == "Empty")
                {
                    BtnFacebook.Enabled = false;
                    BtnFacebook.SetColor(Color.ParseColor("#8c8a8a"));
                }
                else
                {
                    BtnFacebook.Enabled = true;
                }

                if (Methods.FunString.StringNullRemover(data.Google) == "Empty")
                {
                    BtnGoogle.Enabled = false;
                    BtnGoogle.SetColor(Color.ParseColor("#8c8a8a"));
                }
                else
                {
                    BtnGoogle.Enabled = true;
                }

                if (Methods.FunString.StringNullRemover(data.Twitter) == "Empty")
                {
                    BtnTwitter.Enabled = false;
                    BtnTwitter.SetColor(Color.ParseColor("#8c8a8a"));
                }
                else
                {
                    BtnTwitter.Enabled = true;
                }

                if (Methods.FunString.StringNullRemover(data.Youtube) == "Empty")
                {
                    BtnYoutube.Enabled = false;
                    BtnYoutube.SetColor(Color.ParseColor("#8c8a8a"));
                }
                else
                {
                    BtnYoutube.Enabled = true;
                }

                if (Methods.FunString.StringNullRemover(data.Vk) == "Empty")
                {
                    BtnVk.Enabled = false;
                    BtnVk.SetColor(Color.ParseColor("#8c8a8a"));
                }
                else
                {
                    BtnVk.Enabled = true;
                }

                if (Methods.FunString.StringNullRemover(data.Instagram) == "Empty")
                {
                    BtnInstegram.Enabled = false;
                    BtnInstegram.SetColor(Color.ParseColor("#8c8a8a"));
                }
                else
                {
                    BtnInstegram.Enabled = true;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public void LoadUserData(UserDataObject cl, bool friends = true)
        {
            try
            {
                PPrivacy = cl.PPrivacy;

                GlideImageLoader.LoadImage(Activity, cl.Avatar, ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Color);

                AboutTab.TextSanitizerAutoLink.Load(AppTools.GetAboutFinal(cl));
                AboutTab.TxtGender.Text = cl.Gender;
                AboutTab.TxtEmail.Text  = cl.Email;
                if (string.IsNullOrEmpty(cl.Website))
                {
                    AboutTab.WebsiteLinearLayout.Visibility = ViewStates.Gone;
                }
                else
                {
                    AboutTab.TxtWebsite.Text = cl.Website;
                    AboutTab.WebsiteLinearLayout.Visibility = ViewStates.Visible;
                }

                TxtUserName.Text = "@" + cl.Username;

                var font = Typeface.CreateFromAsset(Application.Context.Resources.Assets, "ionicons.ttf");
                TxtFullName.SetTypeface(font, TypefaceStyle.Normal);

                var textHighLighter = AppTools.GetNameFinal(cl);

                if (cl.Verified == "1")
                {
                    textHighLighter += " " + IonIconsFonts.CheckmarkCircled;
                }

                if (cl.BusinessAccount == "1")
                {
                    textHighLighter += " " + IonIconsFonts.SocialUsd;
                }

                var decorator = TextDecorator.Decorate(TxtFullName, textHighLighter);

                if (cl.Verified == "1")
                {
                    decorator.SetTextColor(Resource.Color.Post_IsVerified, IonIconsFonts.CheckmarkCircled);
                }

                if (cl.BusinessAccount == "1")
                {
                    decorator.SetTextColor(Resource.Color.Post_IsBusiness, IonIconsFonts.SocialUsd);
                }

                decorator.Build();

                TxtPostCount.Text = Methods.FunString.FormatPriceValue(Int32.Parse(cl.PostsCount));

                if (cl.Followers != null && int.TryParse(cl.Followers, out var numberFollowers))
                {
                    TxtFollowersCount.Text = Methods.FunString.FormatPriceValue(numberFollowers);
                }

                if (cl.Following != null && int.TryParse(cl.Following, out var numberFollowing))
                {
                    TxtFollowingCount.Text = Methods.FunString.FormatPriceValue(numberFollowing);
                }

                if (!string.IsNullOrEmpty(cl.Google))
                {
                    AboutTab.Google = cl.Google;
                    AboutTab.SocialGoogle.SetTypeface(font, TypefaceStyle.Normal);
                    AboutTab.SocialGoogle.Text            = IonIconsFonts.SocialGoogle;
                    AboutTab.SocialGoogle.Visibility      = ViewStates.Visible;
                    AboutTab.SocialLinksLinear.Visibility = ViewStates.Visible;
                }

                if (!string.IsNullOrEmpty(cl.Facebook))
                {
                    AboutTab.Facebook = cl.Facebook;
                    AboutTab.SocialFacebook.SetTypeface(font, TypefaceStyle.Normal);
                    AboutTab.SocialFacebook.Text          = IonIconsFonts.SocialFacebook;
                    AboutTab.SocialFacebook.Visibility    = ViewStates.Visible;
                    AboutTab.SocialLinksLinear.Visibility = ViewStates.Visible;
                }

                if (!string.IsNullOrEmpty(cl.Website))
                {
                    AboutTab.Website = cl.Website;
                    AboutTab.WebsiteButton.SetTypeface(font, TypefaceStyle.Normal);
                    AboutTab.WebsiteButton.Text           = IonIconsFonts.AndroidGlobe;
                    AboutTab.WebsiteButton.Visibility     = ViewStates.Visible;
                    AboutTab.SocialLinksLinear.Visibility = ViewStates.Visible;
                }


                if (!string.IsNullOrEmpty(cl.Twitter))
                {
                    AboutTab.Twitter = cl.Twitter;
                    AboutTab.SocialTwitter.SetTypeface(font, TypefaceStyle.Normal);
                    AboutTab.SocialTwitter.Text           = IonIconsFonts.SocialTwitter;
                    AboutTab.SocialTwitter.Visibility     = ViewStates.Visible;
                    AboutTab.SocialLinksLinear.Visibility = ViewStates.Visible;
                }

                BtnMessage.Visibility = cl.IsFollowing != null && (cl.CPrivacy == "1" || cl.CPrivacy == "2" && cl.IsFollowing.Value) ? ViewStates.Visible : ViewStates.Invisible;

                if (cl.IsFollowing != null)
                {
                    SIsFollowing = cl.IsFollowing.Value;
                }

                if (!friends)
                {
                    return;
                }
                if (cl.IsFollowing != null && cl.IsFollowing.Value) // My Friend
                {
                    FollowButton.SetBackgroundColor(Color.ParseColor("#efefef"));
                    FollowButton.SetTextColor(Color.ParseColor("#444444"));
                    FollowButton.Text = Context.GetText(Resource.String.Lbl_Following);
                    FollowButton.Tag  = "true";
                }
                else
                {
                    //Not Friend
                    FollowButton.SetBackgroundResource(Resource.Drawable.buttonFlatNormal);
                    FollowButton.SetTextColor(Color.ParseColor("#ffffff"));
                    FollowButton.Text = Context.GetText(Resource.String.Lbl_Follow);
                    FollowButton.Tag  = "false";
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        private async void Run()
        {
            try
            {
                if (Methods.CheckConnectivity())
                {
                    var(apiStatus, respond) = await RequestsAsync.User.ProfileAsync(UserId, "followers,following,albums,activities,latest_songs,top_songs,store").ConfigureAwait(false);

                    if (apiStatus.Equals(200))
                    {
                        if (respond is ProfileObject result)
                        {
                            if (result.Data != null)
                            {
                                DataUser = result.Data;

                                Activity.RunOnUiThread(() =>
                                {
                                    try
                                    {
                                        LoadDataUser();

                                        if (result.details != null)
                                        {
                                            DetailsCounter         = result.details;
                                            TxtCountFollowers.Text = Methods.FunString.FormatPriceValue(result.details.Followers);
                                            TxtCountFollowing.Text = Methods.FunString.FormatPriceValue(result.details.Following);
                                            TxtCountTracks.Text    = Methods.FunString.FormatPriceValue(result.details.TopSongs);
                                        }
                                    }
                                    catch (Exception e)
                                    {
                                        Console.WriteLine(e);
                                    }
                                });

                                //Add Latest Songs
                                if (result.Data?.Latestsongs?.Count > 0)
                                {
                                    LatestSongsAdapter.SoundsList = new ObservableCollection <SoundDataObject>(result.Data?.Latestsongs);
                                }

                                //Add Latest Songs
                                if (result.Data?.TopSongs?.Count > 0)
                                {
                                    TopSongsAdapter.SoundsList = new ObservableCollection <SoundDataObject>(result.Data?.TopSongs);
                                }

                                //Add Albums
                                if (result.Data?.Albums?.Count > 0)
                                {
                                    AlbumsAdapter.AlbumsList = new ObservableCollection <DataAlbumsObject>(result.Data?.Albums);
                                }

                                //Add Store
                                if (result.Data?.Store?.Count > 0)
                                {
                                    StoreAdapter.SoundsList = new ObservableCollection <SoundDataObject>(result.Data?.Store);
                                }

                                //Add Activities
                                if (result.Data?.Activities?.Count > 0)
                                {
                                    ActivitiesAdapter.ActivityList = new ObservableCollection <ActivityDataObject>(result.Data.Activities);
                                }

                                //SqLiteDatabase dbDatabase = new SqLiteDatabase();
                                //dbDatabase.InsertOrUpdate_DataMyInfo(result.Data);
                                //dbDatabase.Dispose();
                            }
                        }
                    }
                    else
                    {
                        Methods.DisplayReportResult(Activity, respond);
                    }

                    Activity.RunOnUiThread(ShowEmptyPage);
                }
                else
                {
                    Activity.RunOnUiThread(() =>
                    {
                        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(Context, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                    });
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #15
0
        public static void UpdateLastIdMessage(SendMessageObject chatMessages)
        {
            try
            {
                foreach (var messageInfo in chatMessages.MessageData)
                {
                    MessageData m = new MessageData
                    {
                        Id             = messageInfo.Id,
                        FromId         = messageInfo.FromId,
                        GroupId        = messageInfo.GroupId,
                        ToId           = messageInfo.ToId,
                        Text           = messageInfo.Text,
                        Media          = messageInfo.Media,
                        MediaFileName  = messageInfo.MediaFileName,
                        MediaFileNames = messageInfo.MediaFileNames,
                        Time           = messageInfo.Time,
                        Seen           = messageInfo.Seen,
                        DeletedOne     = messageInfo.DeletedOne,
                        DeletedTwo     = messageInfo.DeletedTwo,
                        SentPush       = messageInfo.SentPush,
                        NotificationId = messageInfo.NotificationId,
                        TypeTwo        = messageInfo.TypeTwo,
                        Stickers       = messageInfo.Stickers,
                        TimeText       = messageInfo.TimeText,
                        Position       = messageInfo.Position,
                        ModelType      = messageInfo.ModelType,
                        FileSize       = messageInfo.FileSize,
                        MediaDuration  = messageInfo.MediaDuration,
                        MediaIsPlaying = messageInfo.MediaIsPlaying,
                        ContactNumber  = messageInfo.ContactNumber,
                        ContactName    = messageInfo.ContactName,
                        ProductId      = messageInfo.ProductId,
                        MessageUser    = messageInfo.MessageUser,
                        Product        = messageInfo.Product,
                        MessageHashId  = messageInfo.MessageHashId,
                        Lat            = messageInfo.Lat,
                        Lng            = messageInfo.Lng,
                        SendFile       = false,
                    };

                    var typeModel = Holders.GetTypeModel(m);
                    if (typeModel == MessageModelType.None)
                    {
                        continue;
                    }

                    var message = WoWonderTools.MessageFilter(messageInfo.ToId, m, typeModel, true);
                    message.ModelType = typeModel;

                    AdapterModelsClassMessage checker = WindowActivity?.MAdapter?.DifferList?.FirstOrDefault(a => a.MesData.Id == messageInfo.MessageHashId);
                    if (checker != null)
                    {
                        //checker.TypeView = typeModel;
                        checker.MesData  = message;
                        checker.Id       = Java.Lang.Long.ParseLong(message.Id);
                        checker.TypeView = typeModel;

                        checker.MesData.Id             = message.Id;
                        checker.MesData.FromId         = message.FromId;
                        checker.MesData.GroupId        = message.GroupId;
                        checker.MesData.ToId           = message.ToId;
                        checker.MesData.Text           = message.Text;
                        checker.MesData.Media          = message.Media;
                        checker.MesData.MediaFileName  = message.MediaFileName;
                        checker.MesData.MediaFileNames = message.MediaFileNames;
                        checker.MesData.Time           = message.Time;
                        checker.MesData.Seen           = message.Seen;
                        checker.MesData.DeletedOne     = message.DeletedOne;
                        checker.MesData.DeletedTwo     = message.DeletedTwo;
                        checker.MesData.SentPush       = message.SentPush;
                        checker.MesData.NotificationId = message.NotificationId;
                        checker.MesData.TypeTwo        = message.TypeTwo;
                        checker.MesData.Stickers       = message.Stickers;
                        checker.MesData.TimeText       = message.TimeText;
                        checker.MesData.Position       = message.Position;
                        checker.MesData.ModelType      = message.ModelType;
                        checker.MesData.FileSize       = message.FileSize;
                        checker.MesData.MediaDuration  = message.MediaDuration;
                        checker.MesData.MediaIsPlaying = message.MediaIsPlaying;
                        checker.MesData.ContactNumber  = message.ContactNumber;
                        checker.MesData.ContactName    = message.ContactName;
                        checker.MesData.ProductId      = message.ProductId;
                        checker.MesData.MessageUser    = message.MessageUser;
                        checker.MesData.Product        = message.Product;
                        checker.MesData.MessageHashId  = message.MessageHashId;
                        checker.MesData.Lat            = message.Lat;
                        checker.MesData.Lng            = message.Lng;
                        checker.MesData.SendFile       = false;

                        #region LastChat

                        //if (AppSettings.LastChatSystem == SystemApiGetLastChat.New)
                        //{
                        //    var updaterUser = GlobalContext?.LastChatTab?.MAdapter?.LastChatsList?.FirstOrDefault(a => a.LastChat?.UserId == message.ToId);
                        //    if (updaterUser?.LastChat != null)
                        //    {
                        //        var index = GlobalContext.LastChatTab.MAdapter.LastChatsList.IndexOf(GlobalContext.LastChatTab.MAdapter.LastChatsList.FirstOrDefault(x => x.LastChat?.UserId == message.ToId));
                        //        if (index > -1)
                        //        {
                        //            updaterUser.LastChat.LastMessage.LastMessageClass.Text = typeModel switch
                        //            {
                        //                MessageModelType.RightGif => WindowActivity?.GetText(Resource.String.Lbl_SendGifFile),
                        //                MessageModelType.RightText => !string.IsNullOrEmpty(message.Text) ? Methods.FunString.DecodeString(message.Text) : WindowActivity?.GetText(Resource.String.Lbl_SendMessage),
                        //                MessageModelType.RightSticker => WindowActivity?.GetText(Resource.String.Lbl_SendStickerFile),
                        //                MessageModelType.RightContact => WindowActivity?.GetText(Resource.String.Lbl_SendContactnumber),
                        //                MessageModelType.RightFile => WindowActivity?.GetText(Resource.String.Lbl_SendFile),
                        //                MessageModelType.RightVideo => WindowActivity?.GetText(Resource.String.Lbl_SendVideoFile),
                        //                MessageModelType.RightImage => WindowActivity?.GetText(Resource.String.Lbl_SendImageFile),
                        //                MessageModelType.RightAudio => WindowActivity?.GetText(Resource.String.Lbl_SendAudioFile),
                        //                MessageModelType.RightMap => WindowActivity?.GetText(Resource.String.Lbl_SendLocationFile),
                        //                _ => updaterUser.LastChat?.LastMessage.LastMessageClass.Text
                        //            };

                        //            GlobalContext?.RunOnUiThread(() =>
                        //            {
                        //                try
                        //                {
                        //                    if (!updaterUser.LastChat.IsPin)
                        //                    {
                        //                        var checkPin = GlobalContext.LastChatTab.MAdapter.LastChatsList.LastOrDefault(o => o.LastChat != null && o.LastChat.IsPin);
                        //                        if (checkPin != null)
                        //                        {
                        //                            var toIndex = GlobalContext.LastChatTab.MAdapter.LastChatsList.IndexOf(checkPin) + 1;
                        //                            GlobalContext?.LastChatTab?.MAdapter.LastChatsList.Move(index, toIndex);
                        //                            GlobalContext?.LastChatTab?.MAdapter.NotifyItemMoved(index, toIndex);
                        //                        }
                        //                        else
                        //                        {
                        //                            if (ListUtils.FriendRequestsList.Count > 0)
                        //                            {
                        //                                GlobalContext?.LastChatTab?.MAdapter.LastChatsList.Move(index, 1);
                        //                                GlobalContext?.LastChatTab?.MAdapter.NotifyItemMoved(index, 1);
                        //                            }
                        //                            else
                        //                            {
                        //                                GlobalContext?.LastChatTab?.MAdapter?.LastChatsList.Move(index, 0);
                        //                                GlobalContext?.LastChatTab?.MAdapter?.NotifyItemMoved(index, 0);
                        //                                GlobalContext?.LastChatTab?.MAdapter?.NotifyItemChanged(index, "WithoutBlob");
                        //                            }
                        //                        }
                        //                    }
                        //                }
                        //                catch (Exception e)
                        //                {
                        //                    Methods.DisplayReportResultTrack(e);
                        //                }
                        //            });

                        //            SqLiteDatabase dbSqLite = new SqLiteDatabase();
                        //            //Update All data users to database
                        //            dbSqLite.Insert_Or_Update_LastUsersChat(GlobalContext, new ObservableCollection<ChatObject> { updaterUser?.LastChat });

                        //        }
                        //    }
                        //    else
                        //    {
                        //        //insert new user
                        //        var data = ConvertData(checker.MesData);
                        //        if (data != null)
                        //        {
                        //            //wael change after add in api
                        //            data.IsMute = WoWonderTools.CheckMute(data.UserId, "user");
                        //            data.IsPin = WoWonderTools.CheckPin(data.UserId, "user");
                        //            var archiveObject = WoWonderTools.CheckArchive(data.UserId, "user");
                        //            data.IsArchive = archiveObject != null;


                        //            GlobalContext?.RunOnUiThread(() =>
                        //            {
                        //                try
                        //                {
                        //                    if (!data.IsArchive)
                        //                    {
                        //                        if (ListUtils.FriendRequestsList.Count > 0)
                        //                        {
                        //                            GlobalContext?.LastChatTab.MAdapter.LastChatsList.Insert(0, new Classes.LastChatsClass()
                        //                            {
                        //                                LastChat = data,
                        //                                Type = Classes.ItemType.LastChatNewV
                        //                            });
                        //                            GlobalContext?.LastChatTab.MAdapter.NotifyItemInserted(0);
                        //                            GlobalContext?.LastChatTab.MRecycler.ScrollToPosition(0);
                        //                        }
                        //                        else
                        //                        {
                        //                            GlobalContext?.LastChatTab.MAdapter.LastChatsList.Insert(1, new Classes.LastChatsClass()
                        //                            {
                        //                                LastChat = data,
                        //                                Type = Classes.ItemType.LastChatNewV
                        //                            });
                        //                            GlobalContext?.LastChatTab.MAdapter.NotifyItemInserted(1);
                        //                            GlobalContext?.LastChatTab.MRecycler.ScrollToPosition(1);
                        //                        }
                        //                    }
                        //                    else
                        //                    {
                        //                        if (archiveObject != null)
                        //                        {
                        //                            if (archiveObject.LastMessagesUser.LastMessage?.Id != data.LastMessage.LastMessageClass?.Id)
                        //                            {
                        //                                if (ListUtils.FriendRequestsList.Count > 0)
                        //                                {
                        //                                    GlobalContext?.LastChatTab.MAdapter.LastChatsList.Insert(0, new Classes.LastChatsClass()
                        //                                    {
                        //                                        LastChat = data,
                        //                                        Type = Classes.ItemType.LastChatNewV
                        //                                    });
                        //                                    GlobalContext?.LastChatTab.MAdapter.NotifyItemInserted(0);
                        //                                    GlobalContext?.LastChatTab.MRecycler.ScrollToPosition(0);
                        //                                }
                        //                                else
                        //                                {
                        //                                    GlobalContext?.LastChatTab.MAdapter.LastChatsList.Insert(1, new Classes.LastChatsClass()
                        //                                    {
                        //                                        LastChat = data,
                        //                                        Type = Classes.ItemType.LastChatNewV
                        //                                    });
                        //                                    GlobalContext?.LastChatTab.MAdapter.NotifyItemInserted(1);
                        //                                    GlobalContext?.LastChatTab.MRecycler.ScrollToPosition(1);
                        //                                }

                        //                                ListUtils.ArchiveList.Remove(archiveObject);

                        //                                var sqLiteDatabase = new SqLiteDatabase();
                        //                                sqLiteDatabase.InsertORDelete_Archive(archiveObject);
                        //                            }
                        //                        }
                        //                    }
                        //                }
                        //                catch (Exception e)
                        //                {
                        //                    Methods.DisplayReportResultTrack(e);
                        //                }
                        //            });

                        //            //Update All data users to database
                        //            //dbDatabase.Insert_Or_Update_LastUsersChat(new ObservableCollection<GetUsersListObject.User>
                        //            //{
                        //            //    data
                        //            //});
                        //        }
                        //    }
                        //}
                        //else
                        //{
                        //    var updaterUser = GlobalContext?.LastChatTab?.MAdapter?.LastChatsList?.FirstOrDefault(a => a.LastMessagesUser?.UserId == message.ToId);
                        //    if (updaterUser?.LastMessagesUser != null)
                        //    {
                        //        var index = GlobalContext.LastChatTab.MAdapter.LastChatsList.IndexOf(GlobalContext.LastChatTab.MAdapter.LastChatsList.FirstOrDefault(x => x.LastMessagesUser?.UserId == message.ToId));
                        //        if (index > -1)
                        //        {
                        //            updaterUser.LastMessagesUser.LastMessage.Text = typeModel switch
                        //            {
                        //                MessageModelType.RightGif => WindowActivity?.GetText(Resource.String.Lbl_SendGifFile),
                        //                MessageModelType.RightText => !string.IsNullOrEmpty(message.Text) ? Methods.FunString.DecodeString(message.Text) : WindowActivity?.GetText(Resource.String.Lbl_SendMessage),
                        //                MessageModelType.RightSticker => WindowActivity?.GetText(Resource.String.Lbl_SendStickerFile),
                        //                MessageModelType.RightContact => WindowActivity?.GetText(Resource.String.Lbl_SendContactnumber),
                        //                MessageModelType.RightFile => WindowActivity?.GetText(Resource.String.Lbl_SendFile),
                        //                MessageModelType.RightVideo => WindowActivity?.GetText(Resource.String.Lbl_SendVideoFile),
                        //                MessageModelType.RightImage => WindowActivity?.GetText(Resource.String.Lbl_SendImageFile),
                        //                MessageModelType.RightAudio => WindowActivity?.GetText(Resource.String.Lbl_SendAudioFile),
                        //                MessageModelType.RightMap => WindowActivity?.GetText(Resource.String.Lbl_SendLocationFile),
                        //                _ => updaterUser.LastMessagesUser?.LastMessage.Text
                        //            };

                        //            GlobalContext?.RunOnUiThread(() =>
                        //            {
                        //                try
                        //                {
                        //                    if (!updaterUser.LastMessagesUser.IsPin)
                        //                    {
                        //                        var checkPin = GlobalContext?.LastChatTab?.MAdapter.LastChatsList.LastOrDefault(o => o.LastMessagesUser != null && o.LastMessagesUser.IsPin);
                        //                        if (checkPin != null)
                        //                        {
                        //                            var toIndex = GlobalContext.LastChatTab.MAdapter.LastChatsList.IndexOf(checkPin) + 1;
                        //                            GlobalContext?.LastChatTab?.MAdapter.LastChatsList.Move(index, toIndex);
                        //                            GlobalContext?.LastChatTab?.MAdapter.NotifyItemMoved(index, toIndex);
                        //                        }
                        //                        else
                        //                        {
                        //                            if (ListUtils.FriendRequestsList.Count > 0)
                        //                            {
                        //                                GlobalContext?.LastChatTab?.MAdapter.LastChatsList.Move(index, 1);
                        //                                GlobalContext?.LastChatTab?.MAdapter.NotifyItemMoved(index, 1);
                        //                            }
                        //                            else
                        //                            {
                        //                                GlobalContext?.LastChatTab?.MAdapter.LastChatsList.Move(index, 0);
                        //                                GlobalContext?.LastChatTab?.MAdapter.NotifyItemMoved(index, 0);
                        //                            }
                        //                        }
                        //                    }
                        //                }
                        //                catch (Exception e)
                        //                {
                        //                    Methods.DisplayReportResultTrack(e);
                        //                }
                        //            });
                        //            SqLiteDatabase dbSqLite = new SqLiteDatabase();
                        //            //Update All data users to database
                        //            dbSqLite.Insert_Or_Update_LastUsersChat(GlobalContext, new ObservableCollection<GetUsersListObject.User> { updaterUser.LastMessagesUser });
                        //        }
                        //    }
                        //    else
                        //    {
                        //        //insert new user
                        //        var data = ConvertDataChat(checker.MesData);
                        //        if (data != null)
                        //        {
                        //            //wael change after add in api
                        //            data.IsMute = WoWonderTools.CheckMute(data.UserId, "user");
                        //            data.IsPin = WoWonderTools.CheckPin(data.UserId, "user");
                        //            var archiveObject = WoWonderTools.CheckArchive(data.UserId, "user");
                        //            data.IsArchive = archiveObject != null;

                        //            GlobalContext?.RunOnUiThread(() =>
                        //            {
                        //                try
                        //                {
                        //                    if (!data.IsArchive)
                        //                    {
                        //                        if (ListUtils.FriendRequestsList.Count > 0)
                        //                        {
                        //                            GlobalContext?.LastChatTab?.MAdapter.LastChatsList.Insert(0, new Classes.LastChatsClass()
                        //                            {
                        //                                LastMessagesUser = data,
                        //                                Type = Classes.ItemType.LastChatOldV
                        //                            });
                        //                            GlobalContext?.LastChatTab?.MAdapter.NotifyItemInserted(0);
                        //                            GlobalContext?.LastChatTab?.MRecycler.ScrollToPosition(0);
                        //                        }
                        //                        else
                        //                        {
                        //                            GlobalContext?.LastChatTab?.MAdapter.LastChatsList.Insert(1, new Classes.LastChatsClass()
                        //                            {
                        //                                LastMessagesUser = data,
                        //                                Type = Classes.ItemType.LastChatOldV
                        //                            });
                        //                            GlobalContext?.LastChatTab?.MAdapter.NotifyItemInserted(1);
                        //                            GlobalContext?.LastChatTab?.MRecycler.ScrollToPosition(1);
                        //                        }
                        //                    }
                        //                    else
                        //                    {
                        //                        if (archiveObject != null)
                        //                        {
                        //                            if (archiveObject.LastMessagesUser.LastMessage?.Id != data.LastMessage.Id)
                        //                            {
                        //                                if (ListUtils.FriendRequestsList.Count > 0)
                        //                                {
                        //                                    GlobalContext?.LastChatTab?.MAdapter.LastChatsList.Insert(0, new Classes.LastChatsClass()
                        //                                    {
                        //                                        LastMessagesUser = data,
                        //                                        Type = Classes.ItemType.LastChatOldV
                        //                                    });
                        //                                    GlobalContext?.LastChatTab?.MAdapter.NotifyItemInserted(0);
                        //                                    GlobalContext?.LastChatTab?.MRecycler.ScrollToPosition(0);
                        //                                }
                        //                                else
                        //                                {
                        //                                    GlobalContext?.LastChatTab?.MAdapter.LastChatsList.Insert(1, new Classes.LastChatsClass()
                        //                                    {
                        //                                        LastMessagesUser = data,
                        //                                        Type = Classes.ItemType.LastChatOldV
                        //                                    });
                        //                                    GlobalContext?.LastChatTab?.MAdapter.NotifyItemInserted(1);
                        //                                    GlobalContext?.LastChatTab?.MRecycler.ScrollToPosition(1);
                        //                                }

                        //                                ListUtils.ArchiveList.Remove(archiveObject);

                        //                                var sqLiteDatabase = new SqLiteDatabase();
                        //                                sqLiteDatabase.InsertORDelete_Archive(archiveObject);
                        //                            }
                        //                        }
                        //                    }
                        //                }
                        //                catch (Exception e)
                        //                {
                        //                    Methods.DisplayReportResultTrack(e);
                        //                }
                        //            });

                        //            //Update All data users to database
                        //            //dbDatabase.Insert_Or_Update_LastUsersChat(new ObservableCollection<GetUsersListObject.User>
                        //            //{
                        //            //    data
                        //            //});
                        //        }
                        //    }
                        //}

                        #endregion

                        //checker.Media = media;
                        //Update All data users to database
                        SqLiteDatabase dbDatabase = new SqLiteDatabase();
                        dbDatabase.Insert_Or_Update_To_one_MessagesTable(checker.MesData);

                        GlobalContext.Activity?.RunOnUiThread(() =>
                        {
                            try
                            {
                                //Update data RecyclerView Messages.
                                //if (message.ModelType == MessageModelType.RightSticker || message.ModelType == MessageModelType.RightImage || message.ModelType == MessageModelType.RightMap || message.ModelType == MessageModelType.RightVideo)
                                WindowActivity?.Update_One_Messages(checker.MesData);

                                if (UserDetails.SoundControl)
                                {
                                    Methods.AudioRecorderAndPlayer.PlayAudioFromAsset("Popup_SendMesseges.mp3");
                                }
                            }
                            catch (Exception e)
                            {
                                Methods.DisplayReportResultTrack(e);
                            }
                        });
                    }
                }

                DataUser     = null;
                DataUserChat = null;
                UserData     = null;
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Example #16
0
 public async Task <object> Login(UserDataObject userDataObject)
 {
     return(await _authService.Login(userDataObject));
 }
Example #17
0
        private void LoadDataUser(UserDataObject dataUser)
        {
            try
            {
                if (dataUser != null)
                {
                    CollapsingToolbar.Title = DeepSoundTools.GetNameFinal(dataUser);

                    FullGlideRequestBuilder.Load(dataUser.Cover).Into(ImageCover);
                    FullGlideRequestBuilder.Load(dataUser.Avatar).Into(ImageAvatar);

                    TxtFullName.Text = DeepSoundTools.GetNameFinal(dataUser);

                    IconPro.Visibility = dataUser.IsPro == 1 ? ViewStates.Visible : ViewStates.Gone;

                    if (dataUser.Verified == 1)
                    {
                        TxtFullName.SetCompoundDrawablesWithIntrinsicBounds(0, 0, Resource.Drawable.icon_checkmark_small_vector, 0);
                    }

                    if (ActivitiesFragment?.IsCreated == true)
                    {
                        ActivitiesFragment.PopulateData(dataUser.Activities);
                    }

                    if (AlbumsFragment?.IsCreated == true)
                    {
                        AlbumsFragment.PopulateData(dataUser.Albums);
                    }

                    if (LikedFragment?.IsCreated == true)
                    {
                        LikedFragment.PopulateData(dataUser.Liked);
                    }

                    if (PlaylistFragment?.IsCreated == true)
                    {
                        PlaylistFragment.PopulateData(dataUser.Playlists);
                    }

                    if (SongsFragment?.IsCreated == true)
                    {
                        SongsFragment.PopulateData(dataUser.TopSongs);
                    }

                    if (StationsFragment?.IsCreated == true)
                    {
                        StationsFragment.PopulateData(dataUser.Stations);
                    }

                    if (StoreFragment?.IsCreated == true)
                    {
                        StoreFragment.PopulateData(dataUser.Store);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        private void Initialize(ContactsAdapterViewHolder holder, UserDataObject users)
        {
            try
            {
                if (users.Avatar == "addImage")
                {
                    holder.ImageLastseen.Visibility = ViewStates.Gone;
                }

                GlideImageLoader.LoadImage(ActivityContext, users.Avatar, holder.Image, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                holder.Name.Text = Methods.FunString.SubStringCutOf(WoWonderTools.GetNameFinal(users), 25);

                if (users.Verified == "1")
                {
                    holder.Name.SetCompoundDrawablesWithIntrinsicBounds(0, 0, Resource.Drawable.icon_checkmark_small_vector, 0);
                }

                if (Type == TypeTextSecondary.None)
                {
                    holder.About.Visibility = ViewStates.Gone;
                }
                else
                {
                    holder.About.Text = Type == TypeTextSecondary.About ? Methods.FunString.SubStringCutOf(WoWonderTools.GetAboutFinal(users), 35) : ActivityContext.GetString(Resource.String.Lbl_Last_seen) + " " + Methods.Time.TimeAgo(int.Parse(users.LastseenUnixTime), true);
                }

                //Online Or offline
                var online = WoWonderTools.GetStatusOnline(int.Parse(users.LastseenUnixTime), users.LastseenStatus);
                if (online)
                {
                    holder.ImageLastseen.SetImageResource(Resource.Drawable.Green_Online);
                    if (AppSettings.ShowOnlineOfflineMessage)
                    {
                        var data = ListOnline.Contains(users.Name);
                        if (data == false)
                        {
                            ListOnline.Add(users.Name);

                            Toast toast = Toast.MakeText(ActivityContext, users.Name + " " + ActivityContext.GetString(Resource.String.Lbl_Online), ToastLength.Short);
                            toast.SetGravity(GravityFlags.Center, 0, 0);
                            toast.Show();
                        }
                    }
                }
                else
                {
                    holder.ImageLastseen.SetImageResource(Resource.Drawable.Grey_Offline);
                }

                if (ShowButton)
                {
                    switch (users.IsFollowing)
                    {
                    // My Friend
                    case "1":
                    {
                        holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                        if (AppSettings.ConnectivitySystem == 1)        // Following
                        {
                            holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Following);
                        }
                        else         // Friend
                        {
                            holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Friends);
                        }
                        holder.Button.Tag = "true";
                        break;
                    }

                    // Request
                    case "2":
                        holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        holder.Button.SetTextColor(Color.ParseColor("#444444"));
                        holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Request);
                        holder.Button.Tag  = "Request";
                        break;

                    //Not Friend
                    case "0":
                    {
                        holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        holder.Button.SetTextColor(Color.ParseColor(AppSettings.MainColor));
                        if (AppSettings.ConnectivitySystem == 1)         // Following
                        {
                            holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Follow);
                        }
                        else         // Friend
                        {
                            holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_AddFriends);
                        }
                        holder.Button.Tag = "false";

                        var dbDatabase = new SqLiteDatabase();
                        dbDatabase.Delete_UsersContact(users.UserId);
                        dbDatabase.Dispose();
                        break;
                    }

                    default:
                    {
                        holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        holder.Button.SetTextColor(Color.ParseColor("#ffffff"));
                        if (AppSettings.ConnectivitySystem == 1)         // Following
                        {
                            holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Following);
                        }
                        else         // Friend
                        {
                            holder.Button.Text = ActivityContext.GetText(Resource.String.Lbl_Friends);
                        }

                        users.IsFollowing = "1";
                        holder.Button.Tag = "true";
                        break;
                    }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #19
0
        private void LoadDataUser(UserDataObject dataUser)
        {
            try
            {
                if (dataUser != null)
                {
                    CollapsingToolbar.Title = DeepSoundTools.GetNameFinal(dataUser);

                    FullGlideRequestBuilder.Load(dataUser.Cover).Into(ImageCover);
                    FullGlideRequestBuilder.Load(dataUser.Avatar).Into(ImageAvatar);

                    TxtFullName.Text = DeepSoundTools.GetNameFinal(dataUser);

                    IconPro.Visibility = dataUser.IsPro == 1 ? ViewStates.Visible : ViewStates.Gone;

                    if (dataUser.Verified == 1)
                    {
                        TxtFullName.SetCompoundDrawablesWithIntrinsicBounds(0, 0, Resource.Drawable.icon_checkmark_small_vector, 0);
                    }

                    if (DataUser.IsFollowing != null && DataUser.IsFollowing.Value) // My Friend
                    {
                        //BtnFollow.SetBackgroundResource(Resource.Drawable.SubcribeButton);
                        //BtnFollow.BackgroundTintList = ColorStateList.ValueOf(Color.ParseColor(AppSettings.MainColor));

                        //icon
                        var iconTick = Activity.GetDrawable(Resource.Drawable.ic_tick);
                        iconTick.Bounds = new Rect(10, 10, 10, 7);
                        BtnFollow.SetCompoundDrawablesWithIntrinsicBounds(iconTick, null, null, null);
                        BtnFollow.Tag = "friends";
                    }
                    else  //Not Friend
                    {
                        //BtnFollow.SetBackgroundResource(Resource.Drawable.SubcribeButton);
                        //BtnFollow.BackgroundTintList = ColorStateList.ValueOf(Color.ParseColor("#444444"));

                        //icon
                        var iconAdd = Activity.GetDrawable(Resource.Drawable.ic_add);
                        iconAdd.Bounds = new Rect(10, 10, 10, 7);
                        BtnFollow.SetCompoundDrawablesWithIntrinsicBounds(iconAdd, null, null, null);
                        BtnFollow.Tag = "Add";
                    }

                    if (ActivitiesFragment?.IsCreated == true)
                    {
                        ActivitiesFragment.PopulateData(dataUser.Activities);
                    }

                    if (AlbumsFragment?.IsCreated == true)
                    {
                        AlbumsFragment.PopulateData(dataUser.Albums);
                    }

                    if (LikedFragment?.IsCreated == true)
                    {
                        LikedFragment.PopulateData(dataUser.Liked);
                    }

                    if (PlaylistFragment?.IsCreated == true)
                    {
                        PlaylistFragment.PopulateData(dataUser.Playlists);
                    }

                    if (SongsFragment?.IsCreated == true)
                    {
                        SongsFragment.PopulateData(dataUser.TopSongs);
                    }

                    if (StationsFragment?.IsCreated == true)
                    {
                        StationsFragment.PopulateData(dataUser.Stations);
                    }

                    if (StoreFragment?.IsCreated == true)
                    {
                        StoreFragment.PopulateData(dataUser.Store);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #20
0
        private static void HandleNotificationOpened(OSNotificationOpenedResult result)
        {
            try
            {
                OSNotificationPayload       payload        = result.notification.payload;
                Dictionary <string, object> additionalData = payload.additionalData;

                string message = payload.body;
                Console.WriteLine(message);

                string actionId = result.action.actionID;
                if (additionalData != null)
                {
                    TypeText = "User";
                    foreach (var item in additionalData)
                    {
                        switch (item.Key)
                        {
                        case "user_id":
                            Userid = item.Value.ToString();
                            break;

                        case "track":
                        {
                            TrackId = item.Value.ToString();
                            if (!string.IsNullOrEmpty(TrackId))
                            {
                                TypeText = "Track";
                            }
                            break;
                        }

                        case "user_data":
                            UserData = JsonConvert.DeserializeObject <UserDataObject>(item.Value.ToString());
                            break;

                        case "url":
                        {
                            string url = item.Value.ToString();
                            Console.WriteLine(url);
                            break;
                        }
                        }
                    }

                    //to : do
                    //go to activity or fragment depending on data

                    Intent intent = new Intent(Application.Context, typeof(HomeActivity));
                    intent.SetFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask);
                    intent.AddFlags(ActivityFlags.SingleTop);
                    intent.SetAction(Intent.ActionView);
                    intent.PutExtra("TypeNotification", TypeText);
                    Application.Context.StartActivity(intent);

                    if (additionalData.ContainsKey("discount"))
                    {
                        // Take user to your store..
                    }
                }
                if (actionId != null)
                {
                    // actionSelected equals the id on the button the user pressed.
                    // actionSelected will equal "__DEFAULT__" when the notification itself was tapped when buttons were present.
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Example #21
0
 public override bool ValidateUser(string username, string password)
 {
     return(UserDataObject.IsValid(username, password));
 }
Example #22
0
    // Use this for initialization
    void Start()
    {
        // Enable handcursor in execution mode
        KinectManager = GameObject.Find("KinectManager");
//		KinectManager.GetComponent<InteractionManager>().showHandCursor = true;

        _kinectManager = KinectManager.GetComponent <KinectManager>();
        if (!_kinectManager.displayUserMapSmall)
        {
            _kinectManager.displayUserMapSmall = true;
        }

        Debug.Log("Enable handcursor");

        imageConfidenceList  = new List <Image>();
        imageTimeList        = new List <Image>();
        imageAttemptsList    = new List <Image>();
        imageTimeValue       = new List <float>();
        imageConfidenceValue = new List <float>();
        imageAttemptsValue   = new List <float>();

        // Set the title of current exercise
        exerciseNameText.text = UserDataObject.GetCurrentExerciseName().ToUpper();
        textStandingLeg.text  = UserDataObject.GetCurrentSide().direction;

        // Output summary data from exercise
        OutputData();

        _currentExercise = UserDataObject.GetCurrentExercise();
        _lastExercise    = UserDataObject.GetLastTierExercise();

        Debug.Log("GetCurrentExercise: " + UserDataObject.GetCurrentExercise().fileName);
        Debug.Log("GetLastTierExercise " + UserDataObject.GetLastTierExercise().fileName);
        Debug.Log(PlayerPrefs.GetInt("CurrentExerciseId"));

        // Check if a side is not accomplished
        foreach (var side in _currentExercise.sides)
        {
            Debug.Log(side.direction);
            Debug.Log(side.accomplished);
            if (side.accomplished == false)
            {
                sideNotAccomplished = true;
            }
        }

        // Not last exercise --> load following exercise
        if (_currentExercise != _lastExercise || sideNotAccomplished)
        {
            Debug.Log("any sideNotAccomplished? : " + sideNotAccomplished);
            if (sideNotAccomplished)
            {
                buttonNextExercise.GetComponentInChildren <Text>().text = "Next Side";
                buttonNextExercise.onClick.AddListener(() =>
                {
                    Debug.Log("currentside id : " + PlayerPrefs.GetInt("CurrentSideId"));

                    if (PlayerPrefs.GetInt("CurrentSideId") == 0)
                    {
                        Debug.Log("LOAD LEFT");
                        PlayerPrefs.SetInt("CurrentSideId", 1);
                        LoadNextScene("Left");
                    }
                    else if (PlayerPrefs.GetInt("CurrentSideId") == 1)
                    {
                        Debug.Log("LOAD RIGHT");
                        PlayerPrefs.SetInt("CurrentSideId", 0);
                        LoadNextScene("Right");
                    }
                });
            }
            else             // all sides accomplished --> load next exercise
            {
                PlayerPrefs.SetInt("CurrentExerciseId", PlayerPrefs.GetInt("CurrentExerciseId") + 1);
                buttonNextExercise.onClick.AddListener(() =>
                {
                    SceneManager.LoadScene("ExerciseSideSelection");
                });
            }
        }
        else         // all exercises completed --> load TierMenu
        {
            buttonNextExercise.GetComponentInChildren <Text>().text = "Level Summary";
            buttonNextExercise.onClick.AddListener(() =>
            {
                SceneManager.LoadScene("TierSummary");
            });
        }
    }
        private void LoadDataUser(UserDataObject data)
        {
            try
            {
                //Cover
                GlideImageLoader.LoadImage(this, data.Cover, CoverImage, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);

                //profile_picture
                GlideImageLoader.LoadImage(this, data.Avatar, UserProfileImage, ImageStyle.CircleCrop, ImagePlaceholders.Drawable);

                UserDetails.FullName = data.Name;

                TxtFullname.Text  = WoWonderTools.GetNameFinal(data);
                TxtUserName.Text  = "@" + data.Username;
                TxtFirstName.Text = Methods.FunString.DecodeString(data.FirstName);
                TxtLastName.Text  = Methods.FunString.DecodeString(data.LastName);

                if (data.Details.DetailsClass != null)
                {
                    var following = Methods.FunString.FormatPriceValue(Convert.ToInt32(data.Details.DetailsClass?.FollowingCount));
                    var followers = Methods.FunString.FormatPriceValue(Convert.ToInt32(data.Details.DetailsClass?.FollowersCount));

                    if (AppSettings.ConnectivitySystem == 1)
                    {
                        TxtFollowing.Visibility      = ViewStates.Visible;
                        TxtFollowingCount.Visibility = ViewStates.Visible;

                        TxtFollowers.Visibility      = ViewStates.Visible;
                        TxtFollowersCount.Visibility = ViewStates.Visible;

                        TxtFollowing.Text      = GetText(Resource.String.Lbl_Following);
                        TxtFollowingCount.Text = following;

                        TxtFollowers.Text      = GetText(Resource.String.Lbl_Followers);
                        TxtFollowersCount.Text = followers;
                    }
                    else
                    {
                        TxtFollowing.Visibility      = ViewStates.Visible;
                        TxtFollowingCount.Visibility = ViewStates.Visible;

                        TxtFollowers.Visibility      = ViewStates.Gone;
                        TxtFollowersCount.Visibility = ViewStates.Gone;

                        TxtFollowing.Text      = GetText(Resource.String.Lbl_Friends);
                        TxtFollowingCount.Text = following;
                    }
                }

                switch (data.Gender.ToLower())
                {
                case "male":
                    TxtGenderText.Text = GetText(Resource.String.Radio_Male);
                    break;

                case "female":
                    TxtGenderText.Text = GetText(Resource.String.Radio_Female);
                    break;

                default:
                    TxtGenderText.Text = data.Gender;
                    break;
                }

                TxtLocationText.Text = data.Address;
                TxtMobileText.Text   = data.PhoneNumber;
                TxtWebsiteText.Text  = data.Website;
                TxtWorkText.Text     = data.Working;

                TxtFacebookText.Text  = data.Facebook;
                TxtGoogleText.Text    = data.Google;
                TxtTwitterText.Text   = data.Twitter;
                TxtVkText.Text        = data.Vk;
                TxtInstagramText.Text = data.Instagram;
                TxtYoutubeText.Text   = data.Youtube;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        private void LoadUserData(UserDataObject cl, bool friends = true)
        {
            try
            {
                PPrivacy = cl.PPrivacy;

                GlideImageLoader.LoadImage(Activity, cl.Avatar, UserProfileImage, ImageStyle.RoundedCrop, ImagePlaceholders.Color);
                UserProfileImage.SetScaleType(ImageView.ScaleType.CenterCrop);

                TextSanitizerAutoLink.Load(AppTools.GetAboutFinal(cl));
                AboutLiner.Visibility = ViewStates.Visible;

                Username.Text = "@" + cl.Username;
                Fullname.Text = AppTools.GetNameFinal(cl);

                IconVerified.Visibility = cl.Verified == "1" ? ViewStates.Visible : ViewStates.Gone;

                IconBusiness.Visibility = cl.BusinessAccount == "1" ? ViewStates.Visible : ViewStates.Gone;

                Typeface font = Typeface.CreateFromAsset(Application.Context.Resources.Assets, "ionicons.ttf");

                TxtCountFav.Text       = Methods.FunString.FormatPriceValue(Int32.Parse(cl.PostsCount));
                TxtCountFollowers.Text = Methods.FunString.FormatPriceValue(Convert.ToInt32(cl.Followers));
                TxtCountFollowing.Text = Methods.FunString.FormatPriceValue(Convert.ToInt32(cl.Following));

                if (!string.IsNullOrEmpty(cl.Google))
                {
                    Google = cl.Google;
                    SocialGoogle.SetTypeface(font, TypefaceStyle.Normal);
                    SocialGoogle.Text       = IonIconsFonts.SocialGoogle;
                    SocialGoogle.Visibility = ViewStates.Visible;
                }

                if (!string.IsNullOrEmpty(cl.Facebook))
                {
                    Facebook = cl.Facebook;
                    SocialFacebook.SetTypeface(font, TypefaceStyle.Normal);
                    SocialFacebook.Text       = IonIconsFonts.SocialFacebook;
                    SocialFacebook.Visibility = ViewStates.Visible;
                }

                if (!string.IsNullOrEmpty(cl.Website))
                {
                    Website = cl.Website;
                    WebsiteButton.SetTypeface(font, TypefaceStyle.Normal);
                    WebsiteButton.Text       = IonIconsFonts.AndroidGlobe;
                    WebsiteButton.Visibility = ViewStates.Visible;
                }

                if (!string.IsNullOrEmpty(cl.Twitter))
                {
                    Twitter = cl.Twitter;
                    SocialTwitter.SetTypeface(font, TypefaceStyle.Normal);
                    SocialTwitter.Text       = IonIconsFonts.SocialTwitter;
                    SocialTwitter.Visibility = ViewStates.Visible;
                }

                if (cl.IsFollowing != null)
                {
                    SIsFollowing = cl.IsFollowing.Value;
                    if (!friends)
                    {
                        return;
                    }

                    if (cl.IsFollowing.Value) // My Friend
                    {
                        FollowButton.SetBackgroundResource(Resource.Drawable.Shape_Radius_Grey_Btn);
                        FollowButton.SetTextColor(Color.ParseColor("#000000"));
                        FollowButton.Text = Context.GetText(Resource.String.Lbl_Following);
                        FollowButton.Tag  = "true";
                    }
                    else
                    {
                        //Not Friend
                        FollowButton.SetBackgroundResource(Resource.Drawable.Shape_Radius_Gradient_Btn);
                        FollowButton.SetTextColor(Color.ParseColor("#ffffff"));
                        FollowButton.Text = Context.GetText(Resource.String.Lbl_Follow);
                        FollowButton.Tag  = "false";
                    }

                    MessageButton.Visibility = cl.CPrivacy == "1" || cl.CPrivacy == "2" && cl.IsFollowing.Value
                        ? ViewStates.Visible
                        : ViewStates.Invisible;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #25
0
 public async Task <object> ResetPassword(UserDataObject userDataObject)
 {
     return(await _authService.ResetPassword(userDataObject));
 }
        public static void UpdateLastIdMessage(ChatMessagesDataObject messages, UserDataObject userData)
        {
            try
            {
                var checker = MessagesBoxActivity.MAdapter.MessageList.FirstOrDefault(a => a.Id == Convert.ToInt32(messages.Hash));
                if (checker != null)
                {
                    checker.Id             = messages.Id;
                    checker.Id             = messages.Id;
                    checker.FromId         = messages.FromId;
                    checker.ToId           = messages.ToId;
                    checker.Text           = messages.Text;
                    checker.Seen           = messages.Seen;
                    checker.Time           = messages.Time;
                    checker.FromDeleted    = messages.FromDeleted;
                    checker.ToDeleted      = messages.ToDeleted;
                    checker.SentPush       = messages.SentPush;
                    checker.NotificationId = messages.NotificationId;
                    checker.TypeTwo        = messages.TypeTwo;
                    checker.Image          = messages.Image;
                    checker.FullImage      = messages.FullImage;
                    checker.ApiPosition    = messages.ApiPosition;
                    checker.ApiType        = messages.ApiType;

                    var dataUser = LastChatActivity.MAdapter?.UserList?.FirstOrDefault(a => a.User.Id == messages.ToId);
                    if (dataUser != null)
                    {
                        var index = LastChatActivity.MAdapter?.UserList?.IndexOf(LastChatActivity.MAdapter.UserList?.FirstOrDefault(x => x.User.Id == messages.ToId));
                        if (index > -1)
                        {
                            LastChatActivity.MAdapter?.UserList?.Move(Convert.ToInt32(index), 0);
                            LastChatActivity.MAdapter?.NotifyItemMoved(Convert.ToInt32(index), 0);

                            var data = LastChatActivity.MAdapter?.UserList?.FirstOrDefault(a => a.User.Id == dataUser.User.Id);
                            if (data != null)
                            {
                                data.GetCountSeen   = 0;
                                data.User           = dataUser.User;
                                data.GetLastMessage = checker;

                                LastChatActivity.MAdapter.NotifyDataSetChanged();
                            }
                        }
                    }
                    else
                    {
                        if (userData != null)
                        {
                            LastChatActivity.MAdapter?.UserList?.Insert(0, new DataConversation()
                            {
                                GetCountSeen   = 0,
                                User           = userData,
                                GetLastMessage = checker,
                            });

                            LastChatActivity.MAdapter?.NotifyItemInserted(0);
                        }
                    }

                    SqLiteDatabase dbDatabase = new SqLiteDatabase();

                    //Update All data users to database
                    dbDatabase.InsertOrUpdateToOneMessages(checker);
                    dbDatabase.Dispose();

                    MessagesBoxActivity.UpdateOneMessage(checker);

                    if (AppSettings.RunSoundControl)
                    {
                        Methods.AudioRecorderAndPlayer.PlayAudioFromAsset("Popup_SendMesseges.mp3");
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #27
0
        // Get data To My Profile Table
        public void GetDataMyInfo()
        {
            try
            {
                using (OpenConnection())
                {
                    if (Connection == null)
                    {
                        return;
                    }

                    var listData = new ObservableCollection <UserDataObject>();
                    var user     = Connection.Table <DataTables.InfoUsersTb>().FirstOrDefault();
                    if (user != null)
                    {
                        UserDataObject data = new UserDataObject()
                        {
                            Id           = user.Id,
                            Username     = user.Username,
                            Email        = user.Email,
                            IpAddress    = user.IpAddress,
                            Name         = user.Name,
                            Gender       = user.Gender,
                            EmailCode    = user.EmailCode,
                            Language     = user.Language,
                            Avatar       = user.Avatar,
                            Cover        = user.Cover,
                            Src          = user.Src,
                            CountryId    = user.CountryId,
                            Age          = user.Age,
                            About        = user.About,
                            Google       = user.Google,
                            Facebook     = user.Facebook,
                            Twitter      = user.Twitter,
                            Instagram    = user.Instagram,
                            Website      = user.Website,
                            Active       = user.Active,
                            Admin        = user.Admin,
                            Verified     = user.Verified,
                            LastActive   = user.LastActive,
                            Registered   = user.Registered,
                            Uploads      = user.Uploads,
                            Wallet       = user.Wallet,
                            Balance      = user.Balance,
                            Artist       = user.Artist,
                            IsPro        = user.IsPro,
                            ProTime      = user.ProTime,
                            LastFollowId = user.LastFollowId,
                            OrAvatar     = user.OrAvatar,
                            OrCover      = user.OrCover,
                            Url          = user.Url,
                            AboutDecoded = user.AboutDecoded,
                            NameV        = user.NameV,
                            CountryName  = user.CountryName,
                            GenderText   = user.GenderText,
                        };

                        listData.Add(data);

                        UserDetails.Avatar   = user.Avatar;
                        UserDetails.Cover    = user.Cover;
                        UserDetails.Username = user.Username;
                        UserDetails.FullName = user.Name;
                        UserDetails.Email    = user.Email;

                        ListUtils.MyUserInfoList = new ObservableCollection <UserDataObject>();
                        ListUtils.MyUserInfoList.Clear();
                        ListUtils.MyUserInfoList = listData;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #28
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                SetTheme(AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base);

                Window.SetSoftInputMode(SoftInput.AdjustResize);
                base.OnCreate(savedInstanceState);

                if (AppSettings.SetTabDarkTheme)
                {
                    Window.SetBackgroundDrawableResource(Resource.Drawable.chatBackground3_Dark);
                }
                else
                {
                    Window.SetBackgroundDrawableResource(Resource.Drawable.chatBackground3);
                }

                // Set our view from the "MessagesBox_Layout" layout resource
                SetContentView(Resource.Layout.MessagesBox_Layout);

                var data = Intent.GetStringExtra("UserId") ?? "Data not available";
                if (data != "Data not available" && !string.IsNullOrEmpty(data))
                {
                    Userid = data;                                                              // to_id
                }
                var type = Intent.GetStringExtra("TypeChat") ?? "Data not available";
                if (type != "Data not available" && !string.IsNullOrEmpty(type))
                {
                    TypeChat = type;
                    string  json = Intent.GetStringExtra("UserItem");
                    dynamic item;
                    switch (type)
                    {
                    case "LastChat":
                        item = JsonConvert.DeserializeObject <GetChatsObject.Data>(json);
                        if (item != null)
                        {
                            DataUser = item;
                        }
                        break;

                    case "Owner":
                        item = JsonConvert.DeserializeObject <UserDataObject>(json);
                        if (item != null)
                        {
                            UserInfoData = item;
                        }
                        break;
                    }
                }

                //Get Value And Set Toolbar
                InitComponent();
                InitToolbar();
                SetRecyclerViewAdapters();


                //Set Title ToolBar and data chat user
                loadData_ItemUser();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #29
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 !);
            }
        }
        //############# DON'T MODIFY HERE #############
        //========================= Functions =========================

        public static async Task SendMessageTask(long userId, string text, string path, string hashId, UserDataObject userData)
        {
            try
            {
                var(apiStatus, respond) = await RequestsAsync.Chat.SendMessageAsync(userId.ToString(), text, path, hashId);

                if (apiStatus == 200)
                {
                    if (respond is SendMessageObject result)
                    {
                        if (result.Data != null)
                        {
                            UpdateLastIdMessage(result.Data, userData);
                        }
                    }
                }
                else if (apiStatus == 400)
                {
                    if (respond is ErrorObject error)
                    {
                        var errorText = error.Error;
                        Toast.MakeText(Application.Context, errorText, ToastLength.Short);
                    }
                }
                else if (apiStatus == 404)
                {
                    var error = respond.ToString();
                    Toast.MakeText(Application.Context, error, ToastLength.Short);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Example #31
0
        public void UserLoggedIn(UserDataObject user)
        {
            var repository = new UserLoginHistoryRepository();

            repository.Create(user.ToEntity());
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);
                SetTheme(AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base);

                View mContentView = Window.DecorView;
                var  uiOptions    = (int)mContentView.SystemUiVisibility;
                var  newUiOptions = uiOptions;

                newUiOptions |= (int)SystemUiFlags.LayoutStable;
                newUiOptions |= (int)SystemUiFlags.LayoutFullscreen;
                mContentView.SystemUiVisibility = (StatusBarVisibility)newUiOptions;

                Window.AddFlags(WindowManagerFlags.Fullscreen);

                // Create your application here
                SetContentView(Resource.Layout.UserProfile_Layout);

                NamePage = Intent.GetStringExtra("NamePage") ?? string.Empty;

                SUserId = Intent.GetStringExtra("UserId") ?? string.Empty;

                var userObject = Intent.GetStringExtra("UserObject");
                if (!string.IsNullOrEmpty(userObject))
                {
                    try
                    {
                        if (NamePage == "Chat")
                        {
                            if (AppSettings.LastChatSystem == SystemApiGetLastChat.New)
                            {
                                UserData = JsonConvert.DeserializeObject <UserDataObject>(userObject);
                            }
                            else if (AppSettings.LastChatSystem == SystemApiGetLastChat.Old)
                            {
                                UserData = JsonConvert.DeserializeObject <GetUsersListObject.User>(userObject);
                            }
                            else
                            {
                                UserData = JsonConvert.DeserializeObject <UserDataObject>(userObject);
                            }
                        }
                        else
                        {
                            UserData = JsonConvert.DeserializeObject <UserDataObject>(userObject);
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }
                }

                //Get Value And Set Toolbar
                InitComponent();
                InitToolbar();
                SetRecyclerViewAdapters();

                MAdView = FindViewById <AdView>(Resource.Id.adView);
                AdsGoogle.InitAdView(MAdView, null);

                //Get Data User
                if (UserData != null)
                {
                    LoadDataUser(UserData);
                }

                GetFiles();

                StartApiService();

                AdsGoogle.Ad_Interstitial(this);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }