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(); } }
public async Task CreateProfileAsync(UserSignUpInfo signUpInfo) { await ExecuteCreateProfileAsync(signUpInfo, true); }