Skip to content

Commit

Permalink
Merge branch 'trunk' into 886-replace-file_selector-with-file_picker-…
Browse files Browse the repository at this point in the history
…in-all-of-our-dependencies
  • Loading branch information
CurtlyCritchlow authored Jan 8, 2025
2 parents 2f32a0d + 5775e84 commit 353057f
Show file tree
Hide file tree
Showing 8 changed files with 202 additions and 154 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/melos_bootstrap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 # v2.17.0
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff # v2.18.0
with:
channel: "stable"
- name: flutter pub get
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: SARIF file
path: results.sarif
retention-days: 5

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
uses: github/codeql-action/upload-sarif@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0
with:
sarif_file: results.sarif
4 changes: 2 additions & 2 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ jobs:

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: subosito/flutter-action@74af56c5ed2697ba4621264652728e8d217e53d3 # v2.17.0
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff # v2.18.0
with:
channel: "${{ matrix.flutter-channel}}"
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: 'stable'
cache-dependency-path: tools/osv-scanner/go.sum
Expand Down
34 changes: 17 additions & 17 deletions packages/at_onboarding_flutter/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -138,29 +138,29 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/webview_flutter_wkwebview/darwin"

SPEC CHECKSUMS:
at_backupkey_flutter: 2fc3d01138175e41bce8b574387a47544c53e01b
at_file_saver: c0e052c72d8c0296318bd70f2ae7f510887014ce
at_onboarding_flutter: e8219b6d0bfb236d3837ec3528871aebdcc56e8d
biometric_storage: 1400f1382af3a4cc2bf05340e13c3d8de873ceb9
device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
at_backupkey_flutter: 48921a75415718560c801a16374cd504b714c5aa
at_file_saver: 7341b40c09bde071008a40555d3e38fa0646e65e
at_onboarding_flutter: 2cbfcd94971fed75fb1360871481381e5fa51998
biometric_storage: 662167ef947fba48891850f0b3042f892a839e9a
device_info_plus: 71ffc6ab7634ade6267c7a93088ed7e4f74e5896
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
file_picker: 09aa5ec1ab24135ccd7a1621c46c84134bfd6655
file_selector_ios: f0670c1064a8c8450e38145d8043160105d0b97c
file_picker: 9b3292d7c8bc68c8a7bf8eb78f730e49c8efc517
file_selector_ios: f92e583d43608aebc2e4a18daac30b8902845502
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_keychain: 01aabf894ffe8b01adfda1d9df21c210c1b4b452
flutter_keychain: 082382ca04745cc72ed13aa3598c151bb2eb426b
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
permission_handler_apple: 4ed2196e43d0651e8ff7ca3483a069d469701f2d
qr_code_scanner: d77f94ecc9abf96d9b9b8fc04ef13f611e5a147a
SDWebImage: 72f86271a6f3139cc7e4a89220946489d4b9a866
share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
share_plus: 50da8cb520a8f0f65671c6c6a99b3617ed10a58a
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
webview_flutter_wkwebview: 0982481e3d9c78fd5c6f62a002fcd24fc791f1e4
url_launcher_ios: 694010445543906933d732453a59da0a173ae33d
webview_flutter_wkwebview: 44d4dee7d7056d5ad185d25b38404436d56c547c

PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048

COCOAPODS: 1.14.3
COCOAPODS: 1.16.2
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ class AtOnboardingAccountsScreen extends StatefulWidget {
}) : super(key: key);

@override
State<AtOnboardingAccountsScreen> createState() => _AtOnboardingAccountsScreenState();
State<AtOnboardingAccountsScreen> createState() =>
_AtOnboardingAccountsScreenState();
}

class _AtOnboardingAccountsScreenState extends State<AtOnboardingAccountsScreen> {
class _AtOnboardingAccountsScreenState
extends State<AtOnboardingAccountsScreen> {
List<String> pairedAtsignsList = [];
Object? lastSelectedIndex;
late int greyStartIndex;
Expand Down Expand Up @@ -66,80 +68,68 @@ class _AtOnboardingAccountsScreenState extends State<AtOnboardingAccountsScreen>
),
body: Padding(
padding: const EdgeInsets.all(16),
child: pairedAtsignsList.isEmpty
? Center(
child: Column(
children: <Widget>[
CircularProgressIndicator(valueColor: AlwaysStoppedAnimation<Color>(theme.primaryColor)),
Text(
AtOnboardingLocalizations.current.loading_atSigns,
style: const TextStyle(
fontSize: AtOnboardingDimens.fontLarge,
fontWeight: FontWeight.bold,
),
),
],
),
child: Column(
children: <Widget>[
Text(
widget.message ??
AtOnboardingLocalizations.current.title_select_atSign,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: AtOnboardingDimens.fontNormal,
),
),
const SizedBox(height: 10),
if (widget.newAtsign != null) ...<Widget>[
const Divider(thickness: 0.8),
RadioListTile<Object>(
controlAffinity: ListTileControlAffinity.trailing,
groupValue: lastSelectedIndex,
onChanged: (Object? value) {
setState(() {
lastSelectedIndex = value;
});
_showAlert(widget.newAtsign!, context);
},
value: 'new',
activeColor: theme.primaryColor,
title: Text('@${widget.newAtsign}',
style: const TextStyle(fontWeight: FontWeight.bold)),
)
: Column(
children: <Widget>[
Text(
widget.message ?? AtOnboardingLocalizations.current.title_select_atSign,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: AtOnboardingDimens.fontNormal,
),
),
const SizedBox(height: 10),
if (widget.newAtsign != null) ...<Widget>[
const Divider(thickness: 0.8),
RadioListTile<Object>(
],
const Divider(thickness: 0.8),
Expanded(
child: ListView.builder(
itemCount: widget.atsigns.length,
itemBuilder: (BuildContext context, int index) {
String currentItem = '@${widget.atsigns[index]}';
bool isExist = pairedAtsignsList.contains(currentItem);
return Padding(
padding: const EdgeInsets.symmetric(vertical: 2.0),
child: RadioListTile<Object>(
controlAffinity: ListTileControlAffinity.trailing,
groupValue: lastSelectedIndex,
onChanged: (Object? value) {
setState(() {
lastSelectedIndex = value;
});
_showAlert(widget.newAtsign!, context);
},
value: 'new',
onChanged: isExist
? null
: (Object? value) {
setState(() {
lastSelectedIndex = value;
});
_showAlert(
widget.atsigns[
int.parse(lastSelectedIndex.toString())],
context,
);
},
value: index,
activeColor: theme.primaryColor,
title: Text('@${widget.newAtsign}', style: const TextStyle(fontWeight: FontWeight.bold)),
)
],
const Divider(thickness: 0.8),
Expanded(
child: ListView.builder(
itemCount: widget.atsigns.length,
itemBuilder: (BuildContext context, int index) {
String currentItem = '@${widget.atsigns[index]}';
bool isExist = pairedAtsignsList.contains(currentItem);
return Padding(
padding: const EdgeInsets.symmetric(vertical: 2.0),
child: RadioListTile<Object>(
controlAffinity: ListTileControlAffinity.trailing,
groupValue: lastSelectedIndex,
onChanged: isExist
? null
: (Object? value) {
setState(() {
lastSelectedIndex = value;
});
_showAlert(
widget.atsigns[int.parse(lastSelectedIndex.toString())],
context,
);
},
value: index,
activeColor: theme.primaryColor,
title: Text(currentItem),
),
);
},
title: Text(currentItem),
),
),
],
);
},
),
),
],
),
),
),
);
Expand All @@ -163,11 +153,15 @@ class _AtOnboardingAccountsScreenState extends State<AtOnboardingAccountsScreen>
style: theme.textTheme.bodyLarge,
children: <InlineSpan>[
TextSpan(
text: AtOnboardingLocalizations.current.title_pair_atSign_prev,
text:
AtOnboardingLocalizations.current.title_pair_atSign_prev,
),
TextSpan(text: ' $atsign ', style: const TextStyle(fontWeight: FontWeight.bold)),
TextSpan(
text: AtOnboardingLocalizations.current.title_pair_atSign_next,
text: ' $atsign ',
style: const TextStyle(fontWeight: FontWeight.bold)),
TextSpan(
text:
AtOnboardingLocalizations.current.title_pair_atSign_next,
)
],
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:convert';
import 'dart:io';

import 'package:at_client_mobile/at_client_mobile.dart';
import 'package:at_onboarding_flutter/at_onboarding_result.dart';
import 'package:at_onboarding_flutter/localizations/generated/l10n.dart';
import 'package:at_onboarding_flutter/screen/at_onboarding_backup_screen.dart';
Expand Down Expand Up @@ -103,7 +102,8 @@ class _AtOnboardingActivateScreenState
),
const SizedBox(height: 10),
Text(
AtOnboardingLocalizations.current.msg_wait_fetching_atSign,
AtOnboardingLocalizations
.current.msg_wait_fetching_atSign,
),
],
),
Expand Down Expand Up @@ -146,7 +146,7 @@ class _AtOnboardingActivateScreenState
data = jsonDecode(data);

AtOnboardingOTPResult? result;
if(context.mounted) {
if (context.mounted) {
result = await AtOnboardingOTPScreen.push(
context: context,
atSign: atsign ?? (widget.atSign ?? ''),
Expand Down Expand Up @@ -219,8 +219,11 @@ class _AtOnboardingActivateScreenState
_onboardingService.setAtClientPreference =
widget.config.atClientPreference;

authResponse = await _onboardingService.authenticate(atsign,
cramSecret: secret, status: OnboardingStatus.ACTIVATE);
String? previousAtsign = _onboardingService.currentAtsign;
_onboardingService.setAtsign = atsign;
authResponse = await _onboardingService.onboard(
cramSecret: secret,
);

int round = 1;
atSignStatus = await _onboardingService.checkAtSignServerStatus(atsign);
Expand All @@ -235,6 +238,11 @@ class _AtOnboardingActivateScreenState
debugPrint("currentAtSignStatus: $atSignStatus");
}

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

if (authResponse == AtOnboardingResponseStatus.authSuccess) {
if (atSignStatus == ServerStatus.teapot) {
await _showAlertDialog(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,12 +450,10 @@ class _AtOnboardingGenerateScreenState
);
}

Future<dynamic> _processSharedSecret({
Future<void> _processSharedSecret({
required String atSign,
required String secret,
}) async {
dynamic authResponse;
String cramSecret = secret.split(':').last;
String verifiedAtSign = atSign.startsWith('@') ? atSign : '@$atSign';

try {
Expand All @@ -474,15 +472,17 @@ class _AtOnboardingGenerateScreenState

await Future.delayed(const Duration(seconds: 10));

authResponse = await _onboardingService.authenticate(
verifiedAtSign,
cramSecret: cramSecret,
status: OnboardingStatus.ACTIVATE,
String? previousAtsign = _onboardingService.currentAtsign;
_onboardingService.setAtsign = verifiedAtSign;

final authResponse = await _onboardingService.onboard(
cramSecret: secret,
);

_inprogressDialog.close();
if (authResponse == AtOnboardingResponseStatus.authSuccess) {
if (authResponse) {
if (!mounted) return;
Navigator.push(
await Navigator.push(
context,
MaterialPageRoute(
builder: (_) => AtOnboardingBackupScreen(
Expand All @@ -493,19 +493,14 @@ class _AtOnboardingGenerateScreenState

if (!mounted) return;
Navigator.pop(
context, AtOnboardingResult.success(atsign: verifiedAtSign));
} else if (authResponse == AtOnboardingResponseStatus.serverNotReached) {
await _showAlertDialog(
AtOnboardingLocalizations.current.msg_atSign_unreachable,
context,
AtOnboardingResult.success(atsign: verifiedAtSign),
);
} else if (authResponse == AtOnboardingResponseStatus.authFailed) {
} else {
_onboardingService.setAtsign = previousAtsign;
await _showAlertDialog(
AtOnboardingLocalizations.current.error_authenticated_failed,
);
} else {
await showErrorDialog(
AtOnboardingLocalizations.current.msg_response_time_out,
);
}
} catch (e) {
_inprogressDialog.close();
Expand All @@ -527,7 +522,6 @@ class _AtOnboardingGenerateScreenState
);
}
}
return authResponse;
}

Future<void> _showAlertDialog(dynamic errorMessage, {String? title}) async {
Expand Down
Loading

0 comments on commit 353057f

Please sign in to comment.