diff --git a/packages/at_backupkey_flutter/example/lib/main.dart b/packages/at_backupkey_flutter/example/lib/main.dart index 6191edd5a..f7d61f6e4 100644 --- a/packages/at_backupkey_flutter/example/lib/main.dart +++ b/packages/at_backupkey_flutter/example/lib/main.dart @@ -40,7 +40,6 @@ class _MyAppState extends State { Future futurePreference = loadAtClientPreference(); AtClientPreference? atClientPreference; - @override Widget build(BuildContext context) { return StreamBuilder( @@ -55,8 +54,8 @@ class _MyAppState extends State { primaryColor: const Color(0xFFf4533d), colorScheme: ThemeData.light().colorScheme.copyWith( primary: const Color(0xFFf4533d), + background: Colors.white, ), - backgroundColor: Colors.white, scaffoldBackgroundColor: Colors.white, ), darkTheme: ThemeData().copyWith( @@ -64,8 +63,8 @@ class _MyAppState extends State { primaryColor: Colors.blue, colorScheme: ThemeData.dark().colorScheme.copyWith( primary: Colors.blue, + background: Colors.grey[850], ), - backgroundColor: Colors.grey[850], scaffoldBackgroundColor: Colors.grey[850], ), themeMode: themeMode, @@ -188,7 +187,7 @@ class _HomeScreenState extends State { /// Use the AtClientManager instance to get the current atsign Text( 'Current @sign: ${atClientManager.atClient.getCurrentAtSign()}'), - + ElevatedButton.icon( icon: const Icon( Icons.file_copy, @@ -196,7 +195,9 @@ class _HomeScreenState extends State { ), label: const Text('Backup your key'), onPressed: () async { - BackupKeyWidget(atsign: atClientManager.atClient.getCurrentAtSign() ?? '') + BackupKeyWidget( + atsign: + atClientManager.atClient.getCurrentAtSign() ?? '') .showBackupDialog(context); }, ), diff --git a/packages/at_backupkey_flutter/example/pubspec.yaml b/packages/at_backupkey_flutter/example/pubspec.yaml index 769121666..b298a24a9 100644 --- a/packages/at_backupkey_flutter/example/pubspec.yaml +++ b/packages/at_backupkey_flutter/example/pubspec.yaml @@ -11,8 +11,6 @@ environment: dependencies: at_app_flutter: ^5.2.0 - at_backupkey_flutter: - path: ../ at_client_mobile: ^3.2.12 at_onboarding_flutter: ^6.1.3 cupertino_icons: ^1.0.6 @@ -24,6 +22,10 @@ dependencies: dev_dependencies: flutter_lints: ^2.0.3 +dependency_overrides: + at_backupkey_flutter: + path: ../ + # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec # The following section is specific to Flutter. diff --git a/packages/at_backupkey_flutter/test/at_backupkey_flutter_test.dart b/packages/at_backupkey_flutter/test/at_backupkey_flutter_test.dart index 8db536ad0..930d3d288 100644 --- a/packages/at_backupkey_flutter/test/at_backupkey_flutter_test.dart +++ b/packages/at_backupkey_flutter/test/at_backupkey_flutter_test.dart @@ -7,12 +7,20 @@ void main() { TestWidgetsFlutterBinding.ensureInitialized(); setUp(() { - channel.setMockMethodCallHandler((MethodCall methodCall) async { - return '42'; - }); + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler( + channel, + (MethodCall methodCall) async { + return '42'; + }, + ); }); tearDown(() { - channel.setMockMethodCallHandler(null); + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler( + channel, + null, + ); }); } diff --git a/packages/at_backupkey_flutter/test/backupkey_service_test.dart b/packages/at_backupkey_flutter/test/backupkey_service_test.dart index cd16b58ac..7b6d37975 100644 --- a/packages/at_backupkey_flutter/test/backupkey_service_test.dart +++ b/packages/at_backupkey_flutter/test/backupkey_service_test.dart @@ -13,36 +13,36 @@ void main() { group('Fetching AESKey', () { test('for registered @sign', () async { - MockDataService _mockDataService = MockDataService(atsign); - String aesKey = _mockDataService.getAESKey; + MockDataService mockDataService = MockDataService(atsign); + String aesKey = mockDataService.getAESKey; expect(aesKey.length == 44, true); }); test('for unregistered @sign', () async { - MockDataService _mockDataService = MockDataService(atsign + '123'); - String? aesKey = _mockDataService.getAESKey; + MockDataService mockDataService = MockDataService('${atsign}123'); + String? aesKey = mockDataService.getAESKey; expect(aesKey, null); }); }); group('Fetch EncryptedKeys', () { test('for registerd @sign', () async { - MockDataService _mockDataService = MockDataService(atsign); - var map = _mockDataService.getEncryptedKeys(); + MockDataService mockDataService = MockDataService(atsign); + var map = mockDataService.getEncryptedKeys(); expect(map.length, greaterThan(0)); }); test('for unregisterd @sign', () async { - MockDataService _mockDataService = MockDataService(atsign + '123'); - var map = _mockDataService.getEncryptedKeys(); + MockDataService mockDataService = MockDataService('${atsign}123'); + var map = mockDataService.getEncryptedKeys(); expect(map, {}); }); }); group('generate backupkey file', () { test('for registered @sign', () async { - MockDataService _mockDataService = MockDataService(atsign); - var aesEncryptedKeys = _mockDataService.getEncryptedKeys(); + MockDataService mockDataService = MockDataService(atsign); + var aesEncryptedKeys = mockDataService.getEncryptedKeys(); expect(aesEncryptedKeys.isNotEmpty, true); var result = await _generateFile(atsign, aesEncryptedKeys); expect(result, true); @@ -50,9 +50,9 @@ void main() { }); test('for unregistered @sign', () async { - String atSign = atsign + '123'; - MockDataService _mockDataService = MockDataService(atSign); - var aesEncryptedKeys = _mockDataService.getEncryptedKeys(); + String atSign = '${atsign}123'; + MockDataService mockDataService = MockDataService(atSign); + var aesEncryptedKeys = mockDataService.getEncryptedKeys(); expect(aesEncryptedKeys.isNotEmpty, false); var result = await _generateFile(atSign, aesEncryptedKeys); expect(result, false); @@ -82,7 +82,9 @@ Future setUpFunc(String atsign) async { // To setup encryption keys await atClient.getLocalSecondary()!.putValue( - AT_ENCRYPTION_PRIVATE_KEY, demo_data.encryptionPrivateKeyMap[atsign]!); + AtConstants.atEncryptionPrivateKey, + demo_data.encryptionPrivateKeyMap[atsign]!, + ); } AtClientPreference getAtSignPreference(String atsign) { @@ -113,6 +115,7 @@ class MockDataService { late String atsign; MockDataService(this.atsign); + get getAESKey => demo_data.aesKeyMap[atsign]; Map getEncryptedKeys() { diff --git a/packages/at_backupkey_flutter/test/widgets_test/backup_key_widget_test.dart b/packages/at_backupkey_flutter/test/widgets_test/backup_key_widget_test.dart index 43eb1f9f1..83ab3117c 100644 --- a/packages/at_backupkey_flutter/test/widgets_test/backup_key_widget_test.dart +++ b/packages/at_backupkey_flutter/test/widgets_test/backup_key_widget_test.dart @@ -6,7 +6,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { - Widget _wrapWidgetWithMaterialApp({required Widget backupKeyWidget}) { + Widget wrapWidgetWithMaterialApp({required Widget backupKeyWidget}) { return TestMaterialApp( home: Builder( builder: (BuildContext context) { @@ -28,31 +28,31 @@ void main() { // Test case to check backupkey widget is displayed testWidgets('BackupKey widget is used', (WidgetTester tester) async { await tester.pumpWidget( - _wrapWidgetWithMaterialApp(backupKeyWidget: backupKeyWidget)); + wrapWidgetWithMaterialApp(backupKeyWidget: backupKeyWidget)); expect(find.byType(BackupKeyWidget), findsOneWidget); }); // Test case to identify atsign text testWidgets("Identify atsign text", (WidgetTester tester) async { await tester.pumpWidget( - _wrapWidgetWithMaterialApp(backupKeyWidget: backupKeyWidget)); + wrapWidgetWithMaterialApp(backupKeyWidget: backupKeyWidget)); expect(backupKeyWidget.atsign, 'bluebellrelated86'); }); // Test case to identify button text testWidgets("Identify button text", (WidgetTester tester) async { await tester.pumpWidget( - _wrapWidgetWithMaterialApp(backupKeyWidget: backupKeyWidget)); + wrapWidgetWithMaterialApp(backupKeyWidget: backupKeyWidget)); expect(backupKeyWidget.buttonText, 'Click here'); }); // Test case to check icon Color testWidgets('Test case to check icon color', (WidgetTester tester) async { await tester.pumpWidget( - _wrapWidgetWithMaterialApp(backupKeyWidget: backupKeyWidget)); + wrapWidgetWithMaterialApp(backupKeyWidget: backupKeyWidget)); expect(backupKeyWidget.iconColor, Colors.purple); }); // Test case to check button Color testWidgets('Test case to check button color', (WidgetTester tester) async { await tester.pumpWidget( - _wrapWidgetWithMaterialApp(backupKeyWidget: backupKeyWidget)); + wrapWidgetWithMaterialApp(backupKeyWidget: backupKeyWidget)); expect(backupKeyWidget.buttonColor, Colors.white); }); }); diff --git a/packages/at_chat_flutter/example/lib/main.dart b/packages/at_chat_flutter/example/lib/main.dart index dbf5a9dde..f9567ba3c 100644 --- a/packages/at_chat_flutter/example/lib/main.dart +++ b/packages/at_chat_flutter/example/lib/main.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'package:at_chat_flutter_example/second_screen.dart'; import 'package:flutter/material.dart'; -import 'package:at_client_mobile/at_client_mobile.dart'; import 'package:at_onboarding_flutter/at_onboarding_flutter.dart'; import 'package:at_utils/at_logger.dart' show AtSignLogger; import 'package:path_provider/path_provider.dart' @@ -27,8 +26,9 @@ Future loadAtClientPreference() async { class MyApp extends StatefulWidget { const MyApp({Key? key}) : super(key: key); + @override - _MyAppState createState() => _MyAppState(); + State createState() => _MyAppState(); } class _MyAppState extends State { @@ -70,44 +70,51 @@ class _MyAppState extends State { setState(() { atClientPreference = preference; }); - final result = await AtOnboarding.onboard( - context: context, - config: AtOnboardingConfig( - atClientPreference: atClientPreference!, - domain: AtEnv.rootDomain, - appAPIKey: '477b-876u-bcez-c42z-6a3d', - rootEnvironment: AtEnv.rootEnvironment, - ), - ); - switch (result.status) { - case AtOnboardingResultStatus.success: - await Navigator.pushReplacement( - context, - MaterialPageRoute( - builder: (context) => const SecondScreen(), - )); - break; - case AtOnboardingResultStatus.error: - _logger.severe( - 'Onboarding throws ${result.errorCode} error'); - await showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - content: const Text('Something went wrong'), - actions: [ - TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: const Text('ok')) - ], + if (mounted) { + final result = await AtOnboarding.onboard( + context: context, + config: AtOnboardingConfig( + atClientPreference: atClientPreference!, + domain: AtEnv.rootDomain, + appAPIKey: '477b-876u-bcez-c42z-6a3d', + rootEnvironment: AtEnv.rootEnvironment, + ), + ); + + switch (result.status) { + case AtOnboardingResultStatus.success: + if (mounted) { + await Navigator.pushReplacement( + context, + MaterialPageRoute( + builder: (context) => const SecondScreen(), + )); + } + break; + case AtOnboardingResultStatus.error: + _logger.severe( + 'Onboarding throws ${result.errorCode} error'); + if (mounted) { + await showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + content: const Text('Something went wrong'), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: const Text('ok')) + ], + ); + }, ); - }, - ); - break; - case AtOnboardingResultStatus.cancel: - break; + } + break; + case AtOnboardingResultStatus.cancel: + break; + } } }, child: const Text('Start onboarding'), diff --git a/packages/at_chat_flutter/example/lib/second_screen.dart b/packages/at_chat_flutter/example/lib/second_screen.dart index bbed4cd78..3476af9e4 100644 --- a/packages/at_chat_flutter/example/lib/second_screen.dart +++ b/packages/at_chat_flutter/example/lib/second_screen.dart @@ -9,7 +9,7 @@ class SecondScreen extends StatefulWidget { const SecondScreen({Key? key}) : super(key: key); @override - _SecondScreenState createState() => _SecondScreenState(); + State createState() => _SecondScreenState(); } class _SecondScreenState extends State { @@ -26,6 +26,7 @@ class _SecondScreenState extends State { /// Get the AtClientManager instance var atClientManager = AtClientManager.getInstance(); + @override void initState() { getAtSignAndInitializeChat(); @@ -222,8 +223,8 @@ class _SecondScreenState extends State { if (member1.trim() != '' && member2.trim() != '' && groupId != '') { setChatWithAtSign(null, isGroup: true, groupId: groupId, groupMembers: [ activeAtSign!, - member1.startsWith('@') ? member1 : '@' + member1, - member2.startsWith('@') ? member2 : '@' + member2 + member1.startsWith('@') ? member1 : '@$member1', + member2.startsWith('@') ? member2 : '@$member2' ]); Navigator.push(context, MaterialPageRoute(builder: (context) => const ThirdScreen())); @@ -238,8 +239,8 @@ class _SecondScreenState extends State { context: context, builder: (BuildContext context) { return AlertDialog( - title: Row( - children: const [Text('Some details are missing!')], + title: const Row( + children: [Text('Some details are missing!')], ), content: const Text('Please enter all fields'), actions: [ diff --git a/packages/at_chat_flutter/example/lib/third_screen.dart b/packages/at_chat_flutter/example/lib/third_screen.dart index a34ab7c09..1e63afefc 100644 --- a/packages/at_chat_flutter/example/lib/third_screen.dart +++ b/packages/at_chat_flutter/example/lib/third_screen.dart @@ -5,7 +5,7 @@ class ThirdScreen extends StatefulWidget { const ThirdScreen({Key? key}) : super(key: key); @override - _ThirdScreenState createState() => _ThirdScreenState(); + State createState() => _ThirdScreenState(); } class _ThirdScreenState extends State { @@ -28,8 +28,10 @@ class _ThirdScreenState extends State { var result = await deleteMessages(); var message = result ? 'Messages are deleted' : 'Failed to delete'; - ScaffoldMessenger.of(context) - .showSnackBar(SnackBar(content: Text(message))); + if (mounted) { + ScaffoldMessenger.of(context) + .showSnackBar(SnackBar(content: Text(message))); + } }, ), ]), diff --git a/packages/at_chat_flutter/example/pubspec.yaml b/packages/at_chat_flutter/example/pubspec.yaml index a03846371..e497ce7fb 100644 --- a/packages/at_chat_flutter/example/pubspec.yaml +++ b/packages/at_chat_flutter/example/pubspec.yaml @@ -36,6 +36,10 @@ dependencies: # the parent directory to use the current plugin's version. path: ../ at_onboarding_flutter: ^6.1.3 + at_client_mobile: ^3.2.13 + at_utils: ^3.0.15 + path_provider: ^2.1.1 + flutter_keychain: ^2.4.0 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. @@ -56,6 +60,7 @@ flutter: uses-material-design: true dev_dependencies: + flutter_lints: ^3.0.1 flutter_test: sdk: flutter # To add assets to your application, add an assets section, like this: diff --git a/packages/at_chat_flutter/lib/screens/chat_screen.dart b/packages/at_chat_flutter/lib/screens/chat_screen.dart index 1fcf00bae..192aa3089 100644 --- a/packages/at_chat_flutter/lib/screens/chat_screen.dart +++ b/packages/at_chat_flutter/lib/screens/chat_screen.dart @@ -51,7 +51,7 @@ class ChatScreen extends StatefulWidget { : super(key: key); @override - _ChatScreenState createState() => _ChatScreenState(); + State createState() => _ChatScreenState(); } class _ChatScreenState extends State { @@ -174,15 +174,19 @@ class _ChatScreenState extends State { (id) async { var result = await _chatService .deleteSelectedMessage(id); - Navigator.of(context).pop(); + if (mounted) { + Navigator.of(context).pop(); + } var message = result ? 'Message is deleted' : 'Failed to delete'; - ScaffoldMessenger.of(context) - .showSnackBar(SnackBar( - content: - Text(message))); + if (mounted) { + ScaffoldMessenger.of(context) + .showSnackBar(SnackBar( + content: + Text(message))); + } }, message: snapshot.data![index], color: @@ -225,7 +229,7 @@ class _ChatScreenState extends State { ); if ((result?.files ?? []).isNotEmpty) { final file = File(result!.files.first.path!); - await _chatService.sendImageFile(context, file); + if (mounted) await _chatService.sendImageFile(context, file); } else { // User canceled the picker } diff --git a/packages/at_chat_flutter/lib/services/chat_service.dart b/packages/at_chat_flutter/lib/services/chat_service.dart index 70f9d2de8..9edb60860 100644 --- a/packages/at_chat_flutter/lib/services/chat_service.dart +++ b/packages/at_chat_flutter/lib/services/chat_service.dart @@ -5,6 +5,7 @@ import 'dart:io'; import 'dart:typed_data'; import 'package:at_chat_flutter/models/message_model.dart'; + // ignore: import_of_legacy_library_into_null_safe import 'package:at_client_mobile/at_client_mobile.dart'; @@ -141,7 +142,7 @@ class ChatService { if (chatWithAtSignFromApp.startsWith('@')) { chatWithAtSign = chatWithAtSignFromApp; } else { - chatWithAtSign = '@' + chatWithAtSignFromApp; + chatWithAtSign = '@$chatWithAtSignFromApp'; } } else { chatWithAtSign = ''; diff --git a/packages/at_chat_flutter/lib/utils/colors.dart b/packages/at_chat_flutter/lib/utils/colors.dart index 0fcaa8d33..993a7d63f 100644 --- a/packages/at_chat_flutter/lib/utils/colors.dart +++ b/packages/at_chat_flutter/lib/utils/colors.dart @@ -11,7 +11,7 @@ class CustomColors { class ContactInitialsColors { static Color getColor(String atsign) { if (atsign.length == 1) { - atsign = atsign + ' '; + atsign = '$atsign '; } switch (atsign[1].toUpperCase()) { case 'A': diff --git a/packages/at_chat_flutter/lib/widgets/bottom_sheet_dialog.dart b/packages/at_chat_flutter/lib/widgets/bottom_sheet_dialog.dart index 83f771afd..cbc41fc9a 100644 --- a/packages/at_chat_flutter/lib/widgets/bottom_sheet_dialog.dart +++ b/packages/at_chat_flutter/lib/widgets/bottom_sheet_dialog.dart @@ -10,7 +10,7 @@ class BottomSheetDialog extends StatefulWidget { }) : super(key: key); @override - _BottomSheetDialogState createState() => _BottomSheetDialogState(); + State createState() => _BottomSheetDialogState(); } class _BottomSheetDialogState extends State { diff --git a/packages/at_chat_flutter/lib/widgets/incoming_message_bubble.dart b/packages/at_chat_flutter/lib/widgets/incoming_message_bubble.dart index cfcb8ff48..b31f370ef 100644 --- a/packages/at_chat_flutter/lib/widgets/incoming_message_bubble.dart +++ b/packages/at_chat_flutter/lib/widgets/incoming_message_bubble.dart @@ -2,6 +2,7 @@ import 'dart:typed_data'; import 'package:at_chat_flutter/models/message_model.dart'; import 'package:at_chat_flutter/utils/colors.dart'; + // ignore: import_of_legacy_library_into_null_safe import 'package:at_common_flutter/at_common_flutter.dart'; import 'package:at_chat_flutter/widgets/contacts_initials.dart'; @@ -18,8 +19,9 @@ class IncomingMessageBubble extends StatefulWidget { this.color = CustomColors.incomingMessageColor, this.avatarColor = CustomColors.defaultColor}) : super(key: key); + @override - _IncomingMessageBubbleState createState() => _IncomingMessageBubbleState(); + State createState() => _IncomingMessageBubbleState(); } class _IncomingMessageBubbleState extends State { diff --git a/packages/at_chat_flutter/lib/widgets/outgoing_message_bubble.dart b/packages/at_chat_flutter/lib/widgets/outgoing_message_bubble.dart index 852f5ff43..0af14fc81 100644 --- a/packages/at_chat_flutter/lib/widgets/outgoing_message_bubble.dart +++ b/packages/at_chat_flutter/lib/widgets/outgoing_message_bubble.dart @@ -23,7 +23,7 @@ class OutgoingMessageBubble extends StatefulWidget { : super(key: key); @override - _OutgoingMessageBubbleState createState() => _OutgoingMessageBubbleState(); + State createState() => _OutgoingMessageBubbleState(); } class _OutgoingMessageBubbleState extends State { diff --git a/packages/at_chat_flutter/lib/widgets/send_message.dart b/packages/at_chat_flutter/lib/widgets/send_message.dart index ac0ba42ef..dd6bc9340 100644 --- a/packages/at_chat_flutter/lib/widgets/send_message.dart +++ b/packages/at_chat_flutter/lib/widgets/send_message.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; + // ignore: import_of_legacy_library_into_null_safe import 'package:at_common_flutter/services/size_config.dart'; @@ -19,8 +20,9 @@ class SendMessage extends StatefulWidget { this.hintText, this.onMediaPressed, }) : super(key: key); + @override - _SendMessageState createState() => _SendMessageState(); + State createState() => _SendMessageState(); } class _SendMessageState extends State { diff --git a/packages/at_chat_flutter/test/widget_tests/bottom_sheet_dialog_test.dart b/packages/at_chat_flutter/test/widget_tests/bottom_sheet_dialog_test.dart index 534189f3d..a439fd4b2 100644 --- a/packages/at_chat_flutter/test/widget_tests/bottom_sheet_dialog_test.dart +++ b/packages/at_chat_flutter/test/widget_tests/bottom_sheet_dialog_test.dart @@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart'; import '../test_material_app.dart'; void main() { - Widget _wrapWidgetWithMaterialApp({required Widget bottomSheetDialog}) { + Widget wrapWidgetWithMaterialApp({required Widget bottomSheetDialog}) { return TestMaterialApp(home: Builder(builder: (BuildContext context) { SizeConfig().init(context); return bottomSheetDialog; @@ -21,7 +21,7 @@ void main() { testWidgets("Botton Sheet is displayed", (WidgetTester tester) async { final bottomSheetDialog = BottomSheetDialog(() {}); await tester.pumpWidget( - _wrapWidgetWithMaterialApp(bottomSheetDialog: bottomSheetDialog)); + wrapWidgetWithMaterialApp(bottomSheetDialog: bottomSheetDialog)); expect(find.byType(BottomSheetDialog), findsOneWidget); }); @@ -32,7 +32,7 @@ void main() { log('Call back is given'); }); await tester.pumpWidget( - _wrapWidgetWithMaterialApp(bottomSheetDialog: bottomSheetDialog)); + wrapWidgetWithMaterialApp(bottomSheetDialog: bottomSheetDialog)); await tester.tap((find.byType(BottomSheetDialog))); expect(bottomSheetDialog.deleteCallback.call(), null); }); diff --git a/packages/at_chat_flutter/test/widget_tests/button_widget_test.dart b/packages/at_chat_flutter/test/widget_tests/button_widget_test.dart index 3dacf5ae6..c433fcc9d 100644 --- a/packages/at_chat_flutter/test/widget_tests/button_widget_test.dart +++ b/packages/at_chat_flutter/test/widget_tests/button_widget_test.dart @@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart'; import '../test_material_app.dart'; void main() { - Widget _wrapWidgetWithMaterialApp({required Widget buttonWidget}) { + Widget wrapWidgetWithMaterialApp({required Widget buttonWidget}) { return TestMaterialApp(home: Builder(builder: (BuildContext context) { SizeConfig().init(context); return buttonWidget; @@ -34,7 +34,7 @@ void main() { testWidgets("Button widget is used and shown on screen", (WidgetTester tester) async { await tester - .pumpWidget(_wrapWidgetWithMaterialApp(buttonWidget: buttonWidget)); + .pumpWidget(wrapWidgetWithMaterialApp(buttonWidget: buttonWidget)); expect(find.byType(ButtonWidget), findsOneWidget); }); @@ -42,14 +42,14 @@ void main() { // Test case to check button string is given testWidgets("Button text displayed", (WidgetTester tester) async { await tester - .pumpWidget(_wrapWidgetWithMaterialApp(buttonWidget: buttonWidget)); + .pumpWidget(wrapWidgetWithMaterialApp(buttonWidget: buttonWidget)); expect(find.text('Click here'), findsOneWidget); }); // Test case to check onPress functionality testWidgets("OnPress is given an action", (WidgetTester tester) async { await tester - .pumpWidget(_wrapWidgetWithMaterialApp(buttonWidget: buttonWidget)); + .pumpWidget(wrapWidgetWithMaterialApp(buttonWidget: buttonWidget)); expect(buttonWidget.onPress!.call(), null); }); @@ -57,7 +57,7 @@ void main() { testWidgets("BorderRadius of button widget as circular", (WidgetTester tester) async { await tester - .pumpWidget(_wrapWidgetWithMaterialApp(buttonWidget: buttonWidget)); + .pumpWidget(wrapWidgetWithMaterialApp(buttonWidget: buttonWidget)); final container = tester.widget(find.byType(Container)); final decoration = container.decoration as BoxDecoration; final borderRadius = decoration.borderRadius as BorderRadius; @@ -71,7 +71,7 @@ void main() { testWidgets("Color of button is button default color", (WidgetTester tester) async { await tester - .pumpWidget(_wrapWidgetWithMaterialApp(buttonWidget: buttonWidget)); + .pumpWidget(wrapWidgetWithMaterialApp(buttonWidget: buttonWidget)); final container = tester.widget(find.byType(Container)); final decoration = container.decoration as BoxDecoration; expect( diff --git a/packages/at_chat_flutter/test/widget_tests/contacts_intials_test.dart b/packages/at_chat_flutter/test/widget_tests/contacts_intials_test.dart index 13284b268..c7f4644c3 100644 --- a/packages/at_chat_flutter/test/widget_tests/contacts_intials_test.dart +++ b/packages/at_chat_flutter/test/widget_tests/contacts_intials_test.dart @@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart'; import '../test_material_app.dart'; void main() { - Widget _wrapWidgetWithMaterialApp({required Widget contactInitial}) { + Widget wrapWidgetWithMaterialApp({required Widget contactInitial}) { return TestMaterialApp(home: Builder(builder: (BuildContext context) { SizeConfig().init(context); return contactInitial; @@ -16,21 +16,19 @@ void main() { /// Functional test cases for [contactInitial] group('Contacts Initial widget Tests:', () { - - // Test case to identify contact initial is used in screen or not - testWidgets("Button widget is used and shown on screen", + // Test case to identify contact initial is used in screen or not + testWidgets("Button widget is used and shown on screen", (WidgetTester tester) async { - await tester - .pumpWidget(_wrapWidgetWithMaterialApp(contactInitial: ContactInitial(initials:'@'))); + await tester.pumpWidget(wrapWidgetWithMaterialApp( + contactInitial: ContactInitial(initials: '@'))); expect(find.byType(ContactInitial), findsOneWidget); }); - // Test case to identify contact initial text - testWidgets("identify contact initial text", - (WidgetTester tester) async { - await tester - .pumpWidget(_wrapWidgetWithMaterialApp(contactInitial: ContactInitial(initials:'@'))); + // Test case to identify contact initial text + testWidgets("identify contact initial text", (WidgetTester tester) async { + await tester.pumpWidget(wrapWidgetWithMaterialApp( + contactInitial: ContactInitial(initials: '@'))); expect(find.text('@'), findsOneWidget); }); @@ -38,17 +36,26 @@ void main() { // Test case to check contact initial to check background color testWidgets('Contacts initial with background color', (WidgetTester tester) async { - await tester.pumpWidget(_wrapWidgetWithMaterialApp( - contactInitial: ContactInitial(initials: '@',backgroundColor: CustomColors.defaultColor,))); + await tester.pumpWidget(wrapWidgetWithMaterialApp( + contactInitial: ContactInitial( + initials: '@', + backgroundColor: CustomColors.defaultColor, + ))); final contactsInitial = tester.widget(find.byType(ContactInitial)); - expect(contactsInitial.backgroundColor, CustomColors.defaultColor,); + expect( + contactsInitial.backgroundColor, + CustomColors.defaultColor, + ); }); - - // Test case to check contact initial to check given without background color + + // Test case to check contact initial to check given without background color testWidgets('Contacts initial without background color', (WidgetTester tester) async { - await tester.pumpWidget(_wrapWidgetWithMaterialApp(contactInitial: ContactInitial(initials: '@',))); + await tester.pumpWidget(wrapWidgetWithMaterialApp( + contactInitial: ContactInitial( + initials: '@', + ))); final contactsInitial = tester.widget(find.byType(ContactInitial)); expect(contactsInitial.backgroundColor, null); diff --git a/packages/at_chat_flutter/test/widget_tests/incoming_message_bubble_test.dart b/packages/at_chat_flutter/test/widget_tests/incoming_message_bubble_test.dart index 18126accb..fd4c2e223 100644 --- a/packages/at_chat_flutter/test/widget_tests/incoming_message_bubble_test.dart +++ b/packages/at_chat_flutter/test/widget_tests/incoming_message_bubble_test.dart @@ -10,7 +10,7 @@ import 'package:flutter_test/flutter_test.dart'; import '../test_material_app.dart'; void main() { - Widget _wrapWidgetWithMaterialApp({required Widget incomingMessageBubble}) { + Widget wrapWidgetWithMaterialApp({required Widget incomingMessageBubble}) { return TestMaterialApp(home: Builder(builder: (BuildContext context) { SizeConfig().init(context); return incomingMessageBubble; @@ -23,7 +23,7 @@ void main() { testWidgets("Incoming message bubble widget is used and shown on screen", (WidgetTester tester) async { const incomingMessageBubble = IncomingMessageBubble(); - await tester.pumpWidget(_wrapWidgetWithMaterialApp( + await tester.pumpWidget(wrapWidgetWithMaterialApp( incomingMessageBubble: incomingMessageBubble)); expect(find.byType(IncomingMessageBubble), findsOneWidget); @@ -36,7 +36,7 @@ void main() { final incomingMessageBubble = IncomingMessageBubble( message: message, ); - await tester.pumpWidget(_wrapWidgetWithMaterialApp( + await tester.pumpWidget(wrapWidgetWithMaterialApp( incomingMessageBubble: incomingMessageBubble)); expect(incomingMessageBubble.message, message); }); @@ -46,7 +46,7 @@ void main() { const incomingMessageBubble = IncomingMessageBubble( color: CustomColors.defaultColor, ); - await tester.pumpWidget(_wrapWidgetWithMaterialApp( + await tester.pumpWidget(wrapWidgetWithMaterialApp( incomingMessageBubble: incomingMessageBubble)); final container = tester .widget(find.byType(IncomingMessageBubble)); @@ -60,7 +60,7 @@ void main() { testWidgets("Color of avatar in incoming message bubble", (WidgetTester tester) async { const incomingMessageBubble = IncomingMessageBubble(); - await tester.pumpWidget(_wrapWidgetWithMaterialApp( + await tester.pumpWidget(wrapWidgetWithMaterialApp( incomingMessageBubble: incomingMessageBubble)); final contactInitial = tester.widget(find.byType(ContactInitial)); diff --git a/packages/at_chat_flutter/test/widget_tests/outgoing_message_bubble_test.dart b/packages/at_chat_flutter/test/widget_tests/outgoing_message_bubble_test.dart index 16b95ec5b..9e9cedd42 100644 --- a/packages/at_chat_flutter/test/widget_tests/outgoing_message_bubble_test.dart +++ b/packages/at_chat_flutter/test/widget_tests/outgoing_message_bubble_test.dart @@ -8,7 +8,7 @@ import 'package:flutter_test/flutter_test.dart'; import '../test_material_app.dart'; void main() { - Widget _wrapWidgetWithMaterialApp({required Widget outgoingMessageBubble}) { + Widget wrapWidgetWithMaterialApp({required Widget outgoingMessageBubble}) { return TestMaterialApp(home: Builder(builder: (BuildContext context) { SizeConfig().init(context); return outgoingMessageBubble; @@ -22,7 +22,7 @@ void main() { (WidgetTester tester) async { // ignore: prefer_const_constructors final outgoingMessageBubble = OutgoingMessageBubble((message) {}); - await tester.pumpWidget(_wrapWidgetWithMaterialApp( + await tester.pumpWidget(wrapWidgetWithMaterialApp( outgoingMessageBubble: outgoingMessageBubble)); expect(find.byType(OutgoingMessageBubble), findsOneWidget); @@ -37,7 +37,7 @@ void main() { (message) {}, message: displayMessage, ); - await tester.pumpWidget(_wrapWidgetWithMaterialApp( + await tester.pumpWidget(wrapWidgetWithMaterialApp( outgoingMessageBubble: outgoingMessageBubble)); expect(outgoingMessageBubble.message, displayMessage); }); @@ -49,7 +49,7 @@ void main() { (message) {}, color: CustomColors.defaultColor, ); - await tester.pumpWidget(_wrapWidgetWithMaterialApp( + await tester.pumpWidget(wrapWidgetWithMaterialApp( outgoingMessageBubble: outgoingMessageBubble)); final container = tester .widget(find.byType(OutgoingMessageBubble)); @@ -66,7 +66,7 @@ void main() { (message) {}, avatarColor: CustomColors.defaultColor, ); - await tester.pumpWidget(_wrapWidgetWithMaterialApp( + await tester.pumpWidget(wrapWidgetWithMaterialApp( outgoingMessageBubble: outgoingMessageBubble)); final avatarColor = tester .widget(find.byType(OutgoingMessageBubble)); diff --git a/packages/at_follows_flutter/example/lib/main.dart b/packages/at_follows_flutter/example/lib/main.dart index 77df912a4..6701935ac 100644 --- a/packages/at_follows_flutter/example/lib/main.dart +++ b/packages/at_follows_flutter/example/lib/main.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'package:at_follows_flutter_example/screens/follows_screen.dart'; import 'package:at_onboarding_flutter/services/onboarding_service.dart'; import 'package:flutter/material.dart'; -import 'package:at_client_mobile/at_client_mobile.dart'; import 'package:at_onboarding_flutter/at_onboarding_flutter.dart'; import 'package:at_utils/at_logger.dart' show AtSignLogger; import 'package:path_provider/path_provider.dart' diff --git a/packages/at_follows_flutter/example/lib/screens/follows_screen.dart b/packages/at_follows_flutter/example/lib/screens/follows_screen.dart index 3766cdcce..f63fd91ab 100644 --- a/packages/at_follows_flutter/example/lib/screens/follows_screen.dart +++ b/packages/at_follows_flutter/example/lib/screens/follows_screen.dart @@ -2,7 +2,6 @@ import 'package:at_follows_flutter/screens/connections.dart'; import 'package:at_follows_flutter_example/services/at_service.dart'; import 'package:at_follows_flutter_example/services/notification_service.dart'; import 'package:flutter/material.dart'; -import 'package:at_utils/at_logger.dart'; import 'package:at_follows_flutter_example/utils/app_strings.dart'; class NextScreen extends StatefulWidget { diff --git a/packages/at_follows_flutter/example/lib/services/at_service.dart b/packages/at_follows_flutter/example/lib/services/at_service.dart index b7dadde4d..815084cf9 100644 --- a/packages/at_follows_flutter/example/lib/services/at_service.dart +++ b/packages/at_follows_flutter/example/lib/services/at_service.dart @@ -2,7 +2,8 @@ import 'dart:async'; import 'dart:convert'; import 'package:at_client_mobile/at_client_mobile.dart'; -import 'package:at_follows_flutter_example/services/notification_service.dart' as follows_notification_service; +import 'package:at_follows_flutter_example/services/notification_service.dart' + as follows_notification_service; import 'package:at_follows_flutter_example/utils/app_constants.dart'; import 'package:path_provider/path_provider.dart' as path_provider; import 'package:at_commons/at_commons.dart' as at_commons; @@ -83,6 +84,7 @@ class AtService { _atsign = await getAtSign(); String? privateKey = await getPrivateKey(_atsign!); // ignore: await_only_futures + // ignore: deprecated_member_use await atClientInstance!.startMonitor(privateKey!, (response) { acceptStream(response); }); @@ -93,7 +95,8 @@ class AtService { acceptStream(response) async { response = response.toString().replaceAll('notification:', '').trim(); var notification = AtNotification.fromJson(jsonDecode(response)); - await follows_notification_service.NotificationService().showNotification(notification); + await follows_notification_service.NotificationService() + .showNotification(notification); } } diff --git a/packages/at_follows_flutter/lib/services/connections_service.dart b/packages/at_follows_flutter/lib/services/connections_service.dart index 790e19489..ccc2f76a9 100644 --- a/packages/at_follows_flutter/lib/services/connections_service.dart +++ b/packages/at_follows_flutter/lib/services/connections_service.dart @@ -410,11 +410,11 @@ class ConnectionsService { atsignData.setData(atValue); } catch (e) { - _logger.severe('Error in _getAtsignData getting value ${e}'); + _logger.severe('Error in _getAtsignData getting value $e'); } } } catch (e) { - _logger.severe('Fetching keys for $connection throws ${e}'); + _logger.severe('Fetching keys for $connection throws $e'); } return atsignData; @@ -446,6 +446,7 @@ class ConnectionsService { bool startMonitor() { AtClientManager.getInstance() + .atClient .notificationService .subscribe() .listen((notification) { diff --git a/packages/at_follows_flutter/lib/services/sdk_service.dart b/packages/at_follows_flutter/lib/services/sdk_service.dart index 4efeb9b4b..48c28f78f 100644 --- a/packages/at_follows_flutter/lib/services/sdk_service.dart +++ b/packages/at_follows_flutter/lib/services/sdk_service.dart @@ -106,6 +106,7 @@ class SDKService { Future notify(AtKey key, String value, OperationEnum operation, Function onDone, Function onError) async { var notificationResponse = await AtClientManager.getInstance() + .atClient .notificationService .notify(_getNotificationParams(key, value, operation)) .timeout(Duration(seconds: AppConstants.responseTimeLimit), @@ -168,7 +169,7 @@ class SDKService { ///Performs sync for current @sign sync() async { - AtClientManager.getInstance().syncService.sync(); + AtClientManager.getInstance().atClient.syncService.sync(); } ///Throws [ResponseTimeOutException]. diff --git a/packages/at_follows_flutter/lib/widgets/web_view_screen.dart b/packages/at_follows_flutter/lib/widgets/web_view_screen.dart index ae2695697..0e8904b9e 100644 --- a/packages/at_follows_flutter/lib/widgets/web_view_screen.dart +++ b/packages/at_follows_flutter/lib/widgets/web_view_screen.dart @@ -3,7 +3,7 @@ import 'package:at_follows_flutter/utils/color_constants.dart'; import 'package:at_follows_flutter/widgets/custom_appbar.dart'; import 'package:flutter/material.dart'; import 'package:at_utils/at_logger.dart'; -import 'package:url_launcher/url_launcher.dart'; +import 'package:url_launcher/url_launcher_string.dart'; import 'package:webview_flutter/webview_flutter.dart'; class WebViewScreen extends StatefulWidget { @@ -82,10 +82,10 @@ class _WebViewScreenState extends State { _launchURL(String url) async { // url = Uri.encodeFull(url); - if (await canLaunch(url)) { + if (await canLaunchUrlString(url)) { Navigator.pop(context); Navigator.pop(context); - await launch(url); + await launchUrlString(url); } else { _logger.severe('unable to launch $url'); } diff --git a/packages/at_follows_flutter/test/unit_tests/connections_service_test.dart b/packages/at_follows_flutter/test/unit_tests/connections_service_test.dart index b5ba7029b..14a8f1ec7 100644 --- a/packages/at_follows_flutter/test/unit_tests/connections_service_test.dart +++ b/packages/at_follows_flutter/test/unit_tests/connections_service_test.dart @@ -292,7 +292,7 @@ Future setUpFunc(String atsign) async { final atClientManager = AtClientManager.getInstance(); AtClientService atClientService = AtClientService(); final atClient = atClientManager.atClient; - atClientManager.syncService.sync(); + atClientManager.atClient.syncService.sync(); await setEncryptionKeys(atClient, atsign); return atClientService; } @@ -323,18 +323,24 @@ setEncryptionKeys(AtClient atClient, String atsign) async { metadata.namespaceAware = false; var result; // set pkam private key - result = await atClient.getLocalSecondary()!.putValue(AT_PKAM_PRIVATE_KEY, - demo_data.pkamPrivateKeyMap[atsign]!); // set pkam public key - result = await atClient - .getLocalSecondary()! - .putValue(AT_PKAM_PUBLIC_KEY, demo_data.pkamPublicKeyMap[atsign]!); + result = await atClient.getLocalSecondary()!.putValue( + AtConstants.atPkamPrivateKey, + demo_data.pkamPrivateKeyMap[atsign]!, + ); // set pkam public key + result = await atClient.getLocalSecondary()!.putValue( + AtConstants.atPkamPublicKey, + demo_data.pkamPublicKeyMap[atsign]!, + ); // set encryption private key result = await atClient.getLocalSecondary()!.putValue( - AT_ENCRYPTION_PRIVATE_KEY, demo_data.encryptionPrivateKeyMap[atsign]!); + AtConstants.atEncryptionPrivateKey, + demo_data.encryptionPrivateKeyMap[atsign]!, + ); //set aesKey - result = await atClient - .getLocalSecondary()! - .putValue(AT_ENCRYPTION_SELF_KEY, demo_data.aesKeyMap[atsign]!); + result = await atClient.getLocalSecondary()!.putValue( + AtConstants.atEncryptionSelfKey, + demo_data.aesKeyMap[atsign]!, + ); // set encryption public key. should be synced metadata.isPublic = true; diff --git a/packages/at_invitation_flutter/example/lib/main.dart b/packages/at_invitation_flutter/example/lib/main.dart index 95b1e9dc2..5a9439a1b 100644 --- a/packages/at_invitation_flutter/example/lib/main.dart +++ b/packages/at_invitation_flutter/example/lib/main.dart @@ -2,9 +2,7 @@ import 'dart:async'; import 'package:at_invitation_flutter_example/second_screen.dart'; import 'package:flutter/material.dart'; -import 'package:at_client_mobile/at_client_mobile.dart'; import 'package:at_onboarding_flutter/at_onboarding_flutter.dart'; -import 'package:at_utils/at_logger.dart' show AtSignLogger; import 'package:path_provider/path_provider.dart' show getApplicationSupportDirectory; import 'package:at_app_flutter/at_app_flutter.dart' show AtEnv; @@ -28,7 +26,7 @@ Future loadAtClientPreference() async { class MyApp extends StatefulWidget { const MyApp({Key? key}) : super(key: key); @override - _MyAppState createState() => _MyAppState(); + State createState() => _MyAppState(); } class _MyAppState extends State { @@ -37,8 +35,6 @@ class _MyAppState extends State { late AtClientPreference atClientPreference; AtClientService? atClientService; - final AtSignLogger _logger = AtSignLogger(AtEnv.appNamespace); - @override Widget build(BuildContext context) { return MaterialApp( diff --git a/packages/at_invitation_flutter/example/lib/second_screen.dart b/packages/at_invitation_flutter/example/lib/second_screen.dart index b4d9b0fc9..1c55dc78d 100644 --- a/packages/at_invitation_flutter/example/lib/second_screen.dart +++ b/packages/at_invitation_flutter/example/lib/second_screen.dart @@ -2,16 +2,16 @@ import 'package:at_app_flutter/at_app_flutter.dart'; import 'package:at_invitation_flutter/at_invitation_flutter.dart'; import 'package:flutter/material.dart'; import 'package:at_client_mobile/at_client_mobile.dart'; +import 'package:url_launcher/url_launcher_string.dart'; import 'constants.dart'; import 'package:uni_links/uni_links.dart'; -import 'package:url_launcher/url_launcher.dart'; import 'package:at_utils/at_logger.dart'; class SecondScreen extends StatefulWidget { const SecondScreen({Key? key}) : super(key: key); @override - _SecondScreenState createState() => _SecondScreenState(); + State createState() => _SecondScreenState(); } class _SecondScreenState extends State { @@ -115,10 +115,10 @@ class _SecondScreenState extends State { } void _checkForInvite() async { - String _url = MixedConstants.cookiePage; - await canLaunch(_url) - ? await launch(_url, forceSafariVC: false) - : throw 'Could not launch $_url'; + String url = MixedConstants.cookiePage; + await canLaunchUrlString(url) + ? await launchUrlString(url) + : throw 'Could not launch $url'; } void _handleIncomingLinks() { diff --git a/packages/at_invitation_flutter/example/pubspec.yaml b/packages/at_invitation_flutter/example/pubspec.yaml index 02bb75638..d8c47253e 100644 --- a/packages/at_invitation_flutter/example/pubspec.yaml +++ b/packages/at_invitation_flutter/example/pubspec.yaml @@ -35,6 +35,11 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../ + at_onboarding_flutter: ^6.1.5 + at_client_mobile: ^3.2.13 + at_utils: ^3.0.15 + flutter_keychain: ^2.4.0 + path_provider: ^2.1.1 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. @@ -58,8 +63,6 @@ dev_dependencies: # following page: https://dart.dev/tools/pub/pubspec # The following section is specific to Flutter. flutter: - assets: - - .env # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in diff --git a/packages/at_invitation_flutter/lib/services/invitation_service.dart b/packages/at_invitation_flutter/lib/services/invitation_service.dart index 2c9e333e3..59a6a8c8b 100644 --- a/packages/at_invitation_flutter/lib/services/invitation_service.dart +++ b/packages/at_invitation_flutter/lib/services/invitation_service.dart @@ -3,7 +3,6 @@ import 'dart:async'; import 'dart:convert'; import 'dart:math'; -import 'package:at_commons/at_commons.dart'; import 'package:at_invitation_flutter/models/message_share.dart'; import 'package:at_invitation_flutter/widgets/share_dialog.dart'; import 'package:at_invitation_flutter/widgets/otp_dialog.dart'; diff --git a/packages/at_invitation_flutter/lib/widgets/otp_dialog.dart b/packages/at_invitation_flutter/lib/widgets/otp_dialog.dart index f8fbb161e..9b675ec44 100644 --- a/packages/at_invitation_flutter/lib/widgets/otp_dialog.dart +++ b/packages/at_invitation_flutter/lib/widgets/otp_dialog.dart @@ -14,7 +14,7 @@ class OTPDialog extends StatefulWidget { : super(key: key); @override - _OTPDialogState createState() => _OTPDialogState(); + State createState() => _OTPDialogState(); } class _OTPDialogState extends State { diff --git a/packages/at_invitation_flutter/lib/widgets/share_dialog.dart b/packages/at_invitation_flutter/lib/widgets/share_dialog.dart index 32d7c7ba9..5f96300f0 100644 --- a/packages/at_invitation_flutter/lib/widgets/share_dialog.dart +++ b/packages/at_invitation_flutter/lib/widgets/share_dialog.dart @@ -4,13 +4,14 @@ import 'package:at_common_flutter/at_common_flutter.dart'; import 'package:at_invitation_flutter/utils/text_styles.dart' as invitation_text_styles; import 'package:flutter/material.dart'; -import 'package:url_launcher/url_launcher.dart'; +import 'package:url_launcher/url_launcher_string.dart'; class ShareDialog extends StatefulWidget { final String? uniqueID; final String? passcode; final String? webPageLink; final String currentAtsign; + const ShareDialog( {Key? key, this.uniqueID, @@ -20,7 +21,7 @@ class ShareDialog extends StatefulWidget { : super(key: key); @override - _ShareDialogState createState() => _ShareDialogState(); + State createState() => _ShareDialogState(); } class _ShareDialogState extends State { @@ -32,6 +33,7 @@ class _ShareDialogState extends State { String emailAddress = ''; String phoneNumber = ''; int activeOption = 0; + @override void dispose() { atSignController.dispose(); @@ -169,7 +171,7 @@ class _ShareDialogState extends State { emailAddress = value.trim(); if (emailAddress != '') { if (RegExp( - r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+") + r"^[a-zA-Z0-9.a-zA-Z0-9!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+") .hasMatch(emailAddress)) { emailError = false; emailErrorMessage = ''; @@ -220,7 +222,7 @@ class _ShareDialogState extends State { setState(() { isLoading = false; }); - Navigator.pop(context); + if (mounted) Navigator.pop(context); } }, buttonColor: @@ -264,8 +266,8 @@ class _ShareDialogState extends State { Future _sendInformation() async { // construct message body - String link = (widget.webPageLink ?? '') + - '?key=${widget.uniqueID}&atsign=${widget.currentAtsign}'; + String link = + '${widget.webPageLink ?? ''}?key=${widget.uniqueID}&atsign=${widget.currentAtsign}'; String inviteText = 'Hi there, you have been invited to join this app. \n link: $link \n password: ${widget.passcode}'; @@ -274,23 +276,22 @@ class _ShareDialogState extends State { // send SMS if (phoneNumber != '') { if (Platform.isAndroid) { - var uri = 'sms:' + phoneNumber + '?body=' + messageBody; - if (await canLaunch(uri)) { - await launch(uri); + var uri = 'sms:$phoneNumber?body=$messageBody'; + if (await canLaunchUrlString(uri)) { + await launchUrlString(uri); } } else if (Platform.isIOS) { - var uri = 'sms:' + phoneNumber + '&body=' + messageBody; - if (await canLaunch(uri)) { - await launch(uri); + var uri = 'sms:$phoneNumber&body=$messageBody'; + if (await canLaunchUrlString(uri)) { + await launchUrlString(uri); } } } // send email else if (emailAddress != '') { - var uri = - 'mailto:' + emailAddress + '?subject=Invitation&body=' + messageBody; - if (await canLaunch(uri)) { - await launch(uri); + var uri = 'mailto:$emailAddress?subject=Invitation&body=$messageBody'; + if (await canLaunchUrlString(uri)) { + await launchUrlString(uri); } } } diff --git a/packages/at_invitation_flutter/test/at_invitation_flutter_test.dart b/packages/at_invitation_flutter/test/at_invitation_flutter_test.dart index 6e99279fe..93753c1ae 100644 --- a/packages/at_invitation_flutter/test/at_invitation_flutter_test.dart +++ b/packages/at_invitation_flutter/test/at_invitation_flutter_test.dart @@ -7,12 +7,20 @@ void main() { TestWidgetsFlutterBinding.ensureInitialized(); setUp(() { - channel.setMockMethodCallHandler((MethodCall methodCall) async { - return '42'; - }); + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler( + channel, + (MethodCall methodCall) async { + return '42'; + }, + ); }); tearDown(() { - channel.setMockMethodCallHandler(null); + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler( + channel, + null, + ); }); } diff --git a/packages/at_invitation_flutter/test/widgets_test/otp_dialog_test.dart b/packages/at_invitation_flutter/test/widgets_test/otp_dialog_test.dart index 2805acbb9..ee80d2a5f 100644 --- a/packages/at_invitation_flutter/test/widgets_test/otp_dialog_test.dart +++ b/packages/at_invitation_flutter/test/widgets_test/otp_dialog_test.dart @@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart'; import '../test_material_app.dart'; void main() { - Widget _wrapWidgetWithMaterialApp({required Widget otpDialog}) { + Widget wrapWidgetWithMaterialApp({required Widget otpDialog}) { return TestMaterialApp(home: Builder(builder: (BuildContext context) { SizeConfig().init(context); return otpDialog; @@ -15,30 +15,32 @@ void main() { /// Functional test cases for OTP Dialog Widget group('OTP Dialog Widget Tests:', () { - final otpDialog = OTPDialog(uniqueID: '25',passcode: '25032511',webPageLink: 'url for the site',); + const otpDialog = OTPDialog( + uniqueID: '25', + passcode: '25032511', + webPageLink: 'url for the site', + ); // Test Case to Check OTP Dialog is displayed testWidgets("OTP Dialog is displayed", (WidgetTester tester) async { - - await tester - .pumpWidget(_wrapWidgetWithMaterialApp(otpDialog: otpDialog)); + await tester.pumpWidget(wrapWidgetWithMaterialApp(otpDialog: otpDialog)); expect(find.byType(OTPDialog), findsOneWidget); }); - // Test case to check uniqueId given - testWidgets("Test case to check unique id is given", (WidgetTester tester) async { - await tester - .pumpWidget(_wrapWidgetWithMaterialApp(otpDialog: otpDialog)); + // Test case to check uniqueId given + testWidgets("Test case to check unique id is given", + (WidgetTester tester) async { + await tester.pumpWidget(wrapWidgetWithMaterialApp(otpDialog: otpDialog)); expect(otpDialog.uniqueID, '25'); }); // Test case to check passcode is given - testWidgets("Test case to check passcode is given", (WidgetTester tester) async { - await tester - .pumpWidget(_wrapWidgetWithMaterialApp(otpDialog: otpDialog)); + testWidgets("Test case to check passcode is given", + (WidgetTester tester) async { + await tester.pumpWidget(wrapWidgetWithMaterialApp(otpDialog: otpDialog)); expect(otpDialog.passcode, '25032511'); }); // Test case to check web page link is given - testWidgets("Test case to check web page link is given", (WidgetTester tester) async { - await tester - .pumpWidget(_wrapWidgetWithMaterialApp(otpDialog: otpDialog)); + testWidgets("Test case to check web page link is given", + (WidgetTester tester) async { + await tester.pumpWidget(wrapWidgetWithMaterialApp(otpDialog: otpDialog)); expect(otpDialog.webPageLink, 'url for the site'); }); }); diff --git a/packages/at_invitation_flutter/test/widgets_test/share_dialog_test.dart b/packages/at_invitation_flutter/test/widgets_test/share_dialog_test.dart index c17ddf746..badab1de2 100644 --- a/packages/at_invitation_flutter/test/widgets_test/share_dialog_test.dart +++ b/packages/at_invitation_flutter/test/widgets_test/share_dialog_test.dart @@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart'; import '../test_material_app.dart'; void main() { - Widget _wrapWidgetWithMaterialApp({required Widget shareDialog}) { + Widget wrapWidgetWithMaterialApp({required Widget shareDialog}) { return TestMaterialApp(home: Builder(builder: (BuildContext context) { SizeConfig().init(context); return shareDialog; @@ -15,35 +15,44 @@ void main() { /// Functional test cases for Share Dialog Widget group('Share Dialog Widget Tests:', () { - final shareDialog = ShareDialog(currentAtsign: '@bluebellrelated86',uniqueID: '25',passcode: '25032511',webPageLink: 'url for the site',); + const shareDialog = ShareDialog( + currentAtsign: '@bluebellrelated86', + uniqueID: '25', + passcode: '25032511', + webPageLink: 'url for the site', + ); // Test Case to Check Share Dialog is displayed testWidgets("Share Dialog is displayed", (WidgetTester tester) async { await tester - .pumpWidget(_wrapWidgetWithMaterialApp(shareDialog: shareDialog)); + .pumpWidget(wrapWidgetWithMaterialApp(shareDialog: shareDialog)); expect(find.byType(ShareDialog), findsOneWidget); }); // Test case to check current atsign is given - testWidgets("Test case to check current atsign is given", (WidgetTester tester) async { + testWidgets("Test case to check current atsign is given", + (WidgetTester tester) async { await tester - .pumpWidget(_wrapWidgetWithMaterialApp(shareDialog: shareDialog)); + .pumpWidget(wrapWidgetWithMaterialApp(shareDialog: shareDialog)); expect(shareDialog.currentAtsign, '@bluebellrelated86'); }); // Test case to check uniqueId given - testWidgets("Test case to check unique id is given", (WidgetTester tester) async { + testWidgets("Test case to check unique id is given", + (WidgetTester tester) async { await tester - .pumpWidget(_wrapWidgetWithMaterialApp(shareDialog: shareDialog)); + .pumpWidget(wrapWidgetWithMaterialApp(shareDialog: shareDialog)); expect(shareDialog.uniqueID, '25'); }); // Test case to check passcode is given - testWidgets("Test case to check passcode is given", (WidgetTester tester) async { + testWidgets("Test case to check passcode is given", + (WidgetTester tester) async { await tester - .pumpWidget(_wrapWidgetWithMaterialApp(shareDialog: shareDialog)); + .pumpWidget(wrapWidgetWithMaterialApp(shareDialog: shareDialog)); expect(shareDialog.passcode, '25032511'); }); // Test case to check web page link is given - testWidgets("Test case to check web page link is given", (WidgetTester tester) async { + testWidgets("Test case to check web page link is given", + (WidgetTester tester) async { await tester - .pumpWidget(_wrapWidgetWithMaterialApp(shareDialog: shareDialog)); + .pumpWidget(wrapWidgetWithMaterialApp(shareDialog: shareDialog)); expect(shareDialog.webPageLink, 'url for the site'); }); }); diff --git a/packages/at_location_flutter/test/at_location_flutter_test.dart b/packages/at_location_flutter/test/at_location_flutter_test.dart index 4d9fe07ad..38acc55d5 100644 --- a/packages/at_location_flutter/test/at_location_flutter_test.dart +++ b/packages/at_location_flutter/test/at_location_flutter_test.dart @@ -17,17 +17,20 @@ import 'package:mocktail/mocktail.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart'; Position get mockPosition => Position( - latitude: 52.561270, - longitude: 5.639382, - timestamp: DateTime.fromMillisecondsSinceEpoch( - 500, - isUtc: true, - ), - altitude: 3000.0, - accuracy: 0.0, - heading: 0.0, - speed: 0.0, - speedAccuracy: 0.0); + latitude: 52.561270, + longitude: 5.639382, + timestamp: DateTime.fromMillisecondsSinceEpoch( + 500, + isUtc: true, + ), + altitude: 3000.0, + accuracy: 0.0, + heading: 0.0, + speed: 0.0, + speedAccuracy: 0.0, + altitudeAccuracy: 0.0, + headingAccuracy: 0.0, + ); class MockAtContactImpl extends Mock implements AtContactsImpl {} diff --git a/packages/at_login_flutter/lib/services/at_login_service.dart b/packages/at_login_flutter/lib/services/at_login_service.dart index c95ca11dc..a37e629ea 100644 --- a/packages/at_login_flutter/lib/services/at_login_service.dart +++ b/packages/at_login_flutter/lib/services/at_login_service.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; + import 'package:at_login_flutter/domain/at_login_model.dart'; import 'package:at_login_flutter/exceptions/at_login_exceptions.dart'; import 'package:at_login_flutter/utils/app_constants.dart'; @@ -5,9 +7,9 @@ import 'package:at_login_flutter/utils/strings.dart'; import 'package:at_client_mobile/at_client_mobile.dart'; import 'dart:core'; import 'package:at_login_flutter/utils/at_login_utils.dart'; -import 'package:at_client/src/encryption_service/sign_in_public_data.dart'; import 'package:at_server_status/at_server_status.dart'; import 'package:at_utils/at_utils.dart'; +import 'package:crypton/crypton.dart'; import 'package:flutter/material.dart'; class AtLoginService { @@ -15,9 +17,9 @@ class AtLoginService { // late List _atLoginList; late AtClientPreference _atClientPreference; - late String? _requestorUrl; late String _initialised; - late String _atSign; + + Widget get nextScreen => _nextScreen; late Widget _nextScreen; late AtStatus atStatus; @@ -59,7 +61,7 @@ class AtLoginService { Future setAtsign(String? atSign) async { bool success = false; var namespace = _atClientPreference.namespace; - var result = await AtClientManager.getInstance() + await AtClientManager.getInstance() .setCurrentAtSign(atSign!, namespace, _atClientPreference); // if (result != null) success = true; return success; @@ -140,13 +142,11 @@ class AtLoginService { .localSecondary! .getEncryptionPrivateKey(); - var signature = await SignInPublicData.signInData( - atLoginObj.challenge, encryptionPrivateKey!); + var privateKey = RSAPrivateKey.fromString(encryptionPrivateKey ?? ''); + var dataSignature = privateKey + .createSHA256Signature(utf8.encode(atLoginObj.challenge ?? '')); + var signature = base64Encode(dataSignature); - // var rsaKey = RSAPrivateKey.fromString(privateKey!); - // var sha256signature = rsaKey.createSHA256Signature( - // utf8.encode(atLoginObj.challenge!) as Uint8List); - // var signature = base64Encode(sha256signature); await setAtsign(atLoginObj.atsign); _logger.info( 'putLoginProof|atLoginObj.requestorUrl:${atLoginObj.requestorUrl}'); diff --git a/packages/at_login_flutter/lib/services/custom_nav.dart b/packages/at_login_flutter/lib/services/custom_nav.dart index c28646ff5..ac254e1b3 100644 --- a/packages/at_login_flutter/lib/services/custom_nav.dart +++ b/packages/at_login_flutter/lib/services/custom_nav.dart @@ -9,7 +9,7 @@ class CustomNav { } push(Widget widget, context) { - WidgetsBinding.instance!.addPostFrameCallback((_) { + WidgetsBinding.instance.addPostFrameCallback((_) { Navigator.push(context, MaterialPageRoute(builder: (context) => widget)); }); } diff --git a/packages/at_login_flutter/lib/services/size_config.dart b/packages/at_login_flutter/lib/services/size_config.dart index ff9f09676..d03cc2ab6 100644 --- a/packages/at_login_flutter/lib/services/size_config.dart +++ b/packages/at_login_flutter/lib/services/size_config.dart @@ -11,7 +11,6 @@ class SizeConfig { late double screenHeight; late double blockSizeHorizontal; late double blockSizeVertical; - double? deviceTextFactor; late double _safeAreaHorizontal; late double _safeAreaVertical; @@ -29,8 +28,6 @@ class SizeConfig { refHeight = 812; refWidth = 375; - deviceTextFactor = _mediaQueryData.textScaleFactor; - // print("height is::: $screenHeight"); if (screenHeight < 1200) { diff --git a/packages/at_login_flutter/lib/utils/at_login_utils.dart b/packages/at_login_flutter/lib/utils/at_login_utils.dart index ee3f334cf..c17ceb01d 100644 --- a/packages/at_login_flutter/lib/utils/at_login_utils.dart +++ b/packages/at_login_flutter/lib/utils/at_login_utils.dart @@ -44,8 +44,9 @@ class AtLoginUtils { var x509Pem = socket.peerCertificate!.pem; // test with an internet available certificate to ensure we are picking out the SAN and not the CN var data = X509Utils.x509CertificateFromPem(x509Pem); - var subjectAlternativeName = data.subjectAlternativNames; - var commonName = data.subject['2.5.4.3']; + var subjectAlternativeName = + data.tbsCertificate?.extensions?.subjectAlternativNames; + var commonName = data.tbsCertificate?.subject['2.5.4.3']; subjectAlternativeName!.add(commonName!); print('SAN: $subjectAlternativeName'); for (var i = 0; i < subjectAlternativeName.length; i++) { diff --git a/packages/at_login_flutter/lib/widgets/at_login_dashboard_widget.dart b/packages/at_login_flutter/lib/widgets/at_login_dashboard_widget.dart index c1a235d35..fa7304e18 100644 --- a/packages/at_login_flutter/lib/widgets/at_login_dashboard_widget.dart +++ b/packages/at_login_flutter/lib/widgets/at_login_dashboard_widget.dart @@ -1,5 +1,4 @@ import 'package:at_client_mobile/at_client_mobile.dart'; -import 'package:at_commons/at_commons.dart'; import 'package:at_login_flutter/domain/at_login_model.dart'; import 'package:at_login_flutter/services/at_login_service.dart'; import 'package:flutter/material.dart'; diff --git a/packages/at_login_flutter/lib/widgets/at_login_widget.dart b/packages/at_login_flutter/lib/widgets/at_login_widget.dart index 770bcc2ec..e206a2851 100644 --- a/packages/at_login_flutter/lib/widgets/at_login_widget.dart +++ b/packages/at_login_flutter/lib/widgets/at_login_widget.dart @@ -56,8 +56,9 @@ class AtLogin { this.domain}) { _show(); } + void _show() { - WidgetsBinding.instance!.addPostFrameCallback((timeStamp) { + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { showDialog( context: context, barrierDismissible: false, @@ -329,7 +330,7 @@ class _AtLoginWidgetState extends State { ElevatedButton( child: const Text(Strings.loginDenied), style: ElevatedButton.styleFrom( - primary: Colors.red, + backgroundColor: Colors.red, // padding: EdgeInsets.symmetric(horizontal: 50, vertical: 20), textStyle: TextStyle( fontSize: 18, @@ -346,7 +347,7 @@ class _AtLoginWidgetState extends State { ElevatedButton( child: Text(Strings.loginAllowed), style: ElevatedButton.styleFrom( - primary: Colors.green, + backgroundColor: Colors.green, textStyle: TextStyle( fontSize: 18, )), @@ -378,7 +379,7 @@ class _AtLoginWidgetState extends State { ElevatedButton( child: const Text(Strings.notPairAtsign), style: ElevatedButton.styleFrom( - primary: Colors.red, + backgroundColor: Colors.red, // padding: EdgeInsets.symmetric(horizontal: 50, vertical: 20), textStyle: TextStyle( fontSize: 18, @@ -391,7 +392,7 @@ class _AtLoginWidgetState extends State { ElevatedButton( child: Text(Strings.pairAtsign), style: ElevatedButton.styleFrom( - primary: Colors.green, + backgroundColor: Colors.green, textStyle: TextStyle( fontSize: 18, )), diff --git a/packages/at_login_flutter/pubspec.yaml b/packages/at_login_flutter/pubspec.yaml index e49c0a55c..c37574c60 100644 --- a/packages/at_login_flutter/pubspec.yaml +++ b/packages/at_login_flutter/pubspec.yaml @@ -23,6 +23,7 @@ dependencies: path_provider: ^2.1.1 permission_handler: ^11.0.0 provider: ^6.0.5 + crypton: ^2.1.0 dev_dependencies: flutter_test: diff --git a/packages/at_login_flutter/test/at_login_flutter_test.dart b/packages/at_login_flutter/test/at_login_flutter_test.dart index 4906c82ff..2e4eae97f 100644 --- a/packages/at_login_flutter/test/at_login_flutter_test.dart +++ b/packages/at_login_flutter/test/at_login_flutter_test.dart @@ -8,13 +8,20 @@ void main() { TestWidgetsFlutterBinding.ensureInitialized(); setUp(() { - channel.setMockMethodCallHandler((MethodCall methodCall) async { - return '42'; - }); + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler( + channel, + (MethodCall methodCall) async { + return '42'; + }, + ); }); tearDown(() { - channel.setMockMethodCallHandler(null); + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler( + channel, + null, + ); }); - } diff --git a/packages/at_sync_ui_flutter/example/lib/main.dart b/packages/at_sync_ui_flutter/example/lib/main.dart index da81f6ea8..beebc34f2 100644 --- a/packages/at_sync_ui_flutter/example/lib/main.dart +++ b/packages/at_sync_ui_flutter/example/lib/main.dart @@ -53,8 +53,8 @@ class _MyAppState extends State { primaryColor: const Color(0xFFf4533d), colorScheme: ThemeData.light().colorScheme.copyWith( primary: const Color(0xFFf4533d), + background: Colors.white, ), - backgroundColor: Colors.white, scaffoldBackgroundColor: Colors.white, ), darkTheme: ThemeData().copyWith( @@ -62,8 +62,8 @@ class _MyAppState extends State { primaryColor: Colors.blue, colorScheme: ThemeData.dark().colorScheme.copyWith( primary: Colors.blue, + background: Colors.grey[850], ), - backgroundColor: Colors.grey[850], scaffoldBackgroundColor: Colors.grey[850], ), themeMode: themeMode, diff --git a/packages/at_sync_ui_flutter/example/lib/second_screen.dart b/packages/at_sync_ui_flutter/example/lib/second_screen.dart index b1f199cef..bb38e3c56 100644 --- a/packages/at_sync_ui_flutter/example/lib/second_screen.dart +++ b/packages/at_sync_ui_flutter/example/lib/second_screen.dart @@ -7,6 +7,7 @@ import 'main.dart'; class SecondScreen extends StatefulWidget { final String activeAtSign; + const SecondScreen({required this.activeAtSign, Key? key}) : super(key: key); @override @@ -70,12 +71,14 @@ class _SecondScreenState extends State { ), ElevatedButton( onPressed: () async { + // ignore: deprecated_member_use AtSyncUIService().sync(); }, child: const Text('Default Sync'), ), ElevatedButton( onPressed: () async { + // ignore: deprecated_member_use AtSyncUIService().sync( atSyncUIOverlay: AtSyncUIOverlay.dialog, ); @@ -84,6 +87,7 @@ class _SecondScreenState extends State { ), ElevatedButton( onPressed: () async { + // ignore: deprecated_member_use AtSyncUIService().sync( atSyncUIOverlay: AtSyncUIOverlay.snackbar, ); @@ -92,6 +96,7 @@ class _SecondScreenState extends State { ), ElevatedButton( onPressed: () async { + // ignore: deprecated_member_use AtSyncUIService().sync( atSyncUIOverlay: AtSyncUIOverlay.none, ); @@ -133,6 +138,7 @@ class _SecondScreenState extends State { ), floatingActionButton: FloatingActionButton( onPressed: () async { + // ignore: deprecated_member_use AtSyncUIService().sync( atSyncUIOverlay: AtSyncUIOverlay.none, ); diff --git a/packages/at_sync_ui_flutter/example/pubspec.yaml b/packages/at_sync_ui_flutter/example/pubspec.yaml index 3fd555aaf..94b5d73db 100644 --- a/packages/at_sync_ui_flutter/example/pubspec.yaml +++ b/packages/at_sync_ui_flutter/example/pubspec.yaml @@ -29,9 +29,7 @@ environment: dependencies: at_app_flutter: ^5.2.0 at_backupkey_flutter: ^4.0.10 - at_onboarding_flutter: ^6.1.3 - at_sync_ui_flutter: - path: ../ + at_onboarding_flutter: ^6.1.5 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.6 @@ -39,6 +37,10 @@ dependencies: sdk: flutter flutter_colorpicker: ^1.0.3 +dependency_overrides: + at_sync_ui_flutter: + path: ../ + dev_dependencies: # The "flutter_lints" package below contains a set of recommended lints to # encourage good coding practices. The lint set provided by the package is diff --git a/packages/at_sync_ui_flutter/lib/services/at_sync_ui_services.dart b/packages/at_sync_ui_flutter/lib/services/at_sync_ui_services.dart index bd3a124fb..2acf89b9f 100644 --- a/packages/at_sync_ui_flutter/lib/services/at_sync_ui_services.dart +++ b/packages/at_sync_ui_flutter/lib/services/at_sync_ui_services.dart @@ -1,13 +1,13 @@ // ignore_for_file: implementation_imports, prefer_typing_uninitialized_variables import 'dart:async'; -import 'package:at_client/src/service/sync_service.dart'; import 'package:at_client/at_client.dart'; import 'package:at_sync_ui_flutter/at_sync_ui.dart'; import 'package:flutter/material.dart'; class AtSyncUIService extends SyncProgressListener { static final AtSyncUIService _singleton = AtSyncUIService._internal(); + AtSyncUIService._internal(); factory AtSyncUIService() { @@ -47,6 +47,7 @@ class AtSyncUIService extends SyncProgressListener { /// [atSyncUIListener] can be used to listen to sync status changes Stream get atSyncUIListener => _atSyncUIListenerController.stream as Stream; + StreamSink get _atSyncUIListenerSink => _atSyncUIListenerController.sink as StreamSink; @@ -101,10 +102,12 @@ class AtSyncUIService extends SyncProgressListener { var _atSyncUIController = AtSyncUIController(); AtSyncUI.instance.setupController(controller: _atSyncUIController); - syncService = AtClientManager.getInstance().syncService; + syncService = AtClientManager.getInstance().atClient.syncService; syncService!.addProgressListener(this); + // ignore: deprecated_member_use syncService!.setOnDone(_onSuccessCallback); + // ignore: deprecated_member_use_from_same_package sync(atSyncUIOverlay: atSyncUIOverlay!, startTimer: startTimer); }