disable bio auth (#1172)

* disable bio auth * enforce dark theme on desktop platforms --------- Co-authored-by: fossephate <fosse@book.local>

Matthew Fosse committed Nov 14, 2023 at 15:56 UTC fdeee8874a8d0bdd1fbaebb27d235c191ea019c0
1 file changed +32 -31
lib/core/backup_service.dart
+32 -31
@@ -1,6 +1,7 @@
1 import 'dart:convert';
2 import 'dart:io';
3 import 'dart:typed_data';
4 +import 'package:cake_wallet/themes/theme_list.dart';
5 import 'package:cake_wallet/utils/device_info.dart';
6 import 'package:cw_core/wallet_type.dart';
7 import 'package:flutter/foundation.dart';
@@ -254,7 +255,8 @@ class BackupService {
255 final lookupsENS = data[PreferencesKey.lookupsENS] as bool?;
256 final syncAll = data[PreferencesKey.syncAllKey] as bool?;
257 final syncMode = data[PreferencesKey.syncModeKey] as int?;
257 - final autoGenerateSubaddressStatus = data[PreferencesKey.autoGenerateSubaddressStatusKey] as int?;
258 + final autoGenerateSubaddressStatus =
259 + data[PreferencesKey.autoGenerateSubaddressStatusKey] as int?;
260
261 await _sharedPreferences.setString(PreferencesKey.currentWalletName, currentWalletName);
262
@@ -291,9 +293,12 @@ class BackupService {
293 await _sharedPreferences.setInt(
294 PreferencesKey.currentTransactionPriorityKeyLegacy, currentTransactionPriorityKeyLegacy);
295
294 - if (allowBiometricalAuthentication != null && !Platform.isMacOS && !Platform.isLinux)
296 + if (Platform.isMacOS || Platform.isLinux) {
297 + await _sharedPreferences.setBool(PreferencesKey.allowBiometricalAuthenticationKey, false);
298 + } else if (allowBiometricalAuthentication != null) {
299 await _sharedPreferences.setBool(
300 PreferencesKey.allowBiometricalAuthenticationKey, allowBiometricalAuthentication);
301 + }
302
303 if (currentBitcoinElectrumSererId != null)
304 await _sharedPreferences.setInt(
@@ -309,14 +314,19 @@ class BackupService {
314 if (fiatApiMode != null)
315 await _sharedPreferences.setInt(PreferencesKey.currentFiatApiModeKey, fiatApiMode);
316 if (autoGenerateSubaddressStatus != null)
312 - await _sharedPreferences.setInt(PreferencesKey.autoGenerateSubaddressStatusKey,
313 - autoGenerateSubaddressStatus);
317 + await _sharedPreferences.setInt(
318 + PreferencesKey.autoGenerateSubaddressStatusKey, autoGenerateSubaddressStatus);
319
320 if (currentPinLength != null)
321 await _sharedPreferences.setInt(PreferencesKey.currentPinLength, currentPinLength);
322
318 - if (currentTheme != null && DeviceInfo.instance.isMobile)
323 + if (currentTheme != null && DeviceInfo.instance.isMobile) {
324 await _sharedPreferences.setInt(PreferencesKey.currentTheme, currentTheme);
325 + // enforce dark theme on desktop platforms until the design is ready:
326 + } else if (DeviceInfo.instance.isDesktop) {
327 + await _sharedPreferences.setInt(PreferencesKey.currentTheme, ThemeList.darkTheme.raw);
328 + }
329 +
330
331 if (exchangeStatus != null)
332 await _sharedPreferences.setInt(PreferencesKey.exchangeStatusKey, exchangeStatus);
@@ -389,19 +399,17 @@ class BackupService {
399 await _sharedPreferences.setBool(PreferencesKey.lookupsYatService, lookupsYatService);
400
401 if (lookupsUnstoppableDomains != null)
392 - await _sharedPreferences.setBool(PreferencesKey.lookupsUnstoppableDomains, lookupsUnstoppableDomains);
402 + await _sharedPreferences.setBool(
403 + PreferencesKey.lookupsUnstoppableDomains, lookupsUnstoppableDomains);
404
405 if (lookupsOpenAlias != null)
406 await _sharedPreferences.setBool(PreferencesKey.lookupsOpenAlias, lookupsOpenAlias);
407
397 - if (lookupsENS != null)
398 - await _sharedPreferences.setBool(PreferencesKey.lookupsENS, lookupsENS);
408 + if (lookupsENS != null) await _sharedPreferences.setBool(PreferencesKey.lookupsENS, lookupsENS);
409
400 - if (syncAll != null)
401 - await _sharedPreferences.setBool(PreferencesKey.syncAllKey, syncAll);
410 + if (syncAll != null) await _sharedPreferences.setBool(PreferencesKey.syncAllKey, syncAll);
411
403 - if (syncMode != null)
404 - await _sharedPreferences.setInt(PreferencesKey.syncModeKey, syncMode);
412 + if (syncMode != null) await _sharedPreferences.setInt(PreferencesKey.syncModeKey, syncMode);
413
414 await preferencesFile.delete();
415 }
@@ -505,7 +513,8 @@ class BackupService {
513 _sharedPreferences.getBool(PreferencesKey.shouldSaveRecipientAddressKey),
514 PreferencesKey.disableBuyKey: _sharedPreferences.getBool(PreferencesKey.disableBuyKey),
515 PreferencesKey.disableSellKey: _sharedPreferences.getBool(PreferencesKey.disableSellKey),
508 - PreferencesKey.defaultBuyProvider: _sharedPreferences.getInt(PreferencesKey.defaultBuyProvider),
516 + PreferencesKey.defaultBuyProvider:
517 + _sharedPreferences.getInt(PreferencesKey.defaultBuyProvider),
518 PreferencesKey.isDarkThemeLegacy:
519 _sharedPreferences.getBool(PreferencesKey.isDarkThemeLegacy),
520 PreferencesKey.currentPinLength: _sharedPreferences.getInt(PreferencesKey.currentPinLength),
@@ -547,28 +556,20 @@ class BackupService {
556 _sharedPreferences.getBool(PreferencesKey.shouldRequireTOTP2FAForCreatingNewWallets),
557 PreferencesKey.shouldRequireTOTP2FAForAllSecurityAndBackupSettings: _sharedPreferences
558 .getBool(PreferencesKey.shouldRequireTOTP2FAForAllSecurityAndBackupSettings),
550 - PreferencesKey.sortBalanceBy:
551 - _sharedPreferences.getInt(PreferencesKey.sortBalanceBy),
559 + PreferencesKey.sortBalanceBy: _sharedPreferences.getInt(PreferencesKey.sortBalanceBy),
560 PreferencesKey.pinNativeTokenAtTop:
561 _sharedPreferences.getBool(PreferencesKey.pinNativeTokenAtTop),
554 - PreferencesKey.useEtherscan:
555 - _sharedPreferences.getBool(PreferencesKey.useEtherscan),
556 - PreferencesKey.lookupsTwitter:
557 - _sharedPreferences.getBool(PreferencesKey.lookupsTwitter),
558 - PreferencesKey.lookupsMastodon:
559 - _sharedPreferences.getBool(PreferencesKey.lookupsMastodon),
562 + PreferencesKey.useEtherscan: _sharedPreferences.getBool(PreferencesKey.useEtherscan),
563 + PreferencesKey.lookupsTwitter: _sharedPreferences.getBool(PreferencesKey.lookupsTwitter),
564 + PreferencesKey.lookupsMastodon: _sharedPreferences.getBool(PreferencesKey.lookupsMastodon),
565 PreferencesKey.lookupsYatService:
561 - _sharedPreferences.getBool(PreferencesKey.lookupsYatService),
566 + _sharedPreferences.getBool(PreferencesKey.lookupsYatService),
567 PreferencesKey.lookupsUnstoppableDomains:
563 - _sharedPreferences.getBool(PreferencesKey.lookupsUnstoppableDomains),
564 - PreferencesKey.lookupsOpenAlias:
565 - _sharedPreferences.getBool(PreferencesKey.lookupsOpenAlias),
566 - PreferencesKey.lookupsENS:
567 - _sharedPreferences.getBool(PreferencesKey.lookupsENS),
568 - PreferencesKey.syncModeKey:
569 - _sharedPreferences.getInt(PreferencesKey.syncModeKey),
570 - PreferencesKey.syncAllKey:
571 - _sharedPreferences.getBool(PreferencesKey.syncAllKey),
568 + _sharedPreferences.getBool(PreferencesKey.lookupsUnstoppableDomains),
569 + PreferencesKey.lookupsOpenAlias: _sharedPreferences.getBool(PreferencesKey.lookupsOpenAlias),
570 + PreferencesKey.lookupsENS: _sharedPreferences.getBool(PreferencesKey.lookupsENS),
571 + PreferencesKey.syncModeKey: _sharedPreferences.getInt(PreferencesKey.syncModeKey),
572 + PreferencesKey.syncAllKey: _sharedPreferences.getBool(PreferencesKey.syncAllKey),
573 PreferencesKey.autoGenerateSubaddressStatusKey:
574 _sharedPreferences.getInt(PreferencesKey.autoGenerateSubaddressStatusKey),
575 };