async Task ComparePhoneCodeAsync()
        {
            //if (!Validate())
            //{
            //    Mvx.Resolve<IProgressDialogManager>().ShowMessage("Error", "Field can't' be empty.");
            //    return;
            //}

            //if (SmsCode == profileData.PhoneCode)

            if (SmsCode == "1111")
            {
                profile.PhoneValidate = true;
                var result = await serverApiService.SaveProfileAsync(profile.Id, profile, profile.Token);

                if (CheckHttpStatuseCode(result.StatusCode))
                {
                    storedSettingsService.Profile      = profile;
                    storedSettingsService.IsAuthorized = true;
                    storedSettingsService.ProfileId    = profile.Id;
                    storedSettingsService.AuthToken    = profile.Token;
                    Close(this);
                    ShowViewModel <HomeViewModel>(new { name = result.FirstName, message = "Welcome, " });
                }
            }
            else
            {
                await Mvx.Resolve <IUserInteraction>().AlertAsync("Wrong SMS code! Please try again.", "Error");
            }
        }
Example #2
0
        public async Task <bool> SaveProfileAsync(Profile profile)
        {
            var result = await serverApiService.SaveProfileAsync(storedSettingsService.ProfileId, storedSettingsService.Profile, storedSettingsService.AuthToken);

            if (result.StatusCode == System.Net.HttpStatusCode.OK)
            {
                return(true);
            }
            else
            {
                await Mvx.Resolve <IUserInteraction>().AlertAsync("Your personal data was not saved. Please try again later", result.StatusCode.ToString());

                return(false);
            }
        }
        public async Task DataSynchronisationAsync()
        {
            if (storedSettingsService.IsDataSynchronized || storedSettingsService.Profile == null)
            {
                storedSettingsService.Profile = await serverApiService.GetProfileAsync(storedSettingsService.ProfileId, storedSettingsService.AuthToken);
            }
            if (storedSettingsService.TripCompleted != null)
            {
                await paymentProcessing.TripCompletedAsync(storedSettingsService.TripCompleted);
            }
            else
            {
                var result = await serverApiService.SaveProfileAsync(storedSettingsService.ProfileId, storedSettingsService.Profile, storedSettingsService.AuthToken);

                if (result != null)
                {
                    if (result.StatusCode == System.Net.HttpStatusCode.OK)
                    {
                        storedSettingsService.IsDataSynchronized = true;
                    }
                }
            }
        }