feat: persist whether a wallet still needs its recovery phrase backed up

This commit is contained in:
Blazebrain
2026-08-28 23:07:43 +01:00
parent 9a66b511e3
commit e95d9d143e
6 changed files with 75 additions and 6 deletions
+11 -2
View File
@@ -63,7 +63,7 @@ Future<void> _initDb({String? pathOverride}) async {
}
}
await db?.close();
db = await openDatabase(dbFile.path, version: 10,
db = await openDatabase(dbFile.path, version: 11,
onUpgrade: (Database db, int oldVersion, int newVersion) async {
printV("migrating: $oldVersion, $newVersion");
if (oldVersion <= 1) {
@@ -152,6 +152,14 @@ CREATE TABLE IF NOT EXISTS BalanceCardStyleSettings (
await _createSplTokenTable(db);
await _createTronTokenTable(db);
}
if (oldVersion <= 10) {
await _addColumnIfNotExists(
db,
table: 'WalletInfo',
column: 'showSeedBackupReminder',
definition: 'BOOLEAN DEFAULT FALSE',
);
}
}, onCreate: (Database db, int version) async {
await db.execute('''
CREATE TABLE WalletInfo (
@@ -178,7 +186,8 @@ CREATE TABLE WalletInfo (
sortOrder INTEGER DEFAULT (0) NOT NULL,
receiveInfoboxDismissed BOOLEAN DEFAULT FALSE,
showCombinedBalance BOOLEAN DEFAULT TRUE,
favoriteTokenAddress TEXT DEFAULT NULL
favoriteTokenAddress TEXT DEFAULT NULL,
showSeedBackupReminder BOOLEAN DEFAULT FALSE
);
''');
+18 -3
View File
@@ -349,7 +349,8 @@ class WalletInfo {
this.addressPageType,
this.receiveInfoboxDismissed,
this.showCombinedBalance,
this.favoriteTokenAddress)
this.favoriteTokenAddress,
this.showSeedBackupReminder)
: _yatLastUsedAddressController = StreamController<String>.broadcast();
factory WalletInfo.external(
@@ -397,7 +398,8 @@ class WalletInfo {
null,
receiveInfoboxDismissed ?? false,
showCombinedBalance ?? true,
favoriteTokenAddress);
favoriteTokenAddress,
false);
}
static String get tableName => 'walletInfo';
@@ -418,6 +420,7 @@ class WalletInfo {
bool receiveInfoboxDismissed;
bool showCombinedBalance;
String? favoriteTokenAddress;
bool showSeedBackupReminder;
Future<Map<String, String>> getAddresses() async {
final list = await WalletInfoAddressMap.selectList(internalId);
@@ -587,6 +590,7 @@ class WalletInfo {
"receiveInfoboxDismissed": receiveInfoboxDismissed ? 1 : 0,
"showCombinedBalance": showCombinedBalance ? 1 : 0,
"favoriteTokenAddress": favoriteTokenAddress,
"showSeedBackupReminder": showSeedBackupReminder ? 1 : 0,
"network": network,
};
@@ -616,7 +620,8 @@ class WalletInfo {
json['addressPageType'] as String? ?? null,
json['receiveInfoboxDismissed'] != 0,
json["showCombinedBalance"] != 0,
json["favoriteTokenAddress"] as String? ?? null);
json["favoriteTokenAddress"] as String? ?? null,
json['showSeedBackupReminder'] == 1);
info.network = json['network'] as String?;
return info;
}
@@ -664,4 +669,14 @@ class WalletInfo {
restoreHeight = height;
await save();
}
Future<void> updateShowSeedBackupReminder(bool show) async {
showSeedBackupReminder = show;
try {
await save();
} catch (e) {
printV("Failed to save the seed backup reminder flag: $e");
}
}
}
+2 -1
View File
@@ -274,7 +274,8 @@ class WalletInfo extends HiveObject {
addressPageType,
false,
true,
null)
null,
false)
..network = network;
final wiId = await walletInfo.save();
for (final address in usedAddresses ?? <String>[]) {