From 0043a91d03d9e8178e6a7dc25bfdd5b1f739e53d Mon Sep 17 00:00:00 2001 From: Matthew Fosse Date: Fri, 5 Apr 2024 10:11:54 -0700 Subject: [PATCH 01/10] version bump to 3.13.9, auth working on mac --- lib/entities/biometric_auth.dart | 28 ++++++++------- lib/locales/hausa_intl.dart | 28 +++++++++++++++ lib/locales/yoruba_intl.dart | 35 +++++++++++++++++++ .../settings/security_backup_page.dart | 4 ++- lib/src/screens/settings/tor_page.dart | 4 +-- .../validable_annotated_editable_text.dart | 27 ++++++++++++-- lib/view_model/auth_view_model.dart | 15 ++++---- pubspec_base.yaml | 2 +- pubspec_description.yaml | 2 +- 9 files changed, 117 insertions(+), 28 deletions(-) diff --git a/lib/entities/biometric_auth.dart b/lib/entities/biometric_auth.dart index febbfa469..cdf2dcd43 100644 --- a/lib/entities/biometric_auth.dart +++ b/lib/entities/biometric_auth.dart @@ -1,32 +1,34 @@ -import 'package:local_auth/local_auth.dart'; +// import 'package:local_auth/local_auth.dart'; import 'package:flutter/services.dart'; import 'package:cake_wallet/generated/i18n.dart'; +import 'package:flutter_local_authentication/flutter_local_authentication.dart'; class BiometricAuth { - final _localAuth = LocalAuthentication(); + final _flutterLocalAuthenticationPlugin = FlutterLocalAuthentication(); Future isAuthenticated() async { try { - return await _localAuth.authenticate( - localizedReason: S.current.biometric_auth_reason, - options: AuthenticationOptions( - biometricOnly: true, - useErrorDialogs: true, - stickyAuth: false)); + final authenticated = await _flutterLocalAuthenticationPlugin.authenticate(); + return authenticated; } on PlatformException catch (e) { print(e); } - return false; } Future canCheckBiometrics() async { + bool canAuthenticate; try { - return await _localAuth.canCheckBiometrics; - } on PlatformException catch (e) { - print(e); + canAuthenticate = await _flutterLocalAuthenticationPlugin.canAuthenticate(); + + // Setup TouchID Allowable Reuse duration + // It works only in iOS and macOS, but it's safe to call it even on other platforms. + await _flutterLocalAuthenticationPlugin.setTouchIDAuthenticationAllowableReuseDuration(30); + } on Exception catch (error) { + print("Exception checking support. $error"); + canAuthenticate = false; } - return false; + return canAuthenticate; } } diff --git a/lib/locales/hausa_intl.dart b/lib/locales/hausa_intl.dart index 749d39a4d..1ff12df0a 100644 --- a/lib/locales/hausa_intl.dart +++ b/lib/locales/hausa_intl.dart @@ -751,6 +751,34 @@ class HaMaterialLocalizations extends GlobalMaterialLocalizations { @override String get scrimOnTapHintRaw => "Scrip on Tap"; + + @override + // TODO: implement collapsedHint + String get collapsedHint => throw UnimplementedError(); + + @override + // TODO: implement expandedHint + String get expandedHint => throw UnimplementedError(); + + @override + // TODO: implement expansionTileCollapsedHint + String get expansionTileCollapsedHint => throw UnimplementedError(); + + @override + // TODO: implement expansionTileCollapsedTapHint + String get expansionTileCollapsedTapHint => throw UnimplementedError(); + + @override + // TODO: implement expansionTileExpandedHint + String get expansionTileExpandedHint => throw UnimplementedError(); + + @override + // TODO: implement expansionTileExpandedTapHint + String get expansionTileExpandedTapHint => throw UnimplementedError(); + + @override + // TODO: implement scanTextButtonLabel + String get scanTextButtonLabel => throw UnimplementedError(); } /// Cupertino Support diff --git a/lib/locales/yoruba_intl.dart b/lib/locales/yoruba_intl.dart index 889c21cb7..c53515709 100644 --- a/lib/locales/yoruba_intl.dart +++ b/lib/locales/yoruba_intl.dart @@ -751,6 +751,34 @@ String get keyboardKeyMetaWindows => 'Windows'; @override String get scrimOnTapHintRaw => "Scrip on Tap"; + + @override + // TODO: implement collapsedHint + String get collapsedHint => throw UnimplementedError(); + + @override + // TODO: implement expandedHint + String get expandedHint => throw UnimplementedError(); + + @override + // TODO: implement expansionTileCollapsedHint + String get expansionTileCollapsedHint => throw UnimplementedError(); + + @override + // TODO: implement expansionTileCollapsedTapHint + String get expansionTileCollapsedTapHint => throw UnimplementedError(); + + @override + // TODO: implement expansionTileExpandedHint + String get expansionTileExpandedHint => throw UnimplementedError(); + + @override + // TODO: implement expansionTileExpandedTapHint + String get expansionTileExpandedTapHint => throw UnimplementedError(); + + @override + // TODO: implement scanTextButtonLabel + String get scanTextButtonLabel => throw UnimplementedError(); } /// Cupertino Support @@ -955,4 +983,11 @@ String get todayLabel => 'Oyọ'; @override String get noSpellCheckReplacementsLabel => ""; + +// @override +// String get clearButtonLabel => ''; +// - CupertinoLocalizations.lookUpButtonLabel +// - CupertinoLocalizations.menuDismissLabel +// - CupertinoLocalizations.searchWebButtonLabel +// - CupertinoLocalizations.shareButtonLabel } diff --git a/lib/src/screens/settings/security_backup_page.dart b/lib/src/screens/settings/security_backup_page.dart index e559e9b15..1f0f58ad4 100644 --- a/lib/src/screens/settings/security_backup_page.dart +++ b/lib/src/screens/settings/security_backup_page.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:cake_wallet/core/auth_service.dart'; import 'package:cake_wallet/entities/pin_code_required_duration.dart'; import 'package:cake_wallet/routes.dart'; @@ -58,7 +60,7 @@ class SecurityBackupPage extends BasePage { .shouldRequireTOTP2FAForAllSecurityAndBackupSettings, ), ), - if (DeviceInfo.instance.isMobile) + if (DeviceInfo.instance.isMobile || Platform.isMacOS || Platform.isLinux) Observer(builder: (_) { return SettingsSwitcherCell( title: S.current.settings_allow_biometrical_authentication, diff --git a/lib/src/screens/settings/tor_page.dart b/lib/src/screens/settings/tor_page.dart index ae1ef1677..2f544be35 100644 --- a/lib/src/screens/settings/tor_page.dart +++ b/lib/src/screens/settings/tor_page.dart @@ -146,7 +146,7 @@ class ConnectScreen extends StatelessWidget { ElevatedButton( onPressed: connect, style: ElevatedButton.styleFrom( - primary: Colors.blue, + // primary: Colors.blue, padding: EdgeInsets.symmetric(horizontal: 40, vertical: 15), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(30), @@ -211,7 +211,7 @@ class DisconnectScreen extends StatelessWidget { ElevatedButton( onPressed: disconnect, style: ElevatedButton.styleFrom( - primary: Colors.red, + // primary: Colors.red, padding: EdgeInsets.symmetric(horizontal: 40, vertical: 15), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(30), diff --git a/lib/src/widgets/validable_annotated_editable_text.dart b/lib/src/widgets/validable_annotated_editable_text.dart index 6c3fc4f16..f7a4e55a4 100644 --- a/lib/src/widgets/validable_annotated_editable_text.dart +++ b/lib/src/widgets/validable_annotated_editable_text.dart @@ -2,7 +2,30 @@ import 'package:cake_wallet/core/seed_validator.dart'; import 'package:cw_core/wallet_type.dart'; import 'package:flutter/material.dart'; -class Annotation extends Comparable { +abstract interface class ComparableCopy { + /// Compares this object to another object. + /// + /// Returns a value like a [Comparator] when comparing `this` to [other]. + /// That is, it returns a negative integer if `this` is ordered before [other], + /// a positive integer if `this` is ordered after [other], + /// and zero if `this` and [other] are ordered together. + /// + /// The [other] argument must be a value that is comparable to this object. + int compareTo(T other); + + /// A [Comparator] that compares one comparable to another. + /// + /// It returns the result of `a.compareTo(b)`. + /// The call may fail at run-time + /// if `a` is not comparable to the type of `b`. + /// + /// This utility function is used as the default comparator + /// for ordering collections, for example in the [List] sort function. + static int compare(Comparable a, Comparable b) => a.compareTo(b); +} + + +class Annotation extends ComparableCopy { Annotation({required this.range, required this.style}); final TextRange range; @@ -12,7 +35,7 @@ class Annotation extends Comparable { int compareTo(Annotation other) => range.start.compareTo(other.range.start); } -class TextAnnotation extends Comparable { +class TextAnnotation extends ComparableCopy { TextAnnotation({required this.text, required this.style}); final TextStyle style; diff --git a/lib/view_model/auth_view_model.dart b/lib/view_model/auth_view_model.dart index e50f4db0c..0e6590845 100644 --- a/lib/view_model/auth_view_model.dart +++ b/lib/view_model/auth_view_model.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'package:flutter/material.dart'; +import 'package:flutter_local_authentication/flutter_local_authentication.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:mobx/mobx.dart'; import 'package:cake_wallet/view_model/auth_state.dart'; @@ -105,16 +106,14 @@ abstract class AuthViewModelBase with Store { @action Future biometricAuth() async { + final _flutterLocalAuthenticationPlugin = FlutterLocalAuthentication(); + try { - final canBiometricAuth = await _biometricAuth.canCheckBiometrics(); - - if (canBiometricAuth) { - final isAuthenticated = await _biometricAuth.isAuthenticated(); - - if (isAuthenticated) { - state = ExecutedSuccessfullyState(); - } + final authenticated = await _flutterLocalAuthenticationPlugin.authenticate(); + if (!authenticated) { + throw Exception('Biometric authentication failed'); } + state = ExecutedSuccessfullyState(); } catch (e) { state = FailureState(e.toString()); } diff --git a/pubspec_base.yaml b/pubspec_base.yaml index 0293df1d1..47906f368 100644 --- a/pubspec_base.yaml +++ b/pubspec_base.yaml @@ -33,8 +33,8 @@ dependencies: dio: ^4.0.6 hive: ^2.2.3 hive_flutter: ^1.1.0 - local_auth: ^2.1.0 local_auth_android: 1.0.21 + flutter_local_authentication: ^1.2.0 package_info: ^2.0.0 #package_info_plus: ^1.4.2 devicelocale: diff --git a/pubspec_description.yaml b/pubspec_description.yaml index ebb6bf001..b51fe96d6 100644 --- a/pubspec_description.yaml +++ b/pubspec_description.yaml @@ -4,4 +4,4 @@ version: 0.0.0 publish_to: none environment: - sdk: ">=2.17.5 <3.0.0" \ No newline at end of file + sdk: ">=3.1.0 <4.0.0" \ No newline at end of file From e7f55edafcb429638706a24e210d34f7195fdc7f Mon Sep 17 00:00:00 2001 From: Matthew Fosse Date: Fri, 5 Apr 2024 10:23:27 -0700 Subject: [PATCH 02/10] bump flutter version in workflow file --- .github/workflows/pr_test_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_test_build.yml b/.github/workflows/pr_test_build.yml index ddc8869f0..7b70f9e68 100644 --- a/.github/workflows/pr_test_build.yml +++ b/.github/workflows/pr_test_build.yml @@ -42,7 +42,7 @@ jobs: - name: Flutter action uses: subosito/flutter-action@v1 with: - flutter-version: "3.10.x" + flutter-version: "3.13.9" channel: stable - name: Install package dependencies From 99fcd3a5844de4fd3d9fef6d5952dde25cd22c08 Mon Sep 17 00:00:00 2001 From: Matthew Fosse Date: Fri, 5 Apr 2024 10:42:01 -0700 Subject: [PATCH 03/10] workflow fix --- .github/workflows/pr_test_build.yml | 2 +- cw_bitcoin/pubspec.yaml | 2 +- cw_bitcoin_cash/pubspec.yaml | 2 +- cw_core/pubspec.yaml | 2 +- cw_ethereum/pubspec.yaml | 2 +- cw_evm/pubspec.yaml | 2 +- cw_haven/pubspec.yaml | 2 +- cw_monero/pubspec.yaml | 2 +- cw_nano/pubspec.yaml | 2 +- cw_polygon/pubspec.yaml | 2 +- cw_solana/pubspec.yaml | 2 +- lib/entities/biometric_auth.dart | 2 -- lib/locales/hausa_intl.dart | 36 ++++++++++++++++++++++++ lib/locales/yoruba_intl.dart | 43 ++++++++++++++++++++++++----- 14 files changed, 83 insertions(+), 20 deletions(-) diff --git a/.github/workflows/pr_test_build.yml b/.github/workflows/pr_test_build.yml index 7b70f9e68..3e90b9582 100644 --- a/.github/workflows/pr_test_build.yml +++ b/.github/workflows/pr_test_build.yml @@ -42,7 +42,7 @@ jobs: - name: Flutter action uses: subosito/flutter-action@v1 with: - flutter-version: "3.13.9" + flutter-version: "3.19.5" channel: stable - name: Install package dependencies diff --git a/cw_bitcoin/pubspec.yaml b/cw_bitcoin/pubspec.yaml index bcbb55e11..78c62954d 100644 --- a/cw_bitcoin/pubspec.yaml +++ b/cw_bitcoin/pubspec.yaml @@ -39,7 +39,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - build_runner: ^2.1.11 + build_runner: ^2.4.7 build_resolvers: ^2.0.9 mobx_codegen: ^2.0.7 hive_generator: ^1.1.3 diff --git a/cw_bitcoin_cash/pubspec.yaml b/cw_bitcoin_cash/pubspec.yaml index 7130b3c58..f13b89e88 100644 --- a/cw_bitcoin_cash/pubspec.yaml +++ b/cw_bitcoin_cash/pubspec.yaml @@ -39,7 +39,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - build_runner: ^2.1.11 + build_runner: ^2.4.7 mobx_codegen: ^2.0.7 hive_generator: ^1.1.3 diff --git a/cw_core/pubspec.yaml b/cw_core/pubspec.yaml index 04a840d4e..259f985f7 100644 --- a/cw_core/pubspec.yaml +++ b/cw_core/pubspec.yaml @@ -28,7 +28,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - build_runner: ^2.1.11 + build_runner: ^2.4.7 build_resolvers: ^2.0.9 mobx_codegen: ^2.0.7 hive_generator: ^2.0.1 diff --git a/cw_ethereum/pubspec.yaml b/cw_ethereum/pubspec.yaml index 649ec574b..518f631a2 100644 --- a/cw_ethereum/pubspec.yaml +++ b/cw_ethereum/pubspec.yaml @@ -22,7 +22,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - build_runner: ^2.1.11 + build_runner: ^2.4.7 flutter: # assets: # - images/a_dot_burr.jpeg diff --git a/cw_evm/pubspec.yaml b/cw_evm/pubspec.yaml index c202cc72a..cb7688d3c 100644 --- a/cw_evm/pubspec.yaml +++ b/cw_evm/pubspec.yaml @@ -27,7 +27,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - build_runner: ^2.1.11 + build_runner: ^2.4.7 mobx_codegen: ^2.0.7 hive_generator: ^1.1.3 flutter_lints: ^2.0.0 diff --git a/cw_haven/pubspec.yaml b/cw_haven/pubspec.yaml index c215ab779..e3e2179ac 100644 --- a/cw_haven/pubspec.yaml +++ b/cw_haven/pubspec.yaml @@ -24,7 +24,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - build_runner: ^2.1.11 + build_runner: ^2.4.7 mobx_codegen: ^2.0.7 build_resolvers: ^2.0.9 hive_generator: ^1.1.3 diff --git a/cw_monero/pubspec.yaml b/cw_monero/pubspec.yaml index a6fe7f967..3b763fee5 100644 --- a/cw_monero/pubspec.yaml +++ b/cw_monero/pubspec.yaml @@ -26,7 +26,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - build_runner: ^2.1.11 + build_runner: ^2.4.7 build_resolvers: ^2.0.9 mobx_codegen: ^2.0.7 hive_generator: ^1.1.3 diff --git a/cw_nano/pubspec.yaml b/cw_nano/pubspec.yaml index a4b8732fd..b65b5bb4b 100644 --- a/cw_nano/pubspec.yaml +++ b/cw_nano/pubspec.yaml @@ -32,7 +32,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - build_runner: ^2.1.11 + build_runner: ^2.4.7 mobx_codegen: ^2.0.7 hive_generator: ^1.1.3 diff --git a/cw_polygon/pubspec.yaml b/cw_polygon/pubspec.yaml index 505838d7c..fd91151d7 100644 --- a/cw_polygon/pubspec.yaml +++ b/cw_polygon/pubspec.yaml @@ -28,7 +28,7 @@ dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^2.0.0 - build_runner: ^2.1.11 + build_runner: ^2.4.7 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/cw_solana/pubspec.yaml b/cw_solana/pubspec.yaml index 7e24983bf..5c4e706b4 100644 --- a/cw_solana/pubspec.yaml +++ b/cw_solana/pubspec.yaml @@ -26,7 +26,7 @@ dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^2.0.0 - build_runner: ^2.1.11 + build_runner: ^2.4.7 mobx_codegen: ^2.0.7 hive_generator: ^1.1.3 diff --git a/lib/entities/biometric_auth.dart b/lib/entities/biometric_auth.dart index cdf2dcd43..0997864e4 100644 --- a/lib/entities/biometric_auth.dart +++ b/lib/entities/biometric_auth.dart @@ -1,6 +1,4 @@ -// import 'package:local_auth/local_auth.dart'; import 'package:flutter/services.dart'; -import 'package:cake_wallet/generated/i18n.dart'; import 'package:flutter_local_authentication/flutter_local_authentication.dart'; class BiometricAuth { diff --git a/lib/locales/hausa_intl.dart b/lib/locales/hausa_intl.dart index 1ff12df0a..bdcd2a8f5 100644 --- a/lib/locales/hausa_intl.dart +++ b/lib/locales/hausa_intl.dart @@ -779,6 +779,22 @@ class HaMaterialLocalizations extends GlobalMaterialLocalizations { @override // TODO: implement scanTextButtonLabel String get scanTextButtonLabel => throw UnimplementedError(); + + @override + // TODO: implement lookUpButtonLabel + String get lookUpButtonLabel => throw UnimplementedError(); + + @override + // TODO: implement menuDismissLabel + String get menuDismissLabel => throw UnimplementedError(); + + @override + // TODO: implement searchWebButtonLabel + String get searchWebButtonLabel => throw UnimplementedError(); + + @override + // TODO: implement shareButtonLabel + String get shareButtonLabel => throw UnimplementedError(); } /// Cupertino Support @@ -983,4 +999,24 @@ class HaCupertinoLocalizations extends GlobalCupertinoLocalizations { @override String get noSpellCheckReplacementsLabel => ""; + + @override + // TODO: implement clearButtonLabel + String get clearButtonLabel => throw UnimplementedError(); + + @override + // TODO: implement lookUpButtonLabel + String get lookUpButtonLabel => throw UnimplementedError(); + + @override + // TODO: implement menuDismissLabel + String get menuDismissLabel => throw UnimplementedError(); + + @override + // TODO: implement searchWebButtonLabel + String get searchWebButtonLabel => throw UnimplementedError(); + + @override + // TODO: implement shareButtonLabel + String get shareButtonLabel => throw UnimplementedError(); } diff --git a/lib/locales/yoruba_intl.dart b/lib/locales/yoruba_intl.dart index c53515709..365108596 100644 --- a/lib/locales/yoruba_intl.dart +++ b/lib/locales/yoruba_intl.dart @@ -779,6 +779,22 @@ String get keyboardKeyMetaWindows => 'Windows'; @override // TODO: implement scanTextButtonLabel String get scanTextButtonLabel => throw UnimplementedError(); + + @override + // TODO: implement lookUpButtonLabel + String get lookUpButtonLabel => throw UnimplementedError(); + + @override + // TODO: implement menuDismissLabel + String get menuDismissLabel => throw UnimplementedError(); + + @override + // TODO: implement searchWebButtonLabel + String get searchWebButtonLabel => throw UnimplementedError(); + + @override + // TODO: implement shareButtonLabel + String get shareButtonLabel => throw UnimplementedError(); } /// Cupertino Support @@ -983,11 +999,24 @@ String get todayLabel => 'Oyọ'; @override String get noSpellCheckReplacementsLabel => ""; - -// @override -// String get clearButtonLabel => ''; -// - CupertinoLocalizations.lookUpButtonLabel -// - CupertinoLocalizations.menuDismissLabel -// - CupertinoLocalizations.searchWebButtonLabel -// - CupertinoLocalizations.shareButtonLabel + + @override + // TODO: implement clearButtonLabel + String get clearButtonLabel => throw UnimplementedError(); + + @override + // TODO: implement lookUpButtonLabel + String get lookUpButtonLabel => throw UnimplementedError(); + + @override + // TODO: implement menuDismissLabel + String get menuDismissLabel => throw UnimplementedError(); + + @override + // TODO: implement searchWebButtonLabel + String get searchWebButtonLabel => throw UnimplementedError(); + + @override + // TODO: implement shareButtonLabel + String get shareButtonLabel => throw UnimplementedError(); } From f004fb1d2ad902c9897c797618d46fedc2697c76 Mon Sep 17 00:00:00 2001 From: Matthew Fosse Date: Fri, 5 Apr 2024 10:52:04 -0700 Subject: [PATCH 04/10] test fix --- cw_bitcoin/pubspec.yaml | 3 +++ cw_bitcoin_cash/pubspec.yaml | 3 +++ cw_core/pubspec.yaml | 3 +++ cw_ethereum/pubspec.yaml | 4 ++++ cw_evm/pubspec.yaml | 3 +++ cw_haven/pubspec.yaml | 3 +++ cw_monero/pubspec.yaml | 3 +++ cw_nano/pubspec.yaml | 3 +++ cw_polygon/pubspec.yaml | 3 +++ cw_solana/pubspec.yaml | 3 +++ 10 files changed, 31 insertions(+) diff --git a/cw_bitcoin/pubspec.yaml b/cw_bitcoin/pubspec.yaml index 78c62954d..f1c90c984 100644 --- a/cw_bitcoin/pubspec.yaml +++ b/cw_bitcoin/pubspec.yaml @@ -44,6 +44,9 @@ dev_dependencies: mobx_codegen: ^2.0.7 hive_generator: ^1.1.3 +dependency_overrides: + watcher: ^1.1.0 + # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/cw_bitcoin_cash/pubspec.yaml b/cw_bitcoin_cash/pubspec.yaml index f13b89e88..833db534f 100644 --- a/cw_bitcoin_cash/pubspec.yaml +++ b/cw_bitcoin_cash/pubspec.yaml @@ -43,6 +43,9 @@ dev_dependencies: mobx_codegen: ^2.0.7 hive_generator: ^1.1.3 +dependency_overrides: + watcher: ^1.1.0 + # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/cw_core/pubspec.yaml b/cw_core/pubspec.yaml index 259f985f7..51d671dc7 100644 --- a/cw_core/pubspec.yaml +++ b/cw_core/pubspec.yaml @@ -33,6 +33,9 @@ dev_dependencies: mobx_codegen: ^2.0.7 hive_generator: ^2.0.1 +dependency_overrides: + watcher: ^1.1.0 + # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/cw_ethereum/pubspec.yaml b/cw_ethereum/pubspec.yaml index 518f631a2..cbe6644a4 100644 --- a/cw_ethereum/pubspec.yaml +++ b/cw_ethereum/pubspec.yaml @@ -23,6 +23,10 @@ dev_dependencies: flutter_test: sdk: flutter build_runner: ^2.4.7 + +dependency_overrides: + watcher: ^1.1.0 + flutter: # assets: # - images/a_dot_burr.jpeg diff --git a/cw_evm/pubspec.yaml b/cw_evm/pubspec.yaml index cb7688d3c..eaafb8415 100644 --- a/cw_evm/pubspec.yaml +++ b/cw_evm/pubspec.yaml @@ -32,6 +32,9 @@ dev_dependencies: hive_generator: ^1.1.3 flutter_lints: ^2.0.0 +dependency_overrides: + watcher: ^1.1.0 + flutter: # assets: # - images/a_dot_burr.jpeg diff --git a/cw_haven/pubspec.yaml b/cw_haven/pubspec.yaml index e3e2179ac..d868c986d 100644 --- a/cw_haven/pubspec.yaml +++ b/cw_haven/pubspec.yaml @@ -29,6 +29,9 @@ dev_dependencies: build_resolvers: ^2.0.9 hive_generator: ^1.1.3 +dependency_overrides: + watcher: ^1.1.0 + # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/cw_monero/pubspec.yaml b/cw_monero/pubspec.yaml index 3b763fee5..c49a541ab 100644 --- a/cw_monero/pubspec.yaml +++ b/cw_monero/pubspec.yaml @@ -31,6 +31,9 @@ dev_dependencies: mobx_codegen: ^2.0.7 hive_generator: ^1.1.3 +dependency_overrides: + watcher: ^1.1.0 + # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/cw_nano/pubspec.yaml b/cw_nano/pubspec.yaml index b65b5bb4b..768c1bb4e 100644 --- a/cw_nano/pubspec.yaml +++ b/cw_nano/pubspec.yaml @@ -36,6 +36,9 @@ dev_dependencies: mobx_codegen: ^2.0.7 hive_generator: ^1.1.3 +dependency_overrides: + watcher: ^1.1.0 + # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/cw_polygon/pubspec.yaml b/cw_polygon/pubspec.yaml index fd91151d7..61a474002 100644 --- a/cw_polygon/pubspec.yaml +++ b/cw_polygon/pubspec.yaml @@ -30,6 +30,9 @@ dev_dependencies: flutter_lints: ^2.0.0 build_runner: ^2.4.7 +dependency_overrides: + watcher: ^1.1.0 + # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/cw_solana/pubspec.yaml b/cw_solana/pubspec.yaml index 5c4e706b4..6b59282b4 100644 --- a/cw_solana/pubspec.yaml +++ b/cw_solana/pubspec.yaml @@ -30,6 +30,9 @@ dev_dependencies: mobx_codegen: ^2.0.7 hive_generator: ^1.1.3 +dependency_overrides: + watcher: ^1.1.0 + flutter: # assets: # - images/a_dot_burr.jpeg From 91752bd4e48ef16da3e781e7b3da6d5a7a182a60 Mon Sep 17 00:00:00 2001 From: Matthew Fosse Date: Fri, 5 Apr 2024 11:07:26 -0700 Subject: [PATCH 05/10] downgrade flutter version --- .github/workflows/pr_test_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_test_build.yml b/.github/workflows/pr_test_build.yml index 3e90b9582..7b70f9e68 100644 --- a/.github/workflows/pr_test_build.yml +++ b/.github/workflows/pr_test_build.yml @@ -42,7 +42,7 @@ jobs: - name: Flutter action uses: subosito/flutter-action@v1 with: - flutter-version: "3.19.5" + flutter-version: "3.13.9" channel: stable - name: Install package dependencies From 91fc247462c8cc1801bcebf2c89ccbf00b2cddd2 Mon Sep 17 00:00:00 2001 From: Matthew Fosse Date: Fri, 5 Apr 2024 11:10:11 -0700 Subject: [PATCH 06/10] test fix --- lib/src/widgets/validable_annotated_editable_text.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/src/widgets/validable_annotated_editable_text.dart b/lib/src/widgets/validable_annotated_editable_text.dart index f7a4e55a4..f6fbf18ae 100644 --- a/lib/src/widgets/validable_annotated_editable_text.dart +++ b/lib/src/widgets/validable_annotated_editable_text.dart @@ -1,8 +1,6 @@ -import 'package:cake_wallet/core/seed_validator.dart'; -import 'package:cw_core/wallet_type.dart'; import 'package:flutter/material.dart'; -abstract interface class ComparableCopy { +abstract class ComparableCopy { /// Compares this object to another object. /// /// Returns a value like a [Comparator] when comparing `this` to [other]. From 37c9f900780a6e0dc5d1d34f29e2c81b5fd2e6cd Mon Sep 17 00:00:00 2001 From: Matthew Fosse Date: Fri, 5 Apr 2024 11:11:49 -0700 Subject: [PATCH 07/10] test fix --- lib/src/widgets/validable_annotated_editable_text.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/widgets/validable_annotated_editable_text.dart b/lib/src/widgets/validable_annotated_editable_text.dart index f6fbf18ae..f88094dd5 100644 --- a/lib/src/widgets/validable_annotated_editable_text.dart +++ b/lib/src/widgets/validable_annotated_editable_text.dart @@ -19,7 +19,7 @@ abstract class ComparableCopy { /// /// This utility function is used as the default comparator /// for ordering collections, for example in the [List] sort function. - static int compare(Comparable a, Comparable b) => a.compareTo(b); + static int compare(ComparableCopy a, ComparableCopy b) => a.compareTo(b); } From 223f1675dbad0f88603e3313f939342a99bd9bb7 Mon Sep 17 00:00:00 2001 From: Matthew Fosse Date: Mon, 8 Apr 2024 10:28:59 -0700 Subject: [PATCH 08/10] update gradle version --- android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index 8286d9cb9..e182e39af 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.7.10' + ext.kotlin_version = '1.8.10' repositories { google() jcenter() From d817911187d85ca95ea5004541c30240631cf349 Mon Sep 17 00:00:00 2001 From: Matthew Fosse Date: Tue, 16 Apr 2024 11:34:53 -0700 Subject: [PATCH 09/10] fixes for updated dart version, localization file updates --- lib/entities/biometric_auth.dart | 8 +--- lib/lightning/lightning.dart | 47 +++++++++++++++++++ lib/locales/hausa_intl.dart | 22 ++++----- lib/locales/yoruba_intl.dart | 10 ++-- .../validable_annotated_editable_text.dart | 29 +++--------- 5 files changed, 72 insertions(+), 44 deletions(-) create mode 100644 lib/lightning/lightning.dart diff --git a/lib/entities/biometric_auth.dart b/lib/entities/biometric_auth.dart index 0997864e4..463a22775 100644 --- a/lib/entities/biometric_auth.dart +++ b/lib/entities/biometric_auth.dart @@ -8,7 +8,7 @@ class BiometricAuth { try { final authenticated = await _flutterLocalAuthenticationPlugin.authenticate(); return authenticated; - } on PlatformException catch (e) { + } catch (e) { print(e); } return false; @@ -18,11 +18,7 @@ class BiometricAuth { bool canAuthenticate; try { canAuthenticate = await _flutterLocalAuthenticationPlugin.canAuthenticate(); - - // Setup TouchID Allowable Reuse duration - // It works only in iOS and macOS, but it's safe to call it even on other platforms. - await _flutterLocalAuthenticationPlugin.setTouchIDAuthenticationAllowableReuseDuration(30); - } on Exception catch (error) { + } catch (error) { print("Exception checking support. $error"); canAuthenticate = false; } diff --git a/lib/lightning/lightning.dart b/lib/lightning/lightning.dart new file mode 100644 index 000000000..6c5b75770 --- /dev/null +++ b/lib/lightning/lightning.dart @@ -0,0 +1,47 @@ +import 'package:cake_wallet/bitcoin/bitcoin.dart'; +import 'package:cw_core/unspent_transaction_output.dart'; +import 'package:cw_core/wallet_credentials.dart'; +import 'package:cw_core/wallet_info.dart'; +import 'package:cw_core/transaction_priority.dart'; +import 'package:cw_core/output_info.dart'; +import 'package:cw_core/unspent_coins_info.dart'; +import 'package:cw_core/wallet_service.dart'; +import 'package:cw_core/receive_page_option.dart'; +import 'package:cw_core/crypto_amount_format.dart'; +import 'package:cake_wallet/view_model/send/output.dart'; +import 'package:cw_core/wallet_type.dart'; +import 'package:hive/hive.dart'; +import 'package:mobx/mobx.dart'; +import 'package:intl/intl.dart'; + +import 'package:cw_bitcoin/electrum_wallet.dart'; +import 'package:cw_bitcoin/bitcoin_unspent.dart'; +import 'package:cw_bitcoin/bitcoin_mnemonic.dart'; +import 'package:cw_bitcoin/bitcoin_transaction_priority.dart'; +import 'package:cw_bitcoin/bitcoin_wallet_creation_credentials.dart'; +import 'package:cw_bitcoin/bitcoin_amount_format.dart'; +import 'package:cw_bitcoin/bitcoin_address_record.dart'; +import 'package:cw_bitcoin/bitcoin_transaction_credentials.dart'; +import 'package:cw_lightning/lightning_wallet_service.dart'; +import 'package:cw_lightning/lightning_receive_page_option.dart'; + +part 'cw_lightning.dart'; + +Lightning? lightning = CWLightning(); + +abstract class Lightning { + String formatterLightningAmountToString({required int amount}); + double formatterLightningAmountToDouble({required int amount}); + int formatterStringDoubleToLightningAmount(String amount); + WalletService createLightningWalletService( + Box walletInfoSource, Box unspentCoinSource); + List getLightningReceivePageOptions(); + String satsToLightningString(int sats); + ReceivePageOption getOptionInvoice(); + ReceivePageOption getOptionOnchain(); + String bitcoinAmountToLightningString({required int amount}); + int bitcoinAmountToLightningAmount({required int amount}); + double bitcoinDoubleToLightningDouble({required double amount}); + double lightningDoubleToBitcoinDouble({required double amount}); +} + \ No newline at end of file diff --git a/lib/locales/hausa_intl.dart b/lib/locales/hausa_intl.dart index bdcd2a8f5..d4cd31780 100644 --- a/lib/locales/hausa_intl.dart +++ b/lib/locales/hausa_intl.dart @@ -754,47 +754,47 @@ class HaMaterialLocalizations extends GlobalMaterialLocalizations { @override // TODO: implement collapsedHint - String get collapsedHint => throw UnimplementedError(); + String get collapsedHint => "collapsedHint"; @override // TODO: implement expandedHint - String get expandedHint => throw UnimplementedError(); + String get expandedHint => "expandedHint"; @override // TODO: implement expansionTileCollapsedHint - String get expansionTileCollapsedHint => throw UnimplementedError(); + String get expansionTileCollapsedHint => "expansionTileCollapsedHint"; @override // TODO: implement expansionTileCollapsedTapHint - String get expansionTileCollapsedTapHint => throw UnimplementedError(); + String get expansionTileCollapsedTapHint => "expansionTileCollapsedTapHint"; @override // TODO: implement expansionTileExpandedHint - String get expansionTileExpandedHint => throw UnimplementedError(); + String get expansionTileExpandedHint => "expansionTileExpandedHint"; @override // TODO: implement expansionTileExpandedTapHint - String get expansionTileExpandedTapHint => throw UnimplementedError(); + String get expansionTileExpandedTapHint => "expansionTileExpandedTapHint"; @override // TODO: implement scanTextButtonLabel - String get scanTextButtonLabel => throw UnimplementedError(); + String get scanTextButtonLabel => "scanTextButtonLabel"; @override // TODO: implement lookUpButtonLabel - String get lookUpButtonLabel => throw UnimplementedError(); + String get lookUpButtonLabel => "lookUpButtonLabel"; @override // TODO: implement menuDismissLabel - String get menuDismissLabel => throw UnimplementedError(); + String get menuDismissLabel => "menuDismissLabel"; @override // TODO: implement searchWebButtonLabel - String get searchWebButtonLabel => throw UnimplementedError(); + String get searchWebButtonLabel => "searchWebButtonLabel"; @override // TODO: implement shareButtonLabel - String get shareButtonLabel => throw UnimplementedError(); + String get shareButtonLabel => "shareButtonLabel"; } /// Cupertino Support diff --git a/lib/locales/yoruba_intl.dart b/lib/locales/yoruba_intl.dart index 365108596..54b8bc021 100644 --- a/lib/locales/yoruba_intl.dart +++ b/lib/locales/yoruba_intl.dart @@ -1002,21 +1002,21 @@ String get todayLabel => 'Oyọ'; @override // TODO: implement clearButtonLabel - String get clearButtonLabel => throw UnimplementedError(); + String get clearButtonLabel => "clearButtonLabel"; @override // TODO: implement lookUpButtonLabel - String get lookUpButtonLabel => throw UnimplementedError(); + String get lookUpButtonLabel => "lookUpButtonLabel"; @override // TODO: implement menuDismissLabel - String get menuDismissLabel => throw UnimplementedError(); + String get menuDismissLabel => "menuDismissLabel"; @override // TODO: implement searchWebButtonLabel - String get searchWebButtonLabel => throw UnimplementedError(); + String get searchWebButtonLabel => "searchWebButtonLabel"; @override // TODO: implement shareButtonLabel - String get shareButtonLabel => throw UnimplementedError(); + String get shareButtonLabel => "shareButtonLabel"; } diff --git a/lib/src/widgets/validable_annotated_editable_text.dart b/lib/src/widgets/validable_annotated_editable_text.dart index f88094dd5..7ea928d8a 100644 --- a/lib/src/widgets/validable_annotated_editable_text.dart +++ b/lib/src/widgets/validable_annotated_editable_text.dart @@ -1,29 +1,14 @@ import 'package:flutter/material.dart'; -abstract class ComparableCopy { - /// Compares this object to another object. - /// - /// Returns a value like a [Comparator] when comparing `this` to [other]. - /// That is, it returns a negative integer if `this` is ordered before [other], - /// a positive integer if `this` is ordered after [other], - /// and zero if `this` and [other] are ordered together. - /// - /// The [other] argument must be a value that is comparable to this object. - int compareTo(T other); - /// A [Comparator] that compares one comparable to another. - /// - /// It returns the result of `a.compareTo(b)`. - /// The call may fail at run-time - /// if `a` is not comparable to the type of `b`. - /// - /// This utility function is used as the default comparator - /// for ordering collections, for example in the [List] sort function. - static int compare(ComparableCopy a, ComparableCopy b) => a.compareTo(b); +extension Compare on Comparable { + bool operator <=(T other) => compareTo(other) <= 0; + bool operator >=(T other) => compareTo(other) >= 0; + bool operator <(T other) => compareTo(other) < 0; + bool operator >(T other) => compareTo(other) > 0; } - -class Annotation extends ComparableCopy { +class Annotation implements Comparable { Annotation({required this.range, required this.style}); final TextRange range; @@ -33,7 +18,7 @@ class Annotation extends ComparableCopy { int compareTo(Annotation other) => range.start.compareTo(other.range.start); } -class TextAnnotation extends ComparableCopy { +class TextAnnotation implements Comparable { TextAnnotation({required this.text, required this.style}); final TextStyle style; From e358683e15f7876f5766c6b20e69c480c37a8be2 Mon Sep 17 00:00:00 2001 From: Matthew Fosse Date: Tue, 16 Apr 2024 11:35:33 -0700 Subject: [PATCH 10/10] remove accidental inclusion --- lib/lightning/lightning.dart | 47 ------------------------------------ 1 file changed, 47 deletions(-) delete mode 100644 lib/lightning/lightning.dart diff --git a/lib/lightning/lightning.dart b/lib/lightning/lightning.dart deleted file mode 100644 index 6c5b75770..000000000 --- a/lib/lightning/lightning.dart +++ /dev/null @@ -1,47 +0,0 @@ -import 'package:cake_wallet/bitcoin/bitcoin.dart'; -import 'package:cw_core/unspent_transaction_output.dart'; -import 'package:cw_core/wallet_credentials.dart'; -import 'package:cw_core/wallet_info.dart'; -import 'package:cw_core/transaction_priority.dart'; -import 'package:cw_core/output_info.dart'; -import 'package:cw_core/unspent_coins_info.dart'; -import 'package:cw_core/wallet_service.dart'; -import 'package:cw_core/receive_page_option.dart'; -import 'package:cw_core/crypto_amount_format.dart'; -import 'package:cake_wallet/view_model/send/output.dart'; -import 'package:cw_core/wallet_type.dart'; -import 'package:hive/hive.dart'; -import 'package:mobx/mobx.dart'; -import 'package:intl/intl.dart'; - -import 'package:cw_bitcoin/electrum_wallet.dart'; -import 'package:cw_bitcoin/bitcoin_unspent.dart'; -import 'package:cw_bitcoin/bitcoin_mnemonic.dart'; -import 'package:cw_bitcoin/bitcoin_transaction_priority.dart'; -import 'package:cw_bitcoin/bitcoin_wallet_creation_credentials.dart'; -import 'package:cw_bitcoin/bitcoin_amount_format.dart'; -import 'package:cw_bitcoin/bitcoin_address_record.dart'; -import 'package:cw_bitcoin/bitcoin_transaction_credentials.dart'; -import 'package:cw_lightning/lightning_wallet_service.dart'; -import 'package:cw_lightning/lightning_receive_page_option.dart'; - -part 'cw_lightning.dart'; - -Lightning? lightning = CWLightning(); - -abstract class Lightning { - String formatterLightningAmountToString({required int amount}); - double formatterLightningAmountToDouble({required int amount}); - int formatterStringDoubleToLightningAmount(String amount); - WalletService createLightningWalletService( - Box walletInfoSource, Box unspentCoinSource); - List getLightningReceivePageOptions(); - String satsToLightningString(int sats); - ReceivePageOption getOptionInvoice(); - ReceivePageOption getOptionOnchain(); - String bitcoinAmountToLightningString({required int amount}); - int bitcoinAmountToLightningAmount({required int amount}); - double bitcoinDoubleToLightningDouble({required double amount}); - double lightningDoubleToBitcoinDouble({required double amount}); -} - \ No newline at end of file