diff --git a/lib/db/hive/db.dart b/lib/db/hive/db.dart index b25041532..d651a52b2 100644 --- a/lib/db/hive/db.dart +++ b/lib/db/hive/db.dart @@ -23,8 +23,12 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/logger.dart'; class DB { + // legacy (required for migrations) + @Deprecated("Left over for migration from old versions of Stack Wallet") static const String boxNameAddressBook = "addressBook"; - static const String boxNameDebugInfo = "debugInfoBox"; + + // in use + // TODO: migrate static const String boxNameNodeModels = "nodeModels"; static const String boxNamePrimaryNodes = "primaryNodes"; static const String boxNameAllWalletsData = "wallets"; @@ -37,13 +41,12 @@ class DB { static const String boxNameTradeNotes = "tradeNotesBox"; static const String boxNameTradeLookup = "tradeToTxidLookUpBox"; static const String boxNameFavoriteWallets = "favoriteWallets"; - static const String boxNamePrefs = "prefs"; static const String boxNameWalletsToDeleteOnStart = "walletsToDeleteOnStart"; static const String boxNamePriceCache = "priceAPIPrice24hCache"; + + // in use (keep for now) static const String boxNameDBInfo = "dbInfo"; - // static const String boxNameTheme = "theme"; - static const String boxNameDesktopData = "desktopData"; - static const String boxNameBuys = "buysBox"; + static const String boxNamePrefs = "prefs"; String boxNameTxCache({required Coin coin}) => "${coin.name}_txCache"; String boxNameSetCache({required Coin coin}) => @@ -51,7 +54,6 @@ class DB { String boxNameUsedSerialsCache({required Coin coin}) => "${coin.name}_usedSerialsCache"; - Box? _boxDebugInfo; Box? _boxNodeModels; Box? _boxPrimaryNodes; Box? _boxAllWalletsData; @@ -66,7 +68,7 @@ class DB { Box? _boxPrefs; Box? _boxTradeLookup; Box? _boxDBInfo; - Box? _boxDesktopData; + // Box? _boxDesktopData; final Map> _walletBoxes = {}; @@ -109,8 +111,6 @@ class DB { _boxPrefs = await Hive.openBox(boxNamePrefs); } - _boxDebugInfo = await Hive.openBox(boxNameDebugInfo); - if (Hive.isBoxOpen(boxNameNodeModels)) { _boxNodeModels = Hive.box(boxNameNodeModels); } else { @@ -129,12 +129,6 @@ class DB { _boxAllWalletsData = await Hive.openBox(boxNameAllWalletsData); } - if (Hive.isBoxOpen(boxNameDesktopData)) { - _boxDesktopData = Hive.box(boxNameDesktopData); - } else { - _boxDesktopData = await Hive.openBox(boxNameDesktopData); - } - _boxNotifications = await Hive.openBox(boxNameNotifications); _boxWatchedTransactions = @@ -258,7 +252,7 @@ class DB { Future deleteEverything() async { try { await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameAddressBook); - await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameDebugInfo); + await DB.instance.deleteBoxFromDisk(boxName: "debugInfoBox"); await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameNodeModels); await DB.instance.deleteBoxFromDisk(boxName: DB.boxNamePrimaryNodes); await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameAllWalletsData);