diff --git a/.dockerignore b/.dockerignore index cf39dfa..479d0c2 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,4 +3,3 @@ build/** misc/build-dir misc/.flatpak-builder misc/root -**/.git/** diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 2ccaa3c..e08984e 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -47,6 +47,9 @@ + diff --git a/install-deps.sh b/install-deps.sh index cee9f2e..96c4e4f 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -13,7 +13,6 @@ if [ "$DL_DIR" == "" ]; then DL_DIR="/tmp" fi - sudo pacman -Sy --noconfirm unzip jdk8-openjdk wget wget -qP $DL_DIR -N https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip diff --git a/lib/accounts.dart b/lib/accounts.dart index 4af5392..94084ee 100644 --- a/lib/accounts.dart +++ b/lib/accounts.dart @@ -322,11 +322,11 @@ abstract class _ActiveAccount with Store { } String newAddress() { - return WarpApi.newDiversifiedAddress(); + return WarpApi.newDiversifiedAddress(settings.uaType); } - String getAddress(bool t, bool s, bool o) { - return WarpApi.getAddress(coin, id, (t ? 1 : 0) | (s ? 2 : 0) | (o ? 4 : 0)); + String getAddress(int uaType) { + return WarpApi.getAddress(coin, id, uaType); } @computed diff --git a/lib/coin/coin.dart b/lib/coin/coin.dart index 749585c..f40e36b 100644 --- a/lib/coin/coin.dart +++ b/lib/coin/coin.dart @@ -41,10 +41,17 @@ abstract class CoinBase { dbFullPath = _getFullPath(dbDir); } - Future open() async { + Future open(bool wal) async { print("Opening DB ${dbFullPath}"); // schema handled in backend - db = await openDatabase(dbFullPath/*, onCreate: createSchema, version: 1*/); + db = await openDatabase(dbFullPath, onConfigure: (db) async { + if (wal) + await db.rawQuery("PRAGMA journal_mode=WAL"); + }); + } + + Future close() async { + await db.close(); } Future tryImport(PlatformFile file) async { @@ -69,8 +76,9 @@ abstract class CoinBase { Future export(BuildContext context, String dbPath) async { final path = _getFullPath(dbPath); - WarpApi.disableWAL(path); - db = await openDatabase(path); + db = await openDatabase(path, onConfigure: (db) async { + await db.rawQuery("PRAGMA journal_mode=off"); + }); await db.close(); await exportFile(context, path, dbName); } diff --git a/lib/main.dart b/lib/main.dart index eb66721..e638fc3 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -348,7 +348,8 @@ class ZWalletAppState extends State { final dbPath = await getDbPath(); for (var coin in coins) { coin.init(dbPath); - WarpApi.createDb(coin.dbFullPath); + await coin.open(false); + await coin.close(); } if (exportDb) { @@ -367,7 +368,6 @@ class ZWalletAppState extends State { _setProgress(0.1 * (coin.coin+1), 'Initializing ${coin.ticker}'); WarpApi.migrateWallet(coin.coin, coin.dbFullPath); WarpApi.initWallet(coin.coin, coin.dbFullPath); - await coin.open(); } for (var s in settings.servers) { @@ -377,6 +377,11 @@ class ZWalletAppState extends State { WarpApi.migrateData(s.coin); } } + + for (var coin in coins) { + await coin.open(true); + } + _setProgress(0.6, 'Loading Account Data'); await accounts.refresh(); _setProgress(0.7, 'Restoring Active Account'); diff --git a/lib/payment_uri.dart b/lib/payment_uri.dart index ce281f5..8a418b4 100644 --- a/lib/payment_uri.dart +++ b/lib/payment_uri.dart @@ -107,7 +107,6 @@ class PaymentURIState extends State { final amount = amountKey.currentState!.amount; final memo = _memoController.text; - final String _qrText; if (amount > 0) { return WarpApi.makePaymentURI(address, amount, memo); } @@ -123,7 +122,7 @@ class PaymentURIState extends State { if (types == null) { return; } setState(() { if (types.isEmpty) { - address = active.getAddress(true, true, true); + address = active.getAddress(7); } else address = _decodeCheckboxes(types); @@ -132,13 +131,11 @@ class PaymentURIState extends State { } String _decodeCheckboxes(List types) { - var t = false; - var s = false; - var o = false; - if (types.contains("T")) t = true; - if (types.contains("S")) s = true; - if (types.contains("O")) o = true; - return active.getAddress(t, s, o); + var uaType = 0; + if (types.contains("T")) uaType |= 1; + if (types.contains("S")) uaType |= 2; + if (types.contains("O")) uaType |= 4; + return active.getAddress(uaType); } void _reset() { diff --git a/native/zcash-sync b/native/zcash-sync index 37d81e5..9ae96e7 160000 --- a/native/zcash-sync +++ b/native/zcash-sync @@ -1 +1 @@ -Subproject commit 37d81e586a35cfdca75e79464cd6fa3aa961431b +Subproject commit 9ae96e7d88bc3bd60c21558062a29c571e27eb09 diff --git a/packages/warp_api_ffi/lib/warp_api.dart b/packages/warp_api_ffi/lib/warp_api.dart index e5816ef..b89afb6 100644 --- a/packages/warp_api_ffi/lib/warp_api.dart +++ b/packages/warp_api_ffi/lib/warp_api.dart @@ -64,10 +64,6 @@ class WarpApi { throw UnsupportedError('This platform is not supported.'); } - static void createDb(String dbPath) { - unwrapResultU8(warp_api_lib.create_db(toNative(dbPath))); - } - static void migrateWallet(int coin, String dbPath) { unwrapResultU8(warp_api_lib.migrate_db(coin, toNative(dbPath))); } @@ -168,8 +164,8 @@ class WarpApi { 0; } - static String newDiversifiedAddress() { - final address = warp_api_lib.new_diversified_address(); + static String newDiversifiedAddress(int uaType) { + final address = warp_api_lib.new_diversified_address(uaType); return unwrapResultString(address); } @@ -395,10 +391,6 @@ class WarpApi { return kp; } - static void disableWAL(String dbPath) { - warp_api_lib.disable_wal(dbPath.toNativeUtf8().cast()); - } - static bool hasCuda() { return warp_api_lib.has_cuda() != 0; } diff --git a/packages/warp_api_ffi/lib/warp_api_generated.dart b/packages/warp_api_ffi/lib/warp_api_generated.dart index 74520ee..715f07c 100644 --- a/packages/warp_api_ffi/lib/warp_api_generated.dart +++ b/packages/warp_api_ffi/lib/warp_api_generated.dart @@ -68,19 +68,6 @@ class NativeLibrary { late final _dart_init_wallet _init_wallet = _init_wallet_ptr.asFunction<_dart_init_wallet>(); - CResult_u8 create_db( - ffi.Pointer db_path, - ) { - return _create_db( - db_path, - ); - } - - late final _create_db_ptr = - _lookup>('create_db'); - late final _dart_create_db _create_db = - _create_db_ptr.asFunction<_dart_create_db>(); - CResult_u8 migrate_db( int coin, ffi.Pointer db_path, @@ -381,8 +368,12 @@ class NativeLibrary { late final _dart_valid_address _valid_address = _valid_address_ptr.asFunction<_dart_valid_address>(); - CResult_____c_char new_diversified_address() { - return _new_diversified_address(); + CResult_____c_char new_diversified_address( + int ua_type, + ) { + return _new_diversified_address( + ua_type, + ); } late final _new_diversified_address_ptr = @@ -901,19 +892,6 @@ class NativeLibrary { late final _dart_derive_zip32 _derive_zip32 = _derive_zip32_ptr.asFunction<_dart_derive_zip32>(); - void disable_wal( - ffi.Pointer db_path, - ) { - return _disable_wal( - db_path, - ); - } - - late final _disable_wal_ptr = - _lookup>('disable_wal'); - late final _dart_disable_wal _disable_wal = - _disable_wal_ptr.asFunction<_dart_disable_wal>(); - int has_cuda() { return _has_cuda(); } @@ -1014,14 +992,6 @@ typedef _dart_init_wallet = CResult_u8 Function( ffi.Pointer db_path, ); -typedef _c_create_db = CResult_u8 Function( - ffi.Pointer db_path, -); - -typedef _dart_create_db = CResult_u8 Function( - ffi.Pointer db_path, -); - typedef _c_migrate_db = CResult_u8 Function( ffi.Uint8 coin, ffi.Pointer db_path, @@ -1220,9 +1190,13 @@ typedef _dart_valid_address = int Function( ffi.Pointer address, ); -typedef _c_new_diversified_address = CResult_____c_char Function(); +typedef _c_new_diversified_address = CResult_____c_char Function( + ffi.Uint8 ua_type, +); -typedef _dart_new_diversified_address = CResult_____c_char Function(); +typedef _dart_new_diversified_address = CResult_____c_char Function( + int ua_type, +); typedef _c_get_latest_height = CResult_u32 Function(); @@ -1558,14 +1532,6 @@ typedef _dart_derive_zip32 = CResult_____c_char Function( int address, ); -typedef _c_disable_wal = ffi.Void Function( - ffi.Pointer db_path, -); - -typedef _dart_disable_wal = void Function( - ffi.Pointer db_path, -); - typedef _c_has_cuda = ffi.Int8 Function(); typedef _dart_has_cuda = int Function(); diff --git a/pubspec.yaml b/pubspec.yaml index 7c71a37..4d23b75 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.2.17+329 +version: 1.2.17+330 environment: sdk: ">=2.12.0 <3.0.0"