cake_wallet/lib/entities/cake_2fa_preset_options.dart
Adegoke David 4120394121
CW-266 verbose access controls for TOTP 2FA (#967)
* chore: Setup

* feat: Verbose controls for TOTP 2FA WIP [skip-ci]

* feat: Implement verbose controls for sends to contact, non contacts and internal wallets

* feat: Implement verbose 2FA control for exchanges to internal wallets [skip-ci]

* Implement verbose controls

* chore: PR cleanup

* fix: Implement fixes and recommendations on verbose controls

* feat: Localization for verbose controls settings

* fix: disable pin when 2fa is not activated

* fix: Naming error

* chore: Reformat code with linelength of 100

* fix: Wallet type page and type bug when creating wallet

* fix: add new values to be stored in local storage to both reload function and import/export functions in back_service.dart

* fix: White spaces with localization files

* fix: Switch observers in modify_2fa page to individual observer

* chore: Switch custom tab widget to reusable SettingsChoicesCell widget

* chore: Remove unneeded argument in create wallet entrypoint

* fix: Switch type for selectedCakePreference when importing preferences from backup file

* fix: Await all values being saved to local storage

---------

Co-authored-by: David Adegoke <blazebrain@Davids-MacBook-Pro.local>
2023-08-04 16:49:26 +03:00

35 lines
1 KiB
Dart

import 'package:cw_core/enumerable_item.dart';
class Cake2FAPresetsOptions extends EnumerableItem<int> with Serializable<int> {
const Cake2FAPresetsOptions({required String super.title, required int super.raw});
static const narrow = Cake2FAPresetsOptions(title: 'Narrow', raw: 0);
static const normal = Cake2FAPresetsOptions(title: 'Normal', raw: 1);
static const aggressive = Cake2FAPresetsOptions(title: 'Aggressive', raw: 2);
static Cake2FAPresetsOptions deserialize({required int raw}) {
switch (raw) {
case 0:
return Cake2FAPresetsOptions.narrow;
case 1:
return Cake2FAPresetsOptions.normal;
case 2:
return Cake2FAPresetsOptions.aggressive;
default:
throw Exception(
'Incorrect Cake 2FA Preset $raw for Cake2FAPresetOptions deserialize',
);
}
}
}
enum VerboseControlSettings {
accessWallet,
addingContacts,
sendsToContacts,
sendsToNonContacts,
sendsToInternalWallets,
exchangesToInternalWallets,
securityAndBackupSettings,
creatingNewWallets,
}