diff --git a/at_chat_flutter/example/pubspec.yaml b/at_chat_flutter/example/pubspec.yaml index c4d04c26..d5229469 100644 --- a/at_chat_flutter/example/pubspec.yaml +++ b/at_chat_flutter/example/pubspec.yaml @@ -27,6 +27,18 @@ dependencies: cupertino_icons: ^1.0.3 at_onboarding_flutter: ^2.1.1 +dependency_overrides: + at_client_mobile: + git: + url: https://github.com/atsign-foundation/at_client_sdk.git + path: at_client_mobile + ref: trunk + + at_client: + git: + url: https://github.com/atsign-foundation/at_client_sdk.git + path: at_client + ref: trunk dev_dependencies: flutter_test: diff --git a/at_chat_flutter/pubspec.yaml b/at_chat_flutter/pubspec.yaml index c5ad05a5..6eb5d312 100644 --- a/at_chat_flutter/pubspec.yaml +++ b/at_chat_flutter/pubspec.yaml @@ -18,7 +18,20 @@ dependencies: at_lookup: ^2.0.3 pedantic: ^1.11.0 #Picker - file_picker: ^4.0.0 + file_picker: ^3.0.2+2 + +dependency_overrides: + at_client_mobile: + git: + url: https://github.com/atsign-foundation/at_client_sdk.git + path: at_client_mobile + ref: trunk + + at_client: + git: + url: https://github.com/atsign-foundation/at_client_sdk.git + path: at_client + ref: trunk dev_dependencies: flutter_test: diff --git a/at_location_flutter/example/pubspec.yaml b/at_location_flutter/example/pubspec.yaml index 390919a8..8ae75c5d 100644 --- a/at_location_flutter/example/pubspec.yaml +++ b/at_location_flutter/example/pubspec.yaml @@ -25,6 +25,18 @@ dependencies: at_lookup: ^2.0.1 at_utils: ^2.0.1 +dependency_overrides: + at_client_mobile: + git: + url: https://github.com/atsign-foundation/at_client_sdk.git + path: at_client_mobile + ref: trunk + + at_client: + git: + url: https://github.com/atsign-foundation/at_client_sdk.git + path: at_client + ref: trunk dev_dependencies: flutter_test: sdk: flutter diff --git a/at_location_flutter/pubspec.yaml b/at_location_flutter/pubspec.yaml index 6cc0e65d..96c6d113 100644 --- a/at_location_flutter/pubspec.yaml +++ b/at_location_flutter/pubspec.yaml @@ -35,6 +35,19 @@ dependencies: at_common_flutter: ^2.0.2 pedantic: ^1.11.0 +dependency_overrides: + at_client_mobile: + git: + url: https://github.com/atsign-foundation/at_client_sdk.git + path: at_client_mobile + ref: trunk + + at_client: + git: + url: https://github.com/atsign-foundation/at_client_sdk.git + path: at_client + ref: trunk + dev_dependencies: flutter_test: sdk: flutter diff --git a/at_onboarding_flutter/lib/screens/pair_atsign.dart b/at_onboarding_flutter/lib/screens/pair_atsign.dart index 201041b1..16364b9a 100644 --- a/at_onboarding_flutter/lib/screens/pair_atsign.dart +++ b/at_onboarding_flutter/lib/screens/pair_atsign.dart @@ -1,7 +1,5 @@ -import 'dart:convert'; - import 'dart:async'; - +import 'dart:convert'; import 'dart:io'; import 'dart:typed_data'; @@ -22,12 +20,12 @@ import 'package:at_onboarding_flutter/widgets/custom_button.dart'; import 'package:at_onboarding_flutter/widgets/custom_dialog.dart'; import 'package:at_onboarding_flutter/widgets/custom_strings.dart'; import 'package:at_server_status/at_server_status.dart'; +import 'package:at_utils/at_logger.dart'; import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; import 'package:flutter_qr_reader/flutter_qr_reader.dart'; -import 'package:permission_handler/permission_handler.dart'; import 'package:path_provider/path_provider.dart' as path_provider; -import 'package:at_utils/at_logger.dart'; +import 'package:permission_handler/permission_handler.dart'; class PairAtsignWidget extends StatefulWidget { final OnboardingStatus? onboardStatus; @@ -101,8 +99,7 @@ class _PairAtsignWidgetState extends State { setState(() { loading = true; }); - bool isExist = - await (_onboardingService.isExistingAtsign(atsign) as FutureOr); + bool isExist = await _onboardingService.isExistingAtsign(atsign); if (isExist) { setState(() { loading = false; @@ -286,7 +283,7 @@ class _PairAtsignWidgetState extends State { loading = true; }); for (PlatformFile pickedFile in result?.files ?? []) { - String path = pickedFile.path!; + String path = pickedFile.path; File selectedFile = File(path); int length = selectedFile.lengthSync(); if (length < 10) { @@ -636,7 +633,7 @@ class _PairAtsignWidgetState extends State { _atsignStatus = atsignStatus ?? AtSignStatus.error; switch (_atsignStatus) { case AtSignStatus.teapot: - if (isExist!) { + if (isExist) { await _showAlertDialog(CustomStrings().pairedAtsign(atsign), getClose: true, onClose: _getAtsignForm); break; @@ -669,7 +666,7 @@ class _PairAtsignWidgetState extends State { break; case AtSignStatus.activated: - if (isExist!) { + if (isExist) { await _showAlertDialog(CustomStrings().pairedAtsign(atsign), getClose: true, onClose: _getAtsignForm); break; diff --git a/at_onboarding_flutter/lib/services/onboarding_service.dart b/at_onboarding_flutter/lib/services/onboarding_service.dart index cf90ebad..2ce38e4c 100644 --- a/at_onboarding_flutter/lib/services/onboarding_service.dart +++ b/at_onboarding_flutter/lib/services/onboarding_service.dart @@ -1,10 +1,11 @@ import 'dart:async'; + import 'package:at_client_mobile/at_client_mobile.dart'; import 'package:at_onboarding_flutter/utils/app_constants.dart'; import 'package:at_onboarding_flutter/utils/response_status.dart'; import 'package:at_server_status/at_server_status.dart'; -import 'package:flutter/material.dart'; import 'package:at_utils/at_logger.dart'; +import 'package:flutter/material.dart'; class OnboardingService { static final OnboardingService _singleton = OnboardingService._internal(); @@ -114,15 +115,15 @@ class OnboardingService { if (cramSecret != null) { _atClientPreference.privateKey = null; } - await atClientService + bool isAuthenticated = await atClientService .authenticate(atsign, _atClientPreference, - jsonData: jsonData, decryptKey: decryptKey, status: status) - .then((bool value) async { - _atsign = atsign; + jsonData: jsonData, decryptKey: decryptKey, status: status); + if(isAuthenticated){ + _atsign = atsign; atClientServiceMap.putIfAbsent(_atsign, () => atClientService); c.complete(ResponseStatus.AUTH_SUCCESS); await _sync(_atsign); - }); + } } catch (e) { _logger.severe('error in authenticating => ${e.toString()}'); if (e == ResponseStatus.TIME_OUT) { @@ -167,9 +168,9 @@ class OnboardingService { return atsign; } - Future isExistingAtsign(String? atsign) async { + Future isExistingAtsign(String? atsign) async { if (atsign == null) { - return null; + return false; } atsign = formatAtSign(atsign); List? atSignsList = await getAtsignList();