From fdeee8874a8d0bdd1fbaebb27d235c191ea019c0 Mon Sep 17 00:00:00 2001 From: Matthew Fosse Date: Tue, 14 Nov 2023 15:56:36 -0600 Subject: [PATCH] disable bio auth (#1172) * disable bio auth * enforce dark theme on desktop platforms --------- Co-authored-by: fossephate --- lib/core/backup_service.dart | 63 ++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/lib/core/backup_service.dart b/lib/core/backup_service.dart index 520447dd4..85fd8f588 100644 --- a/lib/core/backup_service.dart +++ b/lib/core/backup_service.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'dart:io'; import 'dart:typed_data'; +import 'package:cake_wallet/themes/theme_list.dart'; import 'package:cake_wallet/utils/device_info.dart'; import 'package:cw_core/wallet_type.dart'; import 'package:flutter/foundation.dart'; @@ -254,7 +255,8 @@ class BackupService { final lookupsENS = data[PreferencesKey.lookupsENS] as bool?; final syncAll = data[PreferencesKey.syncAllKey] as bool?; 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); @@ -291,9 +293,12 @@ class BackupService { await _sharedPreferences.setInt( 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( PreferencesKey.allowBiometricalAuthenticationKey, allowBiometricalAuthentication); + } if (currentBitcoinElectrumSererId != null) await _sharedPreferences.setInt( @@ -309,14 +314,19 @@ class BackupService { if (fiatApiMode != null) await _sharedPreferences.setInt(PreferencesKey.currentFiatApiModeKey, fiatApiMode); if (autoGenerateSubaddressStatus != null) - await _sharedPreferences.setInt(PreferencesKey.autoGenerateSubaddressStatusKey, - autoGenerateSubaddressStatus); + await _sharedPreferences.setInt( + PreferencesKey.autoGenerateSubaddressStatusKey, autoGenerateSubaddressStatus); if (currentPinLength != null) await _sharedPreferences.setInt(PreferencesKey.currentPinLength, currentPinLength); - if (currentTheme != null && DeviceInfo.instance.isMobile) + if (currentTheme != null && DeviceInfo.instance.isMobile) { 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) await _sharedPreferences.setInt(PreferencesKey.exchangeStatusKey, exchangeStatus); @@ -389,19 +399,17 @@ class BackupService { await _sharedPreferences.setBool(PreferencesKey.lookupsYatService, lookupsYatService); if (lookupsUnstoppableDomains != null) - await _sharedPreferences.setBool(PreferencesKey.lookupsUnstoppableDomains, lookupsUnstoppableDomains); + await _sharedPreferences.setBool( + PreferencesKey.lookupsUnstoppableDomains, lookupsUnstoppableDomains); if (lookupsOpenAlias != null) await _sharedPreferences.setBool(PreferencesKey.lookupsOpenAlias, lookupsOpenAlias); - if (lookupsENS != null) - await _sharedPreferences.setBool(PreferencesKey.lookupsENS, lookupsENS); + if (lookupsENS != null) await _sharedPreferences.setBool(PreferencesKey.lookupsENS, lookupsENS); - if (syncAll != null) - await _sharedPreferences.setBool(PreferencesKey.syncAllKey, syncAll); + if (syncAll != null) await _sharedPreferences.setBool(PreferencesKey.syncAllKey, syncAll); - if (syncMode != null) - await _sharedPreferences.setInt(PreferencesKey.syncModeKey, syncMode); + if (syncMode != null) await _sharedPreferences.setInt(PreferencesKey.syncModeKey, syncMode); await preferencesFile.delete(); } @@ -505,7 +513,8 @@ class BackupService { _sharedPreferences.getBool(PreferencesKey.shouldSaveRecipientAddressKey), PreferencesKey.disableBuyKey: _sharedPreferences.getBool(PreferencesKey.disableBuyKey), PreferencesKey.disableSellKey: _sharedPreferences.getBool(PreferencesKey.disableSellKey), - PreferencesKey.defaultBuyProvider: _sharedPreferences.getInt(PreferencesKey.defaultBuyProvider), + PreferencesKey.defaultBuyProvider: + _sharedPreferences.getInt(PreferencesKey.defaultBuyProvider), PreferencesKey.isDarkThemeLegacy: _sharedPreferences.getBool(PreferencesKey.isDarkThemeLegacy), PreferencesKey.currentPinLength: _sharedPreferences.getInt(PreferencesKey.currentPinLength), @@ -547,28 +556,20 @@ class BackupService { _sharedPreferences.getBool(PreferencesKey.shouldRequireTOTP2FAForCreatingNewWallets), PreferencesKey.shouldRequireTOTP2FAForAllSecurityAndBackupSettings: _sharedPreferences .getBool(PreferencesKey.shouldRequireTOTP2FAForAllSecurityAndBackupSettings), - PreferencesKey.sortBalanceBy: - _sharedPreferences.getInt(PreferencesKey.sortBalanceBy), + PreferencesKey.sortBalanceBy: _sharedPreferences.getInt(PreferencesKey.sortBalanceBy), PreferencesKey.pinNativeTokenAtTop: _sharedPreferences.getBool(PreferencesKey.pinNativeTokenAtTop), - PreferencesKey.useEtherscan: - _sharedPreferences.getBool(PreferencesKey.useEtherscan), - PreferencesKey.lookupsTwitter: - _sharedPreferences.getBool(PreferencesKey.lookupsTwitter), - PreferencesKey.lookupsMastodon: - _sharedPreferences.getBool(PreferencesKey.lookupsMastodon), + PreferencesKey.useEtherscan: _sharedPreferences.getBool(PreferencesKey.useEtherscan), + PreferencesKey.lookupsTwitter: _sharedPreferences.getBool(PreferencesKey.lookupsTwitter), + PreferencesKey.lookupsMastodon: _sharedPreferences.getBool(PreferencesKey.lookupsMastodon), PreferencesKey.lookupsYatService: - _sharedPreferences.getBool(PreferencesKey.lookupsYatService), + _sharedPreferences.getBool(PreferencesKey.lookupsYatService), PreferencesKey.lookupsUnstoppableDomains: - _sharedPreferences.getBool(PreferencesKey.lookupsUnstoppableDomains), - PreferencesKey.lookupsOpenAlias: - _sharedPreferences.getBool(PreferencesKey.lookupsOpenAlias), - PreferencesKey.lookupsENS: - _sharedPreferences.getBool(PreferencesKey.lookupsENS), - PreferencesKey.syncModeKey: - _sharedPreferences.getInt(PreferencesKey.syncModeKey), - PreferencesKey.syncAllKey: - _sharedPreferences.getBool(PreferencesKey.syncAllKey), + _sharedPreferences.getBool(PreferencesKey.lookupsUnstoppableDomains), + PreferencesKey.lookupsOpenAlias: _sharedPreferences.getBool(PreferencesKey.lookupsOpenAlias), + PreferencesKey.lookupsENS: _sharedPreferences.getBool(PreferencesKey.lookupsENS), + PreferencesKey.syncModeKey: _sharedPreferences.getInt(PreferencesKey.syncModeKey), + PreferencesKey.syncAllKey: _sharedPreferences.getBool(PreferencesKey.syncAllKey), PreferencesKey.autoGenerateSubaddressStatusKey: _sharedPreferences.getInt(PreferencesKey.autoGenerateSubaddressStatusKey), };