Skip to content

Commit

Permalink
Merge pull request #960 from atsign-foundation/fix-activation-of-acqu…
Browse files Browse the repository at this point in the history
…ired-atsign

fix(at_onboarding_flutter): fixed activation of an already acquired atsign
  • Loading branch information
Zambrella authored Jan 14, 2025
2 parents a3319f2 + fce1bbd commit a1acc49
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
4 changes: 4 additions & 0 deletions packages/at_onboarding_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 6.1.11

- **FIX**: Fixed an issue preventing an already acquired atSign from being activated

## 6.1.10

- **FIX**: Fixed an issue preventing a new atSign from being activated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,10 @@ class _AtOnboardingActivateScreenState
}
}

Future<dynamic> _processSharedSecret({
Future<void> _processSharedSecret({
required String atsign,
required String secret,
}) async {
dynamic authResponse;
try {
atsign = atsign.startsWith('@') ? atsign : '@$atsign';

Expand All @@ -221,12 +220,13 @@ class _AtOnboardingActivateScreenState

String? previousAtsign = _onboardingService.currentAtsign;
_onboardingService.setAtsign = atsign;
authResponse = await _onboardingService.onboard(
final authResponse = await _onboardingService.onboard(
cramSecret: secret,
);

int round = 1;
atSignStatus = await _onboardingService.checkAtSignServerStatus(atsign);
var atSignStatus =
await _onboardingService.checkAtSignServerStatus(atsign);
while (atSignStatus != ServerStatus.activated) {
if (round > 10) {
break;
Expand All @@ -238,12 +238,11 @@ class _AtOnboardingActivateScreenState
debugPrint("currentAtSignStatus: $atSignStatus");
}

if (authResponse != AtOnboardingResponseStatus.authSuccess ||
atSignStatus == ServerStatus.teapot) {
if (!authResponse || atSignStatus == ServerStatus.teapot) {
_onboardingService.setAtsign = previousAtsign;
}

if (authResponse == AtOnboardingResponseStatus.authSuccess) {
if (authResponse) {
if (atSignStatus == ServerStatus.teapot) {
await _showAlertDialog(
AtOnboardingLocalizations.current.msg_atSign_unreachable,
Expand All @@ -263,14 +262,6 @@ class _AtOnboardingActivateScreenState

if (!mounted) return;
Navigator.pop(context, AtOnboardingResult.success(atsign: atsign));
} else if (authResponse == AtOnboardingResponseStatus.serverNotReached) {
await _showAlertDialog(
AtOnboardingLocalizations.current.msg_atSign_unreachable,
);
} else if (authResponse == AtOnboardingResponseStatus.authFailed) {
await _showAlertDialog(
AtOnboardingLocalizations.current.error_authenticated_failed,
);
} else {
await showErrorDialog(
AtOnboardingLocalizations.current.title_session_expired,
Expand All @@ -294,7 +285,6 @@ class _AtOnboardingActivateScreenState
);
}
}
return authResponse;
}

Future<void> _showAlertDialog(dynamic errorMessage, {String? title}) async {
Expand Down
2 changes: 1 addition & 1 deletion packages/at_onboarding_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: at_onboarding_flutter
description: A Flutter plugin project for onboarding any atSign in atPlatform
apps with ease. Provides a QRscanner option and an upload key file option to
authenticate.
version: 6.1.10
version: 6.1.11
homepage: https://docs.atsign.com/
repository: https://github.com/atsign-foundation/at_widgets/tree/trunk/packages/at_onboarding_flutter
issue_tracker: https://github.com/atsign-foundation/at_widgets/issues
Expand Down

0 comments on commit a1acc49

Please sign in to comment.