Example #1
0
        private async Task ExecuteCreateProfileAsync(UserSignUpInfo signUpInfo, bool retryOnTokenException)
        {
            try
            {
                _connectivityService.CheckConnection();

                await _secretsProvider.InitializeAsync().ConfigureAwait(false);

                var identifier = await _secretsProvider.GetDeviceIdentifierAsync().ConfigureAwait(false);

                var request  = new RegisterRequest(signUpInfo.Username, signUpInfo.Password, identifier);
                var response = await _platformClient.Endpoints.RegisterUserAsync(request).ConfigureAwait(false);

                await _authenticationInfoService.InitUserInfoAsync(response.Metadata, response.UserProfile, response.Token).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Failed to create user profile.");
                if (!_serviceErrorHandler.TryHandle(ex, out var generatedException))
                {
                    throw;
                }

                if (generatedException is CreateProfileTokenValidationException)
                {
                    await ExecuteCreateProfileAsync(signUpInfo, false);

                    return;
                }

                generatedException.Rethrow();
            }
        }
        private async Task <InitializationResult> InitBluetoothAsync()
        {
            var deviceId = await _secretsProvider.GetDeviceIdentifierAsync().ConfigureAwait(false);

            var result = await _tracingEngine.SetupAsync(new TracingInformation(true, deviceId, Configuration.Constants.BluetoothConstants.ServiceUUID, Configuration.Constants.BluetoothConstants.CharacteristicUUID, Configuration.Constants.BluetoothConstants.DataExpirationTime));

            if (!result.Success)
            {
                return(result);
            }

            return(result);
        }