stack_wallet/lib/utilities/delete_everything.dart
julian 3e1e68237a Merge remote-tracking branch 'origin/staging' into add-ethereum
# Conflicts:
#	lib/models/isar/models/blockchain_data/address.dart
#	lib/pages/add_wallet_views/create_or_restore_wallet_view/create_or_restore_wallet_view.dart
#	lib/pages/settings_views/global_settings_view/appearance_settings_view.dart
#	lib/pages_desktop_specific/settings/settings_menu/appearance_settings.dart
#	lib/utilities/db_version_migration.dart
#	test/pages/send_view/send_view_test.mocks.dart
#	test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.mocks.dart
#	test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.mocks.dart
#	test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.mocks.dart
#	test/screen_tests/exchange/exchange_view_test.mocks.dart
#	test/screen_tests/lockscreen_view_screen_test.mocks.dart
#	test/screen_tests/main_view_tests/main_view_screen_testA_test.mocks.dart
#	test/screen_tests/main_view_tests/main_view_screen_testB_test.mocks.dart
#	test/screen_tests/main_view_tests/main_view_screen_testC_test.mocks.dart
#	test/screen_tests/onboarding/backup_key_view_screen_test.mocks.dart
#	test/screen_tests/onboarding/backup_key_warning_view_screen_test.mocks.dart
#	test/screen_tests/onboarding/create_pin_view_screen_test.mocks.dart
#	test/screen_tests/onboarding/restore_wallet_view_screen_test.mocks.dart
#	test/screen_tests/onboarding/verify_backup_key_view_screen_test.mocks.dart
#	test/screen_tests/settings_view/settings_subviews/currency_view_screen_test.mocks.dart
#	test/screen_tests/settings_view/settings_subviews/network_settings_subviews/add_custom_node_view_screen_test.mocks.dart
#	test/screen_tests/settings_view/settings_subviews/network_settings_subviews/node_details_view_screen_test.mocks.dart
#	test/screen_tests/settings_view/settings_subviews/wallet_backup_view_screen_test.mocks.dart
#	test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rescan_warning_view_screen_test.mocks.dart
#	test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/wallet_delete_mnemonic_view_screen_test.mocks.dart
#	test/screen_tests/settings_view/settings_subviews/wallet_settings_view_screen_test.mocks.dart
#	test/screen_tests/settings_view/settings_view_screen_test.mocks.dart
#	test/screen_tests/transaction_subviews/transaction_search_results_view_screen_test.mocks.dart
#	test/screen_tests/wallet_view/confirm_send_view_screen_test.mocks.dart
#	test/screen_tests/wallet_view/receive_view_screen_test.mocks.dart
#	test/screen_tests/wallet_view/send_view_screen_test.mocks.dart
#	test/screen_tests/wallet_view/wallet_view_screen_test.mocks.dart
#	test/widget_tests/managed_favorite_test.mocks.dart
#	test/widget_tests/table_view/table_view_row_test.mocks.dart
#	test/widget_tests/transaction_card_test.mocks.dart
#	test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.mocks.dart
#	test/widget_tests/wallet_info_row/wallet_info_row_test.mocks.dart
2023-03-23 18:13:24 -06:00

30 lines
1.5 KiB
Dart

import 'package:stackwallet/db/hive/db.dart';
import 'package:stackwallet/utilities/logger.dart';
Future<bool> deleteEverything() async {
try {
await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameAddressBook);
await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameDebugInfo);
await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameNodeModels);
await DB.instance.deleteBoxFromDisk(boxName: DB.boxNamePrimaryNodes);
await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameAllWalletsData);
await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameNotifications);
await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameWatchedTransactions);
await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameWatchedTrades);
await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameTrades);
await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameTradesV2);
await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameTradeNotes);
await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameTradeLookup);
await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameFavoriteWallets);
await DB.instance.deleteBoxFromDisk(boxName: DB.boxNamePrefs);
await DB.instance
.deleteBoxFromDisk(boxName: DB.boxNameWalletsToDeleteOnStart);
await DB.instance.deleteBoxFromDisk(boxName: DB.boxNamePriceCache);
await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameDBInfo);
await DB.instance.deleteBoxFromDisk(boxName: "theme");
return true;
} catch (e, s) {
Logging.instance.log("$e $s", level: LogLevel.Error);
return false;
}
}