mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 19:49:22 +00:00
version bump to 3.13.9, auth working on mac (#1367)
* version bump to 3.13.9, auth working on mac * bump flutter version in workflow file * workflow fix * test fix * downgrade flutter version * test fix * test fix * update gradle version * fixes for updated dart version, localization file updates * remove accidental inclusion * missed some unimplemented throws
This commit is contained in:
parent
59d44e8c57
commit
e6b4b08c24
21 changed files with 642 additions and 481 deletions
2
.github/workflows/pr_test_build.yml
vendored
2
.github/workflows/pr_test_build.yml
vendored
|
@ -42,7 +42,7 @@ jobs:
|
||||||
- name: Flutter action
|
- name: Flutter action
|
||||||
uses: subosito/flutter-action@v1
|
uses: subosito/flutter-action@v1
|
||||||
with:
|
with:
|
||||||
flutter-version: "3.10.x"
|
flutter-version: "3.13.9"
|
||||||
channel: stable
|
channel: stable
|
||||||
|
|
||||||
- name: Install package dependencies
|
- name: Install package dependencies
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.7.10'
|
ext.kotlin_version = '1.8.10'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
|
|
|
@ -39,11 +39,14 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
build_runner: ^2.1.11
|
build_runner: ^2.4.7
|
||||||
build_resolvers: ^2.0.9
|
build_resolvers: ^2.0.9
|
||||||
mobx_codegen: ^2.0.7
|
mobx_codegen: ^2.0.7
|
||||||
hive_generator: ^1.1.3
|
hive_generator: ^1.1.3
|
||||||
|
|
||||||
|
dependency_overrides:
|
||||||
|
watcher: ^1.1.0
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
# For information on the generic Dart part of this file, see the
|
||||||
# following page: https://dart.dev/tools/pub/pubspec
|
# following page: https://dart.dev/tools/pub/pubspec
|
||||||
|
|
||||||
|
|
|
@ -39,10 +39,13 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
build_runner: ^2.1.11
|
build_runner: ^2.4.7
|
||||||
mobx_codegen: ^2.0.7
|
mobx_codegen: ^2.0.7
|
||||||
hive_generator: ^1.1.3
|
hive_generator: ^1.1.3
|
||||||
|
|
||||||
|
dependency_overrides:
|
||||||
|
watcher: ^1.1.0
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
# For information on the generic Dart part of this file, see the
|
||||||
# following page: https://dart.dev/tools/pub/pubspec
|
# following page: https://dart.dev/tools/pub/pubspec
|
||||||
|
|
||||||
|
|
|
@ -28,11 +28,14 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
build_runner: ^2.1.11
|
build_runner: ^2.4.7
|
||||||
build_resolvers: ^2.0.9
|
build_resolvers: ^2.0.9
|
||||||
mobx_codegen: ^2.0.7
|
mobx_codegen: ^2.0.7
|
||||||
hive_generator: ^2.0.1
|
hive_generator: ^2.0.1
|
||||||
|
|
||||||
|
dependency_overrides:
|
||||||
|
watcher: ^1.1.0
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
# For information on the generic Dart part of this file, see the
|
||||||
# following page: https://dart.dev/tools/pub/pubspec
|
# following page: https://dart.dev/tools/pub/pubspec
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,11 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
build_runner: ^2.1.11
|
build_runner: ^2.4.7
|
||||||
|
|
||||||
|
dependency_overrides:
|
||||||
|
watcher: ^1.1.0
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
# assets:
|
# assets:
|
||||||
# - images/a_dot_burr.jpeg
|
# - images/a_dot_burr.jpeg
|
||||||
|
|
|
@ -27,11 +27,14 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
build_runner: ^2.1.11
|
build_runner: ^2.4.7
|
||||||
mobx_codegen: ^2.0.7
|
mobx_codegen: ^2.0.7
|
||||||
hive_generator: ^1.1.3
|
hive_generator: ^1.1.3
|
||||||
flutter_lints: ^2.0.0
|
flutter_lints: ^2.0.0
|
||||||
|
|
||||||
|
dependency_overrides:
|
||||||
|
watcher: ^1.1.0
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
# assets:
|
# assets:
|
||||||
# - images/a_dot_burr.jpeg
|
# - images/a_dot_burr.jpeg
|
||||||
|
|
|
@ -24,11 +24,14 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
build_runner: ^2.1.11
|
build_runner: ^2.4.7
|
||||||
mobx_codegen: ^2.0.7
|
mobx_codegen: ^2.0.7
|
||||||
build_resolvers: ^2.0.9
|
build_resolvers: ^2.0.9
|
||||||
hive_generator: ^1.1.3
|
hive_generator: ^1.1.3
|
||||||
|
|
||||||
|
dependency_overrides:
|
||||||
|
watcher: ^1.1.0
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
# For information on the generic Dart part of this file, see the
|
||||||
# following page: https://dart.dev/tools/pub/pubspec
|
# following page: https://dart.dev/tools/pub/pubspec
|
||||||
|
|
||||||
|
|
|
@ -26,11 +26,14 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
build_runner: ^2.1.11
|
build_runner: ^2.4.7
|
||||||
build_resolvers: ^2.0.9
|
build_resolvers: ^2.0.9
|
||||||
mobx_codegen: ^2.0.7
|
mobx_codegen: ^2.0.7
|
||||||
hive_generator: ^1.1.3
|
hive_generator: ^1.1.3
|
||||||
|
|
||||||
|
dependency_overrides:
|
||||||
|
watcher: ^1.1.0
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
# For information on the generic Dart part of this file, see the
|
||||||
# following page: https://dart.dev/tools/pub/pubspec
|
# following page: https://dart.dev/tools/pub/pubspec
|
||||||
|
|
||||||
|
|
|
@ -32,10 +32,13 @@ dependencies:
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
build_runner: ^2.1.11
|
build_runner: ^2.4.7
|
||||||
mobx_codegen: ^2.0.7
|
mobx_codegen: ^2.0.7
|
||||||
hive_generator: ^1.1.3
|
hive_generator: ^1.1.3
|
||||||
|
|
||||||
|
dependency_overrides:
|
||||||
|
watcher: ^1.1.0
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
# For information on the generic Dart part of this file, see the
|
||||||
# following page: https://dart.dev/tools/pub/pubspec
|
# following page: https://dart.dev/tools/pub/pubspec
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,10 @@ dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_lints: ^2.0.0
|
flutter_lints: ^2.0.0
|
||||||
build_runner: ^2.1.11
|
build_runner: ^2.4.7
|
||||||
|
|
||||||
|
dependency_overrides:
|
||||||
|
watcher: ^1.1.0
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
# For information on the generic Dart part of this file, see the
|
||||||
# following page: https://dart.dev/tools/pub/pubspec
|
# following page: https://dart.dev/tools/pub/pubspec
|
||||||
|
|
|
@ -26,10 +26,13 @@ dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_lints: ^2.0.0
|
flutter_lints: ^2.0.0
|
||||||
build_runner: ^2.1.11
|
build_runner: ^2.4.7
|
||||||
mobx_codegen: ^2.0.7
|
mobx_codegen: ^2.0.7
|
||||||
hive_generator: ^1.1.3
|
hive_generator: ^1.1.3
|
||||||
|
|
||||||
|
dependency_overrides:
|
||||||
|
watcher: ^1.1.0
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
# assets:
|
# assets:
|
||||||
# - images/a_dot_burr.jpeg
|
# - images/a_dot_burr.jpeg
|
||||||
|
|
|
@ -1,32 +1,28 @@
|
||||||
import 'package:local_auth/local_auth.dart';
|
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:flutter_local_authentication/flutter_local_authentication.dart';
|
||||||
|
|
||||||
class BiometricAuth {
|
class BiometricAuth {
|
||||||
final _localAuth = LocalAuthentication();
|
final _flutterLocalAuthenticationPlugin = FlutterLocalAuthentication();
|
||||||
|
|
||||||
Future<bool> isAuthenticated() async {
|
Future<bool> isAuthenticated() async {
|
||||||
try {
|
try {
|
||||||
return await _localAuth.authenticate(
|
final authenticated = await _flutterLocalAuthenticationPlugin.authenticate();
|
||||||
localizedReason: S.current.biometric_auth_reason,
|
return authenticated;
|
||||||
options: AuthenticationOptions(
|
} catch (e) {
|
||||||
biometricOnly: true,
|
|
||||||
useErrorDialogs: true,
|
|
||||||
stickyAuth: false));
|
|
||||||
} on PlatformException catch (e) {
|
|
||||||
print(e);
|
print(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> canCheckBiometrics() async {
|
Future<bool> canCheckBiometrics() async {
|
||||||
|
bool canAuthenticate;
|
||||||
try {
|
try {
|
||||||
return await _localAuth.canCheckBiometrics;
|
canAuthenticate = await _flutterLocalAuthenticationPlugin.canAuthenticate();
|
||||||
} on PlatformException catch (e) {
|
} catch (error) {
|
||||||
print(e);
|
print("Exception checking support. $error");
|
||||||
|
canAuthenticate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return canAuthenticate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -751,6 +751,50 @@ class HaMaterialLocalizations extends GlobalMaterialLocalizations {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get scrimOnTapHintRaw => "Scrip on Tap";
|
String get scrimOnTapHintRaw => "Scrip on Tap";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement collapsedHint
|
||||||
|
String get collapsedHint => "collapsedHint";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement expandedHint
|
||||||
|
String get expandedHint => "expandedHint";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement expansionTileCollapsedHint
|
||||||
|
String get expansionTileCollapsedHint => "expansionTileCollapsedHint";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement expansionTileCollapsedTapHint
|
||||||
|
String get expansionTileCollapsedTapHint => "expansionTileCollapsedTapHint";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement expansionTileExpandedHint
|
||||||
|
String get expansionTileExpandedHint => "expansionTileExpandedHint";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement expansionTileExpandedTapHint
|
||||||
|
String get expansionTileExpandedTapHint => "expansionTileExpandedTapHint";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement scanTextButtonLabel
|
||||||
|
String get scanTextButtonLabel => "scanTextButtonLabel";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement lookUpButtonLabel
|
||||||
|
String get lookUpButtonLabel => "lookUpButtonLabel";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement menuDismissLabel
|
||||||
|
String get menuDismissLabel => "menuDismissLabel";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement searchWebButtonLabel
|
||||||
|
String get searchWebButtonLabel => "searchWebButtonLabel";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement shareButtonLabel
|
||||||
|
String get shareButtonLabel => "shareButtonLabel";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Cupertino Support
|
/// Cupertino Support
|
||||||
|
@ -955,4 +999,24 @@ class HaCupertinoLocalizations extends GlobalCupertinoLocalizations {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get noSpellCheckReplacementsLabel => "";
|
String get noSpellCheckReplacementsLabel => "";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement clearButtonLabel
|
||||||
|
String get clearButtonLabel => "clearButtonLabel";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement lookUpButtonLabel
|
||||||
|
String get lookUpButtonLabel => "lookUpButtonLabel";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement menuDismissLabel
|
||||||
|
String get menuDismissLabel => "menuDismissLabel";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement searchWebButtonLabel
|
||||||
|
String get searchWebButtonLabel => "searchWebButtonLabel";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement shareButtonLabel
|
||||||
|
String get shareButtonLabel => "shareButtonLabel";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
@ -751,6 +750,50 @@ String get keyboardKeyMetaWindows => 'Windows';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get scrimOnTapHintRaw => "Scrip on Tap";
|
String get scrimOnTapHintRaw => "Scrip on Tap";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement collapsedHint
|
||||||
|
String get collapsedHint => "collapsedHint";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement expandedHint
|
||||||
|
String get expandedHint => "expandedHint";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement expansionTileCollapsedHint
|
||||||
|
String get expansionTileCollapsedHint => "expansionTileCollapsedHint";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement expansionTileCollapsedTapHint
|
||||||
|
String get expansionTileCollapsedTapHint => "expansionTileCollapsedTapHint";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement expansionTileExpandedHint
|
||||||
|
String get expansionTileExpandedHint => "expansionTileExpandedHint";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement expansionTileExpandedTapHint
|
||||||
|
String get expansionTileExpandedTapHint => "expansionTileExpandedTapHint";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement scanTextButtonLabel
|
||||||
|
String get scanTextButtonLabel => "scanTextButtonLabel";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement lookUpButtonLabel
|
||||||
|
String get lookUpButtonLabel => "lookUpButtonLabel";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement menuDismissLabel
|
||||||
|
String get menuDismissLabel => "menuDismissLabel";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement searchWebButtonLabel
|
||||||
|
String get searchWebButtonLabel => "searchWebButtonLabel";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement shareButtonLabel
|
||||||
|
String get shareButtonLabel => "shareButtonLabel";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Cupertino Support
|
/// Cupertino Support
|
||||||
|
@ -955,4 +998,24 @@ String get todayLabel => 'Oyọ';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get noSpellCheckReplacementsLabel => "";
|
String get noSpellCheckReplacementsLabel => "";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement clearButtonLabel
|
||||||
|
String get clearButtonLabel => "clearButtonLabel";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement lookUpButtonLabel
|
||||||
|
String get lookUpButtonLabel => "lookUpButtonLabel";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement menuDismissLabel
|
||||||
|
String get menuDismissLabel => "menuDismissLabel";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement searchWebButtonLabel
|
||||||
|
String get searchWebButtonLabel => "searchWebButtonLabel";
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement shareButtonLabel
|
||||||
|
String get shareButtonLabel => "shareButtonLabel";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:cake_wallet/core/auth_service.dart';
|
import 'package:cake_wallet/core/auth_service.dart';
|
||||||
import 'package:cake_wallet/entities/pin_code_required_duration.dart';
|
import 'package:cake_wallet/entities/pin_code_required_duration.dart';
|
||||||
import 'package:cake_wallet/routes.dart';
|
import 'package:cake_wallet/routes.dart';
|
||||||
|
@ -58,7 +60,7 @@ class SecurityBackupPage extends BasePage {
|
||||||
.shouldRequireTOTP2FAForAllSecurityAndBackupSettings,
|
.shouldRequireTOTP2FAForAllSecurityAndBackupSettings,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (DeviceInfo.instance.isMobile)
|
if (DeviceInfo.instance.isMobile || Platform.isMacOS || Platform.isLinux)
|
||||||
Observer(builder: (_) {
|
Observer(builder: (_) {
|
||||||
return SettingsSwitcherCell(
|
return SettingsSwitcherCell(
|
||||||
title: S.current.settings_allow_biometrical_authentication,
|
title: S.current.settings_allow_biometrical_authentication,
|
||||||
|
|
|
@ -146,7 +146,7 @@ class ConnectScreen extends StatelessWidget {
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: connect,
|
onPressed: connect,
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
primary: Colors.blue,
|
// primary: Colors.blue,
|
||||||
padding: EdgeInsets.symmetric(horizontal: 40, vertical: 15),
|
padding: EdgeInsets.symmetric(horizontal: 40, vertical: 15),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(30),
|
borderRadius: BorderRadius.circular(30),
|
||||||
|
@ -211,7 +211,7 @@ class DisconnectScreen extends StatelessWidget {
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: disconnect,
|
onPressed: disconnect,
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
primary: Colors.red,
|
// primary: Colors.red,
|
||||||
padding: EdgeInsets.symmetric(horizontal: 40, vertical: 15),
|
padding: EdgeInsets.symmetric(horizontal: 40, vertical: 15),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(30),
|
borderRadius: BorderRadius.circular(30),
|
||||||
|
|
|
@ -1,8 +1,14 @@
|
||||||
import 'package:cake_wallet/core/seed_validator.dart';
|
|
||||||
import 'package:cw_core/wallet_type.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class Annotation extends Comparable<Annotation> {
|
|
||||||
|
extension Compare<T> on Comparable<T> {
|
||||||
|
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 implements Comparable<Annotation> {
|
||||||
Annotation({required this.range, required this.style});
|
Annotation({required this.range, required this.style});
|
||||||
|
|
||||||
final TextRange range;
|
final TextRange range;
|
||||||
|
@ -12,7 +18,7 @@ class Annotation extends Comparable<Annotation> {
|
||||||
int compareTo(Annotation other) => range.start.compareTo(other.range.start);
|
int compareTo(Annotation other) => range.start.compareTo(other.range.start);
|
||||||
}
|
}
|
||||||
|
|
||||||
class TextAnnotation extends Comparable<TextAnnotation> {
|
class TextAnnotation implements Comparable<TextAnnotation> {
|
||||||
TextAnnotation({required this.text, required this.style});
|
TextAnnotation({required this.text, required this.style});
|
||||||
|
|
||||||
final TextStyle style;
|
final TextStyle style;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_local_authentication/flutter_local_authentication.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
import 'package:cake_wallet/view_model/auth_state.dart';
|
import 'package:cake_wallet/view_model/auth_state.dart';
|
||||||
|
@ -105,16 +106,14 @@ abstract class AuthViewModelBase with Store {
|
||||||
|
|
||||||
@action
|
@action
|
||||||
Future<void> biometricAuth() async {
|
Future<void> biometricAuth() async {
|
||||||
|
final _flutterLocalAuthenticationPlugin = FlutterLocalAuthentication();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final canBiometricAuth = await _biometricAuth.canCheckBiometrics();
|
final authenticated = await _flutterLocalAuthenticationPlugin.authenticate();
|
||||||
|
if (!authenticated) {
|
||||||
if (canBiometricAuth) {
|
throw Exception('Biometric authentication failed');
|
||||||
final isAuthenticated = await _biometricAuth.isAuthenticated();
|
}
|
||||||
|
|
||||||
if (isAuthenticated) {
|
|
||||||
state = ExecutedSuccessfullyState();
|
state = ExecutedSuccessfullyState();
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
state = FailureState(e.toString());
|
state = FailureState(e.toString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,8 @@ dependencies:
|
||||||
dio: ^4.0.6
|
dio: ^4.0.6
|
||||||
hive: ^2.2.3
|
hive: ^2.2.3
|
||||||
hive_flutter: ^1.1.0
|
hive_flutter: ^1.1.0
|
||||||
local_auth: ^2.1.0
|
|
||||||
local_auth_android: 1.0.21
|
local_auth_android: 1.0.21
|
||||||
|
flutter_local_authentication: ^1.2.0
|
||||||
package_info: ^2.0.0
|
package_info: ^2.0.0
|
||||||
#package_info_plus: ^1.4.2
|
#package_info_plus: ^1.4.2
|
||||||
devicelocale:
|
devicelocale:
|
||||||
|
|
|
@ -4,4 +4,4 @@ version: 0.0.0
|
||||||
publish_to: none
|
publish_to: none
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.17.5 <3.0.0"
|
sdk: ">=3.1.0 <4.0.0"
|
Loading…
Reference in a new issue