isar init fix and renaming of init functions

This commit is contained in:
julian 2023-01-20 15:57:54 -06:00
parent 3b9cb60aaa
commit 017719971b
23 changed files with 52 additions and 57 deletions

View file

@ -12,7 +12,7 @@ class MainDB {
Isar get isar => _isar!;
Future<bool> isarInit({Isar? mock}) async {
Future<bool> initMainDB({Isar? mock}) async {
if (mock != null) {
_isar = mock;
return true;
@ -28,7 +28,7 @@ class MainDB {
AddressSchema,
],
directory: (await StackFileSystem.applicationIsarDirectory()).path,
inspector: true,
inspector: false,
name: "wallet_data",
);
return true;

View file

@ -265,7 +265,7 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
await loadShared();
}
await MainDB.instance.isarInit();
await MainDB.instance.initMainDB();
_notificationsService = ref.read(notificationsProvider);
_nodeService = ref.read(nodeServiceChangeNotifierProvider);

View file

@ -1257,7 +1257,7 @@ class BitcoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
_cachedElectrumXClient = cachedClient;
_secureStore = secureStore;
initCache(walletId, coin);
isarInit(mockableOverride: mockableOverride);
initWalletDB(mockableOverride: mockableOverride);
}
@override

View file

@ -1214,7 +1214,7 @@ class BitcoinCashWallet extends CoinServiceAPI with WalletCache, WalletDB {
_cachedElectrumXClient = cachedClient;
_secureStore = secureStore;
initCache(walletId, coin);
isarInit(mockableOverride: mockableOverride);
initWalletDB(mockableOverride: mockableOverride);
}
@override

View file

@ -1092,7 +1092,7 @@ class DogecoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
_cachedElectrumXClient = cachedClient;
_secureStore = secureStore;
initCache(walletId, coin);
isarInit(mockableOverride: mockableOverride);
initWalletDB(mockableOverride: mockableOverride);
}
@override

View file

@ -542,7 +542,7 @@ class EpicCashWallet extends CoinServiceAPI
_secureStore = secureStore;
initCache(walletId, coin);
initEpicCashHive(walletId);
isarInit(mockableOverride: mockableOverride);
initWalletDB(mockableOverride: mockableOverride);
Logging.instance.log("$walletName isolate length: ${isolates.length}",
level: LogLevel.Info);

View file

@ -1225,7 +1225,7 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
_secureStore = secureStore;
initCache(walletId, coin);
initFiroHive(walletId);
isarInit(mockableOverride: mockableOverride);
initWalletDB(mockableOverride: mockableOverride);
Logging.instance.log("$walletName isolates length: ${isolates.length}",
level: LogLevel.Info);

View file

@ -1275,7 +1275,7 @@ class LitecoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
_cachedElectrumXClient = cachedClient;
_secureStore = secureStore;
initCache(walletId, coin);
isarInit(mockableOverride: mockableOverride);
initWalletDB(mockableOverride: mockableOverride);
}
@override

View file

@ -92,7 +92,7 @@ class MoneroWallet extends CoinServiceAPI with WalletCache, WalletDB {
_secureStorage = secureStorage;
_prefs = prefs ?? Prefs.instance;
initCache(walletId, coin);
isarInit(mockableOverride: mockableOverride);
initWalletDB(mockableOverride: mockableOverride);
}
@override

View file

@ -1264,7 +1264,7 @@ class NamecoinWallet extends CoinServiceAPI with WalletCache, WalletDB {
_cachedElectrumXClient = cachedClient;
_secureStore = secureStore;
initCache(walletId, coin);
isarInit(mockableOverride: mockableOverride);
initWalletDB(mockableOverride: mockableOverride);
}
@override

View file

@ -1195,7 +1195,7 @@ class ParticlWallet extends CoinServiceAPI with WalletCache, WalletDB {
_cachedElectrumXClient = cachedClient;
_secureStore = secureStore;
initCache(walletId, coin);
isarInit(mockableOverride: mockableOverride);
initWalletDB(mockableOverride: mockableOverride);
}
@override

View file

@ -94,7 +94,7 @@ class WowneroWallet extends CoinServiceAPI with WalletCache, WalletDB {
_secureStorage = secureStorage;
_prefs = prefs ?? Prefs.instance;
initCache(walletId, coin);
isarInit(mockableOverride: mockableOverride);
initWalletDB(mockableOverride: mockableOverride);
}
@override

View file

@ -4,7 +4,7 @@ mixin WalletDB {
MainDB? _db;
MainDB get db => _db!;
void isarInit({MainDB? mockableOverride}) async {
void initWalletDB({MainDB? mockableOverride}) async {
_db = mockableOverride ?? MainDB.instance;
}
}

View file

@ -1,6 +1,7 @@
import 'dart:convert';
import 'package:hive/hive.dart';
import 'package:stackwallet/db/main_db.dart';
import 'package:stackwallet/electrumx_rpc/electrumx.dart';
import 'package:stackwallet/hive/db.dart';
import 'package:stackwallet/models/exchange/change_now/exchange_transaction.dart';
@ -403,7 +404,8 @@ class DbVersionMigrator with WalletDB {
_parseTransactions(txnsLelantus, walletId, true, newAddresses));
// store newly parsed data in isar
isarInit();
await MainDB.instance.initMainDB();
initWalletDB();
await db.isar.writeTxn(() async {
await db.isar.addresses.putAll(newAddresses);
});

View file

@ -42,7 +42,7 @@ packages:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.11"
version: "3.3.0"
args:
dependency: transitive
description:
@ -63,7 +63,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.2"
version: "2.9.0"
barcode_scan2:
dependency: "direct main"
description:
@ -199,14 +199,7 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
version: "1.2.1"
checked_yaml:
dependency: transitive
description:
@ -227,7 +220,7 @@ packages:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
code_builder:
dependency: transitive
description:
@ -297,7 +290,7 @@ packages:
name: coverage
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.5.0"
cross_file:
dependency: transitive
description:
@ -472,7 +465,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
ffi:
dependency: "direct main"
description:
@ -901,21 +894,21 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0"
mime:
dependency: transitive
description:
@ -1027,7 +1020,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
path_drawing:
dependency: transitive
description:
@ -1403,7 +1396,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
version: "1.9.0"
stack_trace:
dependency: transitive
description:
@ -1447,7 +1440,7 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
string_validator:
dependency: "direct main"
description:
@ -1461,35 +1454,35 @@ packages:
name: sync_http
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
version: "0.3.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
test:
dependency: transitive
description:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "1.21.1"
version: "1.21.4"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.9"
version: "0.4.12"
test_core:
dependency: transitive
description:
name: test_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.13"
version: "0.4.16"
time:
dependency: transitive
description:
@ -1538,7 +1531,7 @@ packages:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.3.1"
universal_io:
dependency: transitive
description:
@ -1622,7 +1615,7 @@ packages:
name: vm_service
url: "https://pub.dartlang.org"
source: hosted
version: "8.2.2"
version: "9.0.0"
wakelock:
dependency: "direct main"
description:

View file

@ -1557,9 +1557,9 @@ class MockBitcoinWallet extends _i1.Mock implements _i21.BitcoinWallet {
returnValueForMissingStub: _i17.Future<void>.value(),
) as _i17.Future<void>);
@override
void isarInit({_i13.MainDB? mockableOverride}) => super.noSuchMethod(
void initWalletDB({_i13.MainDB? mockableOverride}) => super.noSuchMethod(
Invocation.method(
#isarInit,
#initWalletDB,
[],
{#mockableOverride: mockableOverride},
),

View file

@ -977,9 +977,9 @@ class MockFiroWallet extends _i1.Mock implements _i9.FiroWallet {
returnValueForMissingStub: _i10.Future<void>.value(),
) as _i10.Future<void>);
@override
void isarInit({_i7.MainDB? mockableOverride}) => super.noSuchMethod(
void initWalletDB({_i7.MainDB? mockableOverride}) => super.noSuchMethod(
Invocation.method(
#isarInit,
#initWalletDB,
[],
{#mockableOverride: mockableOverride},
),

View file

@ -1347,9 +1347,9 @@ class MockBitcoinWallet extends _i1.Mock implements _i20.BitcoinWallet {
returnValueForMissingStub: _i17.Future<void>.value(),
) as _i17.Future<void>);
@override
void isarInit({_i12.MainDB? mockableOverride}) => super.noSuchMethod(
void initWalletDB({_i12.MainDB? mockableOverride}) => super.noSuchMethod(
Invocation.method(
#isarInit,
#initWalletDB,
[],
{#mockableOverride: mockableOverride},
),

View file

@ -1332,9 +1332,9 @@ class MockBitcoinWallet extends _i1.Mock implements _i19.BitcoinWallet {
returnValueForMissingStub: _i16.Future<void>.value(),
) as _i16.Future<void>);
@override
void isarInit({_i12.MainDB? mockableOverride}) => super.noSuchMethod(
void initWalletDB({_i12.MainDB? mockableOverride}) => super.noSuchMethod(
Invocation.method(
#isarInit,
#initWalletDB,
[],
{#mockableOverride: mockableOverride},
),

View file

@ -1891,9 +1891,9 @@ class MockFiroWallet extends _i1.Mock implements _i22.FiroWallet {
returnValueForMissingStub: _i18.Future<void>.value(),
) as _i18.Future<void>);
@override
void isarInit({_i13.MainDB? mockableOverride}) => super.noSuchMethod(
void initWalletDB({_i13.MainDB? mockableOverride}) => super.noSuchMethod(
Invocation.method(
#isarInit,
#initWalletDB,
[],
{#mockableOverride: mockableOverride},
),

View file

@ -1095,9 +1095,9 @@ class MockBitcoinWallet extends _i1.Mock implements _i18.BitcoinWallet {
returnValueForMissingStub: _i15.Future<void>.value(),
) as _i15.Future<void>);
@override
void isarInit({_i12.MainDB? mockableOverride}) => super.noSuchMethod(
void initWalletDB({_i12.MainDB? mockableOverride}) => super.noSuchMethod(
Invocation.method(
#isarInit,
#initWalletDB,
[],
{#mockableOverride: mockableOverride},
),

View file

@ -1346,9 +1346,9 @@ class MockBitcoinWallet extends _i1.Mock implements _i20.BitcoinWallet {
returnValueForMissingStub: _i17.Future<void>.value(),
) as _i17.Future<void>);
@override
void isarInit({_i12.MainDB? mockableOverride}) => super.noSuchMethod(
void initWalletDB({_i12.MainDB? mockableOverride}) => super.noSuchMethod(
Invocation.method(
#isarInit,
#initWalletDB,
[],
{#mockableOverride: mockableOverride},
),

View file

@ -1346,9 +1346,9 @@ class MockBitcoinWallet extends _i1.Mock implements _i20.BitcoinWallet {
returnValueForMissingStub: _i17.Future<void>.value(),
) as _i17.Future<void>);
@override
void isarInit({_i12.MainDB? mockableOverride}) => super.noSuchMethod(
void initWalletDB({_i12.MainDB? mockableOverride}) => super.noSuchMethod(
Invocation.method(
#isarInit,
#initWalletDB,
[],
{#mockableOverride: mockableOverride},
),