async void OnReset(object sender, EventArgs e)
        {
            var promptConfig = new PromptConfig
            {
                Message   = "Enter support code",
                InputType = InputType.Number
            };

            var promptResult = await UserDialogs.Instance.PromptAsync(promptConfig);

            if (promptResult.Ok)
            {
                var otp = promptResult.Text;

                if (!OtpService.ValidateOTP(otp))
                {
                    return;
                }

                Activity.RunOnUiThread(() =>
                {
                    UserDialogs.Instance.ShowLoading();
                });

                try
                {
                    // upload the realm
                    await SupportUtils.UploadDatabase();

                    Activity.RunOnUiThread(() =>
                    {
                        UserDialogs.Instance.Alert("Reset Complete. Please Login.");
                    });
                }
                catch (Exception ex)
                {
                    UserDialogs.Instance.Alert("Reset Failed.");
                    Crashes.TrackError(ex);
                }
                finally
                {
                    Activity.RunOnUiThread(UserDialogs.Instance.HideLoading);
                }
            }
        }
Example #2
0
        /// <summary>
        /// Upload Database
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        async void OnUploadDatabaseClick(object sender, EventArgs e)
        {
            UserDialogs.Instance.ShowLoading("Uploading");
            _uploadDatabaseButton.Enabled = false;

            try
            {
                await SupportUtils.UploadDatabase();

                UserDialogs.Instance.Alert("Upload Complete");
            }
            catch (Exception exception)
            {
                UserDialogs.Instance.Alert("Upload Failed");
                Crashes.TrackError(exception);
            }
            finally
            {
                UserDialogs.Instance.HideLoading();
                _uploadDatabaseButton.Enabled = true;
            }
        }