From 592aeef5b186edcfc6d8eb4d956903296cdb413e Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 24 Oct 2022 17:38:30 -0600 Subject: [PATCH] fix bug where wallets dissapear --- lib/hive/db.dart | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/hive/db.dart b/lib/hive/db.dart index 531771f09..e1232696b 100644 --- a/lib/hive/db.dart +++ b/lib/hive/db.dart @@ -144,12 +144,16 @@ class DB { ]); _initialized = true; - if (get(boxName: boxNamePrefs, key: "familiarity") == null) { - await put(boxName: boxNamePrefs, key: "familiarity", value: 0); + try { + if (_boxPrefs.get("familiarity") == null) { + await _boxPrefs.put("familiarity", 0); + } + int count = _boxPrefs.get("familiarity") as int; + await _boxPrefs.put("familiarity", count + 1); + Constants.exchangeForExperiencedUsers(count + 1); + } catch (e, s) { + print("$e $s"); } - int count = get(boxName: boxNamePrefs, key: "familiarity") as int; - await put(boxName: boxNamePrefs, key: "familiarity", value: count + 1); - Constants.exchangeForExperiencedUsers(count + 1); } }