コード例 #1
0
        public async Task<bool> RegisterEmail(CancellationToken ct, User user, Email email)
        {
            // TODO
            //string url = baseUri.ToString() + "users/emailaddress";
            await TaskEx.Delay(1000);

            return true;

            /*string url = " https://Tumblegatewaytest.Bumble.co.za/v1/" + "users/emailaddress";

            string json = "{\"token\":\"" + user.Token.ToString() + "\"";
            json += ",\"emailaddress\":\"" + email.EmailAddress + "\"";
            json += "}";

            RestResponse response = await RestService.Post(ct, url, json);

            if (response.Success)
            {
                var result = JsonConvert.DeserializeObject<RegisterResult>(response.Data);

                return true;
            }
            else if (!response.IsException)
            {
                response.Error.HandleError(this.GetType().Name, MethodBase.GetCurrentMethod().Name);

                return false;
            }
            else
            {
                throw new Exception(response.Data);
            }*/
        }
コード例 #2
0
        protected override void PageLoaded()
        {
            base.PageLoaded();

            OneTimePin = AppResources.IdentifyOneTimePinWaterMarkText;

            email = SimpleIoc.Default.GetInstance<Email>();

            SimpleIoc.Default.Unregister<Email>();

            base.ShowPopup(CustomPopupMessageType.Information, string.Format(AppResources.IdentifyOtpSentPopupText, email.EmailAddress), AppResources.CustomPopupGenericOkMessage, null);
        }
コード例 #3
0
ファイル: User.cs プロジェクト: CodeObsessed/drumbleapp
 public User(Guid id, Token token, Country country, bool dismissedLocationPopup, Coordinate location, DateTime? lastLocationUpdate, bool dismissedRateAppPopup, bool dismissedSignUpPopup, bool isBumbleRegistered, Email email, string firstName, string lastName, bool isFacebookRegistered, bool isTwitterRegistered, FacebookInfo facebookInfo, TwitterInfo twitterInfo, string twitterHandle, int appUsageCount, bool dismissedLoginUberPopup, UberInfo uberInfo, bool isUberAuthenticated)
     : this(id, token)
 {
     this.Country = country;
     this.DismissedLocationPopup = dismissedLocationPopup;
     this.LastKnownGeneralLocation = location;
     this.LastLocationUpdate = lastLocationUpdate;
     this.DismissedRateAppPopup = dismissedRateAppPopup;
     this.DismissedSignUpPopup = dismissedSignUpPopup;
     this.DismissedLoginUberPopup = dismissedLoginUberPopup;
     this.IsBumbleRegistered = isBumbleRegistered;
     this.Email = email;
     this.FirstName = firstName;
     this.LastName = lastName;
     this.IsFacebookRegistered = isFacebookRegistered;
     this.IsTwitterRegistered = isTwitterRegistered;
     this.IsUberAuthenticated = isUberAuthenticated;
     this.FacebookInfo = facebookInfo;
     this.TwitterInfo = twitterInfo;
     this.UberInfo = uberInfo;
     this.TwitterHandle = twitterHandle;
     this.AppUsageCount = appUsageCount;
 }
コード例 #4
0
        public async Task<User> Authorise(CancellationToken ct, User user, Email email, Pin onetimePin)
        {
            await TaskEx.Delay(1000);

            user.IsBumbleRegistered = true;

            return user;

            /*string url = baseUri.ToString() + "authentication/login";

            string json = "{\"appkey\":\"" + appKey.ToString() + "\",\"pin\":\"" + onetimePin.PinNumber + "\",\"emailaddress\":\"" + email.EmailAddress + "\"}";

            RestResponse response = await RestService.Post(url, json);

            if (response.Success)
            {
                return JsonConvert.DeserializeObject<IdentifyResult>(response.Data);
            }
            else if (!response.IsException)
            {
                response.Error.HandleError(this.GetType().Name, MethodBase.GetCurrentMethod().Name);

                return null;
            }
            else
            {
                throw new Exception(response.Data);
            }*/
        }
コード例 #5
0
        public async Task<ContactResult> Contact(CancellationToken ct, User user, Email from, string subject, string message)
        {
            string url = baseUri.ToString() + "users/" + user.Token.Value.ToString() + "/messages";

            string json = "{\"message\":" + JsonConvert.ToString(subject + "\n\n" + message) + "}";

            RestResponse response = await RestService.Post(ct, url, json, Guid.Empty, user.Token.Value);

            if (response.Success)
            {
                return JsonConvert.DeserializeObject<ContactResult>(response.Data);
            }
            else if (!response.IsException)
            {
                response.Error.HandleError(this.GetType().Name, MethodBase.GetCurrentMethod().Name);

                return null;
            }
            else
            {
                throw new Exception(response.Data);
            }
        }
コード例 #6
0
        private void RequestPin()
        {
            if (Email.Equals(AppResources.LoginEmailTextBoxWaterMark) || String.IsNullOrEmpty(Email))
            {
                base.ShowPopup(CustomPopupMessageType.Error, AppResources.LoginNoEmailErrorPopupText, AppResources.CustomPopupGenericOkMessage, null);
                return;
            }

            Email email;

            try
            {
                email = new Email(Email);
            }
            catch (Exception)
            {
                base.ShowPopup(CustomPopupMessageType.Error, AppResources.LoginNoEmailErrorPopupText, AppResources.CustomPopupGenericOkMessage, null);
                return;
            }

            base.ShowHeaderLoader();
            EmailTextBoxIsEnabled = false;

            Action registerEmail = async () =>
            {   
                try
                {
                    cancellationTokenSource = new CancellationTokenSource();

                    bool otpSent = await DrumbleApi.LoginEmail(cancellationTokenSource.Token, email);

                    if (otpSent)
                    {
                        SimpleIoc.Default.Unregister<Email>();

                        SimpleIoc.Default.Register<Email>(() =>
                        {
                            return email;
                        });

                        base.HideHeaderLoader();
                        EmailTextBoxIsEnabled = true;

                        Messenger.Default.Register<IdentifyMessage>(this, (action) => SetEmailDetails(action));

                        NavigationService.NavigateTo("/Views/Identify.xaml");
                    }
                    else
                    {
                        // TODO error display something went wrong... but what?
                    }
                }
                catch (Exception e)
                {
                    base.HideHeaderLoader();
                    EmailTextBoxIsEnabled = true;

                    base.ShowPopup(CustomPopupMessageType.Error, e.Message, AppResources.CustomPopupGenericOkMessage, null);
                }
            };

            DispatcherHelper.CheckBeginInvokeOnUI(registerEmail);
        }
コード例 #7
0
ファイル: User.cs プロジェクト: CodeObsessed/drumbleapp
 public async Task<bool> RegisterEmail(IDrumbleApiService DrumbleApi, CancellationToken cancellationToken, Email email)
 {
     return await DrumbleApi.RegisterEmail(cancellationToken, this, email);
 }