From ecdc7baa2e3c8f46c3c5013f56c8b864f088ec9f Mon Sep 17 00:00:00 2001 From: OmarHatem Date: Fri, 11 Aug 2023 17:30:24 +0300 Subject: [PATCH] Revert "Cw 397 chatwoot live support (#1011)" This reverts commit af9b5ff10ce2a6a59afa94e17658c25d65a20c99. --- .github/workflows/pr_test_build.yml | 1 - assets/images/live_support.png | Bin 1776 -> 0 bytes assets/images/more_links.png | Bin 1889 -> 0 bytes assets/images/wallet_guides.png | Bin 1760 -> 0 bytes cw_core/lib/cake_hive.dart | 4 - cw_core/lib/erc20_token.dart | 3 +- cw_core/lib/hive_type_ids.dart | 13 --- cw_core/lib/node.dart | 3 +- cw_core/lib/unspent_coins_info.dart | 5 +- cw_core/lib/wallet_info.dart | 8 +- cw_core/lib/wallet_type.dart | 4 +- cw_ethereum/lib/ethereum_wallet.dart | 7 +- lib/anonpay/anonpay_invoice_info.dart | 3 +- lib/buy/order.dart | 7 +- lib/core/backup_service.dart | 13 ++- lib/di.dart | 8 -- lib/entities/contact.dart | 9 +- lib/entities/get_encryption_key.dart | 17 +-- lib/entities/template.dart | 3 +- lib/entities/transaction_description.dart | 3 +- lib/exchange/exchange_template.dart | 3 +- lib/exchange/trade.dart | 5 +- lib/main.dart | 70 ++++++------- lib/router.dart | 13 +-- lib/routes.dart | 2 - .../screens/restore/restore_options_page.dart | 2 + .../restore/widgets/restore_button.dart | 20 ++-- .../widgets/settings_cell_with_arrow.dart | 7 +- lib/src/screens/support/support_page.dart | 99 +++++++----------- .../support/widgets/support_tiles.dart | 69 ------------ .../support_chat/support_chat_page.dart | 38 ------- .../support_chat/widgets/chatwoot_widget.dart | 62 ----------- .../support_other_links_page.dart | 58 ---------- lib/view_model/support_view_model.dart | 29 ++--- pubspec_base.yaml | 1 - res/values/strings_ar.arb | 26 ++--- res/values/strings_bg.arb | 8 +- res/values/strings_cs.arb | 8 +- res/values/strings_de.arb | 10 +- res/values/strings_en.arb | 8 +- res/values/strings_es.arb | 8 +- res/values/strings_fr.arb | 8 +- res/values/strings_ha.arb | 8 +- res/values/strings_hi.arb | 8 +- res/values/strings_hr.arb | 8 +- res/values/strings_id.arb | 8 +- res/values/strings_it.arb | 8 +- res/values/strings_ja.arb | 26 ++--- res/values/strings_ko.arb | 26 ++--- res/values/strings_my.arb | 26 ++--- res/values/strings_nl.arb | 8 +- res/values/strings_pl.arb | 8 +- res/values/strings_pt.arb | 8 +- res/values/strings_ru.arb | 27 ++--- res/values/strings_th.arb | 26 ++--- res/values/strings_tr.arb | 8 +- res/values/strings_uk.arb | 8 +- res/values/strings_ur.arb | 26 ++--- res/values/strings_yo.arb | 26 ++--- res/values/strings_zh.arb | 26 ++--- tool/append_translation.dart | 66 ------------ tool/update_secrets.dart | 3 +- tool/utils/secret_key.dart | 1 - 63 files changed, 261 insertions(+), 763 deletions(-) delete mode 100644 assets/images/live_support.png delete mode 100644 assets/images/more_links.png delete mode 100644 assets/images/wallet_guides.png delete mode 100644 cw_core/lib/cake_hive.dart delete mode 100644 cw_core/lib/hive_type_ids.dart delete mode 100644 lib/src/screens/support/widgets/support_tiles.dart delete mode 100644 lib/src/screens/support_chat/support_chat_page.dart delete mode 100644 lib/src/screens/support_chat/widgets/chatwoot_widget.dart delete mode 100644 lib/src/screens/support_other_links/support_other_links_page.dart delete mode 100644 tool/append_translation.dart diff --git a/.github/workflows/pr_test_build.yml b/.github/workflows/pr_test_build.yml index 47378eef5..e2b932202 100644 --- a/.github/workflows/pr_test_build.yml +++ b/.github/workflows/pr_test_build.yml @@ -127,7 +127,6 @@ jobs: echo "const fiatApiKey = '${{ secrets.FIAT_API_KEY }}';" >> lib/.secrets.g.dart echo "const payfuraApiKey = '${{ secrets.PAYFURA_API_KEY }}';" >> lib/.secrets.g.dart echo "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';" >> cw_ethereum/lib/.secrets.g.dart - echo "const chatwootWebsiteToken = '${{ secrets.CHATWOOT_WEBSITE_TOKEN }}';" >> lib/.secrets.g.dart - name: Rename app run: echo -e "id=com.cakewallet.test\nname=$GITHUB_HEAD_REF" > /opt/android/cake_wallet/android/app.properties diff --git a/assets/images/live_support.png b/assets/images/live_support.png deleted file mode 100644 index 89ad61f458cddcb9ee9c17f751c1d545137d6d95..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1776 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 b(vE)tR=vS9SH@o300000NkvXXu0mjfr1x?h diff --git a/assets/images/wallet_guides.png b/assets/images/wallet_guides.png deleted file mode 100644 index 3f2d9f27059e0ee31cdc7016cbd0ea5caeb93f53..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1760 zcmV<61|Ru}P)ycPI=n#LH)xTNDj_PPN=R&I!iuhF5fV$MYZg^^-NhhOu_$W0V1-1o zf@M;PeVr$$D^VqG>@&>oxyPu8rYExRPwqK0=bLZ7nQMf9jnOUYzyA_0b|_zJ05%$e zL6`4$h@iU!(DTg4ob|j*-Q8~=;PKrN^>07M8NB6aY6qG*j5~AMCWH+{KqLTU2jrOK z9Qccn^dA2K@sj|%GJkFTbael-`IuhiD>om%Glg@GBwts*q5-^uLtgn78{J@oC>HF) zcf`1yi+6mH%nN;{jHNnzq1U9tz3cN4oO7rn-42X-)q$?gyHpE`hN8gN)S}}P!_k$6 z^l?TO;L*>cS6{<9Mv{=Qm2Jq1vmrsPAv8=Nwl9Yy7`=8^f}Dg-o~OINTss-V8;-PC zEQYdsf!h}MF!%?;Xf}3;k=CKO@*#-%Iywh&{N&pFjhsnHX_zX5NenA6B@V|~A^Z{b`6i7HHpr9j&rJ$}Eq@)IIbRa@Qfg~7SOm2eh z-#$J)+`mly|8#^W41yEM_laeFMOHnpR8He92gkmm1~Sy5Nq=I~^nsTcltKlWa~mC^4V`AAkR=az+qQ!74=6IP0es zua?B7ArW`J>aYgwjf{k}q#gb~#@Ikv6HKENkrMh%%(x%UG>ECx4uxN{(qmNWN(fzf zPBKAvE=oFII}@$Ay<;_I>*46-h#7W~i8R0r#;B#92=W|+EN61Ug_NWm9O3nw%L$Y2 zizX9FHEsC$h7C6CLYI*#*DPpV_JgajUU&JL&ynx(k>vjF&cogvc+1hS=gPvu2`I9T zwbUoeM!@VaD=_3dQ256`eR?|LP~GE=9(;bz3f%C@h*T3bl+})I1TD2yT2bIuf_pes z*d&7xhrF#lLG8)46Yf=DDv0vY`WZf713Pb)B*yuFJU_#eCMid92$}AZ7c?}4;gGRP zTXdqDG?>Wg)Kpb$%?{-iXNM6YE?#!}ZXLCC+PuX=A2QVN%w{=1Wlkuoj?#Mi8yz0WKK16XLLBvKWdP2~ghu?g;c+|}}6LxF2o&`ed+#?g> zzI64G6-f%p)e!9=|E{nC~8KLV{-J0o-DRXK&K64D=IPtEg)`MmYz}eePIL{!Q zVHhq=vm0-lB=BC>&~4ROo|rY%q$A`KtyQe;IXAw$v3SN=!L>pwuhs}r;We$yQKdCY z`drqBt!fsIwE6(iK0pxH5mT;kJ)onea{^Cs4W6?DeXBDrY}`d@V{Hp-TZjdL=vNHl z$PDm`U6%z~aW2r(TBJ~LcESlRj?!epux9u{v&Tz1)I^F`g2*DzjzmQob)#}q)zgf4 z*GyQ7AVm?e_2M0fzb9J1#Vt&A5Q7>4Z|fOAvz zg4}C$5T@&Aom~h{2`aEmS9tP|7|@$Awa!5M0$7}-h(AP60@i7oGfq_Up2b5dmwCqB zz`Z%1UE2KPonvTu)s9=+@;1L1_Lj?GmwD4r=Yo{zh6yc4m3EG+{#XMd?EpRSA8(`q zk{@ugm31NWn&0Qneb(bfiD>zBeevGW*1_tJI{yH@j noteRaw ?? ''; set note(String value) => noteRaw = value; -} +} \ No newline at end of file diff --git a/cw_core/lib/wallet_info.dart b/cw_core/lib/wallet_info.dart index 6b3fa9e98..a25702cf7 100644 --- a/cw_core/lib/wallet_info.dart +++ b/cw_core/lib/wallet_info.dart @@ -1,7 +1,7 @@ -import 'dart:async'; -import 'package:cw_core/hive_type_ids.dart'; -import 'package:cw_core/wallet_type.dart'; +import 'package:flutter/foundation.dart'; import 'package:hive/hive.dart'; +import 'package:cw_core/wallet_type.dart'; +import 'dart:async'; part 'wallet_info.g.dart'; @@ -30,7 +30,7 @@ class WalletInfo extends HiveObject { yatEid, yatLastUsedAddressRaw, showIntroCakePayCard); } - static const typeId = WALLET_INFO_TYPE_ID; + static const typeId = 4; static const boxName = 'WalletInfo'; @HiveField(0, defaultValue: '') diff --git a/cw_core/lib/wallet_type.dart b/cw_core/lib/wallet_type.dart index 62c2ad410..a65839041 100644 --- a/cw_core/lib/wallet_type.dart +++ b/cw_core/lib/wallet_type.dart @@ -1,5 +1,4 @@ import 'package:cw_core/crypto_currency.dart'; -import 'package:cw_core/hive_type_ids.dart'; import 'package:hive/hive.dart'; part 'wallet_type.g.dart'; @@ -11,8 +10,9 @@ const walletTypes = [ WalletType.haven, WalletType.ethereum, ]; +const walletTypeTypeId = 5; -@HiveType(typeId: WALLET_TYPE_TYPE_ID) +@HiveType(typeId: walletTypeTypeId) enum WalletType { @HiveField(0) monero, diff --git a/cw_ethereum/lib/ethereum_wallet.dart b/cw_ethereum/lib/ethereum_wallet.dart index 404b78ca2..d94e4ec95 100644 --- a/cw_ethereum/lib/ethereum_wallet.dart +++ b/cw_ethereum/lib/ethereum_wallet.dart @@ -4,7 +4,6 @@ import 'dart:io'; import 'dart:math'; import 'package:cw_core/crypto_currency.dart'; -import 'package:cw_core/cake_hive.dart'; import 'package:cw_core/node.dart'; import 'package:cw_core/pathForWallet.dart'; import 'package:cw_core/pending_transaction.dart'; @@ -59,8 +58,8 @@ abstract class EthereumWalletBase this.walletInfo = walletInfo; transactionHistory = EthereumTransactionHistory(walletInfo: walletInfo, password: password); - if (!CakeHive.isAdapterRegistered(Erc20Token.typeId)) { - CakeHive.registerAdapter(Erc20TokenAdapter()); + if (!Hive.isAdapterRegistered(Erc20Token.typeId)) { + Hive.registerAdapter(Erc20TokenAdapter()); } _sharedPrefs.complete(SharedPreferences.getInstance()); @@ -96,7 +95,7 @@ abstract class EthereumWalletBase Completer _sharedPrefs = Completer(); Future init() async { - erc20TokensBox = await CakeHive.openBox(Erc20Token.boxName); + erc20TokensBox = await Hive.openBox(Erc20Token.boxName); await walletAddresses.init(); await transactionHistory.init(); _privateKey = await getPrivateKey(_mnemonic, _password); diff --git a/lib/anonpay/anonpay_invoice_info.dart b/lib/anonpay/anonpay_invoice_info.dart index bd6776d00..89613224e 100644 --- a/lib/anonpay/anonpay_invoice_info.dart +++ b/lib/anonpay/anonpay_invoice_info.dart @@ -1,5 +1,4 @@ import 'package:cake_wallet/anonpay/anonpay_info_base.dart'; -import 'package:cw_core/hive_type_ids.dart'; import 'package:cw_core/keyable.dart'; import 'package:hive/hive.dart'; @@ -36,7 +35,7 @@ class AnonpayInvoiceInfo extends HiveObject with Keyable implements AnonpayInfoB @HiveField(13) final String provider; - static const typeId = ANONPAY_INVOICE_INFO_TYPE_ID; + static const typeId = 10; static const boxName = 'AnonpayInvoiceInfo'; AnonpayInvoiceInfo({ diff --git a/lib/buy/order.dart b/lib/buy/order.dart index 5a677d291..387fbcd34 100644 --- a/lib/buy/order.dart +++ b/lib/buy/order.dart @@ -1,8 +1,7 @@ import 'package:cake_wallet/buy/buy_provider_description.dart'; +import 'package:hive/hive.dart'; import 'package:cake_wallet/exchange/trade_state.dart'; import 'package:cw_core/format_amount.dart'; -import 'package:cw_core/hive_type_ids.dart'; -import 'package:hive/hive.dart'; part 'order.g.dart'; @@ -27,7 +26,7 @@ class Order extends HiveObject { } } - static const typeId = ORDER_TYPE_ID; + static const typeId = 8; static const boxName = 'Orders'; static const boxKey = 'ordersBoxKey'; @@ -67,4 +66,4 @@ class Order extends HiveObject { BuyProviderDescription.deserialize(raw: providerRaw); String amountFormatted() => formatAmount(amount); -} +} \ No newline at end of file diff --git a/lib/core/backup_service.dart b/lib/core/backup_service.dart index 6476891ed..2e27d83c9 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/entities/cake_2fa_preset_options.dart'; import 'package:cw_core/wallet_type.dart'; import 'package:flutter/foundation.dart'; import 'package:hive/hive.dart'; @@ -9,7 +10,6 @@ import 'package:path_provider/path_provider.dart'; import 'package:cryptography/cryptography.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:archive/archive_io.dart'; -import 'package:cw_core/cake_hive.dart'; import 'package:cake_wallet/core/key_service.dart'; import 'package:cake_wallet/entities/encrypt.dart'; import 'package:cake_wallet/entities/preferences_key.dart'; @@ -17,7 +17,6 @@ import 'package:cake_wallet/entities/secret_store_key.dart'; import 'package:cw_core/wallet_info.dart'; import 'package:cake_wallet/.secrets.g.dart' as secrets; import 'package:cake_wallet/wallet_types.g.dart'; - import 'package:cake_backup/backup.dart' as cake_backup; class BackupService { @@ -171,14 +170,14 @@ class BackupService { Future> _reloadHiveWalletInfoBox() async { final appDir = await getApplicationDocumentsDirectory(); - await CakeHive.close(); - CakeHive.init(appDir.path); + await Hive.close(); + Hive.init(appDir.path); - if (!CakeHive.isAdapterRegistered(WalletInfo.typeId)) { - CakeHive.registerAdapter(WalletInfoAdapter()); + if (!Hive.isAdapterRegistered(WalletInfo.typeId)) { + Hive.registerAdapter(WalletInfoAdapter()); } - return await CakeHive.openBox(WalletInfo.boxName); + return await Hive.openBox(WalletInfo.boxName); } Future _importPreferencesDump() async { diff --git a/lib/di.dart b/lib/di.dart index 2a54c85a3..b02742e64 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -36,8 +36,6 @@ import 'package:cake_wallet/src/screens/setup_2fa/modify_2fa_page.dart'; import 'package:cake_wallet/src/screens/setup_2fa/setup_2fa_qr_page.dart'; import 'package:cake_wallet/src/screens/setup_2fa/setup_2fa.dart'; import 'package:cake_wallet/src/screens/setup_2fa/setup_2fa_enter_code_page.dart'; -import 'package:cake_wallet/src/screens/support_chat/support_chat_page.dart'; -import 'package:cake_wallet/src/screens/support_other_links/support_other_links_page.dart'; import 'package:cake_wallet/src/screens/wallet/wallet_edit_page.dart'; import 'package:cake_wallet/themes/theme_list.dart'; import 'package:cake_wallet/utils/device_info.dart'; @@ -871,12 +869,6 @@ Future setup({ getIt.registerFactory(() => SupportPage(getIt.get())); - getIt.registerFactory(() => - SupportChatPage( - getIt.get(), secureStorage: getIt.get())); - - getIt.registerFactory(() => SupportOtherLinksPage(getIt.get())); - getIt.registerFactory(() { final wallet = getIt.get().wallet; diff --git a/lib/entities/contact.dart b/lib/entities/contact.dart index cd4fa55a2..e111429ca 100644 --- a/lib/entities/contact.dart +++ b/lib/entities/contact.dart @@ -1,7 +1,8 @@ -import 'package:cw_core/crypto_currency.dart'; -import 'package:cw_core/hive_type_ids.dart'; -import 'package:cw_core/keyable.dart'; +import 'package:flutter/foundation.dart'; import 'package:hive/hive.dart'; +import 'package:cw_core/crypto_currency.dart'; +import 'package:cake_wallet/utils/mobx.dart'; +import 'package:cw_core/keyable.dart'; part 'contact.g.dart'; @@ -13,7 +14,7 @@ class Contact extends HiveObject with Keyable { } } - static const typeId = CONTACT_TYPE_ID; + static const typeId = 0; static const boxName = 'Contacts'; @HiveField(0, defaultValue: '') diff --git a/lib/entities/get_encryption_key.dart b/lib/entities/get_encryption_key.dart index e67380bb8..5fc4983d7 100644 --- a/lib/entities/get_encryption_key.dart +++ b/lib/entities/get_encryption_key.dart @@ -1,18 +1,23 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart'; -import 'package:cw_core/cake_hive.dart'; +import 'package:hive/hive.dart'; Future> getEncryptionKey( {required String forKey, required FlutterSecureStorage secureStorage}) async { - final stringifiedKey = await secureStorage.read(key: 'transactionDescriptionsBoxKey'); + final stringifiedKey = + await secureStorage.read(key: 'transactionDescriptionsBoxKey'); List key; if (stringifiedKey == null) { - key = CakeHive.generateSecureKey(); + key = Hive.generateSecureKey(); final keyStringified = key.join(','); - await secureStorage.write(key: 'transactionDescriptionsBoxKey', value: keyStringified); + await secureStorage.write( + key: 'transactionDescriptionsBoxKey', value: keyStringified); } else { - key = stringifiedKey.split(',').map((i) => int.parse(i)).toList(); + key = stringifiedKey + .split(',') + .map((i) => int.parse(i)) + .toList(); } return key; -} +} \ No newline at end of file diff --git a/lib/entities/template.dart b/lib/entities/template.dart index 7cdd2c74a..6955136e0 100644 --- a/lib/entities/template.dart +++ b/lib/entities/template.dart @@ -1,4 +1,3 @@ -import 'package:cw_core/hive_type_ids.dart'; import 'package:hive/hive.dart'; part 'template.g.dart'; @@ -15,7 +14,7 @@ class Template extends HiveObject { required this.amountFiatRaw, this.additionalRecipientsRaw}); - static const typeId = TEMPLATE_TYPE_ID; + static const typeId = 6; static const boxName = 'Template'; @HiveField(0) diff --git a/lib/entities/transaction_description.dart b/lib/entities/transaction_description.dart index 088f9c480..86d6b043a 100644 --- a/lib/entities/transaction_description.dart +++ b/lib/entities/transaction_description.dart @@ -1,4 +1,3 @@ -import 'package:cw_core/hive_type_ids.dart'; import 'package:hive/hive.dart'; part 'transaction_description.g.dart'; @@ -7,7 +6,7 @@ part 'transaction_description.g.dart'; class TransactionDescription extends HiveObject { TransactionDescription({required this.id, this.recipientAddress, this.transactionNote}); - static const typeId = TRANSACTION_TYPE_ID; + static const typeId = 2; static const boxName = 'TransactionDescriptions'; static const boxKey = 'transactionDescriptionsBoxKey'; diff --git a/lib/exchange/exchange_template.dart b/lib/exchange/exchange_template.dart index 2182efd8c..dcfd8d8e8 100644 --- a/lib/exchange/exchange_template.dart +++ b/lib/exchange/exchange_template.dart @@ -1,4 +1,3 @@ -import 'package:cw_core/hive_type_ids.dart'; import 'package:hive/hive.dart'; part 'exchange_template.g.dart'; @@ -15,7 +14,7 @@ class ExchangeTemplate extends HiveObject { required this.depositCurrencyTitleRaw, required this.receiveCurrencyTitleRaw}); - static const typeId = EXCHANGE_TEMPLATE_TYPE_ID; + static const typeId = 7; static const boxName = 'ExchangeTemplate'; @HiveField(0) diff --git a/lib/exchange/trade.dart b/lib/exchange/trade.dart index db8c8fb3b..70dfa5713 100644 --- a/lib/exchange/trade.dart +++ b/lib/exchange/trade.dart @@ -1,9 +1,8 @@ +import 'package:hive/hive.dart'; import 'package:cw_core/crypto_currency.dart'; import 'package:cake_wallet/exchange/exchange_provider_description.dart'; import 'package:cake_wallet/exchange/trade_state.dart'; import 'package:cw_core/format_amount.dart'; -import 'package:cw_core/hive_type_ids.dart'; -import 'package:hive/hive.dart'; part 'trade.g.dart'; @@ -42,7 +41,7 @@ class Trade extends HiveObject { } } - static const typeId = TRADE_TYPE_ID; + static const typeId = 3; static const boxName = 'Trades'; static const boxKey = 'tradesBoxKey'; diff --git a/lib/main.dart b/lib/main.dart index 62a0bfc9c..e0cf58e62 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -7,7 +7,6 @@ import 'package:cake_wallet/locales/locale.dart'; import 'package:cake_wallet/store/yat/yat_store.dart'; import 'package:cake_wallet/utils/exception_handler.dart'; import 'package:cake_wallet/utils/responsive_layout_util.dart'; -import 'package:cw_core/hive_type_ids.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -39,7 +38,6 @@ import 'package:uni_links/uni_links.dart'; import 'package:cw_core/unspent_coins_info.dart'; import 'package:cake_wallet/monero/monero.dart'; import 'package:cake_wallet/wallet_type_utils.dart'; -import 'package:cw_core/cake_hive.dart'; final navigatorKey = GlobalKey(); final rootKey = GlobalKey(); @@ -59,7 +57,7 @@ Future main() async { return true; }; - await CakeHive.close(); + await Hive.close(); await initializeAppConfigs(); @@ -71,50 +69,50 @@ Future main() async { Future initializeAppConfigs() async { final appDir = await getApplicationDocumentsDirectory(); - CakeHive.init(appDir.path); + Hive.init(appDir.path); - if (!CakeHive.isAdapterRegistered(Contact.typeId)) { - CakeHive.registerAdapter(ContactAdapter()); + if (!Hive.isAdapterRegistered(Contact.typeId)) { + Hive.registerAdapter(ContactAdapter()); } - if (!CakeHive.isAdapterRegistered(Node.typeId)) { - CakeHive.registerAdapter(NodeAdapter()); + if (!Hive.isAdapterRegistered(Node.typeId)) { + Hive.registerAdapter(NodeAdapter()); } - if (!CakeHive.isAdapterRegistered(TransactionDescription.typeId)) { - CakeHive.registerAdapter(TransactionDescriptionAdapter()); + if (!Hive.isAdapterRegistered(TransactionDescription.typeId)) { + Hive.registerAdapter(TransactionDescriptionAdapter()); } - if (!CakeHive.isAdapterRegistered(Trade.typeId)) { - CakeHive.registerAdapter(TradeAdapter()); + if (!Hive.isAdapterRegistered(Trade.typeId)) { + Hive.registerAdapter(TradeAdapter()); } - if (!CakeHive.isAdapterRegistered(WalletInfo.typeId)) { - CakeHive.registerAdapter(WalletInfoAdapter()); + if (!Hive.isAdapterRegistered(WalletInfo.typeId)) { + Hive.registerAdapter(WalletInfoAdapter()); } - if (!CakeHive.isAdapterRegistered(WALLET_TYPE_TYPE_ID)) { - CakeHive.registerAdapter(WalletTypeAdapter()); + if (!Hive.isAdapterRegistered(walletTypeTypeId)) { + Hive.registerAdapter(WalletTypeAdapter()); } - if (!CakeHive.isAdapterRegistered(Template.typeId)) { - CakeHive.registerAdapter(TemplateAdapter()); + if (!Hive.isAdapterRegistered(Template.typeId)) { + Hive.registerAdapter(TemplateAdapter()); } - if (!CakeHive.isAdapterRegistered(ExchangeTemplate.typeId)) { - CakeHive.registerAdapter(ExchangeTemplateAdapter()); + if (!Hive.isAdapterRegistered(ExchangeTemplate.typeId)) { + Hive.registerAdapter(ExchangeTemplateAdapter()); } - if (!CakeHive.isAdapterRegistered(Order.typeId)) { - CakeHive.registerAdapter(OrderAdapter()); + if (!Hive.isAdapterRegistered(Order.typeId)) { + Hive.registerAdapter(OrderAdapter()); } - if (!isMoneroOnly && !CakeHive.isAdapterRegistered(UnspentCoinsInfo.typeId)) { - CakeHive.registerAdapter(UnspentCoinsInfoAdapter()); + if (!isMoneroOnly && !Hive.isAdapterRegistered(UnspentCoinsInfo.typeId)) { + Hive.registerAdapter(UnspentCoinsInfoAdapter()); } - if (!CakeHive.isAdapterRegistered(AnonpayInvoiceInfo.typeId)) { - CakeHive.registerAdapter(AnonpayInvoiceInfoAdapter()); + if (!Hive.isAdapterRegistered(AnonpayInvoiceInfo.typeId)) { + Hive.registerAdapter(AnonpayInvoiceInfoAdapter()); } final secureStorage = FlutterSecureStorage(); @@ -122,21 +120,21 @@ Future initializeAppConfigs() async { await getEncryptionKey(secureStorage: secureStorage, forKey: TransactionDescription.boxKey); final tradesBoxKey = await getEncryptionKey(secureStorage: secureStorage, forKey: Trade.boxKey); final ordersBoxKey = await getEncryptionKey(secureStorage: secureStorage, forKey: Order.boxKey); - final contacts = await CakeHive.openBox(Contact.boxName); - final nodes = await CakeHive.openBox(Node.boxName); - final transactionDescriptions = await CakeHive.openBox( + final contacts = await Hive.openBox(Contact.boxName); + final nodes = await Hive.openBox(Node.boxName); + final transactionDescriptions = await Hive.openBox( TransactionDescription.boxName, encryptionKey: transactionDescriptionsBoxKey); - final trades = await CakeHive.openBox(Trade.boxName, encryptionKey: tradesBoxKey); - final orders = await CakeHive.openBox(Order.boxName, encryptionKey: ordersBoxKey); - final walletInfoSource = await CakeHive.openBox(WalletInfo.boxName); - final templates = await CakeHive.openBox