mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-27 06:18:50 +01: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:
@@ -1,32 +1,28 @@
|
||||
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<bool> isAuthenticated() async {
|
||||
try {
|
||||
return await _localAuth.authenticate(
|
||||
localizedReason: S.current.biometric_auth_reason,
|
||||
options: AuthenticationOptions(
|
||||
biometricOnly: true,
|
||||
useErrorDialogs: true,
|
||||
stickyAuth: false));
|
||||
} on PlatformException catch (e) {
|
||||
final authenticated = await _flutterLocalAuthenticationPlugin.authenticate();
|
||||
return authenticated;
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Future<bool> canCheckBiometrics() async {
|
||||
bool canAuthenticate;
|
||||
try {
|
||||
return await _localAuth.canCheckBiometrics;
|
||||
} on PlatformException catch (e) {
|
||||
print(e);
|
||||
canAuthenticate = await _flutterLocalAuthenticationPlugin.canAuthenticate();
|
||||
} catch (error) {
|
||||
print("Exception checking support. $error");
|
||||
canAuthenticate = false;
|
||||
}
|
||||
|
||||
return false;
|
||||
return canAuthenticate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -751,6 +751,50 @@ class HaMaterialLocalizations extends GlobalMaterialLocalizations {
|
||||
|
||||
@override
|
||||
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
|
||||
@@ -955,4 +999,24 @@ class HaCupertinoLocalizations extends GlobalCupertinoLocalizations {
|
||||
|
||||
@override
|
||||
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";
|
||||
}
|
||||
|
||||
+500
-437
File diff suppressed because it is too large
Load Diff
@@ -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,
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
import 'package:cake_wallet/core/seed_validator.dart';
|
||||
import 'package:cw_core/wallet_type.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});
|
||||
|
||||
final TextRange range;
|
||||
@@ -12,7 +18,7 @@ class Annotation extends Comparable<Annotation> {
|
||||
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});
|
||||
|
||||
final TextStyle style;
|
||||
|
||||
@@ -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<void> 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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user