disable bio auth (#1172)

* disable bio auth

* enforce dark theme on desktop platforms

---------

Co-authored-by: fossephate <fosse@book.local>
This commit is contained in:
Matthew Fosse 2023-11-14 15:56:36 -06:00 committed by GitHub
parent a164e5defc
commit fdeee8874a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,7 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:cake_wallet/themes/theme_list.dart';
import 'package:cake_wallet/utils/device_info.dart'; import 'package:cake_wallet/utils/device_info.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
@ -254,7 +255,8 @@ class BackupService {
final lookupsENS = data[PreferencesKey.lookupsENS] as bool?; final lookupsENS = data[PreferencesKey.lookupsENS] as bool?;
final syncAll = data[PreferencesKey.syncAllKey] as bool?; final syncAll = data[PreferencesKey.syncAllKey] as bool?;
final syncMode = data[PreferencesKey.syncModeKey] as int?; final syncMode = data[PreferencesKey.syncModeKey] as int?;
final autoGenerateSubaddressStatus = data[PreferencesKey.autoGenerateSubaddressStatusKey] as int?; final autoGenerateSubaddressStatus =
data[PreferencesKey.autoGenerateSubaddressStatusKey] as int?;
await _sharedPreferences.setString(PreferencesKey.currentWalletName, currentWalletName); await _sharedPreferences.setString(PreferencesKey.currentWalletName, currentWalletName);
@ -291,9 +293,12 @@ class BackupService {
await _sharedPreferences.setInt( await _sharedPreferences.setInt(
PreferencesKey.currentTransactionPriorityKeyLegacy, currentTransactionPriorityKeyLegacy); PreferencesKey.currentTransactionPriorityKeyLegacy, currentTransactionPriorityKeyLegacy);
if (allowBiometricalAuthentication != null && !Platform.isMacOS && !Platform.isLinux) if (Platform.isMacOS || Platform.isLinux) {
await _sharedPreferences.setBool(PreferencesKey.allowBiometricalAuthenticationKey, false);
} else if (allowBiometricalAuthentication != null) {
await _sharedPreferences.setBool( await _sharedPreferences.setBool(
PreferencesKey.allowBiometricalAuthenticationKey, allowBiometricalAuthentication); PreferencesKey.allowBiometricalAuthenticationKey, allowBiometricalAuthentication);
}
if (currentBitcoinElectrumSererId != null) if (currentBitcoinElectrumSererId != null)
await _sharedPreferences.setInt( await _sharedPreferences.setInt(
@ -309,14 +314,19 @@ class BackupService {
if (fiatApiMode != null) if (fiatApiMode != null)
await _sharedPreferences.setInt(PreferencesKey.currentFiatApiModeKey, fiatApiMode); await _sharedPreferences.setInt(PreferencesKey.currentFiatApiModeKey, fiatApiMode);
if (autoGenerateSubaddressStatus != null) if (autoGenerateSubaddressStatus != null)
await _sharedPreferences.setInt(PreferencesKey.autoGenerateSubaddressStatusKey, await _sharedPreferences.setInt(
autoGenerateSubaddressStatus); PreferencesKey.autoGenerateSubaddressStatusKey, autoGenerateSubaddressStatus);
if (currentPinLength != null) if (currentPinLength != null)
await _sharedPreferences.setInt(PreferencesKey.currentPinLength, currentPinLength); await _sharedPreferences.setInt(PreferencesKey.currentPinLength, currentPinLength);
if (currentTheme != null && DeviceInfo.instance.isMobile) if (currentTheme != null && DeviceInfo.instance.isMobile) {
await _sharedPreferences.setInt(PreferencesKey.currentTheme, currentTheme); await _sharedPreferences.setInt(PreferencesKey.currentTheme, currentTheme);
// enforce dark theme on desktop platforms until the design is ready:
} else if (DeviceInfo.instance.isDesktop) {
await _sharedPreferences.setInt(PreferencesKey.currentTheme, ThemeList.darkTheme.raw);
}
if (exchangeStatus != null) if (exchangeStatus != null)
await _sharedPreferences.setInt(PreferencesKey.exchangeStatusKey, exchangeStatus); await _sharedPreferences.setInt(PreferencesKey.exchangeStatusKey, exchangeStatus);
@ -389,19 +399,17 @@ class BackupService {
await _sharedPreferences.setBool(PreferencesKey.lookupsYatService, lookupsYatService); await _sharedPreferences.setBool(PreferencesKey.lookupsYatService, lookupsYatService);
if (lookupsUnstoppableDomains != null) if (lookupsUnstoppableDomains != null)
await _sharedPreferences.setBool(PreferencesKey.lookupsUnstoppableDomains, lookupsUnstoppableDomains); await _sharedPreferences.setBool(
PreferencesKey.lookupsUnstoppableDomains, lookupsUnstoppableDomains);
if (lookupsOpenAlias != null) if (lookupsOpenAlias != null)
await _sharedPreferences.setBool(PreferencesKey.lookupsOpenAlias, lookupsOpenAlias); await _sharedPreferences.setBool(PreferencesKey.lookupsOpenAlias, lookupsOpenAlias);
if (lookupsENS != null) if (lookupsENS != null) await _sharedPreferences.setBool(PreferencesKey.lookupsENS, lookupsENS);
await _sharedPreferences.setBool(PreferencesKey.lookupsENS, lookupsENS);
if (syncAll != null) if (syncAll != null) await _sharedPreferences.setBool(PreferencesKey.syncAllKey, syncAll);
await _sharedPreferences.setBool(PreferencesKey.syncAllKey, syncAll);
if (syncMode != null) if (syncMode != null) await _sharedPreferences.setInt(PreferencesKey.syncModeKey, syncMode);
await _sharedPreferences.setInt(PreferencesKey.syncModeKey, syncMode);
await preferencesFile.delete(); await preferencesFile.delete();
} }
@ -505,7 +513,8 @@ class BackupService {
_sharedPreferences.getBool(PreferencesKey.shouldSaveRecipientAddressKey), _sharedPreferences.getBool(PreferencesKey.shouldSaveRecipientAddressKey),
PreferencesKey.disableBuyKey: _sharedPreferences.getBool(PreferencesKey.disableBuyKey), PreferencesKey.disableBuyKey: _sharedPreferences.getBool(PreferencesKey.disableBuyKey),
PreferencesKey.disableSellKey: _sharedPreferences.getBool(PreferencesKey.disableSellKey), PreferencesKey.disableSellKey: _sharedPreferences.getBool(PreferencesKey.disableSellKey),
PreferencesKey.defaultBuyProvider: _sharedPreferences.getInt(PreferencesKey.defaultBuyProvider), PreferencesKey.defaultBuyProvider:
_sharedPreferences.getInt(PreferencesKey.defaultBuyProvider),
PreferencesKey.isDarkThemeLegacy: PreferencesKey.isDarkThemeLegacy:
_sharedPreferences.getBool(PreferencesKey.isDarkThemeLegacy), _sharedPreferences.getBool(PreferencesKey.isDarkThemeLegacy),
PreferencesKey.currentPinLength: _sharedPreferences.getInt(PreferencesKey.currentPinLength), PreferencesKey.currentPinLength: _sharedPreferences.getInt(PreferencesKey.currentPinLength),
@ -547,28 +556,20 @@ class BackupService {
_sharedPreferences.getBool(PreferencesKey.shouldRequireTOTP2FAForCreatingNewWallets), _sharedPreferences.getBool(PreferencesKey.shouldRequireTOTP2FAForCreatingNewWallets),
PreferencesKey.shouldRequireTOTP2FAForAllSecurityAndBackupSettings: _sharedPreferences PreferencesKey.shouldRequireTOTP2FAForAllSecurityAndBackupSettings: _sharedPreferences
.getBool(PreferencesKey.shouldRequireTOTP2FAForAllSecurityAndBackupSettings), .getBool(PreferencesKey.shouldRequireTOTP2FAForAllSecurityAndBackupSettings),
PreferencesKey.sortBalanceBy: PreferencesKey.sortBalanceBy: _sharedPreferences.getInt(PreferencesKey.sortBalanceBy),
_sharedPreferences.getInt(PreferencesKey.sortBalanceBy),
PreferencesKey.pinNativeTokenAtTop: PreferencesKey.pinNativeTokenAtTop:
_sharedPreferences.getBool(PreferencesKey.pinNativeTokenAtTop), _sharedPreferences.getBool(PreferencesKey.pinNativeTokenAtTop),
PreferencesKey.useEtherscan: PreferencesKey.useEtherscan: _sharedPreferences.getBool(PreferencesKey.useEtherscan),
_sharedPreferences.getBool(PreferencesKey.useEtherscan), PreferencesKey.lookupsTwitter: _sharedPreferences.getBool(PreferencesKey.lookupsTwitter),
PreferencesKey.lookupsTwitter: PreferencesKey.lookupsMastodon: _sharedPreferences.getBool(PreferencesKey.lookupsMastodon),
_sharedPreferences.getBool(PreferencesKey.lookupsTwitter),
PreferencesKey.lookupsMastodon:
_sharedPreferences.getBool(PreferencesKey.lookupsMastodon),
PreferencesKey.lookupsYatService: PreferencesKey.lookupsYatService:
_sharedPreferences.getBool(PreferencesKey.lookupsYatService), _sharedPreferences.getBool(PreferencesKey.lookupsYatService),
PreferencesKey.lookupsUnstoppableDomains: PreferencesKey.lookupsUnstoppableDomains:
_sharedPreferences.getBool(PreferencesKey.lookupsUnstoppableDomains), _sharedPreferences.getBool(PreferencesKey.lookupsUnstoppableDomains),
PreferencesKey.lookupsOpenAlias: PreferencesKey.lookupsOpenAlias: _sharedPreferences.getBool(PreferencesKey.lookupsOpenAlias),
_sharedPreferences.getBool(PreferencesKey.lookupsOpenAlias), PreferencesKey.lookupsENS: _sharedPreferences.getBool(PreferencesKey.lookupsENS),
PreferencesKey.lookupsENS: PreferencesKey.syncModeKey: _sharedPreferences.getInt(PreferencesKey.syncModeKey),
_sharedPreferences.getBool(PreferencesKey.lookupsENS), PreferencesKey.syncAllKey: _sharedPreferences.getBool(PreferencesKey.syncAllKey),
PreferencesKey.syncModeKey:
_sharedPreferences.getInt(PreferencesKey.syncModeKey),
PreferencesKey.syncAllKey:
_sharedPreferences.getBool(PreferencesKey.syncAllKey),
PreferencesKey.autoGenerateSubaddressStatusKey: PreferencesKey.autoGenerateSubaddressStatusKey:
_sharedPreferences.getInt(PreferencesKey.autoGenerateSubaddressStatusKey), _sharedPreferences.getInt(PreferencesKey.autoGenerateSubaddressStatusKey),
}; };