diff --git a/README.md b/README.md index 79b6cfaf55..fba7152fdf 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +# The Stack Duo code has now been merged with the Stack Wallet code! This was due to a refactor where we sought to merge the codebases so getting releases out would be faster and less work. This repository is kept around for "releases" as Obtanium users and the like would get confused if we updated Duo on the same repo as Stack Wallet. Please see the [Stack Wallet repository](https://github.com/cypherstack/stack_wallet) for the latest, most up-to-date code. + [![codecov](https://codecov.io/gh/cypherstack/stack_wallet/branch/main/graph/badge.svg?token=PM1N56UTEW)](https://codecov.io/gh/cypherstack/stack_wallet) # Stack Duo @@ -22,4 +24,4 @@ Highlights include: ## Building -You can look at the [build instructions](docs/build.md) for more information on how to build the app. \ No newline at end of file +You can look at the [build instructions](docs/build.md) for more information on how to build the app. diff --git a/android/build.gradle b/android/build.gradle index b309554fd4..cd89d3a8b0 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -2,11 +2,11 @@ buildscript { ext.kotlin_version = '1.7.20' repositories { google() - jcenter() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.2' + classpath 'com.android.tools.build:gradle:7.3.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -14,7 +14,7 @@ buildscript { allprojects { repositories { google() - jcenter() + mavenCentral() } } @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 562c5e4442..6b665338b3 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip diff --git a/assets/default_themes/dark.zip b/assets/default_themes/dark.zip index 1d8899567f..9823262a9d 100644 Binary files a/assets/default_themes/dark.zip and b/assets/default_themes/dark.zip differ diff --git a/assets/default_themes/light.zip b/assets/default_themes/light.zip index 093a1b2eb2..649716126f 100644 Binary files a/assets/default_themes/light.zip and b/assets/default_themes/light.zip differ diff --git a/crypto_plugins/flutter_libmonero b/crypto_plugins/flutter_libmonero index fbc366564f..a470c4a974 160000 --- a/crypto_plugins/flutter_libmonero +++ b/crypto_plugins/flutter_libmonero @@ -1 +1 @@ -Subproject commit fbc366564fd5180ed6154cc447821e3b83e93dbf +Subproject commit a470c4a974f888eff04ed9d81d87365106675b01 diff --git a/lib/hive/db.dart b/lib/db/hive/db.dart similarity index 71% rename from lib/hive/db.dart rename to lib/db/hive/db.dart index bec6bb8bb7..0e6c57107a 100644 --- a/lib/hive/db.dart +++ b/lib/db/hive/db.dart @@ -3,7 +3,6 @@ import 'dart:isolate'; import 'package:cw_core/wallet_info.dart' as xmr; import 'package:hive/hive.dart'; import 'package:mutex/mutex.dart'; -import 'package:stackduo/models/exchange/change_now/exchange_transaction.dart'; import 'package:stackduo/models/exchange/response_objects/trade.dart'; import 'package:stackduo/models/node_model.dart'; import 'package:stackduo/models/notification_model.dart'; @@ -13,8 +12,13 @@ import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/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"; + static const String boxNameTrades = "exchangeTransactionsBox"; + + // in use + // TODO: migrate static const String boxNameNodeModels = "nodeModels"; static const String boxNamePrimaryNodes = "primaryNodes"; static const String boxNameAllWalletsData = "wallets"; @@ -22,33 +26,31 @@ class DB { static const String boxNameWatchedTransactions = "watchedTxNotificationModels"; static const String boxNameWatchedTrades = "watchedTradesNotificationModels"; - static const String boxNameTrades = "exchangeTransactionsBox"; static const String boxNameTradesV2 = "exchangeTradesBox"; 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 boxNameTxCache({required Coin coin}) => "${coin.name}_txCache"; - String boxNameSetCache({required Coin coin}) => + // firo only + String _boxNameSetCache({required Coin coin}) => "${coin.name}_anonymitySetCache"; - String boxNameUsedSerialsCache({required Coin coin}) => + String _boxNameUsedSerialsCache({required Coin coin}) => "${coin.name}_usedSerialsCache"; - Box? _boxDebugInfo; Box? _boxNodeModels; Box? _boxPrimaryNodes; Box? _boxAllWalletsData; Box? _boxNotifications; Box? _boxWatchedTransactions; Box? _boxWatchedTrades; - Box? _boxTrades; Box? _boxTradesV2; Box? _boxTradeNotes; Box? _boxFavoriteWallets; @@ -56,7 +58,7 @@ class DB { Box? _boxPrefs; Box? _boxTradeLookup; Box? _boxDBInfo; - Box? _boxDesktopData; + // Box? _boxDesktopData; final Map> _walletBoxes = {}; @@ -99,8 +101,6 @@ class DB { _boxPrefs = await Hive.openBox(boxNamePrefs); } - _boxDebugInfo = await Hive.openBox(boxNameDebugInfo); - if (Hive.isBoxOpen(boxNameNodeModels)) { _boxNodeModels = Hive.box(boxNameNodeModels); } else { @@ -119,19 +119,12 @@ 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 = await Hive.openBox(boxNameWatchedTransactions); _boxWatchedTrades = await Hive.openBox(boxNameWatchedTrades); - _boxTrades = await Hive.openBox(boxNameTrades); _boxTradesV2 = await Hive.openBox(boxNameTradesV2); _boxTradeNotes = await Hive.openBox(boxNameTradeNotes); _boxTradeLookup = await Hive.openBox(boxNameTradeLookup); @@ -142,7 +135,6 @@ class DB { await Future.wait([ Hive.openBox(boxNamePriceCache), _loadWalletBoxes(), - _loadSharedCoinCacheBoxes(), ]); } @@ -174,15 +166,40 @@ class DB { } } - Future _loadSharedCoinCacheBoxes() async { - for (final coin in Coin.values) { - _txCacheBoxes[coin] = - await Hive.openBox(boxNameTxCache(coin: coin)); - _setCacheBoxes[coin] = - await Hive.openBox(boxNameSetCache(coin: coin)); - _usedSerialsCacheBoxes[coin] = - await Hive.openBox(boxNameUsedSerialsCache(coin: coin)); - } + Future> getTxCacheBox({required Coin coin}) async { + return _txCacheBoxes[coin] ??= + await Hive.openBox(_boxNameTxCache(coin: coin)); + } + + Future closeTxCacheBox({required Coin coin}) async { + await _txCacheBoxes[coin]?.close(); + } + + Future> getAnonymitySetCacheBox({required Coin coin}) async { + return _setCacheBoxes[coin] ??= + await Hive.openBox(_boxNameSetCache(coin: coin)); + } + + Future closeAnonymitySetCacheBox({required Coin coin}) async { + await _setCacheBoxes[coin]?.close(); + } + + Future> getUsedSerialsCacheBox({required Coin coin}) async { + return _usedSerialsCacheBoxes[coin] ??= + await Hive.openBox(_boxNameUsedSerialsCache(coin: coin)); + } + + Future closeUsedSerialsCacheBox({required Coin coin}) async { + await _usedSerialsCacheBoxes[coin]?.close(); + } + + /// Clear all cached transactions for the specified coin + Future clearSharedTransactionCache({required Coin coin}) async { + await deleteAll(boxName: _boxNameTxCache(coin: coin)); + // if (coin == Coin.firo) { + // await deleteAll(boxName: _boxNameSetCache(coin: coin)); + // await deleteAll(boxName: _boxNameUsedSerialsCache(coin: coin)); + // } } ///////////////////////////////////////// @@ -243,6 +260,36 @@ class DB { Future deleteBoxFromDisk({required String boxName}) async => await mutex.protect(() async => await Hive.deleteBoxFromDisk(boxName)); + + /////////////////////////////////////////////////////////////////////////// + Future deleteEverything() async { + try { + await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameAddressBook); + 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); + await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameNotifications); + await DB.instance + .deleteBoxFromDisk(boxName: DB.boxNameWatchedTransactions); + await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameWatchedTrades); + await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameTrades); + await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameTradesV2); + await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameTradeNotes); + await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameTradeLookup); + await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameFavoriteWallets); + await DB.instance.deleteBoxFromDisk(boxName: DB.boxNamePrefs); + await DB.instance + .deleteBoxFromDisk(boxName: DB.boxNameWalletsToDeleteOnStart); + await DB.instance.deleteBoxFromDisk(boxName: DB.boxNamePriceCache); + await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameDBInfo); + await DB.instance.deleteBoxFromDisk(boxName: "theme"); + return true; + } catch (e, s) { + Logging.instance.log("$e $s", level: LogLevel.Error); + return false; + } + } } abstract class DBKeys { diff --git a/lib/db/main_db.dart b/lib/db/isar/main_db.dart similarity index 99% rename from lib/db/main_db.dart rename to lib/db/isar/main_db.dart index d6ad19275b..761b378b79 100644 --- a/lib/db/main_db.dart +++ b/lib/db/isar/main_db.dart @@ -11,7 +11,7 @@ import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/stack_file_system.dart'; import 'package:tuple/tuple.dart'; -part 'queries/queries.dart'; +part '../queries/queries.dart'; class MainDB { MainDB._(); diff --git a/lib/db/queries/queries.dart b/lib/db/queries/queries.dart index bf7064d830..99f2669734 100644 --- a/lib/db/queries/queries.dart +++ b/lib/db/queries/queries.dart @@ -1,4 +1,4 @@ -part of 'package:stackduo/db/main_db.dart'; +part of 'package:stackduo/db/isar/main_db.dart'; enum CCFilter { all, diff --git a/lib/electrumx_rpc/cached_electrumx.dart b/lib/electrumx_rpc/cached_electrumx.dart index 7e858166d6..6941db12f7 100644 --- a/lib/electrumx_rpc/cached_electrumx.dart +++ b/lib/electrumx_rpc/cached_electrumx.dart @@ -1,46 +1,26 @@ import 'dart:convert'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/electrumx_rpc/electrumx.dart'; -import 'package:stackduo/hive/db.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/logger.dart'; -import 'package:stackduo/utilities/prefs.dart'; import 'package:string_validator/string_validator.dart'; class CachedElectrumX { - final ElectrumX? electrumXClient; - - final String server; - final int port; - final bool useSSL; - - final Prefs prefs; - final List failovers; + final ElectrumX electrumXClient; static const minCacheConfirms = 30; const CachedElectrumX({ - required this.server, - required this.port, - required this.useSSL, - required this.prefs, - required this.failovers, - this.electrumXClient, + required this.electrumXClient, }); factory CachedElectrumX.from({ - required ElectrumXNode node, - required Prefs prefs, - required List failovers, - ElectrumX? electrumXClient, + required ElectrumX electrumXClient, }) => CachedElectrumX( - server: node.address, - port: node.port, - useSSL: node.useSSL, - prefs: prefs, - failovers: failovers, - electrumXClient: electrumXClient); + electrumXClient: electrumXClient, + ); Future> getAnonymitySet({ required String groupId, @@ -48,9 +28,8 @@ class CachedElectrumX { required Coin coin, }) async { try { - final cachedSet = DB.instance.get( - boxName: DB.instance.boxNameSetCache(coin: coin), - key: groupId) as Map?; + final box = await DB.instance.getAnonymitySetCacheBox(coin: coin); + final cachedSet = box.get(groupId) as Map?; Map set; @@ -66,16 +45,7 @@ class CachedElectrumX { set = Map.from(cachedSet); } - final client = electrumXClient ?? - ElectrumX( - host: server, - port: port, - useSSL: useSSL, - prefs: prefs, - failovers: failovers, - ); - - final newSet = await client.getAnonymitySet( + final newSet = await electrumXClient.getAnonymitySet( groupId: groupId, blockhash: set["blockHash"] as String, ); @@ -90,7 +60,7 @@ class CachedElectrumX { : newSet["blockHash"]; for (int i = (newSet["coins"] as List).length - 1; i >= 0; i--) { dynamic newCoin = newSet["coins"][i]; - List translatedCoin = []; + List translatedCoin = []; translatedCoin.add(!isHexadecimal(newCoin[0] as String) ? base64ToHex(newCoin[0] as String) : newCoin[0]); @@ -110,13 +80,11 @@ class CachedElectrumX { set["coins"].insert(0, translatedCoin); } // save set to db - await DB.instance.put( - boxName: DB.instance.boxNameSetCache(coin: coin), - key: groupId, - value: set); + await box.put(groupId, set); Logging.instance.log( - "Updated currently anonymity set for ${coin.name} with group ID $groupId", - level: LogLevel.Info); + "Updated current anonymity set for ${coin.name} with group ID $groupId", + level: LogLevel.Info, + ); } return set; @@ -148,29 +116,19 @@ class CachedElectrumX { bool verbose = true, }) async { try { - final cachedTx = DB.instance.get( - boxName: DB.instance.boxNameTxCache(coin: coin), key: txHash) as Map?; + final box = await DB.instance.getTxCacheBox(coin: coin); + + final cachedTx = box.get(txHash) as Map?; if (cachedTx == null) { - final client = electrumXClient ?? - ElectrumX( - host: server, - port: port, - useSSL: useSSL, - prefs: prefs, - failovers: failovers, - ); - final Map result = - await client.getTransaction(txHash: txHash, verbose: verbose); + final Map result = await electrumXClient + .getTransaction(txHash: txHash, verbose: verbose); result.remove("hex"); result.remove("lelantusData"); if (result["confirmations"] != null && result["confirmations"] as int > minCacheConfirms) { - await DB.instance.put( - boxName: DB.instance.boxNameTxCache(coin: coin), - key: txHash, - value: result); + await box.put(txHash, result); } Logging.instance.log("using fetched result", level: LogLevel.Info); @@ -187,31 +145,25 @@ class CachedElectrumX { } } - Future> getUsedCoinSerials({ + Future> getUsedCoinSerials({ required Coin coin, int startNumber = 0, }) async { try { - List? cachedSerials = DB.instance.get( - boxName: DB.instance.boxNameUsedSerialsCache(coin: coin), - key: "serials") as List?; + final box = await DB.instance.getUsedSerialsCacheBox(coin: coin); + + final _list = box.get("serials") as List?; - cachedSerials ??= []; + List cachedSerials = + _list == null ? [] : List.from(_list); final startNumber = cachedSerials.length; - final client = electrumXClient ?? - ElectrumX( - host: server, - port: port, - useSSL: useSSL, - prefs: prefs, - failovers: failovers, - ); - - final serials = await client.getUsedCoinSerials(startNumber: startNumber); - List newSerials = []; - for (var element in (serials["serials"] as List)) { + final serials = + await electrumXClient.getUsedCoinSerials(startNumber: startNumber); + List newSerials = []; + + for (final element in (serials["serials"] as List)) { if (!isHexadecimal(element as String)) { newSerials.add(base64ToHex(element)); } else { @@ -220,10 +172,10 @@ class CachedElectrumX { } cachedSerials.addAll(newSerials); - await DB.instance.put( - boxName: DB.instance.boxNameUsedSerialsCache(coin: coin), - key: "serials", - value: cachedSerials); + await box.put( + "serials", + cachedSerials, + ); return cachedSerials; } catch (e, s) { @@ -236,11 +188,6 @@ class CachedElectrumX { /// Clear all cached transactions for the specified coin Future clearSharedTransactionCache({required Coin coin}) async { - await DB.instance - .deleteAll(boxName: DB.instance.boxNameTxCache(coin: coin)); - await DB.instance - .deleteAll(boxName: DB.instance.boxNameSetCache(coin: coin)); - await DB.instance.deleteAll( - boxName: DB.instance.boxNameUsedSerialsCache(coin: coin)); + await DB.instance.closeAnonymitySetCacheBox(coin: coin); } } diff --git a/lib/electrumx_rpc/electrumx.dart b/lib/electrumx_rpc/electrumx.dart index 31689681be..a6ac258978 100644 --- a/lib/electrumx_rpc/electrumx.dart +++ b/lib/electrumx_rpc/electrumx.dart @@ -132,8 +132,12 @@ class ElectrumX { final response = await _rpcClient!.request(jsonRequestString); - if (response["error"] != null) { - if (response["error"] + if (response.exception != null) { + throw response.exception!; + } + + if (response.data["error"] != null) { + if (response.data["error"] .toString() .contains("No such mempool or blockchain transaction")) { throw NoSuchTransactionException( @@ -143,11 +147,15 @@ class ElectrumX { } throw Exception( - "JSONRPC response \ncommand: $command \nargs: $args \nerror: $response"); + "JSONRPC response\n" + " command: $command\n" + " args: $args\n" + " error: ${response.data}", + ); } currentFailoverIndex = -1; - return response; + return response.data; } on WifiOnlyException { rethrow; } on SocketException { @@ -228,7 +236,13 @@ class ElectrumX { // Logging.instance.log("batch request: $request"); // send batch request - final response = (await _rpcClient!.request(request)) as List; + final jsonRpcResponse = (await _rpcClient!.request(request)); + + if (jsonRpcResponse.exception != null) { + throw jsonRpcResponse.exception!; + } + + final response = jsonRpcResponse.data as List; // check for errors, format and throw if there are any final List errors = []; @@ -310,6 +324,13 @@ class ElectrumX { requestID: requestID, command: 'blockchain.headers.subscribe', ); + if (response["result"] == null) { + Logging.instance.log( + "getBlockHeadTip returned null response", + level: LogLevel.Error, + ); + throw 'getBlockHeadTip returned null response'; + } return Map.from(response["result"] as Map); } catch (e) { rethrow; @@ -546,8 +567,9 @@ class ElectrumX { bool verbose = true, String? requestID, }) async { + dynamic response; try { - final response = await request( + response = await request( requestID: requestID, command: 'blockchain.transaction.get', args: [ @@ -561,6 +583,10 @@ class ElectrumX { return Map.from(response["result"] as Map); } catch (e) { + Logging.instance.log( + "getTransaction($txHash) response: $response", + level: LogLevel.Error, + ); rethrow; } } diff --git a/lib/electrumx_rpc/rpc.dart b/lib/electrumx_rpc/rpc.dart index 57d694b5c0..a62f7511da 100644 --- a/lib/electrumx_rpc/rpc.dart +++ b/lib/electrumx_rpc/rpc.dart @@ -2,9 +2,11 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; +import 'package:flutter/foundation.dart'; +import 'package:mutex/mutex.dart'; import 'package:stackduo/utilities/logger.dart'; -// hacky fix to receive large jsonrpc responses +// Json RPC class to handle connecting to electrumx servers class JsonRPC { JsonRPC({ required this.host, @@ -12,65 +14,267 @@ class JsonRPC { this.useSSL = false, this.connectionTimeout = const Duration(seconds: 60), }); - bool useSSL; - String host; - int port; - Duration connectionTimeout; - - Future request(String jsonRpcRequest) async { - Socket? socket; - final completer = Completer(); - final List responseData = []; - - void dataHandler(List data) { - responseData.addAll(data); - - // 0x0A is newline - // https://electrumx-spesmilo.readthedocs.io/en/latest/protocol-basics.html - if (data.last == 0x0A) { - try { - final response = json.decode(String.fromCharCodes(responseData)); - completer.complete(response); - } catch (e, s) { - Logging.instance - .log("JsonRPC json.decode: $e\n$s", level: LogLevel.Error); - completer.completeError(e, s); - } finally { - socket?.destroy(); + final bool useSSL; + final String host; + final int port; + final Duration connectionTimeout; + + final _requestMutex = Mutex(); + final _JsonRPCRequestQueue _requestQueue = _JsonRPCRequestQueue(); + Socket? _socket; + StreamSubscription? _subscription; + + void _dataHandler(List data) { + _requestQueue.nextIncompleteReq.then((req) { + if (req != null) { + req.appendDataAndCheckIfComplete(data); + + if (req.isComplete) { + _onReqCompleted(req); } + } else { + Logging.instance.log( + "_dataHandler found a null req!", + level: LogLevel.Warning, + ); } - } + }); + } - void errorHandler(Object error, StackTrace trace) { - Logging.instance - .log("JsonRPC errorHandler: $error\n$trace", level: LogLevel.Error); - completer.completeError(error, trace); - socket?.destroy(); - } + void _errorHandler(Object error, StackTrace trace) { + _requestQueue.nextIncompleteReq.then((req) { + if (req != null) { + req.completer.completeError(error, trace); + _onReqCompleted(req); + } + }); + } + + void _doneHandler() { + disconnect(reason: "JsonRPC _doneHandler() called"); + } - void doneHandler() { - socket?.destroy(); + void _onReqCompleted(_JsonRPCRequest req) { + _requestQueue.remove(req).then((_) { + // attempt to send next request + _sendNextAvailableRequest(); + }); + } + + void _sendNextAvailableRequest() { + _requestQueue.nextIncompleteReq.then((req) { + if (req != null) { + // \r\n required by electrumx server + _socket!.write('${req.jsonRequest}\r\n'); + + // TODO different timeout length? + req.initiateTimeout( + const Duration(seconds: 10), + onTimedOut: () { + _requestQueue.remove(req); + }, + ); + } + }); + } + + Future request(String jsonRpcRequest) async { + await _requestMutex.protect(() async { + if (_socket == null) { + Logging.instance.log( + "JsonRPC request: opening socket $host:$port", + level: LogLevel.Info, + ); + await connect(); + } + }); + + final req = _JsonRPCRequest( + jsonRequest: jsonRpcRequest, + completer: Completer(), + ); + + final future = req.completer.future.onError( + (error, stackTrace) async { + await disconnect( + reason: "return req.completer.future.onError: $error\n$stackTrace", + ); + return JsonRPCResponse( + exception: error is Exception + ? error + : Exception( + "req.completer.future.onError: $error\n$stackTrace", + ), + ); + }, + ); + + // if this is the only/first request then send it right away + await _requestQueue.add( + req, + onInitialRequestAdded: _sendNextAvailableRequest, + ); + + return future; + } + + Future disconnect({required String reason}) async { + await _requestMutex.protect(() async { + await _subscription?.cancel(); + _subscription = null; + _socket?.destroy(); + _socket = null; + + // clean up remaining queue + await _requestQueue.completeRemainingWithError( + "JsonRPC disconnect() called with reason: \"$reason\"", + ); + }); + } + + Future connect() async { + if (_socket != null) { + throw Exception( + "JsonRPC attempted to connect to an already existing socket!", + ); } if (useSSL) { - await SecureSocket.connect(host, port, - timeout: connectionTimeout, - onBadCertificate: (_) => true).then((Socket sock) { - socket = sock; - socket?.listen(dataHandler, - onError: errorHandler, onDone: doneHandler, cancelOnError: true); - }); + _socket = await SecureSocket.connect( + host, + port, + timeout: connectionTimeout, + onBadCertificate: (_) => true, + ); // TODO do not automatically trust bad certificates } else { - await Socket.connect(host, port, timeout: connectionTimeout) - .then((Socket sock) { - socket = sock; - socket?.listen(dataHandler, - onError: errorHandler, onDone: doneHandler, cancelOnError: true); - }); + _socket = await Socket.connect( + host, + port, + timeout: connectionTimeout, + ); } - socket?.write('$jsonRpcRequest\r\n'); + _subscription = _socket!.listen( + _dataHandler, + onError: _errorHandler, + onDone: _doneHandler, + cancelOnError: true, + ); + } +} + +class _JsonRPCRequestQueue { + final _lock = Mutex(); + final List<_JsonRPCRequest> _rq = []; + + Future add( + _JsonRPCRequest req, { + VoidCallback? onInitialRequestAdded, + }) async { + return await _lock.protect(() async { + _rq.add(req); + if (_rq.length == 1) { + onInitialRequestAdded?.call(); + } + }); + } - return completer.future; + Future remove(_JsonRPCRequest req) async { + return await _lock.protect(() async { + final result = _rq.remove(req); + return result; + }); } + + Future<_JsonRPCRequest?> get nextIncompleteReq async { + return await _lock.protect(() async { + int removeCount = 0; + _JsonRPCRequest? returnValue; + for (final req in _rq) { + if (req.isComplete) { + removeCount++; + } else { + returnValue = req; + break; + } + } + + _rq.removeRange(0, removeCount); + + return returnValue; + }); + } + + Future completeRemainingWithError( + String error, { + StackTrace? stackTrace, + }) async { + await _lock.protect(() async { + for (final req in _rq) { + if (!req.isComplete) { + req.completer.completeError(Exception(error), stackTrace); + } + } + _rq.clear(); + }); + } + + Future get isEmpty async { + return await _lock.protect(() async { + return _rq.isEmpty; + }); + } +} + +class _JsonRPCRequest { + // 0x0A is newline + // https://electrumx-spesmilo.readthedocs.io/en/latest/protocol-basics.html + static const int separatorByte = 0x0A; + + final String jsonRequest; + final Completer completer; + final List _responseData = []; + + _JsonRPCRequest({required this.jsonRequest, required this.completer}); + + void appendDataAndCheckIfComplete(List data) { + _responseData.addAll(data); + if (data.last == separatorByte) { + try { + final response = json.decode(String.fromCharCodes(_responseData)); + completer.complete(JsonRPCResponse(data: response)); + } catch (e, s) { + Logging.instance.log( + "JsonRPC json.decode: $e\n$s", + level: LogLevel.Error, + ); + completer.completeError(e, s); + } + } + } + + void initiateTimeout( + Duration timeout, { + VoidCallback? onTimedOut, + }) { + Future.delayed(timeout).then((_) { + if (!isComplete) { + try { + throw Exception("_JsonRPCRequest timed out: $jsonRequest"); + } catch (e, s) { + completer.completeError(e, s); + onTimedOut?.call(); + } + } + }); + } + + bool get isComplete => completer.isCompleted; +} + +class JsonRPCResponse { + final dynamic data; + final Exception? exception; + + JsonRPCResponse({this.data, this.exception}); } diff --git a/lib/exceptions/sw_exception.dart b/lib/exceptions/sw_exception.dart index 34ab664f27..0296da10a8 100644 --- a/lib/exceptions/sw_exception.dart +++ b/lib/exceptions/sw_exception.dart @@ -1,7 +1,7 @@ // generic stack wallet exception which all other custom exceptions should // extend from -class SWException with Exception { +class SWException implements Exception { SWException(this.message); final String message; diff --git a/lib/main.dart b/lib/main.dart index 635ddaaeb9..1333fa222f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -17,8 +17,8 @@ import 'package:hive_flutter/hive_flutter.dart'; import 'package:isar/isar.dart'; import 'package:keyboard_dismisser/keyboard_dismisser.dart'; import 'package:path_provider/path_provider.dart'; -import 'package:stackduo/db/main_db.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/exchange/change_now/exchange_transaction.dart'; import 'package:stackduo/models/exchange/change_now/exchange_transaction_status.dart'; import 'package:stackduo/models/exchange/response_objects/trade.dart'; @@ -69,7 +69,7 @@ final openedFromSWBFileStringStateProvider = // runs the MyApp widget and checks for new users, caching the value in the // miscellaneous box for later use void main() async { - WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized(); + WidgetsFlutterBinding.ensureInitialized(); GoogleFonts.config.allowRuntimeFetching = false; if (Platform.isIOS) { Util.libraryPath = await getLibraryDirectory(); @@ -156,6 +156,8 @@ void main() async { await Hive.openBox(DB.boxNamePrefs); await Prefs.instance.init(); + await StackFileSystem.initThemesDir(); + // Desktop migrate handled elsewhere (currently desktop_login_view.dart) if (!Util.isDesktop) { int dbVersion = DB.instance.get( @@ -177,7 +179,9 @@ void main() async { } } - monero.onStartup(); + if (!Platform.isWindows) { + monero.onStartup(); + } // SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, // overlays: [SystemUiOverlay.bottom]); @@ -186,32 +190,28 @@ void main() async { await MainDB.instance.initMainDB(); ThemeService.instance.init(MainDB.instance); - // install default themes - if (!(await ThemeService.instance.verifyInstalled(themeId: "light"))) { - Logging.instance.log( - "Installing default light theme...", - level: LogLevel.Info, - ); - final lightZip = await rootBundle.load("assets/default_themes/light.zip"); - await ThemeService.instance - .install(themeArchiveData: lightZip.buffer.asUint8List()); - Logging.instance.log( - "Installing default light theme... finished", - level: LogLevel.Info, - ); + // check and update or install default themes + await ThemeService.instance.checkDefaultThemesOnStartup(); + + // verify current user preference theme and revert to default + // if problems are found to prevent app being unusable + if (!(await ThemeService.instance + .verifyInstalled(themeId: Prefs.instance.themeId))) { + Prefs.instance.themeId = "light"; } - if (!(await ThemeService.instance.verifyInstalled(themeId: "dark"))) { - Logging.instance.log( - "Installing default dark theme... ", - level: LogLevel.Info, - ); - final darkZip = await rootBundle.load("assets/default_themes/dark.zip"); - await ThemeService.instance - .install(themeArchiveData: darkZip.buffer.asUint8List()); - Logging.instance.log( - "Installing default dark theme... finished", - level: LogLevel.Info, - ); + + // verify current user preference light brightness theme and revert to default + // if problems are found to prevent app being unusable + if (!(await ThemeService.instance + .verifyInstalled(themeId: Prefs.instance.systemBrightnessLightThemeId))) { + Prefs.instance.systemBrightnessLightThemeId = "light"; + } + + // verify current user preference dark brightness theme and revert to default + // if problems are found to prevent app being unusable + if (!(await ThemeService.instance + .verifyInstalled(themeId: Prefs.instance.systemBrightnessDarkThemeId))) { + Prefs.instance.systemBrightnessDarkThemeId = "dark"; } runApp(const ProviderScope(child: MyApp())); @@ -293,7 +293,7 @@ class _MaterialAppWithThemeState extends ConsumerState } ref.read(applicationThemesDirectoryPathProvider.notifier).state = - (await StackFileSystem.applicationThemesDirectory()).path; + StackFileSystem.themesDir!.path; _notificationsService = ref.read(notificationsProvider); _nodeService = ref.read(nodeServiceChangeNotifierProvider); @@ -388,7 +388,7 @@ class _MaterialAppWithThemeState extends ConsumerState WidgetsBinding.instance.addPostFrameCallback((_) async { //Add themes path to provider ref.read(applicationThemesDirectoryPathProvider.notifier).state = - (await StackFileSystem.applicationThemesDirectory()).path; + StackFileSystem.themesDir!.path; ref.read(themeProvider.state).state = ref.read(pThemeService).getTheme( themeId: themeId, @@ -444,6 +444,12 @@ class _MaterialAppWithThemeState extends ConsumerState super.dispose(); } + @override + void didChangeLocales(List? locales) { + ref.read(localeServiceChangeNotifierProvider).loadLocale(); + super.didChangeLocales(locales); + } + @override void didChangeAppLifecycleState(AppLifecycleState state) async { debugPrint("didChangeAppLifecycleState: ${state.name}"); diff --git a/lib/models/add_wallet_list_entity/add_wallet_list_entity.dart b/lib/models/add_wallet_list_entity/add_wallet_list_entity.dart new file mode 100644 index 0000000000..0e4c8d12d6 --- /dev/null +++ b/lib/models/add_wallet_list_entity/add_wallet_list_entity.dart @@ -0,0 +1,18 @@ +/* + * This file is part of Stack Wallet. + * + * Copyright (c) 2023 Cypher Stack + * All Rights Reserved. + * The code is distributed under GPLv3 license, see LICENSE file for details. + * Generated by Cypher Stack on 2023-05-26 + * + */ + +import 'package:equatable/equatable.dart'; +import 'package:stackduo/utilities/enums/coin_enum.dart'; + +abstract class AddWalletListEntity extends Equatable { + Coin get coin; + String get name; + String get ticker; +} diff --git a/lib/models/add_wallet_list_entity/sub_classes/coin_entity.dart b/lib/models/add_wallet_list_entity/sub_classes/coin_entity.dart new file mode 100644 index 0000000000..50ced5c62e --- /dev/null +++ b/lib/models/add_wallet_list_entity/sub_classes/coin_entity.dart @@ -0,0 +1,30 @@ +/* + * This file is part of Stack Wallet. + * + * Copyright (c) 2023 Cypher Stack + * All Rights Reserved. + * The code is distributed under GPLv3 license, see LICENSE file for details. + * Generated by Cypher Stack on 2023-05-26 + * + */ + +import 'package:stackduo/models/add_wallet_list_entity/add_wallet_list_entity.dart'; +import 'package:stackduo/utilities/enums/coin_enum.dart'; + +class CoinEntity extends AddWalletListEntity { + CoinEntity(this._coin); + + final Coin _coin; + + @override + Coin get coin => _coin; + + @override + String get name => coin.prettyName; + + @override + String get ticker => coin.ticker; + + @override + List get props => [coin, name, ticker]; +} diff --git a/lib/models/isar/models/blockchain_data/address.dart b/lib/models/isar/models/blockchain_data/address.dart index 5b1c6e28c5..b6b186c767 100644 --- a/lib/models/isar/models/blockchain_data/address.dart +++ b/lib/models/isar/models/blockchain_data/address.dart @@ -122,7 +122,10 @@ enum AddressType { cryptonote, mimbleWimble, unknown, - nonWallet; + nonWallet, + ethereum, + nano, + banano; String get readableName { switch (this) { @@ -140,6 +143,12 @@ enum AddressType { return "Unknown"; case AddressType.nonWallet: return "Non wallet/unknown"; + case AddressType.ethereum: + return "Ethereum"; + case AddressType.nano: + return "Nano"; + case AddressType.banano: + return "Banano"; } } } diff --git a/lib/models/isar/models/blockchain_data/address.g.dart b/lib/models/isar/models/blockchain_data/address.g.dart index 37186584be..356904d2cc 100644 --- a/lib/models/isar/models/blockchain_data/address.g.dart +++ b/lib/models/isar/models/blockchain_data/address.g.dart @@ -260,6 +260,9 @@ const _AddresstypeEnumValueMap = { 'mimbleWimble': 4, 'unknown': 5, 'nonWallet': 6, + 'ethereum': 7, + 'nano': 8, + 'banano': 9, }; const _AddresstypeValueEnumMap = { 0: AddressType.p2pkh, @@ -269,6 +272,9 @@ const _AddresstypeValueEnumMap = { 4: AddressType.mimbleWimble, 5: AddressType.unknown, 6: AddressType.nonWallet, + 7: AddressType.ethereum, + 8: AddressType.nano, + 9: AddressType.banano, }; Id _addressGetId(Address object) { diff --git a/lib/models/isar/models/blockchain_data/transaction.dart b/lib/models/isar/models/blockchain_data/transaction.dart index 70322d385b..3b22287f4e 100644 --- a/lib/models/isar/models/blockchain_data/transaction.dart +++ b/lib/models/isar/models/blockchain_data/transaction.dart @@ -12,6 +12,7 @@ part 'transaction.g.dart'; @Collection() class Transaction { + Transaction({ required this.walletId, required this.txid, @@ -29,6 +30,7 @@ class Transaction { required this.inputs, required this.outputs, required this.nonce, + required this.numberOfMessages, }); Tuple2 copyWith({ @@ -50,6 +52,7 @@ class Transaction { int? nonce, Id? id, Address? address, + int? numberOfMessages, }) { return Tuple2( Transaction( @@ -68,7 +71,8 @@ class Transaction { otherData: otherData ?? this.otherData, nonce: nonce ?? this.nonce, inputs: inputs ?? this.inputs, - outputs: outputs ?? this.outputs) + outputs: outputs ?? this.outputs, + numberOfMessages: numberOfMessages ?? this.numberOfMessages) ..id = id ?? this.id, address ?? this.address.value, ); @@ -114,6 +118,8 @@ class Transaction { late final List outputs; + late final int? numberOfMessages; + @Backlink(to: "transactions") final address = IsarLink
(); @@ -154,6 +160,7 @@ class Transaction { "address: ${address.value}, " "inputsLength: ${inputs.length}, " "outputsLength: ${outputs.length}, " + "numberOfMessages: $numberOfMessages, " "}"; String toJsonString() { @@ -175,6 +182,7 @@ class Transaction { "address": address.value?.toJsonString(), "inputs": inputs.map((e) => e.toJsonString()).toList(), "outputs": outputs.map((e) => e.toJsonString()).toList(), + "numberOfMessages": numberOfMessages, }; return jsonEncode(result); } @@ -205,6 +213,7 @@ class Transaction { outputs: List.from(json["outputs"] as List) .map((e) => Output.fromJsonString(e)) .toList(), + numberOfMessages: json["numberOfMessages"] as int, ); if (json["address"] == null) { return Tuple2(transaction, null); diff --git a/lib/models/isar/models/blockchain_data/transaction.g.dart b/lib/models/isar/models/blockchain_data/transaction.g.dart index 74a5a1652b..c11649ddbe 100644 --- a/lib/models/isar/models/blockchain_data/transaction.g.dart +++ b/lib/models/isar/models/blockchain_data/transaction.g.dart @@ -58,46 +58,51 @@ const TransactionSchema = CollectionSchema( name: r'nonce', type: IsarType.long, ), - r'otherData': PropertySchema( + r'numberOfMessages': PropertySchema( id: 8, + name: r'numberOfMessages', + type: IsarType.long, + ), + r'otherData': PropertySchema( + id: 9, name: r'otherData', type: IsarType.string, ), r'outputs': PropertySchema( - id: 9, + id: 10, name: r'outputs', type: IsarType.objectList, target: r'Output', ), r'slateId': PropertySchema( - id: 10, + id: 11, name: r'slateId', type: IsarType.string, ), r'subType': PropertySchema( - id: 11, + id: 12, name: r'subType', type: IsarType.byte, enumMap: _TransactionsubTypeEnumValueMap, ), r'timestamp': PropertySchema( - id: 12, + id: 13, name: r'timestamp', type: IsarType.long, ), r'txid': PropertySchema( - id: 13, + id: 14, name: r'txid', type: IsarType.string, ), r'type': PropertySchema( - id: 14, + id: 15, name: r'type', type: IsarType.byte, enumMap: _TransactiontypeEnumValueMap, ), r'walletId': PropertySchema( - id: 15, + id: 16, name: r'walletId', type: IsarType.string, ) @@ -233,19 +238,20 @@ void _transactionSerialize( writer.writeBool(offsets[5], object.isCancelled); writer.writeBool(offsets[6], object.isLelantus); writer.writeLong(offsets[7], object.nonce); - writer.writeString(offsets[8], object.otherData); + writer.writeLong(offsets[8], object.numberOfMessages); + writer.writeString(offsets[9], object.otherData); writer.writeObjectList( - offsets[9], + offsets[10], allOffsets, OutputSchema.serialize, object.outputs, ); - writer.writeString(offsets[10], object.slateId); - writer.writeByte(offsets[11], object.subType.index); - writer.writeLong(offsets[12], object.timestamp); - writer.writeString(offsets[13], object.txid); - writer.writeByte(offsets[14], object.type.index); - writer.writeString(offsets[15], object.walletId); + writer.writeString(offsets[11], object.slateId); + writer.writeByte(offsets[12], object.subType.index); + writer.writeLong(offsets[13], object.timestamp); + writer.writeString(offsets[14], object.txid); + writer.writeByte(offsets[15], object.type.index); + writer.writeString(offsets[16], object.walletId); } Transaction _transactionDeserialize( @@ -269,23 +275,24 @@ Transaction _transactionDeserialize( isCancelled: reader.readBool(offsets[5]), isLelantus: reader.readBoolOrNull(offsets[6]), nonce: reader.readLongOrNull(offsets[7]), - otherData: reader.readStringOrNull(offsets[8]), + numberOfMessages: reader.readLongOrNull(offsets[8]), + otherData: reader.readStringOrNull(offsets[9]), outputs: reader.readObjectList( - offsets[9], + offsets[10], OutputSchema.deserialize, allOffsets, Output(), ) ?? [], - slateId: reader.readStringOrNull(offsets[10]), + slateId: reader.readStringOrNull(offsets[11]), subType: - _TransactionsubTypeValueEnumMap[reader.readByteOrNull(offsets[11])] ?? + _TransactionsubTypeValueEnumMap[reader.readByteOrNull(offsets[12])] ?? TransactionSubType.none, - timestamp: reader.readLong(offsets[12]), - txid: reader.readString(offsets[13]), - type: _TransactiontypeValueEnumMap[reader.readByteOrNull(offsets[14])] ?? + timestamp: reader.readLong(offsets[13]), + txid: reader.readString(offsets[14]), + type: _TransactiontypeValueEnumMap[reader.readByteOrNull(offsets[15])] ?? TransactionType.outgoing, - walletId: reader.readString(offsets[15]), + walletId: reader.readString(offsets[16]), ); object.id = id; return object; @@ -321,8 +328,10 @@ P _transactionDeserializeProp

( case 7: return (reader.readLongOrNull(offset)) as P; case 8: - return (reader.readStringOrNull(offset)) as P; + return (reader.readLongOrNull(offset)) as P; case 9: + return (reader.readStringOrNull(offset)) as P; + case 10: return (reader.readObjectList( offset, OutputSchema.deserialize, @@ -330,19 +339,19 @@ P _transactionDeserializeProp

( Output(), ) ?? []) as P; - case 10: - return (reader.readStringOrNull(offset)) as P; case 11: + return (reader.readStringOrNull(offset)) as P; + case 12: return (_TransactionsubTypeValueEnumMap[reader.readByteOrNull(offset)] ?? TransactionSubType.none) as P; - case 12: - return (reader.readLong(offset)) as P; case 13: - return (reader.readString(offset)) as P; + return (reader.readLong(offset)) as P; case 14: + return (reader.readString(offset)) as P; + case 15: return (_TransactiontypeValueEnumMap[reader.readByteOrNull(offset)] ?? TransactionType.outgoing) as P; - case 15: + case 16: return (reader.readString(offset)) as P; default: throw IsarError('Unknown property with id $propertyId'); @@ -1374,6 +1383,80 @@ extension TransactionQueryFilter }); } + QueryBuilder + numberOfMessagesIsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'numberOfMessages', + )); + }); + } + + QueryBuilder + numberOfMessagesIsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'numberOfMessages', + )); + }); + } + + QueryBuilder + numberOfMessagesEqualTo(int? value) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'numberOfMessages', + value: value, + )); + }); + } + + QueryBuilder + numberOfMessagesGreaterThan( + int? value, { + bool include = false, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'numberOfMessages', + value: value, + )); + }); + } + + QueryBuilder + numberOfMessagesLessThan( + int? value, { + bool include = false, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'numberOfMessages', + value: value, + )); + }); + } + + QueryBuilder + numberOfMessagesBetween( + int? lower, + int? upper, { + bool includeLower = true, + bool includeUpper = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'numberOfMessages', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + )); + }); + } + QueryBuilder otherDataIsNull() { return QueryBuilder.apply(this, (query) { @@ -2320,6 +2403,20 @@ extension TransactionQuerySortBy }); } + QueryBuilder + sortByNumberOfMessages() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'numberOfMessages', Sort.asc); + }); + } + + QueryBuilder + sortByNumberOfMessagesDesc() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'numberOfMessages', Sort.desc); + }); + } + QueryBuilder sortByOtherData() { return QueryBuilder.apply(this, (query) { return query.addSortBy(r'otherData', Sort.asc); @@ -2504,6 +2601,20 @@ extension TransactionQuerySortThenBy }); } + QueryBuilder + thenByNumberOfMessages() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'numberOfMessages', Sort.asc); + }); + } + + QueryBuilder + thenByNumberOfMessagesDesc() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'numberOfMessages', Sort.desc); + }); + } + QueryBuilder thenByOtherData() { return QueryBuilder.apply(this, (query) { return query.addSortBy(r'otherData', Sort.asc); @@ -2634,6 +2745,13 @@ extension TransactionQueryWhereDistinct }); } + QueryBuilder + distinctByNumberOfMessages() { + return QueryBuilder.apply(this, (query) { + return query.addDistinctBy(r'numberOfMessages'); + }); + } + QueryBuilder distinctByOtherData( {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { @@ -2737,6 +2855,12 @@ extension TransactionQueryProperty }); } + QueryBuilder numberOfMessagesProperty() { + return QueryBuilder.apply(this, (query) { + return query.addPropertyName(r'numberOfMessages'); + }); + } + QueryBuilder otherDataProperty() { return QueryBuilder.apply(this, (query) { return query.addPropertyName(r'otherData'); diff --git a/lib/models/isar/stack_theme.dart b/lib/models/isar/stack_theme.dart index 75e1cda4d2..a30274902d 100644 --- a/lib/models/isar/stack_theme.dart +++ b/lib/models/isar/stack_theme.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:io'; import 'package:flutter/material.dart'; import 'package:isar/isar.dart'; @@ -7,6 +8,7 @@ import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/extensions/extensions.dart'; import 'package:stackduo/utilities/extensions/impl/box_shadow.dart'; import 'package:stackduo/utilities/extensions/impl/gradient.dart'; +import 'package:stackduo/utilities/stack_file_system.dart'; part 'stack_theme.g.dart'; @@ -16,13 +18,13 @@ class StackTheme { /// id of theme on themes server @Index(unique: true, replace: true) - final String themeId; + late final String themeId; /// the theme name that will be displayed in app - final String name; + late final String name; // system brightness - final String brightnessString; + late final String brightnessString; /// convenience enum conversion for stored [brightnessString] @ignore @@ -44,7 +46,7 @@ class StackTheme { Color get background => _background ??= Color(backgroundInt); @ignore Color? _background; - final int backgroundInt; + late final int backgroundInt; // ==== backgroundAppBar ===================================================== @@ -53,7 +55,7 @@ class StackTheme { _backgroundAppBar ??= Color(backgroundAppBarInt); @ignore Color? _backgroundAppBar; - final int backgroundAppBarInt; + late final int backgroundAppBarInt; // ==== gradientBackground ===================================================== @@ -73,7 +75,7 @@ class StackTheme { @ignore Gradient? _gradientBackground; - final String? gradientBackgroundString; + late final String? gradientBackgroundString; // ==== boxShadows ===================================================== @@ -86,7 +88,7 @@ class StackTheme { ); @ignore BoxShadow? _standardBoxShadow; - final String standardBoxShadowString; + late final String standardBoxShadowString; @ignore BoxShadow? get homeViewButtonBarBoxShadow { @@ -105,7 +107,7 @@ class StackTheme { @ignore BoxShadow? _homeViewButtonBarBoxShadow; - final String? homeViewButtonBarBoxShadowString; + late final String? homeViewButtonBarBoxShadowString; // ==== overlay ===================================================== @@ -113,7 +115,7 @@ class StackTheme { Color get overlay => _overlay ??= Color(overlayInt); @ignore Color? _overlay; - final int overlayInt; + late final int overlayInt; // ==== accentColorBlue ===================================================== @@ -123,7 +125,7 @@ class StackTheme { ); @ignore Color? _accentColorBlue; - final int accentColorBlueInt; + late final int accentColorBlueInt; // ==== accentColorGreen ===================================================== @@ -133,7 +135,7 @@ class StackTheme { ); @ignore Color? _accentColorGreen; - final int accentColorGreenInt; + late final int accentColorGreenInt; // ==== accentColorYellow ===================================================== @@ -143,7 +145,7 @@ class StackTheme { ); @ignore Color? _accentColorYellow; - final int accentColorYellowInt; + late final int accentColorYellowInt; // ==== accentColorRed ===================================================== @@ -153,7 +155,7 @@ class StackTheme { ); @ignore Color? _accentColorRed; - final int accentColorRedInt; + late final int accentColorRedInt; // ==== accentColorOrange ===================================================== @@ -163,7 +165,7 @@ class StackTheme { ); @ignore Color? _accentColorOrange; - final int accentColorOrangeInt; + late final int accentColorOrangeInt; // ==== accentColorDark ===================================================== @@ -173,7 +175,7 @@ class StackTheme { ); @ignore Color? _accentColorDark; - final int accentColorDarkInt; + late final int accentColorDarkInt; // ==== shadow ===================================================== @@ -183,7 +185,7 @@ class StackTheme { ); @ignore Color? _shadow; - final int shadowInt; + late final int shadowInt; // ==== textDark ===================================================== @@ -193,7 +195,7 @@ class StackTheme { ); @ignore Color? _textDark; - final int textDarkInt; + late final int textDarkInt; // ==== textDark2 ===================================================== @@ -203,7 +205,7 @@ class StackTheme { ); @ignore Color? _textDark2; - final int textDark2Int; + late final int textDark2Int; // ==== textDark3 ===================================================== @@ -213,7 +215,7 @@ class StackTheme { ); @ignore Color? _textDark3; - final int textDark3Int; + late final int textDark3Int; // ==== textSubtitle1 ===================================================== @@ -223,7 +225,7 @@ class StackTheme { ); @ignore Color? _textSubtitle1; - final int textSubtitle1Int; + late final int textSubtitle1Int; // ==== textSubtitle2 ===================================================== @@ -233,7 +235,7 @@ class StackTheme { ); @ignore Color? _textSubtitle2; - final int textSubtitle2Int; + late final int textSubtitle2Int; // ==== textSubtitle3 ===================================================== @@ -243,7 +245,7 @@ class StackTheme { ); @ignore Color? _textSubtitle3; - final int textSubtitle3Int; + late final int textSubtitle3Int; // ==== textSubtitle4 ===================================================== @@ -253,7 +255,7 @@ class StackTheme { ); @ignore Color? _textSubtitle4; - final int textSubtitle4Int; + late final int textSubtitle4Int; // ==== textSubtitle5 ===================================================== @@ -263,7 +265,7 @@ class StackTheme { ); @ignore Color? _textSubtitle5; - final int textSubtitle5Int; + late final int textSubtitle5Int; // ==== textSubtitle6 ===================================================== @@ -273,7 +275,7 @@ class StackTheme { ); @ignore Color? _textSubtitle6; - final int textSubtitle6Int; + late final int textSubtitle6Int; // ==== textWhite ===================================================== @@ -283,7 +285,7 @@ class StackTheme { ); @ignore Color? _textWhite; - final int textWhiteInt; + late final int textWhiteInt; // ==== textFavoriteCard ===================================================== @@ -293,7 +295,7 @@ class StackTheme { ); @ignore Color? _textFavoriteCard; - final int textFavoriteCardInt; + late final int textFavoriteCardInt; // ==== textError ===================================================== @@ -303,7 +305,7 @@ class StackTheme { ); @ignore Color? _textError; - final int textErrorInt; + late final int textErrorInt; // ==== textRestore ===================================================== @@ -313,7 +315,7 @@ class StackTheme { ); @ignore Color? _textRestore; - final int textRestoreInt; + late final int textRestoreInt; // ==== buttonBackPrimary ===================================================== @@ -323,7 +325,7 @@ class StackTheme { ); @ignore Color? _buttonBackPrimary; - final int buttonBackPrimaryInt; + late final int buttonBackPrimaryInt; // ==== buttonBackSecondary ===================================================== @@ -333,7 +335,7 @@ class StackTheme { ); @ignore Color? _buttonBackSecondary; - final int buttonBackSecondaryInt; + late final int buttonBackSecondaryInt; // ==== buttonBackPrimaryDisabled ===================================================== @@ -343,7 +345,7 @@ class StackTheme { ); @ignore Color? _buttonBackPrimaryDisabled; - final int buttonBackPrimaryDisabledInt; + late final int buttonBackPrimaryDisabledInt; // ==== buttonBackSecondaryDisabled ===================================================== @@ -354,7 +356,7 @@ class StackTheme { ); @ignore Color? _buttonBackSecondaryDisabled; - final int buttonBackSecondaryDisabledInt; + late final int buttonBackSecondaryDisabledInt; // ==== buttonBackBorder ===================================================== @@ -364,7 +366,7 @@ class StackTheme { ); @ignore Color? _buttonBackBorder; - final int buttonBackBorderInt; + late final int buttonBackBorderInt; // ==== buttonBackBorderDisabled ===================================================== @@ -374,7 +376,7 @@ class StackTheme { ); @ignore Color? _buttonBackBorderDisabled; - final int buttonBackBorderDisabledInt; + late final int buttonBackBorderDisabledInt; // ==== buttonBackBorderSecondary ===================================================== @@ -384,7 +386,7 @@ class StackTheme { ); @ignore Color? _buttonBackBorderSecondary; - final int buttonBackBorderSecondaryInt; + late final int buttonBackBorderSecondaryInt; // ==== buttonBackBorderSecondaryDisabled ===================================================== @@ -395,7 +397,7 @@ class StackTheme { ); @ignore Color? _buttonBackBorderSecondaryDisabled; - final int buttonBackBorderSecondaryDisabledInt; + late final int buttonBackBorderSecondaryDisabledInt; // ==== numberBackDefault ===================================================== @@ -405,7 +407,7 @@ class StackTheme { ); @ignore Color? _numberBackDefault; - final int numberBackDefaultInt; + late final int numberBackDefaultInt; // ==== numpadBackDefault ===================================================== @@ -415,7 +417,7 @@ class StackTheme { ); @ignore Color? _numpadBackDefault; - final int numpadBackDefaultInt; + late final int numpadBackDefaultInt; // ==== bottomNavBack ===================================================== @@ -425,7 +427,7 @@ class StackTheme { ); @ignore Color? _bottomNavBack; - final int bottomNavBackInt; + late final int bottomNavBackInt; // ==== buttonTextPrimary ===================================================== @@ -435,7 +437,7 @@ class StackTheme { ); @ignore Color? _buttonTextPrimary; - final int buttonTextPrimaryInt; + late final int buttonTextPrimaryInt; // ==== buttonTextSecondary ===================================================== @@ -445,7 +447,7 @@ class StackTheme { ); @ignore Color? _buttonTextSecondary; - final int buttonTextSecondaryInt; + late final int buttonTextSecondaryInt; // ==== buttonTextPrimaryDisabled ===================================================== @@ -455,7 +457,7 @@ class StackTheme { ); @ignore Color? _buttonTextPrimaryDisabled; - final int buttonTextPrimaryDisabledInt; + late final int buttonTextPrimaryDisabledInt; // ==== buttonTextSecondaryDisabled ===================================================== @@ -464,7 +466,7 @@ class StackTheme { _buttonTextSecondaryDisabled ??= Color(buttonTextSecondaryDisabledInt); @ignore Color? _buttonTextSecondaryDisabled; - final int buttonTextSecondaryDisabledInt; + late final int buttonTextSecondaryDisabledInt; // ==== buttonTextBorder ===================================================== @@ -473,7 +475,7 @@ class StackTheme { _buttonTextBorder ??= Color(buttonTextBorderInt); @ignore Color? _buttonTextBorder; - final int buttonTextBorderInt; + late final int buttonTextBorderInt; // ==== buttonTextDisabled ===================================================== @@ -482,7 +484,7 @@ class StackTheme { _buttonTextDisabled ??= Color(buttonTextDisabledInt); @ignore Color? _buttonTextDisabled; - final int buttonTextDisabledInt; + late final int buttonTextDisabledInt; // ==== buttonTextBorderless ===================================================== @@ -491,7 +493,7 @@ class StackTheme { _buttonTextBorderless ??= Color(buttonTextBorderlessInt); @ignore Color? _buttonTextBorderless; - final int buttonTextBorderlessInt; + late final int buttonTextBorderlessInt; // ==== buttonTextBorderlessDisabled ===================================================== @@ -500,7 +502,7 @@ class StackTheme { _buttonTextBorderlessDisabled ??= Color(buttonTextBorderlessDisabledInt); @ignore Color? _buttonTextBorderlessDisabled; - final int buttonTextBorderlessDisabledInt; + late final int buttonTextBorderlessDisabledInt; // ==== numberTextDefault ===================================================== @@ -509,7 +511,7 @@ class StackTheme { _numberTextDefault ??= Color(numberTextDefaultInt); @ignore Color? _numberTextDefault; - final int numberTextDefaultInt; + late final int numberTextDefaultInt; // ==== numpadTextDefault ===================================================== @@ -518,7 +520,7 @@ class StackTheme { _numpadTextDefault ??= Color(numpadTextDefaultInt); @ignore Color? _numpadTextDefault; - final int numpadTextDefaultInt; + late final int numpadTextDefaultInt; // ==== bottomNavText ===================================================== @@ -526,7 +528,7 @@ class StackTheme { Color get bottomNavText => _bottomNavText ??= Color(bottomNavTextInt); @ignore Color? _bottomNavText; - final int bottomNavTextInt; + late final int bottomNavTextInt; // ==== customTextButtonEnabledText ===================================================== @@ -535,7 +537,7 @@ class StackTheme { _customTextButtonEnabledText ??= Color(customTextButtonEnabledTextInt); @ignore Color? _customTextButtonEnabledText; - final int customTextButtonEnabledTextInt; + late final int customTextButtonEnabledTextInt; // ==== customTextButtonDisabledText ===================================================== @@ -544,7 +546,7 @@ class StackTheme { _customTextButtonDisabledText ??= Color(customTextButtonDisabledTextInt); @ignore Color? _customTextButtonDisabledText; - final int customTextButtonDisabledTextInt; + late final int customTextButtonDisabledTextInt; // ==== switchBGOn ===================================================== @@ -552,7 +554,7 @@ class StackTheme { Color get switchBGOn => _switchBGOn ??= Color(switchBGOnInt); @ignore Color? _switchBGOn; - final int switchBGOnInt; + late final int switchBGOnInt; // ==== switchBGOff ===================================================== @@ -560,7 +562,7 @@ class StackTheme { Color get switchBGOff => _switchBGOff ??= Color(switchBGOffInt); @ignore Color? _switchBGOff; - final int switchBGOffInt; + late final int switchBGOffInt; // ==== switchBGDisabled ===================================================== @@ -569,7 +571,7 @@ class StackTheme { _switchBGDisabled ??= Color(switchBGDisabledInt); @ignore Color? _switchBGDisabled; - final int switchBGDisabledInt; + late final int switchBGDisabledInt; // ==== switchCircleOn ===================================================== @@ -577,7 +579,7 @@ class StackTheme { Color get switchCircleOn => _switchCircleOn ??= Color(switchCircleOnInt); @ignore Color? _switchCircleOn; - final int switchCircleOnInt; + late final int switchCircleOnInt; // ==== switchCircleOff ===================================================== @@ -585,7 +587,7 @@ class StackTheme { Color get switchCircleOff => _switchCircleOff ??= Color(switchCircleOffInt); @ignore Color? _switchCircleOff; - final int switchCircleOffInt; + late final int switchCircleOffInt; // ==== switchCircleDisabled ===================================================== @@ -594,7 +596,7 @@ class StackTheme { _switchCircleDisabled ??= Color(switchCircleDisabledInt); @ignore Color? _switchCircleDisabled; - final int switchCircleDisabledInt; + late final int switchCircleDisabledInt; // ==== stepIndicatorBGCheck ===================================================== @@ -603,7 +605,7 @@ class StackTheme { _stepIndicatorBGCheck ??= Color(stepIndicatorBGCheckInt); @ignore Color? _stepIndicatorBGCheck; - final int stepIndicatorBGCheckInt; + late final int stepIndicatorBGCheckInt; // ==== stepIndicatorBGNumber ===================================================== @@ -612,7 +614,7 @@ class StackTheme { _stepIndicatorBGNumber ??= Color(stepIndicatorBGNumberInt); @ignore Color? _stepIndicatorBGNumber; - final int stepIndicatorBGNumberInt; + late final int stepIndicatorBGNumberInt; // ==== stepIndicatorBGInactive ===================================================== @@ -621,7 +623,7 @@ class StackTheme { _stepIndicatorBGInactive ??= Color(stepIndicatorBGInactiveInt); @ignore Color? _stepIndicatorBGInactive; - final int stepIndicatorBGInactiveInt; + late final int stepIndicatorBGInactiveInt; // ==== stepIndicatorBGLines ===================================================== @@ -630,7 +632,7 @@ class StackTheme { _stepIndicatorBGLines ??= Color(stepIndicatorBGLinesInt); @ignore Color? _stepIndicatorBGLines; - final int stepIndicatorBGLinesInt; + late final int stepIndicatorBGLinesInt; // ==== stepIndicatorBGLinesInactive ===================================================== @@ -639,7 +641,7 @@ class StackTheme { _stepIndicatorBGLinesInactive ??= Color(stepIndicatorBGLinesInactiveInt); @ignore Color? _stepIndicatorBGLinesInactive; - final int stepIndicatorBGLinesInactiveInt; + late final int stepIndicatorBGLinesInactiveInt; // ==== stepIndicatorIconText ===================================================== @@ -648,7 +650,7 @@ class StackTheme { _stepIndicatorIconText ??= Color(stepIndicatorIconTextInt); @ignore Color? _stepIndicatorIconText; - final int stepIndicatorIconTextInt; + late final int stepIndicatorIconTextInt; // ==== stepIndicatorIconNumber ===================================================== @@ -657,7 +659,7 @@ class StackTheme { _stepIndicatorIconNumber ??= Color(stepIndicatorIconNumberInt); @ignore Color? _stepIndicatorIconNumber; - final int stepIndicatorIconNumberInt; + late final int stepIndicatorIconNumberInt; // ==== stepIndicatorIconInactive ===================================================== @@ -666,7 +668,7 @@ class StackTheme { _stepIndicatorIconInactive ??= Color(stepIndicatorIconInactiveInt); @ignore Color? _stepIndicatorIconInactive; - final int stepIndicatorIconInactiveInt; + late final int stepIndicatorIconInactiveInt; // ==== checkboxBGChecked ===================================================== @@ -675,7 +677,7 @@ class StackTheme { _checkboxBGChecked ??= Color(checkboxBGCheckedInt); @ignore Color? _checkboxBGChecked; - final int checkboxBGCheckedInt; + late final int checkboxBGCheckedInt; // ==== checkboxBorderEmpty ===================================================== @@ -684,7 +686,7 @@ class StackTheme { _checkboxBorderEmpty ??= Color(checkboxBorderEmptyInt); @ignore Color? _checkboxBorderEmpty; - final int checkboxBorderEmptyInt; + late final int checkboxBorderEmptyInt; // ==== checkboxBGDisabled ===================================================== @@ -693,7 +695,7 @@ class StackTheme { _checkboxBGDisabled ??= Color(checkboxBGDisabledInt); @ignore Color? _checkboxBGDisabled; - final int checkboxBGDisabledInt; + late final int checkboxBGDisabledInt; // ==== checkboxIconChecked ===================================================== @@ -702,7 +704,7 @@ class StackTheme { _checkboxIconChecked ??= Color(checkboxIconCheckedInt); @ignore Color? _checkboxIconChecked; - final int checkboxIconCheckedInt; + late final int checkboxIconCheckedInt; // ==== checkboxIconDisabled ===================================================== @@ -711,7 +713,7 @@ class StackTheme { _checkboxIconDisabled ??= Color(checkboxIconDisabledInt); @ignore Color? _checkboxIconDisabled; - final int checkboxIconDisabledInt; + late final int checkboxIconDisabledInt; // ==== checkboxTextLabel ===================================================== @@ -720,7 +722,7 @@ class StackTheme { _checkboxTextLabel ??= Color(checkboxTextLabelInt); @ignore Color? _checkboxTextLabel; - final int checkboxTextLabelInt; + late final int checkboxTextLabelInt; // ==== snackBarBackSuccess ===================================================== @@ -729,7 +731,7 @@ class StackTheme { _snackBarBackSuccess ??= Color(snackBarBackSuccessInt); @ignore Color? _snackBarBackSuccess; - final int snackBarBackSuccessInt; + late final int snackBarBackSuccessInt; // ==== snackBarBackError ===================================================== @@ -738,7 +740,7 @@ class StackTheme { _snackBarBackError ??= Color(snackBarBackErrorInt); @ignore Color? _snackBarBackError; - final int snackBarBackErrorInt; + late final int snackBarBackErrorInt; // ==== snackBarBackInfo ===================================================== @@ -747,7 +749,7 @@ class StackTheme { _snackBarBackInfo ??= Color(snackBarBackInfoInt); @ignore Color? _snackBarBackInfo; - final int snackBarBackInfoInt; + late final int snackBarBackInfoInt; // ==== snackBarTextSuccess ===================================================== @@ -756,7 +758,7 @@ class StackTheme { _snackBarTextSuccess ??= Color(snackBarTextSuccessInt); @ignore Color? _snackBarTextSuccess; - final int snackBarTextSuccessInt; + late final int snackBarTextSuccessInt; // ==== snackBarTextError ===================================================== @@ -765,7 +767,7 @@ class StackTheme { _snackBarTextError ??= Color(snackBarTextErrorInt); @ignore Color? _snackBarTextError; - final int snackBarTextErrorInt; + late final int snackBarTextErrorInt; // ==== snackBarTextInfo ===================================================== @@ -774,7 +776,7 @@ class StackTheme { _snackBarTextInfo ??= Color(snackBarTextInfoInt); @ignore Color? _snackBarTextInfo; - final int snackBarTextInfoInt; + late final int snackBarTextInfoInt; // ==== bottomNavIconBack ===================================================== @@ -783,7 +785,7 @@ class StackTheme { _bottomNavIconBack ??= Color(bottomNavIconBackInt); @ignore Color? _bottomNavIconBack; - final int bottomNavIconBackInt; + late final int bottomNavIconBackInt; // ==== bottomNavIconIcon ===================================================== @@ -792,7 +794,7 @@ class StackTheme { _bottomNavIconIcon ??= Color(bottomNavIconIconInt); @ignore Color? _bottomNavIconIcon; - final int bottomNavIconIconInt; + late final int bottomNavIconIconInt; // ==== bottomNavIconIcon highlighted ===================================================== @@ -801,7 +803,7 @@ class StackTheme { _bottomNavIconIconHighlighted ??= Color(bottomNavIconIconHighlightedInt); @ignore Color? _bottomNavIconIconHighlighted; - final int bottomNavIconIconHighlightedInt; + late final int bottomNavIconIconHighlightedInt; // ==== topNavIconPrimary ===================================================== @@ -810,7 +812,7 @@ class StackTheme { _topNavIconPrimary ??= Color(topNavIconPrimaryInt); @ignore Color? _topNavIconPrimary; - final int topNavIconPrimaryInt; + late final int topNavIconPrimaryInt; // ==== topNavIconGreen ===================================================== @@ -818,7 +820,7 @@ class StackTheme { Color get topNavIconGreen => _topNavIconGreen ??= Color(topNavIconGreenInt); @ignore Color? _topNavIconGreen; - final int topNavIconGreenInt; + late final int topNavIconGreenInt; // ==== topNavIconYellow ===================================================== @@ -827,7 +829,7 @@ class StackTheme { _topNavIconYellow ??= Color(topNavIconYellowInt); @ignore Color? _topNavIconYellow; - final int topNavIconYellowInt; + late final int topNavIconYellowInt; // ==== topNavIconRed ===================================================== @@ -835,7 +837,7 @@ class StackTheme { Color get topNavIconRed => _topNavIconRed ??= Color(topNavIconRedInt); @ignore Color? _topNavIconRed; - final int topNavIconRedInt; + late final int topNavIconRedInt; // ==== settingsIconBack ===================================================== @@ -844,7 +846,7 @@ class StackTheme { _settingsIconBack ??= Color(settingsIconBackInt); @ignore Color? _settingsIconBack; - final int settingsIconBackInt; + late final int settingsIconBackInt; // ==== settingsIconIcon ===================================================== @@ -853,7 +855,7 @@ class StackTheme { _settingsIconIcon ??= Color(settingsIconIconInt); @ignore Color? _settingsIconIcon; - final int settingsIconIconInt; + late final int settingsIconIconInt; // ==== settingsIconBack2 ===================================================== @@ -862,7 +864,7 @@ class StackTheme { _settingsIconBack2 ??= Color(settingsIconBack2Int); @ignore Color? _settingsIconBack2; - final int settingsIconBack2Int; + late final int settingsIconBack2Int; // ==== settingsIconElement ===================================================== @@ -871,7 +873,7 @@ class StackTheme { _settingsIconElement ??= Color(settingsIconElementInt); @ignore Color? _settingsIconElement; - final int settingsIconElementInt; + late final int settingsIconElementInt; // ==== textFieldActiveBG ===================================================== @@ -880,7 +882,7 @@ class StackTheme { _textFieldActiveBG ??= Color(textFieldActiveBGInt); @ignore Color? _textFieldActiveBG; - final int textFieldActiveBGInt; + late final int textFieldActiveBGInt; // ==== textFieldDefaultBG ===================================================== @@ -889,7 +891,7 @@ class StackTheme { _textFieldDefaultBG ??= Color(textFieldDefaultBGInt); @ignore Color? _textFieldDefaultBG; - final int textFieldDefaultBGInt; + late final int textFieldDefaultBGInt; // ==== textFieldErrorBG ===================================================== @@ -898,7 +900,7 @@ class StackTheme { _textFieldErrorBG ??= Color(textFieldErrorBGInt); @ignore Color? _textFieldErrorBG; - final int textFieldErrorBGInt; + late final int textFieldErrorBGInt; // ==== textFieldSuccessBG ===================================================== @@ -907,7 +909,7 @@ class StackTheme { _textFieldSuccessBG ??= Color(textFieldSuccessBGInt); @ignore Color? _textFieldSuccessBG; - final int textFieldSuccessBGInt; + late final int textFieldSuccessBGInt; // ==== textFieldErrorBorder ===================================================== @@ -916,7 +918,7 @@ class StackTheme { _textFieldErrorBorder ??= Color(textFieldErrorBorderInt); @ignore Color? _textFieldErrorBorder; - final int textFieldErrorBorderInt; + late final int textFieldErrorBorderInt; // ==== textFieldSuccessBorder ===================================================== @@ -925,7 +927,7 @@ class StackTheme { _textFieldSuccessBorder ??= Color(textFieldSuccessBorderInt); @ignore Color? _textFieldSuccessBorder; - final int textFieldSuccessBorderInt; + late final int textFieldSuccessBorderInt; // ==== textFieldActiveSearchIconLeft ===================================================== @@ -934,7 +936,7 @@ class StackTheme { Color(textFieldActiveSearchIconLeftInt); @ignore Color? _textFieldActiveSearchIconLeft; - final int textFieldActiveSearchIconLeftInt; + late final int textFieldActiveSearchIconLeftInt; // ==== textFieldDefaultSearchIconLeft ===================================================== @@ -944,7 +946,7 @@ class StackTheme { Color(textFieldDefaultSearchIconLeftInt); @ignore Color? _textFieldDefaultSearchIconLeft; - final int textFieldDefaultSearchIconLeftInt; + late final int textFieldDefaultSearchIconLeftInt; // ==== textFieldErrorSearchIconLeft ===================================================== @@ -953,7 +955,7 @@ class StackTheme { _textFieldErrorSearchIconLeft ??= Color(textFieldErrorSearchIconLeftInt); @ignore Color? _textFieldErrorSearchIconLeft; - final int textFieldErrorSearchIconLeftInt; + late final int textFieldErrorSearchIconLeftInt; // ==== textFieldSuccessSearchIconLeft ===================================================== @@ -963,7 +965,7 @@ class StackTheme { Color(textFieldSuccessSearchIconLeftInt); @ignore Color? _textFieldSuccessSearchIconLeft; - final int textFieldSuccessSearchIconLeftInt; + late final int textFieldSuccessSearchIconLeftInt; // ==== textFieldActiveText ===================================================== @@ -972,7 +974,7 @@ class StackTheme { _textFieldActiveText ??= Color(textFieldActiveTextInt); @ignore Color? _textFieldActiveText; - final int textFieldActiveTextInt; + late final int textFieldActiveTextInt; // ==== textFieldDefaultText ===================================================== @@ -981,7 +983,7 @@ class StackTheme { _textFieldDefaultText ??= Color(textFieldDefaultTextInt); @ignore Color? _textFieldDefaultText; - final int textFieldDefaultTextInt; + late final int textFieldDefaultTextInt; // ==== textFieldErrorText ===================================================== @@ -990,7 +992,7 @@ class StackTheme { _textFieldErrorText ??= Color(textFieldErrorTextInt); @ignore Color? _textFieldErrorText; - final int textFieldErrorTextInt; + late final int textFieldErrorTextInt; // ==== textFieldSuccessText ===================================================== @@ -999,7 +1001,7 @@ class StackTheme { _textFieldSuccessText ??= Color(textFieldSuccessTextInt); @ignore Color? _textFieldSuccessText; - final int textFieldSuccessTextInt; + late final int textFieldSuccessTextInt; // ==== textFieldActiveLabel ===================================================== @@ -1008,7 +1010,7 @@ class StackTheme { _textFieldActiveLabel ??= Color(textFieldActiveLabelInt); @ignore Color? _textFieldActiveLabel; - final int textFieldActiveLabelInt; + late final int textFieldActiveLabelInt; // ==== textFieldErrorLabel ===================================================== @@ -1017,7 +1019,7 @@ class StackTheme { _textFieldErrorLabel ??= Color(textFieldErrorLabelInt); @ignore Color? _textFieldErrorLabel; - final int textFieldErrorLabelInt; + late final int textFieldErrorLabelInt; // ==== textFieldSuccessLabel ===================================================== @@ -1026,7 +1028,7 @@ class StackTheme { _textFieldSuccessLabel ??= Color(textFieldSuccessLabelInt); @ignore Color? _textFieldSuccessLabel; - final int textFieldSuccessLabelInt; + late final int textFieldSuccessLabelInt; // ==== textFieldActiveSearchIconRight ===================================================== @@ -1036,7 +1038,7 @@ class StackTheme { Color(textFieldActiveSearchIconRightInt); @ignore Color? _textFieldActiveSearchIconRight; - final int textFieldActiveSearchIconRightInt; + late final int textFieldActiveSearchIconRightInt; // ==== textFieldDefaultSearchIconRight ===================================================== @@ -1046,7 +1048,7 @@ class StackTheme { Color(textFieldDefaultSearchIconRightInt); @ignore Color? _textFieldDefaultSearchIconRight; - final int textFieldDefaultSearchIconRightInt; + late final int textFieldDefaultSearchIconRightInt; // ==== textFieldErrorSearchIconRight ===================================================== @@ -1055,7 +1057,7 @@ class StackTheme { Color(textFieldErrorSearchIconRightInt); @ignore Color? _textFieldErrorSearchIconRight; - final int textFieldErrorSearchIconRightInt; + late final int textFieldErrorSearchIconRightInt; // ==== textFieldSuccessSearchIconRight ===================================================== @@ -1065,7 +1067,7 @@ class StackTheme { Color(textFieldSuccessSearchIconRightInt); @ignore Color? _textFieldSuccessSearchIconRight; - final int textFieldSuccessSearchIconRightInt; + late final int textFieldSuccessSearchIconRightInt; // ==== settingsItem2ActiveBG ===================================================== @@ -1074,7 +1076,7 @@ class StackTheme { _settingsItem2ActiveBG ??= Color(settingsItem2ActiveBGInt); @ignore Color? _settingsItem2ActiveBG; - final int settingsItem2ActiveBGInt; + late final int settingsItem2ActiveBGInt; // ==== settingsItem2ActiveText ===================================================== @@ -1083,7 +1085,7 @@ class StackTheme { _settingsItem2ActiveText ??= Color(settingsItem2ActiveTextInt); @ignore Color? _settingsItem2ActiveText; - final int settingsItem2ActiveTextInt; + late final int settingsItem2ActiveTextInt; // ==== settingsItem2ActiveSub ===================================================== @@ -1092,7 +1094,7 @@ class StackTheme { _settingsItem2ActiveSub ??= Color(settingsItem2ActiveSubInt); @ignore Color? _settingsItem2ActiveSub; - final int settingsItem2ActiveSubInt; + late final int settingsItem2ActiveSubInt; // ==== radioButtonIconBorder ===================================================== @@ -1101,7 +1103,7 @@ class StackTheme { _radioButtonIconBorder ??= Color(radioButtonIconBorderInt); @ignore Color? _radioButtonIconBorder; - final int radioButtonIconBorderInt; + late final int radioButtonIconBorderInt; // ==== radioButtonIconBorderDisabled ===================================================== @@ -1110,7 +1112,7 @@ class StackTheme { Color(radioButtonIconBorderDisabledInt); @ignore Color? _radioButtonIconBorderDisabled; - final int radioButtonIconBorderDisabledInt; + late final int radioButtonIconBorderDisabledInt; // ==== radioButtonBorderEnabled ===================================================== @@ -1119,7 +1121,7 @@ class StackTheme { _radioButtonBorderEnabled ??= Color(radioButtonBorderEnabledInt); @ignore Color? _radioButtonBorderEnabled; - final int radioButtonBorderEnabledInt; + late final int radioButtonBorderEnabledInt; // ==== radioButtonBorderDisabled ===================================================== @@ -1128,7 +1130,7 @@ class StackTheme { _radioButtonBorderDisabled ??= Color(radioButtonBorderDisabledInt); @ignore Color? _radioButtonBorderDisabled; - final int radioButtonBorderDisabledInt; + late final int radioButtonBorderDisabledInt; // ==== radioButtonIconCircle ===================================================== @@ -1137,7 +1139,7 @@ class StackTheme { _radioButtonIconCircle ??= Color(radioButtonIconCircleInt); @ignore Color? _radioButtonIconCircle; - final int radioButtonIconCircleInt; + late final int radioButtonIconCircleInt; // ==== radioButtonIconEnabled ===================================================== @@ -1146,7 +1148,7 @@ class StackTheme { _radioButtonIconEnabled ??= Color(radioButtonIconEnabledInt); @ignore Color? _radioButtonIconEnabled; - final int radioButtonIconEnabledInt; + late final int radioButtonIconEnabledInt; // ==== radioButtonTextEnabled ===================================================== @@ -1155,7 +1157,7 @@ class StackTheme { _radioButtonTextEnabled ??= Color(radioButtonTextEnabledInt); @ignore Color? _radioButtonTextEnabled; - final int radioButtonTextEnabledInt; + late final int radioButtonTextEnabledInt; // ==== radioButtonTextDisabled ===================================================== @@ -1164,7 +1166,7 @@ class StackTheme { _radioButtonTextDisabled ??= Color(radioButtonTextDisabledInt); @ignore Color? _radioButtonTextDisabled; - final int radioButtonTextDisabledInt; + late final int radioButtonTextDisabledInt; // ==== radioButtonLabelEnabled ===================================================== @@ -1173,7 +1175,7 @@ class StackTheme { _radioButtonLabelEnabled ??= Color(radioButtonLabelEnabledInt); @ignore Color? _radioButtonLabelEnabled; - final int radioButtonLabelEnabledInt; + late final int radioButtonLabelEnabledInt; // ==== radioButtonLabelDisabled ===================================================== @@ -1182,7 +1184,7 @@ class StackTheme { _radioButtonLabelDisabled ??= Color(radioButtonLabelDisabledInt); @ignore Color? _radioButtonLabelDisabled; - final int radioButtonLabelDisabledInt; + late final int radioButtonLabelDisabledInt; // ==== infoItemBG ===================================================== @@ -1190,7 +1192,7 @@ class StackTheme { Color get infoItemBG => _infoItemBG ??= Color(infoItemBGInt); @ignore Color? _infoItemBG; - final int infoItemBGInt; + late final int infoItemBGInt; // ==== infoItemLabel ===================================================== @@ -1198,7 +1200,7 @@ class StackTheme { Color get infoItemLabel => _infoItemLabel ??= Color(infoItemLabelInt); @ignore Color? _infoItemLabel; - final int infoItemLabelInt; + late final int infoItemLabelInt; // ==== infoItemText ===================================================== @@ -1206,7 +1208,7 @@ class StackTheme { Color get infoItemText => _infoItemText ??= Color(infoItemTextInt); @ignore Color? _infoItemText; - final int infoItemTextInt; + late final int infoItemTextInt; // ==== infoItemIcons ===================================================== @@ -1214,7 +1216,7 @@ class StackTheme { Color get infoItemIcons => _infoItemIcons ??= Color(infoItemIconsInt); @ignore Color? _infoItemIcons; - final int infoItemIconsInt; + late final int infoItemIconsInt; // ==== popupBG ===================================================== @@ -1222,7 +1224,7 @@ class StackTheme { Color get popupBG => _popupBG ??= Color(popupBGInt); @ignore Color? _popupBG; - final int popupBGInt; + late final int popupBGInt; // ==== currencyListItemBG ===================================================== @@ -1231,7 +1233,7 @@ class StackTheme { _currencyListItemBG ??= Color(currencyListItemBGInt); @ignore Color? _currencyListItemBG; - final int currencyListItemBGInt; + late final int currencyListItemBGInt; // ==== stackWalletBG ===================================================== @@ -1239,7 +1241,7 @@ class StackTheme { Color get stackWalletBG => _stackWalletBG ??= Color(stackWalletBGInt); @ignore Color? _stackWalletBG; - final int stackWalletBGInt; + late final int stackWalletBGInt; // ==== stackWalletMid ===================================================== @@ -1247,7 +1249,7 @@ class StackTheme { Color get stackWalletMid => _stackWalletMid ??= Color(stackWalletMidInt); @ignore Color? _stackWalletMid; - final int stackWalletMidInt; + late final int stackWalletMidInt; // ==== stackWalletBottom ===================================================== @@ -1256,7 +1258,7 @@ class StackTheme { _stackWalletBottom ??= Color(stackWalletBottomInt); @ignore Color? _stackWalletBottom; - final int stackWalletBottomInt; + late final int stackWalletBottomInt; // ==== bottomNavShadow ===================================================== @@ -1264,7 +1266,7 @@ class StackTheme { Color get bottomNavShadow => _bottomNavShadow ??= Color(bottomNavShadowInt); @ignore Color? _bottomNavShadow; - final int bottomNavShadowInt; + late final int bottomNavShadowInt; // ==== favoriteStarActive ===================================================== @@ -1273,7 +1275,7 @@ class StackTheme { _favoriteStarActive ??= Color(favoriteStarActiveInt); @ignore Color? _favoriteStarActive; - final int favoriteStarActiveInt; + late final int favoriteStarActiveInt; // ==== favoriteStarInactive ===================================================== @@ -1282,7 +1284,7 @@ class StackTheme { _favoriteStarInactive ??= Color(favoriteStarInactiveInt); @ignore Color? _favoriteStarInactive; - final int favoriteStarInactiveInt; + late final int favoriteStarInactiveInt; // ==== splash ===================================================== @@ -1290,7 +1292,7 @@ class StackTheme { Color get splash => _splash ??= Color(splashInt); @ignore Color? _splash; - final int splashInt; + late final int splashInt; // ==== highlight ===================================================== @@ -1298,7 +1300,7 @@ class StackTheme { Color get highlight => _highlight ??= Color(highlightInt); @ignore Color? _highlight; - final int highlightInt; + late final int highlightInt; // ==== warningForeground ===================================================== @@ -1307,7 +1309,7 @@ class StackTheme { _warningForeground ??= Color(warningForegroundInt); @ignore Color? _warningForeground; - final int warningForegroundInt; + late final int warningForegroundInt; // ==== warningBackground ===================================================== @@ -1316,7 +1318,7 @@ class StackTheme { _warningBackground ??= Color(warningBackgroundInt); @ignore Color? _warningBackground; - final int warningBackgroundInt; + late final int warningBackgroundInt; // ==== loadingOverlayTextColor ===================================================== @@ -1325,7 +1327,7 @@ class StackTheme { _loadingOverlayTextColor ??= Color(loadingOverlayTextColorInt); @ignore Color? _loadingOverlayTextColor; - final int loadingOverlayTextColorInt; + late final int loadingOverlayTextColorInt; // ==== myStackContactIconBG ===================================================== @@ -1334,7 +1336,7 @@ class StackTheme { _myStackContactIconBG ??= Color(myStackContactIconBGInt); @ignore Color? _myStackContactIconBG; - final int myStackContactIconBGInt; + late final int myStackContactIconBGInt; // ==== textConfirmTotalAmount ===================================================== @@ -1343,7 +1345,7 @@ class StackTheme { _textConfirmTotalAmount ??= Color(textConfirmTotalAmountInt); @ignore Color? _textConfirmTotalAmount; - final int textConfirmTotalAmountInt; + late final int textConfirmTotalAmountInt; // ==== textSelectedWordTableItem ===================================================== @@ -1352,7 +1354,7 @@ class StackTheme { _textSelectedWordTableItem ??= Color(textSelectedWordTableItemInt); @ignore Color? _textSelectedWordTableItem; - final int textSelectedWordTableItemInt; + late final int textSelectedWordTableItemInt; // ==== rateTypeToggleColorOn ===================================================== @@ -1361,7 +1363,7 @@ class StackTheme { _rateTypeToggleColorOn ??= Color(rateTypeToggleColorOnInt); @ignore Color? _rateTypeToggleColorOn; - final int rateTypeToggleColorOnInt; + late final int rateTypeToggleColorOnInt; // ==== rateTypeToggleColorOff ===================================================== @@ -1370,7 +1372,7 @@ class StackTheme { _rateTypeToggleColorOff ??= Color(rateTypeToggleColorOffInt); @ignore Color? _rateTypeToggleColorOff; - final int rateTypeToggleColorOffInt; + late final int rateTypeToggleColorOffInt; // ==== rateTypeToggleDesktopColorOn ===================================================== @@ -1379,7 +1381,7 @@ class StackTheme { _rateTypeToggleDesktopColorOn ??= Color(rateTypeToggleDesktopColorOnInt); @ignore Color? _rateTypeToggleDesktopColorOn; - final int rateTypeToggleDesktopColorOnInt; + late final int rateTypeToggleDesktopColorOnInt; // ==== rateTypeToggleDesktopColorOff ===================================================== @@ -1388,7 +1390,7 @@ class StackTheme { Color(rateTypeToggleDesktopColorOffInt); @ignore Color? _rateTypeToggleDesktopColorOff; - final int rateTypeToggleDesktopColorOffInt; + late final int rateTypeToggleDesktopColorOffInt; // ==== ethTagText ===================================================== @@ -1396,7 +1398,7 @@ class StackTheme { Color get ethTagText => _ethTagText ??= Color(ethTagTextInt); @ignore Color? _ethTagText; - final int ethTagTextInt; + late final int ethTagTextInt; // ==== ethTagBG ===================================================== @@ -1404,7 +1406,7 @@ class StackTheme { Color get ethTagBG => _ethTagBG ??= Color(ethTagBGInt); @ignore Color? _ethTagBG; - final int ethTagBGInt; + late final int ethTagBGInt; // ==== ethWalletTagText ===================================================== @@ -1413,7 +1415,7 @@ class StackTheme { _ethWalletTagText ??= Color(ethWalletTagTextInt); @ignore Color? _ethWalletTagText; - final int ethWalletTagTextInt; + late final int ethWalletTagTextInt; // ==== ethWalletTagBG ===================================================== @@ -1421,7 +1423,7 @@ class StackTheme { Color get ethWalletTagBG => _ethWalletTagBG ??= Color(ethWalletTagBGInt); @ignore Color? _ethWalletTagBG; - final int ethWalletTagBGInt; + late final int ethWalletTagBGInt; // ==== tokenSummaryTextPrimary ===================================================== @@ -1430,7 +1432,7 @@ class StackTheme { _tokenSummaryTextPrimary ??= Color(tokenSummaryTextPrimaryInt); @ignore Color? _tokenSummaryTextPrimary; - final int tokenSummaryTextPrimaryInt; + late final int tokenSummaryTextPrimaryInt; // ==== tokenSummaryTextSecondary ===================================================== @@ -1439,7 +1441,7 @@ class StackTheme { _tokenSummaryTextSecondary ??= Color(tokenSummaryTextSecondaryInt); @ignore Color? _tokenSummaryTextSecondary; - final int tokenSummaryTextSecondaryInt; + late final int tokenSummaryTextSecondaryInt; // ==== tokenSummaryBG ===================================================== @@ -1447,7 +1449,7 @@ class StackTheme { Color get tokenSummaryBG => _tokenSummaryBG ??= Color(tokenSummaryBGInt); @ignore Color? _tokenSummaryBG; - final int tokenSummaryBGInt; + late final int tokenSummaryBGInt; // ==== tokenSummaryButtonBG ===================================================== @@ -1456,7 +1458,7 @@ class StackTheme { _tokenSummaryButtonBG ??= Color(tokenSummaryButtonBGInt); @ignore Color? _tokenSummaryButtonBG; - final int tokenSummaryButtonBGInt; + late final int tokenSummaryButtonBGInt; // ==== tokenSummaryIcon ===================================================== @@ -1465,7 +1467,7 @@ class StackTheme { _tokenSummaryIcon ??= Color(tokenSummaryIconInt); @ignore Color? _tokenSummaryIcon; - final int tokenSummaryIconInt; + late final int tokenSummaryIconInt; // ==== coinColors ===================================================== @@ -1474,478 +1476,348 @@ class StackTheme { _coinColors ??= parseCoinColors(coinColorsJsonString); @ignore Map? _coinColors; - final String coinColorsJsonString; + late final String coinColorsJsonString; // ==== assets ===================================================== - final ThemeAssets assets; + @Name("assets") // legacy "column" name + late final ThemeAssets? assetsV1; + + late final ThemeAssetsV2? assetsV2; + + // cheat build runner into adding this at end of property id list in isar + @Name("zAssetsV3") + late final ThemeAssetsV3? assetsV3; + + @ignore + IThemeAssets get assets => assetsV3 ?? assetsV2 ?? assetsV1!; // =========================================================================== - StackTheme({ - required this.themeId, - required this.name, - required this.assets, - required this.brightnessString, - required this.backgroundInt, - required this.backgroundAppBarInt, - required this.gradientBackgroundString, - required this.standardBoxShadowString, - required this.homeViewButtonBarBoxShadowString, - required this.overlayInt, - required this.accentColorBlueInt, - required this.accentColorGreenInt, - required this.accentColorYellowInt, - required this.accentColorRedInt, - required this.accentColorOrangeInt, - required this.accentColorDarkInt, - required this.shadowInt, - required this.textDarkInt, - required this.textDark2Int, - required this.textDark3Int, - required this.textSubtitle1Int, - required this.textSubtitle2Int, - required this.textSubtitle3Int, - required this.textSubtitle4Int, - required this.textSubtitle5Int, - required this.textSubtitle6Int, - required this.textWhiteInt, - required this.textFavoriteCardInt, - required this.textErrorInt, - required this.textRestoreInt, - required this.buttonBackPrimaryInt, - required this.buttonBackSecondaryInt, - required this.buttonBackPrimaryDisabledInt, - required this.buttonBackSecondaryDisabledInt, - required this.buttonBackBorderInt, - required this.buttonBackBorderDisabledInt, - required this.buttonBackBorderSecondaryInt, - required this.buttonBackBorderSecondaryDisabledInt, - required this.numberBackDefaultInt, - required this.numpadBackDefaultInt, - required this.bottomNavBackInt, - required this.buttonTextPrimaryInt, - required this.buttonTextSecondaryInt, - required this.buttonTextPrimaryDisabledInt, - required this.buttonTextSecondaryDisabledInt, - required this.buttonTextBorderInt, - required this.buttonTextDisabledInt, - required this.buttonTextBorderlessInt, - required this.buttonTextBorderlessDisabledInt, - required this.numberTextDefaultInt, - required this.numpadTextDefaultInt, - required this.bottomNavTextInt, - required this.customTextButtonEnabledTextInt, - required this.customTextButtonDisabledTextInt, - required this.switchBGOnInt, - required this.switchBGOffInt, - required this.switchBGDisabledInt, - required this.switchCircleOnInt, - required this.switchCircleOffInt, - required this.switchCircleDisabledInt, - required this.stepIndicatorBGCheckInt, - required this.stepIndicatorBGNumberInt, - required this.stepIndicatorBGInactiveInt, - required this.stepIndicatorBGLinesInt, - required this.stepIndicatorBGLinesInactiveInt, - required this.stepIndicatorIconTextInt, - required this.stepIndicatorIconNumberInt, - required this.stepIndicatorIconInactiveInt, - required this.checkboxBGCheckedInt, - required this.checkboxBorderEmptyInt, - required this.checkboxBGDisabledInt, - required this.checkboxIconCheckedInt, - required this.checkboxIconDisabledInt, - required this.checkboxTextLabelInt, - required this.snackBarBackSuccessInt, - required this.snackBarBackErrorInt, - required this.snackBarBackInfoInt, - required this.snackBarTextSuccessInt, - required this.snackBarTextErrorInt, - required this.snackBarTextInfoInt, - required this.bottomNavIconBackInt, - required this.bottomNavIconIconInt, - required this.bottomNavIconIconHighlightedInt, - required this.topNavIconPrimaryInt, - required this.topNavIconGreenInt, - required this.topNavIconYellowInt, - required this.topNavIconRedInt, - required this.settingsIconBackInt, - required this.settingsIconIconInt, - required this.settingsIconBack2Int, - required this.settingsIconElementInt, - required this.textFieldActiveBGInt, - required this.textFieldDefaultBGInt, - required this.textFieldErrorBGInt, - required this.textFieldSuccessBGInt, - required this.textFieldErrorBorderInt, - required this.textFieldSuccessBorderInt, - required this.textFieldActiveSearchIconLeftInt, - required this.textFieldDefaultSearchIconLeftInt, - required this.textFieldErrorSearchIconLeftInt, - required this.textFieldSuccessSearchIconLeftInt, - required this.textFieldActiveTextInt, - required this.textFieldDefaultTextInt, - required this.textFieldErrorTextInt, - required this.textFieldSuccessTextInt, - required this.textFieldActiveLabelInt, - required this.textFieldErrorLabelInt, - required this.textFieldSuccessLabelInt, - required this.textFieldActiveSearchIconRightInt, - required this.textFieldDefaultSearchIconRightInt, - required this.textFieldErrorSearchIconRightInt, - required this.textFieldSuccessSearchIconRightInt, - required this.settingsItem2ActiveBGInt, - required this.settingsItem2ActiveTextInt, - required this.settingsItem2ActiveSubInt, - required this.radioButtonIconBorderInt, - required this.radioButtonIconBorderDisabledInt, - required this.radioButtonBorderEnabledInt, - required this.radioButtonBorderDisabledInt, - required this.radioButtonIconCircleInt, - required this.radioButtonIconEnabledInt, - required this.radioButtonTextEnabledInt, - required this.radioButtonTextDisabledInt, - required this.radioButtonLabelEnabledInt, - required this.radioButtonLabelDisabledInt, - required this.infoItemBGInt, - required this.infoItemLabelInt, - required this.infoItemTextInt, - required this.infoItemIconsInt, - required this.popupBGInt, - required this.currencyListItemBGInt, - required this.stackWalletBGInt, - required this.stackWalletMidInt, - required this.stackWalletBottomInt, - required this.bottomNavShadowInt, - required this.favoriteStarActiveInt, - required this.favoriteStarInactiveInt, - required this.splashInt, - required this.highlightInt, - required this.warningForegroundInt, - required this.warningBackgroundInt, - required this.loadingOverlayTextColorInt, - required this.myStackContactIconBGInt, - required this.textConfirmTotalAmountInt, - required this.textSelectedWordTableItemInt, - required this.rateTypeToggleColorOnInt, - required this.rateTypeToggleColorOffInt, - required this.rateTypeToggleDesktopColorOnInt, - required this.rateTypeToggleDesktopColorOffInt, - required this.ethTagTextInt, - required this.ethTagBGInt, - required this.ethWalletTagTextInt, - required this.ethWalletTagBGInt, - required this.tokenSummaryTextPrimaryInt, - required this.tokenSummaryTextSecondaryInt, - required this.tokenSummaryBGInt, - required this.tokenSummaryButtonBGInt, - required this.tokenSummaryIconInt, - required this.coinColorsJsonString, - }); + late final int? version; + + StackTheme(); factory StackTheme.fromJson({ required Map json, - required String applicationThemesDirectoryPath, }) { - return StackTheme( - themeId: json["id"] as String, - name: json["name"] as String, - brightnessString: json["brightness"] as String, - backgroundInt: parseColor(json["colors"]["background"] as String), - backgroundAppBarInt: - parseColor(json["colors"]["background_app_bar"] as String), - gradientBackgroundString: json["colors"]["gradients"] != null + final version = json["version"] as int? ?? 1; + + return StackTheme() + ..version = version + ..assetsV1 = version == 1 + ? ThemeAssets.fromJson( + json: Map.from(json["assets"] as Map), + themeId: json["id"] as String, + ) + : null + ..assetsV2 = version == 2 + ? ThemeAssetsV2.fromJson( + json: Map.from(json["assets"] as Map), + themeId: json["id"] as String, + ) + : null + ..assetsV3 = version >= 3 + ? ThemeAssetsV3.fromJson( + json: Map.from(json["assets"] as Map), + themeId: json["id"] as String, + ) + : null + ..themeId = json["id"] as String + ..name = json["name"] as String + ..brightnessString = json["brightness"] as String + ..backgroundInt = parseColor(json["colors"]["background"] as String) + ..backgroundAppBarInt = + parseColor(json["colors"]["background_app_bar"] as String) + ..gradientBackgroundString = json["colors"]["gradients"] != null ? jsonEncode(json["colors"]["gradients"]) - : null, - standardBoxShadowString: - jsonEncode(json["colors"]["box_shadows"]["standard"] as Map), - homeViewButtonBarBoxShadowString: + : null + ..standardBoxShadowString = + jsonEncode(json["colors"]["box_shadows"]["standard"] as Map) + ..homeViewButtonBarBoxShadowString = json["colors"]["box_shadows"]["home_view_button_bar"] == null ? null : jsonEncode( - json["colors"]["box_shadows"]["home_view_button_bar"] as Map), - coinColorsJsonString: jsonEncode(json["colors"]['coin'] as Map), - assets: ThemeAssets.fromJson( - json: Map.from(json["assets"] as Map), - applicationThemesDirectoryPath: applicationThemesDirectoryPath, - themeId: json["id"] as String, - ), - overlayInt: parseColor(json["colors"]["overlay"] as String), - accentColorBlueInt: - parseColor(json["colors"]["accent_color_blue"] as String), - accentColorGreenInt: - parseColor(json["colors"]["accent_color_green"] as String), - accentColorYellowInt: - parseColor(json["colors"]["accent_color_yellow"] as String), - accentColorRedInt: - parseColor(json["colors"]["accent_color_red"] as String), - accentColorOrangeInt: - parseColor(json["colors"]["accent_color_orange"] as String), - accentColorDarkInt: - parseColor(json["colors"]["accent_color_dark"] as String), - shadowInt: parseColor(json["colors"]["shadow"] as String), - textDarkInt: parseColor(json["colors"]["text_dark_one"] as String), - textDark2Int: parseColor(json["colors"]["text_dark_two"] as String), - textDark3Int: parseColor(json["colors"]["text_dark_three"] as String), - textWhiteInt: parseColor(json["colors"]["text_white"] as String), - textFavoriteCardInt: - parseColor(json["colors"]["text_favorite"] as String), - textErrorInt: parseColor(json["colors"]["text_error"] as String), - textRestoreInt: parseColor(json["colors"]["text_restore"] as String), - buttonBackPrimaryInt: - parseColor(json["colors"]["button_back_primary"] as String), - buttonBackSecondaryInt: - parseColor(json["colors"]["button_back_secondary"] as String), - buttonBackPrimaryDisabledInt: - parseColor(json["colors"]["button_back_primary_disabled"] as String), - buttonBackSecondaryDisabledInt: parseColor( - json["colors"]["button_back_secondary_disabled"] as String), - buttonBackBorderInt: - parseColor(json["colors"]["button_back_border"] as String), - buttonBackBorderDisabledInt: - parseColor(json["colors"]["button_back_border_disabled"] as String), - buttonBackBorderSecondaryInt: - parseColor(json["colors"]["button_back_border_secondary"] as String), - buttonBackBorderSecondaryDisabledInt: parseColor( - json["colors"]["button_back_border_secondary_disabled"] as String), - numberBackDefaultInt: - parseColor(json["colors"]["number_back_default"] as String), - numpadBackDefaultInt: - parseColor(json["colors"]["numpad_back_default"] as String), - bottomNavBackInt: parseColor(json["colors"]["bottom_nav_back"] as String), - textSubtitle1Int: - parseColor(json["colors"]["text_subtitle_one"] as String), - textSubtitle2Int: - parseColor(json["colors"]["text_subtitle_two"] as String), - textSubtitle3Int: - parseColor(json["colors"]["text_subtitle_three"] as String), - textSubtitle4Int: - parseColor(json["colors"]["text_subtitle_four"] as String), - textSubtitle5Int: - parseColor(json["colors"]["text_subtitle_five"] as String), - textSubtitle6Int: - parseColor(json["colors"]["text_subtitle_six"] as String), - buttonTextPrimaryInt: - parseColor(json["colors"]["button_text_primary"] as String), - buttonTextSecondaryInt: - parseColor(json["colors"]["button_text_secondary"] as String), - buttonTextPrimaryDisabledInt: - parseColor(json["colors"]["button_text_primary_disabled"] as String), - buttonTextSecondaryDisabledInt: parseColor( - json["colors"]["button_text_secondary_disabled"] as String), - buttonTextBorderInt: - parseColor(json["colors"]["button_text_border"] as String), - buttonTextDisabledInt: - parseColor(json["colors"]["button_text_disabled"] as String), - buttonTextBorderlessInt: - parseColor(json["colors"]["button_text_borderless"] as String), - buttonTextBorderlessDisabledInt: parseColor( - json["colors"]["button_text_borderless_disabled"] as String), - numberTextDefaultInt: - parseColor(json["colors"]["number_text_default"] as String), - numpadTextDefaultInt: - parseColor(json["colors"]["numpad_text_default"] as String), - bottomNavTextInt: parseColor(json["colors"]["bottom_nav_text"] as String), - customTextButtonEnabledTextInt: parseColor( - json["colors"]["custom_text_button_enabled_text"] as String), - customTextButtonDisabledTextInt: parseColor( - json["colors"]["custom_text_button_disabled_text"] as String), - switchBGOnInt: parseColor(json["colors"]["switch_bg_on"] as String), - switchBGOffInt: parseColor(json["colors"]["switch_bg_off"] as String), - switchBGDisabledInt: - parseColor(json["colors"]["switch_bg_disabled"] as String), - switchCircleOnInt: - parseColor(json["colors"]["switch_circle_on"] as String), - switchCircleOffInt: - parseColor(json["colors"]["switch_circle_off"] as String), - switchCircleDisabledInt: - parseColor(json["colors"]["switch_circle_disabled"] as String), - stepIndicatorBGCheckInt: - parseColor(json["colors"]["step_indicator_bg_check"] as String), - stepIndicatorBGNumberInt: - parseColor(json["colors"]["step_indicator_bg_number"] as String), - stepIndicatorBGInactiveInt: - parseColor(json["colors"]["step_indicator_bg_inactive"] as String), - stepIndicatorBGLinesInt: - parseColor(json["colors"]["step_indicator_bg_lines"] as String), - stepIndicatorBGLinesInactiveInt: parseColor( - json["colors"]["step_indicator_bg_lines_inactive"] as String), - stepIndicatorIconTextInt: - parseColor(json["colors"]["step_indicator_icon_text"] as String), - stepIndicatorIconNumberInt: - parseColor(json["colors"]["step_indicator_icon_number"] as String), - stepIndicatorIconInactiveInt: - parseColor(json["colors"]["step_indicator_icon_inactive"] as String), - checkboxBGCheckedInt: - parseColor(json["colors"]["checkbox_bg_checked"] as String), - checkboxBorderEmptyInt: - parseColor(json["colors"]["checkbox_border_empty"] as String), - checkboxBGDisabledInt: - parseColor(json["colors"]["checkbox_bg_disabled"] as String), - checkboxIconCheckedInt: - parseColor(json["colors"]["checkbox_icon_checked"] as String), - checkboxIconDisabledInt: - parseColor(json["colors"]["checkbox_icon_disabled"] as String), - checkboxTextLabelInt: - parseColor(json["colors"]["checkbox_text_label"] as String), - snackBarBackSuccessInt: - parseColor(json["colors"]["snack_bar_back_success"] as String), - snackBarBackErrorInt: - parseColor(json["colors"]["snack_bar_back_error"] as String), - snackBarBackInfoInt: - parseColor(json["colors"]["snack_bar_back_info"] as String), - snackBarTextSuccessInt: - parseColor(json["colors"]["snack_bar_text_success"] as String), - snackBarTextErrorInt: - parseColor(json["colors"]["snack_bar_text_error"] as String), - snackBarTextInfoInt: - parseColor(json["colors"]["snack_bar_text_info"] as String), - bottomNavIconBackInt: - parseColor(json["colors"]["bottom_nav_icon_back"] as String), - bottomNavIconIconInt: - parseColor(json["colors"]["bottom_nav_icon_icon"] as String), - bottomNavIconIconHighlightedInt: parseColor( - json["colors"]["bottom_nav_icon_icon_highlighted"] as String), - topNavIconPrimaryInt: - parseColor(json["colors"]["top_nav_icon_primary"] as String), - topNavIconGreenInt: - parseColor(json["colors"]["top_nav_icon_green"] as String), - topNavIconYellowInt: - parseColor(json["colors"]["top_nav_icon_yellow"] as String), - topNavIconRedInt: - parseColor(json["colors"]["top_nav_icon_red"] as String), - settingsIconBackInt: - parseColor(json["colors"]["settings_icon_back"] as String), - settingsIconIconInt: - parseColor(json["colors"]["settings_icon_icon"] as String), - settingsIconBack2Int: - parseColor(json["colors"]["settings_icon_back_two"] as String), - settingsIconElementInt: - parseColor(json["colors"]["settings_icon_element"] as String), - textFieldActiveBGInt: - parseColor(json["colors"]["text_field_active_bg"] as String), - textFieldDefaultBGInt: - parseColor(json["colors"]["text_field_default_bg"] as String), - textFieldErrorBGInt: - parseColor(json["colors"]["text_field_error_bg"] as String), - textFieldSuccessBGInt: - parseColor(json["colors"]["text_field_success_bg"] as String), - textFieldErrorBorderInt: - parseColor(json["colors"]["text_field_error_border"] as String), - textFieldSuccessBorderInt: - parseColor(json["colors"]["text_field_success_border"] as String), - textFieldActiveSearchIconLeftInt: parseColor( - json["colors"]["text_field_active_search_icon_left"] as String), - textFieldDefaultSearchIconLeftInt: parseColor( - json["colors"]["text_field_default_search_icon_left"] as String), - textFieldErrorSearchIconLeftInt: parseColor( - json["colors"]["text_field_error_search_icon_left"] as String), - textFieldSuccessSearchIconLeftInt: parseColor( - json["colors"]["text_field_success_search_icon_left"] as String), - textFieldActiveTextInt: - parseColor(json["colors"]["text_field_active_text"] as String), - textFieldDefaultTextInt: - parseColor(json["colors"]["text_field_default_text"] as String), - textFieldErrorTextInt: - parseColor(json["colors"]["text_field_error_text"] as String), - textFieldSuccessTextInt: - parseColor(json["colors"]["text_field_success_text"] as String), - textFieldActiveLabelInt: - parseColor(json["colors"]["text_field_active_label"] as String), - textFieldErrorLabelInt: - parseColor(json["colors"]["text_field_error_label"] as String), - textFieldSuccessLabelInt: - parseColor(json["colors"]["text_field_success_label"] as String), - textFieldActiveSearchIconRightInt: parseColor( - json["colors"]["text_field_active_search_icon_right"] as String), - textFieldDefaultSearchIconRightInt: parseColor( - json["colors"]["text_field_default_search_icon_right"] as String), - textFieldErrorSearchIconRightInt: parseColor( - json["colors"]["text_field_error_search_icon_right"] as String), - textFieldSuccessSearchIconRightInt: parseColor( - json["colors"]["text_field_success_search_icon_right"] as String), - settingsItem2ActiveBGInt: parseColor( - json["colors"]["settings_item_level_two_active_bg"] as String), - settingsItem2ActiveTextInt: parseColor( - json["colors"]["settings_item_level_two_active_text"] as String), - settingsItem2ActiveSubInt: parseColor( - json["colors"]["settings_item_level_two_active_sub"] as String), - radioButtonIconBorderInt: - parseColor(json["colors"]["radio_button_icon_border"] as String), - radioButtonIconBorderDisabledInt: parseColor( - json["colors"]["radio_button_icon_border_disabled"] as String), - radioButtonBorderEnabledInt: - parseColor(json["colors"]["radio_button_border_enabled"] as String), - radioButtonBorderDisabledInt: - parseColor(json["colors"]["radio_button_border_disabled"] as String), - radioButtonIconCircleInt: - parseColor(json["colors"]["radio_button_icon_circle"] as String), - radioButtonIconEnabledInt: - parseColor(json["colors"]["radio_button_icon_enabled"] as String), - radioButtonTextEnabledInt: - parseColor(json["colors"]["radio_button_text_enabled"] as String), - radioButtonTextDisabledInt: - parseColor(json["colors"]["radio_button_text_disabled"] as String), - radioButtonLabelEnabledInt: - parseColor(json["colors"]["radio_button_label_enabled"] as String), - radioButtonLabelDisabledInt: - parseColor(json["colors"]["radio_button_label_disabled"] as String), - infoItemBGInt: parseColor(json["colors"]["info_item_bg"] as String), - infoItemLabelInt: parseColor(json["colors"]["info_item_label"] as String), - infoItemTextInt: parseColor(json["colors"]["info_item_text"] as String), - infoItemIconsInt: parseColor(json["colors"]["info_item_icons"] as String), - popupBGInt: parseColor(json["colors"]["popup_bg"] as String), - currencyListItemBGInt: - parseColor(json["colors"]["currency_list_item_bg"] as String), - stackWalletBGInt: parseColor(json["colors"]["sw_bg"] as String), - stackWalletMidInt: parseColor(json["colors"]["sw_mid"] as String), - stackWalletBottomInt: parseColor(json["colors"]["sw_bottom"] as String), - bottomNavShadowInt: - parseColor(json["colors"]["bottom_nav_shadow"] as String), - splashInt: parseColor(json["colors"]["splash"] as String), - highlightInt: parseColor(json["colors"]["highlight"] as String), - warningForegroundInt: - parseColor(json["colors"]["warning_foreground"] as String), - warningBackgroundInt: - parseColor(json["colors"]["warning_background"] as String), - loadingOverlayTextColorInt: - parseColor(json["colors"]["loading_overlay_text_color"] as String), - myStackContactIconBGInt: - parseColor(json["colors"]["my_stack_contact_icon_bg"] as String), - textConfirmTotalAmountInt: - parseColor(json["colors"]["text_confirm_total_amount"] as String), - textSelectedWordTableItemInt: parseColor( - json["colors"]["text_selected_word_table_iterm"] as String), - favoriteStarActiveInt: - parseColor(json["colors"]["favorite_star_active"] as String), - favoriteStarInactiveInt: - parseColor(json["colors"]["favorite_star_inactive"] as String), - rateTypeToggleColorOnInt: - parseColor(json["colors"]["rate_type_toggle_color_on"] as String), - rateTypeToggleColorOffInt: - parseColor(json["colors"]["rate_type_toggle_color_off"] as String), - rateTypeToggleDesktopColorOnInt: parseColor( - json["colors"]["rate_type_toggle_desktop_color_on"] as String), - rateTypeToggleDesktopColorOffInt: parseColor( - json["colors"]["rate_type_toggle_desktop_color_off"] as String), - ethTagTextInt: parseColor(json["colors"]["eth_tag_text"] as String), - ethTagBGInt: parseColor(json["colors"]["eth_tag_bg"] as String), - ethWalletTagTextInt: - parseColor(json["colors"]["eth_wallet_tag_text"] as String), - ethWalletTagBGInt: - parseColor(json["colors"]["eth_wallet_tag_bg"] as String), - tokenSummaryTextPrimaryInt: - parseColor(json["colors"]["token_summary_text_primary"] as String), - tokenSummaryTextSecondaryInt: - parseColor(json["colors"]["token_summary_text_secondary"] as String), - tokenSummaryBGInt: - parseColor(json["colors"]["token_summary_bg"] as String), - tokenSummaryButtonBGInt: - parseColor(json["colors"]["token_summary_button_bg"] as String), - tokenSummaryIconInt: - parseColor(json["colors"]["token_summary_icon"] as String), - ); + json["colors"]["box_shadows"]["home_view_button_bar"] as Map) + ..coinColorsJsonString = jsonEncode(json["colors"]['coin'] as Map) + ..overlayInt = parseColor(json["colors"]["overlay"] as String) + ..accentColorBlueInt = + parseColor(json["colors"]["accent_color_blue"] as String) + ..accentColorGreenInt = + parseColor(json["colors"]["accent_color_green"] as String) + ..accentColorYellowInt = + parseColor(json["colors"]["accent_color_yellow"] as String) + ..accentColorRedInt = + parseColor(json["colors"]["accent_color_red"] as String) + ..accentColorOrangeInt = + parseColor(json["colors"]["accent_color_orange"] as String) + ..accentColorDarkInt = + parseColor(json["colors"]["accent_color_dark"] as String) + ..shadowInt = parseColor(json["colors"]["shadow"] as String) + ..textDarkInt = parseColor(json["colors"]["text_dark_one"] as String) + ..textDark2Int = parseColor(json["colors"]["text_dark_two"] as String) + ..textDark3Int = parseColor(json["colors"]["text_dark_three"] as String) + ..textWhiteInt = parseColor(json["colors"]["text_white"] as String) + ..textFavoriteCardInt = + parseColor(json["colors"]["text_favorite"] as String) + ..textErrorInt = parseColor(json["colors"]["text_error"] as String) + ..textRestoreInt = parseColor(json["colors"]["text_restore"] as String) + ..buttonBackPrimaryInt = + parseColor(json["colors"]["button_back_primary"] as String) + ..buttonBackSecondaryInt = + parseColor(json["colors"]["button_back_secondary"] as String) + ..buttonBackPrimaryDisabledInt = + parseColor(json["colors"]["button_back_primary_disabled"] as String) + ..buttonBackSecondaryDisabledInt = + parseColor(json["colors"]["button_back_secondary_disabled"] as String) + ..buttonBackBorderInt = + parseColor(json["colors"]["button_back_border"] as String) + ..buttonBackBorderDisabledInt = + parseColor(json["colors"]["button_back_border_disabled"] as String) + ..buttonBackBorderSecondaryInt = + parseColor(json["colors"]["button_back_border_secondary"] as String) + ..buttonBackBorderSecondaryDisabledInt = parseColor( + json["colors"]["button_back_border_secondary_disabled"] as String) + ..numberBackDefaultInt = + parseColor(json["colors"]["number_back_default"] as String) + ..numpadBackDefaultInt = + parseColor(json["colors"]["numpad_back_default"] as String) + ..bottomNavBackInt = + parseColor(json["colors"]["bottom_nav_back"] as String) + ..textSubtitle1Int = + parseColor(json["colors"]["text_subtitle_one"] as String) + ..textSubtitle2Int = + parseColor(json["colors"]["text_subtitle_two"] as String) + ..textSubtitle3Int = + parseColor(json["colors"]["text_subtitle_three"] as String) + ..textSubtitle4Int = + parseColor(json["colors"]["text_subtitle_four"] as String) + ..textSubtitle5Int = + parseColor(json["colors"]["text_subtitle_five"] as String) + ..textSubtitle6Int = + parseColor(json["colors"]["text_subtitle_six"] as String) + ..buttonTextPrimaryInt = + parseColor(json["colors"]["button_text_primary"] as String) + ..buttonTextSecondaryInt = + parseColor(json["colors"]["button_text_secondary"] as String) + ..buttonTextPrimaryDisabledInt = + parseColor(json["colors"]["button_text_primary_disabled"] as String) + ..buttonTextSecondaryDisabledInt = + parseColor(json["colors"]["button_text_secondary_disabled"] as String) + ..buttonTextBorderInt = + parseColor(json["colors"]["button_text_border"] as String) + ..buttonTextDisabledInt = + parseColor(json["colors"]["button_text_disabled"] as String) + ..buttonTextBorderlessInt = + parseColor(json["colors"]["button_text_borderless"] as String) + ..buttonTextBorderlessDisabledInt = parseColor( + json["colors"]["button_text_borderless_disabled"] as String) + ..numberTextDefaultInt = + parseColor(json["colors"]["number_text_default"] as String) + ..numpadTextDefaultInt = + parseColor(json["colors"]["numpad_text_default"] as String) + ..bottomNavTextInt = + parseColor(json["colors"]["bottom_nav_text"] as String) + ..customTextButtonEnabledTextInt = parseColor( + json["colors"]["custom_text_button_enabled_text"] as String) + ..customTextButtonDisabledTextInt = parseColor( + json["colors"]["custom_text_button_disabled_text"] as String) + ..switchBGOnInt = parseColor(json["colors"]["switch_bg_on"] as String) + ..switchBGOffInt = parseColor(json["colors"]["switch_bg_off"] as String) + ..switchBGDisabledInt = + parseColor(json["colors"]["switch_bg_disabled"] as String) + ..switchCircleOnInt = + parseColor(json["colors"]["switch_circle_on"] as String) + ..switchCircleOffInt = + parseColor(json["colors"]["switch_circle_off"] as String) + ..switchCircleDisabledInt = + parseColor(json["colors"]["switch_circle_disabled"] as String) + ..stepIndicatorBGCheckInt = + parseColor(json["colors"]["step_indicator_bg_check"] as String) + ..stepIndicatorBGNumberInt = + parseColor(json["colors"]["step_indicator_bg_number"] as String) + ..stepIndicatorBGInactiveInt = + parseColor(json["colors"]["step_indicator_bg_inactive"] as String) + ..stepIndicatorBGLinesInt = + parseColor(json["colors"]["step_indicator_bg_lines"] as String) + ..stepIndicatorBGLinesInactiveInt = parseColor( + json["colors"]["step_indicator_bg_lines_inactive"] as String) + ..stepIndicatorIconTextInt = + parseColor(json["colors"]["step_indicator_icon_text"] as String) + ..stepIndicatorIconNumberInt = + parseColor(json["colors"]["step_indicator_icon_number"] as String) + ..stepIndicatorIconInactiveInt = + parseColor(json["colors"]["step_indicator_icon_inactive"] as String) + ..checkboxBGCheckedInt = + parseColor(json["colors"]["checkbox_bg_checked"] as String) + ..checkboxBorderEmptyInt = + parseColor(json["colors"]["checkbox_border_empty"] as String) + ..checkboxBGDisabledInt = + parseColor(json["colors"]["checkbox_bg_disabled"] as String) + ..checkboxIconCheckedInt = + parseColor(json["colors"]["checkbox_icon_checked"] as String) + ..checkboxIconDisabledInt = + parseColor(json["colors"]["checkbox_icon_disabled"] as String) + ..checkboxTextLabelInt = + parseColor(json["colors"]["checkbox_text_label"] as String) + ..snackBarBackSuccessInt = + parseColor(json["colors"]["snack_bar_back_success"] as String) + ..snackBarBackErrorInt = + parseColor(json["colors"]["snack_bar_back_error"] as String) + ..snackBarBackInfoInt = + parseColor(json["colors"]["snack_bar_back_info"] as String) + ..snackBarTextSuccessInt = + parseColor(json["colors"]["snack_bar_text_success"] as String) + ..snackBarTextErrorInt = + parseColor(json["colors"]["snack_bar_text_error"] as String) + ..snackBarTextInfoInt = + parseColor(json["colors"]["snack_bar_text_info"] as String) + ..bottomNavIconBackInt = + parseColor(json["colors"]["bottom_nav_icon_back"] as String) + ..bottomNavIconIconInt = + parseColor(json["colors"]["bottom_nav_icon_icon"] as String) + ..bottomNavIconIconHighlightedInt = parseColor( + json["colors"]["bottom_nav_icon_icon_highlighted"] as String) + ..topNavIconPrimaryInt = + parseColor(json["colors"]["top_nav_icon_primary"] as String) + ..topNavIconGreenInt = + parseColor(json["colors"]["top_nav_icon_green"] as String) + ..topNavIconYellowInt = + parseColor(json["colors"]["top_nav_icon_yellow"] as String) + ..topNavIconRedInt = + parseColor(json["colors"]["top_nav_icon_red"] as String) + ..settingsIconBackInt = + parseColor(json["colors"]["settings_icon_back"] as String) + ..settingsIconIconInt = + parseColor(json["colors"]["settings_icon_icon"] as String) + ..settingsIconBack2Int = + parseColor(json["colors"]["settings_icon_back_two"] as String) + ..settingsIconElementInt = + parseColor(json["colors"]["settings_icon_element"] as String) + ..textFieldActiveBGInt = + parseColor(json["colors"]["text_field_active_bg"] as String) + ..textFieldDefaultBGInt = + parseColor(json["colors"]["text_field_default_bg"] as String) + ..textFieldErrorBGInt = + parseColor(json["colors"]["text_field_error_bg"] as String) + ..textFieldSuccessBGInt = + parseColor(json["colors"]["text_field_success_bg"] as String) + ..textFieldErrorBorderInt = + parseColor(json["colors"]["text_field_error_border"] as String) + ..textFieldSuccessBorderInt = + parseColor(json["colors"]["text_field_success_border"] as String) + ..textFieldActiveSearchIconLeftInt = parseColor( + json["colors"]["text_field_active_search_icon_left"] as String) + ..textFieldDefaultSearchIconLeftInt = parseColor( + json["colors"]["text_field_default_search_icon_left"] as String) + ..textFieldErrorSearchIconLeftInt = parseColor( + json["colors"]["text_field_error_search_icon_left"] as String) + ..textFieldSuccessSearchIconLeftInt = parseColor( + json["colors"]["text_field_success_search_icon_left"] as String) + ..textFieldActiveTextInt = + parseColor(json["colors"]["text_field_active_text"] as String) + ..textFieldDefaultTextInt = + parseColor(json["colors"]["text_field_default_text"] as String) + ..textFieldErrorTextInt = + parseColor(json["colors"]["text_field_error_text"] as String) + ..textFieldSuccessTextInt = + parseColor(json["colors"]["text_field_success_text"] as String) + ..textFieldActiveLabelInt = + parseColor(json["colors"]["text_field_active_label"] as String) + ..textFieldErrorLabelInt = + parseColor(json["colors"]["text_field_error_label"] as String) + ..textFieldSuccessLabelInt = + parseColor(json["colors"]["text_field_success_label"] as String) + ..textFieldActiveSearchIconRightInt = parseColor( + json["colors"]["text_field_active_search_icon_right"] as String) + ..textFieldDefaultSearchIconRightInt = parseColor( + json["colors"]["text_field_default_search_icon_right"] as String) + ..textFieldErrorSearchIconRightInt = parseColor( + json["colors"]["text_field_error_search_icon_right"] as String) + ..textFieldSuccessSearchIconRightInt = parseColor( + json["colors"]["text_field_success_search_icon_right"] as String) + ..settingsItem2ActiveBGInt = parseColor( + json["colors"]["settings_item_level_two_active_bg"] as String) + ..settingsItem2ActiveTextInt = parseColor( + json["colors"]["settings_item_level_two_active_text"] as String) + ..settingsItem2ActiveSubInt = parseColor( + json["colors"]["settings_item_level_two_active_sub"] as String) + ..radioButtonIconBorderInt = + parseColor(json["colors"]["radio_button_icon_border"] as String) + ..radioButtonIconBorderDisabledInt = parseColor( + json["colors"]["radio_button_icon_border_disabled"] as String) + ..radioButtonBorderEnabledInt = + parseColor(json["colors"]["radio_button_border_enabled"] as String) + ..radioButtonBorderDisabledInt = + parseColor(json["colors"]["radio_button_border_disabled"] as String) + ..radioButtonIconCircleInt = + parseColor(json["colors"]["radio_button_icon_circle"] as String) + ..radioButtonIconEnabledInt = + parseColor(json["colors"]["radio_button_icon_enabled"] as String) + ..radioButtonTextEnabledInt = + parseColor(json["colors"]["radio_button_text_enabled"] as String) + ..radioButtonTextDisabledInt = + parseColor(json["colors"]["radio_button_text_disabled"] as String) + ..radioButtonLabelEnabledInt = + parseColor(json["colors"]["radio_button_label_enabled"] as String) + ..radioButtonLabelDisabledInt = + parseColor(json["colors"]["radio_button_label_disabled"] as String) + ..infoItemBGInt = parseColor(json["colors"]["info_item_bg"] as String) + ..infoItemLabelInt = + parseColor(json["colors"]["info_item_label"] as String) + ..infoItemTextInt = parseColor(json["colors"]["info_item_text"] as String) + ..infoItemIconsInt = + parseColor(json["colors"]["info_item_icons"] as String) + ..popupBGInt = parseColor(json["colors"]["popup_bg"] as String) + ..currencyListItemBGInt = + parseColor(json["colors"]["currency_list_item_bg"] as String) + ..stackWalletBGInt = parseColor(json["colors"]["sw_bg"] as String) + ..stackWalletMidInt = parseColor(json["colors"]["sw_mid"] as String) + ..stackWalletBottomInt = parseColor(json["colors"]["sw_bottom"] as String) + ..bottomNavShadowInt = + parseColor(json["colors"]["bottom_nav_shadow"] as String) + ..splashInt = parseColor(json["colors"]["splash"] as String) + ..highlightInt = parseColor(json["colors"]["highlight"] as String) + ..warningForegroundInt = + parseColor(json["colors"]["warning_foreground"] as String) + ..warningBackgroundInt = + parseColor(json["colors"]["warning_background"] as String) + ..loadingOverlayTextColorInt = + parseColor(json["colors"]["loading_overlay_text_color"] as String) + ..myStackContactIconBGInt = + parseColor(json["colors"]["my_stack_contact_icon_bg"] as String) + ..textConfirmTotalAmountInt = + parseColor(json["colors"]["text_confirm_total_amount"] as String) + ..textSelectedWordTableItemInt = + parseColor(json["colors"]["text_selected_word_table_iterm"] as String) + ..favoriteStarActiveInt = + parseColor(json["colors"]["favorite_star_active"] as String) + ..favoriteStarInactiveInt = + parseColor(json["colors"]["favorite_star_inactive"] as String) + ..rateTypeToggleColorOnInt = + parseColor(json["colors"]["rate_type_toggle_color_on"] as String) + ..rateTypeToggleColorOffInt = + parseColor(json["colors"]["rate_type_toggle_color_off"] as String) + ..rateTypeToggleDesktopColorOnInt = parseColor( + json["colors"]["rate_type_toggle_desktop_color_on"] as String) + ..rateTypeToggleDesktopColorOffInt = parseColor( + json["colors"]["rate_type_toggle_desktop_color_off"] as String) + ..ethTagTextInt = parseColor(json["colors"]["eth_tag_text"] as String) + ..ethTagBGInt = parseColor(json["colors"]["eth_tag_bg"] as String) + ..ethWalletTagTextInt = + parseColor(json["colors"]["eth_wallet_tag_text"] as String) + ..ethWalletTagBGInt = + parseColor(json["colors"]["eth_wallet_tag_bg"] as String) + ..tokenSummaryTextPrimaryInt = + parseColor(json["colors"]["token_summary_text_primary"] as String) + ..tokenSummaryTextSecondaryInt = + parseColor(json["colors"]["token_summary_text_secondary"] as String) + ..tokenSummaryBGInt = + parseColor(json["colors"]["token_summary_bg"] as String) + ..tokenSummaryButtonBGInt = + parseColor(json["colors"]["token_summary_button_bg"] as String) + ..tokenSummaryIconInt = + parseColor(json["colors"]["token_summary_icon"] as String); } /// Grab the int value of the hex color string. @@ -1990,28 +1862,44 @@ class StackTheme { } @Embedded(inheritance: false) -class ThemeAssets { +class ThemeAssets implements IThemeAssets { + @override late final String bellNew; + @override late final String buy; + @override late final String exchange; + @override late final String personaIncognito; + @override late final String personaEasy; + @override late final String stack; - - @Deprecated("Use assets.dart's appIcon()") + @override late final String stackIcon; - + @override late final String receive; + @override late final String receivePending; + @override late final String receiveCancelled; + @override late final String send; + @override late final String sendPending; + @override late final String sendCancelled; + @override late final String themeSelector; + @override late final String themePreview; + @override late final String txExchange; + @override late final String txExchangePending; + @override late final String txExchangeFailed; + late final String bitcoin; late final String litecoin; late final String bitcoincash; @@ -2045,126 +1933,615 @@ class ThemeAssets { late final String wowneroImageSecondary; late final String namecoinImageSecondary; late final String particlImageSecondary; + @override late final String? loadingGif; + @override late final String? background; - // todo: add all assets expected in json - ThemeAssets(); factory ThemeAssets.fromJson({ required Map json, - required String applicationThemesDirectoryPath, required String themeId, }) { return ThemeAssets() - ..bellNew = - "$applicationThemesDirectoryPath/$themeId/assets/${json["bell_new"] as String}" - ..buy = - "$applicationThemesDirectoryPath/$themeId/assets/${json["buy"] as String}" - ..exchange = - "$applicationThemesDirectoryPath/$themeId/assets/${json["exchange"] as String}" + ..bellNew = "$themeId/assets/${json["bell_new"] as String}" + ..buy = "$themeId/assets/${json["buy"] as String}" + ..exchange = "$themeId/assets/${json["exchange"] as String}" ..personaIncognito = - "$applicationThemesDirectoryPath/$themeId/assets/${json["persona_incognito"] as String}" - ..personaEasy = - "$applicationThemesDirectoryPath/$themeId/assets/${json["persona_easy"] as String}" - ..stack = - "$applicationThemesDirectoryPath/$themeId/assets/${json["stack"] as String}" - ..stackIcon = - "$applicationThemesDirectoryPath/$themeId/assets/${json["stack_icon"] as String}" - ..receive = - "$applicationThemesDirectoryPath/$themeId/assets/${json["receive"] as String}" - ..receivePending = - "$applicationThemesDirectoryPath/$themeId/assets/${json["receive_pending"] as String}" + "$themeId/assets/${json["persona_incognito"] as String}" + ..personaEasy = "$themeId/assets/${json["persona_easy"] as String}" + ..stack = "$themeId/assets/${json["stack"] as String}" + ..stackIcon = "$themeId/assets/${json["stack_icon"] as String}" + ..receive = "$themeId/assets/${json["receive"] as String}" + ..receivePending = "$themeId/assets/${json["receive_pending"] as String}" ..receiveCancelled = - "$applicationThemesDirectoryPath/$themeId/assets/${json["receive_cancelled"] as String}" - ..send = - "$applicationThemesDirectoryPath/$themeId/assets/${json["send"] as String}" - ..sendPending = - "$applicationThemesDirectoryPath/$themeId/assets/${json["send_pending"] as String}" - ..sendCancelled = - "$applicationThemesDirectoryPath/$themeId/assets/${json["send_cancelled"] as String}" - ..themeSelector = - "$applicationThemesDirectoryPath/$themeId/assets/${json["theme_selector"] as String}" - ..themePreview = - "$applicationThemesDirectoryPath/$themeId/assets/${json["theme_preview"] as String}" - ..txExchange = - "$applicationThemesDirectoryPath/$themeId/assets/${json["tx_exchange"] as String}" + "$themeId/assets/${json["receive_cancelled"] as String}" + ..send = "$themeId/assets/${json["send"] as String}" + ..sendPending = "$themeId/assets/${json["send_pending"] as String}" + ..sendCancelled = "$themeId/assets/${json["send_cancelled"] as String}" + ..themeSelector = "$themeId/assets/${json["theme_selector"] as String}" + ..themePreview = "$themeId/assets/${json["theme_preview"] as String}" + ..txExchange = "$themeId/assets/${json["tx_exchange"] as String}" ..txExchangePending = - "$applicationThemesDirectoryPath/$themeId/assets/${json["tx_exchange_pending"] as String}" + "$themeId/assets/${json["tx_exchange_pending"] as String}" ..txExchangeFailed = - "$applicationThemesDirectoryPath/$themeId/assets/${json["tx_exchange_failed"] as String}" - ..bitcoin = - "$applicationThemesDirectoryPath/$themeId/assets/${json["bitcoin"] as String}" - ..litecoin = - "$applicationThemesDirectoryPath/$themeId/assets/${json["litecoin"] as String}" - ..bitcoincash = - "$applicationThemesDirectoryPath/$themeId/assets/${json["bitcoincash"] as String}" - ..dogecoin = - "$applicationThemesDirectoryPath/$themeId/assets/${json["dogecoin"] as String}" - ..epicCash = - "$applicationThemesDirectoryPath/$themeId/assets/${json["epicCash"] as String}" - ..ethereum = - "$applicationThemesDirectoryPath/$themeId/assets/${json["ethereum"] as String}" - ..firo = - "$applicationThemesDirectoryPath/$themeId/assets/${json["firo"] as String}" - ..monero = - "$applicationThemesDirectoryPath/$themeId/assets/${json["monero"] as String}" - ..wownero = - "$applicationThemesDirectoryPath/$themeId/assets/${json["wownero"] as String}" - ..namecoin = - "$applicationThemesDirectoryPath/$themeId/assets/${json["namecoin"] as String}" - ..particl = - "$applicationThemesDirectoryPath/$themeId/assets/${json["particl"] as String}" - ..bitcoinImage = - "$applicationThemesDirectoryPath/$themeId/assets/${json["bitcoin_image"] as String}" + "$themeId/assets/${json["tx_exchange_failed"] as String}" + ..bitcoin = "$themeId/assets/${json["bitcoin"] as String}" + ..litecoin = "$themeId/assets/${json["litecoin"] as String}" + ..bitcoincash = "$themeId/assets/${json["bitcoincash"] as String}" + ..dogecoin = "$themeId/assets/${json["dogecoin"] as String}" + ..epicCash = "$themeId/assets/${json["epicCash"] as String}" + ..ethereum = "$themeId/assets/${json["ethereum"] as String}" + ..firo = "$themeId/assets/${json["firo"] as String}" + ..monero = "$themeId/assets/${json["monero"] as String}" + ..wownero = "$themeId/assets/${json["wownero"] as String}" + ..namecoin = "$themeId/assets/${json["namecoin"] as String}" + ..particl = "$themeId/assets/${json["particl"] as String}" + ..bitcoinImage = "$themeId/assets/${json["bitcoin_image"] as String}" ..bitcoincashImage = - "$applicationThemesDirectoryPath/$themeId/assets/${json["bitcoincash_image"] as String}" - ..dogecoinImage = - "$applicationThemesDirectoryPath/$themeId/assets/${json["dogecoin_image"] as String}" - ..epicCashImage = - "$applicationThemesDirectoryPath/$themeId/assets/${json["epicCash_image"] as String}" - ..ethereumImage = - "$applicationThemesDirectoryPath/$themeId/assets/${json["ethereum_image"] as String}" - ..firoImage = - "$applicationThemesDirectoryPath/$themeId/assets/${json["firo_image"] as String}" - ..litecoinImage = - "$applicationThemesDirectoryPath/$themeId/assets/${json["litecoin_image"] as String}" - ..moneroImage = - "$applicationThemesDirectoryPath/$themeId/assets/${json["monero_image"] as String}" - ..wowneroImage = - "$applicationThemesDirectoryPath/$themeId/assets/${json["wownero_image"] as String}" - ..namecoinImage = - "$applicationThemesDirectoryPath/$themeId/assets/${json["namecoin_image"] as String}" - ..particlImage = - "$applicationThemesDirectoryPath/$themeId/assets/${json["particl_image"] as String}" + "$themeId/assets/${json["bitcoincash_image"] as String}" + ..dogecoinImage = "$themeId/assets/${json["dogecoin_image"] as String}" + ..epicCashImage = "$themeId/assets/${json["epicCash_image"] as String}" + ..ethereumImage = "$themeId/assets/${json["ethereum_image"] as String}" + ..firoImage = "$themeId/assets/${json["firo_image"] as String}" + ..litecoinImage = "$themeId/assets/${json["litecoin_image"] as String}" + ..moneroImage = "$themeId/assets/${json["monero_image"] as String}" + ..wowneroImage = "$themeId/assets/${json["wownero_image"] as String}" + ..namecoinImage = "$themeId/assets/${json["namecoin_image"] as String}" + ..particlImage = "$themeId/assets/${json["particl_image"] as String}" ..bitcoinImageSecondary = - "$applicationThemesDirectoryPath/$themeId/assets/${json["bitcoin_image_secondary"] as String}" + "$themeId/assets/${json["bitcoin_image_secondary"] as String}" ..bitcoincashImageSecondary = - "$applicationThemesDirectoryPath/$themeId/assets/${json["bitcoincash_image_secondary"] as String}" + "$themeId/assets/${json["bitcoincash_image_secondary"] as String}" ..dogecoinImageSecondary = - "$applicationThemesDirectoryPath/$themeId/assets/${json["dogecoin_image_secondary"] as String}" + "$themeId/assets/${json["dogecoin_image_secondary"] as String}" ..epicCashImageSecondary = - "$applicationThemesDirectoryPath/$themeId/assets/${json["epicCash_image_secondary"] as String}" + "$themeId/assets/${json["epicCash_image_secondary"] as String}" ..ethereumImageSecondary = - "$applicationThemesDirectoryPath/$themeId/assets/${json["ethereum_image_secondary"] as String}" + "$themeId/assets/${json["ethereum_image_secondary"] as String}" ..firoImageSecondary = - "$applicationThemesDirectoryPath/$themeId/assets/${json["firo_image_secondary"] as String}" + "$themeId/assets/${json["firo_image_secondary"] as String}" ..litecoinImageSecondary = - "$applicationThemesDirectoryPath/$themeId/assets/${json["litecoin_image_secondary"] as String}" + "$themeId/assets/${json["litecoin_image_secondary"] as String}" ..moneroImageSecondary = - "$applicationThemesDirectoryPath/$themeId/assets/${json["monero_image_secondary"] as String}" + "$themeId/assets/${json["monero_image_secondary"] as String}" ..wowneroImageSecondary = - "$applicationThemesDirectoryPath/$themeId/assets/${json["wownero_image_secondary"] as String}" + "$themeId/assets/${json["wownero_image_secondary"] as String}" ..namecoinImageSecondary = - "$applicationThemesDirectoryPath/$themeId/assets/${json["namecoin_image_secondary"] as String}" + "$themeId/assets/${json["namecoin_image_secondary"] as String}" ..particlImageSecondary = - "$applicationThemesDirectoryPath/$themeId/assets/${json["particl_image_secondary"] as String}" + "$themeId/assets/${json["particl_image_secondary"] as String}" ..loadingGif = json["loading_gif"] is String - ? "$applicationThemesDirectoryPath/$themeId/assets/${json["loading_gif"] as String}" + ? "$themeId/assets/${json["loading_gif"] as String}" : null ..background = json["background"] is String - ? "$applicationThemesDirectoryPath/$themeId/assets/${json["background"] as String}" + ? "$themeId/assets/${json["background"] as String}" : null; } } + +@Embedded(inheritance: false) +class ThemeAssetsV2 implements IThemeAssets { + @override + late final String bellNew; + @override + late final String buy; + @override + late final String exchange; + @override + late final String personaIncognito; + @override + late final String personaEasy; + @override + late final String stack; + @override + late final String stackIcon; + @override + late final String receive; + @override + late final String receivePending; + @override + late final String receiveCancelled; + @override + late final String send; + @override + late final String sendPending; + @override + late final String sendCancelled; + @override + late final String themeSelector; + @override + late final String themePreview; + @override + late final String txExchange; + @override + late final String txExchangePending; + @override + late final String txExchangeFailed; + @override + late final String? loadingGif; + @override + late final String? background; + + late final String coinPlaceholder; + + @ignore + Map get coinIcons => _coinIcons ??= parseCoinAssetsString( + coinIconsString, + placeHolder: coinPlaceholder, + ); + @ignore + Map? _coinIcons; + late final String coinIconsString; + + @ignore + Map get coinImages => _coinImages ??= parseCoinAssetsString( + coinImagesString, + placeHolder: coinPlaceholder, + ); + @ignore + Map? _coinImages; + late final String coinImagesString; + + @ignore + Map get coinSecondaryImages => + _coinSecondaryImages ??= parseCoinAssetsString( + coinSecondaryImagesString, + placeHolder: coinPlaceholder, + ); + @ignore + Map? _coinSecondaryImages; + late final String coinSecondaryImagesString; + + ThemeAssetsV2(); + + factory ThemeAssetsV2.fromJson({ + required Map json, + required String themeId, + }) { + return ThemeAssetsV2() + ..bellNew = "$themeId/assets/${json["bell_new"] as String}" + ..buy = "$themeId/assets/${json["buy"] as String}" + ..exchange = "$themeId/assets/${json["exchange"] as String}" + ..personaIncognito = + "$themeId/assets/${json["persona_incognito"] as String}" + ..personaEasy = "$themeId/assets/${json["persona_easy"] as String}" + ..stack = "$themeId/assets/${json["stack"] as String}" + ..stackIcon = "$themeId/assets/${json["stack_icon"] as String}" + ..receive = "$themeId/assets/${json["receive"] as String}" + ..receivePending = "$themeId/assets/${json["receive_pending"] as String}" + ..receiveCancelled = + "$themeId/assets/${json["receive_cancelled"] as String}" + ..send = "$themeId/assets/${json["send"] as String}" + ..sendPending = "$themeId/assets/${json["send_pending"] as String}" + ..sendCancelled = "$themeId/assets/${json["send_cancelled"] as String}" + ..themeSelector = "$themeId/assets/${json["theme_selector"] as String}" + ..themePreview = "$themeId/assets/${json["theme_preview"] as String}" + ..txExchange = "$themeId/assets/${json["tx_exchange"] as String}" + ..txExchangePending = + "$themeId/assets/${json["tx_exchange_pending"] as String}" + ..txExchangeFailed = + "$themeId/assets/${json["tx_exchange_failed"] as String}" + ..coinPlaceholder = + "$themeId/assets/${json["coin_placeholder"] as String}" + ..coinIconsString = createCoinAssetsString( + "$themeId/assets", + Map.from(json["coins"]["icons"] as Map), + ) + ..coinImagesString = createCoinAssetsString( + "$themeId/assets", + Map.from(json["coins"]["images"] as Map), + ) + ..coinSecondaryImagesString = createCoinAssetsString( + "$themeId/assets", + Map.from(json["coins"]["secondaries"] as Map), + ) + ..loadingGif = json["loading_gif"] is String + ? "$themeId/assets/${json["loading_gif"] as String}" + : null + ..background = json["background"] is String + ? "$themeId/assets/${json["background"] as String}" + : null; + } + + static String createCoinAssetsString(String path, Map json) { + final Map map = {}; + for (final entry in json.entries) { + map[entry.key] = "$path/${entry.value as String}"; + } + return jsonEncode(map); + } + + static Map parseCoinAssetsString( + String jsonString, { + required String placeHolder, + }) { + final json = jsonDecode(jsonString) as Map; + final map = Map.from(json); + + final Map result = {}; + + for (final coin in Coin.values) { + result[coin] = map[coin.name] as String? ?? placeHolder; + } + + return result; + } + + @override + String toString() { + return 'ThemeAssetsV2(' + 'bellNew: $bellNew, ' + 'buy: $buy, ' + 'exchange: $exchange, ' + 'personaIncognito: $personaIncognito, ' + 'personaEasy: $personaEasy, ' + 'stack: $stack, ' + 'stackIcon: $stackIcon, ' + 'receive: $receive, ' + 'receivePending: $receivePending, ' + 'receiveCancelled: $receiveCancelled, ' + 'send: $send, ' + 'sendPending: $sendPending, ' + 'sendCancelled: $sendCancelled, ' + 'themeSelector: $themeSelector, ' + 'themePreview: $themePreview, ' + 'txExchange: $txExchange, ' + 'txExchangePending: $txExchangePending, ' + 'txExchangeFailed: $txExchangeFailed, ' + 'loadingGif: $loadingGif, ' + 'background: $background, ' + 'coinPlaceholder: $coinPlaceholder, ' + 'coinIcons: $coinIcons, ' + 'coinImages: $coinImages, ' + 'coinSecondaryImages: $coinSecondaryImages, ' + ')'; + } +} + +@Embedded(inheritance: false) +class ThemeAssetsV3 implements IThemeAssets { + @Name("bellNew") + late final String bellNewRelative; + @override + @ignore + String get bellNew => prependIfNeeded(bellNewRelative); + + @Name("buy") + late final String buyRelative; + @override + @ignore + String get buy => prependIfNeeded(buyRelative); + + @Name("exchange") + late final String exchangeRelative; + @override + @ignore + String get exchange => prependIfNeeded(exchangeRelative); + + @Name("personaIncognito") + late final String personaIncognitoRelative; + @override + @ignore + String get personaIncognito => prependIfNeeded(personaIncognitoRelative); + + @Name("personaEasy") + late final String personaEasyRelative; + @override + @ignore + String get personaEasy => prependIfNeeded(personaEasyRelative); + + @Name("stack") + late final String stackRelative; + @override + @ignore + String get stack => prependIfNeeded(stackRelative); + + @Name("stackIcon") + late final String stackIconRelative; + @override + @ignore + String get stackIcon => prependIfNeeded(stackIconRelative); + + @Name("receive") + late final String receiveRelative; + @override + @ignore + String get receive => prependIfNeeded(receiveRelative); + + @Name("receivePending") + late final String receivePendingRelative; + @override + @ignore + String get receivePending => prependIfNeeded(receivePendingRelative); + + @Name("receiveCancelled") + late final String receiveCancelledRelative; + @override + @ignore + String get receiveCancelled => prependIfNeeded(receiveCancelledRelative); + + @Name("send") + late final String sendRelative; + @override + @ignore + String get send => prependIfNeeded(sendRelative); + + @Name("sendPending") + late final String sendPendingRelative; + @override + @ignore + String get sendPending => prependIfNeeded(sendPendingRelative); + + @Name("sendCancelled") + late final String sendCancelledRelative; + @override + @ignore + String get sendCancelled => prependIfNeeded(sendCancelledRelative); + + @Name("themeSelector") + late final String themeSelectorRelative; + @override + @ignore + String get themeSelector => prependIfNeeded(themeSelectorRelative); + + @Name("themePreview") + late final String themePreviewRelative; + @override + @ignore + String get themePreview => prependIfNeeded(themePreviewRelative); + + @Name("txExchange") + late final String txExchangeRelative; + @override + @ignore + String get txExchange => prependIfNeeded(txExchangeRelative); + + @Name("txExchangePending") + late final String txExchangePendingRelative; + @override + @ignore + String get txExchangePending => prependIfNeeded(txExchangePendingRelative); + + @Name("txExchangeFailed") + late final String txExchangeFailedRelative; + @override + @ignore + String get txExchangeFailed => prependIfNeeded(txExchangeFailedRelative); + + @Name("loadingGif") + late final String? loadingGifRelative; + @override + @ignore + String? get loadingGif => + loadingGifRelative != null ? prependIfNeeded(loadingGifRelative!) : null; + + @Name("background") + late final String? backgroundRelative; + @override + @ignore + String? get background => + backgroundRelative != null ? prependIfNeeded(backgroundRelative!) : null; + + @Name("coinPlaceholder") + late final String coinPlaceholderRelative; + @ignore + String get coinPlaceholder => prependIfNeeded(coinPlaceholderRelative); + + // Added some future proof params in case we want to add anything else + // This should provide some buffer in stead of creating assetsV4 etc + @Name("otherStringParam1") + late final String? dummy1; + @Name("otherStringParam2") + late final String? dummy2; + @Name("otherStringParam3") + late final String? dummy3; + + @ignore + Map get coinIcons => _coinIcons ??= parseCoinAssetsString( + coinIconsString, + placeHolder: coinPlaceholder, + ); + @ignore + Map? _coinIcons; + late final String coinIconsString; + + @ignore + Map get coinImages => _coinImages ??= parseCoinAssetsString( + coinImagesString, + placeHolder: coinPlaceholder, + ); + @ignore + Map? _coinImages; + late final String coinImagesString; + + @ignore + Map get coinSecondaryImages => + _coinSecondaryImages ??= parseCoinAssetsString( + coinSecondaryImagesString, + placeHolder: coinPlaceholder, + ); + @ignore + Map? _coinSecondaryImages; + late final String coinSecondaryImagesString; + + @ignore + Map? get coinCardImages => + _coinCardImages ??= coinCardImagesString == null + ? null + : parseCoinAssetsString( + coinCardImagesString!, + placeHolder: coinPlaceholder, + ); + @ignore + Map? _coinCardImages; + late final String? coinCardImagesString; + + ThemeAssetsV3(); + + factory ThemeAssetsV3.fromJson({ + required Map json, + required String themeId, + }) { + return ThemeAssetsV3() + ..bellNewRelative = "$themeId/assets/${json["bell_new"] as String}" + ..buyRelative = "$themeId/assets/${json["buy"] as String}" + ..exchangeRelative = "$themeId/assets/${json["exchange"] as String}" + ..personaIncognitoRelative = + "$themeId/assets/${json["persona_incognito"] as String}" + ..personaEasyRelative = + "$themeId/assets/${json["persona_easy"] as String}" + ..stackRelative = "$themeId/assets/${json["stack"] as String}" + ..stackIconRelative = "$themeId/assets/${json["stack_icon"] as String}" + ..receiveRelative = "$themeId/assets/${json["receive"] as String}" + ..receivePendingRelative = + "$themeId/assets/${json["receive_pending"] as String}" + ..receiveCancelledRelative = + "$themeId/assets/${json["receive_cancelled"] as String}" + ..sendRelative = "$themeId/assets/${json["send"] as String}" + ..sendPendingRelative = + "$themeId/assets/${json["send_pending"] as String}" + ..sendCancelledRelative = + "$themeId/assets/${json["send_cancelled"] as String}" + ..themeSelectorRelative = + "$themeId/assets/${json["theme_selector"] as String}" + ..themePreviewRelative = + "$themeId/assets/${json["theme_preview"] as String}" + ..txExchangeRelative = "$themeId/assets/${json["tx_exchange"] as String}" + ..txExchangePendingRelative = + "$themeId/assets/${json["tx_exchange_pending"] as String}" + ..txExchangeFailedRelative = + "$themeId/assets/${json["tx_exchange_failed"] as String}" + ..coinPlaceholderRelative = + "$themeId/assets/${json["coin_placeholder"] as String}" + ..coinIconsString = createCoinAssetsString( + "$themeId/assets", + Map.from(json["coins"]["icons"] as Map), + ) + ..coinImagesString = createCoinAssetsString( + "$themeId/assets", + Map.from(json["coins"]["images"] as Map), + ) + ..coinSecondaryImagesString = createCoinAssetsString( + "$themeId/assets", + Map.from(json["coins"]["secondaries"] as Map), + ) + ..coinCardImagesString = json["coins"]["cards"] is Map + ? createCoinAssetsString( + "$themeId/assets", + Map.from(json["coins"]["cards"] as Map), + ) + : null + ..loadingGifRelative = json["loading_gif"] is String + ? "$themeId/assets/${json["loading_gif"] as String}" + : null + ..backgroundRelative = json["background"] is String + ? "$themeId/assets/${json["background"] as String}" + : null + ..dummy1 = null + ..dummy2 = null + ..dummy3 = null; + } + + static String prependIfNeeded(String relativePath) { + final path = StackFileSystem.themesDir!.path; + + if (relativePath.startsWith(path)) { + return relativePath; + } else { + if (Platform.isIOS) { + const pattern = "/var/mobile/Containers/Data/Application/"; + if (relativePath.startsWith(pattern)) { + final parts = relativePath.split("/Library/themes/"); + if (parts.isNotEmpty) { + return "$path/${parts.last}"; + } + } + } + + return "$path/$relativePath"; + } + } + + static String createCoinAssetsString(String path, Map json) { + final Map map = {}; + for (final entry in json.entries) { + map[entry.key] = "$path/${entry.value as String}"; + } + return jsonEncode(map); + } + + static Map parseCoinAssetsString( + String jsonString, { + required String placeHolder, + }) { + final json = jsonDecode(jsonString) as Map; + final map = Map.from(json); + + final Map result = {}; + + for (final coin in Coin.values) { + result[coin] = map[coin.name] as String? ?? placeHolder; + + result[coin] = prependIfNeeded(result[coin]!); + } + + return result; + } + + @override + String toString() { + return 'ThemeAssetsV3(' + 'bellNew: $bellNew, ' + 'buy: $buy, ' + 'exchange: $exchange, ' + 'personaIncognito: $personaIncognito, ' + 'personaEasy: $personaEasy, ' + 'stack: $stack, ' + 'stackIcon: $stackIcon, ' + 'receive: $receive, ' + 'receivePending: $receivePending, ' + 'receiveCancelled: $receiveCancelled, ' + 'send: $send, ' + 'sendPending: $sendPending, ' + 'sendCancelled: $sendCancelled, ' + 'themeSelector: $themeSelector, ' + 'themePreview: $themePreview, ' + 'txExchange: $txExchange, ' + 'txExchangePending: $txExchangePending, ' + 'txExchangeFailed: $txExchangeFailed, ' + 'loadingGif: $loadingGif, ' + 'background: $background, ' + 'coinPlaceholder: $coinPlaceholder, ' + 'coinIcons: $coinIcons, ' + 'coinImages: $coinImages, ' + 'coinSecondaryImages: $coinSecondaryImages, ' + 'coinCardImages: $coinCardImages' + ')'; + } +} + +abstract class IThemeAssets { + String get bellNew; + String get buy; + String get exchange; + String get personaIncognito; + String get personaEasy; + String get stack; + String get stackIcon; + String get receive; + String get receivePending; + String get receiveCancelled; + String get send; + String get sendPending; + String get sendCancelled; + String get themeSelector; + String get themePreview; + String get txExchange; + String get txExchangePending; + String get txExchangeFailed; + + String? get loadingGif; + String? get background; +} diff --git a/lib/models/isar/stack_theme.g.dart b/lib/models/isar/stack_theme.g.dart index 64d8c3f6c2..bf38c461d5 100644 --- a/lib/models/isar/stack_theme.g.dart +++ b/lib/models/isar/stack_theme.g.dart @@ -53,765 +53,782 @@ const StackThemeSchema = CollectionSchema( type: IsarType.object, target: r'ThemeAssets', ), - r'backgroundAppBarInt': PropertySchema( + r'assetsV2': PropertySchema( id: 7, + name: r'assetsV2', + type: IsarType.object, + target: r'ThemeAssetsV2', + ), + r'backgroundAppBarInt': PropertySchema( + id: 8, name: r'backgroundAppBarInt', type: IsarType.long, ), r'backgroundInt': PropertySchema( - id: 8, + id: 9, name: r'backgroundInt', type: IsarType.long, ), r'bottomNavBackInt': PropertySchema( - id: 9, + id: 10, name: r'bottomNavBackInt', type: IsarType.long, ), r'bottomNavIconBackInt': PropertySchema( - id: 10, + id: 11, name: r'bottomNavIconBackInt', type: IsarType.long, ), r'bottomNavIconIconHighlightedInt': PropertySchema( - id: 11, + id: 12, name: r'bottomNavIconIconHighlightedInt', type: IsarType.long, ), r'bottomNavIconIconInt': PropertySchema( - id: 12, + id: 13, name: r'bottomNavIconIconInt', type: IsarType.long, ), r'bottomNavShadowInt': PropertySchema( - id: 13, + id: 14, name: r'bottomNavShadowInt', type: IsarType.long, ), r'bottomNavTextInt': PropertySchema( - id: 14, + id: 15, name: r'bottomNavTextInt', type: IsarType.long, ), r'brightnessString': PropertySchema( - id: 15, + id: 16, name: r'brightnessString', type: IsarType.string, ), r'buttonBackBorderDisabledInt': PropertySchema( - id: 16, + id: 17, name: r'buttonBackBorderDisabledInt', type: IsarType.long, ), r'buttonBackBorderInt': PropertySchema( - id: 17, + id: 18, name: r'buttonBackBorderInt', type: IsarType.long, ), r'buttonBackBorderSecondaryDisabledInt': PropertySchema( - id: 18, + id: 19, name: r'buttonBackBorderSecondaryDisabledInt', type: IsarType.long, ), r'buttonBackBorderSecondaryInt': PropertySchema( - id: 19, + id: 20, name: r'buttonBackBorderSecondaryInt', type: IsarType.long, ), r'buttonBackPrimaryDisabledInt': PropertySchema( - id: 20, + id: 21, name: r'buttonBackPrimaryDisabledInt', type: IsarType.long, ), r'buttonBackPrimaryInt': PropertySchema( - id: 21, + id: 22, name: r'buttonBackPrimaryInt', type: IsarType.long, ), r'buttonBackSecondaryDisabledInt': PropertySchema( - id: 22, + id: 23, name: r'buttonBackSecondaryDisabledInt', type: IsarType.long, ), r'buttonBackSecondaryInt': PropertySchema( - id: 23, + id: 24, name: r'buttonBackSecondaryInt', type: IsarType.long, ), r'buttonTextBorderInt': PropertySchema( - id: 24, + id: 25, name: r'buttonTextBorderInt', type: IsarType.long, ), r'buttonTextBorderlessDisabledInt': PropertySchema( - id: 25, + id: 26, name: r'buttonTextBorderlessDisabledInt', type: IsarType.long, ), r'buttonTextBorderlessInt': PropertySchema( - id: 26, + id: 27, name: r'buttonTextBorderlessInt', type: IsarType.long, ), r'buttonTextDisabledInt': PropertySchema( - id: 27, + id: 28, name: r'buttonTextDisabledInt', type: IsarType.long, ), r'buttonTextPrimaryDisabledInt': PropertySchema( - id: 28, + id: 29, name: r'buttonTextPrimaryDisabledInt', type: IsarType.long, ), r'buttonTextPrimaryInt': PropertySchema( - id: 29, + id: 30, name: r'buttonTextPrimaryInt', type: IsarType.long, ), r'buttonTextSecondaryDisabledInt': PropertySchema( - id: 30, + id: 31, name: r'buttonTextSecondaryDisabledInt', type: IsarType.long, ), r'buttonTextSecondaryInt': PropertySchema( - id: 31, + id: 32, name: r'buttonTextSecondaryInt', type: IsarType.long, ), r'checkboxBGCheckedInt': PropertySchema( - id: 32, + id: 33, name: r'checkboxBGCheckedInt', type: IsarType.long, ), r'checkboxBGDisabledInt': PropertySchema( - id: 33, + id: 34, name: r'checkboxBGDisabledInt', type: IsarType.long, ), r'checkboxBorderEmptyInt': PropertySchema( - id: 34, + id: 35, name: r'checkboxBorderEmptyInt', type: IsarType.long, ), r'checkboxIconCheckedInt': PropertySchema( - id: 35, + id: 36, name: r'checkboxIconCheckedInt', type: IsarType.long, ), r'checkboxIconDisabledInt': PropertySchema( - id: 36, + id: 37, name: r'checkboxIconDisabledInt', type: IsarType.long, ), r'checkboxTextLabelInt': PropertySchema( - id: 37, + id: 38, name: r'checkboxTextLabelInt', type: IsarType.long, ), r'coinColorsJsonString': PropertySchema( - id: 38, + id: 39, name: r'coinColorsJsonString', type: IsarType.string, ), r'currencyListItemBGInt': PropertySchema( - id: 39, + id: 40, name: r'currencyListItemBGInt', type: IsarType.long, ), r'customTextButtonDisabledTextInt': PropertySchema( - id: 40, + id: 41, name: r'customTextButtonDisabledTextInt', type: IsarType.long, ), r'customTextButtonEnabledTextInt': PropertySchema( - id: 41, + id: 42, name: r'customTextButtonEnabledTextInt', type: IsarType.long, ), r'ethTagBGInt': PropertySchema( - id: 42, + id: 43, name: r'ethTagBGInt', type: IsarType.long, ), r'ethTagTextInt': PropertySchema( - id: 43, + id: 44, name: r'ethTagTextInt', type: IsarType.long, ), r'ethWalletTagBGInt': PropertySchema( - id: 44, + id: 45, name: r'ethWalletTagBGInt', type: IsarType.long, ), r'ethWalletTagTextInt': PropertySchema( - id: 45, + id: 46, name: r'ethWalletTagTextInt', type: IsarType.long, ), r'favoriteStarActiveInt': PropertySchema( - id: 46, + id: 47, name: r'favoriteStarActiveInt', type: IsarType.long, ), r'favoriteStarInactiveInt': PropertySchema( - id: 47, + id: 48, name: r'favoriteStarInactiveInt', type: IsarType.long, ), r'gradientBackgroundString': PropertySchema( - id: 48, + id: 49, name: r'gradientBackgroundString', type: IsarType.string, ), r'highlightInt': PropertySchema( - id: 49, + id: 50, name: r'highlightInt', type: IsarType.long, ), r'homeViewButtonBarBoxShadowString': PropertySchema( - id: 50, + id: 51, name: r'homeViewButtonBarBoxShadowString', type: IsarType.string, ), r'infoItemBGInt': PropertySchema( - id: 51, + id: 52, name: r'infoItemBGInt', type: IsarType.long, ), r'infoItemIconsInt': PropertySchema( - id: 52, + id: 53, name: r'infoItemIconsInt', type: IsarType.long, ), r'infoItemLabelInt': PropertySchema( - id: 53, + id: 54, name: r'infoItemLabelInt', type: IsarType.long, ), r'infoItemTextInt': PropertySchema( - id: 54, + id: 55, name: r'infoItemTextInt', type: IsarType.long, ), r'loadingOverlayTextColorInt': PropertySchema( - id: 55, + id: 56, name: r'loadingOverlayTextColorInt', type: IsarType.long, ), r'myStackContactIconBGInt': PropertySchema( - id: 56, + id: 57, name: r'myStackContactIconBGInt', type: IsarType.long, ), r'name': PropertySchema( - id: 57, + id: 58, name: r'name', type: IsarType.string, ), r'numberBackDefaultInt': PropertySchema( - id: 58, + id: 59, name: r'numberBackDefaultInt', type: IsarType.long, ), r'numberTextDefaultInt': PropertySchema( - id: 59, + id: 60, name: r'numberTextDefaultInt', type: IsarType.long, ), r'numpadBackDefaultInt': PropertySchema( - id: 60, + id: 61, name: r'numpadBackDefaultInt', type: IsarType.long, ), r'numpadTextDefaultInt': PropertySchema( - id: 61, + id: 62, name: r'numpadTextDefaultInt', type: IsarType.long, ), r'overlayInt': PropertySchema( - id: 62, + id: 63, name: r'overlayInt', type: IsarType.long, ), r'popupBGInt': PropertySchema( - id: 63, + id: 64, name: r'popupBGInt', type: IsarType.long, ), r'radioButtonBorderDisabledInt': PropertySchema( - id: 64, + id: 65, name: r'radioButtonBorderDisabledInt', type: IsarType.long, ), r'radioButtonBorderEnabledInt': PropertySchema( - id: 65, + id: 66, name: r'radioButtonBorderEnabledInt', type: IsarType.long, ), r'radioButtonIconBorderDisabledInt': PropertySchema( - id: 66, + id: 67, name: r'radioButtonIconBorderDisabledInt', type: IsarType.long, ), r'radioButtonIconBorderInt': PropertySchema( - id: 67, + id: 68, name: r'radioButtonIconBorderInt', type: IsarType.long, ), r'radioButtonIconCircleInt': PropertySchema( - id: 68, + id: 69, name: r'radioButtonIconCircleInt', type: IsarType.long, ), r'radioButtonIconEnabledInt': PropertySchema( - id: 69, + id: 70, name: r'radioButtonIconEnabledInt', type: IsarType.long, ), r'radioButtonLabelDisabledInt': PropertySchema( - id: 70, + id: 71, name: r'radioButtonLabelDisabledInt', type: IsarType.long, ), r'radioButtonLabelEnabledInt': PropertySchema( - id: 71, + id: 72, name: r'radioButtonLabelEnabledInt', type: IsarType.long, ), r'radioButtonTextDisabledInt': PropertySchema( - id: 72, + id: 73, name: r'radioButtonTextDisabledInt', type: IsarType.long, ), r'radioButtonTextEnabledInt': PropertySchema( - id: 73, + id: 74, name: r'radioButtonTextEnabledInt', type: IsarType.long, ), r'rateTypeToggleColorOffInt': PropertySchema( - id: 74, + id: 75, name: r'rateTypeToggleColorOffInt', type: IsarType.long, ), r'rateTypeToggleColorOnInt': PropertySchema( - id: 75, + id: 76, name: r'rateTypeToggleColorOnInt', type: IsarType.long, ), r'rateTypeToggleDesktopColorOffInt': PropertySchema( - id: 76, + id: 77, name: r'rateTypeToggleDesktopColorOffInt', type: IsarType.long, ), r'rateTypeToggleDesktopColorOnInt': PropertySchema( - id: 77, + id: 78, name: r'rateTypeToggleDesktopColorOnInt', type: IsarType.long, ), r'settingsIconBack2Int': PropertySchema( - id: 78, + id: 79, name: r'settingsIconBack2Int', type: IsarType.long, ), r'settingsIconBackInt': PropertySchema( - id: 79, + id: 80, name: r'settingsIconBackInt', type: IsarType.long, ), r'settingsIconElementInt': PropertySchema( - id: 80, + id: 81, name: r'settingsIconElementInt', type: IsarType.long, ), r'settingsIconIconInt': PropertySchema( - id: 81, + id: 82, name: r'settingsIconIconInt', type: IsarType.long, ), r'settingsItem2ActiveBGInt': PropertySchema( - id: 82, + id: 83, name: r'settingsItem2ActiveBGInt', type: IsarType.long, ), r'settingsItem2ActiveSubInt': PropertySchema( - id: 83, + id: 84, name: r'settingsItem2ActiveSubInt', type: IsarType.long, ), r'settingsItem2ActiveTextInt': PropertySchema( - id: 84, + id: 85, name: r'settingsItem2ActiveTextInt', type: IsarType.long, ), r'shadowInt': PropertySchema( - id: 85, + id: 86, name: r'shadowInt', type: IsarType.long, ), r'snackBarBackErrorInt': PropertySchema( - id: 86, + id: 87, name: r'snackBarBackErrorInt', type: IsarType.long, ), r'snackBarBackInfoInt': PropertySchema( - id: 87, + id: 88, name: r'snackBarBackInfoInt', type: IsarType.long, ), r'snackBarBackSuccessInt': PropertySchema( - id: 88, + id: 89, name: r'snackBarBackSuccessInt', type: IsarType.long, ), r'snackBarTextErrorInt': PropertySchema( - id: 89, + id: 90, name: r'snackBarTextErrorInt', type: IsarType.long, ), r'snackBarTextInfoInt': PropertySchema( - id: 90, + id: 91, name: r'snackBarTextInfoInt', type: IsarType.long, ), r'snackBarTextSuccessInt': PropertySchema( - id: 91, + id: 92, name: r'snackBarTextSuccessInt', type: IsarType.long, ), r'splashInt': PropertySchema( - id: 92, + id: 93, name: r'splashInt', type: IsarType.long, ), r'stackWalletBGInt': PropertySchema( - id: 93, + id: 94, name: r'stackWalletBGInt', type: IsarType.long, ), r'stackWalletBottomInt': PropertySchema( - id: 94, + id: 95, name: r'stackWalletBottomInt', type: IsarType.long, ), r'stackWalletMidInt': PropertySchema( - id: 95, + id: 96, name: r'stackWalletMidInt', type: IsarType.long, ), r'standardBoxShadowString': PropertySchema( - id: 96, + id: 97, name: r'standardBoxShadowString', type: IsarType.string, ), r'stepIndicatorBGCheckInt': PropertySchema( - id: 97, + id: 98, name: r'stepIndicatorBGCheckInt', type: IsarType.long, ), r'stepIndicatorBGInactiveInt': PropertySchema( - id: 98, + id: 99, name: r'stepIndicatorBGInactiveInt', type: IsarType.long, ), r'stepIndicatorBGLinesInactiveInt': PropertySchema( - id: 99, + id: 100, name: r'stepIndicatorBGLinesInactiveInt', type: IsarType.long, ), r'stepIndicatorBGLinesInt': PropertySchema( - id: 100, + id: 101, name: r'stepIndicatorBGLinesInt', type: IsarType.long, ), r'stepIndicatorBGNumberInt': PropertySchema( - id: 101, + id: 102, name: r'stepIndicatorBGNumberInt', type: IsarType.long, ), r'stepIndicatorIconInactiveInt': PropertySchema( - id: 102, + id: 103, name: r'stepIndicatorIconInactiveInt', type: IsarType.long, ), r'stepIndicatorIconNumberInt': PropertySchema( - id: 103, + id: 104, name: r'stepIndicatorIconNumberInt', type: IsarType.long, ), r'stepIndicatorIconTextInt': PropertySchema( - id: 104, + id: 105, name: r'stepIndicatorIconTextInt', type: IsarType.long, ), r'switchBGDisabledInt': PropertySchema( - id: 105, + id: 106, name: r'switchBGDisabledInt', type: IsarType.long, ), r'switchBGOffInt': PropertySchema( - id: 106, + id: 107, name: r'switchBGOffInt', type: IsarType.long, ), r'switchBGOnInt': PropertySchema( - id: 107, + id: 108, name: r'switchBGOnInt', type: IsarType.long, ), r'switchCircleDisabledInt': PropertySchema( - id: 108, + id: 109, name: r'switchCircleDisabledInt', type: IsarType.long, ), r'switchCircleOffInt': PropertySchema( - id: 109, + id: 110, name: r'switchCircleOffInt', type: IsarType.long, ), r'switchCircleOnInt': PropertySchema( - id: 110, + id: 111, name: r'switchCircleOnInt', type: IsarType.long, ), r'textConfirmTotalAmountInt': PropertySchema( - id: 111, + id: 112, name: r'textConfirmTotalAmountInt', type: IsarType.long, ), r'textDark2Int': PropertySchema( - id: 112, + id: 113, name: r'textDark2Int', type: IsarType.long, ), r'textDark3Int': PropertySchema( - id: 113, + id: 114, name: r'textDark3Int', type: IsarType.long, ), r'textDarkInt': PropertySchema( - id: 114, + id: 115, name: r'textDarkInt', type: IsarType.long, ), r'textErrorInt': PropertySchema( - id: 115, + id: 116, name: r'textErrorInt', type: IsarType.long, ), r'textFavoriteCardInt': PropertySchema( - id: 116, + id: 117, name: r'textFavoriteCardInt', type: IsarType.long, ), r'textFieldActiveBGInt': PropertySchema( - id: 117, + id: 118, name: r'textFieldActiveBGInt', type: IsarType.long, ), r'textFieldActiveLabelInt': PropertySchema( - id: 118, + id: 119, name: r'textFieldActiveLabelInt', type: IsarType.long, ), r'textFieldActiveSearchIconLeftInt': PropertySchema( - id: 119, + id: 120, name: r'textFieldActiveSearchIconLeftInt', type: IsarType.long, ), r'textFieldActiveSearchIconRightInt': PropertySchema( - id: 120, + id: 121, name: r'textFieldActiveSearchIconRightInt', type: IsarType.long, ), r'textFieldActiveTextInt': PropertySchema( - id: 121, + id: 122, name: r'textFieldActiveTextInt', type: IsarType.long, ), r'textFieldDefaultBGInt': PropertySchema( - id: 122, + id: 123, name: r'textFieldDefaultBGInt', type: IsarType.long, ), r'textFieldDefaultSearchIconLeftInt': PropertySchema( - id: 123, + id: 124, name: r'textFieldDefaultSearchIconLeftInt', type: IsarType.long, ), r'textFieldDefaultSearchIconRightInt': PropertySchema( - id: 124, + id: 125, name: r'textFieldDefaultSearchIconRightInt', type: IsarType.long, ), r'textFieldDefaultTextInt': PropertySchema( - id: 125, + id: 126, name: r'textFieldDefaultTextInt', type: IsarType.long, ), r'textFieldErrorBGInt': PropertySchema( - id: 126, + id: 127, name: r'textFieldErrorBGInt', type: IsarType.long, ), r'textFieldErrorBorderInt': PropertySchema( - id: 127, + id: 128, name: r'textFieldErrorBorderInt', type: IsarType.long, ), r'textFieldErrorLabelInt': PropertySchema( - id: 128, + id: 129, name: r'textFieldErrorLabelInt', type: IsarType.long, ), r'textFieldErrorSearchIconLeftInt': PropertySchema( - id: 129, + id: 130, name: r'textFieldErrorSearchIconLeftInt', type: IsarType.long, ), r'textFieldErrorSearchIconRightInt': PropertySchema( - id: 130, + id: 131, name: r'textFieldErrorSearchIconRightInt', type: IsarType.long, ), r'textFieldErrorTextInt': PropertySchema( - id: 131, + id: 132, name: r'textFieldErrorTextInt', type: IsarType.long, ), r'textFieldSuccessBGInt': PropertySchema( - id: 132, + id: 133, name: r'textFieldSuccessBGInt', type: IsarType.long, ), r'textFieldSuccessBorderInt': PropertySchema( - id: 133, + id: 134, name: r'textFieldSuccessBorderInt', type: IsarType.long, ), r'textFieldSuccessLabelInt': PropertySchema( - id: 134, + id: 135, name: r'textFieldSuccessLabelInt', type: IsarType.long, ), r'textFieldSuccessSearchIconLeftInt': PropertySchema( - id: 135, + id: 136, name: r'textFieldSuccessSearchIconLeftInt', type: IsarType.long, ), r'textFieldSuccessSearchIconRightInt': PropertySchema( - id: 136, + id: 137, name: r'textFieldSuccessSearchIconRightInt', type: IsarType.long, ), r'textFieldSuccessTextInt': PropertySchema( - id: 137, + id: 138, name: r'textFieldSuccessTextInt', type: IsarType.long, ), r'textRestoreInt': PropertySchema( - id: 138, + id: 139, name: r'textRestoreInt', type: IsarType.long, ), r'textSelectedWordTableItemInt': PropertySchema( - id: 139, + id: 140, name: r'textSelectedWordTableItemInt', type: IsarType.long, ), r'textSubtitle1Int': PropertySchema( - id: 140, + id: 141, name: r'textSubtitle1Int', type: IsarType.long, ), r'textSubtitle2Int': PropertySchema( - id: 141, + id: 142, name: r'textSubtitle2Int', type: IsarType.long, ), r'textSubtitle3Int': PropertySchema( - id: 142, + id: 143, name: r'textSubtitle3Int', type: IsarType.long, ), r'textSubtitle4Int': PropertySchema( - id: 143, + id: 144, name: r'textSubtitle4Int', type: IsarType.long, ), r'textSubtitle5Int': PropertySchema( - id: 144, + id: 145, name: r'textSubtitle5Int', type: IsarType.long, ), r'textSubtitle6Int': PropertySchema( - id: 145, + id: 146, name: r'textSubtitle6Int', type: IsarType.long, ), r'textWhiteInt': PropertySchema( - id: 146, + id: 147, name: r'textWhiteInt', type: IsarType.long, ), r'themeId': PropertySchema( - id: 147, + id: 148, name: r'themeId', type: IsarType.string, ), r'tokenSummaryBGInt': PropertySchema( - id: 148, + id: 149, name: r'tokenSummaryBGInt', type: IsarType.long, ), r'tokenSummaryButtonBGInt': PropertySchema( - id: 149, + id: 150, name: r'tokenSummaryButtonBGInt', type: IsarType.long, ), r'tokenSummaryIconInt': PropertySchema( - id: 150, + id: 151, name: r'tokenSummaryIconInt', type: IsarType.long, ), r'tokenSummaryTextPrimaryInt': PropertySchema( - id: 151, + id: 152, name: r'tokenSummaryTextPrimaryInt', type: IsarType.long, ), r'tokenSummaryTextSecondaryInt': PropertySchema( - id: 152, + id: 153, name: r'tokenSummaryTextSecondaryInt', type: IsarType.long, ), r'topNavIconGreenInt': PropertySchema( - id: 153, + id: 154, name: r'topNavIconGreenInt', type: IsarType.long, ), r'topNavIconPrimaryInt': PropertySchema( - id: 154, + id: 155, name: r'topNavIconPrimaryInt', type: IsarType.long, ), r'topNavIconRedInt': PropertySchema( - id: 155, + id: 156, name: r'topNavIconRedInt', type: IsarType.long, ), r'topNavIconYellowInt': PropertySchema( - id: 156, + id: 157, name: r'topNavIconYellowInt', type: IsarType.long, ), + r'version': PropertySchema( + id: 158, + name: r'version', + type: IsarType.long, + ), r'warningBackgroundInt': PropertySchema( - id: 157, + id: 159, name: r'warningBackgroundInt', type: IsarType.long, ), r'warningForegroundInt': PropertySchema( - id: 158, + id: 160, name: r'warningForegroundInt', type: IsarType.long, + ), + r'zAssetsV3': PropertySchema( + id: 161, + name: r'zAssetsV3', + type: IsarType.object, + target: r'ThemeAssetsV3', ) }, estimateSize: _stackThemeEstimateSize, @@ -835,7 +852,11 @@ const StackThemeSchema = CollectionSchema( ) }, links: {}, - embeddedSchemas: {r'ThemeAssets': ThemeAssetsSchema}, + embeddedSchemas: { + r'ThemeAssets': ThemeAssetsSchema, + r'ThemeAssetsV2': ThemeAssetsV2Schema, + r'ThemeAssetsV3': ThemeAssetsV3Schema + }, getId: _stackThemeGetId, getLinks: _stackThemeGetLinks, attach: _stackThemeAttach, @@ -848,9 +869,22 @@ int _stackThemeEstimateSize( Map> allOffsets, ) { var bytesCount = offsets.last; - bytesCount += 3 + - ThemeAssetsSchema.estimateSize( - object.assets, allOffsets[ThemeAssets]!, allOffsets); + { + final value = object.assetsV1; + if (value != null) { + bytesCount += 3 + + ThemeAssetsSchema.estimateSize( + value, allOffsets[ThemeAssets]!, allOffsets); + } + } + { + final value = object.assetsV2; + if (value != null) { + bytesCount += 3 + + ThemeAssetsV2Schema.estimateSize( + value, allOffsets[ThemeAssetsV2]!, allOffsets); + } + } bytesCount += 3 + object.brightnessString.length * 3; bytesCount += 3 + object.coinColorsJsonString.length * 3; { @@ -868,6 +902,14 @@ int _stackThemeEstimateSize( bytesCount += 3 + object.name.length * 3; bytesCount += 3 + object.standardBoxShadowString.length * 3; bytesCount += 3 + object.themeId.length * 3; + { + final value = object.assetsV3; + if (value != null) { + bytesCount += 3 + + ThemeAssetsV3Schema.estimateSize( + value, allOffsets[ThemeAssetsV3]!, allOffsets); + } + } return bytesCount; } @@ -887,160 +929,173 @@ void _stackThemeSerialize( offsets[6], allOffsets, ThemeAssetsSchema.serialize, - object.assets, + object.assetsV1, + ); + writer.writeObject( + offsets[7], + allOffsets, + ThemeAssetsV2Schema.serialize, + object.assetsV2, + ); + writer.writeLong(offsets[8], object.backgroundAppBarInt); + writer.writeLong(offsets[9], object.backgroundInt); + writer.writeLong(offsets[10], object.bottomNavBackInt); + writer.writeLong(offsets[11], object.bottomNavIconBackInt); + writer.writeLong(offsets[12], object.bottomNavIconIconHighlightedInt); + writer.writeLong(offsets[13], object.bottomNavIconIconInt); + writer.writeLong(offsets[14], object.bottomNavShadowInt); + writer.writeLong(offsets[15], object.bottomNavTextInt); + writer.writeString(offsets[16], object.brightnessString); + writer.writeLong(offsets[17], object.buttonBackBorderDisabledInt); + writer.writeLong(offsets[18], object.buttonBackBorderInt); + writer.writeLong(offsets[19], object.buttonBackBorderSecondaryDisabledInt); + writer.writeLong(offsets[20], object.buttonBackBorderSecondaryInt); + writer.writeLong(offsets[21], object.buttonBackPrimaryDisabledInt); + writer.writeLong(offsets[22], object.buttonBackPrimaryInt); + writer.writeLong(offsets[23], object.buttonBackSecondaryDisabledInt); + writer.writeLong(offsets[24], object.buttonBackSecondaryInt); + writer.writeLong(offsets[25], object.buttonTextBorderInt); + writer.writeLong(offsets[26], object.buttonTextBorderlessDisabledInt); + writer.writeLong(offsets[27], object.buttonTextBorderlessInt); + writer.writeLong(offsets[28], object.buttonTextDisabledInt); + writer.writeLong(offsets[29], object.buttonTextPrimaryDisabledInt); + writer.writeLong(offsets[30], object.buttonTextPrimaryInt); + writer.writeLong(offsets[31], object.buttonTextSecondaryDisabledInt); + writer.writeLong(offsets[32], object.buttonTextSecondaryInt); + writer.writeLong(offsets[33], object.checkboxBGCheckedInt); + writer.writeLong(offsets[34], object.checkboxBGDisabledInt); + writer.writeLong(offsets[35], object.checkboxBorderEmptyInt); + writer.writeLong(offsets[36], object.checkboxIconCheckedInt); + writer.writeLong(offsets[37], object.checkboxIconDisabledInt); + writer.writeLong(offsets[38], object.checkboxTextLabelInt); + writer.writeString(offsets[39], object.coinColorsJsonString); + writer.writeLong(offsets[40], object.currencyListItemBGInt); + writer.writeLong(offsets[41], object.customTextButtonDisabledTextInt); + writer.writeLong(offsets[42], object.customTextButtonEnabledTextInt); + writer.writeLong(offsets[43], object.ethTagBGInt); + writer.writeLong(offsets[44], object.ethTagTextInt); + writer.writeLong(offsets[45], object.ethWalletTagBGInt); + writer.writeLong(offsets[46], object.ethWalletTagTextInt); + writer.writeLong(offsets[47], object.favoriteStarActiveInt); + writer.writeLong(offsets[48], object.favoriteStarInactiveInt); + writer.writeString(offsets[49], object.gradientBackgroundString); + writer.writeLong(offsets[50], object.highlightInt); + writer.writeString(offsets[51], object.homeViewButtonBarBoxShadowString); + writer.writeLong(offsets[52], object.infoItemBGInt); + writer.writeLong(offsets[53], object.infoItemIconsInt); + writer.writeLong(offsets[54], object.infoItemLabelInt); + writer.writeLong(offsets[55], object.infoItemTextInt); + writer.writeLong(offsets[56], object.loadingOverlayTextColorInt); + writer.writeLong(offsets[57], object.myStackContactIconBGInt); + writer.writeString(offsets[58], object.name); + writer.writeLong(offsets[59], object.numberBackDefaultInt); + writer.writeLong(offsets[60], object.numberTextDefaultInt); + writer.writeLong(offsets[61], object.numpadBackDefaultInt); + writer.writeLong(offsets[62], object.numpadTextDefaultInt); + writer.writeLong(offsets[63], object.overlayInt); + writer.writeLong(offsets[64], object.popupBGInt); + writer.writeLong(offsets[65], object.radioButtonBorderDisabledInt); + writer.writeLong(offsets[66], object.radioButtonBorderEnabledInt); + writer.writeLong(offsets[67], object.radioButtonIconBorderDisabledInt); + writer.writeLong(offsets[68], object.radioButtonIconBorderInt); + writer.writeLong(offsets[69], object.radioButtonIconCircleInt); + writer.writeLong(offsets[70], object.radioButtonIconEnabledInt); + writer.writeLong(offsets[71], object.radioButtonLabelDisabledInt); + writer.writeLong(offsets[72], object.radioButtonLabelEnabledInt); + writer.writeLong(offsets[73], object.radioButtonTextDisabledInt); + writer.writeLong(offsets[74], object.radioButtonTextEnabledInt); + writer.writeLong(offsets[75], object.rateTypeToggleColorOffInt); + writer.writeLong(offsets[76], object.rateTypeToggleColorOnInt); + writer.writeLong(offsets[77], object.rateTypeToggleDesktopColorOffInt); + writer.writeLong(offsets[78], object.rateTypeToggleDesktopColorOnInt); + writer.writeLong(offsets[79], object.settingsIconBack2Int); + writer.writeLong(offsets[80], object.settingsIconBackInt); + writer.writeLong(offsets[81], object.settingsIconElementInt); + writer.writeLong(offsets[82], object.settingsIconIconInt); + writer.writeLong(offsets[83], object.settingsItem2ActiveBGInt); + writer.writeLong(offsets[84], object.settingsItem2ActiveSubInt); + writer.writeLong(offsets[85], object.settingsItem2ActiveTextInt); + writer.writeLong(offsets[86], object.shadowInt); + writer.writeLong(offsets[87], object.snackBarBackErrorInt); + writer.writeLong(offsets[88], object.snackBarBackInfoInt); + writer.writeLong(offsets[89], object.snackBarBackSuccessInt); + writer.writeLong(offsets[90], object.snackBarTextErrorInt); + writer.writeLong(offsets[91], object.snackBarTextInfoInt); + writer.writeLong(offsets[92], object.snackBarTextSuccessInt); + writer.writeLong(offsets[93], object.splashInt); + writer.writeLong(offsets[94], object.stackWalletBGInt); + writer.writeLong(offsets[95], object.stackWalletBottomInt); + writer.writeLong(offsets[96], object.stackWalletMidInt); + writer.writeString(offsets[97], object.standardBoxShadowString); + writer.writeLong(offsets[98], object.stepIndicatorBGCheckInt); + writer.writeLong(offsets[99], object.stepIndicatorBGInactiveInt); + writer.writeLong(offsets[100], object.stepIndicatorBGLinesInactiveInt); + writer.writeLong(offsets[101], object.stepIndicatorBGLinesInt); + writer.writeLong(offsets[102], object.stepIndicatorBGNumberInt); + writer.writeLong(offsets[103], object.stepIndicatorIconInactiveInt); + writer.writeLong(offsets[104], object.stepIndicatorIconNumberInt); + writer.writeLong(offsets[105], object.stepIndicatorIconTextInt); + writer.writeLong(offsets[106], object.switchBGDisabledInt); + writer.writeLong(offsets[107], object.switchBGOffInt); + writer.writeLong(offsets[108], object.switchBGOnInt); + writer.writeLong(offsets[109], object.switchCircleDisabledInt); + writer.writeLong(offsets[110], object.switchCircleOffInt); + writer.writeLong(offsets[111], object.switchCircleOnInt); + writer.writeLong(offsets[112], object.textConfirmTotalAmountInt); + writer.writeLong(offsets[113], object.textDark2Int); + writer.writeLong(offsets[114], object.textDark3Int); + writer.writeLong(offsets[115], object.textDarkInt); + writer.writeLong(offsets[116], object.textErrorInt); + writer.writeLong(offsets[117], object.textFavoriteCardInt); + writer.writeLong(offsets[118], object.textFieldActiveBGInt); + writer.writeLong(offsets[119], object.textFieldActiveLabelInt); + writer.writeLong(offsets[120], object.textFieldActiveSearchIconLeftInt); + writer.writeLong(offsets[121], object.textFieldActiveSearchIconRightInt); + writer.writeLong(offsets[122], object.textFieldActiveTextInt); + writer.writeLong(offsets[123], object.textFieldDefaultBGInt); + writer.writeLong(offsets[124], object.textFieldDefaultSearchIconLeftInt); + writer.writeLong(offsets[125], object.textFieldDefaultSearchIconRightInt); + writer.writeLong(offsets[126], object.textFieldDefaultTextInt); + writer.writeLong(offsets[127], object.textFieldErrorBGInt); + writer.writeLong(offsets[128], object.textFieldErrorBorderInt); + writer.writeLong(offsets[129], object.textFieldErrorLabelInt); + writer.writeLong(offsets[130], object.textFieldErrorSearchIconLeftInt); + writer.writeLong(offsets[131], object.textFieldErrorSearchIconRightInt); + writer.writeLong(offsets[132], object.textFieldErrorTextInt); + writer.writeLong(offsets[133], object.textFieldSuccessBGInt); + writer.writeLong(offsets[134], object.textFieldSuccessBorderInt); + writer.writeLong(offsets[135], object.textFieldSuccessLabelInt); + writer.writeLong(offsets[136], object.textFieldSuccessSearchIconLeftInt); + writer.writeLong(offsets[137], object.textFieldSuccessSearchIconRightInt); + writer.writeLong(offsets[138], object.textFieldSuccessTextInt); + writer.writeLong(offsets[139], object.textRestoreInt); + writer.writeLong(offsets[140], object.textSelectedWordTableItemInt); + writer.writeLong(offsets[141], object.textSubtitle1Int); + writer.writeLong(offsets[142], object.textSubtitle2Int); + writer.writeLong(offsets[143], object.textSubtitle3Int); + writer.writeLong(offsets[144], object.textSubtitle4Int); + writer.writeLong(offsets[145], object.textSubtitle5Int); + writer.writeLong(offsets[146], object.textSubtitle6Int); + writer.writeLong(offsets[147], object.textWhiteInt); + writer.writeString(offsets[148], object.themeId); + writer.writeLong(offsets[149], object.tokenSummaryBGInt); + writer.writeLong(offsets[150], object.tokenSummaryButtonBGInt); + writer.writeLong(offsets[151], object.tokenSummaryIconInt); + writer.writeLong(offsets[152], object.tokenSummaryTextPrimaryInt); + writer.writeLong(offsets[153], object.tokenSummaryTextSecondaryInt); + writer.writeLong(offsets[154], object.topNavIconGreenInt); + writer.writeLong(offsets[155], object.topNavIconPrimaryInt); + writer.writeLong(offsets[156], object.topNavIconRedInt); + writer.writeLong(offsets[157], object.topNavIconYellowInt); + writer.writeLong(offsets[158], object.version); + writer.writeLong(offsets[159], object.warningBackgroundInt); + writer.writeLong(offsets[160], object.warningForegroundInt); + writer.writeObject( + offsets[161], + allOffsets, + ThemeAssetsV3Schema.serialize, + object.assetsV3, ); - writer.writeLong(offsets[7], object.backgroundAppBarInt); - writer.writeLong(offsets[8], object.backgroundInt); - writer.writeLong(offsets[9], object.bottomNavBackInt); - writer.writeLong(offsets[10], object.bottomNavIconBackInt); - writer.writeLong(offsets[11], object.bottomNavIconIconHighlightedInt); - writer.writeLong(offsets[12], object.bottomNavIconIconInt); - writer.writeLong(offsets[13], object.bottomNavShadowInt); - writer.writeLong(offsets[14], object.bottomNavTextInt); - writer.writeString(offsets[15], object.brightnessString); - writer.writeLong(offsets[16], object.buttonBackBorderDisabledInt); - writer.writeLong(offsets[17], object.buttonBackBorderInt); - writer.writeLong(offsets[18], object.buttonBackBorderSecondaryDisabledInt); - writer.writeLong(offsets[19], object.buttonBackBorderSecondaryInt); - writer.writeLong(offsets[20], object.buttonBackPrimaryDisabledInt); - writer.writeLong(offsets[21], object.buttonBackPrimaryInt); - writer.writeLong(offsets[22], object.buttonBackSecondaryDisabledInt); - writer.writeLong(offsets[23], object.buttonBackSecondaryInt); - writer.writeLong(offsets[24], object.buttonTextBorderInt); - writer.writeLong(offsets[25], object.buttonTextBorderlessDisabledInt); - writer.writeLong(offsets[26], object.buttonTextBorderlessInt); - writer.writeLong(offsets[27], object.buttonTextDisabledInt); - writer.writeLong(offsets[28], object.buttonTextPrimaryDisabledInt); - writer.writeLong(offsets[29], object.buttonTextPrimaryInt); - writer.writeLong(offsets[30], object.buttonTextSecondaryDisabledInt); - writer.writeLong(offsets[31], object.buttonTextSecondaryInt); - writer.writeLong(offsets[32], object.checkboxBGCheckedInt); - writer.writeLong(offsets[33], object.checkboxBGDisabledInt); - writer.writeLong(offsets[34], object.checkboxBorderEmptyInt); - writer.writeLong(offsets[35], object.checkboxIconCheckedInt); - writer.writeLong(offsets[36], object.checkboxIconDisabledInt); - writer.writeLong(offsets[37], object.checkboxTextLabelInt); - writer.writeString(offsets[38], object.coinColorsJsonString); - writer.writeLong(offsets[39], object.currencyListItemBGInt); - writer.writeLong(offsets[40], object.customTextButtonDisabledTextInt); - writer.writeLong(offsets[41], object.customTextButtonEnabledTextInt); - writer.writeLong(offsets[42], object.ethTagBGInt); - writer.writeLong(offsets[43], object.ethTagTextInt); - writer.writeLong(offsets[44], object.ethWalletTagBGInt); - writer.writeLong(offsets[45], object.ethWalletTagTextInt); - writer.writeLong(offsets[46], object.favoriteStarActiveInt); - writer.writeLong(offsets[47], object.favoriteStarInactiveInt); - writer.writeString(offsets[48], object.gradientBackgroundString); - writer.writeLong(offsets[49], object.highlightInt); - writer.writeString(offsets[50], object.homeViewButtonBarBoxShadowString); - writer.writeLong(offsets[51], object.infoItemBGInt); - writer.writeLong(offsets[52], object.infoItemIconsInt); - writer.writeLong(offsets[53], object.infoItemLabelInt); - writer.writeLong(offsets[54], object.infoItemTextInt); - writer.writeLong(offsets[55], object.loadingOverlayTextColorInt); - writer.writeLong(offsets[56], object.myStackContactIconBGInt); - writer.writeString(offsets[57], object.name); - writer.writeLong(offsets[58], object.numberBackDefaultInt); - writer.writeLong(offsets[59], object.numberTextDefaultInt); - writer.writeLong(offsets[60], object.numpadBackDefaultInt); - writer.writeLong(offsets[61], object.numpadTextDefaultInt); - writer.writeLong(offsets[62], object.overlayInt); - writer.writeLong(offsets[63], object.popupBGInt); - writer.writeLong(offsets[64], object.radioButtonBorderDisabledInt); - writer.writeLong(offsets[65], object.radioButtonBorderEnabledInt); - writer.writeLong(offsets[66], object.radioButtonIconBorderDisabledInt); - writer.writeLong(offsets[67], object.radioButtonIconBorderInt); - writer.writeLong(offsets[68], object.radioButtonIconCircleInt); - writer.writeLong(offsets[69], object.radioButtonIconEnabledInt); - writer.writeLong(offsets[70], object.radioButtonLabelDisabledInt); - writer.writeLong(offsets[71], object.radioButtonLabelEnabledInt); - writer.writeLong(offsets[72], object.radioButtonTextDisabledInt); - writer.writeLong(offsets[73], object.radioButtonTextEnabledInt); - writer.writeLong(offsets[74], object.rateTypeToggleColorOffInt); - writer.writeLong(offsets[75], object.rateTypeToggleColorOnInt); - writer.writeLong(offsets[76], object.rateTypeToggleDesktopColorOffInt); - writer.writeLong(offsets[77], object.rateTypeToggleDesktopColorOnInt); - writer.writeLong(offsets[78], object.settingsIconBack2Int); - writer.writeLong(offsets[79], object.settingsIconBackInt); - writer.writeLong(offsets[80], object.settingsIconElementInt); - writer.writeLong(offsets[81], object.settingsIconIconInt); - writer.writeLong(offsets[82], object.settingsItem2ActiveBGInt); - writer.writeLong(offsets[83], object.settingsItem2ActiveSubInt); - writer.writeLong(offsets[84], object.settingsItem2ActiveTextInt); - writer.writeLong(offsets[85], object.shadowInt); - writer.writeLong(offsets[86], object.snackBarBackErrorInt); - writer.writeLong(offsets[87], object.snackBarBackInfoInt); - writer.writeLong(offsets[88], object.snackBarBackSuccessInt); - writer.writeLong(offsets[89], object.snackBarTextErrorInt); - writer.writeLong(offsets[90], object.snackBarTextInfoInt); - writer.writeLong(offsets[91], object.snackBarTextSuccessInt); - writer.writeLong(offsets[92], object.splashInt); - writer.writeLong(offsets[93], object.stackWalletBGInt); - writer.writeLong(offsets[94], object.stackWalletBottomInt); - writer.writeLong(offsets[95], object.stackWalletMidInt); - writer.writeString(offsets[96], object.standardBoxShadowString); - writer.writeLong(offsets[97], object.stepIndicatorBGCheckInt); - writer.writeLong(offsets[98], object.stepIndicatorBGInactiveInt); - writer.writeLong(offsets[99], object.stepIndicatorBGLinesInactiveInt); - writer.writeLong(offsets[100], object.stepIndicatorBGLinesInt); - writer.writeLong(offsets[101], object.stepIndicatorBGNumberInt); - writer.writeLong(offsets[102], object.stepIndicatorIconInactiveInt); - writer.writeLong(offsets[103], object.stepIndicatorIconNumberInt); - writer.writeLong(offsets[104], object.stepIndicatorIconTextInt); - writer.writeLong(offsets[105], object.switchBGDisabledInt); - writer.writeLong(offsets[106], object.switchBGOffInt); - writer.writeLong(offsets[107], object.switchBGOnInt); - writer.writeLong(offsets[108], object.switchCircleDisabledInt); - writer.writeLong(offsets[109], object.switchCircleOffInt); - writer.writeLong(offsets[110], object.switchCircleOnInt); - writer.writeLong(offsets[111], object.textConfirmTotalAmountInt); - writer.writeLong(offsets[112], object.textDark2Int); - writer.writeLong(offsets[113], object.textDark3Int); - writer.writeLong(offsets[114], object.textDarkInt); - writer.writeLong(offsets[115], object.textErrorInt); - writer.writeLong(offsets[116], object.textFavoriteCardInt); - writer.writeLong(offsets[117], object.textFieldActiveBGInt); - writer.writeLong(offsets[118], object.textFieldActiveLabelInt); - writer.writeLong(offsets[119], object.textFieldActiveSearchIconLeftInt); - writer.writeLong(offsets[120], object.textFieldActiveSearchIconRightInt); - writer.writeLong(offsets[121], object.textFieldActiveTextInt); - writer.writeLong(offsets[122], object.textFieldDefaultBGInt); - writer.writeLong(offsets[123], object.textFieldDefaultSearchIconLeftInt); - writer.writeLong(offsets[124], object.textFieldDefaultSearchIconRightInt); - writer.writeLong(offsets[125], object.textFieldDefaultTextInt); - writer.writeLong(offsets[126], object.textFieldErrorBGInt); - writer.writeLong(offsets[127], object.textFieldErrorBorderInt); - writer.writeLong(offsets[128], object.textFieldErrorLabelInt); - writer.writeLong(offsets[129], object.textFieldErrorSearchIconLeftInt); - writer.writeLong(offsets[130], object.textFieldErrorSearchIconRightInt); - writer.writeLong(offsets[131], object.textFieldErrorTextInt); - writer.writeLong(offsets[132], object.textFieldSuccessBGInt); - writer.writeLong(offsets[133], object.textFieldSuccessBorderInt); - writer.writeLong(offsets[134], object.textFieldSuccessLabelInt); - writer.writeLong(offsets[135], object.textFieldSuccessSearchIconLeftInt); - writer.writeLong(offsets[136], object.textFieldSuccessSearchIconRightInt); - writer.writeLong(offsets[137], object.textFieldSuccessTextInt); - writer.writeLong(offsets[138], object.textRestoreInt); - writer.writeLong(offsets[139], object.textSelectedWordTableItemInt); - writer.writeLong(offsets[140], object.textSubtitle1Int); - writer.writeLong(offsets[141], object.textSubtitle2Int); - writer.writeLong(offsets[142], object.textSubtitle3Int); - writer.writeLong(offsets[143], object.textSubtitle4Int); - writer.writeLong(offsets[144], object.textSubtitle5Int); - writer.writeLong(offsets[145], object.textSubtitle6Int); - writer.writeLong(offsets[146], object.textWhiteInt); - writer.writeString(offsets[147], object.themeId); - writer.writeLong(offsets[148], object.tokenSummaryBGInt); - writer.writeLong(offsets[149], object.tokenSummaryButtonBGInt); - writer.writeLong(offsets[150], object.tokenSummaryIconInt); - writer.writeLong(offsets[151], object.tokenSummaryTextPrimaryInt); - writer.writeLong(offsets[152], object.tokenSummaryTextSecondaryInt); - writer.writeLong(offsets[153], object.topNavIconGreenInt); - writer.writeLong(offsets[154], object.topNavIconPrimaryInt); - writer.writeLong(offsets[155], object.topNavIconRedInt); - writer.writeLong(offsets[156], object.topNavIconYellowInt); - writer.writeLong(offsets[157], object.warningBackgroundInt); - writer.writeLong(offsets[158], object.warningForegroundInt); } StackTheme _stackThemeDeserialize( @@ -1049,173 +1104,183 @@ StackTheme _stackThemeDeserialize( List offsets, Map> allOffsets, ) { - final object = StackTheme( - accentColorBlueInt: reader.readLong(offsets[0]), - accentColorDarkInt: reader.readLong(offsets[1]), - accentColorGreenInt: reader.readLong(offsets[2]), - accentColorOrangeInt: reader.readLong(offsets[3]), - accentColorRedInt: reader.readLong(offsets[4]), - accentColorYellowInt: reader.readLong(offsets[5]), - assets: reader.readObjectOrNull( - offsets[6], - ThemeAssetsSchema.deserialize, - allOffsets, - ) ?? - ThemeAssets(), - backgroundAppBarInt: reader.readLong(offsets[7]), - backgroundInt: reader.readLong(offsets[8]), - bottomNavBackInt: reader.readLong(offsets[9]), - bottomNavIconBackInt: reader.readLong(offsets[10]), - bottomNavIconIconHighlightedInt: reader.readLong(offsets[11]), - bottomNavIconIconInt: reader.readLong(offsets[12]), - bottomNavShadowInt: reader.readLong(offsets[13]), - bottomNavTextInt: reader.readLong(offsets[14]), - brightnessString: reader.readString(offsets[15]), - buttonBackBorderDisabledInt: reader.readLong(offsets[16]), - buttonBackBorderInt: reader.readLong(offsets[17]), - buttonBackBorderSecondaryDisabledInt: reader.readLong(offsets[18]), - buttonBackBorderSecondaryInt: reader.readLong(offsets[19]), - buttonBackPrimaryDisabledInt: reader.readLong(offsets[20]), - buttonBackPrimaryInt: reader.readLong(offsets[21]), - buttonBackSecondaryDisabledInt: reader.readLong(offsets[22]), - buttonBackSecondaryInt: reader.readLong(offsets[23]), - buttonTextBorderInt: reader.readLong(offsets[24]), - buttonTextBorderlessDisabledInt: reader.readLong(offsets[25]), - buttonTextBorderlessInt: reader.readLong(offsets[26]), - buttonTextDisabledInt: reader.readLong(offsets[27]), - buttonTextPrimaryDisabledInt: reader.readLong(offsets[28]), - buttonTextPrimaryInt: reader.readLong(offsets[29]), - buttonTextSecondaryDisabledInt: reader.readLong(offsets[30]), - buttonTextSecondaryInt: reader.readLong(offsets[31]), - checkboxBGCheckedInt: reader.readLong(offsets[32]), - checkboxBGDisabledInt: reader.readLong(offsets[33]), - checkboxBorderEmptyInt: reader.readLong(offsets[34]), - checkboxIconCheckedInt: reader.readLong(offsets[35]), - checkboxIconDisabledInt: reader.readLong(offsets[36]), - checkboxTextLabelInt: reader.readLong(offsets[37]), - coinColorsJsonString: reader.readString(offsets[38]), - currencyListItemBGInt: reader.readLong(offsets[39]), - customTextButtonDisabledTextInt: reader.readLong(offsets[40]), - customTextButtonEnabledTextInt: reader.readLong(offsets[41]), - ethTagBGInt: reader.readLong(offsets[42]), - ethTagTextInt: reader.readLong(offsets[43]), - ethWalletTagBGInt: reader.readLong(offsets[44]), - ethWalletTagTextInt: reader.readLong(offsets[45]), - favoriteStarActiveInt: reader.readLong(offsets[46]), - favoriteStarInactiveInt: reader.readLong(offsets[47]), - gradientBackgroundString: reader.readStringOrNull(offsets[48]), - highlightInt: reader.readLong(offsets[49]), - homeViewButtonBarBoxShadowString: reader.readStringOrNull(offsets[50]), - infoItemBGInt: reader.readLong(offsets[51]), - infoItemIconsInt: reader.readLong(offsets[52]), - infoItemLabelInt: reader.readLong(offsets[53]), - infoItemTextInt: reader.readLong(offsets[54]), - loadingOverlayTextColorInt: reader.readLong(offsets[55]), - myStackContactIconBGInt: reader.readLong(offsets[56]), - name: reader.readString(offsets[57]), - numberBackDefaultInt: reader.readLong(offsets[58]), - numberTextDefaultInt: reader.readLong(offsets[59]), - numpadBackDefaultInt: reader.readLong(offsets[60]), - numpadTextDefaultInt: reader.readLong(offsets[61]), - overlayInt: reader.readLong(offsets[62]), - popupBGInt: reader.readLong(offsets[63]), - radioButtonBorderDisabledInt: reader.readLong(offsets[64]), - radioButtonBorderEnabledInt: reader.readLong(offsets[65]), - radioButtonIconBorderDisabledInt: reader.readLong(offsets[66]), - radioButtonIconBorderInt: reader.readLong(offsets[67]), - radioButtonIconCircleInt: reader.readLong(offsets[68]), - radioButtonIconEnabledInt: reader.readLong(offsets[69]), - radioButtonLabelDisabledInt: reader.readLong(offsets[70]), - radioButtonLabelEnabledInt: reader.readLong(offsets[71]), - radioButtonTextDisabledInt: reader.readLong(offsets[72]), - radioButtonTextEnabledInt: reader.readLong(offsets[73]), - rateTypeToggleColorOffInt: reader.readLong(offsets[74]), - rateTypeToggleColorOnInt: reader.readLong(offsets[75]), - rateTypeToggleDesktopColorOffInt: reader.readLong(offsets[76]), - rateTypeToggleDesktopColorOnInt: reader.readLong(offsets[77]), - settingsIconBack2Int: reader.readLong(offsets[78]), - settingsIconBackInt: reader.readLong(offsets[79]), - settingsIconElementInt: reader.readLong(offsets[80]), - settingsIconIconInt: reader.readLong(offsets[81]), - settingsItem2ActiveBGInt: reader.readLong(offsets[82]), - settingsItem2ActiveSubInt: reader.readLong(offsets[83]), - settingsItem2ActiveTextInt: reader.readLong(offsets[84]), - shadowInt: reader.readLong(offsets[85]), - snackBarBackErrorInt: reader.readLong(offsets[86]), - snackBarBackInfoInt: reader.readLong(offsets[87]), - snackBarBackSuccessInt: reader.readLong(offsets[88]), - snackBarTextErrorInt: reader.readLong(offsets[89]), - snackBarTextInfoInt: reader.readLong(offsets[90]), - snackBarTextSuccessInt: reader.readLong(offsets[91]), - splashInt: reader.readLong(offsets[92]), - stackWalletBGInt: reader.readLong(offsets[93]), - stackWalletBottomInt: reader.readLong(offsets[94]), - stackWalletMidInt: reader.readLong(offsets[95]), - standardBoxShadowString: reader.readString(offsets[96]), - stepIndicatorBGCheckInt: reader.readLong(offsets[97]), - stepIndicatorBGInactiveInt: reader.readLong(offsets[98]), - stepIndicatorBGLinesInactiveInt: reader.readLong(offsets[99]), - stepIndicatorBGLinesInt: reader.readLong(offsets[100]), - stepIndicatorBGNumberInt: reader.readLong(offsets[101]), - stepIndicatorIconInactiveInt: reader.readLong(offsets[102]), - stepIndicatorIconNumberInt: reader.readLong(offsets[103]), - stepIndicatorIconTextInt: reader.readLong(offsets[104]), - switchBGDisabledInt: reader.readLong(offsets[105]), - switchBGOffInt: reader.readLong(offsets[106]), - switchBGOnInt: reader.readLong(offsets[107]), - switchCircleDisabledInt: reader.readLong(offsets[108]), - switchCircleOffInt: reader.readLong(offsets[109]), - switchCircleOnInt: reader.readLong(offsets[110]), - textConfirmTotalAmountInt: reader.readLong(offsets[111]), - textDark2Int: reader.readLong(offsets[112]), - textDark3Int: reader.readLong(offsets[113]), - textDarkInt: reader.readLong(offsets[114]), - textErrorInt: reader.readLong(offsets[115]), - textFavoriteCardInt: reader.readLong(offsets[116]), - textFieldActiveBGInt: reader.readLong(offsets[117]), - textFieldActiveLabelInt: reader.readLong(offsets[118]), - textFieldActiveSearchIconLeftInt: reader.readLong(offsets[119]), - textFieldActiveSearchIconRightInt: reader.readLong(offsets[120]), - textFieldActiveTextInt: reader.readLong(offsets[121]), - textFieldDefaultBGInt: reader.readLong(offsets[122]), - textFieldDefaultSearchIconLeftInt: reader.readLong(offsets[123]), - textFieldDefaultSearchIconRightInt: reader.readLong(offsets[124]), - textFieldDefaultTextInt: reader.readLong(offsets[125]), - textFieldErrorBGInt: reader.readLong(offsets[126]), - textFieldErrorBorderInt: reader.readLong(offsets[127]), - textFieldErrorLabelInt: reader.readLong(offsets[128]), - textFieldErrorSearchIconLeftInt: reader.readLong(offsets[129]), - textFieldErrorSearchIconRightInt: reader.readLong(offsets[130]), - textFieldErrorTextInt: reader.readLong(offsets[131]), - textFieldSuccessBGInt: reader.readLong(offsets[132]), - textFieldSuccessBorderInt: reader.readLong(offsets[133]), - textFieldSuccessLabelInt: reader.readLong(offsets[134]), - textFieldSuccessSearchIconLeftInt: reader.readLong(offsets[135]), - textFieldSuccessSearchIconRightInt: reader.readLong(offsets[136]), - textFieldSuccessTextInt: reader.readLong(offsets[137]), - textRestoreInt: reader.readLong(offsets[138]), - textSelectedWordTableItemInt: reader.readLong(offsets[139]), - textSubtitle1Int: reader.readLong(offsets[140]), - textSubtitle2Int: reader.readLong(offsets[141]), - textSubtitle3Int: reader.readLong(offsets[142]), - textSubtitle4Int: reader.readLong(offsets[143]), - textSubtitle5Int: reader.readLong(offsets[144]), - textSubtitle6Int: reader.readLong(offsets[145]), - textWhiteInt: reader.readLong(offsets[146]), - themeId: reader.readString(offsets[147]), - tokenSummaryBGInt: reader.readLong(offsets[148]), - tokenSummaryButtonBGInt: reader.readLong(offsets[149]), - tokenSummaryIconInt: reader.readLong(offsets[150]), - tokenSummaryTextPrimaryInt: reader.readLong(offsets[151]), - tokenSummaryTextSecondaryInt: reader.readLong(offsets[152]), - topNavIconGreenInt: reader.readLong(offsets[153]), - topNavIconPrimaryInt: reader.readLong(offsets[154]), - topNavIconRedInt: reader.readLong(offsets[155]), - topNavIconYellowInt: reader.readLong(offsets[156]), - warningBackgroundInt: reader.readLong(offsets[157]), - warningForegroundInt: reader.readLong(offsets[158]), + final object = StackTheme(); + object.accentColorBlueInt = reader.readLong(offsets[0]); + object.accentColorDarkInt = reader.readLong(offsets[1]); + object.accentColorGreenInt = reader.readLong(offsets[2]); + object.accentColorOrangeInt = reader.readLong(offsets[3]); + object.accentColorRedInt = reader.readLong(offsets[4]); + object.accentColorYellowInt = reader.readLong(offsets[5]); + object.assetsV1 = reader.readObjectOrNull( + offsets[6], + ThemeAssetsSchema.deserialize, + allOffsets, + ); + object.assetsV2 = reader.readObjectOrNull( + offsets[7], + ThemeAssetsV2Schema.deserialize, + allOffsets, ); + object.backgroundAppBarInt = reader.readLong(offsets[8]); + object.backgroundInt = reader.readLong(offsets[9]); + object.bottomNavBackInt = reader.readLong(offsets[10]); + object.bottomNavIconBackInt = reader.readLong(offsets[11]); + object.bottomNavIconIconHighlightedInt = reader.readLong(offsets[12]); + object.bottomNavIconIconInt = reader.readLong(offsets[13]); + object.bottomNavShadowInt = reader.readLong(offsets[14]); + object.bottomNavTextInt = reader.readLong(offsets[15]); + object.brightnessString = reader.readString(offsets[16]); + object.buttonBackBorderDisabledInt = reader.readLong(offsets[17]); + object.buttonBackBorderInt = reader.readLong(offsets[18]); + object.buttonBackBorderSecondaryDisabledInt = reader.readLong(offsets[19]); + object.buttonBackBorderSecondaryInt = reader.readLong(offsets[20]); + object.buttonBackPrimaryDisabledInt = reader.readLong(offsets[21]); + object.buttonBackPrimaryInt = reader.readLong(offsets[22]); + object.buttonBackSecondaryDisabledInt = reader.readLong(offsets[23]); + object.buttonBackSecondaryInt = reader.readLong(offsets[24]); + object.buttonTextBorderInt = reader.readLong(offsets[25]); + object.buttonTextBorderlessDisabledInt = reader.readLong(offsets[26]); + object.buttonTextBorderlessInt = reader.readLong(offsets[27]); + object.buttonTextDisabledInt = reader.readLong(offsets[28]); + object.buttonTextPrimaryDisabledInt = reader.readLong(offsets[29]); + object.buttonTextPrimaryInt = reader.readLong(offsets[30]); + object.buttonTextSecondaryDisabledInt = reader.readLong(offsets[31]); + object.buttonTextSecondaryInt = reader.readLong(offsets[32]); + object.checkboxBGCheckedInt = reader.readLong(offsets[33]); + object.checkboxBGDisabledInt = reader.readLong(offsets[34]); + object.checkboxBorderEmptyInt = reader.readLong(offsets[35]); + object.checkboxIconCheckedInt = reader.readLong(offsets[36]); + object.checkboxIconDisabledInt = reader.readLong(offsets[37]); + object.checkboxTextLabelInt = reader.readLong(offsets[38]); + object.coinColorsJsonString = reader.readString(offsets[39]); + object.currencyListItemBGInt = reader.readLong(offsets[40]); + object.customTextButtonDisabledTextInt = reader.readLong(offsets[41]); + object.customTextButtonEnabledTextInt = reader.readLong(offsets[42]); + object.ethTagBGInt = reader.readLong(offsets[43]); + object.ethTagTextInt = reader.readLong(offsets[44]); + object.ethWalletTagBGInt = reader.readLong(offsets[45]); + object.ethWalletTagTextInt = reader.readLong(offsets[46]); + object.favoriteStarActiveInt = reader.readLong(offsets[47]); + object.favoriteStarInactiveInt = reader.readLong(offsets[48]); + object.gradientBackgroundString = reader.readStringOrNull(offsets[49]); + object.highlightInt = reader.readLong(offsets[50]); + object.homeViewButtonBarBoxShadowString = + reader.readStringOrNull(offsets[51]); object.id = id; + object.infoItemBGInt = reader.readLong(offsets[52]); + object.infoItemIconsInt = reader.readLong(offsets[53]); + object.infoItemLabelInt = reader.readLong(offsets[54]); + object.infoItemTextInt = reader.readLong(offsets[55]); + object.loadingOverlayTextColorInt = reader.readLong(offsets[56]); + object.myStackContactIconBGInt = reader.readLong(offsets[57]); + object.name = reader.readString(offsets[58]); + object.numberBackDefaultInt = reader.readLong(offsets[59]); + object.numberTextDefaultInt = reader.readLong(offsets[60]); + object.numpadBackDefaultInt = reader.readLong(offsets[61]); + object.numpadTextDefaultInt = reader.readLong(offsets[62]); + object.overlayInt = reader.readLong(offsets[63]); + object.popupBGInt = reader.readLong(offsets[64]); + object.radioButtonBorderDisabledInt = reader.readLong(offsets[65]); + object.radioButtonBorderEnabledInt = reader.readLong(offsets[66]); + object.radioButtonIconBorderDisabledInt = reader.readLong(offsets[67]); + object.radioButtonIconBorderInt = reader.readLong(offsets[68]); + object.radioButtonIconCircleInt = reader.readLong(offsets[69]); + object.radioButtonIconEnabledInt = reader.readLong(offsets[70]); + object.radioButtonLabelDisabledInt = reader.readLong(offsets[71]); + object.radioButtonLabelEnabledInt = reader.readLong(offsets[72]); + object.radioButtonTextDisabledInt = reader.readLong(offsets[73]); + object.radioButtonTextEnabledInt = reader.readLong(offsets[74]); + object.rateTypeToggleColorOffInt = reader.readLong(offsets[75]); + object.rateTypeToggleColorOnInt = reader.readLong(offsets[76]); + object.rateTypeToggleDesktopColorOffInt = reader.readLong(offsets[77]); + object.rateTypeToggleDesktopColorOnInt = reader.readLong(offsets[78]); + object.settingsIconBack2Int = reader.readLong(offsets[79]); + object.settingsIconBackInt = reader.readLong(offsets[80]); + object.settingsIconElementInt = reader.readLong(offsets[81]); + object.settingsIconIconInt = reader.readLong(offsets[82]); + object.settingsItem2ActiveBGInt = reader.readLong(offsets[83]); + object.settingsItem2ActiveSubInt = reader.readLong(offsets[84]); + object.settingsItem2ActiveTextInt = reader.readLong(offsets[85]); + object.shadowInt = reader.readLong(offsets[86]); + object.snackBarBackErrorInt = reader.readLong(offsets[87]); + object.snackBarBackInfoInt = reader.readLong(offsets[88]); + object.snackBarBackSuccessInt = reader.readLong(offsets[89]); + object.snackBarTextErrorInt = reader.readLong(offsets[90]); + object.snackBarTextInfoInt = reader.readLong(offsets[91]); + object.snackBarTextSuccessInt = reader.readLong(offsets[92]); + object.splashInt = reader.readLong(offsets[93]); + object.stackWalletBGInt = reader.readLong(offsets[94]); + object.stackWalletBottomInt = reader.readLong(offsets[95]); + object.stackWalletMidInt = reader.readLong(offsets[96]); + object.standardBoxShadowString = reader.readString(offsets[97]); + object.stepIndicatorBGCheckInt = reader.readLong(offsets[98]); + object.stepIndicatorBGInactiveInt = reader.readLong(offsets[99]); + object.stepIndicatorBGLinesInactiveInt = reader.readLong(offsets[100]); + object.stepIndicatorBGLinesInt = reader.readLong(offsets[101]); + object.stepIndicatorBGNumberInt = reader.readLong(offsets[102]); + object.stepIndicatorIconInactiveInt = reader.readLong(offsets[103]); + object.stepIndicatorIconNumberInt = reader.readLong(offsets[104]); + object.stepIndicatorIconTextInt = reader.readLong(offsets[105]); + object.switchBGDisabledInt = reader.readLong(offsets[106]); + object.switchBGOffInt = reader.readLong(offsets[107]); + object.switchBGOnInt = reader.readLong(offsets[108]); + object.switchCircleDisabledInt = reader.readLong(offsets[109]); + object.switchCircleOffInt = reader.readLong(offsets[110]); + object.switchCircleOnInt = reader.readLong(offsets[111]); + object.textConfirmTotalAmountInt = reader.readLong(offsets[112]); + object.textDark2Int = reader.readLong(offsets[113]); + object.textDark3Int = reader.readLong(offsets[114]); + object.textDarkInt = reader.readLong(offsets[115]); + object.textErrorInt = reader.readLong(offsets[116]); + object.textFavoriteCardInt = reader.readLong(offsets[117]); + object.textFieldActiveBGInt = reader.readLong(offsets[118]); + object.textFieldActiveLabelInt = reader.readLong(offsets[119]); + object.textFieldActiveSearchIconLeftInt = reader.readLong(offsets[120]); + object.textFieldActiveSearchIconRightInt = reader.readLong(offsets[121]); + object.textFieldActiveTextInt = reader.readLong(offsets[122]); + object.textFieldDefaultBGInt = reader.readLong(offsets[123]); + object.textFieldDefaultSearchIconLeftInt = reader.readLong(offsets[124]); + object.textFieldDefaultSearchIconRightInt = reader.readLong(offsets[125]); + object.textFieldDefaultTextInt = reader.readLong(offsets[126]); + object.textFieldErrorBGInt = reader.readLong(offsets[127]); + object.textFieldErrorBorderInt = reader.readLong(offsets[128]); + object.textFieldErrorLabelInt = reader.readLong(offsets[129]); + object.textFieldErrorSearchIconLeftInt = reader.readLong(offsets[130]); + object.textFieldErrorSearchIconRightInt = reader.readLong(offsets[131]); + object.textFieldErrorTextInt = reader.readLong(offsets[132]); + object.textFieldSuccessBGInt = reader.readLong(offsets[133]); + object.textFieldSuccessBorderInt = reader.readLong(offsets[134]); + object.textFieldSuccessLabelInt = reader.readLong(offsets[135]); + object.textFieldSuccessSearchIconLeftInt = reader.readLong(offsets[136]); + object.textFieldSuccessSearchIconRightInt = reader.readLong(offsets[137]); + object.textFieldSuccessTextInt = reader.readLong(offsets[138]); + object.textRestoreInt = reader.readLong(offsets[139]); + object.textSelectedWordTableItemInt = reader.readLong(offsets[140]); + object.textSubtitle1Int = reader.readLong(offsets[141]); + object.textSubtitle2Int = reader.readLong(offsets[142]); + object.textSubtitle3Int = reader.readLong(offsets[143]); + object.textSubtitle4Int = reader.readLong(offsets[144]); + object.textSubtitle5Int = reader.readLong(offsets[145]); + object.textSubtitle6Int = reader.readLong(offsets[146]); + object.textWhiteInt = reader.readLong(offsets[147]); + object.themeId = reader.readString(offsets[148]); + object.tokenSummaryBGInt = reader.readLong(offsets[149]); + object.tokenSummaryButtonBGInt = reader.readLong(offsets[150]); + object.tokenSummaryIconInt = reader.readLong(offsets[151]); + object.tokenSummaryTextPrimaryInt = reader.readLong(offsets[152]); + object.tokenSummaryTextSecondaryInt = reader.readLong(offsets[153]); + object.topNavIconGreenInt = reader.readLong(offsets[154]); + object.topNavIconPrimaryInt = reader.readLong(offsets[155]); + object.topNavIconRedInt = reader.readLong(offsets[156]); + object.topNavIconYellowInt = reader.readLong(offsets[157]); + object.version = reader.readLongOrNull(offsets[158]); + object.warningBackgroundInt = reader.readLong(offsets[159]); + object.warningForegroundInt = reader.readLong(offsets[160]); + object.assetsV3 = reader.readObjectOrNull( + offsets[161], + ThemeAssetsV3Schema.deserialize, + allOffsets, + ); return object; } @@ -1240,13 +1305,16 @@ P _stackThemeDeserializeProp

( return (reader.readLong(offset)) as P; case 6: return (reader.readObjectOrNull( - offset, - ThemeAssetsSchema.deserialize, - allOffsets, - ) ?? - ThemeAssets()) as P; + offset, + ThemeAssetsSchema.deserialize, + allOffsets, + )) as P; case 7: - return (reader.readLong(offset)) as P; + return (reader.readObjectOrNull( + offset, + ThemeAssetsV2Schema.deserialize, + allOffsets, + )) as P; case 8: return (reader.readLong(offset)) as P; case 9: @@ -1262,9 +1330,9 @@ P _stackThemeDeserializeProp

( case 14: return (reader.readLong(offset)) as P; case 15: - return (reader.readString(offset)) as P; - case 16: return (reader.readLong(offset)) as P; + case 16: + return (reader.readString(offset)) as P; case 17: return (reader.readLong(offset)) as P; case 18: @@ -1308,9 +1376,9 @@ P _stackThemeDeserializeProp

( case 37: return (reader.readLong(offset)) as P; case 38: - return (reader.readString(offset)) as P; - case 39: return (reader.readLong(offset)) as P; + case 39: + return (reader.readString(offset)) as P; case 40: return (reader.readLong(offset)) as P; case 41: @@ -1328,13 +1396,13 @@ P _stackThemeDeserializeProp

( case 47: return (reader.readLong(offset)) as P; case 48: - return (reader.readStringOrNull(offset)) as P; - case 49: return (reader.readLong(offset)) as P; - case 50: + case 49: return (reader.readStringOrNull(offset)) as P; - case 51: + case 50: return (reader.readLong(offset)) as P; + case 51: + return (reader.readStringOrNull(offset)) as P; case 52: return (reader.readLong(offset)) as P; case 53: @@ -1346,9 +1414,9 @@ P _stackThemeDeserializeProp

( case 56: return (reader.readLong(offset)) as P; case 57: - return (reader.readString(offset)) as P; - case 58: return (reader.readLong(offset)) as P; + case 58: + return (reader.readString(offset)) as P; case 59: return (reader.readLong(offset)) as P; case 60: @@ -1424,9 +1492,9 @@ P _stackThemeDeserializeProp

( case 95: return (reader.readLong(offset)) as P; case 96: - return (reader.readString(offset)) as P; - case 97: return (reader.readLong(offset)) as P; + case 97: + return (reader.readString(offset)) as P; case 98: return (reader.readLong(offset)) as P; case 99: @@ -1526,9 +1594,9 @@ P _stackThemeDeserializeProp

( case 146: return (reader.readLong(offset)) as P; case 147: - return (reader.readString(offset)) as P; - case 148: return (reader.readLong(offset)) as P; + case 148: + return (reader.readString(offset)) as P; case 149: return (reader.readLong(offset)) as P; case 150: @@ -1548,7 +1616,17 @@ P _stackThemeDeserializeProp

( case 157: return (reader.readLong(offset)) as P; case 158: + return (reader.readLongOrNull(offset)) as P; + case 159: return (reader.readLong(offset)) as P; + case 160: + return (reader.readLong(offset)) as P; + case 161: + return (reader.readObjectOrNull( + offset, + ThemeAssetsV3Schema.deserialize, + allOffsets, + )) as P; default: throw IsarError('Unknown property with id $propertyId'); } @@ -2081,6 +2159,40 @@ extension StackThemeQueryFilter }); } + QueryBuilder assetsV1IsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'assets', + )); + }); + } + + QueryBuilder + assetsV1IsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'assets', + )); + }); + } + + QueryBuilder assetsV2IsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'assetsV2', + )); + }); + } + + QueryBuilder + assetsV2IsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'assetsV2', + )); + }); + } + QueryBuilder backgroundAppBarIntEqualTo(int value) { return QueryBuilder.apply(this, (query) { @@ -11120,6 +11232,77 @@ extension StackThemeQueryFilter }); } + QueryBuilder versionIsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'version', + )); + }); + } + + QueryBuilder + versionIsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'version', + )); + }); + } + + QueryBuilder versionEqualTo( + int? value) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'version', + value: value, + )); + }); + } + + QueryBuilder + versionGreaterThan( + int? value, { + bool include = false, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'version', + value: value, + )); + }); + } + + QueryBuilder versionLessThan( + int? value, { + bool include = false, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'version', + value: value, + )); + }); + } + + QueryBuilder versionBetween( + int? lower, + int? upper, { + bool includeLower = true, + bool includeUpper = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'version', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + )); + }); + } + QueryBuilder warningBackgroundIntEqualTo(int value) { return QueryBuilder.apply(this, (query) { @@ -11231,16 +11414,47 @@ extension StackThemeQueryFilter )); }); } + + QueryBuilder assetsV3IsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'zAssetsV3', + )); + }); + } + + QueryBuilder + assetsV3IsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'zAssetsV3', + )); + }); + } } extension StackThemeQueryObject on QueryBuilder { - QueryBuilder assets( + QueryBuilder assetsV1( FilterQuery q) { return QueryBuilder.apply(this, (query) { return query.object(q, r'assets'); }); } + + QueryBuilder assetsV2( + FilterQuery q) { + return QueryBuilder.apply(this, (query) { + return query.object(q, r'assetsV2'); + }); + } + + QueryBuilder assetsV3( + FilterQuery q) { + return QueryBuilder.apply(this, (query) { + return query.object(q, r'zAssetsV3'); + }); + } } extension StackThemeQueryLinks @@ -13378,6 +13592,18 @@ extension StackThemeQuerySortBy }); } + QueryBuilder sortByVersion() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'version', Sort.asc); + }); + } + + QueryBuilder sortByVersionDesc() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'version', Sort.desc); + }); + } + QueryBuilder sortByWarningBackgroundInt() { return QueryBuilder.apply(this, (query) { @@ -15551,6 +15777,18 @@ extension StackThemeQuerySortThenBy }); } + QueryBuilder thenByVersion() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'version', Sort.asc); + }); + } + + QueryBuilder thenByVersionDesc() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'version', Sort.desc); + }); + } + QueryBuilder thenByWarningBackgroundInt() { return QueryBuilder.apply(this, (query) { @@ -16649,6 +16887,12 @@ extension StackThemeQueryWhereDistinct }); } + QueryBuilder distinctByVersion() { + return QueryBuilder.apply(this, (query) { + return query.addDistinctBy(r'version'); + }); + } + QueryBuilder distinctByWarningBackgroundInt() { return QueryBuilder.apply(this, (query) { @@ -16711,12 +16955,19 @@ extension StackThemeQueryProperty }); } - QueryBuilder assetsProperty() { + QueryBuilder assetsV1Property() { return QueryBuilder.apply(this, (query) { return query.addPropertyName(r'assets'); }); } + QueryBuilder + assetsV2Property() { + return QueryBuilder.apply(this, (query) { + return query.addPropertyName(r'assetsV2'); + }); + } + QueryBuilder backgroundAppBarIntProperty() { return QueryBuilder.apply(this, (query) { @@ -17728,6 +17979,12 @@ extension StackThemeQueryProperty }); } + QueryBuilder versionProperty() { + return QueryBuilder.apply(this, (query) { + return query.addPropertyName(r'version'); + }); + } + QueryBuilder warningBackgroundIntProperty() { return QueryBuilder.apply(this, (query) { @@ -17741,6 +17998,13 @@ extension StackThemeQueryProperty return query.addPropertyName(r'warningForegroundInt'); }); } + + QueryBuilder + assetsV3Property() { + return QueryBuilder.apply(this, (query) { + return query.addPropertyName(r'zAssetsV3'); + }); + } } // ************************************************************************** @@ -22176,63 +22440,7872 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - moneroImageSecondaryEqualTo( - String value, { + QueryBuilder + moneroImageSecondaryEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'moneroImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + moneroImageSecondaryGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'moneroImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + moneroImageSecondaryLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'moneroImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + moneroImageSecondaryBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'moneroImageSecondary', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + moneroImageSecondaryStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'moneroImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + moneroImageSecondaryEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'moneroImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + moneroImageSecondaryContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'moneroImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + moneroImageSecondaryMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'moneroImageSecondary', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + moneroImageSecondaryIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'moneroImageSecondary', + value: '', + )); + }); + } + + QueryBuilder + moneroImageSecondaryIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'moneroImageSecondary', + value: '', + )); + }); + } + + QueryBuilder namecoinEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'namecoin', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + namecoinGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'namecoin', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + namecoinLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'namecoin', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder namecoinBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'namecoin', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + namecoinStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'namecoin', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + namecoinEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'namecoin', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + namecoinContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'namecoin', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder namecoinMatches( + String pattern, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'namecoin', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + namecoinIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'namecoin', + value: '', + )); + }); + } + + QueryBuilder + namecoinIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'namecoin', + value: '', + )); + }); + } + + QueryBuilder + namecoinImageEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'namecoinImage', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + namecoinImageGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'namecoinImage', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + namecoinImageLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'namecoinImage', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + namecoinImageBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'namecoinImage', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + namecoinImageStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'namecoinImage', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + namecoinImageEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'namecoinImage', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + namecoinImageContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'namecoinImage', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + namecoinImageMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'namecoinImage', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + namecoinImageIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'namecoinImage', + value: '', + )); + }); + } + + QueryBuilder + namecoinImageIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'namecoinImage', + value: '', + )); + }); + } + + QueryBuilder + namecoinImageSecondaryEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'namecoinImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + namecoinImageSecondaryGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'namecoinImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + namecoinImageSecondaryLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'namecoinImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + namecoinImageSecondaryBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'namecoinImageSecondary', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + namecoinImageSecondaryStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'namecoinImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + namecoinImageSecondaryEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'namecoinImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + namecoinImageSecondaryContains(String value, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'namecoinImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + namecoinImageSecondaryMatches(String pattern, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'namecoinImageSecondary', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + namecoinImageSecondaryIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'namecoinImageSecondary', + value: '', + )); + }); + } + + QueryBuilder + namecoinImageSecondaryIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'namecoinImageSecondary', + value: '', + )); + }); + } + + QueryBuilder particlEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'particl', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + particlGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'particl', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder particlLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'particl', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder particlBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'particl', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + particlStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'particl', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder particlEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'particl', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder particlContains( + String value, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'particl', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder particlMatches( + String pattern, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'particl', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + particlIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'particl', + value: '', + )); + }); + } + + QueryBuilder + particlIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'particl', + value: '', + )); + }); + } + + QueryBuilder + particlImageEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'particlImage', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + particlImageGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'particlImage', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + particlImageLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'particlImage', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + particlImageBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'particlImage', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + particlImageStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'particlImage', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + particlImageEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'particlImage', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + particlImageContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'particlImage', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + particlImageMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'particlImage', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + particlImageIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'particlImage', + value: '', + )); + }); + } + + QueryBuilder + particlImageIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'particlImage', + value: '', + )); + }); + } + + QueryBuilder + particlImageSecondaryEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'particlImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + particlImageSecondaryGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'particlImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + particlImageSecondaryLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'particlImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + particlImageSecondaryBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'particlImageSecondary', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + particlImageSecondaryStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'particlImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + particlImageSecondaryEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'particlImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + particlImageSecondaryContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'particlImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + particlImageSecondaryMatches(String pattern, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'particlImageSecondary', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + particlImageSecondaryIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'particlImageSecondary', + value: '', + )); + }); + } + + QueryBuilder + particlImageSecondaryIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'particlImageSecondary', + value: '', + )); + }); + } + + QueryBuilder + personaEasyEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'personaEasy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'personaEasy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'personaEasy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'personaEasy', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'personaEasy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'personaEasy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'personaEasy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'personaEasy', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'personaEasy', + value: '', + )); + }); + } + + QueryBuilder + personaEasyIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'personaEasy', + value: '', + )); + }); + } + + QueryBuilder + personaIncognitoEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'personaIncognito', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'personaIncognito', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'personaIncognito', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'personaIncognito', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'personaIncognito', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'personaIncognito', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'personaIncognito', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'personaIncognito', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'personaIncognito', + value: '', + )); + }); + } + + QueryBuilder + personaIncognitoIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'personaIncognito', + value: '', + )); + }); + } + + QueryBuilder receiveEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'receive', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'receive', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder receiveLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'receive', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder receiveBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'receive', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'receive', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder receiveEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'receive', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder receiveContains( + String value, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'receive', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder receiveMatches( + String pattern, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'receive', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'receive', + value: '', + )); + }); + } + + QueryBuilder + receiveIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'receive', + value: '', + )); + }); + } + + QueryBuilder + receiveCancelledEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'receiveCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'receiveCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'receiveCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'receiveCancelled', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'receiveCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'receiveCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'receiveCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'receiveCancelled', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'receiveCancelled', + value: '', + )); + }); + } + + QueryBuilder + receiveCancelledIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'receiveCancelled', + value: '', + )); + }); + } + + QueryBuilder + receivePendingEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'receivePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'receivePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'receivePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'receivePending', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'receivePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'receivePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'receivePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'receivePending', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'receivePending', + value: '', + )); + }); + } + + QueryBuilder + receivePendingIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'receivePending', + value: '', + )); + }); + } + + QueryBuilder sendEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'send', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder sendGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'send', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder sendLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'send', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder sendBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'send', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder sendStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'send', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder sendEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'send', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder sendContains( + String value, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'send', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder sendMatches( + String pattern, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'send', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder sendIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'send', + value: '', + )); + }); + } + + QueryBuilder + sendIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'send', + value: '', + )); + }); + } + + QueryBuilder + sendCancelledEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'sendCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'sendCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'sendCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'sendCancelled', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'sendCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'sendCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'sendCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'sendCancelled', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'sendCancelled', + value: '', + )); + }); + } + + QueryBuilder + sendCancelledIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'sendCancelled', + value: '', + )); + }); + } + + QueryBuilder + sendPendingEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'sendPending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'sendPending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'sendPending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'sendPending', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'sendPending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'sendPending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'sendPending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'sendPending', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'sendPending', + value: '', + )); + }); + } + + QueryBuilder + sendPendingIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'sendPending', + value: '', + )); + }); + } + + QueryBuilder stackEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'stack', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'stack', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder stackLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'stack', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder stackBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'stack', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder stackStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'stack', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder stackEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'stack', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder stackContains( + String value, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'stack', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder stackMatches( + String pattern, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'stack', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder stackIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'stack', + value: '', + )); + }); + } + + QueryBuilder + stackIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'stack', + value: '', + )); + }); + } + + QueryBuilder + stackIconEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'stackIcon', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'stackIcon', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'stackIcon', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'stackIcon', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'stackIcon', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'stackIcon', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'stackIcon', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'stackIcon', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'stackIcon', + value: '', + )); + }); + } + + QueryBuilder + stackIconIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'stackIcon', + value: '', + )); + }); + } + + QueryBuilder + themePreviewEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'themePreview', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'themePreview', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'themePreview', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'themePreview', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'themePreview', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'themePreview', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'themePreview', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'themePreview', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'themePreview', + value: '', + )); + }); + } + + QueryBuilder + themePreviewIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'themePreview', + value: '', + )); + }); + } + + QueryBuilder + themeSelectorEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'themeSelector', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'themeSelector', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'themeSelector', + value: '', + )); + }); + } + + QueryBuilder + themeSelectorIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'themeSelector', + value: '', + )); + }); + } + + QueryBuilder + txExchangeEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'txExchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'txExchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'txExchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'txExchange', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'txExchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'txExchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'txExchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'txExchange', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'txExchange', + value: '', + )); + }); + } + + QueryBuilder + txExchangeIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'txExchange', + value: '', + )); + }); + } + + QueryBuilder + txExchangeFailedEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'txExchangeFailed', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'txExchangeFailed', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'txExchangeFailed', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'txExchangeFailed', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'txExchangeFailed', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'txExchangeFailed', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'txExchangeFailed', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'txExchangeFailed', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'txExchangeFailed', + value: '', + )); + }); + } + + QueryBuilder + txExchangeFailedIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'txExchangeFailed', + value: '', + )); + }); + } + + QueryBuilder + txExchangePendingEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'txExchangePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'txExchangePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'txExchangePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'txExchangePending', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'txExchangePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'txExchangePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'txExchangePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'txExchangePending', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'txExchangePending', + value: '', + )); + }); + } + + QueryBuilder + txExchangePendingIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'txExchangePending', + value: '', + )); + }); + } + + QueryBuilder wowneroEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'wownero', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + wowneroGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'wownero', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder wowneroLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'wownero', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder wowneroBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'wownero', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + wowneroStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'wownero', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder wowneroEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'wownero', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder wowneroContains( + String value, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'wownero', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder wowneroMatches( + String pattern, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'wownero', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + wowneroIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'wownero', + value: '', + )); + }); + } + + QueryBuilder + wowneroIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'wownero', + value: '', + )); + }); + } + + QueryBuilder + wowneroImageEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'wowneroImage', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + wowneroImageGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'wowneroImage', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + wowneroImageLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'wowneroImage', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + wowneroImageBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'wowneroImage', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + wowneroImageStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'wowneroImage', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + wowneroImageEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'wowneroImage', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + wowneroImageContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'wowneroImage', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + wowneroImageMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'wowneroImage', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + wowneroImageIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'wowneroImage', + value: '', + )); + }); + } + + QueryBuilder + wowneroImageIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'wowneroImage', + value: '', + )); + }); + } + + QueryBuilder + wowneroImageSecondaryEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'wowneroImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + wowneroImageSecondaryGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'wowneroImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + wowneroImageSecondaryLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'wowneroImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + wowneroImageSecondaryBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'wowneroImageSecondary', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + wowneroImageSecondaryStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'wowneroImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + wowneroImageSecondaryEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'wowneroImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + wowneroImageSecondaryContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'wowneroImageSecondary', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + wowneroImageSecondaryMatches(String pattern, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'wowneroImageSecondary', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + wowneroImageSecondaryIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'wowneroImageSecondary', + value: '', + )); + }); + } + + QueryBuilder + wowneroImageSecondaryIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'wowneroImageSecondary', + value: '', + )); + }); + } +} + +extension ThemeAssetsQueryObject + on QueryBuilder {} + +// coverage:ignore-file +// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters + +const ThemeAssetsV2Schema = Schema( + name: r'ThemeAssetsV2', + id: -373522695224267013, + properties: { + r'background': PropertySchema( + id: 0, + name: r'background', + type: IsarType.string, + ), + r'bellNew': PropertySchema( + id: 1, + name: r'bellNew', + type: IsarType.string, + ), + r'buy': PropertySchema( + id: 2, + name: r'buy', + type: IsarType.string, + ), + r'coinIconsString': PropertySchema( + id: 3, + name: r'coinIconsString', + type: IsarType.string, + ), + r'coinImagesString': PropertySchema( + id: 4, + name: r'coinImagesString', + type: IsarType.string, + ), + r'coinPlaceholder': PropertySchema( + id: 5, + name: r'coinPlaceholder', + type: IsarType.string, + ), + r'coinSecondaryImagesString': PropertySchema( + id: 6, + name: r'coinSecondaryImagesString', + type: IsarType.string, + ), + r'exchange': PropertySchema( + id: 7, + name: r'exchange', + type: IsarType.string, + ), + r'loadingGif': PropertySchema( + id: 8, + name: r'loadingGif', + type: IsarType.string, + ), + r'personaEasy': PropertySchema( + id: 9, + name: r'personaEasy', + type: IsarType.string, + ), + r'personaIncognito': PropertySchema( + id: 10, + name: r'personaIncognito', + type: IsarType.string, + ), + r'receive': PropertySchema( + id: 11, + name: r'receive', + type: IsarType.string, + ), + r'receiveCancelled': PropertySchema( + id: 12, + name: r'receiveCancelled', + type: IsarType.string, + ), + r'receivePending': PropertySchema( + id: 13, + name: r'receivePending', + type: IsarType.string, + ), + r'send': PropertySchema( + id: 14, + name: r'send', + type: IsarType.string, + ), + r'sendCancelled': PropertySchema( + id: 15, + name: r'sendCancelled', + type: IsarType.string, + ), + r'sendPending': PropertySchema( + id: 16, + name: r'sendPending', + type: IsarType.string, + ), + r'stack': PropertySchema( + id: 17, + name: r'stack', + type: IsarType.string, + ), + r'stackIcon': PropertySchema( + id: 18, + name: r'stackIcon', + type: IsarType.string, + ), + r'themePreview': PropertySchema( + id: 19, + name: r'themePreview', + type: IsarType.string, + ), + r'themeSelector': PropertySchema( + id: 20, + name: r'themeSelector', + type: IsarType.string, + ), + r'txExchange': PropertySchema( + id: 21, + name: r'txExchange', + type: IsarType.string, + ), + r'txExchangeFailed': PropertySchema( + id: 22, + name: r'txExchangeFailed', + type: IsarType.string, + ), + r'txExchangePending': PropertySchema( + id: 23, + name: r'txExchangePending', + type: IsarType.string, + ) + }, + estimateSize: _themeAssetsV2EstimateSize, + serialize: _themeAssetsV2Serialize, + deserialize: _themeAssetsV2Deserialize, + deserializeProp: _themeAssetsV2DeserializeProp, +); + +int _themeAssetsV2EstimateSize( + ThemeAssetsV2 object, + List offsets, + Map> allOffsets, +) { + var bytesCount = offsets.last; + { + final value = object.background; + if (value != null) { + bytesCount += 3 + value.length * 3; + } + } + bytesCount += 3 + object.bellNew.length * 3; + bytesCount += 3 + object.buy.length * 3; + bytesCount += 3 + object.coinIconsString.length * 3; + bytesCount += 3 + object.coinImagesString.length * 3; + bytesCount += 3 + object.coinPlaceholder.length * 3; + bytesCount += 3 + object.coinSecondaryImagesString.length * 3; + bytesCount += 3 + object.exchange.length * 3; + { + final value = object.loadingGif; + if (value != null) { + bytesCount += 3 + value.length * 3; + } + } + bytesCount += 3 + object.personaEasy.length * 3; + bytesCount += 3 + object.personaIncognito.length * 3; + bytesCount += 3 + object.receive.length * 3; + bytesCount += 3 + object.receiveCancelled.length * 3; + bytesCount += 3 + object.receivePending.length * 3; + bytesCount += 3 + object.send.length * 3; + bytesCount += 3 + object.sendCancelled.length * 3; + bytesCount += 3 + object.sendPending.length * 3; + bytesCount += 3 + object.stack.length * 3; + bytesCount += 3 + object.stackIcon.length * 3; + bytesCount += 3 + object.themePreview.length * 3; + bytesCount += 3 + object.themeSelector.length * 3; + bytesCount += 3 + object.txExchange.length * 3; + bytesCount += 3 + object.txExchangeFailed.length * 3; + bytesCount += 3 + object.txExchangePending.length * 3; + return bytesCount; +} + +void _themeAssetsV2Serialize( + ThemeAssetsV2 object, + IsarWriter writer, + List offsets, + Map> allOffsets, +) { + writer.writeString(offsets[0], object.background); + writer.writeString(offsets[1], object.bellNew); + writer.writeString(offsets[2], object.buy); + writer.writeString(offsets[3], object.coinIconsString); + writer.writeString(offsets[4], object.coinImagesString); + writer.writeString(offsets[5], object.coinPlaceholder); + writer.writeString(offsets[6], object.coinSecondaryImagesString); + writer.writeString(offsets[7], object.exchange); + writer.writeString(offsets[8], object.loadingGif); + writer.writeString(offsets[9], object.personaEasy); + writer.writeString(offsets[10], object.personaIncognito); + writer.writeString(offsets[11], object.receive); + writer.writeString(offsets[12], object.receiveCancelled); + writer.writeString(offsets[13], object.receivePending); + writer.writeString(offsets[14], object.send); + writer.writeString(offsets[15], object.sendCancelled); + writer.writeString(offsets[16], object.sendPending); + writer.writeString(offsets[17], object.stack); + writer.writeString(offsets[18], object.stackIcon); + writer.writeString(offsets[19], object.themePreview); + writer.writeString(offsets[20], object.themeSelector); + writer.writeString(offsets[21], object.txExchange); + writer.writeString(offsets[22], object.txExchangeFailed); + writer.writeString(offsets[23], object.txExchangePending); +} + +ThemeAssetsV2 _themeAssetsV2Deserialize( + Id id, + IsarReader reader, + List offsets, + Map> allOffsets, +) { + final object = ThemeAssetsV2(); + object.background = reader.readStringOrNull(offsets[0]); + object.bellNew = reader.readString(offsets[1]); + object.buy = reader.readString(offsets[2]); + object.coinIconsString = reader.readString(offsets[3]); + object.coinImagesString = reader.readString(offsets[4]); + object.coinPlaceholder = reader.readString(offsets[5]); + object.coinSecondaryImagesString = reader.readString(offsets[6]); + object.exchange = reader.readString(offsets[7]); + object.loadingGif = reader.readStringOrNull(offsets[8]); + object.personaEasy = reader.readString(offsets[9]); + object.personaIncognito = reader.readString(offsets[10]); + object.receive = reader.readString(offsets[11]); + object.receiveCancelled = reader.readString(offsets[12]); + object.receivePending = reader.readString(offsets[13]); + object.send = reader.readString(offsets[14]); + object.sendCancelled = reader.readString(offsets[15]); + object.sendPending = reader.readString(offsets[16]); + object.stack = reader.readString(offsets[17]); + object.stackIcon = reader.readString(offsets[18]); + object.themePreview = reader.readString(offsets[19]); + object.themeSelector = reader.readString(offsets[20]); + object.txExchange = reader.readString(offsets[21]); + object.txExchangeFailed = reader.readString(offsets[22]); + object.txExchangePending = reader.readString(offsets[23]); + return object; +} + +P _themeAssetsV2DeserializeProp

( + IsarReader reader, + int propertyId, + int offset, + Map> allOffsets, +) { + switch (propertyId) { + case 0: + return (reader.readStringOrNull(offset)) as P; + case 1: + return (reader.readString(offset)) as P; + case 2: + return (reader.readString(offset)) as P; + case 3: + return (reader.readString(offset)) as P; + case 4: + return (reader.readString(offset)) as P; + case 5: + return (reader.readString(offset)) as P; + case 6: + return (reader.readString(offset)) as P; + case 7: + return (reader.readString(offset)) as P; + case 8: + return (reader.readStringOrNull(offset)) as P; + case 9: + return (reader.readString(offset)) as P; + case 10: + return (reader.readString(offset)) as P; + case 11: + return (reader.readString(offset)) as P; + case 12: + return (reader.readString(offset)) as P; + case 13: + return (reader.readString(offset)) as P; + case 14: + return (reader.readString(offset)) as P; + case 15: + return (reader.readString(offset)) as P; + case 16: + return (reader.readString(offset)) as P; + case 17: + return (reader.readString(offset)) as P; + case 18: + return (reader.readString(offset)) as P; + case 19: + return (reader.readString(offset)) as P; + case 20: + return (reader.readString(offset)) as P; + case 21: + return (reader.readString(offset)) as P; + case 22: + return (reader.readString(offset)) as P; + case 23: + return (reader.readString(offset)) as P; + default: + throw IsarError('Unknown property with id $propertyId'); + } +} + +extension ThemeAssetsV2QueryFilter + on QueryBuilder { + QueryBuilder + backgroundIsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'background', + )); + }); + } + + QueryBuilder + backgroundIsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'background', + )); + }); + } + + QueryBuilder + backgroundEqualTo( + String? value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'background', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundGreaterThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'background', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundLessThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'background', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundBetween( + String? lower, + String? upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'background', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'background', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'background', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'background', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'background', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'background', + value: '', + )); + }); + } + + QueryBuilder + backgroundIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'background', + value: '', + )); + }); + } + + QueryBuilder + bellNewEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'bellNew', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'bellNew', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'bellNew', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'bellNew', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'bellNew', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'bellNew', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'bellNew', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'bellNew', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'bellNew', + value: '', + )); + }); + } + + QueryBuilder + bellNewIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'bellNew', + value: '', + )); + }); + } + + QueryBuilder buyEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'buy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + buyGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'buy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder buyLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'buy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder buyBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'buy', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + buyStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'buy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder buyEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'buy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder buyContains( + String value, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'buy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder buyMatches( + String pattern, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'buy', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + buyIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'buy', + value: '', + )); + }); + } + + QueryBuilder + buyIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'buy', + value: '', + )); + }); + } + + QueryBuilder + coinIconsStringEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'coinIconsString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinIconsStringGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'coinIconsString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinIconsStringLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'coinIconsString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinIconsStringBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'coinIconsString', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinIconsStringStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'coinIconsString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinIconsStringEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'coinIconsString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinIconsStringContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'coinIconsString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinIconsStringMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'coinIconsString', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinIconsStringIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'coinIconsString', + value: '', + )); + }); + } + + QueryBuilder + coinIconsStringIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'coinIconsString', + value: '', + )); + }); + } + + QueryBuilder + coinImagesStringEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'coinImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinImagesStringGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'coinImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinImagesStringLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'coinImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinImagesStringBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'coinImagesString', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinImagesStringStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'coinImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinImagesStringEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'coinImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinImagesStringContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'coinImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinImagesStringMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'coinImagesString', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinImagesStringIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'coinImagesString', + value: '', + )); + }); + } + + QueryBuilder + coinImagesStringIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'coinImagesString', + value: '', + )); + }); + } + + QueryBuilder + coinPlaceholderEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'coinPlaceholder', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinPlaceholderGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'coinPlaceholder', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinPlaceholderLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'coinPlaceholder', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinPlaceholderBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'coinPlaceholder', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinPlaceholderStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'coinPlaceholder', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinPlaceholderEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'coinPlaceholder', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinPlaceholderContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'coinPlaceholder', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinPlaceholderMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'coinPlaceholder', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinPlaceholderIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'coinPlaceholder', + value: '', + )); + }); + } + + QueryBuilder + coinPlaceholderIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'coinPlaceholder', + value: '', + )); + }); + } + + QueryBuilder + coinSecondaryImagesStringEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'coinSecondaryImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinSecondaryImagesStringGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'coinSecondaryImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinSecondaryImagesStringLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'coinSecondaryImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinSecondaryImagesStringBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'coinSecondaryImagesString', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinSecondaryImagesStringStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'coinSecondaryImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinSecondaryImagesStringEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'coinSecondaryImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinSecondaryImagesStringContains(String value, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'coinSecondaryImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinSecondaryImagesStringMatches(String pattern, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'coinSecondaryImagesString', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinSecondaryImagesStringIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'coinSecondaryImagesString', + value: '', + )); + }); + } + + QueryBuilder + coinSecondaryImagesStringIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'coinSecondaryImagesString', + value: '', + )); + }); + } + + QueryBuilder + exchangeEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'exchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + exchangeGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'exchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + exchangeLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'exchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + exchangeBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'exchange', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + exchangeStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'exchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + exchangeEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'exchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + exchangeContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'exchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + exchangeMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'exchange', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + exchangeIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'exchange', + value: '', + )); + }); + } + + QueryBuilder + exchangeIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'exchange', + value: '', + )); + }); + } + + QueryBuilder + loadingGifIsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'loadingGif', + )); + }); + } + + QueryBuilder + loadingGifIsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'loadingGif', + )); + }); + } + + QueryBuilder + loadingGifEqualTo( + String? value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'loadingGif', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + loadingGifGreaterThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'loadingGif', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + loadingGifLessThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'loadingGif', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + loadingGifBetween( + String? lower, + String? upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'loadingGif', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + loadingGifStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'loadingGif', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + loadingGifEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'loadingGif', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + loadingGifContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'loadingGif', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + loadingGifMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'loadingGif', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + loadingGifIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'loadingGif', + value: '', + )); + }); + } + + QueryBuilder + loadingGifIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'loadingGif', + value: '', + )); + }); + } + + QueryBuilder + personaEasyEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'personaEasy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'personaEasy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'personaEasy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'personaEasy', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'personaEasy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'personaEasy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'personaEasy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'personaEasy', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'personaEasy', + value: '', + )); + }); + } + + QueryBuilder + personaEasyIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'personaEasy', + value: '', + )); + }); + } + + QueryBuilder + personaIncognitoEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'personaIncognito', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'personaIncognito', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'personaIncognito', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'personaIncognito', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'personaIncognito', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'personaIncognito', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'personaIncognito', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'personaIncognito', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'personaIncognito', + value: '', + )); + }); + } + + QueryBuilder + personaIncognitoIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'personaIncognito', + value: '', + )); + }); + } + + QueryBuilder + receiveEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'receive', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'receive', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'receive', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'receive', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'receive', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'receive', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'receive', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'receive', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'receive', + value: '', + )); + }); + } + + QueryBuilder + receiveIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'receive', + value: '', + )); + }); + } + + QueryBuilder + receiveCancelledEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'receiveCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'receiveCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'receiveCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'receiveCancelled', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'receiveCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'receiveCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'receiveCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'receiveCancelled', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'receiveCancelled', + value: '', + )); + }); + } + + QueryBuilder + receiveCancelledIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'receiveCancelled', + value: '', + )); + }); + } + + QueryBuilder + receivePendingEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'receivePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'receivePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'receivePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'receivePending', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'receivePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'receivePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'receivePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'receivePending', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'receivePending', + value: '', + )); + }); + } + + QueryBuilder + receivePendingIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'receivePending', + value: '', + )); + }); + } + + QueryBuilder sendEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'send', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'send', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'send', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder sendBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'send', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'send', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'send', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'send', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder sendMatches( + String pattern, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'send', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'send', + value: '', + )); + }); + } + + QueryBuilder + sendIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'send', + value: '', + )); + }); + } + + QueryBuilder + sendCancelledEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'sendCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'sendCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'sendCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'sendCancelled', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'sendCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'sendCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'sendCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'sendCancelled', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'sendCancelled', + value: '', + )); + }); + } + + QueryBuilder + sendCancelledIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'sendCancelled', + value: '', + )); + }); + } + + QueryBuilder + sendPendingEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'sendPending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'sendPending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'sendPending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'sendPending', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'sendPending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'sendPending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'sendPending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'sendPending', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'sendPending', + value: '', + )); + }); + } + + QueryBuilder + sendPendingIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'sendPending', + value: '', + )); + }); + } + + QueryBuilder + stackEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'stack', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'stack', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'stack', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'stack', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'stack', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'stack', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'stack', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'stack', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'stack', + value: '', + )); + }); + } + + QueryBuilder + stackIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'stack', + value: '', + )); + }); + } + + QueryBuilder + stackIconEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'stackIcon', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'stackIcon', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'stackIcon', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'stackIcon', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'stackIcon', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'stackIcon', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'stackIcon', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'stackIcon', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'stackIcon', + value: '', + )); + }); + } + + QueryBuilder + stackIconIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'stackIcon', + value: '', + )); + }); + } + + QueryBuilder + themePreviewEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'themePreview', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'themePreview', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'themePreview', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'themePreview', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'themePreview', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'themePreview', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'themePreview', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'themePreview', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'themePreview', + value: '', + )); + }); + } + + QueryBuilder + themePreviewIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'themePreview', + value: '', + )); + }); + } + + QueryBuilder + themeSelectorEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'themeSelector', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'themeSelector', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'themeSelector', + value: '', + )); + }); + } + + QueryBuilder + themeSelectorIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'themeSelector', + value: '', + )); + }); + } + + QueryBuilder + txExchangeEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'txExchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'txExchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'txExchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'txExchange', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'txExchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'txExchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'txExchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'txExchange', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'txExchange', + value: '', + )); + }); + } + + QueryBuilder + txExchangeIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'txExchange', + value: '', + )); + }); + } + + QueryBuilder + txExchangeFailedEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'txExchangeFailed', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'txExchangeFailed', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'txExchangeFailed', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'txExchangeFailed', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'txExchangeFailed', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'txExchangeFailed', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'txExchangeFailed', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'txExchangeFailed', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'txExchangeFailed', + value: '', + )); + }); + } + + QueryBuilder + txExchangeFailedIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'txExchangeFailed', + value: '', + )); + }); + } + + QueryBuilder + txExchangePendingEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'txExchangePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'txExchangePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'txExchangePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'txExchangePending', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'txExchangePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'txExchangePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'txExchangePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'txExchangePending', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'txExchangePending', + value: '', + )); + }); + } + + QueryBuilder + txExchangePendingIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'txExchangePending', + value: '', + )); + }); + } +} + +extension ThemeAssetsV2QueryObject + on QueryBuilder {} + +// coverage:ignore-file +// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters + +const ThemeAssetsV3Schema = Schema( + name: r'ThemeAssetsV3', + id: -8828098514594684151, + properties: { + r'background': PropertySchema( + id: 0, + name: r'background', + type: IsarType.string, + ), + r'bellNew': PropertySchema( + id: 1, + name: r'bellNew', + type: IsarType.string, + ), + r'buy': PropertySchema( + id: 2, + name: r'buy', + type: IsarType.string, + ), + r'coinCardImagesString': PropertySchema( + id: 3, + name: r'coinCardImagesString', + type: IsarType.string, + ), + r'coinIconsString': PropertySchema( + id: 4, + name: r'coinIconsString', + type: IsarType.string, + ), + r'coinImagesString': PropertySchema( + id: 5, + name: r'coinImagesString', + type: IsarType.string, + ), + r'coinPlaceholder': PropertySchema( + id: 6, + name: r'coinPlaceholder', + type: IsarType.string, + ), + r'coinSecondaryImagesString': PropertySchema( + id: 7, + name: r'coinSecondaryImagesString', + type: IsarType.string, + ), + r'exchange': PropertySchema( + id: 8, + name: r'exchange', + type: IsarType.string, + ), + r'loadingGif': PropertySchema( + id: 9, + name: r'loadingGif', + type: IsarType.string, + ), + r'otherStringParam1': PropertySchema( + id: 10, + name: r'otherStringParam1', + type: IsarType.string, + ), + r'otherStringParam2': PropertySchema( + id: 11, + name: r'otherStringParam2', + type: IsarType.string, + ), + r'otherStringParam3': PropertySchema( + id: 12, + name: r'otherStringParam3', + type: IsarType.string, + ), + r'personaEasy': PropertySchema( + id: 13, + name: r'personaEasy', + type: IsarType.string, + ), + r'personaIncognito': PropertySchema( + id: 14, + name: r'personaIncognito', + type: IsarType.string, + ), + r'receive': PropertySchema( + id: 15, + name: r'receive', + type: IsarType.string, + ), + r'receiveCancelled': PropertySchema( + id: 16, + name: r'receiveCancelled', + type: IsarType.string, + ), + r'receivePending': PropertySchema( + id: 17, + name: r'receivePending', + type: IsarType.string, + ), + r'send': PropertySchema( + id: 18, + name: r'send', + type: IsarType.string, + ), + r'sendCancelled': PropertySchema( + id: 19, + name: r'sendCancelled', + type: IsarType.string, + ), + r'sendPending': PropertySchema( + id: 20, + name: r'sendPending', + type: IsarType.string, + ), + r'stack': PropertySchema( + id: 21, + name: r'stack', + type: IsarType.string, + ), + r'stackIcon': PropertySchema( + id: 22, + name: r'stackIcon', + type: IsarType.string, + ), + r'themePreview': PropertySchema( + id: 23, + name: r'themePreview', + type: IsarType.string, + ), + r'themeSelector': PropertySchema( + id: 24, + name: r'themeSelector', + type: IsarType.string, + ), + r'txExchange': PropertySchema( + id: 25, + name: r'txExchange', + type: IsarType.string, + ), + r'txExchangeFailed': PropertySchema( + id: 26, + name: r'txExchangeFailed', + type: IsarType.string, + ), + r'txExchangePending': PropertySchema( + id: 27, + name: r'txExchangePending', + type: IsarType.string, + ) + }, + estimateSize: _themeAssetsV3EstimateSize, + serialize: _themeAssetsV3Serialize, + deserialize: _themeAssetsV3Deserialize, + deserializeProp: _themeAssetsV3DeserializeProp, +); + +int _themeAssetsV3EstimateSize( + ThemeAssetsV3 object, + List offsets, + Map> allOffsets, +) { + var bytesCount = offsets.last; + { + final value = object.backgroundRelative; + if (value != null) { + bytesCount += 3 + value.length * 3; + } + } + bytesCount += 3 + object.bellNewRelative.length * 3; + bytesCount += 3 + object.buyRelative.length * 3; + { + final value = object.coinCardImagesString; + if (value != null) { + bytesCount += 3 + value.length * 3; + } + } + bytesCount += 3 + object.coinIconsString.length * 3; + bytesCount += 3 + object.coinImagesString.length * 3; + bytesCount += 3 + object.coinPlaceholderRelative.length * 3; + bytesCount += 3 + object.coinSecondaryImagesString.length * 3; + bytesCount += 3 + object.exchangeRelative.length * 3; + { + final value = object.loadingGifRelative; + if (value != null) { + bytesCount += 3 + value.length * 3; + } + } + { + final value = object.dummy1; + if (value != null) { + bytesCount += 3 + value.length * 3; + } + } + { + final value = object.dummy2; + if (value != null) { + bytesCount += 3 + value.length * 3; + } + } + { + final value = object.dummy3; + if (value != null) { + bytesCount += 3 + value.length * 3; + } + } + bytesCount += 3 + object.personaEasyRelative.length * 3; + bytesCount += 3 + object.personaIncognitoRelative.length * 3; + bytesCount += 3 + object.receiveRelative.length * 3; + bytesCount += 3 + object.receiveCancelledRelative.length * 3; + bytesCount += 3 + object.receivePendingRelative.length * 3; + bytesCount += 3 + object.sendRelative.length * 3; + bytesCount += 3 + object.sendCancelledRelative.length * 3; + bytesCount += 3 + object.sendPendingRelative.length * 3; + bytesCount += 3 + object.stackRelative.length * 3; + bytesCount += 3 + object.stackIconRelative.length * 3; + bytesCount += 3 + object.themePreviewRelative.length * 3; + bytesCount += 3 + object.themeSelectorRelative.length * 3; + bytesCount += 3 + object.txExchangeRelative.length * 3; + bytesCount += 3 + object.txExchangeFailedRelative.length * 3; + bytesCount += 3 + object.txExchangePendingRelative.length * 3; + return bytesCount; +} + +void _themeAssetsV3Serialize( + ThemeAssetsV3 object, + IsarWriter writer, + List offsets, + Map> allOffsets, +) { + writer.writeString(offsets[0], object.backgroundRelative); + writer.writeString(offsets[1], object.bellNewRelative); + writer.writeString(offsets[2], object.buyRelative); + writer.writeString(offsets[3], object.coinCardImagesString); + writer.writeString(offsets[4], object.coinIconsString); + writer.writeString(offsets[5], object.coinImagesString); + writer.writeString(offsets[6], object.coinPlaceholderRelative); + writer.writeString(offsets[7], object.coinSecondaryImagesString); + writer.writeString(offsets[8], object.exchangeRelative); + writer.writeString(offsets[9], object.loadingGifRelative); + writer.writeString(offsets[10], object.dummy1); + writer.writeString(offsets[11], object.dummy2); + writer.writeString(offsets[12], object.dummy3); + writer.writeString(offsets[13], object.personaEasyRelative); + writer.writeString(offsets[14], object.personaIncognitoRelative); + writer.writeString(offsets[15], object.receiveRelative); + writer.writeString(offsets[16], object.receiveCancelledRelative); + writer.writeString(offsets[17], object.receivePendingRelative); + writer.writeString(offsets[18], object.sendRelative); + writer.writeString(offsets[19], object.sendCancelledRelative); + writer.writeString(offsets[20], object.sendPendingRelative); + writer.writeString(offsets[21], object.stackRelative); + writer.writeString(offsets[22], object.stackIconRelative); + writer.writeString(offsets[23], object.themePreviewRelative); + writer.writeString(offsets[24], object.themeSelectorRelative); + writer.writeString(offsets[25], object.txExchangeRelative); + writer.writeString(offsets[26], object.txExchangeFailedRelative); + writer.writeString(offsets[27], object.txExchangePendingRelative); +} + +ThemeAssetsV3 _themeAssetsV3Deserialize( + Id id, + IsarReader reader, + List offsets, + Map> allOffsets, +) { + final object = ThemeAssetsV3(); + object.backgroundRelative = reader.readStringOrNull(offsets[0]); + object.bellNewRelative = reader.readString(offsets[1]); + object.buyRelative = reader.readString(offsets[2]); + object.coinCardImagesString = reader.readStringOrNull(offsets[3]); + object.coinIconsString = reader.readString(offsets[4]); + object.coinImagesString = reader.readString(offsets[5]); + object.coinPlaceholderRelative = reader.readString(offsets[6]); + object.coinSecondaryImagesString = reader.readString(offsets[7]); + object.exchangeRelative = reader.readString(offsets[8]); + object.loadingGifRelative = reader.readStringOrNull(offsets[9]); + object.dummy1 = reader.readStringOrNull(offsets[10]); + object.dummy2 = reader.readStringOrNull(offsets[11]); + object.dummy3 = reader.readStringOrNull(offsets[12]); + object.personaEasyRelative = reader.readString(offsets[13]); + object.personaIncognitoRelative = reader.readString(offsets[14]); + object.receiveRelative = reader.readString(offsets[15]); + object.receiveCancelledRelative = reader.readString(offsets[16]); + object.receivePendingRelative = reader.readString(offsets[17]); + object.sendRelative = reader.readString(offsets[18]); + object.sendCancelledRelative = reader.readString(offsets[19]); + object.sendPendingRelative = reader.readString(offsets[20]); + object.stackRelative = reader.readString(offsets[21]); + object.stackIconRelative = reader.readString(offsets[22]); + object.themePreviewRelative = reader.readString(offsets[23]); + object.themeSelectorRelative = reader.readString(offsets[24]); + object.txExchangeRelative = reader.readString(offsets[25]); + object.txExchangeFailedRelative = reader.readString(offsets[26]); + object.txExchangePendingRelative = reader.readString(offsets[27]); + return object; +} + +P _themeAssetsV3DeserializeProp

( + IsarReader reader, + int propertyId, + int offset, + Map> allOffsets, +) { + switch (propertyId) { + case 0: + return (reader.readStringOrNull(offset)) as P; + case 1: + return (reader.readString(offset)) as P; + case 2: + return (reader.readString(offset)) as P; + case 3: + return (reader.readStringOrNull(offset)) as P; + case 4: + return (reader.readString(offset)) as P; + case 5: + return (reader.readString(offset)) as P; + case 6: + return (reader.readString(offset)) as P; + case 7: + return (reader.readString(offset)) as P; + case 8: + return (reader.readString(offset)) as P; + case 9: + return (reader.readStringOrNull(offset)) as P; + case 10: + return (reader.readStringOrNull(offset)) as P; + case 11: + return (reader.readStringOrNull(offset)) as P; + case 12: + return (reader.readStringOrNull(offset)) as P; + case 13: + return (reader.readString(offset)) as P; + case 14: + return (reader.readString(offset)) as P; + case 15: + return (reader.readString(offset)) as P; + case 16: + return (reader.readString(offset)) as P; + case 17: + return (reader.readString(offset)) as P; + case 18: + return (reader.readString(offset)) as P; + case 19: + return (reader.readString(offset)) as P; + case 20: + return (reader.readString(offset)) as P; + case 21: + return (reader.readString(offset)) as P; + case 22: + return (reader.readString(offset)) as P; + case 23: + return (reader.readString(offset)) as P; + case 24: + return (reader.readString(offset)) as P; + case 25: + return (reader.readString(offset)) as P; + case 26: + return (reader.readString(offset)) as P; + case 27: + return (reader.readString(offset)) as P; + default: + throw IsarError('Unknown property with id $propertyId'); + } +} + +extension ThemeAssetsV3QueryFilter + on QueryBuilder { + QueryBuilder + backgroundRelativeIsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'background', + )); + }); + } + + QueryBuilder + backgroundRelativeIsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'background', + )); + }); + } + + QueryBuilder + backgroundRelativeEqualTo( + String? value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'background', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundRelativeGreaterThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'background', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundRelativeLessThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'background', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundRelativeBetween( + String? lower, + String? upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'background', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundRelativeStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'background', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundRelativeEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'background', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundRelativeContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'background', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundRelativeMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'background', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundRelativeIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'background', + value: '', + )); + }); + } + + QueryBuilder + backgroundRelativeIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'background', + value: '', + )); + }); + } + + QueryBuilder + bellNewRelativeEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'bellNew', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewRelativeGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'bellNew', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewRelativeLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'bellNew', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewRelativeBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'bellNew', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewRelativeStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'bellNew', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewRelativeEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'bellNew', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewRelativeContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'bellNew', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewRelativeMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'bellNew', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewRelativeIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'bellNew', + value: '', + )); + }); + } + + QueryBuilder + bellNewRelativeIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'bellNew', + value: '', + )); + }); + } + + QueryBuilder + buyRelativeEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'buy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + buyRelativeGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'buy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + buyRelativeLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'buy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + buyRelativeBetween( + String lower, + String upper, { + bool includeLower = true, + bool includeUpper = true, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'buy', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + buyRelativeStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'buy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + buyRelativeEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'buy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + buyRelativeContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'buy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + buyRelativeMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'buy', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + buyRelativeIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'buy', + value: '', + )); + }); + } + + QueryBuilder + buyRelativeIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'buy', + value: '', + )); + }); + } + + QueryBuilder + coinCardImagesStringIsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'coinCardImagesString', + )); + }); + } + + QueryBuilder + coinCardImagesStringIsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'coinCardImagesString', + )); + }); + } + + QueryBuilder + coinCardImagesStringEqualTo( + String? value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'moneroImageSecondary', + property: r'coinCardImagesString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - moneroImageSecondaryGreaterThan( - String value, { + QueryBuilder + coinCardImagesStringGreaterThan( + String? value, { bool include = false, bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'moneroImageSecondary', + property: r'coinCardImagesString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - moneroImageSecondaryLessThan( - String value, { + QueryBuilder + coinCardImagesStringLessThan( + String? value, { bool include = false, bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'moneroImageSecondary', + property: r'coinCardImagesString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - moneroImageSecondaryBetween( - String lower, - String upper, { + QueryBuilder + coinCardImagesStringBetween( + String? lower, + String? upper, { bool includeLower = true, bool includeUpper = true, bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'moneroImageSecondary', + property: r'coinCardImagesString', lower: lower, includeLower: includeLower, upper: upper, @@ -22242,91 +30315,92 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - moneroImageSecondaryStartsWith( + QueryBuilder + coinCardImagesStringStartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'moneroImageSecondary', + property: r'coinCardImagesString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - moneroImageSecondaryEndsWith( + QueryBuilder + coinCardImagesStringEndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'moneroImageSecondary', + property: r'coinCardImagesString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - moneroImageSecondaryContains(String value, {bool caseSensitive = true}) { + QueryBuilder + coinCardImagesStringContains(String value, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'moneroImageSecondary', + property: r'coinCardImagesString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - moneroImageSecondaryMatches(String pattern, {bool caseSensitive = true}) { + QueryBuilder + coinCardImagesStringMatches(String pattern, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'moneroImageSecondary', + property: r'coinCardImagesString', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - moneroImageSecondaryIsEmpty() { + QueryBuilder + coinCardImagesStringIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'moneroImageSecondary', + property: r'coinCardImagesString', value: '', )); }); } - QueryBuilder - moneroImageSecondaryIsNotEmpty() { + QueryBuilder + coinCardImagesStringIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'moneroImageSecondary', + property: r'coinCardImagesString', value: '', )); }); } - QueryBuilder namecoinEqualTo( + QueryBuilder + coinIconsStringEqualTo( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'namecoin', + property: r'coinIconsString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - namecoinGreaterThan( + QueryBuilder + coinIconsStringGreaterThan( String value, { bool include = false, bool caseSensitive = true, @@ -22334,15 +30408,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'namecoin', + property: r'coinIconsString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - namecoinLessThan( + QueryBuilder + coinIconsStringLessThan( String value, { bool include = false, bool caseSensitive = true, @@ -22350,14 +30424,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'namecoin', + property: r'coinIconsString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder namecoinBetween( + QueryBuilder + coinIconsStringBetween( String lower, String upper, { bool includeLower = true, @@ -22366,7 +30441,7 @@ extension ThemeAssetsQueryFilter }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'namecoin', + property: r'coinIconsString', lower: lower, includeLower: includeLower, upper: upper, @@ -22376,93 +30451,92 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - namecoinStartsWith( + QueryBuilder + coinIconsStringStartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'namecoin', + property: r'coinIconsString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - namecoinEndsWith( + QueryBuilder + coinIconsStringEndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'namecoin', + property: r'coinIconsString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - namecoinContains(String value, {bool caseSensitive = true}) { + QueryBuilder + coinIconsStringContains(String value, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'namecoin', + property: r'coinIconsString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder namecoinMatches( - String pattern, - {bool caseSensitive = true}) { + QueryBuilder + coinIconsStringMatches(String pattern, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'namecoin', + property: r'coinIconsString', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - namecoinIsEmpty() { + QueryBuilder + coinIconsStringIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'namecoin', + property: r'coinIconsString', value: '', )); }); } - QueryBuilder - namecoinIsNotEmpty() { + QueryBuilder + coinIconsStringIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'namecoin', + property: r'coinIconsString', value: '', )); }); } - QueryBuilder - namecoinImageEqualTo( + QueryBuilder + coinImagesStringEqualTo( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'namecoinImage', + property: r'coinImagesString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - namecoinImageGreaterThan( + QueryBuilder + coinImagesStringGreaterThan( String value, { bool include = false, bool caseSensitive = true, @@ -22470,15 +30544,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'namecoinImage', + property: r'coinImagesString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - namecoinImageLessThan( + QueryBuilder + coinImagesStringLessThan( String value, { bool include = false, bool caseSensitive = true, @@ -22486,15 +30560,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'namecoinImage', + property: r'coinImagesString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - namecoinImageBetween( + QueryBuilder + coinImagesStringBetween( String lower, String upper, { bool includeLower = true, @@ -22503,7 +30577,7 @@ extension ThemeAssetsQueryFilter }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'namecoinImage', + property: r'coinImagesString', lower: lower, includeLower: includeLower, upper: upper, @@ -22513,92 +30587,92 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - namecoinImageStartsWith( + QueryBuilder + coinImagesStringStartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'namecoinImage', + property: r'coinImagesString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - namecoinImageEndsWith( + QueryBuilder + coinImagesStringEndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'namecoinImage', + property: r'coinImagesString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - namecoinImageContains(String value, {bool caseSensitive = true}) { + QueryBuilder + coinImagesStringContains(String value, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'namecoinImage', + property: r'coinImagesString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - namecoinImageMatches(String pattern, {bool caseSensitive = true}) { + QueryBuilder + coinImagesStringMatches(String pattern, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'namecoinImage', + property: r'coinImagesString', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - namecoinImageIsEmpty() { + QueryBuilder + coinImagesStringIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'namecoinImage', + property: r'coinImagesString', value: '', )); }); } - QueryBuilder - namecoinImageIsNotEmpty() { + QueryBuilder + coinImagesStringIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'namecoinImage', + property: r'coinImagesString', value: '', )); }); } - QueryBuilder - namecoinImageSecondaryEqualTo( + QueryBuilder + coinPlaceholderRelativeEqualTo( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'namecoinImageSecondary', + property: r'coinPlaceholder', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - namecoinImageSecondaryGreaterThan( + QueryBuilder + coinPlaceholderRelativeGreaterThan( String value, { bool include = false, bool caseSensitive = true, @@ -22606,15 +30680,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'namecoinImageSecondary', + property: r'coinPlaceholder', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - namecoinImageSecondaryLessThan( + QueryBuilder + coinPlaceholderRelativeLessThan( String value, { bool include = false, bool caseSensitive = true, @@ -22622,15 +30696,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'namecoinImageSecondary', + property: r'coinPlaceholder', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - namecoinImageSecondaryBetween( + QueryBuilder + coinPlaceholderRelativeBetween( String lower, String upper, { bool includeLower = true, @@ -22639,7 +30713,7 @@ extension ThemeAssetsQueryFilter }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'namecoinImageSecondary', + property: r'coinPlaceholder', lower: lower, includeLower: includeLower, upper: upper, @@ -22649,93 +30723,94 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - namecoinImageSecondaryStartsWith( + QueryBuilder + coinPlaceholderRelativeStartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'namecoinImageSecondary', + property: r'coinPlaceholder', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - namecoinImageSecondaryEndsWith( + QueryBuilder + coinPlaceholderRelativeEndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'namecoinImageSecondary', + property: r'coinPlaceholder', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - namecoinImageSecondaryContains(String value, + QueryBuilder + coinPlaceholderRelativeContains(String value, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'namecoinImageSecondary', + property: r'coinPlaceholder', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - namecoinImageSecondaryMatches(String pattern, + QueryBuilder + coinPlaceholderRelativeMatches(String pattern, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'namecoinImageSecondary', + property: r'coinPlaceholder', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - namecoinImageSecondaryIsEmpty() { + QueryBuilder + coinPlaceholderRelativeIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'namecoinImageSecondary', + property: r'coinPlaceholder', value: '', )); }); } - QueryBuilder - namecoinImageSecondaryIsNotEmpty() { + QueryBuilder + coinPlaceholderRelativeIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'namecoinImageSecondary', + property: r'coinPlaceholder', value: '', )); }); } - QueryBuilder particlEqualTo( + QueryBuilder + coinSecondaryImagesStringEqualTo( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'particl', + property: r'coinSecondaryImagesString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - particlGreaterThan( + QueryBuilder + coinSecondaryImagesStringGreaterThan( String value, { bool include = false, bool caseSensitive = true, @@ -22743,14 +30818,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'particl', + property: r'coinSecondaryImagesString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder particlLessThan( + QueryBuilder + coinSecondaryImagesStringLessThan( String value, { bool include = false, bool caseSensitive = true, @@ -22758,14 +30834,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'particl', + property: r'coinSecondaryImagesString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder particlBetween( + QueryBuilder + coinSecondaryImagesStringBetween( String lower, String upper, { bool includeLower = true, @@ -22774,7 +30851,7 @@ extension ThemeAssetsQueryFilter }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'particl', + property: r'coinSecondaryImagesString', lower: lower, includeLower: includeLower, upper: upper, @@ -22784,93 +30861,94 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - particlStartsWith( + QueryBuilder + coinSecondaryImagesStringStartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'particl', + property: r'coinSecondaryImagesString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder particlEndsWith( + QueryBuilder + coinSecondaryImagesStringEndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'particl', + property: r'coinSecondaryImagesString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder particlContains( - String value, - {bool caseSensitive = true}) { + QueryBuilder + coinSecondaryImagesStringContains(String value, + {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'particl', + property: r'coinSecondaryImagesString', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder particlMatches( - String pattern, - {bool caseSensitive = true}) { + QueryBuilder + coinSecondaryImagesStringMatches(String pattern, + {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'particl', + property: r'coinSecondaryImagesString', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - particlIsEmpty() { + QueryBuilder + coinSecondaryImagesStringIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'particl', + property: r'coinSecondaryImagesString', value: '', )); }); } - QueryBuilder - particlIsNotEmpty() { + QueryBuilder + coinSecondaryImagesStringIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'particl', + property: r'coinSecondaryImagesString', value: '', )); }); } - QueryBuilder - particlImageEqualTo( + QueryBuilder + exchangeRelativeEqualTo( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'particlImage', + property: r'exchange', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - particlImageGreaterThan( + QueryBuilder + exchangeRelativeGreaterThan( String value, { bool include = false, bool caseSensitive = true, @@ -22878,15 +30956,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'particlImage', + property: r'exchange', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - particlImageLessThan( + QueryBuilder + exchangeRelativeLessThan( String value, { bool include = false, bool caseSensitive = true, @@ -22894,15 +30972,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'particlImage', + property: r'exchange', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - particlImageBetween( + QueryBuilder + exchangeRelativeBetween( String lower, String upper, { bool includeLower = true, @@ -22911,7 +30989,7 @@ extension ThemeAssetsQueryFilter }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'particlImage', + property: r'exchange', lower: lower, includeLower: includeLower, upper: upper, @@ -22921,133 +30999,151 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - particlImageStartsWith( + QueryBuilder + exchangeRelativeStartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'particlImage', + property: r'exchange', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - particlImageEndsWith( + QueryBuilder + exchangeRelativeEndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'particlImage', + property: r'exchange', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - particlImageContains(String value, {bool caseSensitive = true}) { + QueryBuilder + exchangeRelativeContains(String value, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'particlImage', + property: r'exchange', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - particlImageMatches(String pattern, {bool caseSensitive = true}) { + QueryBuilder + exchangeRelativeMatches(String pattern, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'particlImage', + property: r'exchange', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - particlImageIsEmpty() { + QueryBuilder + exchangeRelativeIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'particlImage', + property: r'exchange', value: '', )); }); } - QueryBuilder - particlImageIsNotEmpty() { + QueryBuilder + exchangeRelativeIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'particlImage', + property: r'exchange', value: '', )); }); } - QueryBuilder - particlImageSecondaryEqualTo( - String value, { + QueryBuilder + loadingGifRelativeIsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'loadingGif', + )); + }); + } + + QueryBuilder + loadingGifRelativeIsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'loadingGif', + )); + }); + } + + QueryBuilder + loadingGifRelativeEqualTo( + String? value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'particlImageSecondary', + property: r'loadingGif', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - particlImageSecondaryGreaterThan( - String value, { + QueryBuilder + loadingGifRelativeGreaterThan( + String? value, { bool include = false, bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'particlImageSecondary', + property: r'loadingGif', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - particlImageSecondaryLessThan( - String value, { + QueryBuilder + loadingGifRelativeLessThan( + String? value, { bool include = false, bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'particlImageSecondary', + property: r'loadingGif', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - particlImageSecondaryBetween( - String lower, - String upper, { + QueryBuilder + loadingGifRelativeBetween( + String? lower, + String? upper, { bool includeLower = true, bool includeUpper = true, bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'particlImageSecondary', + property: r'loadingGif', lower: lower, includeLower: includeLower, upper: upper, @@ -23057,134 +31153,151 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - particlImageSecondaryStartsWith( + QueryBuilder + loadingGifRelativeStartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'particlImageSecondary', + property: r'loadingGif', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - particlImageSecondaryEndsWith( + QueryBuilder + loadingGifRelativeEndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'particlImageSecondary', + property: r'loadingGif', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - particlImageSecondaryContains(String value, {bool caseSensitive = true}) { + QueryBuilder + loadingGifRelativeContains(String value, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'particlImageSecondary', + property: r'loadingGif', value: value, caseSensitive: caseSensitive, )); }); - } - - QueryBuilder - particlImageSecondaryMatches(String pattern, - {bool caseSensitive = true}) { + } + + QueryBuilder + loadingGifRelativeMatches(String pattern, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'particlImageSecondary', + property: r'loadingGif', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - particlImageSecondaryIsEmpty() { + QueryBuilder + loadingGifRelativeIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'particlImageSecondary', + property: r'loadingGif', value: '', )); }); } - QueryBuilder - particlImageSecondaryIsNotEmpty() { + QueryBuilder + loadingGifRelativeIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'particlImageSecondary', + property: r'loadingGif', value: '', )); }); } - QueryBuilder - personaEasyEqualTo( - String value, { + QueryBuilder + dummy1IsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'otherStringParam1', + )); + }); + } + + QueryBuilder + dummy1IsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'otherStringParam1', + )); + }); + } + + QueryBuilder + dummy1EqualTo( + String? value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'personaEasy', + property: r'otherStringParam1', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - personaEasyGreaterThan( - String value, { + QueryBuilder + dummy1GreaterThan( + String? value, { bool include = false, bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'personaEasy', + property: r'otherStringParam1', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - personaEasyLessThan( - String value, { + QueryBuilder + dummy1LessThan( + String? value, { bool include = false, bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'personaEasy', + property: r'otherStringParam1', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - personaEasyBetween( - String lower, - String upper, { + QueryBuilder + dummy1Between( + String? lower, + String? upper, { bool includeLower = true, bool includeUpper = true, bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'personaEasy', + property: r'otherStringParam1', lower: lower, includeLower: includeLower, upper: upper, @@ -23194,133 +31307,151 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - personaEasyStartsWith( + QueryBuilder + dummy1StartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'personaEasy', + property: r'otherStringParam1', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - personaEasyEndsWith( + QueryBuilder + dummy1EndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'personaEasy', + property: r'otherStringParam1', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - personaEasyContains(String value, {bool caseSensitive = true}) { + QueryBuilder + dummy1Contains(String value, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'personaEasy', + property: r'otherStringParam1', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - personaEasyMatches(String pattern, {bool caseSensitive = true}) { + QueryBuilder + dummy1Matches(String pattern, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'personaEasy', + property: r'otherStringParam1', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - personaEasyIsEmpty() { + QueryBuilder + dummy1IsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'personaEasy', + property: r'otherStringParam1', value: '', )); }); } - QueryBuilder - personaEasyIsNotEmpty() { + QueryBuilder + dummy1IsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'personaEasy', + property: r'otherStringParam1', value: '', )); }); } - QueryBuilder - personaIncognitoEqualTo( - String value, { + QueryBuilder + dummy2IsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'otherStringParam2', + )); + }); + } + + QueryBuilder + dummy2IsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'otherStringParam2', + )); + }); + } + + QueryBuilder + dummy2EqualTo( + String? value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'personaIncognito', + property: r'otherStringParam2', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - personaIncognitoGreaterThan( - String value, { + QueryBuilder + dummy2GreaterThan( + String? value, { bool include = false, bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'personaIncognito', + property: r'otherStringParam2', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - personaIncognitoLessThan( - String value, { + QueryBuilder + dummy2LessThan( + String? value, { bool include = false, bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'personaIncognito', + property: r'otherStringParam2', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - personaIncognitoBetween( - String lower, - String upper, { + QueryBuilder + dummy2Between( + String? lower, + String? upper, { bool includeLower = true, bool includeUpper = true, bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'personaIncognito', + property: r'otherStringParam2', lower: lower, includeLower: includeLower, upper: upper, @@ -23330,130 +31461,151 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - personaIncognitoStartsWith( + QueryBuilder + dummy2StartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'personaIncognito', + property: r'otherStringParam2', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - personaIncognitoEndsWith( + QueryBuilder + dummy2EndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'personaIncognito', + property: r'otherStringParam2', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - personaIncognitoContains(String value, {bool caseSensitive = true}) { + QueryBuilder + dummy2Contains(String value, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'personaIncognito', + property: r'otherStringParam2', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - personaIncognitoMatches(String pattern, {bool caseSensitive = true}) { + QueryBuilder + dummy2Matches(String pattern, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'personaIncognito', + property: r'otherStringParam2', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - personaIncognitoIsEmpty() { + QueryBuilder + dummy2IsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'personaIncognito', + property: r'otherStringParam2', value: '', )); }); } - QueryBuilder - personaIncognitoIsNotEmpty() { + QueryBuilder + dummy2IsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'personaIncognito', + property: r'otherStringParam2', value: '', )); }); } - QueryBuilder receiveEqualTo( - String value, { + QueryBuilder + dummy3IsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'otherStringParam3', + )); + }); + } + + QueryBuilder + dummy3IsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'otherStringParam3', + )); + }); + } + + QueryBuilder + dummy3EqualTo( + String? value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'receive', + property: r'otherStringParam3', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - receiveGreaterThan( - String value, { + QueryBuilder + dummy3GreaterThan( + String? value, { bool include = false, bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'receive', + property: r'otherStringParam3', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder receiveLessThan( - String value, { + QueryBuilder + dummy3LessThan( + String? value, { bool include = false, bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'receive', + property: r'otherStringParam3', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder receiveBetween( - String lower, - String upper, { + QueryBuilder + dummy3Between( + String? lower, + String? upper, { bool includeLower = true, bool includeUpper = true, bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'receive', + property: r'otherStringParam3', lower: lower, includeLower: includeLower, upper: upper, @@ -23463,93 +31615,92 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - receiveStartsWith( + QueryBuilder + dummy3StartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'receive', + property: r'otherStringParam3', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder receiveEndsWith( + QueryBuilder + dummy3EndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'receive', + property: r'otherStringParam3', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder receiveContains( - String value, - {bool caseSensitive = true}) { + QueryBuilder + dummy3Contains(String value, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'receive', + property: r'otherStringParam3', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder receiveMatches( - String pattern, - {bool caseSensitive = true}) { + QueryBuilder + dummy3Matches(String pattern, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'receive', + property: r'otherStringParam3', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - receiveIsEmpty() { + QueryBuilder + dummy3IsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'receive', + property: r'otherStringParam3', value: '', )); }); } - QueryBuilder - receiveIsNotEmpty() { + QueryBuilder + dummy3IsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'receive', + property: r'otherStringParam3', value: '', )); }); } - QueryBuilder - receiveCancelledEqualTo( + QueryBuilder + personaEasyRelativeEqualTo( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'receiveCancelled', + property: r'personaEasy', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - receiveCancelledGreaterThan( + QueryBuilder + personaEasyRelativeGreaterThan( String value, { bool include = false, bool caseSensitive = true, @@ -23557,15 +31708,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'receiveCancelled', + property: r'personaEasy', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - receiveCancelledLessThan( + QueryBuilder + personaEasyRelativeLessThan( String value, { bool include = false, bool caseSensitive = true, @@ -23573,15 +31724,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'receiveCancelled', + property: r'personaEasy', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - receiveCancelledBetween( + QueryBuilder + personaEasyRelativeBetween( String lower, String upper, { bool includeLower = true, @@ -23590,7 +31741,7 @@ extension ThemeAssetsQueryFilter }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'receiveCancelled', + property: r'personaEasy', lower: lower, includeLower: includeLower, upper: upper, @@ -23600,92 +31751,92 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - receiveCancelledStartsWith( + QueryBuilder + personaEasyRelativeStartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'receiveCancelled', + property: r'personaEasy', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - receiveCancelledEndsWith( + QueryBuilder + personaEasyRelativeEndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'receiveCancelled', + property: r'personaEasy', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - receiveCancelledContains(String value, {bool caseSensitive = true}) { + QueryBuilder + personaEasyRelativeContains(String value, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'receiveCancelled', + property: r'personaEasy', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - receiveCancelledMatches(String pattern, {bool caseSensitive = true}) { + QueryBuilder + personaEasyRelativeMatches(String pattern, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'receiveCancelled', + property: r'personaEasy', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - receiveCancelledIsEmpty() { + QueryBuilder + personaEasyRelativeIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'receiveCancelled', + property: r'personaEasy', value: '', )); }); } - QueryBuilder - receiveCancelledIsNotEmpty() { + QueryBuilder + personaEasyRelativeIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'receiveCancelled', + property: r'personaEasy', value: '', )); }); } - QueryBuilder - receivePendingEqualTo( + QueryBuilder + personaIncognitoRelativeEqualTo( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'receivePending', + property: r'personaIncognito', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - receivePendingGreaterThan( + QueryBuilder + personaIncognitoRelativeGreaterThan( String value, { bool include = false, bool caseSensitive = true, @@ -23693,15 +31844,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'receivePending', + property: r'personaIncognito', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - receivePendingLessThan( + QueryBuilder + personaIncognitoRelativeLessThan( String value, { bool include = false, bool caseSensitive = true, @@ -23709,15 +31860,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'receivePending', + property: r'personaIncognito', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - receivePendingBetween( + QueryBuilder + personaIncognitoRelativeBetween( String lower, String upper, { bool includeLower = true, @@ -23726,7 +31877,7 @@ extension ThemeAssetsQueryFilter }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'receivePending', + property: r'personaIncognito', lower: lower, includeLower: includeLower, upper: upper, @@ -23736,90 +31887,94 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - receivePendingStartsWith( + QueryBuilder + personaIncognitoRelativeStartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'receivePending', + property: r'personaIncognito', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - receivePendingEndsWith( + QueryBuilder + personaIncognitoRelativeEndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'receivePending', + property: r'personaIncognito', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - receivePendingContains(String value, {bool caseSensitive = true}) { + QueryBuilder + personaIncognitoRelativeContains(String value, + {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'receivePending', + property: r'personaIncognito', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - receivePendingMatches(String pattern, {bool caseSensitive = true}) { + QueryBuilder + personaIncognitoRelativeMatches(String pattern, + {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'receivePending', + property: r'personaIncognito', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - receivePendingIsEmpty() { + QueryBuilder + personaIncognitoRelativeIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'receivePending', + property: r'personaIncognito', value: '', )); }); } - QueryBuilder - receivePendingIsNotEmpty() { + QueryBuilder + personaIncognitoRelativeIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'receivePending', + property: r'personaIncognito', value: '', )); }); } - QueryBuilder sendEqualTo( + QueryBuilder + receiveRelativeEqualTo( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'send', + property: r'receive', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder sendGreaterThan( + QueryBuilder + receiveRelativeGreaterThan( String value, { bool include = false, bool caseSensitive = true, @@ -23827,14 +31982,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'send', + property: r'receive', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder sendLessThan( + QueryBuilder + receiveRelativeLessThan( String value, { bool include = false, bool caseSensitive = true, @@ -23842,14 +31998,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'send', + property: r'receive', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder sendBetween( + QueryBuilder + receiveRelativeBetween( String lower, String upper, { bool includeLower = true, @@ -23858,7 +32015,7 @@ extension ThemeAssetsQueryFilter }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'send', + property: r'receive', lower: lower, includeLower: includeLower, upper: upper, @@ -23868,91 +32025,92 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder sendStartsWith( + QueryBuilder + receiveRelativeStartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'send', + property: r'receive', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder sendEndsWith( + QueryBuilder + receiveRelativeEndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'send', + property: r'receive', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder sendContains( - String value, - {bool caseSensitive = true}) { + QueryBuilder + receiveRelativeContains(String value, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'send', + property: r'receive', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder sendMatches( - String pattern, - {bool caseSensitive = true}) { + QueryBuilder + receiveRelativeMatches(String pattern, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'send', + property: r'receive', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder sendIsEmpty() { + QueryBuilder + receiveRelativeIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'send', + property: r'receive', value: '', )); }); } - QueryBuilder - sendIsNotEmpty() { + QueryBuilder + receiveRelativeIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'send', + property: r'receive', value: '', )); }); } - QueryBuilder - sendCancelledEqualTo( + QueryBuilder + receiveCancelledRelativeEqualTo( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'sendCancelled', + property: r'receiveCancelled', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - sendCancelledGreaterThan( + QueryBuilder + receiveCancelledRelativeGreaterThan( String value, { bool include = false, bool caseSensitive = true, @@ -23960,15 +32118,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'sendCancelled', + property: r'receiveCancelled', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - sendCancelledLessThan( + QueryBuilder + receiveCancelledRelativeLessThan( String value, { bool include = false, bool caseSensitive = true, @@ -23976,15 +32134,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'sendCancelled', + property: r'receiveCancelled', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - sendCancelledBetween( + QueryBuilder + receiveCancelledRelativeBetween( String lower, String upper, { bool includeLower = true, @@ -23993,7 +32151,7 @@ extension ThemeAssetsQueryFilter }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'sendCancelled', + property: r'receiveCancelled', lower: lower, includeLower: includeLower, upper: upper, @@ -24003,92 +32161,94 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - sendCancelledStartsWith( + QueryBuilder + receiveCancelledRelativeStartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'sendCancelled', + property: r'receiveCancelled', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - sendCancelledEndsWith( + QueryBuilder + receiveCancelledRelativeEndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'sendCancelled', + property: r'receiveCancelled', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - sendCancelledContains(String value, {bool caseSensitive = true}) { + QueryBuilder + receiveCancelledRelativeContains(String value, + {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'sendCancelled', + property: r'receiveCancelled', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - sendCancelledMatches(String pattern, {bool caseSensitive = true}) { + QueryBuilder + receiveCancelledRelativeMatches(String pattern, + {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'sendCancelled', + property: r'receiveCancelled', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - sendCancelledIsEmpty() { + QueryBuilder + receiveCancelledRelativeIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'sendCancelled', + property: r'receiveCancelled', value: '', )); }); } - QueryBuilder - sendCancelledIsNotEmpty() { + QueryBuilder + receiveCancelledRelativeIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'sendCancelled', + property: r'receiveCancelled', value: '', )); }); } - QueryBuilder - sendPendingEqualTo( + QueryBuilder + receivePendingRelativeEqualTo( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'sendPending', + property: r'receivePending', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - sendPendingGreaterThan( + QueryBuilder + receivePendingRelativeGreaterThan( String value, { bool include = false, bool caseSensitive = true, @@ -24096,15 +32256,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'sendPending', + property: r'receivePending', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - sendPendingLessThan( + QueryBuilder + receivePendingRelativeLessThan( String value, { bool include = false, bool caseSensitive = true, @@ -24112,15 +32272,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'sendPending', + property: r'receivePending', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - sendPendingBetween( + QueryBuilder + receivePendingRelativeBetween( String lower, String upper, { bool includeLower = true, @@ -24129,7 +32289,7 @@ extension ThemeAssetsQueryFilter }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'sendPending', + property: r'receivePending', lower: lower, includeLower: includeLower, upper: upper, @@ -24139,91 +32299,94 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - sendPendingStartsWith( + QueryBuilder + receivePendingRelativeStartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'sendPending', + property: r'receivePending', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - sendPendingEndsWith( + QueryBuilder + receivePendingRelativeEndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'sendPending', + property: r'receivePending', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - sendPendingContains(String value, {bool caseSensitive = true}) { + QueryBuilder + receivePendingRelativeContains(String value, + {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'sendPending', + property: r'receivePending', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - sendPendingMatches(String pattern, {bool caseSensitive = true}) { + QueryBuilder + receivePendingRelativeMatches(String pattern, + {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'sendPending', + property: r'receivePending', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - sendPendingIsEmpty() { + QueryBuilder + receivePendingRelativeIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'sendPending', + property: r'receivePending', value: '', )); }); } - QueryBuilder - sendPendingIsNotEmpty() { + QueryBuilder + receivePendingRelativeIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'sendPending', + property: r'receivePending', value: '', )); }); } - QueryBuilder stackEqualTo( + QueryBuilder + sendRelativeEqualTo( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'stack', + property: r'send', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - stackGreaterThan( + QueryBuilder + sendRelativeGreaterThan( String value, { bool include = false, bool caseSensitive = true, @@ -24231,14 +32394,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'stack', + property: r'send', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder stackLessThan( + QueryBuilder + sendRelativeLessThan( String value, { bool include = false, bool caseSensitive = true, @@ -24246,14 +32410,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'stack', + property: r'send', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder stackBetween( + QueryBuilder + sendRelativeBetween( String lower, String upper, { bool includeLower = true, @@ -24262,7 +32427,7 @@ extension ThemeAssetsQueryFilter }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'stack', + property: r'send', lower: lower, includeLower: includeLower, upper: upper, @@ -24272,91 +32437,92 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder stackStartsWith( + QueryBuilder + sendRelativeStartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'stack', + property: r'send', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder stackEndsWith( + QueryBuilder + sendRelativeEndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'stack', + property: r'send', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder stackContains( - String value, - {bool caseSensitive = true}) { + QueryBuilder + sendRelativeContains(String value, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'stack', + property: r'send', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder stackMatches( - String pattern, - {bool caseSensitive = true}) { + QueryBuilder + sendRelativeMatches(String pattern, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'stack', + property: r'send', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder stackIsEmpty() { + QueryBuilder + sendRelativeIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'stack', + property: r'send', value: '', )); }); } - QueryBuilder - stackIsNotEmpty() { + QueryBuilder + sendRelativeIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'stack', + property: r'send', value: '', )); }); } - QueryBuilder - stackIconEqualTo( + QueryBuilder + sendCancelledRelativeEqualTo( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'stackIcon', + property: r'sendCancelled', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - stackIconGreaterThan( + QueryBuilder + sendCancelledRelativeGreaterThan( String value, { bool include = false, bool caseSensitive = true, @@ -24364,15 +32530,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'stackIcon', + property: r'sendCancelled', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - stackIconLessThan( + QueryBuilder + sendCancelledRelativeLessThan( String value, { bool include = false, bool caseSensitive = true, @@ -24380,15 +32546,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'stackIcon', + property: r'sendCancelled', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - stackIconBetween( + QueryBuilder + sendCancelledRelativeBetween( String lower, String upper, { bool includeLower = true, @@ -24397,7 +32563,7 @@ extension ThemeAssetsQueryFilter }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'stackIcon', + property: r'sendCancelled', lower: lower, includeLower: includeLower, upper: upper, @@ -24407,92 +32573,93 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - stackIconStartsWith( + QueryBuilder + sendCancelledRelativeStartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'stackIcon', + property: r'sendCancelled', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - stackIconEndsWith( + QueryBuilder + sendCancelledRelativeEndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'stackIcon', + property: r'sendCancelled', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - stackIconContains(String value, {bool caseSensitive = true}) { + QueryBuilder + sendCancelledRelativeContains(String value, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'stackIcon', + property: r'sendCancelled', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - stackIconMatches(String pattern, {bool caseSensitive = true}) { + QueryBuilder + sendCancelledRelativeMatches(String pattern, + {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'stackIcon', + property: r'sendCancelled', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - stackIconIsEmpty() { + QueryBuilder + sendCancelledRelativeIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'stackIcon', + property: r'sendCancelled', value: '', )); }); } - QueryBuilder - stackIconIsNotEmpty() { + QueryBuilder + sendCancelledRelativeIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'stackIcon', + property: r'sendCancelled', value: '', )); }); } - QueryBuilder - themePreviewEqualTo( + QueryBuilder + sendPendingRelativeEqualTo( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'themePreview', + property: r'sendPending', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - themePreviewGreaterThan( + QueryBuilder + sendPendingRelativeGreaterThan( String value, { bool include = false, bool caseSensitive = true, @@ -24500,15 +32667,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'themePreview', + property: r'sendPending', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - themePreviewLessThan( + QueryBuilder + sendPendingRelativeLessThan( String value, { bool include = false, bool caseSensitive = true, @@ -24516,15 +32683,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'themePreview', + property: r'sendPending', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - themePreviewBetween( + QueryBuilder + sendPendingRelativeBetween( String lower, String upper, { bool includeLower = true, @@ -24533,7 +32700,7 @@ extension ThemeAssetsQueryFilter }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'themePreview', + property: r'sendPending', lower: lower, includeLower: includeLower, upper: upper, @@ -24543,92 +32710,92 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - themePreviewStartsWith( + QueryBuilder + sendPendingRelativeStartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'themePreview', + property: r'sendPending', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - themePreviewEndsWith( + QueryBuilder + sendPendingRelativeEndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'themePreview', + property: r'sendPending', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - themePreviewContains(String value, {bool caseSensitive = true}) { + QueryBuilder + sendPendingRelativeContains(String value, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'themePreview', + property: r'sendPending', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - themePreviewMatches(String pattern, {bool caseSensitive = true}) { + QueryBuilder + sendPendingRelativeMatches(String pattern, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'themePreview', + property: r'sendPending', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - themePreviewIsEmpty() { + QueryBuilder + sendPendingRelativeIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'themePreview', + property: r'sendPending', value: '', )); }); } - QueryBuilder - themePreviewIsNotEmpty() { + QueryBuilder + sendPendingRelativeIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'themePreview', + property: r'sendPending', value: '', )); }); } - QueryBuilder - themeSelectorEqualTo( + QueryBuilder + stackRelativeEqualTo( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'themeSelector', + property: r'stack', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - themeSelectorGreaterThan( + QueryBuilder + stackRelativeGreaterThan( String value, { bool include = false, bool caseSensitive = true, @@ -24636,15 +32803,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'themeSelector', + property: r'stack', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - themeSelectorLessThan( + QueryBuilder + stackRelativeLessThan( String value, { bool include = false, bool caseSensitive = true, @@ -24652,15 +32819,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'themeSelector', + property: r'stack', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - themeSelectorBetween( + QueryBuilder + stackRelativeBetween( String lower, String upper, { bool includeLower = true, @@ -24669,7 +32836,7 @@ extension ThemeAssetsQueryFilter }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'themeSelector', + property: r'stack', lower: lower, includeLower: includeLower, upper: upper, @@ -24679,92 +32846,92 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - themeSelectorStartsWith( + QueryBuilder + stackRelativeStartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'themeSelector', + property: r'stack', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - themeSelectorEndsWith( + QueryBuilder + stackRelativeEndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'themeSelector', + property: r'stack', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - themeSelectorContains(String value, {bool caseSensitive = true}) { + QueryBuilder + stackRelativeContains(String value, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'themeSelector', + property: r'stack', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - themeSelectorMatches(String pattern, {bool caseSensitive = true}) { + QueryBuilder + stackRelativeMatches(String pattern, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'themeSelector', + property: r'stack', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - themeSelectorIsEmpty() { + QueryBuilder + stackRelativeIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'themeSelector', + property: r'stack', value: '', )); }); } - QueryBuilder - themeSelectorIsNotEmpty() { + QueryBuilder + stackRelativeIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'themeSelector', + property: r'stack', value: '', )); }); } - QueryBuilder - txExchangeEqualTo( + QueryBuilder + stackIconRelativeEqualTo( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'txExchange', + property: r'stackIcon', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - txExchangeGreaterThan( + QueryBuilder + stackIconRelativeGreaterThan( String value, { bool include = false, bool caseSensitive = true, @@ -24772,15 +32939,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'txExchange', + property: r'stackIcon', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - txExchangeLessThan( + QueryBuilder + stackIconRelativeLessThan( String value, { bool include = false, bool caseSensitive = true, @@ -24788,15 +32955,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'txExchange', + property: r'stackIcon', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - txExchangeBetween( + QueryBuilder + stackIconRelativeBetween( String lower, String upper, { bool includeLower = true, @@ -24805,7 +32972,7 @@ extension ThemeAssetsQueryFilter }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'txExchange', + property: r'stackIcon', lower: lower, includeLower: includeLower, upper: upper, @@ -24815,92 +32982,92 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - txExchangeStartsWith( + QueryBuilder + stackIconRelativeStartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'txExchange', + property: r'stackIcon', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - txExchangeEndsWith( + QueryBuilder + stackIconRelativeEndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'txExchange', + property: r'stackIcon', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - txExchangeContains(String value, {bool caseSensitive = true}) { + QueryBuilder + stackIconRelativeContains(String value, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'txExchange', + property: r'stackIcon', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - txExchangeMatches(String pattern, {bool caseSensitive = true}) { + QueryBuilder + stackIconRelativeMatches(String pattern, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'txExchange', + property: r'stackIcon', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - txExchangeIsEmpty() { + QueryBuilder + stackIconRelativeIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'txExchange', + property: r'stackIcon', value: '', )); }); } - QueryBuilder - txExchangeIsNotEmpty() { + QueryBuilder + stackIconRelativeIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'txExchange', + property: r'stackIcon', value: '', )); }); } - QueryBuilder - txExchangeFailedEqualTo( + QueryBuilder + themePreviewRelativeEqualTo( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'txExchangeFailed', + property: r'themePreview', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - txExchangeFailedGreaterThan( + QueryBuilder + themePreviewRelativeGreaterThan( String value, { bool include = false, bool caseSensitive = true, @@ -24908,15 +33075,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'txExchangeFailed', + property: r'themePreview', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - txExchangeFailedLessThan( + QueryBuilder + themePreviewRelativeLessThan( String value, { bool include = false, bool caseSensitive = true, @@ -24924,15 +33091,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'txExchangeFailed', + property: r'themePreview', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - txExchangeFailedBetween( + QueryBuilder + themePreviewRelativeBetween( String lower, String upper, { bool includeLower = true, @@ -24941,7 +33108,7 @@ extension ThemeAssetsQueryFilter }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'txExchangeFailed', + property: r'themePreview', lower: lower, includeLower: includeLower, upper: upper, @@ -24951,92 +33118,92 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - txExchangeFailedStartsWith( + QueryBuilder + themePreviewRelativeStartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'txExchangeFailed', + property: r'themePreview', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - txExchangeFailedEndsWith( + QueryBuilder + themePreviewRelativeEndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'txExchangeFailed', + property: r'themePreview', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - txExchangeFailedContains(String value, {bool caseSensitive = true}) { + QueryBuilder + themePreviewRelativeContains(String value, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'txExchangeFailed', + property: r'themePreview', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - txExchangeFailedMatches(String pattern, {bool caseSensitive = true}) { + QueryBuilder + themePreviewRelativeMatches(String pattern, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'txExchangeFailed', + property: r'themePreview', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - txExchangeFailedIsEmpty() { + QueryBuilder + themePreviewRelativeIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'txExchangeFailed', + property: r'themePreview', value: '', )); }); } - QueryBuilder - txExchangeFailedIsNotEmpty() { + QueryBuilder + themePreviewRelativeIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'txExchangeFailed', + property: r'themePreview', value: '', )); }); } - QueryBuilder - txExchangePendingEqualTo( + QueryBuilder + themeSelectorRelativeEqualTo( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'txExchangePending', + property: r'themeSelector', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - txExchangePendingGreaterThan( + QueryBuilder + themeSelectorRelativeGreaterThan( String value, { bool include = false, bool caseSensitive = true, @@ -25044,15 +33211,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'txExchangePending', + property: r'themeSelector', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - txExchangePendingLessThan( + QueryBuilder + themeSelectorRelativeLessThan( String value, { bool include = false, bool caseSensitive = true, @@ -25060,15 +33227,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'txExchangePending', + property: r'themeSelector', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - txExchangePendingBetween( + QueryBuilder + themeSelectorRelativeBetween( String lower, String upper, { bool includeLower = true, @@ -25077,7 +33244,7 @@ extension ThemeAssetsQueryFilter }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'txExchangePending', + property: r'themeSelector', lower: lower, includeLower: includeLower, upper: upper, @@ -25087,91 +33254,93 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - txExchangePendingStartsWith( + QueryBuilder + themeSelectorRelativeStartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'txExchangePending', + property: r'themeSelector', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - txExchangePendingEndsWith( + QueryBuilder + themeSelectorRelativeEndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'txExchangePending', + property: r'themeSelector', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - txExchangePendingContains(String value, {bool caseSensitive = true}) { + QueryBuilder + themeSelectorRelativeContains(String value, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'txExchangePending', + property: r'themeSelector', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - txExchangePendingMatches(String pattern, {bool caseSensitive = true}) { + QueryBuilder + themeSelectorRelativeMatches(String pattern, + {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'txExchangePending', + property: r'themeSelector', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - txExchangePendingIsEmpty() { + QueryBuilder + themeSelectorRelativeIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'txExchangePending', + property: r'themeSelector', value: '', )); }); } - QueryBuilder - txExchangePendingIsNotEmpty() { + QueryBuilder + themeSelectorRelativeIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'txExchangePending', + property: r'themeSelector', value: '', )); }); } - QueryBuilder wowneroEqualTo( + QueryBuilder + txExchangeRelativeEqualTo( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'wownero', + property: r'txExchange', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - wowneroGreaterThan( + QueryBuilder + txExchangeRelativeGreaterThan( String value, { bool include = false, bool caseSensitive = true, @@ -25179,14 +33348,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'wownero', + property: r'txExchange', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder wowneroLessThan( + QueryBuilder + txExchangeRelativeLessThan( String value, { bool include = false, bool caseSensitive = true, @@ -25194,14 +33364,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'wownero', + property: r'txExchange', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder wowneroBetween( + QueryBuilder + txExchangeRelativeBetween( String lower, String upper, { bool includeLower = true, @@ -25210,7 +33381,7 @@ extension ThemeAssetsQueryFilter }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'wownero', + property: r'txExchange', lower: lower, includeLower: includeLower, upper: upper, @@ -25220,93 +33391,92 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - wowneroStartsWith( + QueryBuilder + txExchangeRelativeStartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'wownero', + property: r'txExchange', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder wowneroEndsWith( + QueryBuilder + txExchangeRelativeEndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'wownero', + property: r'txExchange', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder wowneroContains( - String value, - {bool caseSensitive = true}) { + QueryBuilder + txExchangeRelativeContains(String value, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'wownero', + property: r'txExchange', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder wowneroMatches( - String pattern, - {bool caseSensitive = true}) { + QueryBuilder + txExchangeRelativeMatches(String pattern, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'wownero', + property: r'txExchange', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - wowneroIsEmpty() { + QueryBuilder + txExchangeRelativeIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'wownero', + property: r'txExchange', value: '', )); }); } - QueryBuilder - wowneroIsNotEmpty() { + QueryBuilder + txExchangeRelativeIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'wownero', + property: r'txExchange', value: '', )); }); } - QueryBuilder - wowneroImageEqualTo( + QueryBuilder + txExchangeFailedRelativeEqualTo( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'wowneroImage', + property: r'txExchangeFailed', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - wowneroImageGreaterThan( + QueryBuilder + txExchangeFailedRelativeGreaterThan( String value, { bool include = false, bool caseSensitive = true, @@ -25314,15 +33484,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'wowneroImage', + property: r'txExchangeFailed', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - wowneroImageLessThan( + QueryBuilder + txExchangeFailedRelativeLessThan( String value, { bool include = false, bool caseSensitive = true, @@ -25330,15 +33500,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'wowneroImage', + property: r'txExchangeFailed', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - wowneroImageBetween( + QueryBuilder + txExchangeFailedRelativeBetween( String lower, String upper, { bool includeLower = true, @@ -25347,7 +33517,7 @@ extension ThemeAssetsQueryFilter }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'wowneroImage', + property: r'txExchangeFailed', lower: lower, includeLower: includeLower, upper: upper, @@ -25357,92 +33527,94 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - wowneroImageStartsWith( + QueryBuilder + txExchangeFailedRelativeStartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'wowneroImage', + property: r'txExchangeFailed', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - wowneroImageEndsWith( + QueryBuilder + txExchangeFailedRelativeEndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'wowneroImage', + property: r'txExchangeFailed', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - wowneroImageContains(String value, {bool caseSensitive = true}) { + QueryBuilder + txExchangeFailedRelativeContains(String value, + {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'wowneroImage', + property: r'txExchangeFailed', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - wowneroImageMatches(String pattern, {bool caseSensitive = true}) { + QueryBuilder + txExchangeFailedRelativeMatches(String pattern, + {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'wowneroImage', + property: r'txExchangeFailed', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - wowneroImageIsEmpty() { + QueryBuilder + txExchangeFailedRelativeIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'wowneroImage', + property: r'txExchangeFailed', value: '', )); }); } - QueryBuilder - wowneroImageIsNotEmpty() { + QueryBuilder + txExchangeFailedRelativeIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'wowneroImage', + property: r'txExchangeFailed', value: '', )); }); } - QueryBuilder - wowneroImageSecondaryEqualTo( + QueryBuilder + txExchangePendingRelativeEqualTo( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'wowneroImageSecondary', + property: r'txExchangePending', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - wowneroImageSecondaryGreaterThan( + QueryBuilder + txExchangePendingRelativeGreaterThan( String value, { bool include = false, bool caseSensitive = true, @@ -25450,15 +33622,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( include: include, - property: r'wowneroImageSecondary', + property: r'txExchangePending', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - wowneroImageSecondaryLessThan( + QueryBuilder + txExchangePendingRelativeLessThan( String value, { bool include = false, bool caseSensitive = true, @@ -25466,15 +33638,15 @@ extension ThemeAssetsQueryFilter return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.lessThan( include: include, - property: r'wowneroImageSecondary', + property: r'txExchangePending', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - wowneroImageSecondaryBetween( + QueryBuilder + txExchangePendingRelativeBetween( String lower, String upper, { bool includeLower = true, @@ -25483,7 +33655,7 @@ extension ThemeAssetsQueryFilter }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.between( - property: r'wowneroImageSecondary', + property: r'txExchangePending', lower: lower, includeLower: includeLower, upper: upper, @@ -25493,77 +33665,78 @@ extension ThemeAssetsQueryFilter }); } - QueryBuilder - wowneroImageSecondaryStartsWith( + QueryBuilder + txExchangePendingRelativeStartsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.startsWith( - property: r'wowneroImageSecondary', + property: r'txExchangePending', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - wowneroImageSecondaryEndsWith( + QueryBuilder + txExchangePendingRelativeEndsWith( String value, { bool caseSensitive = true, }) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.endsWith( - property: r'wowneroImageSecondary', + property: r'txExchangePending', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - wowneroImageSecondaryContains(String value, {bool caseSensitive = true}) { + QueryBuilder + txExchangePendingRelativeContains(String value, + {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.contains( - property: r'wowneroImageSecondary', + property: r'txExchangePending', value: value, caseSensitive: caseSensitive, )); }); } - QueryBuilder - wowneroImageSecondaryMatches(String pattern, + QueryBuilder + txExchangePendingRelativeMatches(String pattern, {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.matches( - property: r'wowneroImageSecondary', + property: r'txExchangePending', wildcard: pattern, caseSensitive: caseSensitive, )); }); } - QueryBuilder - wowneroImageSecondaryIsEmpty() { + QueryBuilder + txExchangePendingRelativeIsEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.equalTo( - property: r'wowneroImageSecondary', + property: r'txExchangePending', value: '', )); }); } - QueryBuilder - wowneroImageSecondaryIsNotEmpty() { + QueryBuilder + txExchangePendingRelativeIsNotEmpty() { return QueryBuilder.apply(this, (query) { return query.addFilterCondition(FilterCondition.greaterThan( - property: r'wowneroImageSecondary', + property: r'txExchangePending', value: '', )); }); } } -extension ThemeAssetsQueryObject - on QueryBuilder {} +extension ThemeAssetsV3QueryObject + on QueryBuilder {} diff --git a/lib/models/paymint/transactions_model.dart b/lib/models/paymint/transactions_model.dart index 987c4c3c54..f952fa4fd9 100644 --- a/lib/models/paymint/transactions_model.dart +++ b/lib/models/paymint/transactions_model.dart @@ -362,8 +362,8 @@ class Output { scriptpubkeyType: json['scriptPubKey']['type'] as String?, scriptpubkeyAddress: address, value: (Decimal.parse((json["value"] ?? 0).toString()) * - Decimal.fromInt(Constants.satsPerCoin(Coin - .bitcoin))) // dirty hack but we need 8 decimal places here to keep consistent data structure + Decimal.fromInt(Constants.satsPerCoin(Coin.bitcoin) + .toInt())) // dirty hack but we need 8 decimal places here to keep consistent data structure .toBigInt() .toInt(), ); @@ -375,8 +375,8 @@ class Output { scriptpubkeyType: "", scriptpubkeyAddress: "", value: (Decimal.parse(0.toString()) * - Decimal.fromInt(Constants.satsPerCoin(Coin - .bitcoin))) // dirty hack but we need 8 decimal places here to keep consistent data structure + Decimal.fromInt(Constants.satsPerCoin(Coin.bitcoin) + .toInt())) // dirty hack but we need 8 decimal places here to keep consistent data structure .toBigInt() .toInt()); } diff --git a/lib/notifications/notification_card.dart b/lib/notifications/notification_card.dart index 4f0ec4734b..6ee2088aa4 100644 --- a/lib/notifications/notification_card.dart +++ b/lib/notifications/notification_card.dart @@ -32,7 +32,7 @@ class NotificationCard extends ConsumerWidget { static const double mobileIconSize = 24; static const double desktopIconSize = 30; - String coinIconPath(ThemeAssets assets, WidgetRef ref) { + String coinIconPath(IThemeAssets assets, WidgetRef ref) { try { final coin = coinFromPrettyName(notification.coinName); return ref.read(coinIconProvider(coin)); @@ -61,7 +61,7 @@ class NotificationCard extends ConsumerWidget { File( coinIconPath( ref.watch( - themeProvider.select((value) => value.assets), + themeAssetsProvider, ), ref), ), @@ -79,7 +79,7 @@ class NotificationCard extends ConsumerWidget { File( coinIconPath( ref.watch( - themeProvider.select((value) => value.assets), + themeAssetsProvider, ), ref), ), diff --git a/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart b/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart index 8f1f22187f..d9d5f87b2d 100644 --- a/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart +++ b/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart @@ -1,12 +1,15 @@ import 'dart:io'; import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:stackduo/models/add_wallet_list_entity/add_wallet_list_entity.dart'; +import 'package:stackduo/models/add_wallet_list_entity/sub_classes/coin_entity.dart'; import 'package:stackduo/pages/add_wallet_views/add_wallet_view/sub_widgets/add_wallet_text.dart'; -import 'package:stackduo/pages/add_wallet_views/add_wallet_view/sub_widgets/mobile_coin_list.dart'; +import 'package:stackduo/pages/add_wallet_views/add_wallet_view/sub_widgets/expanding_sub_list_item.dart'; import 'package:stackduo/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart'; -import 'package:stackduo/pages/add_wallet_views/add_wallet_view/sub_widgets/searchable_coin_list.dart'; import 'package:stackduo/pages_desktop_specific/my_stack_view/exit_to_my_stack_button.dart'; +import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/constants.dart'; @@ -17,39 +20,119 @@ import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/custom_buttons/app_bar_icon_button.dart'; import 'package:stackduo/widgets/desktop/desktop_app_bar.dart'; import 'package:stackduo/widgets/desktop/desktop_scaffold.dart'; +import 'package:stackduo/widgets/expandable.dart'; import 'package:stackduo/widgets/icon_widgets/x_icon.dart'; import 'package:stackduo/widgets/rounded_white_container.dart'; import 'package:stackduo/widgets/stack_text_field.dart'; import 'package:stackduo/widgets/textfield_icon_button.dart'; -class AddWalletView extends StatefulWidget { +class AddWalletView extends ConsumerStatefulWidget { const AddWalletView({Key? key}) : super(key: key); static const routeName = "/addWallet"; @override - State createState() => _AddWalletViewState(); + ConsumerState createState() => _AddWalletViewState(); } -class _AddWalletViewState extends State { +class _AddWalletViewState extends ConsumerState { late final TextEditingController _searchFieldController; late final FocusNode _searchFocusNode; String _searchTerm = ""; - final List coins = [...Coin.values]; + final List _coinsTestnet = [ + ...Coin.values.sublist(Coin.values.length - kTestNetCoinCount), + ]; + final List _coins = [ + ...Coin.values.sublist(0, Coin.values.length - kTestNetCoinCount) + ]; + final List coinEntities = []; final bool isDesktop = Util.isDesktop; + List filter( + String text, + List entities, + ) { + final _entities = [...entities]; + if (text.isNotEmpty) { + final lowercaseTerm = text.toLowerCase(); + _entities.retainWhere( + (e) => + e.ticker.toLowerCase().contains(lowercaseTerm) || + e.name.toLowerCase().contains(lowercaseTerm) || + e.coin.name.toLowerCase().contains(lowercaseTerm), + ); + } + + return _entities; + } + + // Future _addToken() async { + // EthContract? contract; + // if (isDesktop) { + // contract = await showDialog( + // context: context, + // builder: (context) => const DesktopDialog( + // maxWidth: 580, + // maxHeight: 500, + // child: AddCustomTokenView(), + // ), + // ); + // } else { + // contract = await Navigator.of(context).pushNamed( + // AddCustomTokenView.routeName, + // ); + // } + // + // if (contract != null) { + // await MainDB.instance.putEthContract(contract); + // if (mounted) { + // setState(() { + // if (tokenEntities + // .where((e) => e.token.address == contract!.address) + // .isEmpty) { + // tokenEntities.add(EthTokenEntity(contract!)); + // tokenEntities.sort((a, b) => a.token.name.compareTo(b.token.name)); + // } + // }); + // } + // } + // } + @override void initState() { _searchFieldController = TextEditingController(); _searchFocusNode = FocusNode(); - if (isDesktop) { - if (Platform.isWindows) { - coins.remove(Coin.monero); - } + // _coinsTestnet.remove(Coin.firoTestNet); + if (Platform.isWindows) { + _coins.remove(Coin.monero); + // _coins.remove(Coin.wownero); + } else if (Platform.isLinux) { + // _coins.remove(Coin.wownero); } + + coinEntities.addAll(_coins.map((e) => CoinEntity(e))); + + if (ref.read(prefsChangeNotifierProvider).showTestNetCoins) { + coinEntities.addAll(_coinsTestnet.map((e) => CoinEntity(e))); + } + + // final contracts = + // MainDB.instance.getEthContracts().sortByName().findAllSync(); + // + // if (contracts.isEmpty) { + // contracts.addAll(DefaultTokens.list); + // MainDB.instance.putEthContracts(contracts); + // } + // + // tokenEntities.addAll(contracts.map((e) => EthTokenEntity(e))); + + WidgetsBinding.instance.addPostFrameCallback((_) { + ref.refresh(addWalletSelectedEntityStateProvider); + }); + super.initState(); } @@ -95,87 +178,102 @@ class _AddWalletViewState extends State { Padding( padding: const EdgeInsets.all(4.0), child: ClipRRect( - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + child: TextField( + autocorrect: Util.isDesktop ? false : true, + enableSuggestions: Util.isDesktop ? false : true, + controller: _searchFieldController, + focusNode: _searchFocusNode, + onChanged: (value) { + setState(() { + _searchTerm = value; + }); + }, + style: + STextStyles.desktopTextMedium(context).copyWith( + height: 2, ), - child: Semantics( - label: - "Search Text Field. Inputs Text To Search In Wallets.", - excludeSemantics: true, - child: TextField( - autocorrect: Util.isDesktop ? false : true, - enableSuggestions: - Util.isDesktop ? false : true, - controller: _searchFieldController, - focusNode: _searchFocusNode, - onChanged: (value) { - setState(() { - _searchTerm = value; - }); - }, - style: STextStyles.desktopTextMedium(context) - .copyWith( - height: 2, + decoration: standardInputDecoration( + "Search", + _searchFocusNode, + context, + ).copyWith( + contentPadding: const EdgeInsets.symmetric( + vertical: 10, + ), + prefixIcon: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16, + // vertical: 20, ), - decoration: standardInputDecoration( - "Search", - _searchFocusNode, - context, - ).copyWith( - contentPadding: const EdgeInsets.symmetric( - vertical: 10, - ), - prefixIcon: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16, - // vertical: 20, - ), - child: SvgPicture.asset( - Assets.svg.search, - width: 24, - height: 24, - color: Theme.of(context) - .extension()! - .textFieldDefaultSearchIconLeft, - ), - ), - suffixIcon: _searchFieldController - .text.isNotEmpty - ? Padding( - padding: - const EdgeInsets.only(right: 10), - child: UnconstrainedBox( - child: Row( - children: [ - TextFieldIconButton( - child: const XIcon( - width: 24, - height: 24, - ), - onTap: () async { - setState(() { - _searchFieldController - .text = ""; - _searchTerm = ""; - }); - }, - ), - ], - ), - ), - ) - : null, + child: SvgPicture.asset( + Assets.svg.search, + width: 24, + height: 24, + color: Theme.of(context) + .extension()! + .textFieldDefaultSearchIconLeft, ), ), - )), + suffixIcon: _searchFieldController.text.isNotEmpty + ? Padding( + padding: const EdgeInsets.only(right: 10), + child: UnconstrainedBox( + child: Row( + children: [ + TextFieldIconButton( + child: const XIcon( + width: 24, + height: 24, + ), + onTap: () async { + setState(() { + _searchFieldController.text = + ""; + _searchTerm = ""; + }); + }, + ), + ], + ), + ), + ) + : null, + ), + ), + ), + ), + const SizedBox( + height: 8, ), Expanded( - child: SearchableCoinList( - coins: coins, - isDesktop: true, - searchTerm: _searchTerm, + child: SingleChildScrollView( + child: Column( + children: [ + ExpandingSubListItem( + title: "Coins", + entities: filter(_searchTerm, coinEntities), + initialState: ExpandableState.expanded, + animationDurationMultiplier: 0.5, + ), + // ExpandingSubListItem( + // title: "Tokens", + // entities: filter(_searchTerm, tokenEntities), + // initialState: ExpandableState.expanded, + // animationDurationMultiplier: 0.5, + // trailing: AddCustomTokenSelector( + // addFunction: _addToken, + // ), + // ), + ], + ), ), ), + const SizedBox( + height: 20, + ), ], ), ), @@ -222,9 +320,83 @@ class _AddWalletViewState extends State { const SizedBox( height: 16, ), + ClipRRect( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + child: Semantics( + label: + "Search Text Field. Inputs Text To Search In Wallets.", + excludeSemantics: true, + child: TextField( + autofocus: isDesktop, + autocorrect: !isDesktop, + enableSuggestions: !isDesktop, + controller: _searchFieldController, + focusNode: _searchFocusNode, + onChanged: (value) => + setState(() => _searchTerm = value), + style: STextStyles.field(context), + decoration: standardInputDecoration( + "Search", + _searchFocusNode, + context, + desktopMed: isDesktop, + ).copyWith( + prefixIcon: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 16, + ), + child: SvgPicture.asset( + Assets.svg.search, + width: 16, + height: 16, + ), + ), + suffixIcon: _searchFieldController.text.isNotEmpty + ? Padding( + padding: const EdgeInsets.only(right: 0), + child: UnconstrainedBox( + child: Row( + children: [ + TextFieldIconButton( + child: const XIcon(), + onTap: () async { + setState(() { + _searchFieldController.text = + ""; + _searchTerm = ""; + }); + }, + ), + ], + ), + ), + ) + : null, + ), + ), + )), + const SizedBox( + height: 10, + ), Expanded( - child: MobileCoinList( - coins: coins, + child: SingleChildScrollView( + child: Column( + children: [ + ExpandingSubListItem( + title: "Coins", + entities: filter(_searchTerm, coinEntities), + initialState: ExpandableState.expanded, + ), + // ExpandingSubListItem( + // title: "Tokens", + // entities: filter(_searchTerm, tokenEntities), + // initialState: ExpandableState.expanded, + // ), + ], + ), ), ), const SizedBox( diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/add_wallet_entity_list.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/add_wallet_entity_list.dart new file mode 100644 index 0000000000..bbafbe2cc6 --- /dev/null +++ b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/add_wallet_entity_list.dart @@ -0,0 +1,48 @@ +/* + * This file is part of Stack Wallet. + * + * Copyright (c) 2023 Cypher Stack + * All Rights Reserved. + * The code is distributed under GPLv3 license, see LICENSE file for details. + * Generated by Cypher Stack on 2023-05-26 + * + */ + +import 'package:flutter/material.dart'; +import 'package:stackduo/models/add_wallet_list_entity/add_wallet_list_entity.dart'; +import 'package:stackduo/pages/add_wallet_views/add_wallet_view/sub_widgets/coin_select_item.dart'; + +class AddWalletEntityList extends StatelessWidget { + const AddWalletEntityList({ + Key? key, + required this.entities, + this.trailing, + }) : super(key: key); + + final List entities; + final Widget? trailing; + + @override + Widget build(BuildContext context) { + return ListView.builder( + shrinkWrap: true, + primary: false, + itemCount: trailing != null ? entities.length + 1 : entities.length, + itemBuilder: (ctx, index) { + if (trailing != null && index == entities.length) { + return Padding( + padding: const EdgeInsets.all(4), + child: trailing, + ); + } else { + return Padding( + padding: const EdgeInsets.all(4), + child: CoinSelectItem( + entity: entities[index], + ), + ); + } + }, + ); + } +} diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/coin_select_item.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/coin_select_item.dart index 4354aae6cc..1600d21047 100644 --- a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/coin_select_item.dart +++ b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/coin_select_item.dart @@ -3,6 +3,7 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:stackduo/models/add_wallet_list_entity/add_wallet_list_entity.dart'; import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/themes/coin_icon_provider.dart'; import 'package:stackduo/themes/stack_colors.dart'; @@ -15,30 +16,44 @@ import 'package:stackduo/utilities/util.dart'; class CoinSelectItem extends ConsumerWidget { const CoinSelectItem({ Key? key, - required this.coin, + required this.entity, }) : super(key: key); - final Coin coin; + final AddWalletListEntity entity; @override Widget build(BuildContext context, WidgetRef ref) { - debugPrint("BUILD: CoinSelectItem for ${coin.name}"); - final selectedCoin = ref.watch(addWalletSelectedCoinStateProvider); + debugPrint("BUILD: CoinSelectItem for ${entity.name}"); + final selectedEntity = ref.watch(addWalletSelectedEntityStateProvider); final isDesktop = Util.isDesktop; + String? tokenImageUri; + // if (entity is EthTokenEntity) { + // final currency = ExchangeDataLoadingService.instance.isar.currencies + // .where() + // .exchangeNameEqualTo(ChangeNowExchange.exchangeName) + // .filter() + // .tokenContractEqualTo( + // (entity as EthTokenEntity).token.address, + // caseSensitive: false, + // ) + // .and() + // .imageIsNotEmpty() + // .findFirstSync(); + // tokenImageUri = currency?.image; + // } + return Container( decoration: BoxDecoration( - // color: selectedCoin == coin ? CFColors.selection : CFColors.white, - color: selectedCoin == coin + color: selectedEntity == entity ? Theme.of(context).extension()!.textFieldActiveBG : Theme.of(context).extension()!.popupBG, borderRadius: BorderRadius.circular(Constants.size.circularBorderRadius), ), child: MaterialButton( - // splashColor: Theme.of(context).extension()!.highlight, - key: Key("coinSelectItemButtonKey_${coin.name}"), + key: Key("coinSelectItemButtonKey_${entity.name}${entity.ticker}"), padding: isDesktop ? const EdgeInsets.only(left: 24) : const EdgeInsets.all(12), @@ -53,26 +68,32 @@ class CoinSelectItem extends ConsumerWidget { ), child: Row( children: [ - SvgPicture.file( - File( - ref.watch(coinIconProvider(coin)), - ), - width: 26, - height: 26, - ), + tokenImageUri != null + ? SvgPicture.network( + tokenImageUri, + width: 26, + height: 26, + ) + : SvgPicture.file( + File( + ref.watch(coinIconProvider(entity.coin)), + ), + width: 26, + height: 26, + ), SizedBox( width: isDesktop ? 12 : 10, ), Text( - coin.prettyName, + "${entity.name} (${entity.ticker})", style: isDesktop ? STextStyles.desktopTextMedium(context) : STextStyles.subtitle600(context).copyWith( fontSize: 14, ), ), - if (isDesktop && selectedCoin == coin) const Spacer(), - if (isDesktop && selectedCoin == coin) + if (isDesktop && selectedEntity == entity) const Spacer(), + if (isDesktop && selectedEntity == entity) Padding( padding: const EdgeInsets.only( right: 18, @@ -91,8 +112,9 @@ class CoinSelectItem extends ConsumerWidget { ], ), ), - onPressed: () => - ref.read(addWalletSelectedCoinStateProvider.state).state = coin, + onPressed: () { + ref.read(addWalletSelectedEntityStateProvider.state).state = entity; + }, ), ); } diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/expanding_sub_list_item.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/expanding_sub_list_item.dart new file mode 100644 index 0000000000..6f6f7ddc58 --- /dev/null +++ b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/expanding_sub_list_item.dart @@ -0,0 +1,133 @@ +/* + * This file is part of Stack Wallet. + * + * Copyright (c) 2023 Cypher Stack + * All Rights Reserved. + * The code is distributed under GPLv3 license, see LICENSE file for details. + * Generated by Cypher Stack on 2023-05-26 + * + */ + +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:stackduo/models/add_wallet_list_entity/add_wallet_list_entity.dart'; +import 'package:stackduo/pages/add_wallet_views/add_wallet_view/sub_widgets/add_wallet_entity_list.dart'; +import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/utilities/assets.dart'; +import 'package:stackduo/utilities/text_styles.dart'; +import 'package:stackduo/utilities/util.dart'; +import 'package:stackduo/widgets/animated_widgets/rotate_icon.dart'; +import 'package:stackduo/widgets/expandable.dart'; + +class ExpandingSubListItem extends StatefulWidget { + const ExpandingSubListItem({ + Key? key, + required this.title, + required this.entities, + this.trailing, + required this.initialState, + double? animationDurationMultiplier, + this.curve = Curves.easeInOutCubicEmphasized, + }) : animationDurationMultiplier = + animationDurationMultiplier ?? entities.length * 0.11, + super(key: key); + + final String title; + final List entities; + final Widget? trailing; + final ExpandableState initialState; + final double animationDurationMultiplier; + final Curve curve; + + @override + State createState() => _ExpandingSubListItemState(); +} + +class _ExpandingSubListItemState extends State { + final isDesktop = Util.isDesktop; + + late final ExpandableController _controller; + late final RotateIconController _rotateIconController; + + @override + void initState() { + _controller = ExpandableController(); + _rotateIconController = RotateIconController(); + WidgetsBinding.instance.addPostFrameCallback((_) { + if (widget.initialState == ExpandableState.expanded) { + _controller.toggle?.call(); + } + }); + super.initState(); + } + + @override + void dispose() { + _controller.toggle = null; + _rotateIconController.forward = null; + _rotateIconController.reverse = null; + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Expandable( + animationDurationMultiplier: widget.animationDurationMultiplier, + curve: widget.curve, + controller: _controller, + onExpandWillChange: (state) { + if (state == ExpandableState.expanded) { + _rotateIconController.forward?.call(); + } else { + _rotateIconController.reverse?.call(); + } + }, + header: Container( + color: Colors.transparent, + child: Padding( + padding: const EdgeInsets.only( + top: 8.0, + bottom: 8.0, + right: 10, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + widget.title, + style: isDesktop + ? STextStyles.desktopTextMedium(context).copyWith( + color: Theme.of(context) + .extension()! + .textDark3, + ) + : STextStyles.smallMed12(context), + textAlign: TextAlign.left, + ), + RotateIcon( + icon: SvgPicture.asset( + Assets.svg.chevronDown, + width: isDesktop ? 20 : 12, + height: isDesktop ? 10 : 6, + color: Theme.of(context) + .extension()! + .textFieldActiveSearchIconRight, + ), + curve: widget.curve, + animationDurationMultiplier: widget.animationDurationMultiplier, + controller: _rotateIconController, + ), + ], + ), + ), + ), + body: SingleChildScrollView( + primary: false, + child: AddWalletEntityList( + entities: widget.entities, + trailing: widget.trailing, + ), + ), + ); + } +} diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/mobile_coin_list.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/mobile_coin_list.dart deleted file mode 100644 index b238c6833d..0000000000 --- a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/mobile_coin_list.dart +++ /dev/null @@ -1,38 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:stackduo/pages/add_wallet_views/add_wallet_view/sub_widgets/coin_select_item.dart'; -import 'package:stackduo/providers/global/prefs_provider.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; - -class MobileCoinList extends StatelessWidget { - const MobileCoinList({ - Key? key, - required this.coins, - }) : super(key: key); - - final List coins; - - @override - Widget build(BuildContext context) { - return Consumer( - builder: (_, ref, __) { - bool showTestNet = ref.watch( - prefsChangeNotifierProvider.select((value) => value.showTestNetCoins), - ); - - return ListView.builder( - itemCount: - showTestNet ? coins.length : coins.length - (kTestNetCoinCount), - itemBuilder: (ctx, index) { - return Padding( - padding: const EdgeInsets.all(4), - child: CoinSelectItem( - coin: coins[index], - ), - ); - }, - ); - }, - ); - } -} diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart index 2d7d3f36f5..e872b23735 100644 --- a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart +++ b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart @@ -2,8 +2,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:stackduo/pages/add_wallet_views/create_or_restore_wallet_view/create_or_restore_wallet_view.dart'; import 'package:stackduo/providers/providers.dart'; -import 'package:stackduo/utilities/text_styles.dart'; import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/utilities/text_styles.dart'; class AddWalletNextButton extends ConsumerWidget { const AddWalletNextButton({ @@ -17,7 +17,7 @@ class AddWalletNextButton extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { debugPrint("BUILD: NextButton"); final selectedCoin = - ref.watch(addWalletSelectedCoinStateProvider.state).state; + ref.watch(addWalletSelectedEntityStateProvider.state).state; final enabled = selectedCoin != null; @@ -25,13 +25,17 @@ class AddWalletNextButton extends ConsumerWidget { onPressed: !enabled ? null : () { - final selectedCoin = - ref.read(addWalletSelectedCoinStateProvider.state).state; - + // if (selectedCoin is EthTokenEntity) { + // Navigator.of(context).pushNamed( + // SelectWalletForTokenView.routeName, + // arguments: selectedCoin, + // ); + // } else { Navigator.of(context).pushNamed( CreateOrRestoreWalletView.routeName, arguments: selectedCoin, ); + // } }, style: enabled ? Theme.of(context) diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/searchable_coin_list.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/searchable_coin_list.dart deleted file mode 100644 index c7d063e29c..0000000000 --- a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/searchable_coin_list.dart +++ /dev/null @@ -1,57 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:stackduo/pages/add_wallet_views/add_wallet_view/sub_widgets/coin_select_item.dart'; -import 'package:stackduo/providers/global/prefs_provider.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; - -class SearchableCoinList extends ConsumerWidget { - const SearchableCoinList({ - Key? key, - required this.coins, - required this.isDesktop, - required this.searchTerm, - }) : super(key: key); - - final List coins; - final bool isDesktop; - final String searchTerm; - - List filterCoins(String text, bool showTestNetCoins) { - final _coins = [...coins]; - if (text.isNotEmpty) { - final lowercaseTerm = text.toLowerCase(); - _coins.retainWhere((e) => - e.ticker.toLowerCase().contains(lowercaseTerm) || - e.prettyName.toLowerCase().contains(lowercaseTerm) || - e.name.toLowerCase().contains(lowercaseTerm)); - } - - // Kidgloves for Wownero on desktop - // if(isDesktop) { - // _coins.remove(Coin.wownero); - // } - - return _coins; - } - - @override - Widget build(BuildContext context, WidgetRef ref) { - bool showTestNet = ref.watch( - prefsChangeNotifierProvider.select((value) => value.showTestNetCoins), - ); - - final _coins = filterCoins(searchTerm, showTestNet); - - return ListView.builder( - itemCount: _coins.length, - itemBuilder: (ctx, index) { - return Padding( - padding: const EdgeInsets.all(4), - child: CoinSelectItem( - coin: _coins[index], - ), - ); - }, - ); - } -} diff --git a/lib/pages/add_wallet_views/create_or_restore_wallet_view/create_or_restore_wallet_view.dart b/lib/pages/add_wallet_views/create_or_restore_wallet_view/create_or_restore_wallet_view.dart index 796b27515c..6dd6862ce4 100644 --- a/lib/pages/add_wallet_views/create_or_restore_wallet_view/create_or_restore_wallet_view.dart +++ b/lib/pages/add_wallet_views/create_or_restore_wallet_view/create_or_restore_wallet_view.dart @@ -1,11 +1,11 @@ import 'package:flutter/material.dart'; +import 'package:stackduo/models/add_wallet_list_entity/add_wallet_list_entity.dart'; import 'package:stackduo/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/coin_image.dart'; import 'package:stackduo/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_or_restore_wallet_subtitle.dart'; import 'package:stackduo/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_or_restore_wallet_title.dart'; import 'package:stackduo/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_wallet_button_group.dart'; import 'package:stackduo/pages_desktop_specific/my_stack_view/exit_to_my_stack_button.dart'; import 'package:stackduo/themes/stack_colors.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/custom_buttons/app_bar_icon_button.dart'; @@ -15,12 +15,12 @@ import 'package:stackduo/widgets/desktop/desktop_scaffold.dart'; class CreateOrRestoreWalletView extends StatelessWidget { const CreateOrRestoreWalletView({ Key? key, - required this.coin, + required this.entity, }) : super(key: key); static const routeName = "/createOrRestoreWallet"; - final Coin coin; + final AddWalletListEntity entity; @override Widget build(BuildContext context) { @@ -44,7 +44,7 @@ class CreateOrRestoreWalletView extends StatelessWidget { flex: 10, ), CreateRestoreWalletTitle( - coin: coin, + coin: entity.coin, isDesktop: isDesktop, ), const SizedBox( @@ -60,7 +60,7 @@ class CreateOrRestoreWalletView extends StatelessWidget { height: 32, ), CoinImage( - coin: coin, + coin: entity.coin, width: isDesktop ? 324 : MediaQuery.of(context).size.width / 1.6, height: @@ -70,7 +70,7 @@ class CreateOrRestoreWalletView extends StatelessWidget { height: 32, ), CreateWalletButtonGroup( - coin: coin, + coin: entity.coin, isDesktop: isDesktop, ), const Spacer( @@ -112,7 +112,7 @@ class CreateOrRestoreWalletView extends StatelessWidget { flex: 2, ), CoinImage( - coin: coin, + coin: entity.coin, width: isDesktop ? 324 : MediaQuery.of(context).size.width / 1.6, @@ -124,7 +124,7 @@ class CreateOrRestoreWalletView extends StatelessWidget { flex: 2, ), CreateRestoreWalletTitle( - coin: coin, + coin: entity.coin, isDesktop: isDesktop, ), const SizedBox( @@ -137,7 +137,7 @@ class CreateOrRestoreWalletView extends StatelessWidget { flex: 5, ), CreateWalletButtonGroup( - coin: coin, + coin: entity.coin, isDesktop: isDesktop, ), ], diff --git a/lib/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart b/lib/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart index ce8befeb0d..79340722df 100644 --- a/lib/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart +++ b/lib/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart @@ -327,19 +327,15 @@ class _NameYourWalletViewState extends ConsumerState { final name = textEditingController.text; if (await walletsService.checkForDuplicate(name)) { - if (mounted) { - unawaited( - showFloatingFlushBar( - type: FlushBarType.warning, - message: "Wallet name already in use.", - iconAsset: Assets.svg.circleAlert, - context: context, - ), - ); - } + unawaited(showFloatingFlushBar( + type: FlushBarType.warning, + message: "Wallet name already in use.", + iconAsset: Assets.svg.circleAlert, + context: context, + )); } else { // hide keyboard if has focus - if (mounted && FocusScope.of(context).hasFocus) { + if (FocusScope.of(context).hasFocus) { FocusScope.of(context).unfocus(); await Future.delayed( const Duration(milliseconds: 50)); diff --git a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart index 439733a48f..a78cff3985 100644 --- a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart +++ b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart @@ -63,10 +63,6 @@ class _NewWalletRecoveryPhraseWarningViewState Widget build(BuildContext context) { debugPrint("BUILD: $runtimeType"); - final _numberOfPhraseWords = coin == Coin.monero - ? Constants.seedPhraseWordCountMonero - : Constants.seedPhraseWordCountBip39; - return MasterScaffold( isDesktop: isDesktop, appBar: isDesktop @@ -165,7 +161,15 @@ class _NewWalletRecoveryPhraseWarningViewState width: isDesktop ? 480 : null, child: isDesktop ? Text( - "On the next screen you will see $_numberOfPhraseWords words that make up your recovery phrase.\n\nPlease write it down. Keep it safe and never share it with anyone. Your recovery phrase is the only way you can access your funds if you forget your PIN, lose your phone, etc.\n\nStack Duo does not keep nor is able to restore your recover phrase. Only you have access to your wallet.", + "On the next screen you will see " + "${Constants.defaultSeedPhraseLengthFor(coin: coin)} " + "words that make up your recovery phrase.\n\nPlease " + "write it down. Keep it safe and never share it with " + "anyone. Your recovery phrase is the only way you can" + " access your funds if you forget your PIN, lose your" + " phone, etc.\n\nStack Wallet does not keep nor is " + "able to restore your recover phrase. Only you have " + "access to your wallet.", style: isDesktop ? STextStyles.desktopTextMediumRegular(context) : STextStyles.subtitle(context).copyWith( @@ -202,7 +206,9 @@ class _NewWalletRecoveryPhraseWarningViewState ), ), TextSpan( - text: "$_numberOfPhraseWords words", + text: + "${Constants.defaultSeedPhraseLengthFor(coin: coin)}" + " words", style: STextStyles.desktopH3(context).copyWith( color: Theme.of(context) .extension()! diff --git a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart index 413130e687..c4883829cb 100644 --- a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart +++ b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart @@ -391,32 +391,32 @@ class _RestoreOptionsViewState extends ConsumerState { } }, isExpanded: true, - icon: SvgPicture.asset( - Assets.svg.chevronDown, - width: 12, - height: 6, - color: Theme.of(context) - .extension()! - .textFieldActiveSearchIconRight, - ), - buttonPadding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 8, + iconStyleData: IconStyleData( + icon: SvgPicture.asset( + Assets.svg.chevronDown, + width: 12, + height: 6, + color: Theme.of(context) + .extension()! + .textFieldActiveSearchIconRight, + ), ), - buttonDecoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .textFieldDefaultBG, - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, + dropdownStyleData: DropdownStyleData( + offset: const Offset(0, -10), + elevation: 0, + decoration: BoxDecoration( + color: Theme.of(context) + .extension()! + .textFieldDefaultBG, + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), ), ), - dropdownDecoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .textFieldDefaultBG, - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, + menuItemStyleData: const MenuItemStyleData( + padding: EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, ), ), ), diff --git a/lib/pages/address_book_views/subviews/add_address_book_entry_view.dart b/lib/pages/address_book_views/subviews/add_address_book_entry_view.dart index 797ac6ec86..32c9ada284 100644 --- a/lib/pages/address_book_views/subviews/add_address_book_entry_view.dart +++ b/lib/pages/address_book_views/subviews/add_address_book_entry_view.dart @@ -693,7 +693,7 @@ class _AddAddressBookEntryViewState name: nameController.text, addresses: entries, isFavorite: _isFavorite, - customId: const Uuid().v1(), + customId: const Uuid().v1(), ); if (await ref diff --git a/lib/pages/address_book_views/subviews/new_contact_address_entry_form.dart b/lib/pages/address_book_views/subviews/new_contact_address_entry_form.dart index 06646300e7..d079ee1397 100644 --- a/lib/pages/address_book_views/subviews/new_contact_address_entry_form.dart +++ b/lib/pages/address_book_views/subviews/new_contact_address_entry_form.dart @@ -98,9 +98,25 @@ class _NewContactAddressEntryFormState "Select cryptocurrency", style: STextStyles.fieldLabel(context), ), - offset: const Offset(0, -10), + dropdownStyleData: DropdownStyleData( + offset: const Offset(0, -10), + elevation: 0, + decoration: BoxDecoration( + color: Theme.of(context) + .extension()! + .textFieldDefaultBG, + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + ), + ), + menuItemStyleData: const MenuItemStyleData( + padding: EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + ), isExpanded: true, - dropdownElevation: 0, value: ref.watch(addressEntryDataProvider(widget.id) .select((value) => value.coin)), onChanged: (value) { @@ -108,30 +124,12 @@ class _NewContactAddressEntryFormState ref.read(addressEntryDataProvider(widget.id)).coin = value; } }, - icon: SvgPicture.asset( - Assets.svg.chevronDown, - width: 10, - height: 5, - color: Theme.of(context).extension()!.textDark3, - ), - buttonPadding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 4, - ), - buttonDecoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .textFieldDefaultBG, - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, - ), - ), - dropdownDecoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .textFieldDefaultBG, - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, + iconStyleData: IconStyleData( + icon: SvgPicture.asset( + Assets.svg.chevronDown, + width: 10, + height: 5, + color: Theme.of(context).extension()!.textDark3, ), ), items: [ diff --git a/lib/pages/coin_control/coin_control_view.dart b/lib/pages/coin_control/coin_control_view.dart index 3d9ff5c4db..3a6094b414 100644 --- a/lib/pages/coin_control/coin_control_view.dart +++ b/lib/pages/coin_control/coin_control_view.dart @@ -4,19 +4,19 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/isar_models.dart'; import 'package:stackduo/pages/coin_control/utxo_card.dart'; import 'package:stackduo/pages/coin_control/utxo_details_view.dart'; -import 'package:stackduo/providers/global/locale_provider.dart'; import 'package:stackduo/providers/global/wallets_provider.dart'; import 'package:stackduo/services/mixins/coin_control_interface.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/widgets/animated_widgets/rotate_icon.dart'; import 'package:stackduo/widgets/app_bar_field.dart'; import 'package:stackduo/widgets/background.dart'; @@ -687,14 +687,9 @@ class _CoinControlViewState extends ConsumerState { fractionDigits: coin.decimals, ); return Text( - "${selectedSum.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select( - (value) => value.locale, - ), - ), - )} ${coin.ticker}", + ref + .watch(pAmountFormatter(coin)) + .format(selectedSum), style: widget.requestedTotal == null ? STextStyles.w600_14(context) : STextStyles.w600_14(context).copyWith( @@ -735,14 +730,9 @@ class _CoinControlViewState extends ConsumerState { style: STextStyles.w600_14(context), ), Text( - "${widget.requestedTotal!.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select( - (value) => value.locale, - ), - ), - )} ${coin.ticker}", + ref + .watch(pAmountFormatter(coin)) + .format(widget.requestedTotal!), style: STextStyles.w600_14(context), ), ], diff --git a/lib/pages/coin_control/utxo_card.dart b/lib/pages/coin_control/utxo_card.dart index cd83661844..3560e90b47 100644 --- a/lib/pages/coin_control/utxo_card.dart +++ b/lib/pages/coin_control/utxo_card.dart @@ -1,14 +1,14 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/isar_models.dart'; -import 'package:stackduo/providers/global/locale_provider.dart'; import 'package:stackduo/providers/global/wallets_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; import 'package:stackduo/widgets/icon_widgets/utxo_status_icon.dart'; import 'package:stackduo/widgets/rounded_container.dart'; @@ -124,15 +124,11 @@ class _UtxoCardState extends ConsumerState { mainAxisSize: MainAxisSize.min, children: [ Text( - "${utxo.value.toAmountAsRaw( - fractionDigits: coin.decimals, - ).localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), + ref.watch(pAmountFormatter(coin)).format( + utxo.value.toAmountAsRaw( + fractionDigits: coin.decimals, ), - )} ${coin.ticker}", + ), style: STextStyles.w600_14(context), ), const SizedBox( diff --git a/lib/pages/coin_control/utxo_details_view.dart b/lib/pages/coin_control/utxo_details_view.dart index 0d14a961a9..4fd62b35b4 100644 --- a/lib/pages/coin_control/utxo_details_view.dart +++ b/lib/pages/coin_control/utxo_details_view.dart @@ -3,15 +3,15 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/isar_models.dart'; import 'package:stackduo/pages/wallet_view/transaction_views/transaction_details_view.dart'; -import 'package:stackduo/providers/global/locale_provider.dart'; import 'package:stackduo/providers/global/wallets_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; @@ -240,13 +240,11 @@ class _UtxoDetailsViewState extends ConsumerState { width: 16, ), Text( - "${utxo!.value.toAmountAsRaw(fractionDigits: coin.decimals).localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), + ref.watch(pAmountFormatter(coin)).format( + utxo!.value.toAmountAsRaw( + fractionDigits: coin.decimals, ), - )} ${coin.ticker}", + ), style: STextStyles.pageTitleH2(context), ), ], diff --git a/lib/pages/exchange_view/confirm_change_now_send.dart b/lib/pages/exchange_view/confirm_change_now_send.dart index 72a2088ea0..d49da08be8 100644 --- a/lib/pages/exchange_view/confirm_change_now_send.dart +++ b/lib/pages/exchange_view/confirm_change_now_send.dart @@ -10,11 +10,13 @@ import 'package:stackduo/pages/wallet_view/wallet_view.dart'; import 'package:stackduo/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_auth_send.dart'; import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/route_generator.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; +import 'package:stackduo/utilities/logger.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; @@ -139,7 +141,12 @@ class _ConfirmChangeNowSendViewState Navigator.of(context).popUntil(ModalRoute.withName(routeOnSuccessName)); } - } catch (e) { + } catch (e, s) { + Logging.instance.log( + "Broadcast transaction failed: $e\n$s", + level: LogLevel.Error, + ); + // pop sending dialog Navigator.of(context).pop(); @@ -188,9 +195,9 @@ class _ConfirmChangeNowSendViewState child: Column( mainAxisSize: MainAxisSize.min, children: [ - Row( + const Row( mainAxisAlignment: MainAxisAlignment.end, - children: const [ + children: [ DesktopDialogCloseButton(), ], ), @@ -360,20 +367,19 @@ class _ConfirmChangeNowSendViewState mainAxisAlignment: MainAxisAlignment.end, children: [ Text( - "${(transactionInfo["fee"] is Amount ? transactionInfo["fee"] as Amount : (transactionInfo["fee"] as int).toAmountAsRaw( - fractionDigits: ref.watch( - managerProvider - .select((value) => value.coin.decimals), - ), - )).localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ), - )} ${ref.watch( + ref + .watch(pAmountFormatter(ref.watch( managerProvider.select((value) => value.coin), - ).ticker}", + ))) + .format(transactionInfo["fee"] is Amount + ? transactionInfo["fee"] as Amount + : (transactionInfo["fee"] as int) + .toAmountAsRaw( + fractionDigits: ref.watch( + managerProvider.select( + (value) => value.coin.decimals), + ), + )), style: STextStyles.desktopTextExtraExtraSmall(context) .copyWith( @@ -417,16 +423,9 @@ class _ConfirmChangeNowSendViewState final amount = transactionInfo["recipientAmt"] as Amount; final total = amount + fee; - final locale = ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ); + return Text( - "${total.localizedStringAsFixed( - locale: locale, - )}" - " ${coin.ticker}", + ref.watch(pAmountFormatter(coin)).format(total), style: STextStyles.itemSubtitle12(context) .copyWith( color: Theme.of(context) @@ -599,7 +598,7 @@ class _ConfirmChangeNowSendViewState ); return Text( - " | ${value.localizedStringAsFixed(locale: locale)} $currency", + " | ${value.fiatString(locale: locale)} $currency", style: STextStyles.desktopTextExtraExtraSmall(context) .copyWith( @@ -612,15 +611,11 @@ class _ConfirmChangeNowSendViewState ], ), child: Text( - "${(transactionInfo["recipientAmt"] as Amount).localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ), - )} ${ref.watch( - managerProvider.select((value) => value.coin), - ).ticker}", + ref + .watch(pAmountFormatter(ref.watch( + walletsChangeNotifierProvider.select( + (value) => value.getManager(walletId).coin)))) + .format((transactionInfo["recipientAmt"] as Amount)), style: STextStyles.itemSubtitle12(context), textAlign: TextAlign.right, ), @@ -646,19 +641,20 @@ class _ConfirmChangeNowSendViewState style: STextStyles.smallMed12(context), ), Text( - "${(transactionInfo["fee"] is Amount ? transactionInfo["fee"] as Amount : (transactionInfo["fee"] as int).toAmountAsRaw(fractionDigits: ref.watch( - managerProvider.select( - (value) => value.coin.decimals, - ), - ))).localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ), - )} ${ref.watch( + ref + .watch(pAmountFormatter(ref.watch( managerProvider.select((value) => value.coin), - ).ticker}", + ))) + .format( + (transactionInfo["fee"] is Amount + ? transactionInfo["fee"] as Amount + : (transactionInfo["fee"] as int).toAmountAsRaw( + fractionDigits: ref.watch( + managerProvider.select( + (value) => value.coin.decimals, + ), + ))), + ), style: STextStyles.itemSubtitle12(context), textAlign: TextAlign.right, ), @@ -750,16 +746,9 @@ class _ConfirmChangeNowSendViewState final amount = transactionInfo["recipientAmt"] as Amount; final total = amount + fee; - final locale = ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ); + return Text( - "${total.localizedStringAsFixed( - locale: locale, - )}" - " ${coin.ticker}", + ref.watch(pAmountFormatter(coin)).format(total), style: STextStyles.itemSubtitle12(context).copyWith( color: Theme.of(context) .extension()! diff --git a/lib/pages/exchange_view/exchange_coin_selection/exchange_currency_selection_view.dart b/lib/pages/exchange_view/exchange_coin_selection/exchange_currency_selection_view.dart index f53fb92921..63f212206d 100644 --- a/lib/pages/exchange_view/exchange_coin_selection/exchange_currency_selection_view.dart +++ b/lib/pages/exchange_view/exchange_coin_selection/exchange_currency_selection_view.dart @@ -9,11 +9,11 @@ import 'package:stackduo/models/isar/exchange_cache/pair.dart'; import 'package:stackduo/services/exchange/change_now/change_now_exchange.dart'; import 'package:stackduo/services/exchange/exchange_data_loading_service.dart'; import 'package:stackduo/services/exchange/majestic_bank/majestic_bank_exchange.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; @@ -371,18 +371,27 @@ class _ExchangeCurrencySelectionViewState SizedBox( width: 24, height: 24, - child: hasImageUrl - ? SvgPicture.network( - items[index].image, - width: 24, - height: 24, - placeholderBuilder: (_) => - const LoadingIndicator(), - ) - : const SizedBox( - width: 24, - height: 24, - ), + child: + // isStackCoin(items[index].ticker) + // ? CoinIconForTicker( + // ticker: items[index].ticker, size: 24) + // // ? getIconForTicker( + // // items[index].ticker, + // // size: 24, + // // ) + // : + hasImageUrl + ? SvgPicture.network( + items[index].image, + width: 24, + height: 24, + placeholderBuilder: (_) => + const LoadingIndicator(), + ) + : const SizedBox( + width: 24, + height: 24, + ), ), const SizedBox( width: 10, diff --git a/lib/pages/exchange_view/exchange_step_views/step_4_view.dart b/lib/pages/exchange_view/exchange_step_views/step_4_view.dart index a5af665515..68e69148bf 100644 --- a/lib/pages/exchange_view/exchange_step_views/step_4_view.dart +++ b/lib/pages/exchange_view/exchange_step_views/step_4_view.dart @@ -567,7 +567,7 @@ class _Step4ViewState extends ConsumerState { height: 24, ), Center( - child: QrImage( + child: QrImageView( // TODO: grab coin uri scheme from somewhere // data: "${coin.uriScheme}:$receivingAddress", data: model.trade!.payInAddress, diff --git a/lib/pages/exchange_view/exchange_view.dart b/lib/pages/exchange_view/exchange_view.dart index c77b28c597..a4faa9956c 100644 --- a/lib/pages/exchange_view/exchange_view.dart +++ b/lib/pages/exchange_view/exchange_view.dart @@ -3,16 +3,16 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/blockchain_data/transaction.dart'; import 'package:stackduo/pages/exchange_view/exchange_form.dart'; import 'package:stackduo/pages/exchange_view/trade_details_view.dart'; import 'package:stackduo/providers/global/trades_service_provider.dart'; import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/services/exchange/exchange_data_loading_service.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; import 'package:stackduo/widgets/custom_loading_overlay.dart'; import 'package:stackduo/widgets/trade_card.dart'; diff --git a/lib/pages/exchange_view/send_from_view.dart b/lib/pages/exchange_view/send_from_view.dart index b845835f15..0e1e174961 100644 --- a/lib/pages/exchange_view/send_from_view.dart +++ b/lib/pages/exchange_view/send_from_view.dart @@ -15,6 +15,7 @@ import 'package:stackduo/services/coins/manager.dart'; import 'package:stackduo/themes/coin_icon_provider.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; @@ -146,13 +147,7 @@ class _SendFromViewState extends ConsumerState { Row( children: [ Text( - "You need to send ${amount.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ), - )} ${coin.ticker}", + "You need to send ${ref.watch(pAmountFormatter(coin)).format(amount)}", style: isDesktop ? STextStyles.desktopTextExtraExtraSmall(context) : STextStyles.itemSubtitle(context), @@ -426,6 +421,13 @@ class _SendFromCardState extends ConsumerState { "Use private balance", style: STextStyles.itemSubtitle(context), ), + // Text( + // ref.watch(pAmountFormatter(coin)).format( + // (manager.wallet as FiroWallet) + // .availablePrivateBalance(), + // ), + // style: STextStyles.itemSubtitle(context), + // ), ], ), SvgPicture.asset( @@ -482,6 +484,12 @@ class _SendFromCardState extends ConsumerState { "Use public balance", style: STextStyles.itemSubtitle(context), ), + // Text( + // ref.watch(pAmountFormatter(coin)).format( + // (manager.wallet as FiroWallet) + // .availablePublicBalance()), + // style: STextStyles.itemSubtitle(context), + // ), ], ), SvgPicture.asset( @@ -567,9 +575,9 @@ class _SendFromCardState extends ConsumerState { ), if (!isFiro) Text( - "${manager.balance.spendable.localizedStringAsFixed( - locale: locale, - )} ${coin.ticker}", + ref + .watch(pAmountFormatter(coin)) + .format(manager.balance.spendable), style: STextStyles.itemSubtitle(context), ), ], diff --git a/lib/pages/exchange_view/sub_widgets/exchange_provider_option.dart b/lib/pages/exchange_view/sub_widgets/exchange_provider_option.dart index 565f8cd0db..de90ff7d23 100644 --- a/lib/pages/exchange_view/sub_widgets/exchange_provider_option.dart +++ b/lib/pages/exchange_view/sub_widgets/exchange_provider_option.dart @@ -6,13 +6,15 @@ import 'package:stackduo/models/exchange/response_objects/estimate.dart'; import 'package:stackduo/providers/exchange/exchange_form_state_provider.dart'; import 'package:stackduo/providers/global/locale_provider.dart'; import 'package:stackduo/services/exchange/exchange.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; +import 'package:stackduo/utilities/amount/amount_unit.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/enums/exchange_rate_type_enum.dart'; import 'package:stackduo/utilities/logger.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/animated_text.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; @@ -97,13 +99,32 @@ class _ExchangeOptionState extends ConsumerState { .toAmount(fractionDigits: decimals); } - final rateString = - "1 ${sendCurrency.ticker.toUpperCase()} ~ ${rate.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select((value) => value.locale), - ), - )} ${receivingCurrency.ticker.toUpperCase()}"; + Coin? coin; + try { + coin = coinFromTickerCaseInsensitive( + receivingCurrency.ticker); + } catch (_) { + coin = null; + } + + final String rateString; + if (coin != null) { + rateString = "1 ${sendCurrency.ticker.toUpperCase()} " + "~ ${ref.watch(pAmountFormatter(coin)).format(rate)}"; + } else { + final formatter = AmountFormatter( + unit: AmountUnit.normal, + locale: ref.watch( + localeServiceChangeNotifierProvider + .select((value) => value.locale), + ), + coin: Coin.bitcoin, // some sane default + maxDecimals: 8, // some sane default + ); + rateString = "1 ${sendCurrency.ticker.toUpperCase()} " + "~ ${formatter.format(rate, withUnitName: false)}" + " ${receivingCurrency.ticker.toUpperCase()}"; + } return ConditionalParent( condition: i > 0, diff --git a/lib/pages/exchange_view/trade_details_view.dart b/lib/pages/exchange_view/trade_details_view.dart index 7470bc5b8f..d8dc6a0fa7 100644 --- a/lib/pages/exchange_view/trade_details_view.dart +++ b/lib/pages/exchange_view/trade_details_view.dart @@ -26,6 +26,7 @@ import 'package:stackduo/services/exchange/trocador/trocador_exchange.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/themes/theme_providers.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/clipboard_interface.dart'; import 'package:stackduo/utilities/constants.dart'; @@ -113,7 +114,7 @@ class _TradeDetailsViewState extends ConsumerState { super.initState(); } - String _fetchIconAssetForStatus(String statusString, ThemeAssets assets) { + String _fetchIconAssetForStatus(String statusString, IThemeAssets assets) { ChangeNowTransactionStatus? status; try { if (statusString.toLowerCase().startsWith("waiting")) { @@ -322,11 +323,7 @@ class _TradeDetailsViewState extends ConsumerState { File( _fetchIconAssetForStatus( trade.status, - ref.watch( - themeProvider.select( - (value) => value.assets, - ), - ), + ref.watch(themeAssetsProvider), ), ), width: 32, @@ -360,13 +357,9 @@ class _TradeDetailsViewState extends ConsumerState { trade.payInCurrency); final amount = sendAmount.toAmount( fractionDigits: coin.decimals); - text = amount.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ), - ); + text = ref + .watch(pAmountFormatter(coin)) + .format(amount); } catch (_) { text = sendAmount.toStringAsFixed( trade.payInCurrency.toLowerCase() == "xmr" @@ -393,11 +386,7 @@ class _TradeDetailsViewState extends ConsumerState { File( _fetchIconAssetForStatus( trade.status, - ref.watch( - themeProvider.select( - (value) => value.assets, - ), - ), + ref.watch(themeAssetsProvider), ), ), width: 32, @@ -779,7 +768,7 @@ class _TradeDetailsViewState extends ConsumerState { child: SizedBox( width: width + 20, height: width + 20, - child: QrImage( + child: QrImageView( data: trade.payInAddress, size: width, backgroundColor: Theme.of(context) @@ -1232,7 +1221,7 @@ class _TradeDetailsViewState extends ConsumerState { if (trade.exchangeName .startsWith(TrocadorExchange.exchangeName)) { url = - "https://trocador.app/en/checkout${trade.tradeId}"; + "https://trocador.app/en/checkout/${trade.tradeId}"; } } return ConditionalParent( diff --git a/lib/pages/paynym/dialogs/confirm_paynym_connect_dialog.dart b/lib/pages/paynym/dialogs/confirm_paynym_connect_dialog.dart index 3b4511a202..2d413399ac 100644 --- a/lib/pages/paynym/dialogs/confirm_paynym_connect_dialog.dart +++ b/lib/pages/paynym/dialogs/confirm_paynym_connect_dialog.dart @@ -1,10 +1,12 @@ import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/desktop/desktop_dialog.dart'; import 'package:stackduo/widgets/desktop/desktop_dialog_close_button.dart'; @@ -12,7 +14,7 @@ import 'package:stackduo/widgets/desktop/primary_button.dart'; import 'package:stackduo/widgets/desktop/secondary_button.dart'; import 'package:stackduo/widgets/stack_dialog.dart'; -class ConfirmPaynymConnectDialog extends StatelessWidget { +class ConfirmPaynymConnectDialog extends ConsumerWidget { const ConfirmPaynymConnectDialog({ Key? key, required this.nymName, @@ -30,14 +32,14 @@ class ConfirmPaynymConnectDialog extends StatelessWidget { String get title => "Connect to $nymName"; - String get message => "A one-time connection fee of " - "${amount.localizedStringAsFixed(locale: locale)} ${coin.ticker} " + String message(String amountString) => "A one-time connection fee of " + "$amountString " "will be charged to connect to this PayNym.\n\nThis fee " "covers the cost of creating a one-time transaction to create a " "record on the blockchain. This keeps PayNyms decentralized."; @override - Widget build(BuildContext context) { + Widget build(BuildContext context, WidgetRef ref) { if (Util.isDesktop) { return DesktopDialog( maxHeight: double.infinity, @@ -76,7 +78,7 @@ class ConfirmPaynymConnectDialog extends StatelessWidget { right: 40, ), child: Text( - message, + message(ref.watch(pAmountFormatter(coin)).format(amount)), style: STextStyles.desktopTextMedium(context).copyWith( color: Theme.of(context).extension()!.textDark3, ), @@ -123,7 +125,7 @@ class ConfirmPaynymConnectDialog extends StatelessWidget { width: 24, height: 24, ), - message: message, + message: message(ref.watch(pAmountFormatter(coin)).format(amount)), leftButton: SecondaryButton( buttonHeight: ButtonHeight.xl, label: "Cancel", diff --git a/lib/pages/paynym/dialogs/paynym_details_popup.dart b/lib/pages/paynym/dialogs/paynym_details_popup.dart index 0fdc2b4274..c2e81773ff 100644 --- a/lib/pages/paynym/dialogs/paynym_details_popup.dart +++ b/lib/pages/paynym/dialogs/paynym_details_popup.dart @@ -138,6 +138,9 @@ class _PaynymDetailsPopupState extends ConsumerState { nymName: widget.accountLite.nymName, locale: ref.read(localeServiceChangeNotifierProvider).locale, onConfirmPressed: () { + // + print("CONFIRM NOTIF TX: $preparedTx"); + Navigator.of(context).push( RouteGenerator.getRoute( builder: (_) => ConfirmTransactionView( @@ -366,7 +369,7 @@ class _PaynymDetailsPopupState extends ConsumerState { const SizedBox( width: 20, ), - QrImage( + QrImageView( padding: const EdgeInsets.all(0), size: 100, data: widget.accountLite.code, diff --git a/lib/pages/paynym/dialogs/paynym_qr_popup.dart b/lib/pages/paynym/dialogs/paynym_qr_popup.dart index 19adf19c08..23c1303d38 100644 --- a/lib/pages/paynym/dialogs/paynym_qr_popup.dart +++ b/lib/pages/paynym/dialogs/paynym_qr_popup.dart @@ -147,7 +147,7 @@ class PaynymQrPopup extends StatelessWidget { const SizedBox( width: 20, ), - QrImage( + QrImageView( padding: const EdgeInsets.all(0), size: 130, data: paynymAccount.nonSegwitPaymentCode.code, diff --git a/lib/pages/paynym/paynym_claim_view.dart b/lib/pages/paynym/paynym_claim_view.dart index fc46a83929..103cdf9244 100644 --- a/lib/pages/paynym/paynym_claim_view.dart +++ b/lib/pages/paynym/paynym_claim_view.dart @@ -138,10 +138,8 @@ class _PaynymClaimViewState extends ConsumerState { const Spacer( flex: 1, ), - Image( - image: AssetImage( - Assets.svg.unclaimedPaynym, - ), + SvgPicture.asset( + Assets.svg.unclaimedPaynym, width: MediaQuery.of(context).size.width / 2, ), const SizedBox( diff --git a/lib/pages/paynym/subwidgets/desktop_paynym_details.dart b/lib/pages/paynym/subwidgets/desktop_paynym_details.dart index 7eb7b28323..81c3ed3419 100644 --- a/lib/pages/paynym/subwidgets/desktop_paynym_details.dart +++ b/lib/pages/paynym/subwidgets/desktop_paynym_details.dart @@ -356,7 +356,7 @@ class _PaynymDetailsPopupState extends ConsumerState { const SizedBox( width: 20, ), - QrImage( + QrImageView( padding: const EdgeInsets.all(0), size: 100, data: widget.accountLite.code, diff --git a/lib/pages/pinpad_views/create_pin_view.dart b/lib/pages/pinpad_views/create_pin_view.dart index e8597dcc3d..bb829ac2b6 100644 --- a/lib/pages/pinpad_views/create_pin_view.dart +++ b/lib/pages/pinpad_views/create_pin_view.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'dart:io'; import 'package:flutter/material.dart'; @@ -6,12 +7,11 @@ import 'package:stackduo/notifications/show_flush_bar.dart'; import 'package:stackduo/pages/home_view/home_view.dart'; import 'package:stackduo/providers/global/prefs_provider.dart'; import 'package:stackduo/providers/global/secure_store_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/biometrics.dart'; -import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/flutter_secure_storage_interface.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/custom_buttons/app_bar_icon_button.dart'; import 'package:stackduo/widgets/custom_pin_put/custom_pin_put.dart'; @@ -35,10 +35,11 @@ class CreatePinView extends ConsumerStatefulWidget { class _CreatePinViewState extends ConsumerState { BoxDecoration get _pinPutDecoration { return BoxDecoration( - color: Theme.of(context).extension()!.textSubtitle3, + color: Theme.of(context).extension()!.infoItemIcons, border: Border.all( - width: 1, - color: Theme.of(context).extension()!.textSubtitle3), + width: 1, + color: Theme.of(context).extension()!.infoItemIcons, + ), borderRadius: BorderRadius.circular(6), ); } @@ -57,10 +58,13 @@ class _CreatePinViewState extends ConsumerState { late SecureStorageInterface _secureStore; late Biometrics biometrics; + int pinCount = 1; + @override initState() { _secureStore = ref.read(secureStoreProvider); biometrics = widget.biometrics; + super.initState(); } @@ -71,11 +75,13 @@ class _CreatePinViewState extends ConsumerState { _pinPutController2.dispose(); _pinPutFocusNode1.dispose(); _pinPutFocusNode2.dispose(); + super.dispose(); } @override Widget build(BuildContext context) { + // int pinCount = 1; return Background( child: Scaffold( backgroundColor: Theme.of(context).extension()!.background, @@ -116,7 +122,7 @@ class _CreatePinViewState extends ConsumerState { height: 36, ), CustomPinPut( - fieldsCount: Constants.pinLength, + fieldsCount: pinCount, eachFieldHeight: 12, eachFieldWidth: 12, textStyle: STextStyles.label(context).copyWith( @@ -140,21 +146,23 @@ class _CreatePinViewState extends ConsumerState { ), isRandom: ref.read(prefsChangeNotifierProvider).randomizePIN, - submittedFieldDecoration: _pinPutDecoration.copyWith( - color: Theme.of(context) - .extension()! - .infoItemIcons, - border: Border.all( - width: 1, - color: Theme.of(context) - .extension()! - .infoItemIcons, - ), - ), + submittedFieldDecoration: _pinPutDecoration, selectedFieldDecoration: _pinPutDecoration, followingFieldDecoration: _pinPutDecoration, + onPinLengthChanged: (newLength) { + setState(() { + pinCount = newLength; + }); + }, onSubmit: (String pin) { - if (pin.length == Constants.pinLength) { + if (pin.length < 4) { + showFloatingFlushBar( + type: FlushBarType.warning, + message: "PIN not long enough!", + iconAsset: Assets.svg.alertCircle, + context: context, + ); + } else { _pageController.nextPage( duration: const Duration(milliseconds: 300), curve: Curves.linear, @@ -184,7 +192,7 @@ class _CreatePinViewState extends ConsumerState { height: 36, ), CustomPinPut( - fieldsCount: Constants.pinLength, + fieldsCount: pinCount, eachFieldHeight: 12, eachFieldWidth: 12, textStyle: STextStyles.infoSmall(context).copyWith( diff --git a/lib/pages/pinpad_views/lock_screen_view.dart b/lib/pages/pinpad_views/lock_screen_view.dart index 55449d08bd..2ca44c7622 100644 --- a/lib/pages/pinpad_views/lock_screen_view.dart +++ b/lib/pages/pinpad_views/lock_screen_view.dart @@ -9,15 +9,14 @@ import 'package:stackduo/pages/wallet_view/wallet_view.dart'; import 'package:stackduo/providers/global/prefs_provider.dart'; import 'package:stackduo/providers/global/secure_store_provider.dart'; import 'package:stackduo/providers/global/wallets_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; // import 'package:stackduo/providers/global/should_show_lockscreen_on_resume_state_provider.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/biometrics.dart'; -import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/flutter_secure_storage_interface.dart'; import 'package:stackduo/utilities/show_loading.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/custom_buttons/app_bar_icon_button.dart'; import 'package:stackduo/widgets/custom_buttons/blue_text_button.dart'; @@ -189,10 +188,11 @@ class _LockscreenViewState extends ConsumerState { BoxDecoration get _pinPutDecoration { return BoxDecoration( - color: Theme.of(context).extension()!.textSubtitle2, + color: Theme.of(context).extension()!.infoItemIcons, border: Border.all( - width: 1, - color: Theme.of(context).extension()!.textSubtitle2), + width: 1, + color: Theme.of(context).extension()!.infoItemIcons, + ), borderRadius: BorderRadius.circular(6), ); } @@ -202,6 +202,7 @@ class _LockscreenViewState extends ConsumerState { late SecureStorageInterface _secureStore; late Biometrics biometrics; + int pinCount = 1; Widget get _body => Background( child: SafeArea( @@ -274,14 +275,7 @@ class _LockscreenViewState extends ConsumerState { height: 52, ), CustomPinPut( - // I don't know why is this commented out so I am not wrapping it with Semantics - // customKey: CustomKey( - // onPressed: _checkUseBiometrics, - // iconAssetName: Platform.isIOS - // ? Assets.svg.faceId - // : Assets.svg.fingerprint, - // ), - fieldsCount: Constants.pinLength, + fieldsCount: pinCount, eachFieldHeight: 12, eachFieldWidth: 12, textStyle: STextStyles.label(context).copyWith( @@ -303,19 +297,7 @@ class _LockscreenViewState extends ConsumerState { .background, counterText: "", ), - submittedFieldDecoration: _pinPutDecoration.copyWith( - color: Theme.of(context) - .extension()! - .infoItemIcons, - border: Border.all( - width: 1, - color: Theme.of(context) - .extension()! - .infoItemIcons, - ), - ), - selectedFieldDecoration: _pinPutDecoration, - followingFieldDecoration: _pinPutDecoration, + submittedFieldDecoration: _pinPutDecoration, isRandom: ref .read(prefsChangeNotifierProvider) .randomizePIN, diff --git a/lib/pages/receive_view/addresses/address_card.dart b/lib/pages/receive_view/addresses/address_card.dart index df5484ff89..b9ad4956f0 100644 --- a/lib/pages/receive_view/addresses/address_card.dart +++ b/lib/pages/receive_view/addresses/address_card.dart @@ -5,7 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/isar_models.dart'; import 'package:stackduo/pages/receive_view/addresses/address_tag.dart'; import 'package:stackduo/themes/coin_icon_provider.dart'; diff --git a/lib/pages/receive_view/addresses/address_details_view.dart b/lib/pages/receive_view/addresses/address_details_view.dart index 3ea6dc51fa..ecbe7cd4a4 100644 --- a/lib/pages/receive_view/addresses/address_details_view.dart +++ b/lib/pages/receive_view/addresses/address_details_view.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; import 'package:qr_flutter/qr_flutter.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/isar_models.dart'; import 'package:stackduo/pages/receive_view/addresses/address_tag.dart'; import 'package:stackduo/pages/wallet_view/sub_widgets/no_transactions_found.dart'; @@ -77,7 +77,7 @@ class _AddressDetailsViewState extends ConsumerState { Center( child: RepaintBoundary( key: _qrKey, - child: QrImage( + child: QrImageView( data: AddressUtils.buildUriString( ref.watch(walletsChangeNotifierProvider.select( (value) => @@ -266,7 +266,7 @@ class _AddressDetailsViewState extends ConsumerState { Center( child: RepaintBoundary( key: _qrKey, - child: QrImage( + child: QrImageView( data: AddressUtils.buildUriString( ref.watch(walletsChangeNotifierProvider.select( (value) => diff --git a/lib/pages/receive_view/addresses/address_qr_popup.dart b/lib/pages/receive_view/addresses/address_qr_popup.dart index f93e33b21f..e8d27165a6 100644 --- a/lib/pages/receive_view/addresses/address_qr_popup.dart +++ b/lib/pages/receive_view/addresses/address_qr_popup.dart @@ -126,7 +126,7 @@ class _AddressQrPopupState extends State { Center( child: RepaintBoundary( key: _qrKey, - child: QrImage( + child: QrImageView( data: AddressUtils.buildUriString( widget.coin, widget.addressString, diff --git a/lib/pages/receive_view/addresses/edit_address_label_view.dart b/lib/pages/receive_view/addresses/edit_address_label_view.dart index 0f69f9f0a6..a23d64ed53 100644 --- a/lib/pages/receive_view/addresses/edit_address_label_view.dart +++ b/lib/pages/receive_view/addresses/edit_address_label_view.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/address_label.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/text_styles.dart'; diff --git a/lib/pages/receive_view/addresses/wallet_addresses_view.dart b/lib/pages/receive_view/addresses/wallet_addresses_view.dart index e597c4c841..06b9ce19a1 100644 --- a/lib/pages/receive_view/addresses/wallet_addresses_view.dart +++ b/lib/pages/receive_view/addresses/wallet_addresses_view.dart @@ -2,15 +2,15 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/isar_models.dart'; import 'package:stackduo/pages/receive_view/addresses/address_card.dart'; import 'package:stackduo/pages/receive_view/addresses/address_details_view.dart'; import 'package:stackduo/providers/global/wallets_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; diff --git a/lib/pages/receive_view/generate_receiving_uri_qr_code_view.dart b/lib/pages/receive_view/generate_receiving_uri_qr_code_view.dart index f8524fc0a2..0782e26bc7 100644 --- a/lib/pages/receive_view/generate_receiving_uri_qr_code_view.dart +++ b/lib/pages/receive_view/generate_receiving_uri_qr_code_view.dart @@ -13,15 +13,14 @@ import 'package:path_provider/path_provider.dart'; import 'package:qr_flutter/qr_flutter.dart'; import 'package:share_plus/share_plus.dart'; import 'package:stackduo/notifications/show_flush_bar.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/address_utils.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/clipboard_interface.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; -import 'package:stackduo/utilities/enums/flush_bar_type.dart'; import 'package:stackduo/utilities/logger.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; @@ -194,7 +193,7 @@ class _GenerateUriQrCodeViewState extends State { child: SizedBox( width: width + 20, height: width + 20, - child: QrImage( + child: QrImageView( data: uriString, size: width, backgroundColor: @@ -529,7 +528,7 @@ class _GenerateUriQrCodeViewState extends State { child: SizedBox( width: 234, height: 234, - child: QrImage( + child: QrImageView( data: _uriString, size: 220, backgroundColor: Theme.of(context) diff --git a/lib/pages/receive_view/receive_view.dart b/lib/pages/receive_view/receive_view.dart index 416ef408be..5971faadc0 100644 --- a/lib/pages/receive_view/receive_view.dart +++ b/lib/pages/receive_view/receive_view.dart @@ -11,6 +11,7 @@ import 'package:stackduo/pages/receive_view/generate_receiving_uri_qr_code_view. import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/route_generator.dart'; import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/utilities/address_utils.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/clipboard_interface.dart'; import 'package:stackduo/utilities/constants.dart'; @@ -25,15 +26,15 @@ import 'package:stackduo/widgets/rounded_white_container.dart'; class ReceiveView extends ConsumerStatefulWidget { const ReceiveView({ Key? key, - required this.coin, required this.walletId, + this.tokenContract, this.clipboard = const ClipboardWrapper(), }) : super(key: key); static const String routeName = "/receiveView"; - final Coin coin; final String walletId; + final dynamic? tokenContract; final ClipboardInterface clipboard; @override @@ -86,7 +87,7 @@ class _ReceiveViewState extends ConsumerState { @override void initState() { walletId = widget.walletId; - coin = widget.coin; + coin = ref.read(walletsChangeNotifierProvider).getManager(walletId).coin; clipboard = widget.clipboard; WidgetsBinding.instance.addPostFrameCallback((timeStamp) async { @@ -117,6 +118,8 @@ class _ReceiveViewState extends ConsumerState { } }); + final ticker = widget.tokenContract?.symbol ?? coin.ticker; + return Background( child: Scaffold( backgroundColor: Theme.of(context).extension()!.background, @@ -127,7 +130,7 @@ class _ReceiveViewState extends ConsumerState { }, ), title: Text( - "Receive ${coin.ticker}", + "Receive $ticker", style: STextStyles.navBarTitle(context), ), actions: [ @@ -248,7 +251,7 @@ class _ReceiveViewState extends ConsumerState { Row( children: [ Text( - "Your ${coin.ticker} address", + "Your $ticker address", style: STextStyles.itemSubtitle(context), ), const Spacer(), @@ -315,8 +318,12 @@ class _ReceiveViewState extends ConsumerState { child: Center( child: Column( children: [ - QrImage( - data: "${coin.uriScheme}:$receivingAddress", + QrImageView( + data: AddressUtils.buildUriString( + coin, + receivingAddress, + {}, + ), size: MediaQuery.of(context).size.width / 2, foregroundColor: Theme.of(context) .extension()! diff --git a/lib/pages/send_view/confirm_transaction_view.dart b/lib/pages/send_view/confirm_transaction_view.dart index 84ae8ac7c4..2acd2e6014 100644 --- a/lib/pages/send_view/confirm_transaction_view.dart +++ b/lib/pages/send_view/confirm_transaction_view.dart @@ -18,6 +18,7 @@ import 'package:stackduo/services/mixins/paynym_wallet_interface.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/themes/theme_providers.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; @@ -44,6 +45,7 @@ class ConfirmTransactionView extends ConsumerStatefulWidget { this.isTradeTransaction = false, this.isPaynymTransaction = false, this.isPaynymNotificationTransaction = false, + this.isTokenTx = false, this.onSuccessInsteadOfRouteOnSuccess, }) : super(key: key); @@ -55,6 +57,7 @@ class ConfirmTransactionView extends ConsumerStatefulWidget { final bool isTradeTransaction; final bool isPaynymTransaction; final bool isPaynymNotificationTransaction; + final bool isTokenTx; final VoidCallback? onSuccessInsteadOfRouteOnSuccess; @override @@ -104,13 +107,26 @@ class _ConfirmTransactionViewState final note = noteController.text; try { - if (widget.isPaynymNotificationTransaction) { + // if (widget.isTokenTx) { + // txidFuture = ref + // .read(tokenServiceProvider)! + // .confirmSend(txData: transactionInfo); + // } else + if (widget.isPaynymNotificationTransaction) { txidFuture = (manager.wallet as PaynymWalletInterface) .broadcastNotificationTx(preparedTx: transactionInfo); } else if (widget.isPaynymTransaction) { txidFuture = manager.confirmSend(txData: transactionInfo); } else { - txidFuture = manager.confirmSend(txData: transactionInfo); + // final coin = manager.coin; + // if ((coin == Coin.firo || coin == Coin.firoTestNet) && + // ref.read(publicPrivateBalanceStateProvider.state).state != + // "Private") { + // txidFuture = (manager.wallet as FiroWallet) + // .confirmSendPublic(txData: transactionInfo); + // } else { + txidFuture = manager.confirmSend(txData: transactionInfo); + // } } final results = await Future.wait([ @@ -140,6 +156,20 @@ class _ConfirmTransactionViewState widget.onSuccessInsteadOfRouteOnSuccess!.call(); } } + // } on BadEpicHttpAddressException catch (_) { + // if (mounted) { + // // pop building dialog + // Navigator.of(context).pop(); + // unawaited( + // showFloatingFlushBar( + // type: FlushBarType.warning, + // message: + // "Connection failed. Please check the address and try again.", + // context: context, + // ), + // ); + // return; + // } } catch (e, s) { //todo: comeback to this debugPrint("$e\n$s"); @@ -241,8 +271,16 @@ class _ConfirmTransactionViewState final managerProvider = ref.watch(walletsChangeNotifierProvider .select((value) => value.getManagerProvider(walletId))); - final String unit = ref.watch(walletsChangeNotifierProvider - .select((value) => value.getManager(walletId).coin.ticker)); + final coin = ref.watch(walletsChangeNotifierProvider + .select((value) => value.getManager(walletId).coin)); + + final String unit; + // if (widget.isTokenTx) { + // unit = ref.watch( + // tokenServiceProvider.select((value) => value!.tokenContract.symbol)); + // } else { + unit = coin.ticker; + // } return ConditionalParent( condition: !isDesktop, @@ -369,50 +407,76 @@ class _ConfirmTransactionViewState style: STextStyles.smallMed12(context), ), Text( - "${(transactionInfo["recipientAmt"] as Amount).localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select((value) => value.locale), - ), - )} $unit", + ref.watch(pAmountFormatter(coin)).format( + transactionInfo["recipientAmt"] as Amount, + // ethContract: + // ref + // .watch(tokenServiceProvider) + // ?.tokenContract, + ), style: STextStyles.itemSubtitle12(context), textAlign: TextAlign.right, ), ], ), ), - const SizedBox( - height: 12, - ), - RoundedWhiteContainer( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "Transaction fee", - style: STextStyles.smallMed12(context), - ), - Text( - "${(transactionInfo["fee"] is Amount ? transactionInfo["fee"] as Amount : (transactionInfo["fee"] as int).toAmountAsRaw( - fractionDigits: ref.watch( - managerProvider.select( - (value) => value.coin.decimals, + // if (coin != Coin.banano && coin != Coin.nano) + const SizedBox( + height: 12, + ), + // if (coin != Coin.banano && coin != Coin.nano) + RoundedWhiteContainer( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Transaction fee", + style: STextStyles.smallMed12(context), + ), + Text( + ref.watch(pAmountFormatter(coin)).format( + (transactionInfo["fee"] is Amount + ? transactionInfo["fee"] as Amount + : (transactionInfo["fee"] as int) + .toAmountAsRaw( + fractionDigits: ref.watch( + managerProvider.select( + (value) => value.coin.decimals, + ), + ), + )), ), - ), - )).localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select((value) => value.locale), - ), - )} ${ref.watch( - managerProvider.select((value) => value.coin), - ).ticker}", - style: STextStyles.itemSubtitle12(context), - textAlign: TextAlign.right, - ), - ], + style: STextStyles.itemSubtitle12(context), + textAlign: TextAlign.right, + ), + ], + ), + ), + if (transactionInfo["fee"] is int && + transactionInfo["vSize"] is int) + const SizedBox( + height: 12, + ), + if (transactionInfo["fee"] is int && + transactionInfo["vSize"] is int) + RoundedWhiteContainer( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "sats/vByte", + style: STextStyles.smallMed12(context), + ), + const SizedBox( + height: 4, + ), + Text( + "~${(transactionInfo["fee"] / transactionInfo["vSize"]).toInt()}", + style: STextStyles.itemSubtitle12(context), + ), + ], + ), ), - ), const SizedBox( height: 12, ), @@ -524,14 +588,28 @@ class _ConfirmTransactionViewState String fiatAmount = "N/A"; if (externalCalls) { - final price = ref - .read(priceAnd24hChangeNotifierProvider) - .getPrice(coin) - .item1; + final price = + // widget.isTokenTx + // ? ref + // .read( + // priceAnd24hChangeNotifierProvider) + // .getTokenPrice( + // ref + // .read(tokenServiceProvider)! + // .tokenContract + // .address, + // ) + // .item1 + // : + ref + .read( + priceAnd24hChangeNotifierProvider) + .getPrice(coin) + .item1; if (price > Decimal.zero) { fiatAmount = (amount.decimal * price) .toAmount(fractionDigits: 2) - .localizedStringAsFixed( + .fiatString( locale: ref .read( localeServiceChangeNotifierProvider) @@ -543,12 +621,12 @@ class _ConfirmTransactionViewState return Row( children: [ Text( - "${amount.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select((value) => value.locale), - ), - )} $unit", + ref.watch(pAmountFormatter(coin)).format( + amount, + // ethContract: ref + // .read(tokenServiceProvider) + // ?.tokenContract + ), style: STextStyles .desktopTextExtraExtraSmall( context) @@ -658,14 +736,9 @@ class _ConfirmTransactionViewState ); return Text( - "${fee.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select( - (value) => value.locale, - ), - ), - )} ${coin.ticker}", + ref + .watch(pAmountFormatter(coin)) + .format(fee), style: STextStyles.desktopTextExtraExtraSmall( context) @@ -838,75 +911,76 @@ class _ConfirmTransactionViewState ); return Text( - "${fee.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ), - )} ${coin.ticker}", + ref.watch(pAmountFormatter(coin)).format(fee), style: STextStyles.itemSubtitle(context), ); }, ), ), ), + if (isDesktop && + !widget.isPaynymTransaction && + transactionInfo["fee"] is int && + transactionInfo["vSize"] is int) + Padding( + padding: const EdgeInsets.only( + left: 32, + ), + child: Text( + "sats/vByte", + style: STextStyles.desktopTextExtraExtraSmall(context), + ), + ), + if (isDesktop && + !widget.isPaynymTransaction && + transactionInfo["fee"] is int && + transactionInfo["vSize"] is int) + Padding( + padding: const EdgeInsets.only( + top: 10, + left: 32, + right: 32, + ), + child: RoundedContainer( + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 18, + ), + color: Theme.of(context) + .extension()! + .textFieldDefaultBG, + child: Text( + "~${(transactionInfo["fee"] / transactionInfo["vSize"]).toInt()}", + style: STextStyles.itemSubtitle(context), + ), + ), + ), if (!isDesktop) const Spacer(), SizedBox( height: isDesktop ? 23 : 12, ), - Padding( - padding: isDesktop - ? const EdgeInsets.symmetric( - horizontal: 32, - ) - : const EdgeInsets.all(0), - child: RoundedContainer( + if (!widget.isTokenTx) + Padding( padding: isDesktop ? const EdgeInsets.symmetric( - horizontal: 16, - vertical: 18, + horizontal: 32, ) - : const EdgeInsets.all(12), - color: Theme.of(context) - .extension()! - .snackBarBackSuccess, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - isDesktop ? "Total amount to send" : "Total amount", - style: isDesktop - ? STextStyles.desktopTextExtraExtraSmall(context) - .copyWith( - color: Theme.of(context) - .extension()! - .textConfirmTotalAmount, - ) - : STextStyles.titleBold12(context).copyWith( - color: Theme.of(context) - .extension()! - .textConfirmTotalAmount, - ), - ), - Builder(builder: (context) { - final coin = ref.watch(walletsChangeNotifierProvider - .select((value) => value.getManager(walletId).coin)); - final fee = transactionInfo["fee"] is Amount - ? transactionInfo["fee"] as Amount - : (transactionInfo["fee"] as int) - .toAmountAsRaw(fractionDigits: coin.decimals); - final locale = ref.watch( - localeServiceChangeNotifierProvider - .select((value) => value.locale), - ); - final amount = transactionInfo["recipientAmt"] as Amount; - return Text( - "${(amount + fee).localizedStringAsFixed( - locale: locale, - )} ${ref.watch( - managerProvider.select((value) => value.coin), - ).ticker}", + : const EdgeInsets.all(0), + child: RoundedContainer( + padding: isDesktop + ? const EdgeInsets.symmetric( + horizontal: 16, + vertical: 18, + ) + : const EdgeInsets.all(12), + color: Theme.of(context) + .extension()! + .snackBarBackSuccess, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + isDesktop ? "Total amount to send" : "Total amount", style: isDesktop ? STextStyles.desktopTextExtraExtraSmall(context) .copyWith( @@ -914,18 +988,46 @@ class _ConfirmTransactionViewState .extension()! .textConfirmTotalAmount, ) - : STextStyles.itemSubtitle12(context).copyWith( + : STextStyles.titleBold12(context).copyWith( color: Theme.of(context) .extension()! .textConfirmTotalAmount, ), - textAlign: TextAlign.right, - ); - }), - ], + ), + Builder(builder: (context) { + final coin = ref.watch( + walletsChangeNotifierProvider.select( + (value) => value.getManager(walletId).coin)); + final fee = transactionInfo["fee"] is Amount + ? transactionInfo["fee"] as Amount + : (transactionInfo["fee"] as int) + .toAmountAsRaw(fractionDigits: coin.decimals); + + final amount = + transactionInfo["recipientAmt"] as Amount; + return Text( + ref + .watch(pAmountFormatter(coin)) + .format(amount + fee), + style: isDesktop + ? STextStyles.desktopTextExtraExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textConfirmTotalAmount, + ) + : STextStyles.itemSubtitle12(context).copyWith( + color: Theme.of(context) + .extension()! + .textConfirmTotalAmount, + ), + textAlign: TextAlign.right, + ); + }), + ], + ), ), ), - ), SizedBox( height: isDesktop ? 28 : 16, ), diff --git a/lib/pages/send_view/send_view.dart b/lib/pages/send_view/send_view.dart index 97cf1f8399..2778503481 100644 --- a/lib/pages/send_view/send_view.dart +++ b/lib/pages/send_view/send_view.dart @@ -26,6 +26,9 @@ import 'package:stackduo/themes/coin_icon_provider.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/address_utils.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; +import 'package:stackduo/utilities/amount/amount_input_formatter.dart'; +import 'package:stackduo/utilities/amount/amount_unit.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/barcode_scanner_interface.dart'; import 'package:stackduo/utilities/clipboard_interface.dart'; @@ -40,6 +43,7 @@ import 'package:stackduo/widgets/animated_text.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/custom_buttons/app_bar_icon_button.dart'; import 'package:stackduo/widgets/custom_buttons/blue_text_button.dart'; +import 'package:stackduo/widgets/fee_slider.dart'; import 'package:stackduo/widgets/icon_widgets/addressbook_icon.dart'; import 'package:stackduo/widgets/icon_widgets/clipboard_icon.dart'; import 'package:stackduo/widgets/icon_widgets/qrcode_icon.dart'; @@ -108,15 +112,11 @@ class _SendViewState extends ConsumerState { void _cryptoAmountChanged() async { if (!_cryptoAmountChangeLock) { - final String cryptoAmount = cryptoAmountController.text; - if (cryptoAmount.isNotEmpty && - cryptoAmount != "." && - cryptoAmount != ",") { - _amountToSend = cryptoAmount.contains(",") - ? Decimal.parse(cryptoAmount.replaceFirst(",", ".")) - .toAmount(fractionDigits: coin.decimals) - : Decimal.parse(cryptoAmount) - .toAmount(fractionDigits: coin.decimals); + final cryptoAmount = ref.read(pAmountFormatter(coin)).tryParse( + cryptoAmountController.text, + ); + if (cryptoAmount != null) { + _amountToSend = cryptoAmount; if (_cachedAmountToSend != null && _cachedAmountToSend == _amountToSend) { return; @@ -133,7 +133,7 @@ class _SendViewState extends ConsumerState { .toAmount( fractionDigits: 2, ) - .localizedStringAsFixed( + .fiatString( locale: ref.read(localeServiceChangeNotifierProvider).locale, ); } @@ -182,6 +182,15 @@ class _SendViewState extends ConsumerState { late Amount _currentFee; void _setCurrentFee(String fee, bool shouldSetState) { + fee = fee.trim(); + + if (fee.startsWith("~")) { + fee = fee.substring(1); + } + if (fee.contains(" ")) { + fee = fee.split(" ").first; + } + final value = fee.contains(",") ? Decimal.parse(fee.replaceFirst(",", ".")) .toAmount(fractionDigits: coin.decimals) @@ -249,9 +258,10 @@ class _SendViewState extends ConsumerState { case FeeRateType.slow: feeRate = feeObject.slow; break; + default: + feeRate = -1; } - final String locale = ref.read(localeServiceChangeNotifierProvider).locale; Amount fee; if (coin == Coin.monero) { MoneroTransactionPriority specialMoneroId; @@ -265,15 +275,25 @@ class _SendViewState extends ConsumerState { case FeeRateType.slow: specialMoneroId = MoneroTransactionPriority.slow; break; + default: + throw ArgumentError("custom fee not available for monero"); } fee = await manager.estimateFeeFor(amount, specialMoneroId.raw!); - cachedFees[amount] = fee.localizedStringAsFixed(locale: locale); + cachedFees[amount] = ref.read(pAmountFormatter(coin)).format( + fee, + withUnitName: true, + indicatePrecisionLoss: false, + ); return cachedFees[amount]!; } else { fee = await manager.estimateFeeFor(amount, feeRate); - cachedFees[amount] = fee.localizedStringAsFixed(locale: locale); + cachedFees[amount] = ref.read(pAmountFormatter(coin)).format( + fee, + withUnitName: true, + indicatePrecisionLoss: false, + ); return cachedFees[amount]!; } @@ -394,6 +414,7 @@ class _SendViewState extends ConsumerState { isSegwit: widget.accountLite!.segwit, amount: amount, args: { + "satsPerVByte": isCustomFee ? customFeeRate : null, "feeRate": feeRate, "UTXOs": (manager.hasCoinControlSupport && coinControlEnabled && @@ -408,6 +429,7 @@ class _SendViewState extends ConsumerState { amount: amount, args: { "feeRate": ref.read(feeRateTypeStateProvider), + "satsPerVByte": isCustomFee ? customFeeRate : null, "UTXOs": (manager.hasCoinControlSupport && coinControlEnabled && selectedUTXOs.isNotEmpty) @@ -485,6 +507,10 @@ class _SendViewState extends ConsumerState { bool get isPaynymSend => widget.accountLite != null; + bool isCustomFee = false; + + int customFeeRate = 1; + @override void initState() { coin = widget.coin; @@ -510,7 +536,15 @@ class _SendViewState extends ConsumerState { if (_data != null) { if (_data!.amount != null) { - cryptoAmountController.text = _data!.amount!.toString(); + final amount = Amount.fromDecimal( + _data!.amount!, + fractionDigits: coin.decimals, + ); + + cryptoAmountController.text = ref.read(pAmountFormatter(coin)).format( + amount, + withUnitName: false, + ); } sendToController.text = _data!.contactLabel; _address = _data!.address.trim(); @@ -700,10 +734,12 @@ class _SendViewState extends ConsumerState { if (_cachedBalance != null) { return GestureDetector( onTap: () { - cryptoAmountController.text = - _cachedBalance! - .localizedStringAsFixed( - locale: locale); + cryptoAmountController.text = ref + .read(pAmountFormatter(coin)) + .format( + _cachedBalance!, + withUnitName: false, + ); }, child: Container( color: Colors.transparent, @@ -712,9 +748,10 @@ class _SendViewState extends ConsumerState { CrossAxisAlignment.end, children: [ Text( - "${_cachedBalance!.localizedStringAsFixed( - locale: locale, - )} ${coin.ticker}", + ref + .watch(pAmountFormatter( + coin)) + .format(_cachedBalance!), style: STextStyles.titleBold12( context) @@ -726,7 +763,7 @@ class _SendViewState extends ConsumerState { Text( "${(_cachedBalance!.decimal * ref.watch(priceAnd24hChangeNotifierProvider.select((value) => value.getPrice(coin).item1))).toAmount( fractionDigits: 2, - ).localizedStringAsFixed( + ).fiatString( locale: locale, )} ${ref.watch(prefsChangeNotifierProvider.select((value) => value.currency))}", style: STextStyles.subtitle( @@ -786,10 +823,32 @@ class _SendViewState extends ConsumerState { const SizedBox( height: 16, ), - Text( - isPaynymSend ? "Send to PayNym address" : "Send to", - style: STextStyles.smallMed12(context), - textAlign: TextAlign.left, + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + isPaynymSend + ? "Send to PayNym address" + : "Send to", + style: STextStyles.smallMed12(context), + textAlign: TextAlign.left, + ), + // if (coin == Coin.monero) + // CustomTextButton( + // text: "Use OpenAlias", + // onTap: () async { + // await showModalBottomSheet( + // context: context, + // builder: (context) => + // OpenAliasBottomSheet( + // onSelected: (address) { + // sendToController.text = address; + // }, + // ), + // ); + // }, + // ), + ], ), const SizedBox( height: 8, @@ -1011,10 +1070,15 @@ class _SendViewState extends ConsumerState { ); cryptoAmountController .text = - amount - .localizedStringAsFixed( - locale: locale, - ); + ref + .read( + pAmountFormatter( + coin)) + .format( + amount, + withUnitName: + false, + ); _amountToSend = amount; } @@ -1120,11 +1184,11 @@ class _SendViewState extends ConsumerState { text: "Send all ${coin.ticker}", onTap: () async { cryptoAmountController.text = ref - .read(provider) - .balance - .spendable - .localizedStringAsFixed(locale: locale); - + .read(pAmountFormatter(coin)) + .format( + ref.read(provider).balance.spendable, + withUnitName: false, + ); _cryptoAmountChanged(); }, ), @@ -1153,13 +1217,21 @@ class _SendViewState extends ConsumerState { ), textAlign: TextAlign.right, inputFormatters: [ + AmountInputFormatter( + decimals: coin.decimals, + unit: ref.watch(pAmountUnit(coin)), + locale: locale, + ), + // regex to validate a crypto amount with 8 decimal places - TextInputFormatter.withFunction((oldValue, - newValue) => - RegExp(r'^([0-9]*[,.]?[0-9]{0,8}|[,.][0-9]{0,8})$') - .hasMatch(newValue.text) - ? newValue - : oldValue), + // TextInputFormatter.withFunction((oldValue, + // newValue) => + // // RegExp(r'^([0-9]*[,.]?[0-9]{0,8}|[,.][0-9]{0,8})$') + // // RegExp(r'^\d{1,3}([,\.]\d+)?|[,\.\d]+$') + // getAmountRegex(locale, coin.decimals) + // .hasMatch(newValue.text) + // ? newValue + // : oldValue), ], decoration: InputDecoration( contentPadding: const EdgeInsets.only( @@ -1176,7 +1248,9 @@ class _SendViewState extends ConsumerState { child: Padding( padding: const EdgeInsets.all(12), child: Text( - coin.ticker, + ref + .watch(pAmountUnit(coin)) + .unitForCoin(coin), style: STextStyles.smallMed14(context) .copyWith( color: Theme.of(context) @@ -1212,26 +1286,25 @@ class _SendViewState extends ConsumerState { ), textAlign: TextAlign.right, inputFormatters: [ + AmountInputFormatter( + decimals: 2, + locale: locale, + ), // regex to validate a fiat amount with 2 decimal places - TextInputFormatter.withFunction((oldValue, - newValue) => - RegExp(r'^([0-9]*[,.]?[0-9]{0,2}|[,.][0-9]{0,2})$') - .hasMatch(newValue.text) - ? newValue - : oldValue), + // TextInputFormatter.withFunction((oldValue, + // newValue) => + // // RegExp(r'^([0-9]*[,.]?[0-9]{0,2}|[,.][0-9]{0,2})$') + // getAmountRegex(locale, 2) + // .hasMatch(newValue.text) + // ? newValue + // : oldValue), ], onChanged: (baseAmountString) { - if (baseAmountString.isNotEmpty && - baseAmountString != "." && - baseAmountString != ",") { - final Amount baseAmount = - baseAmountString.contains(",") - ? Decimal.parse(baseAmountString - .replaceFirst(",", ".")) - .toAmount(fractionDigits: 2) - : Decimal.parse(baseAmountString) - .toAmount(fractionDigits: 2); - + final baseAmount = Amount.tryParseFiatString( + baseAmountString, + locale: locale, + ); + if (baseAmount != null) { final Decimal _price = ref .read(priceAnd24hChangeNotifierProvider) .getPrice(coin) @@ -1262,12 +1335,10 @@ class _SendViewState extends ConsumerState { level: LogLevel.Info); final amountString = - _amountToSend!.localizedStringAsFixed( - locale: ref - .read( - localeServiceChangeNotifierProvider) - .locale, - ); + ref.read(pAmountFormatter(coin)).format( + _amountToSend!, + withUnitName: false, + ); _cryptoAmountChangeLock = true; cryptoAmountController.text = amountString; @@ -1439,14 +1510,23 @@ class _SendViewState extends ConsumerState { const SizedBox( height: 12, ), + // if (coin != Coin.epicCash && + // coin != Coin.nano && + // coin != Coin.banano) Text( "Transaction fee (estimated)", style: STextStyles.smallMed12(context), textAlign: TextAlign.left, ), + // if (coin != Coin.epicCash && + // coin != Coin.nano && + // coin != Coin.banano) const SizedBox( height: 8, ), + // if (coin != Coin.epicCash && + // coin != Coin.nano && + // coin != Coin.banano) Stack( children: [ TextField( @@ -1470,7 +1550,18 @@ class _SendViewState extends ConsumerState { Constants.size.circularBorderRadius, ), ), - onPressed: () { + onPressed: + // (coin == Coin.firo || + // coin == Coin.firoTestNet) && + // ref + // .watch( + // publicPrivateBalanceStateProvider + // .state) + // .state == + // "Private" + // ? null + // : + () { showModalBottomSheet( backgroundColor: Colors.transparent, context: context, @@ -1485,11 +1576,21 @@ class _SendViewState extends ConsumerState { amount: (Decimal.tryParse( cryptoAmountController .text) ?? + _amountToSend?.decimal ?? Decimal.zero) .toAmount( fractionDigits: coin.decimals, ), updateChosen: (String fee) { + if (fee == "custom") { + if (!isCustomFee) { + setState(() { + isCustomFee = true; + }); + } + return; + } + _setCurrentFee( fee, true, @@ -1497,12 +1598,61 @@ class _SendViewState extends ConsumerState { setState(() { _calculateFeesFuture = Future(() => fee); + if (isCustomFee) { + isCustomFee = false; + } }); }, ), ); }, - child: Row( + child: + // ((coin == Coin.firo || + // coin == Coin.firoTestNet) && + // ref + // .watch( + // publicPrivateBalanceStateProvider + // .state) + // .state == + // "Private") + // ? Row( + // children: [ + // FutureBuilder( + // future: _calculateFeesFuture, + // builder: (context, snapshot) { + // if (snapshot.connectionState == + // ConnectionState + // .done && + // snapshot.hasData) { + // _setCurrentFee( + // snapshot.data!, + // false, + // ); + // return Text( + // "~${snapshot.data!}", + // style: STextStyles + // .itemSubtitle( + // context), + // ); + // } else { + // return AnimatedText( + // stringsToLoopThrough: const [ + // "Calculating", + // "Calculating.", + // "Calculating..", + // "Calculating...", + // ], + // style: STextStyles + // .itemSubtitle( + // context), + // ); + // } + // }, + // ), + // ], + // ) + // : + Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -1527,11 +1677,13 @@ class _SendViewState extends ConsumerState { ConnectionState.done && snapshot.hasData) { _setCurrentFee( - snapshot.data! as String, + snapshot.data!, false, ); return Text( - "~${snapshot.data! as String} ${coin.ticker}", + isCustomFee + ? "" + : "~${snapshot.data!}", style: STextStyles.itemSubtitle( context), @@ -1567,6 +1719,18 @@ class _SendViewState extends ConsumerState { ) ], ), + if (isCustomFee) + Padding( + padding: const EdgeInsets.only( + bottom: 12, + top: 16, + ), + child: FeeSlider( + onSatVByteChanged: (rate) { + customFeeRate = rate; + }, + ), + ), const Spacer(), const SizedBox( height: 12, diff --git a/lib/pages/send_view/sub_widgets/openalias_sheet.dart b/lib/pages/send_view/sub_widgets/openalias_sheet.dart new file mode 100644 index 0000000000..9c9d9a0f81 --- /dev/null +++ b/lib/pages/send_view/sub_widgets/openalias_sheet.dart @@ -0,0 +1,151 @@ +// /* +// * This file is part of Stack Wallet. +// * +// * Copyright (c) 2023 Cypher Stack +// * All Rights Reserved. +// * The code is distributed under GPLv3 license, see LICENSE file for details. +// * Generated by Cypher Stack on 2023-05-26 +// * +// */ +// +// import 'package:basic_utils/basic_utils.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter_riverpod/flutter_riverpod.dart'; +// import 'package:stackduo/themes/stack_colors.dart'; +// import 'package:stackduo/utilities/constants.dart'; +// import 'package:stackduo/utilities/text_styles.dart'; +// +// class OpenAliasBottomSheet extends ConsumerStatefulWidget { +// const OpenAliasBottomSheet({ +// Key? key, +// required this.onSelected, +// }) : super(key: key); +// +// final Null Function(String) onSelected; +// +// @override +// ConsumerState createState() => +// _OpenAliasBottomSheetState(); +// } +// +// class _OpenAliasBottomSheetState extends ConsumerState { +// late TextEditingController textEditingController; +// +// @override +// void initState() { +// super.initState(); +// textEditingController = TextEditingController(); +// } +// +// @override +// Widget build(BuildContext context) { +// return SingleChildScrollView( +// child: Padding( +// padding: +// EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), +// child: Container( +// decoration: BoxDecoration( +// color: Theme.of(context).extension()!.popupBG, +// borderRadius: const BorderRadius.vertical( +// top: Radius.circular(20), +// ), +// ), +// child: Padding( +// padding: const EdgeInsets.only( +// top: 20, +// left: 20, +// right: 20, +// bottom: 20, +// ), +// child: Column( +// mainAxisSize: MainAxisSize.min, +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Center( +// child: Container( +// decoration: BoxDecoration( +// color: Theme.of(context) +// .extension()! +// .textFieldDefaultBG, +// borderRadius: BorderRadius.circular( +// Constants.size.circularBorderRadius, +// ), +// ), +// width: 60, +// height: 4, +// ), +// ), +// const SizedBox( +// height: 36, +// ), +// Text( +// 'OpenAlias Address', +// style: STextStyles.smallMed12(context), +// textAlign: TextAlign.left, +// ), +// const SizedBox( +// height: 8, +// ), +// TextField( +// controller: textEditingController, +// decoration: const InputDecoration( +// border: OutlineInputBorder(), +// ), +// ), +// const SizedBox( +// height: 16, +// ), +// Align( +// alignment: Alignment.bottomCenter, +// child: ConstrainedBox( +// constraints: const BoxConstraints( +// minWidth: 480, +// minHeight: 70, +// ), +// child: TextButton( +// style: Theme.of(context) +// .extension()! +// .getPrimaryEnabledButtonStyle(context), +// onPressed: () async { +// String text = textEditingController.text +// .trim() +// .replaceAll("@", "."); +// List? result = +// await DnsUtils.lookupRecord(text, RRecordType.TXT); +// String address = ""; +// if (result != null && result.isNotEmpty) { +// for (RRecord record in result) { +// if (record.data.startsWith("oa1:xmr")) { +// List datas = record.data.split(" "); +// for (String data in datas) { +// if (data.startsWith("recipient_address=")) { +// address = data +// .substring("recipient_address=".length) +// .replaceAll(";", ""); +// break; +// } +// } +// break; +// } +// } +// } +// widget.onSelected(address); +// if (mounted) { +// Navigator.of(context).pop(); +// } +// }, +// child: Text( +// "Enter", +// style: STextStyles.button(context), +// ), +// ), +// ), +// ) +// ], +// ), +// ), +// ), +// ), +// ); +// } +// } diff --git a/lib/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart b/lib/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart index f844f0e41a..a0f59a3156 100644 --- a/lib/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart +++ b/lib/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart @@ -1,17 +1,17 @@ import 'package:cw_core/monero_transaction_priority.dart'; -import 'package:decimal/decimal.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:stackduo/models/paymint/fee_object_model.dart'; import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/providers/ui/fee_rate_type_state_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/enums/fee_rate_type_enum.dart'; import 'package:stackduo/utilities/logger.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/widgets/animated_text.dart'; final feeSheetSessionCacheProvider = @@ -33,11 +33,13 @@ class TransactionFeeSelectionSheet extends ConsumerStatefulWidget { required this.walletId, required this.amount, required this.updateChosen, + this.isToken = false, }) : super(key: key); final String walletId; final Amount amount; final Function updateChosen; + final bool isToken; @override ConsumerState createState() => @@ -67,49 +69,88 @@ class _TransactionFeeSelectionSheetState switch (feeRateType) { case FeeRateType.fast: if (ref.read(feeSheetSessionCacheProvider).fast[amount] == null) { + // if (widget.isToken == false) { final manager = ref.read(walletsChangeNotifierProvider).getManager(walletId); - if (coin == Coin.monero) { + if (coin == Coin.monero /*|| coin == Coin.wownero*/) { final fee = await manager.estimateFeeFor( amount, MoneroTransactionPriority.fast.raw!); ref.read(feeSheetSessionCacheProvider).fast[amount] = fee; + // } else if ((coin == Coin.firo || coin == Coin.firoTestNet) && + // ref.read(publicPrivateBalanceStateProvider.state).state != + // "Private") { + // ref.read(feeSheetSessionCacheProvider).fast[amount] = + // await (manager.wallet as FiroWallet) + // .estimateFeeForPublic(amount, feeRate); } else { ref.read(feeSheetSessionCacheProvider).fast[amount] = await manager.estimateFeeFor(amount, feeRate); } + // } else { + // final tokenWallet = ref.read(tokenServiceProvider)!; + // final fee = tokenWallet.estimateFeeFor(feeRate); + // ref.read(feeSheetSessionCacheProvider).fast[amount] = fee; + // } } return ref.read(feeSheetSessionCacheProvider).fast[amount]!; case FeeRateType.average: if (ref.read(feeSheetSessionCacheProvider).average[amount] == null) { + // if (widget.isToken == false) { final manager = ref.read(walletsChangeNotifierProvider).getManager(walletId); - if (coin == Coin.monero) { + if (coin == Coin.monero /* || coin == Coin.wownero*/) { final fee = await manager.estimateFeeFor( amount, MoneroTransactionPriority.regular.raw!); ref.read(feeSheetSessionCacheProvider).average[amount] = fee; + // } else if ((coin == Coin.firo || coin == Coin.firoTestNet) && + // ref.read(publicPrivateBalanceStateProvider.state).state != + // "Private") { + // ref.read(feeSheetSessionCacheProvider).average[amount] = + // await (manager.wallet as FiroWallet) + // .estimateFeeForPublic(amount, feeRate); } else { ref.read(feeSheetSessionCacheProvider).average[amount] = await manager.estimateFeeFor(amount, feeRate); } + // } else { + // final tokenWallet = ref.read(tokenServiceProvider)!; + // final fee = tokenWallet.estimateFeeFor(feeRate); + // ref.read(feeSheetSessionCacheProvider).average[amount] = fee; + // } } return ref.read(feeSheetSessionCacheProvider).average[amount]!; case FeeRateType.slow: if (ref.read(feeSheetSessionCacheProvider).slow[amount] == null) { + // if (widget.isToken == false) { final manager = ref.read(walletsChangeNotifierProvider).getManager(walletId); - if (coin == Coin.monero) { + if (coin == Coin.monero /*|| coin == Coin.wownero*/) { final fee = await manager.estimateFeeFor( amount, MoneroTransactionPriority.slow.raw!); ref.read(feeSheetSessionCacheProvider).slow[amount] = fee; + // } else if ((coin == Coin.firo || coin == Coin.firoTestNet) && + // ref.read(publicPrivateBalanceStateProvider.state).state != + // "Private") { + // ref.read(feeSheetSessionCacheProvider).slow[amount] = + // await (manager.wallet as FiroWallet) + // .estimateFeeForPublic(amount, feeRate); } else { ref.read(feeSheetSessionCacheProvider).slow[amount] = await manager.estimateFeeFor(amount, feeRate); } + // } else { + // final tokenWallet = ref.read(tokenServiceProvider)!; + // final fee = tokenWallet.estimateFeeFor(feeRate); + // ref.read(feeSheetSessionCacheProvider).slow[amount] = fee; + // } } return ref.read(feeSheetSessionCacheProvider).slow[amount]!; + + default: + return Amount.zero; } } @@ -188,7 +229,11 @@ class _TransactionFeeSelectionSheetState height: 36, ), FutureBuilder( - future: manager.fees, + future: + // widget.isToken + // ? ref.read(tokenServiceProvider)!.fees + // : + manager.fees, builder: (context, AsyncSnapshot snapshot) { if (snapshot.connectionState == ConnectionState.done && snapshot.hasData) { @@ -282,20 +327,21 @@ class _TransactionFeeSelectionSheetState feeRate: feeObject!.fast, amount: amount, ), - // future: manager.estimateFeeFor( - // Format.decimalAmountToSatoshis( - // amount), - // feeObject!.fast), builder: (_, AsyncSnapshot snapshot) { if (snapshot.connectionState == ConnectionState.done && snapshot.hasData) { return Text( - "(~${snapshot.data!.decimal.toStringAsFixed( - manager.coin.decimals, - )}" - " ${manager.coin.ticker})", + "(~${ref.watch( + pAmountFormatter( + manager.coin, + ), + ).format( + snapshot.data!, + indicatePrecisionLoss: + false, + )})", style: STextStyles.itemSubtitle( context), textAlign: TextAlign.left, @@ -315,13 +361,19 @@ class _TransactionFeeSelectionSheetState const SizedBox( height: 2, ), - if (feeObject == null) + if (feeObject == + null /* && + manager.coin != Coin.ethereum*/ + ) AnimatedText( stringsToLoopThrough: stringsToLoopThrough, style: STextStyles.itemSubtitle(context), ), - if (feeObject != null) + if (feeObject != + null /* && + manager.coin != Coin.ethereum*/ + ) Text( estimatedTimeToBeIncludedInNextBlock( Constants.targetBlockTimeInSeconds( @@ -416,18 +468,21 @@ class _TransactionFeeSelectionSheetState feeRate: feeObject!.medium, amount: amount, ), - // future: manager.estimateFeeFor( - // Format.decimalAmountToSatoshis( - // amount), - // feeObject!.fast), builder: (_, AsyncSnapshot snapshot) { if (snapshot.connectionState == ConnectionState.done && snapshot.hasData) { return Text( - "(~${snapshot.data!.decimal.toStringAsFixed(manager.coin.decimals)}" - " ${manager.coin.ticker})", + "(~${ref.watch( + pAmountFormatter( + manager.coin, + ), + ).format( + snapshot.data!, + indicatePrecisionLoss: + false, + )})", style: STextStyles.itemSubtitle( context), textAlign: TextAlign.left, @@ -506,8 +561,6 @@ class _TransactionFeeSelectionSheetState .watch(feeRateTypeStateProvider.state) .state, onChanged: (x) { - //todo: check if print needed - // debugPrint(x.toString()); ref .read(feeRateTypeStateProvider.state) .state = FeeRateType.slow; @@ -549,17 +602,21 @@ class _TransactionFeeSelectionSheetState feeRate: feeObject!.slow, amount: amount, ), - // future: manager.estimateFeeFor( - // Format.decimalAmountToSatoshis( - // amount), - // feeObject!.fast), builder: (_, AsyncSnapshot snapshot) { if (snapshot.connectionState == ConnectionState.done && snapshot.hasData) { return Text( - "(~${snapshot.data!.decimal.toStringAsFixed(manager.coin.decimals)} ${manager.coin.ticker})", + "(~${ref.watch( + pAmountFormatter( + manager.coin, + ), + ).format( + snapshot.data!, + indicatePrecisionLoss: + false, + )})", style: STextStyles.itemSubtitle( context), textAlign: TextAlign.left, @@ -605,6 +662,79 @@ class _TransactionFeeSelectionSheetState const SizedBox( height: 24, ), + if (manager.coin.isElectrumXCoin) + GestureDetector( + onTap: () { + final state = + ref.read(feeRateTypeStateProvider.state).state; + if (state != FeeRateType.custom) { + ref.read(feeRateTypeStateProvider.state).state = + FeeRateType.custom; + } + widget.updateChosen("custom"); + + Navigator.of(context).pop(); + }, + child: Container( + color: Colors.transparent, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + children: [ + SizedBox( + width: 20, + height: 20, + child: Radio( + activeColor: Theme.of(context) + .extension()! + .radioButtonIconEnabled, + value: FeeRateType.custom, + groupValue: ref + .watch(feeRateTypeStateProvider.state) + .state, + onChanged: (x) { + ref + .read( + feeRateTypeStateProvider.state) + .state = FeeRateType.custom; + Navigator.of(context).pop(); + }, + ), + ), + ], + ), + const SizedBox( + width: 12, + ), + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + FeeRateType.custom.prettyName, + style: + STextStyles.titleBold12(context), + textAlign: TextAlign.left, + ), + ], + ), + const SizedBox( + height: 2, + ), + ], + ), + ), + ], + ), + ), + ), + if (manager.coin.isElectrumXCoin) + const SizedBox( + height: 24, + ), ], ); }, @@ -620,27 +750,35 @@ class _TransactionFeeSelectionSheetState switch (feeRateType) { case FeeRateType.fast: if (ref.read(feeSheetSessionCacheProvider).fast[amount] != null) { - return (ref.read(feeSheetSessionCacheProvider).fast[amount] - as Decimal) - .toStringAsFixed(coin.decimals); + return ref.read(pAmountFormatter(coin)).format( + ref.read(feeSheetSessionCacheProvider).fast[amount]!, + indicatePrecisionLoss: false, + withUnitName: false, + ); } return null; case FeeRateType.average: if (ref.read(feeSheetSessionCacheProvider).average[amount] != null) { - return (ref.read(feeSheetSessionCacheProvider).average[amount] - as Decimal) - .toStringAsFixed(coin.decimals); + return ref.read(pAmountFormatter(coin)).format( + ref.read(feeSheetSessionCacheProvider).average[amount]!, + indicatePrecisionLoss: false, + withUnitName: false, + ); } return null; case FeeRateType.slow: if (ref.read(feeSheetSessionCacheProvider).slow[amount] != null) { - return (ref.read(feeSheetSessionCacheProvider).slow[amount] - as Decimal) - .toStringAsFixed(coin.decimals); + return ref.read(pAmountFormatter(coin)).format( + ref.read(feeSheetSessionCacheProvider).slow[amount]!, + indicatePrecisionLoss: false, + withUnitName: false, + ); } return null; + case FeeRateType.custom: + return null; } } catch (e, s) { Logging.instance.log("$e $s", level: LogLevel.Warning); diff --git a/lib/pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart b/lib/pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart index 9c3284ae37..7bbc9f4e76 100644 --- a/lib/pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart +++ b/lib/pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:stackduo/pages/settings_views/global_settings_view/advanced_views/debug_view.dart'; +import 'package:stackduo/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/manage_coin_units_view.dart'; import 'package:stackduo/pages/settings_views/global_settings_view/advanced_views/manage_explorer_view.dart'; import 'package:stackduo/pages/stack_privacy_calls.dart'; import 'package:stackduo/providers/global/prefs_provider.dart'; @@ -227,6 +228,43 @@ class AdvancedSettingsView extends StatelessWidget { const SizedBox( height: 8, ), + RoundedWhiteContainer( + padding: const EdgeInsets.all(0), + child: RawMaterialButton( + // splashColor: Theme.of(context).extension()!.highlight, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + ), + onPressed: () { + Navigator.of(context).pushNamed(ChooseCoinView.routeName, + arguments: const Tuple3( + "Manage block explorers", + "block explorer", + ManageExplorerView.routeName)); + }, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 20, + ), + child: Row( + children: [ + Text( + "Change block explorer", + style: STextStyles.titleBold12(context), + textAlign: TextAlign.left, + ), + ], + ), + ), + ), + ), + const SizedBox( + height: 8, + ), RoundedWhiteContainer( padding: const EdgeInsets.all(0), child: RawMaterialButton( @@ -239,12 +277,7 @@ class AdvancedSettingsView extends StatelessWidget { ), onPressed: () { Navigator.of(context).pushNamed( - ChooseCoinView.routeName, - arguments: const Tuple3( - "Manage block explorers", - "block explorer", - ManageExplorerView.routeName, - ), + ManageCoinUnitsView.routeName, ); }, child: Padding( @@ -255,7 +288,7 @@ class AdvancedSettingsView extends StatelessWidget { child: Row( children: [ Text( - "Change block explorer", + "Units", style: STextStyles.titleBold12(context), textAlign: TextAlign.left, ), diff --git a/lib/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/choose_unit_sheet.dart b/lib/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/choose_unit_sheet.dart new file mode 100644 index 0000000000..4aecfc4b80 --- /dev/null +++ b/lib/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/choose_unit_sheet.dart @@ -0,0 +1,144 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; +import 'package:stackduo/utilities/amount/amount_unit.dart'; +import 'package:stackduo/utilities/constants.dart'; +import 'package:stackduo/utilities/enums/coin_enum.dart'; +import 'package:stackduo/utilities/text_styles.dart'; + +class ChooseUnitSheet extends ConsumerStatefulWidget { + const ChooseUnitSheet({ + Key? key, + required this.coin, + }) : super(key: key); + + final Coin coin; + + @override + ConsumerState createState() => _ChooseUnitSheetState(); +} + +class _ChooseUnitSheetState extends ConsumerState { + late AmountUnit _current; + late final List values; + + @override + void initState() { + values = AmountUnit.valuesForCoin(widget.coin); + _current = ref.read(pAmountUnit(widget.coin)); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Container( + decoration: BoxDecoration( + color: Theme.of(context).extension()!.popupBG, + borderRadius: const BorderRadius.vertical( + top: Radius.circular(20), + ), + ), + child: Padding( + padding: const EdgeInsets.only( + left: 24, + right: 24, + top: 10, + bottom: 0, + ), + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Center( + child: Container( + decoration: BoxDecoration( + color: Theme.of(context) + .extension()! + .textFieldDefaultBG, + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + ), + width: 60, + height: 4, + ), + ), + const SizedBox( + height: 36, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Coin units", + style: STextStyles.pageTitleH2(context), + textAlign: TextAlign.left, + ), + const SizedBox( + height: 16, + ), + for (int i = 0; i < values.length; i++) + Column( + children: [ + GestureDetector( + onTap: () { + setState(() { + _current = values[i]; + }); + + Navigator.of(context).pop(_current); + }, + child: Container( + color: Colors.transparent, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + width: 20, + height: 20, + child: Radio( + activeColor: Theme.of(context) + .extension()! + .radioButtonIconEnabled, + value: values[i], + groupValue: _current, + onChanged: (x) { + setState(() { + _current = values[i]; + }); + + Navigator.of(context).pop(_current); + }, + ), + ), + const SizedBox( + width: 12, + ), + Text( + values[i].unitForCoin(widget.coin), + style: STextStyles.titleBold12(context), + textAlign: TextAlign.left, + ), + ], + ), + ), + ), + const SizedBox( + height: 16, + ), + ], + ), + const SizedBox( + height: 8, + ), + ], + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/edit_coin_units_view.dart b/lib/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/edit_coin_units_view.dart new file mode 100644 index 0000000000..e83e5aa4d7 --- /dev/null +++ b/lib/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/edit_coin_units_view.dart @@ -0,0 +1,343 @@ +import 'package:dropdown_button2/dropdown_button2.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:stackduo/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/choose_unit_sheet.dart'; +import 'package:stackduo/providers/global/prefs_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; +import 'package:stackduo/utilities/amount/amount_unit.dart'; +import 'package:stackduo/utilities/assets.dart'; +import 'package:stackduo/utilities/constants.dart'; +import 'package:stackduo/utilities/enums/coin_enum.dart'; +import 'package:stackduo/utilities/text_styles.dart'; +import 'package:stackduo/utilities/util.dart'; +import 'package:stackduo/widgets/background.dart'; +import 'package:stackduo/widgets/conditional_parent.dart'; +import 'package:stackduo/widgets/custom_buttons/app_bar_icon_button.dart'; +import 'package:stackduo/widgets/desktop/desktop_dialog.dart'; +import 'package:stackduo/widgets/desktop/desktop_dialog_close_button.dart'; +import 'package:stackduo/widgets/desktop/primary_button.dart'; +import 'package:stackduo/widgets/desktop/secondary_button.dart'; +import 'package:stackduo/widgets/icon_widgets/x_icon.dart'; +import 'package:stackduo/widgets/stack_text_field.dart'; +import 'package:stackduo/widgets/textfield_icon_button.dart'; + +class EditCoinUnitsView extends ConsumerStatefulWidget { + const EditCoinUnitsView({ + Key? key, + required this.coin, + }) : super(key: key); + + final Coin coin; + + static const String routeName = "/editCoinUnitsView"; + + @override + ConsumerState createState() => _EditCoinUnitsViewState(); +} + +class _EditCoinUnitsViewState extends ConsumerState { + late final TextEditingController _decimalsController; + late final FocusNode _decimalsFocusNode; + + late AmountUnit _currentUnit; + + void onSave() { + final maxDecimals = int.tryParse(_decimalsController.text); + + if (maxDecimals == null) { + // TODO show dialog error thing + return; + } + + ref.read(prefsChangeNotifierProvider).updateAmountUnit( + coin: widget.coin, + amountUnit: _currentUnit, + ); + ref.read(prefsChangeNotifierProvider).updateMaxDecimals( + coin: widget.coin, + maxDecimals: maxDecimals, + ); + + Navigator.of(context).pop(); + } + + Future chooseUnit() async { + final chosenUnit = await showModalBottomSheet( + backgroundColor: Colors.transparent, + context: context, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.vertical( + top: Radius.circular(20), + ), + ), + builder: (_) { + return ChooseUnitSheet( + coin: widget.coin, + ); + }, + ); + + if (chosenUnit != null) { + setState(() { + _currentUnit = chosenUnit; + }); + } + } + + @override + void initState() { + _decimalsFocusNode = FocusNode(); + _decimalsController = TextEditingController() + ..text = ref.read(pMaxDecimals(widget.coin)).toString(); + _currentUnit = ref.read(pAmountUnit(widget.coin)); + super.initState(); + } + + @override + void dispose() { + _decimalsFocusNode.dispose(); + _decimalsController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return ConditionalParent( + condition: Util.isDesktop, + builder: (child) => DesktopDialog( + maxHeight: 350, + maxWidth: 500, + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: const EdgeInsets.only(left: 32), + child: Text( + "Edit ${widget.coin.prettyName} units", + style: STextStyles.desktopH3(context), + ), + ), + const DesktopDialogCloseButton(), + ], + ), + Expanded( + child: Padding( + padding: const EdgeInsets.only( + left: 32, + right: 32, + bottom: 32, + ), + child: child, + ), + ), + ], + ), + ), + child: ConditionalParent( + condition: !Util.isDesktop, + builder: (child) => Background( + child: Scaffold( + backgroundColor: + Theme.of(context).extension()!.background, + appBar: AppBar( + leading: AppBarBackButton( + onPressed: () { + Navigator.of(context).pop(); + }, + ), + title: Text( + "Edit ${widget.coin.prettyName} units", + style: STextStyles.navBarTitle(context), + ), + ), + body: Padding( + padding: const EdgeInsets.all(16), + child: child, + ), + ), + ), + child: Column( + children: [ + if (Util.isDesktop) + DropdownButtonHideUnderline( + child: DropdownButton2( + value: _currentUnit, + items: [ + ...AmountUnit.valuesForCoin(widget.coin).map( + (e) => DropdownMenuItem( + value: e, + child: Text( + e.unitForCoin(widget.coin), + style: STextStyles.desktopTextMedium(context), + ), + ), + ), + ], + onChanged: (value) { + if (value is AmountUnit) { + _currentUnit = value; + } + }, + isExpanded: true, + iconStyleData: IconStyleData( + icon: SvgPicture.asset( + Assets.svg.chevronDown, + width: 12, + height: 6, + color: Theme.of(context) + .extension()! + .textFieldActiveSearchIconRight, + ), + ), + dropdownStyleData: DropdownStyleData( + offset: const Offset(0, -10), + elevation: 0, + decoration: BoxDecoration( + color: Theme.of(context) + .extension()! + .textFieldDefaultBG, + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + ), + ), + menuItemStyleData: const MenuItemStyleData( + padding: EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, + ), + ), + ), + ), + if (!Util.isDesktop) + Stack( + children: [ + TextField( + autocorrect: Util.isDesktop ? false : true, + enableSuggestions: Util.isDesktop ? false : true, + // controller: _lengthController, + readOnly: true, + textInputAction: TextInputAction.none, + ), + Positioned.fill( + child: RawMaterialButton( + splashColor: + Theme.of(context).extension()!.highlight, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + ), + onPressed: chooseUnit, + child: Padding( + padding: const EdgeInsets.only( + left: 12, + right: 17, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + _currentUnit.unitForCoin(widget.coin), + style: STextStyles.itemSubtitle12(context), + ), + SvgPicture.asset( + Assets.svg.chevronDown, + width: 14, + height: 6, + color: Theme.of(context) + .extension()! + .textFieldActiveSearchIconRight, + ), + ], + ), + ), + ), + ) + ], + ), + SizedBox( + height: Util.isDesktop ? 24 : 8, + ), + ClipRRect( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + child: TextField( + autocorrect: Util.isDesktop ? false : true, + enableSuggestions: Util.isDesktop ? false : true, + key: const Key("addCustomNodeNodeNameFieldKey"), + controller: _decimalsController, + focusNode: _decimalsFocusNode, + keyboardType: const TextInputType.numberWithOptions( + signed: false, + decimal: false, + ), + style: STextStyles.field(context), + decoration: standardInputDecoration( + "Maximum precision", + _decimalsFocusNode, + context, + ).copyWith( + labelStyle: + Util.isDesktop ? STextStyles.fieldLabel(context) : null, + suffixIcon: _decimalsController.text.isNotEmpty + ? Padding( + padding: const EdgeInsets.only(right: 0), + child: UnconstrainedBox( + child: Row( + children: [ + TextFieldIconButton( + child: const XIcon(), + onTap: () async { + _decimalsController.text = ""; + setState(() {}); + }, + ), + ], + ), + ), + ) + : null, + ), + ), + ), + const SizedBox( + height: 24, + ), + const Spacer(), + ConditionalParent( + condition: Util.isDesktop, + builder: (child) => Row( + children: [ + Expanded( + child: SecondaryButton( + label: "Cancel", + buttonHeight: ButtonHeight.l, + onPressed: Navigator.of(context).pop, + ), + ), + const SizedBox( + width: 16, + ), + Expanded( + child: child, + ), + ], + ), + child: PrimaryButton( + label: "Save", + buttonHeight: Util.isDesktop ? ButtonHeight.l : ButtonHeight.xl, + onPressed: onSave, + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/manage_coin_units_view.dart b/lib/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/manage_coin_units_view.dart new file mode 100644 index 0000000000..3ffee2af1c --- /dev/null +++ b/lib/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/manage_coin_units_view.dart @@ -0,0 +1,177 @@ +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:stackduo/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/edit_coin_units_view.dart'; +import 'package:stackduo/providers/global/prefs_provider.dart'; +import 'package:stackduo/themes/coin_icon_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/utilities/assets.dart'; +import 'package:stackduo/utilities/enums/coin_enum.dart'; +import 'package:stackduo/utilities/text_styles.dart'; +import 'package:stackduo/utilities/util.dart'; +import 'package:stackduo/widgets/background.dart'; +import 'package:stackduo/widgets/conditional_parent.dart'; +import 'package:stackduo/widgets/custom_buttons/app_bar_icon_button.dart'; +import 'package:stackduo/widgets/desktop/desktop_dialog.dart'; +import 'package:stackduo/widgets/desktop/desktop_dialog_close_button.dart'; +import 'package:stackduo/widgets/rounded_white_container.dart'; + +class ManageCoinUnitsView extends ConsumerWidget { + const ManageCoinUnitsView({Key? key}) : super(key: key); + + static const String routeName = "/manageCoinUnitsView"; + + void onEditPressed(Coin coin, BuildContext context) { + if (Util.isDesktop) { + showDialog( + context: context, + builder: (context) => EditCoinUnitsView(coin: coin), + ); + } else { + Navigator.of(context).pushNamed( + EditCoinUnitsView.routeName, + arguments: coin, + ); + } + } + + @override + Widget build(BuildContext context, WidgetRef ref) { + bool showTestNet = ref.watch( + prefsChangeNotifierProvider.select((value) => value.showTestNetCoins), + ); + + final _coins = + Coin.values /*.where((e) => e != Coin.firoTestNet)*/ .toList(); + + List coins = showTestNet + ? _coins + : _coins.sublist(0, _coins.length - kTestNetCoinCount); + + return ConditionalParent( + condition: Util.isDesktop, + builder: (child) => DesktopDialog( + maxHeight: 850, + maxWidth: 600, + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: const EdgeInsets.only(left: 32), + child: Text( + "Units", + style: STextStyles.desktopH3(context), + ), + ), + const DesktopDialogCloseButton(), + ], + ), + Expanded( + child: Padding( + padding: const EdgeInsets.only( + left: 32, + right: 32, + bottom: 32, + ), + child: child, + ), + ), + ], + ), + ), + child: ConditionalParent( + condition: !Util.isDesktop, + builder: (child) => Background( + child: Scaffold( + backgroundColor: + Theme.of(context).extension()!.background, + appBar: AppBar( + leading: AppBarBackButton( + onPressed: () { + Navigator.of(context).pop(); + }, + ), + title: Text( + "Units", + style: STextStyles.navBarTitle(context), + ), + ), + body: child, + ), + ), + child: ListView.separated( + itemCount: Util.isDesktop ? coins.length : coins.length + 2, + separatorBuilder: (_, __) => const SizedBox( + height: 12, + ), + itemBuilder: (_, index) { + if (!Util.isDesktop) { + if (index == 0) { + return const SizedBox(height: 0); + } else if (index > coins.length) { + return const SizedBox(height: 10); + } + } + + final coin = coins[Util.isDesktop ? index : index - 1]; + return Padding( + padding: Util.isDesktop + ? EdgeInsets.zero + : const EdgeInsets.symmetric( + horizontal: 16, + ), + child: RoundedWhiteContainer( + padding: Util.isDesktop + ? const EdgeInsets.symmetric( + vertical: 16, + horizontal: 14, + ) + : const EdgeInsets.all(12), + borderColor: Util.isDesktop + ? Theme.of(context).extension()!.textSubtitle6 + : null, + onPressed: () { + onEditPressed(coin, context); + }, + child: Row( + children: [ + SvgPicture.file( + File( + ref.watch( + coinIconProvider(coin), + ), + ), + width: 24, + height: 24, + ), + const SizedBox( + width: 12, + ), + Expanded( + child: Text( + "Edit ${coin.prettyName} units", + style: STextStyles.titleBold12(context), + ), + ), + const SizedBox( + width: 12, + ), + SvgPicture.asset( + Assets.svg.chevronRight, + width: Util.isDesktop ? 20 : 14, + height: Util.isDesktop ? 20 : 14, + ), + ], + ), + ), + ); + }, + ), + ), + ); + } +} diff --git a/lib/pages/settings_views/global_settings_view/appearance_settings/manage_themes.dart b/lib/pages/settings_views/global_settings_view/appearance_settings/manage_themes.dart index de90bcd524..66a26e507f 100644 --- a/lib/pages/settings_views/global_settings_view/appearance_settings/manage_themes.dart +++ b/lib/pages/settings_views/global_settings_view/appearance_settings/manage_themes.dart @@ -225,14 +225,14 @@ class _IncognitoInstalledThemesState extends ConsumerState { late final StreamSubscription _subscription; - List> installedThemeIdNames = []; + List> installedThemeIdNames = []; void _updateInstalledList() { installedThemeIdNames = ref .read(pThemeService) .installedThemes .where((e) => e.themeId != "light" && e.themeId != "dark") - .map((e) => Tuple2(e.themeId, e.name)) + .map((e) => Tuple3(e.themeId, e.name, e.version)) .toList(); } @@ -274,6 +274,7 @@ class _IncognitoInstalledThemesState data: StackThemeMetaData( name: e.item2, id: e.item1, + version: e.item3 ?? 1, sha256: "", size: "", previewImageUrl: "", diff --git a/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/stack_theme_card.dart b/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/stack_theme_card.dart index de6589e1d9..6d925675ee 100644 --- a/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/stack_theme_card.dart +++ b/lib/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/stack_theme_card.dart @@ -39,6 +39,7 @@ class _StackThemeCardState extends ConsumerState { late final StreamSubscription _subscription; late bool _hasTheme; + bool _needsUpdate = false; String? _cachedSize; Future _downloadAndInstall() async { @@ -84,6 +85,7 @@ class _StackThemeCardState extends ConsumerState { title: message, onOkPressed: (_) { setState(() { + _needsUpdate = !result; _hasTheme = result; }); }, @@ -114,7 +116,7 @@ class _StackThemeCardState extends ConsumerState { } Future getThemeDirectorySize() async { - final themesDir = await StackFileSystem.applicationThemesDirectory(); + final themesDir = StackFileSystem.themesDir!; final themeDir = Directory("${themesDir.path}/${widget.data.id}"); int bytes = 0; if (await themeDir.exists()) { @@ -141,16 +143,21 @@ class _StackThemeCardState extends ConsumerState { } } + StackTheme? getInstalled() => ref + .read(mainDBProvider) + .isar + .stackThemes + .where() + .themeIdEqualTo(widget.data.id) + .findFirstSync(); + @override void initState() { - _hasTheme = ref - .read(mainDBProvider) - .isar - .stackThemes - .where() - .themeIdEqualTo(widget.data.id) - .countSync() > - 0; + final installedTheme = getInstalled(); + _hasTheme = installedTheme != null; + if (_hasTheme) { + _needsUpdate = widget.data.version > (installedTheme?.version ?? 0); + } _subscription = ref .read(mainDBProvider) @@ -158,18 +165,16 @@ class _StackThemeCardState extends ConsumerState { .stackThemes .watchLazy() .listen((event) async { - final hasTheme = (await ref - .read(mainDBProvider) - .isar - .stackThemes - .where() - .themeIdEqualTo(widget.data.id) - .count()) > - 0; + final installedTheme = getInstalled(); + final hasTheme = installedTheme != null; if (_hasTheme != hasTheme && mounted) { WidgetsBinding.instance.addPostFrameCallback((timeStamp) { setState(() { _hasTheme = hasTheme; + if (hasTheme) { + _needsUpdate = + widget.data.version > (installedTheme.version ?? 0); + } }); }); } @@ -272,6 +277,16 @@ class _StackThemeCardState extends ConsumerState { } }, ), + if (_hasTheme && _needsUpdate) + const SizedBox( + height: 12, + ), + if (_hasTheme && _needsUpdate) + PrimaryButton( + label: "Update", + buttonHeight: isDesktop ? ButtonHeight.s : ButtonHeight.l, + onPressed: _downloadPressed, + ), const SizedBox( height: 12, ), diff --git a/lib/pages/settings_views/global_settings_view/currency_view.dart b/lib/pages/settings_views/global_settings_view/currency_view.dart index 87f31e1902..9ce682c140 100644 --- a/lib/pages/settings_views/global_settings_view/currency_view.dart +++ b/lib/pages/settings_views/global_settings_view/currency_view.dart @@ -50,6 +50,10 @@ class _CurrencyViewState extends ConsumerState { currenciesWithoutSelected.remove(current); currenciesWithoutSelected.insert(0, current); ref.read(prefsChangeNotifierProvider).currency = current; + + if (ref.read(prefsChangeNotifierProvider).externalCalls) { + ref.read(priceAnd24hChangeNotifierProvider).updatePrice(); + } } } diff --git a/lib/pages/settings_views/global_settings_view/delete_account_view.dart b/lib/pages/settings_views/global_settings_view/delete_account_view.dart index 668d85b96f..83e1a9e3a9 100644 --- a/lib/pages/settings_views/global_settings_view/delete_account_view.dart +++ b/lib/pages/settings_views/global_settings_view/delete_account_view.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/pages/intro_view.dart'; -import 'package:stackduo/utilities/delete_everything.dart'; -import 'package:stackduo/utilities/text_styles.dart'; import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/utilities/text_styles.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/custom_buttons/app_bar_icon_button.dart'; import 'package:stackduo/widgets/desktop/desktop_app_bar.dart'; @@ -26,7 +26,7 @@ class _DeleteAccountViewState extends State { Future onConfirmDeleteAccount() async { // TODO delete everything then pop to intro view - await showDialog( + await showDialog( barrierDismissible: true, context: context, builder: (_) => StackDialog( @@ -51,12 +51,14 @@ class _DeleteAccountViewState extends State { .extension()! .getPrimaryEnabledButtonStyle(context), onPressed: () async { - await deleteEverything(); + await DB.instance.deleteEverything(); - await Navigator.of(context).pushNamedAndRemoveUntil( - IntroView.routeName, - (route) => false, - ); + if (mounted) { + await Navigator.of(context).pushNamedAndRemoveUntil( + IntroView.routeName, + (route) => false, + ); + } }, child: Text( "Delete", @@ -72,7 +74,7 @@ class _DeleteAccountViewState extends State { return MasterScaffold( isDesktop: isDesktop, appBar: isDesktop - ? DesktopAppBar(isCompactHeight: true) + ? const DesktopAppBar(isCompactHeight: true) : AppBar( leading: AppBarBackButton( onPressed: () async { diff --git a/lib/pages/settings_views/global_settings_view/security_views/change_pin_view/change_pin_view.dart b/lib/pages/settings_views/global_settings_view/security_views/change_pin_view/change_pin_view.dart index e4f36ccd2d..acb3639768 100644 --- a/lib/pages/settings_views/global_settings_view/security_views/change_pin_view/change_pin_view.dart +++ b/lib/pages/settings_views/global_settings_view/security_views/change_pin_view/change_pin_view.dart @@ -4,11 +4,10 @@ import 'package:stackduo/notifications/show_flush_bar.dart'; import 'package:stackduo/pages/settings_views/global_settings_view/security_views/security_view.dart'; import 'package:stackduo/providers/global/prefs_provider.dart'; import 'package:stackduo/providers/global/secure_store_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/assets.dart'; -import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/flutter_secure_storage_interface.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/custom_buttons/app_bar_icon_button.dart'; import 'package:stackduo/widgets/custom_pin_put/custom_pin_put.dart'; @@ -27,10 +26,11 @@ class ChangePinView extends ConsumerStatefulWidget { class _ChangePinViewState extends ConsumerState { BoxDecoration get _pinPutDecoration { return BoxDecoration( - color: Theme.of(context).extension()!.textSubtitle2, + color: Theme.of(context).extension()!.infoItemIcons, border: Border.all( - width: 1, - color: Theme.of(context).extension()!.textSubtitle2), + width: 1, + color: Theme.of(context).extension()!.infoItemIcons, + ), borderRadius: BorderRadius.circular(6), ); } @@ -48,6 +48,8 @@ class _ChangePinViewState extends ConsumerState { late final SecureStorageInterface _secureStore; + int pinCount = 1; + @override void initState() { _secureStore = ref.read(secureStoreProvider); @@ -101,7 +103,7 @@ class _ChangePinViewState extends ConsumerState { height: 52, ), CustomPinPut( - fieldsCount: Constants.pinLength, + fieldsCount: pinCount, eachFieldHeight: 12, eachFieldWidth: 12, textStyle: STextStyles.label(context).copyWith( @@ -125,21 +127,18 @@ class _ChangePinViewState extends ConsumerState { ), isRandom: ref.read(prefsChangeNotifierProvider).randomizePIN, - submittedFieldDecoration: _pinPutDecoration.copyWith( - color: Theme.of(context) - .extension()! - .infoItemIcons, - border: Border.all( - width: 1, - color: Theme.of(context) - .extension()! - .infoItemIcons, - ), - ), + submittedFieldDecoration: _pinPutDecoration, selectedFieldDecoration: _pinPutDecoration, followingFieldDecoration: _pinPutDecoration, onSubmit: (String pin) { - if (pin.length == Constants.pinLength) { + if (pin.length < 4) { + showFloatingFlushBar( + type: FlushBarType.warning, + message: "PIN not long enough!", + iconAsset: Assets.svg.alertCircle, + context: context, + ); + } else { _pageController.nextPage( duration: const Duration(milliseconds: 300), curve: Curves.linear, @@ -165,7 +164,7 @@ class _ChangePinViewState extends ConsumerState { height: 52, ), CustomPinPut( - fieldsCount: Constants.pinLength, + fieldsCount: pinCount, eachFieldHeight: 12, eachFieldWidth: 12, textStyle: STextStyles.infoSmall(context).copyWith( @@ -192,17 +191,7 @@ class _ChangePinViewState extends ConsumerState { ), isRandom: ref.read(prefsChangeNotifierProvider).randomizePIN, - submittedFieldDecoration: _pinPutDecoration.copyWith( - color: Theme.of(context) - .extension()! - .infoItemIcons, - border: Border.all( - width: 1, - color: Theme.of(context) - .extension()! - .infoItemIcons, - ), - ), + submittedFieldDecoration: _pinPutDecoration, selectedFieldDecoration: _pinPutDecoration, followingFieldDecoration: _pinPutDecoration, onSubmit: (String pin) async { diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/edit_auto_backup_view.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/edit_auto_backup_view.dart index ee4da4467d..f553567920 100644 --- a/lib/pages/settings_views/global_settings_view/stack_backup_views/edit_auto_backup_view.dart +++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/edit_auto_backup_view.dart @@ -616,9 +616,7 @@ class _EditAutoBackupViewState extends ConsumerState { if (isDesktop) DropdownButtonHideUnderline( child: DropdownButton2( - offset: const Offset(0, -10), isExpanded: true, - dropdownElevation: 0, value: _currentDropDownValue, items: [ ..._dropDownItems.map( @@ -662,30 +660,31 @@ class _EditAutoBackupViewState extends ConsumerState { }); } }, - icon: SvgPicture.asset( - Assets.svg.chevronDown, - width: 10, - height: 5, - color: Theme.of(context).extension()!.textDark3, - ), - buttonPadding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 8, + iconStyleData: IconStyleData( + icon: SvgPicture.asset( + Assets.svg.chevronDown, + width: 10, + height: 5, + color: + Theme.of(context).extension()!.textDark3, + ), ), - buttonDecoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .textFieldDefaultBG, - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, + dropdownStyleData: DropdownStyleData( + offset: const Offset(0, -10), + elevation: 0, + decoration: BoxDecoration( + color: Theme.of(context) + .extension()! + .textFieldDefaultBG, + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), ), ), - dropdownDecoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .textFieldDefaultBG, - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, + menuItemStyleData: const MenuItemStyleData( + padding: EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, ), ), ), diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart index a2b1151595..b1b57748ce 100644 --- a/lib/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart +++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart @@ -4,7 +4,7 @@ import 'dart:io'; import 'dart:typed_data'; import 'package:stack_wallet_backup/stack_wallet_backup.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/exchange/change_now/exchange_transaction.dart'; import 'package:stackduo/models/exchange/response_objects/trade.dart'; import 'package:stackduo/models/isar/models/contact_entry.dart'; diff --git a/lib/pages/settings_views/global_settings_view/support_view.dart b/lib/pages/settings_views/global_settings_view/support_view.dart index 7f41c45162..7a47e10c71 100644 --- a/lib/pages/settings_views/global_settings_view/support_view.dart +++ b/lib/pages/settings_views/global_settings_view/support_view.dart @@ -190,7 +190,7 @@ class AboutItem extends StatelessWidget { height: iconSize, color: Theme.of(context) .extension()! - .bottomNavIconIcon, + .topNavIconPrimary, ), ), const SizedBox( diff --git a/lib/pages/settings_views/global_settings_view/syncing_preferences_views/wallet_syncing_options_view.dart b/lib/pages/settings_views/global_settings_view/syncing_preferences_views/wallet_syncing_options_view.dart index b070384ea8..59fe27a04e 100644 --- a/lib/pages/settings_views/global_settings_view/syncing_preferences_views/wallet_syncing_options_view.dart +++ b/lib/pages/settings_views/global_settings_view/syncing_preferences_views/wallet_syncing_options_view.dart @@ -6,8 +6,8 @@ import 'package:flutter_svg/svg.dart'; import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/themes/coin_icon_provider.dart'; import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/constants.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/enums/sync_type_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; import 'package:stackduo/utilities/util.dart'; @@ -147,14 +147,10 @@ class WalletSyncingOptionsView extends ConsumerWidget { height: 2, ), Text( - "${manager.balance.total.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select( - (value) => value.locale, - ), - ), - )} ${manager.coin.ticker}", + ref + .watch(pAmountFormatter( + manager.coin)) + .format(manager.balance.total), style: STextStyles.itemSubtitle(context), ) @@ -191,9 +187,9 @@ class WalletSyncingOptionsView extends ConsumerWidget { } break; case SyncingType - .selectedWalletsAtStartup: + .selectedWalletsAtStartup: case SyncingType - .allWalletsOnStartup: + .allWalletsOnStartup: manager.shouldAutoSync = value; break; } diff --git a/lib/pages/settings_views/global_settings_view/xpub_view.dart b/lib/pages/settings_views/global_settings_view/xpub_view.dart index d5b77d2b46..b98d9915d9 100644 --- a/lib/pages/settings_views/global_settings_view/xpub_view.dart +++ b/lib/pages/settings_views/global_settings_view/xpub_view.dart @@ -243,7 +243,7 @@ class _XPub extends StatelessWidget { builder: (child) => RoundedWhiteContainer( child: child, ), - child: QrImage( + child: QrImageView( data: xpub, size: isDesktop ? 280 : MediaQuery.of(context).size.width / 1.5, foregroundColor: diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_backup_views/wallet_backup_view.dart b/lib/pages/settings_views/wallet_settings_view/wallet_backup_views/wallet_backup_view.dart index 23ebc9c2c6..4d8cb6cfdb 100644 --- a/lib/pages/settings_views/wallet_settings_view/wallet_backup_views/wallet_backup_view.dart +++ b/lib/pages/settings_views/wallet_settings_view/wallet_backup_views/wallet_backup_view.dart @@ -6,10 +6,10 @@ import 'package:flutter_windowmanager/flutter_windowmanager.dart'; import 'package:qr_flutter/qr_flutter.dart'; import 'package:stackduo/pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table.dart'; import 'package:stackduo/providers/global/wallets_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/address_utils.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/custom_buttons/app_bar_icon_button.dart'; import 'package:stackduo/widgets/stack_dialog.dart'; @@ -162,7 +162,7 @@ class _WalletBackupViewState extends ConsumerState { child: SizedBox( width: width + 20, height: width + 20, - child: QrImage( + child: QrImageView( data: data, size: width, backgroundColor: Theme.of(context) diff --git a/lib/pages/stack_privacy_calls.dart b/lib/pages/stack_privacy_calls.dart index 2a95a89c47..cd511e3fde 100644 --- a/lib/pages/stack_privacy_calls.dart +++ b/lib/pages/stack_privacy_calls.dart @@ -4,7 +4,7 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/pages/pinpad_views/create_pin_view.dart'; import 'package:stackduo/pages_desktop_specific/password/create_password_view.dart'; import 'package:stackduo/providers/global/prefs_provider.dart'; diff --git a/lib/pages/wallet_view/sub_widgets/tx_icon.dart b/lib/pages/wallet_view/sub_widgets/tx_icon.dart index 0fc321d8ac..2e6865c065 100644 --- a/lib/pages/wallet_view/sub_widgets/tx_icon.dart +++ b/lib/pages/wallet_view/sub_widgets/tx_icon.dart @@ -24,7 +24,7 @@ class TxIcon extends ConsumerWidget { static const Size size = Size(32, 32); String _getAssetName( - bool isCancelled, bool isReceived, bool isPending, ThemeAssets assets) { + bool isCancelled, bool isReceived, bool isPending, IThemeAssets assets) { if (!isReceived && transaction.subType == TransactionSubType.mint) { if (isCancelled) { return Assets.svg.anonymizeFailed; @@ -65,7 +65,7 @@ class TxIcon extends ConsumerWidget { currentHeight, coin.requiredConfirmations, ), - ref.watch(themeProvider).assets, + ref.watch(themeAssetsProvider), ); return SizedBox( diff --git a/lib/pages/wallet_view/sub_widgets/wallet_balance_toggle_sheet.dart b/lib/pages/wallet_view/sub_widgets/wallet_balance_toggle_sheet.dart index 28b5dfd52a..7954516b41 100644 --- a/lib/pages/wallet_view/sub_widgets/wallet_balance_toggle_sheet.dart +++ b/lib/pages/wallet_view/sub_widgets/wallet_balance_toggle_sheet.dart @@ -2,12 +2,13 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/providers/wallet/wallet_balance_toggle_state_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/enums/wallet_balance_toggle_state.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; enum _BalanceType { available, @@ -199,13 +200,7 @@ class BalanceSelector extends ConsumerWidget { height: 2, ), Text( - "${balance.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ), - )} ${coin.ticker}", + ref.watch(pAmountFormatter(coin)).format(balance), style: STextStyles.itemSubtitle12(context).copyWith( color: Theme.of(context) .extension()! diff --git a/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart b/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart index 8c3db8085f..3a2dc07359 100644 --- a/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart +++ b/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart @@ -52,13 +52,19 @@ class _RefreshButtonState extends ConsumerState { if (event.walletId == widget.walletId) { switch (event.newStatus) { case WalletSyncStatus.unableToSync: - _spinController.stop?.call(); + if (_spinController.hasLoadedAnimation) { + _spinController.stop?.call(); + } break; case WalletSyncStatus.synced: - _spinController.stop?.call(); + if (_spinController.hasLoadedAnimation) { + _spinController.stop?.call(); + } break; case WalletSyncStatus.syncing: - _spinController.repeat?.call(); + if (_spinController.hasLoadedAnimation) { + _spinController.repeat?.call(); + } break; } } @@ -84,6 +90,7 @@ class _RefreshButtonState extends ConsumerState { width: isDesktop ? 22 : 36, child: Semantics( label: "Refresh Button. Refreshes The Values In Summary.", + excludeSemantics: true, child: MaterialButton( color: isDesktop ? Theme.of(context) diff --git a/lib/pages/wallet_view/sub_widgets/wallet_summary.dart b/lib/pages/wallet_view/sub_widgets/wallet_summary.dart index 9d24861468..27979d7ce3 100644 --- a/lib/pages/wallet_view/sub_widgets/wallet_summary.dart +++ b/lib/pages/wallet_view/sub_widgets/wallet_summary.dart @@ -1,18 +1,12 @@ import 'package:flutter/material.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:flutter_svg/flutter_svg.dart'; import 'package:stackduo/pages/wallet_view/sub_widgets/wallet_summary_info.dart'; -import 'package:stackduo/services/coins/manager.dart'; import 'package:stackduo/services/event_bus/events/global/wallet_sync_status_changed_event.dart'; -import 'package:stackduo/utilities/assets.dart'; -import 'package:stackduo/utilities/constants.dart'; -import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/widgets/coin_card.dart'; class WalletSummary extends StatelessWidget { const WalletSummary({ Key? key, required this.walletId, - required this.managerProvider, required this.initialSyncStatus, this.aspectRatio = 2.0, this.minHeight = 100.0, @@ -22,7 +16,6 @@ class WalletSummary extends StatelessWidget { }) : super(key: key); final String walletId; - final ChangeNotifierProvider managerProvider; final WalletSyncStatus initialSyncStatus; final double aspectRatio; @@ -42,83 +35,25 @@ class WalletSummary extends StatelessWidget { maxHeight: maxHeight, maxWidth: minWidth, ), - child: Stack( - children: [ - Consumer( - builder: (_, ref, __) { - return Container( - decoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .colorForCoin(ref.watch( - managerProvider.select((value) => value.coin))), - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, - ), - ), - ); - }, - ), - Positioned.fill( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Spacer( - flex: 5, - ), - Expanded( - flex: 6, - child: SvgPicture.asset( - Assets.svg.ellipse1, - // fit: BoxFit.fitWidth, - // clipBehavior: Clip.none, - ), - ), - const SizedBox( - width: 25, - ), - ], + child: LayoutBuilder( + builder: (_, constraints) => Stack( + children: [ + CoinCard( + walletId: walletId, + width: constraints.maxWidth, + height: constraints.maxHeight, ), - ), - // Positioned.fill( - // child: - // Column( - // mainAxisAlignment: MainAxisAlignment.end, - // children: [ - Align( - alignment: Alignment.bottomCenter, - child: Row( - children: [ - const Spacer( - flex: 1, + Positioned.fill( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: WalletSummaryInfo( + walletId: walletId, + initialSyncStatus: initialSyncStatus, ), - Expanded( - flex: 3, - child: SvgPicture.asset( - Assets.svg.ellipse2, - // fit: BoxFit.f, - // clipBehavior: Clip.none, - ), - ), - const SizedBox( - width: 13, - ), - ], - ), - ), - // ], - // ), - // ), - Positioned.fill( - child: Padding( - padding: const EdgeInsets.all(16.0), - child: WalletSummaryInfo( - walletId: walletId, - initialSyncStatus: initialSyncStatus, ), ), - ), - ], + ], + ), ), ), ); diff --git a/lib/pages/wallet_view/sub_widgets/wallet_summary_info.dart b/lib/pages/wallet_view/sub_widgets/wallet_summary_info.dart index 705792b635..c6d10e300d 100644 --- a/lib/pages/wallet_view/sub_widgets/wallet_summary_info.dart +++ b/lib/pages/wallet_view/sub_widgets/wallet_summary_info.dart @@ -14,8 +14,8 @@ import 'package:stackduo/services/event_bus/global_event_bus.dart'; import 'package:stackduo/themes/coin_icon_provider.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/assets.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/enums/wallet_balance_toggle_state.dart'; import 'package:stackduo/utilities/text_styles.dart'; @@ -131,9 +131,7 @@ class _WalletSummaryInfoState extends ConsumerState { FittedBox( fit: BoxFit.scaleDown, child: SelectableText( - "${balanceToShow.localizedStringAsFixed( - locale: locale, - )} ${coin.ticker}", + ref.watch(pAmountFormatter(coin)).format(balanceToShow), style: STextStyles.pageTitleH1(context).copyWith( fontSize: 24, color: Theme.of(context) @@ -146,7 +144,7 @@ class _WalletSummaryInfoState extends ConsumerState { Text( "${(priceTuple.item1 * balanceToShow.decimal).toAmount( fractionDigits: 2, - ).localizedStringAsFixed( + ).fiatString( locale: locale, )} $baseCurrency", style: STextStyles.subtitle500(context).copyWith( diff --git a/lib/pages/wallet_view/transaction_views/all_transactions_view.dart b/lib/pages/wallet_view/transaction_views/all_transactions_view.dart index 7d486c40c2..934d36ae6f 100644 --- a/lib/pages/wallet_view/transaction_views/all_transactions_view.dart +++ b/lib/pages/wallet_view/transaction_views/all_transactions_view.dart @@ -14,6 +14,7 @@ import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/providers/ui/transaction_filter_provider.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; @@ -941,9 +942,7 @@ class _DesktopTransactionCardRowState builder: (_) { final amount = _transaction.realAmount; return Text( - "$prefix${amount.localizedStringAsFixed( - locale: locale, - )} ${coin.ticker}", + "$prefix${ref.watch(pAmountFormatter(coin)).format(amount)}", style: STextStyles.desktopTextExtraExtraSmall(context) .copyWith( color: Theme.of(context) @@ -965,7 +964,7 @@ class _DesktopTransactionCardRowState return Text( "$prefix${(amount.decimal * price).toAmount( fractionDigits: 2, - ).localizedStringAsFixed( + ).fiatString( locale: locale, )} $baseCurrency", style: STextStyles.desktopTextExtraExtraSmall(context), diff --git a/lib/pages/wallet_view/transaction_views/transaction_details_view.dart b/lib/pages/wallet_view/transaction_views/transaction_details_view.dart index 326e0c4f23..04380421e6 100644 --- a/lib/pages/wallet_view/transaction_views/transaction_details_view.dart +++ b/lib/pages/wallet_view/transaction_views/transaction_details_view.dart @@ -1,16 +1,20 @@ import 'dart:async'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:stackduo/models/isar/models/blockchain_data/transaction.dart'; import 'package:stackduo/notifications/show_flush_bar.dart'; +import 'package:stackduo/pages/receive_view/addresses/address_details_view.dart'; import 'package:stackduo/pages/wallet_view/sub_widgets/tx_icon.dart'; import 'package:stackduo/pages/wallet_view/transaction_views/edit_note_view.dart'; import 'package:stackduo/providers/global/address_book_service_provider.dart'; import 'package:stackduo/providers/providers.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/block_explorers.dart'; import 'package:stackduo/utilities/constants.dart'; @@ -18,7 +22,6 @@ import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/format.dart'; import 'package:stackduo/utilities/logger.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; @@ -66,6 +69,7 @@ class _TransactionDetailsViewState late final String amountPrefix; late final String unit; late final bool isTokenTx; + late final dynamic? ethContract; bool showFeePending = false; @@ -73,17 +77,33 @@ class _TransactionDetailsViewState void initState() { isDesktop = Util.isDesktop; _transaction = widget.transaction; - isTokenTx = false; + isTokenTx = _transaction.subType == TransactionSubType.ethToken; walletId = widget.walletId; coin = widget.coin; amount = _transaction.realAmount; fee = _transaction.fee.toAmountAsRaw(fractionDigits: coin.decimals); + // if ((coin == Coin.firo || coin == Coin.firoTestNet) && + // _transaction.subType == TransactionSubType.mint) { + // amountPrefix = ""; + // } else { amountPrefix = _transaction.type == TransactionType.outgoing ? "-" : "+"; + // } + + ethContract = + // isTokenTx + // ? ref.read(mainDBProvider).getEthContractSync(_transaction.otherData!) + // : + null; - unit = coin.ticker; + unit = /*isTokenTx ? ethContract!.symbol :*/ coin.ticker; + // if (coin == Coin.firo || coin == Coin.firoTestNet) { + // showFeePending = true; + // } else { + // showFeePending = false; + // } super.initState(); } @@ -92,18 +112,59 @@ class _TransactionDetailsViewState super.dispose(); } - String whatIsIt(TransactionType type, int height) { + String whatIsIt(Transaction tx, int height) { + final type = tx.type; + // if (coin == Coin.firo || coin == Coin.firoTestNet) { + // if (tx.subType == TransactionSubType.mint) { + // if (tx.isConfirmed(height, coin.requiredConfirmations)) { + // return "Minted"; + // } else { + // return "Minting"; + // } + // } + // } + + // if (coin == Coin.epicCash) { + // if (_transaction.isCancelled) { + // return "Cancelled"; + // } else if (type == TransactionType.incoming) { + // if (tx.isConfirmed(height, coin.requiredConfirmations)) { + // return "Received"; + // } else { + // if (_transaction.numberOfMessages == 1) { + // return "Receiving (waiting for sender)"; + // } else if ((_transaction.numberOfMessages ?? 0) > 1) { + // return "Receiving (waiting for confirmations)"; // TODO test if the sender still has to open again after the receiver has 2 messages present, ie. sender->receiver->sender->node (yes) vs. sender->receiver->node (no) + // } else { + // return "Receiving"; + // } + // } + // } else if (type == TransactionType.outgoing) { + // if (tx.isConfirmed(height, coin.requiredConfirmations)) { + // return "Sent (confirmed)"; + // } else { + // if (_transaction.numberOfMessages == 1) { + // return "Sending (waiting for receiver)"; + // } else if ((_transaction.numberOfMessages ?? 0) > 1) { + // return "Sending (waiting for confirmations)"; + // } else { + // return "Sending"; + // } + // } + // } + // } + if (type == TransactionType.incoming) { // if (_transaction.isMinting) { // return "Minting"; // } else - if (_transaction.isConfirmed(height, coin.requiredConfirmations)) { + if (tx.isConfirmed(height, coin.requiredConfirmations)) { return "Received"; } else { return "Receiving"; } } else if (type == TransactionType.outgoing) { - if (_transaction.isConfirmed(height, coin.requiredConfirmations)) { + if (tx.isConfirmed(height, coin.requiredConfirmations)) { return "Sent"; } else { return "Sending"; @@ -398,7 +459,7 @@ class _TransactionDetailsViewState _transaction.isCancelled ? "Cancelled" : whatIsIt( - _transaction.type, + _transaction, currentHeight, ), style: @@ -413,13 +474,7 @@ class _TransactionDetailsViewState : CrossAxisAlignment.start, children: [ SelectableText( - "$amountPrefix${amount.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select((value) => - value.locale), - ), - )} $unit", + "$amountPrefix${ref.watch(pAmountFormatter(coin)).format(amount, ethContract: ethContract)}", style: isDesktop ? STextStyles .desktopTextExtraExtraSmall( @@ -444,11 +499,18 @@ class _TransactionDetailsViewState "$amountPrefix${(amount.decimal * ref.watch( priceAnd24hChangeNotifierProvider .select((value) => + // isTokenTx + // ? value + // .getTokenPrice( + // _transaction + // .otherData!) + // .item1 + // : value .getPrice( coin) .item1), - )).toAmount(fractionDigits: 2).localizedStringAsFixed( + )).toAmount(fractionDigits: 2).fiatString( locale: ref.watch( localeServiceChangeNotifierProvider .select( @@ -510,7 +572,7 @@ class _TransactionDetailsViewState _transaction.isCancelled ? "Cancelled" : whatIsIt( - _transaction.type, + _transaction, currentHeight, ), style: isDesktop @@ -534,21 +596,37 @@ class _TransactionDetailsViewState ], ), ), - if (!((coin == Coin.monero) && + if (!((coin == + Coin + .monero /* || + coin == Coin.wownero*/ + ) && _transaction.type == - TransactionType.outgoing) && - !(_transaction.subType == - TransactionSubType.mint)) + TransactionType.outgoing) + // && + // !((coin == Coin.firo || + // coin == Coin.firoTestNet) && + // _transaction.subType == + // TransactionSubType.mint) + ) isDesktop ? const _Divider() : const SizedBox( height: 12, ), - if (!((coin == Coin.monero) && + if (!((coin == + Coin + .monero /*|| + coin == Coin.wownero*/ + ) && _transaction.type == - TransactionType.outgoing) && - !(_transaction.subType == - TransactionSubType.mint)) + TransactionType.outgoing) + // && + // !((coin == Coin.firo || + // coin == Coin.firoTestNet) && + // _transaction.subType == + // TransactionSubType.mint) + ) RoundedWhiteContainer( padding: isDesktop ? const EdgeInsets.all(16) @@ -563,17 +641,66 @@ class _TransactionDetailsViewState crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - _transaction.type == - TransactionType.outgoing - ? "Sent to" - : "Receiving address", - style: isDesktop - ? STextStyles - .desktopTextExtraExtraSmall( - context) - : STextStyles.itemSubtitle( - context), + ConditionalParent( + condition: kDebugMode, + builder: (child) { + return Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + child, + CustomTextButton( + text: "Info", + onTap: () { + if (isDesktop) { + showDialog( + context: context, + builder: (_) => + DesktopDialog( + maxHeight: + double.infinity, + child: + AddressDetailsView( + addressId: + _transaction + .address + .value! + .id, + walletId: widget + .walletId, + ), + ), + ); + } else { + Navigator.of(context) + .pushNamed( + AddressDetailsView + .routeName, + arguments: Tuple2( + _transaction.address + .value!.id, + widget.walletId, + ), + ); + } + }, + ) + ], + ); + }, + child: Text( + _transaction.type == + TransactionType.outgoing + ? "Sent to" + : "Receiving address", + style: isDesktop + ? STextStyles + .desktopTextExtraExtraSmall( + context) + : STextStyles.itemSubtitle( + context), + ), ), const SizedBox( height: 8, @@ -833,11 +960,13 @@ class _TransactionDetailsViewState ], ), ), + // if (coin != Coin.banano && coin != Coin.nano) isDesktop ? const _Divider() : const SizedBox( height: 12, ), + // if (coin != Coin.banano && coin != Coin.nano) RoundedWhiteContainer( padding: isDesktop ? const EdgeInsets.all(16) @@ -848,23 +977,17 @@ class _TransactionDetailsViewState currentHeight, coin.requiredConfirmations, ) - ? fee.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select( - (value) => value.locale), - ), - ) + ? ref + .watch(pAmountFormatter(coin)) + .format( + fee, + withUnitName: isTokenTx, + ) : "Pending" - : fee.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select((value) => value.locale), - ), - ); - if (isTokenTx) { - feeString += " ${coin.ticker}"; - } + : ref.watch(pAmountFormatter(coin)).format( + fee, + withUnitName: isTokenTx, + ); return Row( mainAxisAlignment: @@ -937,16 +1060,28 @@ class _TransactionDetailsViewState ? const EdgeInsets.all(16) : const EdgeInsets.all(12), child: Builder(builder: (context) { - final height = _transaction.isConfirmed( - currentHeight, - coin.requiredConfirmations, - ) - ? "${_transaction.height == 0 ? "Unknown" : _transaction.height}" - : _transaction.getConfirmations( + final String height; + + // if (widget.coin == Coin.bitcoincash || + // widget.coin == Coin.eCash || + // widget.coin == Coin.bitcoincashTestnet) { + // height = + // "${_transaction.height != null && _transaction.height! > 0 ? _transaction.height! : "Pending"}"; + // } else { + height = + // widget.coin != Coin.epicCash && + // _transaction.isConfirmed( + // currentHeight, + // coin.requiredConfirmations, + // ) + // ? "${_transaction.height == 0 ? "Unknown" : _transaction.height}" + // : + _transaction.getConfirmations( currentHeight) > 0 ? "${_transaction.height}" : "Pending"; + // } return Row( mainAxisAlignment: @@ -1008,6 +1143,86 @@ class _TransactionDetailsViewState ); }), ), + // if (coin == Coin.ethereum) + // isDesktop + // ? const _Divider() + // : const SizedBox( + // height: 12, + // ), + // if (coin == Coin.ethereum) + // RoundedWhiteContainer( + // padding: isDesktop + // ? const EdgeInsets.all(16) + // : const EdgeInsets.all(12), + // child: Row( + // crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisAlignment: + // MainAxisAlignment.spaceBetween, + // children: [ + // Text( + // "Nonce", + // style: isDesktop + // ? STextStyles + // .desktopTextExtraExtraSmall( + // context) + // : STextStyles.itemSubtitle(context), + // ), + // SelectableText( + // _transaction.nonce.toString(), + // style: isDesktop + // ? STextStyles + // .desktopTextExtraExtraSmall( + // context) + // .copyWith( + // color: Theme.of(context) + // .extension()! + // .textDark, + // ) + // : STextStyles.itemSubtitle12(context), + // ), + // ], + // ), + // ), + if (kDebugMode) + isDesktop + ? const _Divider() + : const SizedBox( + height: 12, + ), + if (kDebugMode) + RoundedWhiteContainer( + padding: isDesktop + ? const EdgeInsets.all(16) + : const EdgeInsets.all(12), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + "Tx sub type", + style: isDesktop + ? STextStyles + .desktopTextExtraExtraSmall( + context) + : STextStyles.itemSubtitle(context), + ), + SelectableText( + _transaction.subType.toString(), + style: isDesktop + ? STextStyles + .desktopTextExtraExtraSmall( + context) + .copyWith( + color: Theme.of(context) + .extension()! + .textDark, + ) + : STextStyles.itemSubtitle12(context), + ), + ], + ), + ), isDesktop ? const _Divider() : const SizedBox( @@ -1057,11 +1272,11 @@ class _TransactionDetailsViewState : STextStyles.itemSubtitle12( context), ), - // ), - // ), + // if (coin != Coin.epicCash) const SizedBox( height: 8, ), + // if (coin != Coin.epicCash) CustomTextButton( text: "Open in block explorer", onTap: () async { @@ -1123,6 +1338,8 @@ class _TransactionDetailsViewState } }, ), + // ), + // ), ], ), ), diff --git a/lib/pages/wallet_view/transaction_views/transaction_search_filter_view.dart b/lib/pages/wallet_view/transaction_views/transaction_search_filter_view.dart index 48795142de..466a726a05 100644 --- a/lib/pages/wallet_view/transaction_views/transaction_search_filter_view.dart +++ b/lib/pages/wallet_view/transaction_views/transaction_search_filter_view.dart @@ -1,6 +1,5 @@ import 'package:decimal/decimal.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_rounded_date_picker/flutter_rounded_date_picker.dart'; import 'package:flutter_svg/svg.dart'; @@ -10,6 +9,8 @@ import 'package:stackduo/providers/ui/transaction_filter_provider.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/themes/theme_providers.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; +import 'package:stackduo/utilities/amount/amount_input_formatter.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; @@ -76,11 +77,12 @@ class _TransactionSearchViewState _toDateString = _selectedToDate == null ? "" : Format.formatDate(_selectedToDate!); - final String amount = filterState.amount?.localizedStringAsFixed( - locale: ref.read(localeServiceChangeNotifierProvider).locale, - decimalPlaces: widget.coin.decimals, - ) ?? - ""; + final String amount = filterState.amount == null + ? "" + : ref.read(pAmountFormatter(widget.coin)).format( + filterState.amount!, + withUnitName: false, + ); _amountTextEditingController.text = amount; } @@ -746,12 +748,20 @@ class _TransactionSearchViewState decimal: true, ), inputFormatters: [ - // regex to validate a crypto amount with 8 decimal places - TextInputFormatter.withFunction((oldValue, newValue) => - RegExp(r'^([0-9]*[,.]?[0-9]{0,8}|[,.][0-9]{0,8})$') - .hasMatch(newValue.text) - ? newValue - : oldValue), + AmountInputFormatter( + decimals: widget.coin.decimals, + unit: ref.watch(pAmountUnit(widget.coin)), + locale: ref.watch( + localeServiceChangeNotifierProvider + .select((value) => value.locale), + ), + ), + // // regex to validate a crypto amount with 8 decimal places + // TextInputFormatter.withFunction((oldValue, newValue) => + // RegExp(r'^([0-9]*[,.]?[0-9]{0,8}|[,.][0-9]{0,8})$') + // .hasMatch(newValue.text) + // ? newValue + // : oldValue), ], style: isDesktop ? STextStyles.desktopTextExtraSmall(context).copyWith( diff --git a/lib/pages/wallet_view/wallet_view.dart b/lib/pages/wallet_view/wallet_view.dart index 792742fd4e..124c28c593 100644 --- a/lib/pages/wallet_view/wallet_view.dart +++ b/lib/pages/wallet_view/wallet_view.dart @@ -572,7 +572,7 @@ class _WalletViewState extends ConsumerState { padding: const EdgeInsets.symmetric(horizontal: 16), child: WalletSummary( walletId: walletId, - managerProvider: managerProvider, + aspectRatio: 1.75, initialSyncStatus: ref.watch(managerProvider .select((value) => value.isRefreshing)) ? WalletSyncStatus.syncing @@ -678,15 +678,11 @@ class _WalletViewState extends ConsumerState { label: "Receive", icon: const ReceiveNavIcon(), onTap: () { - final coin = ref.read(managerProvider).coin; if (mounted) { unawaited( Navigator.of(context).pushNamed( ReceiveView.routeName, - arguments: Tuple2( - walletId, - coin, - ), + arguments: walletId, ), ); } diff --git a/lib/pages/wallets_view/sub_widgets/favorite_card.dart b/lib/pages/wallets_view/sub_widgets/favorite_card.dart index 3bab6de063..629ad62d52 100644 --- a/lib/pages/wallets_view/sub_widgets/favorite_card.dart +++ b/lib/pages/wallets_view/sub_widgets/favorite_card.dart @@ -6,15 +6,15 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:stackduo/pages/wallet_view/wallet_view.dart'; import 'package:stackduo/pages_desktop_specific/my_stack_view/wallet_view/desktop_wallet_view.dart'; import 'package:stackduo/providers/providers.dart'; -import 'package:stackduo/services/coins/manager.dart'; import 'package:stackduo/themes/coin_icon_provider.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; -import 'package:stackduo/utilities/assets.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; import 'package:stackduo/utilities/util.dart'; +import 'package:stackduo/widgets/coin_card.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; import 'package:tuple/tuple.dart'; @@ -24,13 +24,11 @@ class FavoriteCard extends ConsumerStatefulWidget { required this.walletId, required this.width, required this.height, - required this.managerProvider, }) : super(key: key); final String walletId; final double width; final double height; - final ChangeNotifierProvider managerProvider; @override ConsumerState createState() => _FavoriteCardState(); @@ -38,15 +36,10 @@ class FavoriteCard extends ConsumerStatefulWidget { class _FavoriteCardState extends ConsumerState { late final String walletId; - late final ChangeNotifierProvider managerProvider; - - Amount _cachedBalance = Amount.zero; - Amount _cachedFiatValue = Amount.zero; @override void initState() { walletId = widget.walletId; - managerProvider = widget.managerProvider; super.initState(); } @@ -55,9 +48,13 @@ class _FavoriteCardState extends ConsumerState { @override Widget build(BuildContext context) { - final coin = ref.watch(managerProvider.select((value) => value.coin)); + final coin = ref.watch( + walletsChangeNotifierProvider + .select((value) => value.getManager(walletId).coin), + ); final externalCalls = ref.watch( - prefsChangeNotifierProvider.select((value) => value.externalCalls)); + prefsChangeNotifierProvider.select((value) => value.externalCalls), + ); return ConditionalParent( condition: Util.isDesktop, @@ -109,7 +106,10 @@ class _FavoriteCardState extends ConsumerState { child: GestureDetector( onTap: () async { if (coin == Coin.monero) { - await ref.read(managerProvider).initializeExisting(); + await ref + .read(walletsChangeNotifierProvider) + .getManager(walletId) + .initializeExisting(); } if (mounted) { if (Util.isDesktop) { @@ -122,7 +122,9 @@ class _FavoriteCardState extends ConsumerState { WalletView.routeName, arguments: Tuple2( walletId, - managerProvider, + ref + .read(walletsChangeNotifierProvider) + .getManagerProvider(walletId), ), ); } @@ -132,66 +134,10 @@ class _FavoriteCardState extends ConsumerState { width: widget.width, height: widget.height, child: CardOverlayStack( - background: Stack( - children: [ - Container( - width: widget.width, - height: widget.height, - decoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .colorForCoin(coin), - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, - ), - ), - ), - Column( - children: [ - const Spacer(), - SizedBox( - height: widget.width * 0.3, - child: Row( - children: [ - const Spacer( - flex: 9, - ), - SvgPicture.asset( - Assets.svg.ellipse2, - height: widget.width * 0.3, - ), - // ), - const Spacer( - flex: 2, - ), - ], - ), - ), - ], - ), - Row( - children: [ - const Spacer( - flex: 5, - ), - SizedBox( - width: widget.width * 0.45, - child: Column( - children: [ - SvgPicture.asset( - Assets.svg.ellipse1, - width: widget.width * 0.45, - ), - const Spacer(), - ], - ), - ), - const Spacer( - flex: 1, - ), - ], - ), - ], + background: CoinCard( + walletId: widget.walletId, + width: widget.width, + height: widget.height, ), child: Padding( padding: const EdgeInsets.all(12.0), @@ -205,8 +151,12 @@ class _FavoriteCardState extends ConsumerState { children: [ Expanded( child: Text( - ref.watch(managerProvider - .select((value) => value.walletName)), + ref.watch( + walletsChangeNotifierProvider.select( + (value) => + value.getManager(walletId).walletName, + ), + ), style: STextStyles.itemSubtitle12(context).copyWith( color: Theme.of(context) .extension()! @@ -225,42 +175,37 @@ class _FavoriteCardState extends ConsumerState { ], ), ), - FutureBuilder( - future: Future(() => ref.watch(managerProvider - .select((value) => value.balance.total))), - builder: (builderContext, AsyncSnapshot snapshot) { - if (snapshot.connectionState == ConnectionState.done && - snapshot.hasData) { - if (snapshot.data != null) { - _cachedBalance = snapshot.data!; - if (externalCalls && _cachedBalance > Amount.zero) { - _cachedFiatValue = (_cachedBalance.decimal * - ref - .watch( - priceAnd24hChangeNotifierProvider - .select( - (value) => value.getPrice(coin), - ), - ) - .item1) - .toAmount(fractionDigits: 2); - } - } + Builder( + builder: (context) { + final balance = ref.watch( + walletsChangeNotifierProvider.select( + (value) => value.getManager(walletId).balance, + ), + ); + + Amount total = balance.total; + + Amount fiatTotal = Amount.zero; + + if (externalCalls && total > Amount.zero) { + fiatTotal = (total.decimal * + ref + .watch( + priceAnd24hChangeNotifierProvider.select( + (value) => value.getPrice(coin), + ), + ) + .item1) + .toAmount(fractionDigits: 2); } + return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ FittedBox( fit: BoxFit.scaleDown, child: Text( - "${_cachedBalance.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select((value) => value.locale), - ), - decimalPlaces: ref.watch(managerProvider - .select((value) => value.coin.decimals)), - )} ${coin.ticker}", + ref.watch(pAmountFormatter(coin)).format(total), style: STextStyles.titleBold12(context).copyWith( fontSize: 16, color: Theme.of(context) @@ -275,15 +220,16 @@ class _FavoriteCardState extends ConsumerState { ), if (externalCalls) Text( - "${_cachedFiatValue.localizedStringAsFixed( + "${fiatTotal.fiatString( locale: ref.watch( - localeServiceChangeNotifierProvider - .select((value) => value.locale), + localeServiceChangeNotifierProvider.select( + (value) => value.locale, + ), ), - decimalPlaces: 2, )} ${ref.watch( - prefsChangeNotifierProvider - .select((value) => value.currency), + prefsChangeNotifierProvider.select( + (value) => value.currency, + ), )}", style: STextStyles.itemSubtitle12(context).copyWith( diff --git a/lib/pages/wallets_view/sub_widgets/favorite_wallets.dart b/lib/pages/wallets_view/sub_widgets/favorite_wallets.dart index 11aedcbdfe..0dc2c4208c 100644 --- a/lib/pages/wallets_view/sub_widgets/favorite_wallets.dart +++ b/lib/pages/wallets_view/sub_widgets/favorite_wallets.dart @@ -210,7 +210,6 @@ class _FavoriteWalletsState extends ConsumerState { child: FavoriteCard( key: Key("favCard_$walletId"), walletId: walletId!, - managerProvider: managerProvider!, width: cardWidth, height: cardHeight, ), @@ -218,7 +217,6 @@ class _FavoriteWalletsState extends ConsumerState { : FavoriteCard( key: Key("favCard_$walletId"), walletId: walletId!, - managerProvider: managerProvider!, width: cardWidth, height: cardHeight, ) diff --git a/lib/pages/wallets_view/sub_widgets/wallet_list_item.dart b/lib/pages/wallets_view/sub_widgets/wallet_list_item.dart index b28010bb89..971e17fb4c 100644 --- a/lib/pages/wallets_view/sub_widgets/wallet_list_item.dart +++ b/lib/pages/wallets_view/sub_widgets/wallet_list_item.dart @@ -98,12 +98,12 @@ class WalletListItem extends ConsumerWidget { final calls = ref.watch(prefsChangeNotifierProvider).externalCalls; - final priceString = tuple.item1 - .toAmount(fractionDigits: 2) - .localizedStringAsFixed( - locale: ref.watch(localeServiceChangeNotifierProvider - .select((value) => value.locale)), - ); + final priceString = + tuple.item1.toAmount(fractionDigits: 2).fiatString( + locale: ref.watch( + localeServiceChangeNotifierProvider + .select((value) => value.locale)), + ); final double percentChange = tuple.item2; diff --git a/lib/pages/wallets_view/wallets_overview.dart b/lib/pages/wallets_view/wallets_overview.dart index 92194af35b..2ae47352a1 100644 --- a/lib/pages/wallets_view/wallets_overview.dart +++ b/lib/pages/wallets_view/wallets_overview.dart @@ -1,19 +1,22 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:stackduo/models/add_wallet_list_entity/sub_classes/coin_entity.dart'; import 'package:stackduo/pages/add_wallet_views/create_or_restore_wallet_view/create_or_restore_wallet_view.dart'; +import 'package:stackduo/pages_desktop_specific/my_stack_view/dialogs/desktop_expanding_wallet_card.dart'; import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/services/coins/manager.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; import 'package:stackduo/widgets/custom_buttons/app_bar_icon_button.dart'; import 'package:stackduo/widgets/icon_widgets/x_icon.dart'; +import 'package:stackduo/widgets/master_wallet_card.dart'; import 'package:stackduo/widgets/rounded_white_container.dart'; import 'package:stackduo/widgets/stack_text_field.dart'; import 'package:stackduo/widgets/textfield_icon_button.dart'; @@ -170,7 +173,7 @@ class _EthWalletsOverviewState extends ConsumerState { onPressed: () { Navigator.of(context).pushNamed( CreateOrRestoreWalletView.routeName, - arguments: widget.coin, + arguments: CoinEntity(widget.coin), ); }, ), @@ -260,40 +263,40 @@ class _EthWalletsOverviewState extends ConsumerState { itemBuilder: (_, index) { final element = data[index]; - // if (element.item1.hasTokenSupport) { - // if (isDesktop) { - // return DesktopExpandingWalletCard( - // key: Key( - // "${element.item1.walletName}_${element.item2.map((e) => e.address).join()}"), - // data: element, - // navigatorState: widget.navigatorState!, - // ); - // } else { - // return MasterWalletCard( - // walletId: element.item1.walletId, - // ); - // } - // } else { - return ConditionalParent( - condition: isDesktop, - builder: (child) => RoundedWhiteContainer( - padding: const EdgeInsets.symmetric( - vertical: 14, - horizontal: 20, + if (element.item1.hasTokenSupport) { + if (isDesktop) { + return DesktopExpandingWalletCard( + key: Key( + "${element.item1.walletName}_${element.item2.map((e) => e.address).join()}"), + data: element, + navigatorState: widget.navigatorState!, + ); + } else { + return MasterWalletCard( + walletId: element.item1.walletId, + ); + } + } else { + return ConditionalParent( + condition: isDesktop, + builder: (child) => RoundedWhiteContainer( + padding: const EdgeInsets.symmetric( + vertical: 14, + horizontal: 20, + ), + borderColor: Theme.of(context) + .extension()! + .backgroundAppBar, + child: child, ), - borderColor: Theme.of(context) - .extension()! - .backgroundAppBar, - child: child, - ), - child: SimpleWalletCard( - walletId: element.item1.walletId, - popPrevious: isDesktop, - desktopNavigatorState: - isDesktop ? widget.navigatorState : null, - ), - ); - // } + child: SimpleWalletCard( + walletId: element.item1.walletId, + popPrevious: isDesktop, + desktopNavigatorState: + isDesktop ? widget.navigatorState : null, + ), + ); + } }, separatorBuilder: (_, __) => SizedBox( height: isDesktop ? 10 : 8, diff --git a/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_address_card.dart b/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_address_card.dart index 6d60235203..e0773a58c4 100644 --- a/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_address_card.dart +++ b/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_address_card.dart @@ -1,5 +1,7 @@ import 'dart:io'; +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_details.dart b/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_details.dart index a81284895d..b5f34f8578 100644 --- a/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_details.dart +++ b/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_details.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/contact_entry.dart'; import 'package:stackduo/models/isar/models/isar_models.dart'; import 'package:stackduo/pages/address_book_views/subviews/add_new_contact_address_view.dart'; diff --git a/lib/pages_desktop_specific/coin_control/desktop_coin_control_use_dialog.dart b/lib/pages_desktop_specific/coin_control/desktop_coin_control_use_dialog.dart index b66d5758cb..b475dca83b 100644 --- a/lib/pages_desktop_specific/coin_control/desktop_coin_control_use_dialog.dart +++ b/lib/pages_desktop_specific/coin_control/desktop_coin_control_use_dialog.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/blockchain_data/utxo.dart'; import 'package:stackduo/pages_desktop_specific/coin_control/utxo_row.dart'; import 'package:stackduo/providers/global/wallets_provider.dart'; diff --git a/lib/pages_desktop_specific/coin_control/desktop_coin_control_view.dart b/lib/pages_desktop_specific/coin_control/desktop_coin_control_view.dart index bfda3654f7..a57246cb0c 100644 --- a/lib/pages_desktop_specific/coin_control/desktop_coin_control_view.dart +++ b/lib/pages_desktop_specific/coin_control/desktop_coin_control_view.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/blockchain_data/utxo.dart'; import 'package:stackduo/pages_desktop_specific/coin_control/freeze_button.dart'; import 'package:stackduo/pages_desktop_specific/coin_control/utxo_row.dart'; diff --git a/lib/pages_desktop_specific/coin_control/freeze_button.dart b/lib/pages_desktop_specific/coin_control/freeze_button.dart index 21b3ba11ed..5c79d881eb 100644 --- a/lib/pages_desktop_specific/coin_control/freeze_button.dart +++ b/lib/pages_desktop_specific/coin_control/freeze_button.dart @@ -1,7 +1,7 @@ import 'package:async/async.dart'; import 'package:flutter/material.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/blockchain_data/utxo.dart'; import 'package:stackduo/pages_desktop_specific/coin_control/utxo_row.dart'; import 'package:stackduo/utilities/logger.dart'; diff --git a/lib/pages_desktop_specific/coin_control/utxo_row.dart b/lib/pages_desktop_specific/coin_control/utxo_row.dart index fce3bb7103..426327d83d 100644 --- a/lib/pages_desktop_specific/coin_control/utxo_row.dart +++ b/lib/pages_desktop_specific/coin_control/utxo_row.dart @@ -1,15 +1,15 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/isar_models.dart'; import 'package:stackduo/pages/coin_control/utxo_details_view.dart'; -import 'package:stackduo/providers/global/locale_provider.dart'; import 'package:stackduo/providers/global/wallets_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; import 'package:stackduo/widgets/custom_buttons/blue_text_button.dart'; import 'package:stackduo/widgets/desktop/secondary_button.dart'; @@ -144,16 +144,12 @@ class _UtxoRowState extends ConsumerState { ), if (!widget.compact) Text( - "${Amount( - rawValue: BigInt.from(utxo.value), - fractionDigits: coin.decimals, - ).localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, + ref.watch(pAmountFormatter(coin)).format( + Amount( + rawValue: BigInt.from(utxo.value), + fractionDigits: coin.decimals, + ), ), - ), - )} ${coin.ticker}", textAlign: TextAlign.right, style: STextStyles.w600_14(context), ), @@ -170,16 +166,12 @@ class _UtxoRowState extends ConsumerState { mainAxisSize: MainAxisSize.min, children: [ Text( - "${Amount( - rawValue: BigInt.from(utxo.value), - fractionDigits: coin.decimals, - ).localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, + ref.watch(pAmountFormatter(coin)).format( + Amount( + rawValue: BigInt.from(utxo.value), + fractionDigits: coin.decimals, + ), ), - ), - )} ${coin.ticker}", textAlign: TextAlign.right, style: STextStyles.w600_14(context), ), diff --git a/lib/pages_desktop_specific/desktop_exchange/desktop_all_trades_view.dart b/lib/pages_desktop_specific/desktop_exchange/desktop_all_trades_view.dart index 75cc7710e9..e4fc117096 100644 --- a/lib/pages_desktop_specific/desktop_exchange/desktop_all_trades_view.dart +++ b/lib/pages_desktop_specific/desktop_exchange/desktop_all_trades_view.dart @@ -6,7 +6,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/exchange/change_now/exchange_transaction_status.dart'; import 'package:stackduo/models/exchange/response_objects/trade.dart'; import 'package:stackduo/models/isar/models/isar_models.dart'; @@ -288,7 +288,7 @@ class DesktopTradeRowCard extends ConsumerStatefulWidget { class _DesktopTradeRowCardState extends ConsumerState { late final String tradeId; - String _fetchIconAssetForStatus(String statusString, ThemeAssets assets) { + String _fetchIconAssetForStatus(String statusString, IThemeAssets assets) { ChangeNowTransactionStatus? status; try { if (statusString.toLowerCase().startsWith("waiting")) { @@ -528,7 +528,8 @@ class _DesktopTradeRowCardState extends ConsumerState { _fetchIconAssetForStatus( trade.status, ref.watch( - themeProvider.select((value) => value.assets)), + themeAssetsProvider, + ), ), ), width: 32, diff --git a/lib/pages_desktop_specific/desktop_exchange/exchange_steps/step_scaffold.dart b/lib/pages_desktop_specific/desktop_exchange/exchange_steps/step_scaffold.dart index 768f19b198..d176b210b9 100644 --- a/lib/pages_desktop_specific/desktop_exchange/exchange_steps/step_scaffold.dart +++ b/lib/pages_desktop_specific/desktop_exchange/exchange_steps/step_scaffold.dart @@ -374,7 +374,7 @@ class _StepScaffoldState extends ConsumerState { height: 48, ), Center( - child: QrImage( + child: QrImageView( // TODO: grab coin uri scheme from somewhere // data: "${coin.uriScheme}:$receivingAddress", data: ref.watch(desktopExchangeModelProvider diff --git a/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_choose_from_stack.dart b/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_choose_from_stack.dart index 6c60a6c293..0ea21f7213 100644 --- a/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_choose_from_stack.dart +++ b/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_choose_from_stack.dart @@ -2,12 +2,13 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:stackduo/providers/providers.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/widgets/custom_buttons/blue_text_button.dart'; import 'package:stackduo/widgets/desktop/secondary_button.dart'; import 'package:stackduo/widgets/icon_widgets/x_icon.dart'; @@ -278,14 +279,11 @@ class _BalanceDisplay extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final manager = ref.watch(walletsChangeNotifierProvider .select((value) => value.getManager(walletId))); - final locale = ref.watch( - localeServiceChangeNotifierProvider.select((value) => value.locale)); final Amount total = manager.balance.total; return Text( - "${total.localizedStringAsFixed(locale: locale)} " - "${manager.coin.ticker}", + ref.watch(pAmountFormatter(manager.coin)).format(total), style: STextStyles.desktopTextExtraSmall(context).copyWith( color: Theme.of(context).extension()!.textSubtitle1, ), diff --git a/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_trade_history.dart b/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_trade_history.dart index 7124269900..69f9e8ee52 100644 --- a/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_trade_history.dart +++ b/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_trade_history.dart @@ -5,21 +5,19 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; import 'package:stackduo/models/isar/models/blockchain_data/transaction.dart'; import 'package:stackduo/pages/exchange_view/trade_details_view.dart'; -import 'package:stackduo/pages_desktop_specific/desktop_exchange/desktop_all_trades_view.dart'; import 'package:stackduo/providers/exchange/trade_sent_from_stack_lookup_provider.dart'; import 'package:stackduo/providers/global/trades_service_provider.dart'; import 'package:stackduo/providers/global/wallets_provider.dart'; import 'package:stackduo/route_generator.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; -import 'package:stackduo/widgets/custom_buttons/blue_text_button.dart'; import 'package:stackduo/widgets/desktop/desktop_dialog.dart'; import 'package:stackduo/widgets/desktop/desktop_dialog_close_button.dart'; import 'package:stackduo/widgets/rounded_white_container.dart'; import 'package:stackduo/widgets/trade_card.dart'; -import '../../../db/main_db.dart'; +import '../../../db/isar/main_db.dart'; class DesktopTradeHistory extends ConsumerStatefulWidget { const DesktopTradeHistory({Key? key}) : super(key: key); diff --git a/lib/pages_desktop_specific/my_stack_view/desktop_favorite_wallets.dart b/lib/pages_desktop_specific/my_stack_view/desktop_favorite_wallets.dart index 7f8f1322a6..21236aa388 100644 --- a/lib/pages_desktop_specific/my_stack_view/desktop_favorite_wallets.dart +++ b/lib/pages_desktop_specific/my_stack_view/desktop_favorite_wallets.dart @@ -74,7 +74,6 @@ class DesktopFavoriteWallets extends ConsumerWidget { key: Key(walletName), width: cardWidth, height: cardHeight, - managerProvider: managerProvider, ); }) ], diff --git a/lib/pages_desktop_specific/my_stack_view/paynym/desktop_paynym_send_dialog.dart b/lib/pages_desktop_specific/my_stack_view/paynym/desktop_paynym_send_dialog.dart index 6501d57bd0..7fc2aef69f 100644 --- a/lib/pages_desktop_specific/my_stack_view/paynym/desktop_paynym_send_dialog.dart +++ b/lib/pages_desktop_specific/my_stack_view/paynym/desktop_paynym_send_dialog.dart @@ -13,6 +13,7 @@ import 'package:stackduo/providers/global/wallets_provider.dart'; import 'package:stackduo/themes/coin_icon_provider.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/barcode_scanner_interface.dart'; import 'package:stackduo/utilities/clipboard_interface.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; @@ -118,9 +119,26 @@ class _DesktopPaynymSendDialogState crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( - "${manager.balance.spendable.localizedStringAsFixed( - locale: locale, - )} ${coin.ticker}", + // !isFiro + // ? + ref + .watch(pAmountFormatter(coin)) + .format(manager.balance.spendable) + // : ref + // .watch( + // publicPrivateBalanceStateProvider + // .state, + // ) + // .state == + // "Private" + // ? ref.watch(pAmountFormatter(coin)).format( + // (manager.wallet as FiroWallet) + // .availablePrivateBalance()) + // : ref.watch(pAmountFormatter(coin)).format( + // (manager.wallet as FiroWallet) + // .availablePublicBalance(), + // ) + , style: STextStyles.titleBold12(context), textAlign: TextAlign.right, ), @@ -128,19 +146,15 @@ class _DesktopPaynymSendDialogState height: 2, ), Text( - "${(manager.balance.spendable.decimal * ref.watch( + "${((/*!isFiro ?*/ manager.balance.spendable.decimal /*: ref.watch(publicPrivateBalanceStateProvider.state).state == "Private" ? (manager.wallet as FiroWallet).availablePrivateBalance().decimal : (manager.wallet as FiroWallet).availablePublicBalance().decimal*/) * ref.watch( priceAnd24hChangeNotifierProvider.select( (value) => value.getPrice(coin).item1, ), - )).toAmount( - fractionDigits: 2, - ).localizedStringAsFixed( + )).toAmount(fractionDigits: 2).fiatString( locale: locale, - )} ${ref.watch( - prefsChangeNotifierProvider.select( - (value) => value.currency, - ), - )}", + )} ${ref.watch(prefsChangeNotifierProvider.select( + (value) => value.currency, + ))}", style: STextStyles.baseXS(context).copyWith( color: Theme.of(context) .extension()! diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart b/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart index aa26b837dd..58470932c4 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart @@ -214,13 +214,12 @@ class TablePriceInfo extends ConsumerWidget { final priceString = Amount.fromDecimal( tuple.item1, fractionDigits: 2, - ).localizedStringAsFixed( + ).fiatString( locale: ref .watch( localeServiceChangeNotifierProvider.notifier, ) .locale, - decimalPlaces: 2, ); final double percentChange = tuple.item2; diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_fee_dropdown.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_fee_dropdown.dart index 9cb3467241..c570320141 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_fee_dropdown.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_fee_dropdown.dart @@ -7,22 +7,25 @@ import 'package:stackduo/models/models.dart'; import 'package:stackduo/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart'; import 'package:stackduo/providers/global/wallets_provider.dart'; import 'package:stackduo/providers/ui/fee_rate_type_state_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/enums/fee_rate_type_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/widgets/animated_text.dart'; class DesktopFeeDropDown extends ConsumerStatefulWidget { const DesktopFeeDropDown({ Key? key, required this.walletId, + this.isToken = false, }) : super(key: key); final String walletId; + final bool isToken; @override ConsumerState createState() => _DesktopFeeDropDownState(); @@ -49,55 +52,114 @@ class _DesktopFeeDropDownState extends ConsumerState { }) async { switch (feeRateType) { case FeeRateType.fast: - if (ref.read(feeSheetSessionCacheProvider).fast[amount] == null) { + if (ref.read( + // widget.isToken + // ? tokenFeeSessionCacheProvider + // : + feeSheetSessionCacheProvider).fast[amount] == null) { + // if (widget.isToken == false) { final manager = ref.read(walletsChangeNotifierProvider).getManager(walletId); - if (coin == Coin.monero) { + if (coin == Coin.monero /*|| coin == Coin.wownero*/) { final fee = await manager.estimateFeeFor( amount, MoneroTransactionPriority.fast.raw!); ref.read(feeSheetSessionCacheProvider).fast[amount] = fee; + // } else if ((coin == Coin.firo || coin == Coin.firoTestNet) && + // ref.read(publicPrivateBalanceStateProvider.state).state != + // "Private") { + // ref.read(feeSheetSessionCacheProvider).fast[amount] = + // await (manager.wallet as FiroWallet) + // .estimateFeeForPublic(amount, feeRate); } else { ref.read(feeSheetSessionCacheProvider).fast[amount] = await manager.estimateFeeFor(amount, feeRate); } + // } else { + // final tokenWallet = ref.read(tokenServiceProvider)!; + // final fee = tokenWallet.estimateFeeFor(feeRate); + // ref.read(tokenFeeSessionCacheProvider).fast[amount] = fee; + // } } - - return ref.read(feeSheetSessionCacheProvider).fast[amount]!; + return ref.read( + // widget.isToken + // ? tokenFeeSessionCacheProvider + // : + feeSheetSessionCacheProvider).fast[amount]!; case FeeRateType.average: - if (ref.read(feeSheetSessionCacheProvider).average[amount] == null) { + if (ref.read( + // widget.isToken + // ? tokenFeeSessionCacheProvider + // : + feeSheetSessionCacheProvider).average[amount] == null) { + // if (widget.isToken == false) { final manager = ref.read(walletsChangeNotifierProvider).getManager(walletId); - if (coin == Coin.monero) { + if (coin == Coin.monero /*|| coin == Coin.wownero*/) { final fee = await manager.estimateFeeFor( amount, MoneroTransactionPriority.regular.raw!); ref.read(feeSheetSessionCacheProvider).average[amount] = fee; + // } else if ((coin == Coin.firo || coin == Coin.firoTestNet) && + // ref.read(publicPrivateBalanceStateProvider.state).state != + // "Private") { + // ref.read(feeSheetSessionCacheProvider).average[amount] = + // await (manager.wallet as FiroWallet) + // .estimateFeeForPublic(amount, feeRate); } else { ref.read(feeSheetSessionCacheProvider).average[amount] = await manager.estimateFeeFor(amount, feeRate); } + // } else { + // final tokenWallet = ref.read(tokenServiceProvider)!; + // final fee = tokenWallet.estimateFeeFor(feeRate); + // ref.read(tokenFeeSessionCacheProvider).average[amount] = fee; + // } } - - return ref.read(feeSheetSessionCacheProvider).average[amount]!; + return ref.read( + // widget.isToken + // ? tokenFeeSessionCacheProvider + // : + feeSheetSessionCacheProvider).average[amount]!; case FeeRateType.slow: - if (ref.read(feeSheetSessionCacheProvider).slow[amount] == null) { + if (ref.read( + // widget.isToken + // ? tokenFeeSessionCacheProvider + // : + feeSheetSessionCacheProvider).slow[amount] == null) { + // if (widget.isToken == false) { final manager = ref.read(walletsChangeNotifierProvider).getManager(walletId); - if (coin == Coin.monero) { + if (coin == Coin.monero /*|| coin == Coin.wownero*/) { final fee = await manager.estimateFeeFor( amount, MoneroTransactionPriority.slow.raw!); ref.read(feeSheetSessionCacheProvider).slow[amount] = fee; + // } else if ((coin == Coin.firo || coin == Coin.firoTestNet) && + // ref.read(publicPrivateBalanceStateProvider.state).state != + // "Private") { + // ref.read(feeSheetSessionCacheProvider).slow[amount] = + // await (manager.wallet as FiroWallet) + // .estimateFeeForPublic(amount, feeRate); } else { ref.read(feeSheetSessionCacheProvider).slow[amount] = await manager.estimateFeeFor(amount, feeRate); } + // } else { + // final tokenWallet = ref.read(tokenServiceProvider)!; + // final fee = tokenWallet.estimateFeeFor(feeRate); + // ref.read(tokenFeeSessionCacheProvider).slow[amount] = fee; + // } } - - return ref.read(feeSheetSessionCacheProvider).slow[amount]!; + return ref.read( + // widget.isToken + // ? tokenFeeSessionCacheProvider + // : + feeSheetSessionCacheProvider).slow[amount]!; + default: + return Amount.zero; } } @@ -119,65 +181,47 @@ class _DesktopFeeDropDownState extends ConsumerState { .select((value) => value.getManager(walletId))); return FutureBuilder( - future: manager.fees, - builder: (context, AsyncSnapshot snapshot) { - if (snapshot.connectionState == ConnectionState.done && - snapshot.hasData) { - feeObject = snapshot.data!; - } - return DropdownButtonHideUnderline( - child: DropdownButton2( - offset: const Offset(0, -10), - isExpanded: true, - dropdownElevation: 0, - value: ref.watch(feeRateTypeStateProvider.state).state, - // selectedItemBuilder: (s) { - // return [ - // ...FeeRateType.values.map( - // (e) => DropdownMenuItem( - // value: e, - // child: FeeDropDownChild( - // feeObject: feeObject, - // feeRateType: e, - // walletId: walletId, - // amount: amount, - // feeFor: feeFor, - // isSelected: true, - // ), - // ), - // ), - // ]; - // }, - items: [ - ...FeeRateType.values.map( - (e) => DropdownMenuItem( - value: e, - child: FeeDropDownChild( - feeObject: feeObject, - feeRateType: e, - walletId: walletId, - feeFor: feeFor, - isSelected: false, - ), + future: manager.fees, + builder: (context, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.done && + snapshot.hasData) { + feeObject = snapshot.data!; + } + return DropdownButtonHideUnderline( + child: DropdownButton2( + isExpanded: true, + value: ref.watch(feeRateTypeStateProvider.state).state, + items: [ + ...FeeRateType.values.map( + (e) => DropdownMenuItem( + value: e, + child: FeeDropDownChild( + feeObject: feeObject, + feeRateType: e, + walletId: walletId, + feeFor: feeFor, + isSelected: false, ), ), - ], - onChanged: (newRateType) { - if (newRateType is FeeRateType) { - ref.read(feeRateTypeStateProvider.state).state = newRateType; - } - }, + ), + ], + onChanged: (newRateType) { + if (newRateType is FeeRateType) { + ref.read(feeRateTypeStateProvider.state).state = newRateType; + } + }, + iconStyleData: IconStyleData( icon: SvgPicture.asset( Assets.svg.chevronDown, width: 12, height: 6, color: Theme.of(context).extension()!.textDark3, ), - buttonPadding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 8, - ), - buttonDecoration: BoxDecoration( + ), + dropdownStyleData: DropdownStyleData( + offset: const Offset(0, -10), + elevation: 0, + decoration: BoxDecoration( color: Theme.of(context) .extension()! .textFieldDefaultBG, @@ -185,17 +229,17 @@ class _DesktopFeeDropDownState extends ConsumerState { Constants.size.circularBorderRadius, ), ), - dropdownDecoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .textFieldDefaultBG, - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, - ), + ), + menuItemStyleData: const MenuItemStyleData( + padding: EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, ), ), - ); - }); + ), + ); + }, + ); } } @@ -290,10 +334,10 @@ class FeeDropDownChild extends ConsumerWidget { children: [ Text( "${feeRateType.prettyName} " - "(~${snapshot.data!.decimal.toStringAsFixed( - manager.coin.decimals, - )} " - "${manager.coin.ticker})", + "(~${ref.watch(pAmountFormatter(manager.coin)).format( + snapshot.data!, + indicatePrecisionLoss: false, + )})", style: STextStyles.desktopTextExtraExtraSmall(context).copyWith( color: Theme.of(context) @@ -304,6 +348,9 @@ class FeeDropDownChild extends ConsumerWidget { ), if (feeObject != null) Text( + // manager.coin == Coin.ethereum + // ? "" + // : estimatedTimeToBeIncludedInNextBlock( Constants.targetBlockTimeInSeconds(manager.coin), feeRateType == FeeRateType.fast diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_receive.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_receive.dart index efa1cb4e1e..ae85903c21 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_receive.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_receive.dart @@ -10,6 +10,7 @@ import 'package:stackduo/pages/receive_view/generate_receiving_uri_qr_code_view. import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/route_generator.dart'; import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/utilities/address_utils.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/clipboard_interface.dart'; import 'package:stackduo/utilities/constants.dart'; @@ -27,10 +28,12 @@ class DesktopReceive extends ConsumerStatefulWidget { const DesktopReceive({ Key? key, required this.walletId, + this.contractAddress, this.clipboard = const ClipboardWrapper(), }) : super(key: key); final String walletId; + final String? contractAddress; final ClipboardInterface clipboard; @override @@ -148,7 +151,15 @@ class _DesktopReceiveState extends ConsumerState { Row( children: [ Text( - "Your ${coin.ticker} address", + "Your ${ + // widget.contractAddress == null ? + coin.ticker + // : ref.watch( + // tokenServiceProvider.select( + // (value) => value!.tokenContract.symbol, + // ), + // ) + } address", style: STextStyles.itemSubtitle(context), ), const Spacer(), @@ -210,8 +221,12 @@ class _DesktopReceiveState extends ConsumerState { height: 32, ), Center( - child: QrImage( - data: "${coin.uriScheme}:$receivingAddress", + child: QrImageView( + data: AddressUtils.buildUriString( + coin, + receivingAddress, + {}, + ), size: 200, foregroundColor: Theme.of(context).extension()!.accentColorDark, diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart index 690aace106..6fdbe6512d 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:bip47/bip47.dart'; +import 'package:cw_core/monero_transaction_priority.dart'; import 'package:decimal/decimal.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -23,20 +24,27 @@ import 'package:stackduo/services/mixins/paynym_wallet_interface.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/address_utils.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; +import 'package:stackduo/utilities/amount/amount_input_formatter.dart'; +import 'package:stackduo/utilities/amount/amount_unit.dart'; import 'package:stackduo/utilities/barcode_scanner_interface.dart'; import 'package:stackduo/utilities/clipboard_interface.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; +import 'package:stackduo/utilities/enums/fee_rate_type_enum.dart'; import 'package:stackduo/utilities/logger.dart'; import 'package:stackduo/utilities/prefs.dart'; import 'package:stackduo/utilities/text_styles.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/animated_text.dart'; +import 'package:stackduo/widgets/conditional_parent.dart'; import 'package:stackduo/widgets/custom_buttons/blue_text_button.dart'; import 'package:stackduo/widgets/desktop/desktop_dialog.dart'; import 'package:stackduo/widgets/desktop/desktop_dialog_close_button.dart'; +import 'package:stackduo/widgets/desktop/desktop_fee_dialog.dart'; import 'package:stackduo/widgets/desktop/primary_button.dart'; import 'package:stackduo/widgets/desktop/secondary_button.dart'; +import 'package:stackduo/widgets/fee_slider.dart'; import 'package:stackduo/widgets/icon_widgets/addressbook_icon.dart'; import 'package:stackduo/widgets/icon_widgets/clipboard_icon.dart'; import 'package:stackduo/widgets/icon_widgets/x_icon.dart'; @@ -97,6 +105,17 @@ class _DesktopSendState extends ConsumerState { bool get isPaynymSend => widget.accountLite != null; + bool isCustomFee = false; + int customFeeRate = 1; + (FeeRateType, String?, String?)? feeSelectionResult; + + final stringsToLoopThrough = [ + "Calculating", + "Calculating.", + "Calculating..", + "Calculating...", + ]; + Future previewSend() async { final manager = ref.read(walletsChangeNotifierProvider).getManager(walletId); @@ -253,6 +272,7 @@ class _DesktopSendState extends ConsumerState { isSegwit: widget.accountLite!.segwit, amount: amount, args: { + "satsPerVByte": isCustomFee ? customFeeRate : null, "feeRate": feeRate, "UTXOs": (manager.hasCoinControlSupport && coinControlEnabled && @@ -267,6 +287,7 @@ class _DesktopSendState extends ConsumerState { amount: amount, args: { "feeRate": ref.read(feeRateTypeStateProvider), + "satsPerVByte": isCustomFee ? customFeeRate : null, "UTXOs": (manager.hasCoinControlSupport && coinControlEnabled && ref.read(desktopUseUTXOs).isNotEmpty) @@ -397,15 +418,11 @@ class _DesktopSendState extends ConsumerState { void _cryptoAmountChanged() async { if (!_cryptoAmountChangeLock) { - final String cryptoAmount = cryptoAmountController.text; - if (cryptoAmount.isNotEmpty && - cryptoAmount != "." && - cryptoAmount != ",") { - _amountToSend = cryptoAmount.contains(",") - ? Decimal.parse(cryptoAmount.replaceFirst(",", ".")) - .toAmount(fractionDigits: coin.decimals) - : Decimal.parse(cryptoAmount) - .toAmount(fractionDigits: coin.decimals); + final cryptoAmount = ref.read(pAmountFormatter(coin)).tryParse( + cryptoAmountController.text, + ); + if (cryptoAmount != null) { + _amountToSend = cryptoAmount; if (_cachedAmountToSend != null && _cachedAmountToSend == _amountToSend) { return; @@ -420,7 +437,7 @@ class _DesktopSendState extends ConsumerState { if (price > Decimal.zero) { final String fiatAmountString = (_amountToSend!.decimal * price) .toAmount(fractionDigits: 2) - .localizedStringAsFixed( + .fiatString( locale: ref.read(localeServiceChangeNotifierProvider).locale, ); @@ -474,22 +491,17 @@ class _DesktopSendState extends ConsumerState { } if (private && _privateBalanceString != null) { return Text( - "$_privateBalanceString ${coin.ticker}", + "$_privateBalanceString", style: STextStyles.itemSubtitle(context), ); } else if (!private && _publicBalanceString != null) { return Text( - "$_publicBalanceString ${coin.ticker}", + "$_publicBalanceString", style: STextStyles.itemSubtitle(context), ); } else { return AnimatedText( - stringsToLoopThrough: const [ - "Loading balance", - "Loading balance.", - "Loading balance..", - "Loading balance...", - ], + stringsToLoopThrough: stringsToLoopThrough, style: STextStyles.itemSubtitle(context), ); } @@ -528,11 +540,9 @@ class _DesktopSendState extends ConsumerState { final amount = Decimal.parse(results["amount"]!).toAmount( fractionDigits: coin.decimals, ); - cryptoAmountController.text = amount.localizedStringAsFixed( - locale: ref.read(localeServiceChangeNotifierProvider).locale, - decimalPlaces: Constants.decimalPlacesForCoin(coin), - ); - amount.toString(); + cryptoAmountController.text = ref + .read(pAmountFormatter(coin)) + .format(amount, withUnitName: false); _amountToSend = amount; } @@ -582,15 +592,12 @@ class _DesktopSendState extends ConsumerState { } void fiatTextFieldOnChanged(String baseAmountString) { - if (baseAmountString.isNotEmpty && - baseAmountString != "." && - baseAmountString != ",") { - final baseAmount = baseAmountString.contains(",") - ? Decimal.parse(baseAmountString.replaceFirst(",", ".")) - .toAmount(fractionDigits: 2) - : Decimal.parse(baseAmountString).toAmount(fractionDigits: 2); - - var _price = + final baseAmount = Amount.tryParseFiatString( + baseAmountString, + locale: ref.read(localeServiceChangeNotifierProvider).locale, + ); + if (baseAmount != null) { + final _price = ref.read(priceAnd24hChangeNotifierProvider).getPrice(coin).item1; if (_price == Decimal.zero) { @@ -609,10 +616,10 @@ class _DesktopSendState extends ConsumerState { Logging.instance.log("it changed $_amountToSend $_cachedAmountToSend", level: LogLevel.Info); - final amountString = _amountToSend!.localizedStringAsFixed( - locale: ref.read(localeServiceChangeNotifierProvider).locale, - decimalPlaces: coin.decimals, - ); + final amountString = ref.read(pAmountFormatter(coin)).format( + _amountToSend!, + withUnitName: false, + ); _cryptoAmountChangeLock = true; cryptoAmountController.text = amountString; @@ -815,12 +822,21 @@ class _DesktopSendState extends ConsumerState { ), textAlign: TextAlign.right, inputFormatters: [ - // regex to validate a crypto amount with 8 decimal places - TextInputFormatter.withFunction((oldValue, newValue) => - RegExp(r'^([0-9]*[,.]?[0-9]{0,8}|[,.][0-9]{0,8})$') - .hasMatch(newValue.text) - ? newValue - : oldValue), + AmountInputFormatter( + decimals: coin.decimals, + unit: ref.watch(pAmountUnit(coin)), + locale: ref.watch( + localeServiceChangeNotifierProvider.select( + (value) => value.locale, + ), + ), + ), + // // regex to validate a crypto amount with 8 decimal places + // TextInputFormatter.withFunction((oldValue, newValue) => + // RegExp(r'^([0-9]*[,.]?[0-9]{0,8}|[,.][0-9]{0,8})$') + // .hasMatch(newValue.text) + // ? newValue + // : oldValue), ], onChanged: (newValue) {}, decoration: InputDecoration( @@ -840,7 +856,7 @@ class _DesktopSendState extends ConsumerState { child: Padding( padding: const EdgeInsets.all(12), child: Text( - coin.ticker, + ref.watch(pAmountUnit(coin)).unitForCoin(coin), style: STextStyles.smallMed14(context).copyWith( color: Theme.of(context) .extension()! @@ -872,12 +888,20 @@ class _DesktopSendState extends ConsumerState { ), textAlign: TextAlign.right, inputFormatters: [ - // regex to validate a fiat amount with 2 decimal places - TextInputFormatter.withFunction((oldValue, newValue) => - RegExp(r'^([0-9]*[,.]?[0-9]{0,2}|[,.][0-9]{0,2})$') - .hasMatch(newValue.text) - ? newValue - : oldValue), + AmountInputFormatter( + decimals: 2, + locale: ref.watch( + localeServiceChangeNotifierProvider.select( + (value) => value.locale, + ), + ), + ), + // // regex to validate a fiat amount with 2 decimal places + // TextInputFormatter.withFunction((oldValue, newValue) => + // RegExp(r'^([0-9]*[,.]?[0-9]{0,2}|[,.][0-9]{0,2})$') + // .hasMatch(newValue.text) + // ? newValue + // : oldValue), ], onChanged: fiatTextFieldOnChanged, decoration: InputDecoration( @@ -1134,77 +1158,179 @@ class _DesktopSendState extends ConsumerState { } }, ), - // const SizedBox( - // height: 20, - // ), - // Text( - // "Note (optional)", - // style: STextStyles.desktopTextExtraSmall(context).copyWith( - // color: Theme.of(context) - // .extension()! - // .textFieldActiveSearchIconRight, - // ), - // textAlign: TextAlign.left, - // ), - // const SizedBox( - // height: 10, - // ), - // ClipRRect( - // borderRadius: BorderRadius.circular( - // Constants.size.circularBorderRadius, - // ), - // child: TextField( - // minLines: 1, - // maxLines: 5, - // autocorrect: Util.isDesktop ? false : true, - // enableSuggestions: Util.isDesktop ? false : true, - // controller: noteController, - // focusNode: _noteFocusNode, - // style: STextStyles.desktopTextExtraSmall(context).copyWith( - // color: Theme.of(context) - // .extension()! - // .textFieldActiveText, - // height: 1.8, - // ), - // onChanged: (_) => setState(() {}), - // decoration: standardInputDecoration( - // "Type something...", - // _noteFocusNode, - // context, - // desktopMed: true, - // ).copyWith( - // contentPadding: const EdgeInsets.only( - // left: 16, - // top: 11, - // bottom: 12, - // right: 5, - // ), - // suffixIcon: noteController.text.isNotEmpty - // ? Padding( - // padding: const EdgeInsets.only(right: 0), - // child: UnconstrainedBox( - // child: Row( - // children: [ - // TextFieldIconButton( - // child: const XIcon(), - // onTap: () async { - // setState(() { - // noteController.text = ""; - // }); - // }, - // ), - // ], - // ), - // ), - // ) - // : null, - // ), - // ), - // ), if (!isPaynymSend) const SizedBox( height: 20, ), + // if (!([Coin.nano, Coin.banano, Coin.epicCash].contains(coin))) + ConditionalParent( + condition: coin.isElectrumXCoin, + builder: (child) => Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + child, + CustomTextButton( + text: "Edit", + onTap: () async { + feeSelectionResult = await showDialog< + ( + FeeRateType, + String?, + String?, + )?>( + context: context, + builder: (_) => DesktopFeeDialog( + walletId: walletId, + ), + ); + + if (feeSelectionResult != null) { + if (isCustomFee && + feeSelectionResult!.$1 != FeeRateType.custom) { + isCustomFee = false; + } else if (!isCustomFee && + feeSelectionResult!.$1 == FeeRateType.custom) { + isCustomFee = true; + } + } + + setState(() {}); + }, + ), + ], + ), + child: Text( + "Transaction fee" + "${isCustomFee ? "" : " (${/*coin == Coin.ethereum ? "max" : */ "estimated"})"}", + style: STextStyles.desktopTextExtraSmall(context).copyWith( + color: Theme.of(context) + .extension()! + .textFieldActiveSearchIconRight, + ), + textAlign: TextAlign.left, + ), + ), + // if (!([Coin.nano, Coin.banano, Coin.epicCash].contains(coin))) + const SizedBox( + height: 10, + ), + // if (!([Coin.nano, Coin.banano, Coin.epicCash].contains(coin))) + if (!isCustomFee) + (feeSelectionResult?.$2 == null) + ? FutureBuilder( + future: ref.watch( + walletsChangeNotifierProvider.select( + (value) => value.getManager(walletId).fees, + ), + ), + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.done && + snapshot.hasData) { + return DesktopFeeItem( + feeObject: snapshot.data, + feeRateType: FeeRateType.average, + walletId: walletId, + feeFor: ({ + required Amount amount, + required FeeRateType feeRateType, + required int feeRate, + required Coin coin, + }) async { + if (ref + .read(feeSheetSessionCacheProvider) + .average[amount] == + null) { + final manager = ref + .read(walletsChangeNotifierProvider) + .getManager(walletId); + + if (coin == + Coin.monero /* || coin == Coin.wownero*/) { + final fee = await manager.estimateFeeFor(amount, + MoneroTransactionPriority.regular.raw!); + ref + .read(feeSheetSessionCacheProvider) + .average[amount] = fee; + // } else if ((coin == Coin.firo || + // coin == Coin.firoTestNet) && + // ref + // .read( + // publicPrivateBalanceStateProvider + // .state) + // .state != + // "Private") { + // ref + // .read(feeSheetSessionCacheProvider) + // .average[amount] = + // await (manager.wallet as FiroWallet) + // .estimateFeeForPublic(amount, feeRate); + } else { + ref + .read(feeSheetSessionCacheProvider) + .average[amount] = + await manager.estimateFeeFor(amount, feeRate); + } + } + return ref + .read(feeSheetSessionCacheProvider) + .average[amount]!; + }, + isSelected: true, + ); + } else { + return Row( + children: [ + AnimatedText( + stringsToLoopThrough: stringsToLoopThrough, + style: + STextStyles.desktopTextExtraExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textFieldActiveText, + ), + ), + ], + ); + } + }, + ) + : Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + feeSelectionResult?.$2 ?? "", + style: STextStyles.desktopTextExtraExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textFieldActiveText, + ), + textAlign: TextAlign.left, + ), + Text( + feeSelectionResult?.$3 ?? "", + style: STextStyles.desktopTextExtraExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textFieldActiveSearchIconRight, + ), + ), + ], + ), + if (isCustomFee) + Padding( + padding: const EdgeInsets.only( + bottom: 12, + top: 16, + ), + child: FeeSlider( + onSatVByteChanged: (rate) { + customFeeRate = rate; + }, + ), + ), const SizedBox( height: 36, ), diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart index 7f1839987d..a6db300eee 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart @@ -134,7 +134,12 @@ class _DesktopWalletFeaturesState extends ConsumerState { ); final showMore = manager.hasPaynymSupport || - manager.hasCoinControlSupport || + (manager.hasCoinControlSupport && + ref.watch( + prefsChangeNotifierProvider.select( + (value) => value.enableCoinControl, + ), + )) || manager.hasWhirlpoolSupport; return Row( diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_summary.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_summary.dart index 49b0e3068a..3d02fcbcb5 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_summary.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_summary.dart @@ -6,21 +6,23 @@ import 'package:stackduo/pages_desktop_specific/my_stack_view/wallet_view/sub_wi import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/providers/wallet/wallet_balance_toggle_state_provider.dart'; import 'package:stackduo/services/event_bus/events/global/wallet_sync_status_changed_event.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/enums/wallet_balance_toggle_state.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; class DesktopWalletSummary extends ConsumerStatefulWidget { const DesktopWalletSummary({ Key? key, required this.walletId, required this.initialSyncStatus, + this.isToken = false, }) : super(key: key); final String walletId; final WalletSyncStatus initialSyncStatus; + final bool isToken; @override ConsumerState createState() => @@ -56,26 +58,59 @@ class _WDesktopWalletSummaryState extends ConsumerState { final baseCurrency = ref .watch(prefsChangeNotifierProvider.select((value) => value.currency)); - final priceTuple = ref.watch(priceAnd24hChangeNotifierProvider - .select((value) => value.getPrice(coin))); + final tokenContract = + // widget.isToken + // ? ref + // .watch(tokenServiceProvider.select((value) => value!.tokenContract)) + // : + null; + + final priceTuple = + // widget.isToken + // ? ref.watch(priceAnd24hChangeNotifierProvider + // .select((value) => value.getTokenPrice(tokenContract!.address))) + // : + ref.watch(priceAnd24hChangeNotifierProvider + .select((value) => value.getPrice(coin))); final _showAvailable = ref.watch(walletBalanceToggleStateProvider.state).state == WalletBalanceToggleState.available; - final unit = coin.ticker; - final decimalPlaces = coin.decimals; - - Balance balance = ref.watch(walletsChangeNotifierProvider - .select((value) => value.getManager(walletId).balance)); + Balance balance = + // widget.isToken + // ? ref.watch(tokenServiceProvider.select((value) => value!.balance)) + // : + ref.watch(walletsChangeNotifierProvider + .select((value) => value.getManager(walletId).balance)); Amount balanceToShow; - + // if (coin == Coin.firo || coin == Coin.firoTestNet) { + // Balance? balanceSecondary = ref + // .watch( + // walletsChangeNotifierProvider.select( + // (value) => + // value.getManager(widget.walletId).wallet as FiroWallet?, + // ), + // ) + // ?.balancePrivate; + // final showPrivate = + // ref.watch(walletPrivateBalanceToggleStateProvider.state).state == + // WalletBalanceToggleState.available; + // + // if (_showAvailable) { + // balanceToShow = + // showPrivate ? balanceSecondary!.spendable : balance.spendable; + // } else { + // balanceToShow = showPrivate ? balanceSecondary!.total : balance.total; + // } + // } else { if (_showAvailable) { balanceToShow = balance.spendable; } else { balanceToShow = balance.total; } + // } return Consumer( builder: (context, ref, __) { @@ -88,10 +123,9 @@ class _WDesktopWalletSummaryState extends ConsumerState { FittedBox( fit: BoxFit.scaleDown, child: Text( - "${balanceToShow.localizedStringAsFixed( - locale: locale, - decimalPlaces: decimalPlaces, - )} $unit", + ref + .watch(pAmountFormatter(coin)) + .format(balanceToShow, ethContract: tokenContract), style: STextStyles.desktopH3(context), ), ), @@ -100,9 +134,8 @@ class _WDesktopWalletSummaryState extends ConsumerState { "${Amount.fromDecimal( priceTuple.item1 * balanceToShow.decimal, fractionDigits: 2, - ).localizedStringAsFixed( + ).fiatString( locale: locale, - decimalPlaces: 2, )} $baseCurrency", style: STextStyles.desktopTextExtraSmall(context).copyWith( color: Theme.of(context) diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/my_wallet.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/my_wallet.dart index 325759e299..e4bff727e5 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/my_wallet.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/my_wallet.dart @@ -1,7 +1,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:stackduo/pages/wallet_view/sub_widgets/transactions_list.dart'; import 'package:stackduo/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_receive.dart'; import 'package:stackduo/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart'; +import 'package:stackduo/providers/global/wallets_provider.dart'; import 'package:stackduo/widgets/custom_tab_view.dart'; import 'package:stackduo/widgets/rounded_white_container.dart'; @@ -9,9 +11,11 @@ class MyWallet extends ConsumerStatefulWidget { const MyWallet({ Key? key, required this.walletId, + this.contractAddress, }) : super(key: key); final String walletId; + final String? contractAddress; @override ConsumerState createState() => _MyWalletState(); @@ -27,7 +31,8 @@ class _MyWalletState extends ConsumerState { @override void initState() { - // isEth = ref + isEth = false; + //ref // .read(walletsChangeNotifierProvider) // .getManager(widget.walletId) // .coin == @@ -50,37 +55,47 @@ class _MyWalletState extends ConsumerState { child: CustomTabView( titles: titles, children: [ + // widget.contractAddress == null + // ? Padding( padding: const EdgeInsets.all(20), child: DesktopSend( walletId: widget.walletId, ), - ), + ) + // : Padding( + // padding: const EdgeInsets.all(20), + // child: DesktopTokenSend( + // walletId: widget.walletId, + // ), + // ) + , Padding( padding: const EdgeInsets.all(20), child: DesktopReceive( walletId: widget.walletId, + contractAddress: widget.contractAddress, ), ), - // if (isEth && widget.contractAddress == null) - // Padding( - // padding: const EdgeInsets.only(top: 8.0), - // child: ConstrainedBox( - // constraints: BoxConstraints( - // maxHeight: MediaQuery.of(context).size.height - 362, - // ), - // child: TransactionsList( - // walletId: widget.walletId, - // managerProvider: ref.watch( - // walletsChangeNotifierProvider.select( - // (value) => value.getManagerProvider( - // widget.walletId, - // ), - // ), - // ), - // ), - // ), - // ), + if (isEth && widget.contractAddress == null) + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: ConstrainedBox( + constraints: BoxConstraints( + maxHeight: MediaQuery.of(context).size.height - 362, + ), + child: TransactionsList( + walletId: widget.walletId, + managerProvider: ref.watch( + walletsChangeNotifierProvider.select( + (value) => value.getManagerProvider( + widget.walletId, + ), + ), + ), + ), + ), + ), ], ), ), diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/qr_code_desktop_popup_content.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/qr_code_desktop_popup_content.dart index 8dadd748a3..7c7ac6381b 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/qr_code_desktop_popup_content.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/qr_code_desktop_popup_content.dart @@ -20,16 +20,16 @@ class QRCodeDesktopPopupContent extends StatelessWidget { maxWidth: 614, child: Column( children: [ - Row( + const Row( mainAxisAlignment: MainAxisAlignment.end, - children: const [ + children: [ DesktopDialogCloseButton(), ], ), const SizedBox( height: 14, ), - QrImage( + QrImageView( data: value, size: 300, foregroundColor: diff --git a/lib/pages_desktop_specific/password/delete_password_warning_view.dart b/lib/pages_desktop_specific/password/delete_password_warning_view.dart index 0e08f5e8f9..7677165e56 100644 --- a/lib/pages_desktop_specific/password/delete_password_warning_view.dart +++ b/lib/pages_desktop_specific/password/delete_password_warning_view.dart @@ -5,7 +5,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:hive/hive.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:isar/isar.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/notifications/show_flush_bar.dart'; import 'package:stackduo/pages/intro_view.dart'; import 'package:stackduo/utilities/assets.dart'; @@ -42,7 +43,17 @@ class _ForgotPasswordDesktopViewState try { await Hive.close(); - if (Platform.isWindows || Platform.isLinux) { + if (Platform.isWindows) { + final xmrDir = Directory("${appRoot.path}/wallets"); + if (xmrDir.existsSync()) { + await xmrDir.delete(recursive: true); + } + + await Isar.getInstance("desktopStore")?.close(deleteFromDisk: true); + + await (await StackFileSystem.applicationHiveDirectory()) + .delete(recursive: true); + } else if (Platform.isLinux) { await appRoot.delete(recursive: true); } else { // macos in ipad mode diff --git a/lib/pages_desktop_specific/password/desktop_login_view.dart b/lib/pages_desktop_specific/password/desktop_login_view.dart index 1ea7e1da7b..c069c205ab 100644 --- a/lib/pages_desktop_specific/password/desktop_login_view.dart +++ b/lib/pages_desktop_specific/password/desktop_login_view.dart @@ -3,7 +3,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/notifications/show_flush_bar.dart'; import 'package:stackduo/pages_desktop_specific/desktop_home_view.dart'; import 'package:stackduo/pages_desktop_specific/password/forgot_password_desktop_view.dart'; @@ -246,7 +246,7 @@ class _DesktopLoginViewState extends ConsumerState { ), suffixIcon: UnconstrainedBox( child: SizedBox( - height: 70, + height: 40, child: Row( children: [ const SizedBox( diff --git a/lib/pages_desktop_specific/password/forgotten_passphrase_restore_from_swb.dart b/lib/pages_desktop_specific/password/forgotten_passphrase_restore_from_swb.dart index bd08a438d5..ddcf81c4a2 100644 --- a/lib/pages_desktop_specific/password/forgotten_passphrase_restore_from_swb.dart +++ b/lib/pages_desktop_specific/password/forgotten_passphrase_restore_from_swb.dart @@ -5,8 +5,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import 'package:hive_flutter/hive_flutter.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/notifications/show_flush_bar.dart'; import 'package:stackduo/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart'; import 'package:stackduo/pages/settings_views/global_settings_view/stack_backup_views/helpers/swb_file_system.dart'; @@ -15,12 +14,12 @@ import 'package:stackduo/pages_desktop_specific/password/create_password_view.da import 'package:stackduo/providers/desktop/storage_crypto_handler_provider.dart'; import 'package:stackduo/providers/global/secure_store_provider.dart'; import 'package:stackduo/providers/global/wallets_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/flutter_secure_storage_interface.dart'; import 'package:stackduo/utilities/logger.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/widgets/custom_buttons/app_bar_icon_button.dart'; import 'package:stackduo/widgets/desktop/desktop_app_bar.dart'; import 'package:stackduo/widgets/desktop/desktop_dialog.dart'; @@ -203,8 +202,8 @@ class _ForgottenPassphraseRestoreFromSWBState await (ref.read(secureStoreProvider).store as DesktopSecureStore) .close(); ref.refresh(secureStoreProvider); + await ref.read(storageCryptoHandlerProvider).deleteBox(); ref.refresh(storageCryptoHandlerProvider); - await Hive.deleteBoxFromDisk(DB.boxNameDesktopData); await DB.instance.init(); if (mounted) { Navigator.of(context) diff --git a/lib/pages_desktop_specific/settings/desktop_settings_view.dart b/lib/pages_desktop_specific/settings/desktop_settings_view.dart index d83dbb98c1..aff625a52d 100644 --- a/lib/pages_desktop_specific/settings/desktop_settings_view.dart +++ b/lib/pages_desktop_specific/settings/desktop_settings_view.dart @@ -73,10 +73,10 @@ class _DesktopSettingsViewState extends ConsumerState { Widget build(BuildContext context) { return DesktopScaffold( background: Theme.of(context).extension()!.background, - appBar: DesktopAppBar( + appBar: const DesktopAppBar( isCompactHeight: true, leading: Row( - children: const [ + children: [ SizedBox( width: 24, height: 24, @@ -87,7 +87,10 @@ class _DesktopSettingsViewState extends ConsumerState { ), body: Row( children: [ - const SettingsMenu(), + const Padding( + padding: EdgeInsets.all(15.0), + child: SettingsMenu(), + ), Expanded( child: contentViews[ ref.watch(selectedSettingsMenuItemStateProvider.state).state], diff --git a/lib/pages_desktop_specific/settings/settings_menu.dart b/lib/pages_desktop_specific/settings/settings_menu.dart index 4f5562c5ad..2cc746d325 100644 --- a/lib/pages_desktop_specific/settings/settings_menu.dart +++ b/lib/pages_desktop_specific/settings/settings_menu.dart @@ -35,10 +35,10 @@ class _SettingsMenuState extends ConsumerState { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets.only(left: 15), + SizedBox( + width: 250, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.stretch, children: [ for (int i = 0; i < labels.length; i++) Column( @@ -73,157 +73,7 @@ class _SettingsMenuState extends ConsumerState { .state = newValue, ), ], - ) - - // SettingsMenuItem( - // icon: SvgPicture.asset( - // Assets.svg.polygon, - // width: 11, - // height: 11, - // color: selectedMenuItem == 0 - // ? Theme.of(context) - // .extension()! - // .accentColorBlue - // : Colors.transparent, - // ), - // label: "Backup and restore", - // value: 0, - // group: selectedMenuItem, - // onChanged: updateSelectedMenuItem, - // ), - // const SizedBox( - // height: 2, - // ), - // SettingsMenuItem( - // icon: SvgPicture.asset( - // Assets.svg.polygon, - // width: 11, - // height: 11, - // color: selectedMenuItem == 1 - // ? Theme.of(context) - // .extension()! - // .accentColorBlue - // : Colors.transparent, - // ), - // label: "Security", - // value: 1, - // group: selectedMenuItem, - // onChanged: updateSelectedMenuItem, - // ), - // const SizedBox( - // height: 2, - // ), - // SettingsMenuItem( - // icon: SvgPicture.asset( - // Assets.svg.polygon, - // width: 11, - // height: 11, - // color: selectedMenuItem == 2 - // ? Theme.of(context) - // .extension()! - // .accentColorBlue - // : Colors.transparent, - // ), - // label: "Currency", - // value: 2, - // group: selectedMenuItem, - // onChanged: updateSelectedMenuItem, - // ), - // const SizedBox( - // height: 2, - // ), - // SettingsMenuItem( - // icon: SvgPicture.asset( - // Assets.svg.polygon, - // width: 11, - // height: 11, - // color: selectedMenuItem == 3 - // ? Theme.of(context) - // .extension()! - // .accentColorBlue - // : Colors.transparent, - // ), - // label: "Language", - // value: 3, - // group: selectedMenuItem, - // onChanged: updateSelectedMenuItem, - // ), - // const SizedBox( - // height: 2, - // ), - // SettingsMenuItem( - // icon: SvgPicture.asset( - // Assets.svg.polygon, - // width: 11, - // height: 11, - // color: selectedMenuItem == 4 - // ? Theme.of(context) - // .extension()! - // .accentColorBlue - // : Colors.transparent, - // ), - // label: "Nodes", - // value: 4, - // group: selectedMenuItem, - // onChanged: updateSelectedMenuItem, - // ), - // const SizedBox( - // height: 2, - // ), - // SettingsMenuItem( - // icon: SvgPicture.asset( - // Assets.svg.polygon, - // width: 11, - // height: 11, - // color: selectedMenuItem == 5 - // ? Theme.of(context) - // .extension()! - // .accentColorBlue - // : Colors.transparent, - // ), - // label: "Syncing preferences", - // value: 5, - // group: selectedMenuItem, - // onChanged: updateSelectedMenuItem, - // ), - // const SizedBox( - // height: 2, - // ), - // SettingsMenuItem( - // icon: SvgPicture.asset( - // Assets.svg.polygon, - // width: 11, - // height: 11, - // color: selectedMenuItem == 6 - // ? Theme.of(context) - // .extension()! - // .accentColorBlue - // : Colors.transparent, - // ), - // label: "Appearance", - // value: 6, - // group: selectedMenuItem, - // onChanged: updateSelectedMenuItem, - // ), - // const SizedBox( - // height: 2, - // ), - // SettingsMenuItem( - // icon: SvgPicture.asset( - // Assets.svg.polygon, - // width: 11, - // height: 11, - // color: selectedMenuItem == 7 - // ? Theme.of(context) - // .extension()! - // .accentColorBlue - // : Colors.transparent, - // ), - // label: "Advanced", - // value: 7, - // group: selectedMenuItem, - // onChanged: updateSelectedMenuItem, - // ), + ), ], ), ), diff --git a/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/advanced_settings.dart b/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/advanced_settings.dart index e2424eec0f..8684e0073a 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/advanced_settings.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/advanced_settings.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:stackduo/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/manage_coin_units_view.dart'; import 'package:stackduo/pages_desktop_specific/settings/settings_menu/advanced_settings/debug_info_dialog.dart'; import 'package:stackduo/pages_desktop_specific/settings/settings_menu/advanced_settings/desktop_manage_block_explorers_dialog.dart'; import 'package:stackduo/pages_desktop_specific/settings/settings_menu/advanced_settings/stack_privacy_dialog.dart'; @@ -214,7 +215,7 @@ class _AdvancedSettings extends ConsumerState { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - "Debug info", + "Block explorers", style: STextStyles.desktopTextExtraSmall(context) .copyWith( color: Theme.of(context) @@ -224,7 +225,7 @@ class _AdvancedSettings extends ConsumerState { ), PrimaryButton( buttonHeight: ButtonHeight.xs, - label: "Show logs", + label: "Edit", width: 101, onPressed: () async { await showDialog( @@ -232,7 +233,7 @@ class _AdvancedSettings extends ConsumerState { useSafeArea: false, barrierDismissible: true, builder: (context) { - return const DebugInfoDialog(); + return const DesktopManageBlockExplorersDialog(); }, ); }, @@ -252,7 +253,7 @@ class _AdvancedSettings extends ConsumerState { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - "Block explorers", + "Units", style: STextStyles.desktopTextExtraSmall(context) .copyWith( color: Theme.of(context) @@ -270,7 +271,7 @@ class _AdvancedSettings extends ConsumerState { useSafeArea: false, barrierDismissible: true, builder: (context) { - return const DesktopManageBlockExplorersDialog(); + return const ManageCoinUnitsView(); }, ); }, @@ -278,6 +279,47 @@ class _AdvancedSettings extends ConsumerState { ], ), ), + const Padding( + padding: EdgeInsets.all(10.0), + child: Divider( + thickness: 0.5, + ), + ), + Padding( + padding: const EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Debug info", + style: STextStyles.desktopTextExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textDark), + textAlign: TextAlign.left, + ), + PrimaryButton( + buttonHeight: ButtonHeight.xs, + label: "Show logs", + width: 101, + onPressed: () async { + await showDialog( + context: context, + useSafeArea: false, + barrierDismissible: true, + builder: (context) { + return const DebugInfoDialog(); + }, + ); + }, + ), + ], + ), + ), + const SizedBox( + height: 10, + ), ], ), ), diff --git a/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/stack_privacy_dialog.dart b/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/stack_privacy_dialog.dart index 9a2a1d1d42..dec46f3905 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/stack_privacy_dialog.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/stack_privacy_dialog.dart @@ -4,7 +4,7 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/providers/global/prefs_provider.dart'; import 'package:stackduo/providers/global/price_provider.dart'; import 'package:stackduo/services/exchange/exchange_data_loading_service.dart'; diff --git a/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/appearance_settings.dart b/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/appearance_settings.dart index 2c6ca33e92..e8340f7c88 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/appearance_settings.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/appearance_settings.dart @@ -118,44 +118,6 @@ class _AppearanceOptionSettings ], ), ), - // const Padding( - // padding: EdgeInsets.all(10.0), - // child: Divider( - // thickness: 0.5, - // ), - // ), - // Padding( - // padding: const EdgeInsets.all(10.0), - // child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // children: [ - // Text( - // "System brightness", - // style: STextStyles.desktopTextExtraSmall(context) - // .copyWith( - // color: Theme.of(context) - // .extension()! - // .textDark), - // textAlign: TextAlign.left, - // ), - // SizedBox( - // height: 20, - // width: 40, - // child: DraggableSwitchButton( - // isOn: ref.watch( - // prefsChangeNotifierProvider.select( - // (value) => value.enableSystemBrightness), - // ), - // onValueChanged: (newValue) { - // ref - // .read(prefsChangeNotifierProvider) - // .enableSystemBrightness = newValue; - // }, - // ), - // ) - // ], - // ), - // ), const Padding( padding: EdgeInsets.all(10.0), child: Divider( @@ -205,7 +167,7 @@ class ThemeToggle extends ConsumerStatefulWidget { class _ThemeToggle extends ConsumerState { late final StreamSubscription _subscription; - late int _current; + int _current = 0; List> installedThemeIdNames = []; diff --git a/lib/pages_desktop_specific/settings/settings_menu/backup_and_restore/create_auto_backup.dart b/lib/pages_desktop_specific/settings/settings_menu/backup_and_restore/create_auto_backup.dart index a9b1bfdd54..cf495d8246 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/backup_and_restore/create_auto_backup.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/backup_and_restore/create_auto_backup.dart @@ -469,9 +469,7 @@ class _CreateAutoBackup extends ConsumerState { child: isDesktop ? DropdownButtonHideUnderline( child: DropdownButton2( - offset: const Offset(0, -10), isExpanded: true, - dropdownElevation: 0, value: _currentDropDownValue, items: [ ..._dropDownItems.map( @@ -516,32 +514,32 @@ class _CreateAutoBackup extends ConsumerState { }); } }, - icon: SvgPicture.asset( - Assets.svg.chevronDown, - width: 10, - height: 5, - color: Theme.of(context) - .extension()! - .textDark3, - ), - buttonPadding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 8, + iconStyleData: IconStyleData( + icon: SvgPicture.asset( + Assets.svg.chevronDown, + width: 10, + height: 5, + color: Theme.of(context) + .extension()! + .textDark3, + ), ), - buttonDecoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .textFieldDefaultBG, - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, + dropdownStyleData: DropdownStyleData( + offset: const Offset(0, -10), + elevation: 0, + decoration: BoxDecoration( + color: Theme.of(context) + .extension()! + .textFieldDefaultBG, + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), ), ), - dropdownDecoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .textFieldDefaultBG, - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, + menuItemStyleData: const MenuItemStyleData( + padding: EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, ), ), ), diff --git a/lib/providers/db/main_db_provider.dart b/lib/providers/db/main_db_provider.dart index f447287e0c..183615305a 100644 --- a/lib/providers/db/main_db_provider.dart +++ b/lib/providers/db/main_db_provider.dart @@ -1,4 +1,4 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; final mainDBProvider = Provider((ref) => MainDB.instance); diff --git a/lib/providers/ui/add_wallet_selected_coin_provider.dart b/lib/providers/ui/add_wallet_selected_coin_provider.dart index 49d117c697..093207a5f3 100644 --- a/lib/providers/ui/add_wallet_selected_coin_provider.dart +++ b/lib/providers/ui/add_wallet_selected_coin_provider.dart @@ -1,14 +1,5 @@ -import 'package:flutter/foundation.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; +import 'package:stackduo/models/add_wallet_list_entity/add_wallet_list_entity.dart'; -int _count = 0; - -final addWalletSelectedCoinStateProvider = - StateProvider.autoDispose((_) { - if (kDebugMode) { - _count++; - } - - return null; -}); +final addWalletSelectedEntityStateProvider = + StateProvider.autoDispose((_) => null); diff --git a/lib/route_generator.dart b/lib/route_generator.dart index b9ff2d7715..99adf73584 100644 --- a/lib/route_generator.dart +++ b/lib/route_generator.dart @@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; +import 'package:stackduo/models/add_wallet_list_entity/add_wallet_list_entity.dart'; import 'package:stackduo/models/exchange/incomplete_exchange.dart'; import 'package:stackduo/models/exchange/response_objects/trade.dart'; import 'package:stackduo/models/isar/models/contact_entry.dart'; @@ -53,6 +54,8 @@ import 'package:stackduo/pages/send_view/send_view.dart'; import 'package:stackduo/pages/settings_views/global_settings_view/about_view.dart'; import 'package:stackduo/pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart'; import 'package:stackduo/pages/settings_views/global_settings_view/advanced_views/debug_view.dart'; +import 'package:stackduo/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/edit_coin_units_view.dart'; +import 'package:stackduo/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/manage_coin_units_view.dart'; import 'package:stackduo/pages/settings_views/global_settings_view/advanced_views/manage_explorer_view.dart'; import 'package:stackduo/pages/settings_views/global_settings_view/appearance_settings/appearance_settings_view.dart'; import 'package:stackduo/pages/settings_views/global_settings_view/appearance_settings/manage_themes.dart'; @@ -138,6 +141,11 @@ import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/widgets/choose_coin_view.dart'; import 'package:tuple/tuple.dart'; +/* + * This file contains all the routes for the app. + * To add a new route, add it to the switch statement in the generateRoute method. + */ + class RouteGenerator { static const bool useMaterialPageRoute = true; @@ -194,18 +202,6 @@ class RouteGenerator { builder: (_) => const StackPrivacyCalls(isSettings: false), settings: RouteSettings(name: settings.name)); - case WalletsView.routeName: - return getRoute( - shouldUseMaterialRoute: useMaterialPageRoute, - builder: (_) => const WalletsView(), - settings: RouteSettings(name: settings.name)); - - case AddWalletView.routeName: - return getRoute( - shouldUseMaterialRoute: useMaterialPageRoute, - builder: (_) => const AddWalletView(), - settings: RouteSettings(name: settings.name)); - case ChooseCoinView.routeName: if (args is Tuple3) { return getRoute( @@ -236,6 +232,18 @@ class RouteGenerator { } return _routeError("${settings.name} invalid args: ${args.toString()}"); + case WalletsView.routeName: + return getRoute( + shouldUseMaterialRoute: useMaterialPageRoute, + builder: (_) => const WalletsView(), + settings: RouteSettings(name: settings.name)); + + case AddWalletView.routeName: + return getRoute( + shouldUseMaterialRoute: useMaterialPageRoute, + builder: (_) => const AddWalletView(), + settings: RouteSettings(name: settings.name)); + case WalletsOverview.routeName: if (args is Coin) { return getRoute( @@ -534,6 +542,26 @@ class RouteGenerator { } return _routeError("${settings.name} invalid args: ${args.toString()}"); + case ManageCoinUnitsView.routeName: + return getRoute( + shouldUseMaterialRoute: useMaterialPageRoute, + builder: (_) => const ManageCoinUnitsView(), + settings: RouteSettings(name: settings.name)); + + case EditCoinUnitsView.routeName: + if (args is Coin) { + return getRoute( + shouldUseMaterialRoute: useMaterialPageRoute, + builder: (_) => EditCoinUnitsView( + coin: args, + ), + settings: RouteSettings( + name: settings.name, + ), + ); + } + return _routeError("${settings.name} invalid args: ${args.toString()}"); + case CreateBackupInfoView.routeName: return getRoute( shouldUseMaterialRoute: useMaterialPageRoute, @@ -784,11 +812,11 @@ class RouteGenerator { return _routeError("${settings.name} invalid args: ${args.toString()}"); case CreateOrRestoreWalletView.routeName: - if (args is Coin) { + if (args is AddWalletListEntity) { return getRoute( shouldUseMaterialRoute: useMaterialPageRoute, builder: (_) => CreateOrRestoreWalletView( - coin: args, + entity: args, ), settings: RouteSettings( name: settings.name, @@ -954,12 +982,11 @@ class RouteGenerator { return _routeError("${settings.name} invalid args: ${args.toString()}"); case ReceiveView.routeName: - if (args is Tuple2) { + if (args is String) { return getRoute( shouldUseMaterialRoute: useMaterialPageRoute, builder: (_) => ReceiveView( - walletId: args.item1, - coin: args.item2, + walletId: args, ), settings: RouteSettings( name: settings.name, diff --git a/lib/services/address_book_service.dart b/lib/services/address_book_service.dart index 91dfa08d45..96e33a7cfd 100644 --- a/lib/services/address_book_service.dart +++ b/lib/services/address_book_service.dart @@ -1,6 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/contact_entry.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; diff --git a/lib/services/coins/bitcoin/bitcoin_wallet.dart b/lib/services/coins/bitcoin/bitcoin_wallet.dart index aa592efdac..55e7634c80 100644 --- a/lib/services/coins/bitcoin/bitcoin_wallet.dart +++ b/lib/services/coins/bitcoin/bitcoin_wallet.dart @@ -11,7 +11,7 @@ import 'package:bs58check/bs58check.dart' as bs58check; import 'package:decimal/decimal.dart'; import 'package:flutter/foundation.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/electrumx_rpc/cached_electrumx.dart'; import 'package:stackduo/electrumx_rpc/electrumx.dart'; import 'package:stackduo/exceptions/electrumx/no_such_transaction.dart'; @@ -277,8 +277,8 @@ class BitcoinWallet extends CoinServiceAPI @override Future get maxFee async { final fee = (await fees).fast as String; - final satsFee = - Decimal.parse(fee) * Decimal.fromInt(Constants.satsPerCoin(coin)); + final satsFee = Decimal.parse(fee) * + Decimal.fromInt(Constants.satsPerCoin(coin).toInt()); return satsFee.floor().toBigInt().toInt(); } @@ -1060,9 +1060,60 @@ class BitcoinWallet extends CoinServiceAPI }) async { try { final feeRateType = args?["feeRate"]; + final customSatsPerVByte = args?["satsPerVByte"] as int?; final feeRateAmount = args?["feeRateAmount"]; final utxos = args?["UTXOs"] as Set?; - if (feeRateType is FeeRateType || feeRateAmount is int) { + + if (customSatsPerVByte != null) { + // check for send all + bool isSendAll = false; + if (amount == balance.spendable) { + isSendAll = true; + } + + final bool coinControl = utxos != null; + + final result = await coinSelection( + satoshiAmountToSend: amount.raw.toInt(), + selectedTxFeeRate: -1, + satsPerVByte: customSatsPerVByte, + recipientAddress: address, + isSendAll: isSendAll, + utxos: utxos?.toList(), + coinControl: coinControl, + ); + + Logging.instance + .log("PREPARE SEND RESULT: $result", level: LogLevel.Info); + if (result is int) { + switch (result) { + case 1: + throw Exception("Insufficient balance!"); + case 2: + throw Exception("Insufficient funds to pay for transaction fee!"); + default: + throw Exception("Transaction failed with error code $result"); + } + } else { + final hex = result["hex"]; + if (hex is String) { + final fee = result["fee"] as int; + final vSize = result["vSize"] as int; + + Logging.instance.log("txHex: $hex", level: LogLevel.Info); + Logging.instance.log("fee: $fee", level: LogLevel.Info); + Logging.instance.log("vsize: $vSize", level: LogLevel.Info); + // fee should never be less than vSize sanity check + if (fee < vSize) { + throw Exception( + "Error in fee calculation: Transaction fee cannot be less than vSize"); + } + return result as Map; + } else { + throw Exception("sent hex is not a String!!!"); + } + } + } else if (feeRateType is FeeRateType || feeRateAmount is int) { late final int rate; if (feeRateType is FeeRateType) { int fee = 0; @@ -1077,6 +1128,8 @@ class BitcoinWallet extends CoinServiceAPI case FeeRateType.slow: fee = feeObject.slow; break; + default: + throw ArgumentError("Invalid use of custom fee"); } rate = fee; } else { @@ -1201,13 +1254,18 @@ class BitcoinWallet extends CoinServiceAPI void _periodicPingCheck() async { bool hasNetwork = await testNetworkConnection(); - _isConnected = hasNetwork; + if (_isConnected != hasNetwork) { NodeConnectionStatus status = hasNetwork ? NodeConnectionStatus.connected : NodeConnectionStatus.disconnected; GlobalEventBus.instance .fire(NodeConnectionStatusChangedEvent(status, walletId, coin)); + + _isConnected = hasNetwork; + if (hasNetwork) { + unawaited(refresh()); + } } } @@ -1288,6 +1346,7 @@ class BitcoinWallet extends CoinServiceAPI nonce: null, inputs: [], outputs: [], + numberOfMessages: null, ); final address = txData["address"] is String @@ -1342,16 +1401,14 @@ class BitcoinWallet extends CoinServiceAPI )) .toList(); final newNode = await getCurrentNode(); - _cachedElectrumXClient = CachedElectrumX.from( - node: newNode, - prefs: _prefs, - failovers: failovers, - ); _electrumXClient = ElectrumX.from( node: newNode, prefs: _prefs, failovers: failovers, ); + _cachedElectrumXClient = CachedElectrumX.from( + electrumXClient: _electrumXClient, + ); if (shouldRefresh) { unawaited(refresh()); @@ -1468,7 +1525,7 @@ class BitcoinWallet extends CoinServiceAPI } await _secureStore.write( key: '${_walletId}_mnemonic', - value: bip39.generateMnemonic(strength: 256)); + value: bip39.generateMnemonic(strength: 128)); await _secureStore.write(key: '${_walletId}_mnemonicPassphrase', value: ""); // Generate and add addresses to relevant arrays @@ -2187,6 +2244,7 @@ class BitcoinWallet extends CoinServiceAPI required String recipientAddress, required bool coinControl, required bool isSendAll, + int? satsPerVByte, int additionalOutputs = 0, List? utxos, }) async { @@ -2294,18 +2352,22 @@ class BitcoinWallet extends CoinServiceAPI recipients: [recipientAddress], satoshiAmounts: [satoshisBeingUsed - 1], ))["vSize"] as int; - int feeForOneOutput = estimateTxFee( - vSize: vSizeForOneOutput, - feeRatePerKB: selectedTxFeeRate, - ); + int feeForOneOutput = satsPerVByte != null + ? (satsPerVByte * vSizeForOneOutput) + : estimateTxFee( + vSize: vSizeForOneOutput, + feeRatePerKB: selectedTxFeeRate, + ); - final int roughEstimate = roughFeeEstimate( - spendableOutputs.length, - 1, - selectedTxFeeRate, - ).raw.toInt(); - if (feeForOneOutput < roughEstimate) { - feeForOneOutput = roughEstimate; + if (satsPerVByte == null) { + final int roughEstimate = roughFeeEstimate( + spendableOutputs.length, + 1, + selectedTxFeeRate, + ).raw.toInt(); + if (feeForOneOutput < roughEstimate) { + feeForOneOutput = roughEstimate; + } } final int amount = satoshiAmountToSend - feeForOneOutput; @@ -2359,15 +2421,19 @@ class BitcoinWallet extends CoinServiceAPI } // Assume 1 output, only for recipient and no change - final feeForOneOutput = estimateTxFee( - vSize: vSizeForOneOutput, - feeRatePerKB: selectedTxFeeRate, - ); + final feeForOneOutput = satsPerVByte != null + ? (satsPerVByte * vSizeForOneOutput) + : estimateTxFee( + vSize: vSizeForOneOutput, + feeRatePerKB: selectedTxFeeRate, + ); // Assume 2 outputs, one for recipient and one for change - final feeForTwoOutputs = estimateTxFee( - vSize: vSizeForTwoOutPuts, - feeRatePerKB: selectedTxFeeRate, - ); + final feeForTwoOutputs = satsPerVByte != null + ? (satsPerVByte * vSizeForTwoOutPuts) + : estimateTxFee( + vSize: vSizeForTwoOutPuts, + feeRatePerKB: selectedTxFeeRate, + ); Logging.instance .log("feeForTwoOutputs: $feeForTwoOutputs", level: LogLevel.Info); @@ -2562,6 +2628,7 @@ class BitcoinWallet extends CoinServiceAPI return coinSelection( satoshiAmountToSend: satoshiAmountToSend, selectedTxFeeRate: selectedTxFeeRate, + satsPerVByte: satsPerVByte, recipientAddress: recipientAddress, isSendAll: isSendAll, additionalOutputs: additionalOutputs + 1, diff --git a/lib/services/coins/coin_service.dart b/lib/services/coins/coin_service.dart index fc279830b3..e5b88400b3 100644 --- a/lib/services/coins/coin_service.dart +++ b/lib/services/coins/coin_service.dart @@ -46,17 +46,7 @@ abstract class CoinServiceAPI { prefs: prefs, ); final cachedClient = CachedElectrumX.from( - node: electrumxNode, - failovers: failovers - .map((e) => ElectrumXNode( - address: e.host, - port: e.port, - name: e.name, - id: e.id, - useSSL: e.useSSL, - )) - .toList(), - prefs: prefs, + electrumXClient: client, ); switch (coin) { case Coin.bitcoin: diff --git a/lib/services/coins/manager.dart b/lib/services/coins/manager.dart index 932ac9ddb6..94dfe5577e 100644 --- a/lib/services/coins/manager.dart +++ b/lib/services/coins/manager.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'package:event_bus/event_bus.dart'; import 'package:flutter/material.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/balance.dart'; import 'package:stackduo/models/isar/models/isar_models.dart' as isar_models; import 'package:stackduo/models/models.dart'; @@ -234,6 +234,8 @@ class Manager with ChangeNotifier { bool get hasCoinControlSupport => _currentWallet is CoinControlInterface; + bool get hasTokenSupport => false; + bool get hasWhirlpoolSupport => false; int get rescanOnOpenVersion => diff --git a/lib/services/coins/monero/monero_wallet.dart b/lib/services/coins/monero/monero_wallet.dart index d58ea882ae..947c3958d4 100644 --- a/lib/services/coins/monero/monero_wallet.dart +++ b/lib/services/coins/monero/monero_wallet.dart @@ -23,8 +23,8 @@ import 'package:flutter_libmonero/monero/monero.dart'; import 'package:flutter_libmonero/view_model/send/output.dart' as monero_output; import 'package:isar/isar.dart'; import 'package:mutex/mutex.dart'; -import 'package:stackduo/db/main_db.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/balance.dart'; import 'package:stackduo/models/isar/models/isar_models.dart' as isar_models; import 'package:stackduo/models/node_model.dart'; @@ -448,6 +448,8 @@ class MoneroWallet extends CoinServiceAPI with WalletCache, WalletDB { case FeeRateType.slow: feePriority = MoneroTransactionPriority.slow; break; + default: + throw ArgumentError("Invalid use of custom fee"); } Future? awaitPendingTransaction; @@ -854,6 +856,10 @@ class MoneroWallet extends CoinServiceAPI with WalletCache, WalletDB { // String address = walletBase!.getTransactionAddress(chain, index); + if (address.contains("111")) { + return await _generateAddressForChain(chain, index + 1); + } + return isar_models.Address( walletId: walletId, derivationIndex: index, @@ -954,6 +960,7 @@ class MoneroWallet extends CoinServiceAPI with WalletCache, WalletDB { nonce: null, inputs: [], outputs: [], + numberOfMessages: null, ); txnsData.add(Tuple2(txn, address)); diff --git a/lib/services/debug_service.dart b/lib/services/debug_service.dart index 3909cd541d..295403d556 100644 --- a/lib/services/debug_service.dart +++ b/lib/services/debug_service.dart @@ -34,7 +34,7 @@ class DebugService extends ChangeNotifier { // }); } - List get recentLogs => isar.logs.where().limit(200).findAllSync(); + List get recentLogs => isar.logs.where().sortByTimestampInMillisUTCDesc().limit(100).findAllSync(); // Future updateRecentLogs() async { // int totalCount = await isar.logs.count(); diff --git a/lib/services/exchange/change_now/change_now_api.dart b/lib/services/exchange/change_now/change_now_api.dart index f6246d30c6..d3dd088f9d 100644 --- a/lib/services/exchange/change_now/change_now_api.dart +++ b/lib/services/exchange/change_now/change_now_api.dart @@ -201,6 +201,89 @@ class ChangeNowAPI { } } + Future>> getCurrenciesV2( + // { + // bool? fixedRate, + // bool? active, + // } + ) async { + Map? params; + + // if (active != null || fixedRate != null) { + // params = {}; + // if (fixedRate != null) { + // params.addAll({"fixedRate": fixedRate.toString()}); + // } + // if (active != null) { + // params.addAll({"active": active.toString()}); + // } + // } + + final uri = _buildUriV2("/exchange/currencies", params); + + try { + // json array is expected here + final jsonArray = await _makeGetRequest(uri); + + try { + final result = await compute( + _parseV2CurrenciesJson, + jsonArray as List, + ); + return result; + } catch (e, s) { + Logging.instance.log("getAvailableCurrencies exception: $e\n$s", + level: LogLevel.Error); + return ExchangeResponse( + exception: ExchangeException( + "Error: $jsonArray", + ExchangeExceptionType.serializeResponseError, + ), + ); + } + } catch (e, s) { + Logging.instance.log("getAvailableCurrencies exception: $e\n$s", + level: LogLevel.Error); + return ExchangeResponse( + exception: ExchangeException( + e.toString(), + ExchangeExceptionType.generic, + ), + ); + } + } + + ExchangeResponse> _parseV2CurrenciesJson( + List args, + ) { + try { + List currencies = []; + + for (final json in args) { + try { + final map = Map.from(json as Map); + currencies.add( + Currency.fromJson( + map, + rateType: (map["supportsFixedRate"] as bool) + ? SupportedRateType.both + : SupportedRateType.estimated, + exchangeName: ChangeNowExchange.exchangeName, + ), + ); + } catch (_) { + return ExchangeResponse( + exception: ExchangeException("Failed to serialize $json", + ExchangeExceptionType.serializeResponseError)); + } + } + + return ExchangeResponse(value: currencies); + } catch (_) { + rethrow; + } + } + /// This API endpoint returns the array of markets available for the specified currency be default. /// The availability of a particular pair is determined by the 'isAvailable' field. /// diff --git a/lib/services/exchange/change_now/change_now_exchange.dart b/lib/services/exchange/change_now/change_now_exchange.dart index 391851a406..4dc52e8302 100644 --- a/lib/services/exchange/change_now/change_now_exchange.dart +++ b/lib/services/exchange/change_now/change_now_exchange.dart @@ -82,10 +82,11 @@ class ChangeNowExchange extends Exchange { Future>> getAllCurrencies( bool fixedRate, ) async { - return await ChangeNowAPI.instance.getAvailableCurrencies( - fixedRate: fixedRate ? true : null, - active: true, - ); + return await ChangeNowAPI.instance.getCurrenciesV2(); + // return await ChangeNowAPI.instance.getAvailableCurrencies( + // fixedRate: fixedRate ? true : null, + // active: true, + // ); } @override diff --git a/lib/services/exchange/exchange_data_loading_service.dart b/lib/services/exchange/exchange_data_loading_service.dart index 62edcadf15..7a9ac144bc 100644 --- a/lib/services/exchange/exchange_data_loading_service.dart +++ b/lib/services/exchange/exchange_data_loading_service.dart @@ -1,6 +1,6 @@ import 'package:flutter/foundation.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/exchange/active_pair.dart'; import 'package:stackduo/models/exchange/aggregate_currency.dart'; import 'package:stackduo/models/isar/exchange_cache/currency.dart'; diff --git a/lib/services/mixins/coin_control_interface.dart b/lib/services/mixins/coin_control_interface.dart index dd0a991943..c4f25e2ab9 100644 --- a/lib/services/mixins/coin_control_interface.dart +++ b/lib/services/mixins/coin_control_interface.dart @@ -1,7 +1,7 @@ import 'dart:async'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/balance.dart'; import 'package:stackduo/services/event_bus/events/global/balance_refreshed_event.dart'; import 'package:stackduo/services/event_bus/global_event_bus.dart'; diff --git a/lib/services/mixins/electrum_x_parsing.dart b/lib/services/mixins/electrum_x_parsing.dart index 8ad1c7d4c3..31bb51b247 100644 --- a/lib/services/mixins/electrum_x_parsing.dart +++ b/lib/services/mixins/electrum_x_parsing.dart @@ -148,19 +148,31 @@ mixin ElectrumXParsing { type = TransactionType.outgoing; amount = amountSentFromWallet - changeAmount - fee; - final possible = - outputAddresses.difference(myChangeReceivedOnAddresses).first; - - if (transactionAddress.value != possible) { - transactionAddress = Address( - walletId: walletId, - value: possible, - derivationIndex: -1, - derivationPath: null, - subType: AddressSubType.nonWallet, - type: AddressType.nonWallet, - publicKey: [], - ); + // non wallet addresses found in tx outputs + final nonWalletOutAddresses = outputAddresses.difference( + myChangeReceivedOnAddresses, + ); + + if (nonWalletOutAddresses.isNotEmpty) { + final possible = nonWalletOutAddresses.first; + + if (transactionAddress.value != possible) { + transactionAddress = Address( + walletId: walletId, + value: possible, + derivationIndex: -1, + derivationPath: null, + subType: AddressSubType.nonWallet, + type: AddressType.nonWallet, + publicKey: [], + ); + } + } else { + // some other type of tx where the receiving address is + // one of my change addresses + + type = TransactionType.sentToSelf; + amount = changeAmount; } } else { // incoming tx @@ -246,6 +258,7 @@ mixin ElectrumXParsing { nonce: null, inputs: ins, outputs: outs, + numberOfMessages: null, ); return Tuple2(tx, transactionAddress); diff --git a/lib/services/mixins/paynym_wallet_interface.dart b/lib/services/mixins/paynym_wallet_interface.dart index bb09e2622e..179a553883 100644 --- a/lib/services/mixins/paynym_wallet_interface.dart +++ b/lib/services/mixins/paynym_wallet_interface.dart @@ -10,7 +10,7 @@ import 'package:bitcoindart/src/utils/constants/op.dart' as op; import 'package:bitcoindart/src/utils/script.dart' as bscript; import 'package:isar/isar.dart'; import 'package:pointycastle/digests/sha256.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/electrumx_rpc/electrumx.dart'; import 'package:stackduo/exceptions/wallet/insufficient_balance_exception.dart'; import 'package:stackduo/exceptions/wallet/paynym_send_exception.dart'; diff --git a/lib/services/mixins/wallet_cache.dart b/lib/services/mixins/wallet_cache.dart index da18230cd7..9ad5a7eb5f 100644 --- a/lib/services/mixins/wallet_cache.dart +++ b/lib/services/mixins/wallet_cache.dart @@ -1,4 +1,4 @@ -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/balance.dart'; import 'package:stackduo/utilities/amount/amount.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; diff --git a/lib/services/mixins/wallet_db.dart b/lib/services/mixins/wallet_db.dart index 5958521a71..4b4ba4b525 100644 --- a/lib/services/mixins/wallet_db.dart +++ b/lib/services/mixins/wallet_db.dart @@ -1,4 +1,4 @@ -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; mixin WalletDB { MainDB? _db; diff --git a/lib/services/node_service.dart b/lib/services/node_service.dart index fccc0de69b..779ccba560 100644 --- a/lib/services/node_service.dart +++ b/lib/services/node_service.dart @@ -2,7 +2,7 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:http/http.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/node_model.dart'; import 'package:stackduo/utilities/default_nodes.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; diff --git a/lib/services/notes_service.dart b/lib/services/notes_service.dart index caeaf2370e..d937492930 100644 --- a/lib/services/notes_service.dart +++ b/lib/services/notes_service.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/utilities/logger.dart'; class NotesService extends ChangeNotifier { diff --git a/lib/services/notifications_service.dart b/lib/services/notifications_service.dart index dc54d42fd3..c60b8d79af 100644 --- a/lib/services/notifications_service.dart +++ b/lib/services/notifications_service.dart @@ -3,7 +3,7 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:stackduo/electrumx_rpc/electrumx.dart'; import 'package:stackduo/exceptions/electrumx/no_such_transaction.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/exchange/response_objects/trade.dart'; import 'package:stackduo/models/notification_model.dart'; import 'package:stackduo/services/exchange/exchange.dart'; diff --git a/lib/services/price.dart b/lib/services/price.dart index 3319d55dbb..1fa1c9f1a5 100644 --- a/lib/services/price.dart +++ b/lib/services/price.dart @@ -4,7 +4,7 @@ import 'dart:convert'; import 'package:decimal/decimal.dart'; import 'package:flutter/foundation.dart'; import 'package:http/http.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/logger.dart'; import 'package:stackduo/utilities/prefs.dart'; @@ -70,7 +70,7 @@ class PriceAPI { {required String baseCurrency}) async { final now = DateTime.now(); if (_lastUsedBaseCurrency != baseCurrency || - now.difference(_lastCalled).inSeconds > 0) { + now.difference(_lastCalled) > refreshIntervalDuration) { _lastCalled = now; _lastUsedBaseCurrency = baseCurrency; } else { diff --git a/lib/services/trade_notes_service.dart b/lib/services/trade_notes_service.dart index c42e6b4d16..8e02b7528d 100644 --- a/lib/services/trade_notes_service.dart +++ b/lib/services/trade_notes_service.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; class TradeNotesService extends ChangeNotifier { Map get all { diff --git a/lib/services/trade_sent_from_stack_service.dart b/lib/services/trade_sent_from_stack_service.dart index 3d796741c7..6824f39774 100644 --- a/lib/services/trade_sent_from_stack_service.dart +++ b/lib/services/trade_sent_from_stack_service.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/trade_wallet_lookup.dart'; class TradeSentFromStackService extends ChangeNotifier { diff --git a/lib/services/trade_service.dart b/lib/services/trade_service.dart index 2b13b0105f..aa749f63ef 100644 --- a/lib/services/trade_service.dart +++ b/lib/services/trade_service.dart @@ -1,5 +1,5 @@ import 'package:flutter/cupertino.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/exchange/response_objects/trade.dart'; class TradesService extends ChangeNotifier { diff --git a/lib/services/transaction_notification_tracker.dart b/lib/services/transaction_notification_tracker.dart index 5de3777a5e..4e4f2acaac 100644 --- a/lib/services/transaction_notification_tracker.dart +++ b/lib/services/transaction_notification_tracker.dart @@ -1,4 +1,4 @@ -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; class TransactionNotificationTracker { final String walletId; diff --git a/lib/services/wallets.dart b/lib/services/wallets.dart index 7d009f0614..a254997eae 100644 --- a/lib/services/wallets.dart +++ b/lib/services/wallets.dart @@ -1,6 +1,6 @@ import 'package:flutter/foundation.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/node_model.dart'; import 'package:stackduo/services/coins/coin_service.dart'; import 'package:stackduo/services/coins/manager.dart'; diff --git a/lib/services/wallets_service.dart b/lib/services/wallets_service.dart index 3024ea2844..43d1822705 100644 --- a/lib/services/wallets_service.dart +++ b/lib/services/wallets_service.dart @@ -2,8 +2,8 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter_libmonero/monero/monero.dart'; -import 'package:stackduo/db/main_db.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/services/notifications_service.dart'; import 'package:stackduo/services/trade_sent_from_stack_service.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; diff --git a/lib/themes/coin_card_provider.dart b/lib/themes/coin_card_provider.dart new file mode 100644 index 0000000000..fae5b7d344 --- /dev/null +++ b/lib/themes/coin_card_provider.dart @@ -0,0 +1,24 @@ +/* + * This file is part of Stack Wallet. + * + * Copyright (c) 2023 Cypher Stack + * All Rights Reserved. + * The code is distributed under GPLv3 license, see LICENSE file for details. + * Generated by Cypher Stack on 2023-05-26 + * + */ + +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:stackduo/models/isar/stack_theme.dart'; +import 'package:stackduo/themes/theme_providers.dart'; +import 'package:stackduo/utilities/enums/coin_enum.dart'; + +final coinCardProvider = Provider.family((ref, coin) { + final assets = ref.watch(themeAssetsProvider); + + if (assets is ThemeAssetsV3) { + return assets.coinCardImages?[coin.mainNetVersion]; + } else { + return null; + } +}); diff --git a/lib/themes/coin_icon_provider.dart b/lib/themes/coin_icon_provider.dart index 116917c9c2..c1d83d627b 100644 --- a/lib/themes/coin_icon_provider.dart +++ b/lib/themes/coin_icon_provider.dart @@ -1,15 +1,22 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:stackduo/models/isar/stack_theme.dart'; import 'package:stackduo/themes/theme_providers.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; final coinIconProvider = Provider.family((ref, coin) { - final assets = ref.watch(themeProvider).assets; - switch (coin) { - case Coin.bitcoin: - case Coin.bitcoinTestNet: - return assets.bitcoin; + final assets = ref.watch(themeAssetsProvider); - case Coin.monero: - return assets.monero; + if (assets is ThemeAssets) { + switch (coin) { + case Coin.bitcoin: + case Coin.bitcoinTestNet: + return assets.bitcoin; + case Coin.monero: + return assets.monero; + } + } else if (assets is ThemeAssetsV2) { + return (assets).coinIcons[coin.mainNetVersion]!; + } else { + return (assets as ThemeAssetsV3).coinIcons[coin.mainNetVersion]!; } }); diff --git a/lib/themes/coin_image_provider.dart b/lib/themes/coin_image_provider.dart index cf01ecb62c..3761aab376 100644 --- a/lib/themes/coin_image_provider.dart +++ b/lib/themes/coin_image_provider.dart @@ -1,27 +1,45 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:stackduo/models/isar/stack_theme.dart'; import 'package:stackduo/themes/theme_providers.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; final coinImageProvider = Provider.family((ref, coin) { - final assets = ref.watch(themeProvider).assets; - switch (coin) { - case Coin.bitcoin: - case Coin.bitcoinTestNet: - return assets.bitcoinImage; + final assets = ref.watch(themeAssetsProvider); - case Coin.monero: - return assets.moneroImage; + if (assets is ThemeAssets) { + switch (coin) { + case Coin.bitcoin: + case Coin.bitcoinTestNet: + return assets.bitcoinImage; + + case Coin.monero: + return assets.moneroImage; + } + } else if (assets is ThemeAssetsV2) { + return (assets).coinImages[coin.mainNetVersion]!; + } else { + return (assets as ThemeAssetsV3).coinImages[coin.mainNetVersion]!; } }); final coinImageSecondaryProvider = Provider.family((ref, coin) { - final assets = ref.watch(themeProvider).assets; - switch (coin) { - case Coin.bitcoin: - case Coin.bitcoinTestNet: - return assets.bitcoinImageSecondary; + final assets = ref.watch(themeAssetsProvider); + + if (assets is ThemeAssets) { + switch (coin) { + case Coin.bitcoin: + case Coin.bitcoinTestNet: + return assets.bitcoinImageSecondary; + + case Coin.monero: + return assets.moneroImageSecondary; - case Coin.monero: - return assets.moneroImageSecondary; + default: + return assets.stackIcon; + } + } else if (assets is ThemeAssetsV2) { + return (assets).coinSecondaryImages[coin.mainNetVersion]!; + } else { + return (assets as ThemeAssetsV3).coinSecondaryImages[coin.mainNetVersion]!; } }); diff --git a/lib/themes/theme_providers.dart b/lib/themes/theme_providers.dart index 482d507685..9672018acc 100644 --- a/lib/themes/theme_providers.dart +++ b/lib/themes/theme_providers.dart @@ -20,3 +20,11 @@ final themeProvider = StateProvider( ), ), ); + +final themeAssetsProvider = StateProvider( + (ref) => ref.watch( + themeProvider.select( + (value) => value.assets, + ), + ), +); diff --git a/lib/themes/theme_service.dart b/lib/themes/theme_service.dart index ddb410535a..45073888f3 100644 --- a/lib/themes/theme_service.dart +++ b/lib/themes/theme_service.dart @@ -1,13 +1,13 @@ import 'dart:convert'; import 'dart:io'; -import 'dart:typed_data'; import 'package:archive/archive_io.dart'; import 'package:crypto/crypto.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:http/http.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/stack_theme.dart'; import 'package:stackduo/utilities/logger.dart'; import 'package:stackduo/utilities/stack_file_system.dart'; @@ -17,6 +17,7 @@ final pThemeService = Provider((ref) { }); class ThemeService { + static const _currentDefaultThemeVersion = 3; ThemeService._(); static ThemeService? _instance; static ThemeService get instance => _instance ??= ThemeService._(); @@ -29,7 +30,7 @@ class ThemeService { void init(MainDB db) => _db ??= db; Future install({required Uint8List themeArchiveData}) async { - final themesDir = await StackFileSystem.applicationThemesDirectory(); + final themesDir = StackFileSystem.themesDir!; final archive = ZipDecoder().decodeBytes(themeArchiveData); @@ -39,16 +40,19 @@ class ThemeService { throw Exception("Invalid theme archive: Missing theme.json"); } - final OutputStream os = OutputStream(); - themeJsonFiles.first.decompress(os); - final String jsonString = utf8.decode(os.getBytes()); + final jsonString = utf8.decode(themeJsonFiles.first.content as List); final json = jsonDecode(jsonString) as Map; final theme = StackTheme.fromJson( json: Map.from(json), - applicationThemesDirectoryPath: themesDir.path, ); + try { + theme.assets; + } catch (_) { + throw Exception("Invalid theme: Failed to create assets object"); + } + final String assetsPath = "${themesDir.path}/${theme.themeId}"; for (final file in archive.files) { @@ -73,7 +77,7 @@ class ThemeService { } Future remove({required String themeId}) async { - final themesDir = await StackFileSystem.applicationThemesDirectory(); + final themesDir = StackFileSystem.themesDir!; final isarId = await db.isar.stackThemes .where() .themeIdEqualTo(themeId) @@ -83,7 +87,10 @@ class ThemeService { await db.isar.writeTxn(() async { await db.isar.stackThemes.delete(isarId); }); - await Directory("${themesDir.path}/$themeId").delete(recursive: true); + final dir = Directory("${themesDir.path}/$themeId"); + if (dir.existsSync()) { + await dir.delete(recursive: true); + } } else { Logging.instance.log( "Failed to delete theme $themeId", @@ -92,12 +99,82 @@ class ThemeService { } } + Future checkDefaultThemesOnStartup() async { + // install default themes + if (!(await ThemeService.instance.verifyInstalled(themeId: "light"))) { + Logging.instance.log( + "Installing default light theme...", + level: LogLevel.Info, + ); + final lightZip = await rootBundle.load("assets/default_themes/light.zip"); + await ThemeService.instance + .install(themeArchiveData: lightZip.buffer.asUint8List()); + Logging.instance.log( + "Installing default light theme... finished", + level: LogLevel.Info, + ); + } else { + // check installed version + final theme = ThemeService.instance.getTheme(themeId: "light"); + if ((theme?.version ?? 1) < _currentDefaultThemeVersion) { + Logging.instance.log( + "Updating default light theme...", + level: LogLevel.Info, + ); + final lightZip = + await rootBundle.load("assets/default_themes/light.zip"); + await ThemeService.instance + .install(themeArchiveData: lightZip.buffer.asUint8List()); + Logging.instance.log( + "Updating default light theme... finished", + level: LogLevel.Info, + ); + } + } + + if (!(await ThemeService.instance.verifyInstalled(themeId: "dark"))) { + Logging.instance.log( + "Installing default dark theme... ", + level: LogLevel.Info, + ); + final darkZip = await rootBundle.load("assets/default_themes/dark.zip"); + await ThemeService.instance + .install(themeArchiveData: darkZip.buffer.asUint8List()); + Logging.instance.log( + "Installing default dark theme... finished", + level: LogLevel.Info, + ); + } else { + // check installed version + final theme = ThemeService.instance.getTheme(themeId: "dark"); + if ((theme?.version ?? 1) < _currentDefaultThemeVersion) { + Logging.instance.log( + "Updating default dark theme...", + level: LogLevel.Info, + ); + final darkZip = await rootBundle.load("assets/default_themes/dark.zip"); + await ThemeService.instance + .install(themeArchiveData: darkZip.buffer.asUint8List()); + Logging.instance.log( + "Updating default dark theme... finished", + level: LogLevel.Info, + ); + } + } + } + // TODO more thorough check/verification of theme Future verifyInstalled({required String themeId}) async { - final dbHasTheme = - await db.isar.stackThemes.where().themeIdEqualTo(themeId).count() > 0; - if (dbHasTheme) { - final themesDir = await StackFileSystem.applicationThemesDirectory(); + final theme = + await db.isar.stackThemes.where().themeIdEqualTo(themeId).findFirst(); + if (theme != null) { + try { + theme.assets; + } catch (_) { + return false; + } + + final themesDir = StackFileSystem.themesDir!; final jsonFileExists = await File("${themesDir.path}/$themeId/theme.json").exists(); final assetsDirExists = @@ -175,6 +252,7 @@ class ThemeService { class StackThemeMetaData { final String name; final String id; + final int version; final String sha256; final String size; final String previewImageUrl; @@ -182,6 +260,7 @@ class StackThemeMetaData { StackThemeMetaData({ required this.name, required this.id, + required this.version, required this.sha256, required this.size, required this.previewImageUrl, @@ -192,6 +271,7 @@ class StackThemeMetaData { return StackThemeMetaData( name: map["name"] as String, id: map["id"] as String, + version: map["version"] as int? ?? 1, sha256: map["sha256"] as String, size: map["size"] as String, previewImageUrl: map["previewImageUrl"] as String, @@ -210,6 +290,7 @@ class StackThemeMetaData { return "$runtimeType(" "name: $name, " "id: $id, " + "version: $version, " "sha256: $sha256, " "size: $size, " "previewImageUrl: $previewImageUrl" diff --git a/lib/utilities/amount/amount.dart b/lib/utilities/amount/amount.dart index 30619bb0d5..198b1c5f0e 100644 --- a/lib/utilities/amount/amount.dart +++ b/lib/utilities/amount/amount.dart @@ -22,6 +22,39 @@ class Amount { : assert(fractionDigits >= 0), _value = amount.shift(fractionDigits).toBigInt(); + static Amount? tryParseFiatString( + String value, { + required String locale, + }) { + final parts = value.split(" "); + + if (parts.first.isEmpty) { + return null; + } + + String str = parts.first; + if (str.startsWith(RegExp(r'[+-]'))) { + str = str.substring(1); + } + + if (str.isEmpty) { + return null; + } + + // get number symbols for decimal place and group separator + final numberSymbols = numberFormatSymbols[locale] as NumberSymbols? ?? + numberFormatSymbols[locale.substring(0, 2)] as NumberSymbols?; + + final groupSeparator = numberSymbols?.GROUP_SEP ?? ","; + final decimalSeparator = numberSymbols?.DECIMAL_SEP ?? "."; + + str = str.replaceAll(groupSeparator, ""); + + final decimalString = str.replaceFirst(decimalSeparator, "."); + + return Decimal.tryParse(decimalString)?.toAmount(fractionDigits: 2); + } + // =========================================================================== // ======= Instance properties =============================================== @@ -52,29 +85,52 @@ class Amount { return jsonEncode(toMap()); } - String localizedStringAsFixed({ + String fiatString({ required String locale, - int? decimalPlaces, }) { - decimalPlaces ??= fractionDigits; - assert(decimalPlaces >= 0); - final wholeNumber = decimal.truncate(); - if (decimalPlaces == 0) { - return wholeNumber.toStringAsFixed(0); - } + // get number symbols for decimal place and group separator + final numberSymbols = numberFormatSymbols[locale] as NumberSymbols? ?? + numberFormatSymbols[locale.substring(0, 2)] as NumberSymbols?; - final String separator = - (numberFormatSymbols[locale] as NumberSymbols?)?.DECIMAL_SEP ?? - (numberFormatSymbols[locale.substring(0, 2)] as NumberSymbols?) - ?.DECIMAL_SEP ?? - "."; + final String separator = numberSymbols?.DECIMAL_SEP ?? "."; final fraction = decimal - wholeNumber; - return "${wholeNumber.toStringAsFixed(0)}$separator${fraction.toStringAsFixed(decimalPlaces).substring(2)}"; + String wholeNumberString = wholeNumber.toStringAsFixed(0); + // insert group separator + final regex = RegExp(r'\B(?=(\d{3})+(?!\d))'); + wholeNumberString = wholeNumberString.replaceAllMapped( + regex, + (m) => "${m.group(0)}${numberSymbols?.GROUP_SEP ?? ","}", + ); + + return "$wholeNumberString$separator${fraction.toStringAsFixed(2).substring(2)}"; } + // String localizedStringAsFixed({ + // required String locale, + // int? decimalPlaces, + // }) { + // decimalPlaces ??= fractionDigits; + // assert(decimalPlaces >= 0); + // + // final wholeNumber = decimal.truncate(); + // + // if (decimalPlaces == 0) { + // return wholeNumber.toStringAsFixed(0); + // } + // + // final String separator = + // (numberFormatSymbols[locale] as NumberSymbols?)?.DECIMAL_SEP ?? + // (numberFormatSymbols[locale.substring(0, 2)] as NumberSymbols?) + // ?.DECIMAL_SEP ?? + // "."; + // + // final fraction = decimal - wholeNumber; + // + // return "${wholeNumber.toStringAsFixed(0)}$separator${fraction.toStringAsFixed(decimalPlaces).substring(2)}"; + // } // =========================================================================== // ======= Deserialization =================================================== diff --git a/lib/utilities/amount/amount_formatter.dart b/lib/utilities/amount/amount_formatter.dart new file mode 100644 index 0000000000..db119c5378 --- /dev/null +++ b/lib/utilities/amount/amount_formatter.dart @@ -0,0 +1,72 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:stackduo/providers/global/locale_provider.dart'; +import 'package:stackduo/providers/global/prefs_provider.dart'; +import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_unit.dart'; +import 'package:stackduo/utilities/enums/coin_enum.dart'; + +final pAmountUnit = Provider.family( + (ref, coin) => ref.watch( + prefsChangeNotifierProvider.select( + (value) => value.amountUnit(coin), + ), + ), +); +final pMaxDecimals = Provider.family( + (ref, coin) => ref.watch( + prefsChangeNotifierProvider.select( + (value) => value.maxDecimals(coin), + ), + ), +); + +final pAmountFormatter = Provider.family((ref, coin) { + return AmountFormatter( + unit: ref.watch(pAmountUnit(coin)), + locale: ref.watch( + localeServiceChangeNotifierProvider.select((value) => value.locale), + ), + coin: coin, + maxDecimals: ref.watch(pMaxDecimals(coin)), + ); +}); + +class AmountFormatter { + final AmountUnit unit; + final String locale; + final Coin coin; + final int maxDecimals; + + AmountFormatter({ + required this.unit, + required this.locale, + required this.coin, + required this.maxDecimals, + }); + + String format( + Amount amount, { + String? overrideUnit, + dynamic ethContract, + bool withUnitName = true, + bool indicatePrecisionLoss = true, + }) { + return unit.displayAmount( + amount: amount, + locale: locale, + coin: coin, + maxDecimalPlaces: maxDecimals, + withUnitName: withUnitName, + indicatePrecisionLoss: indicatePrecisionLoss, + overrideUnit: overrideUnit, + tokenContract: ethContract, + ); + } + + Amount? tryParse( + String string, { + dynamic ethContract, + }) { + return unit.tryParse(string, locale: locale, coin: coin); + } +} diff --git a/lib/utilities/amount/amount_input_formatter.dart b/lib/utilities/amount/amount_input_formatter.dart new file mode 100644 index 0000000000..54ad579409 --- /dev/null +++ b/lib/utilities/amount/amount_input_formatter.dart @@ -0,0 +1,97 @@ +import 'dart:math'; + +import 'package:flutter/services.dart'; +import 'package:intl/number_symbols.dart'; +import 'package:intl/number_symbols_data.dart'; +import 'package:stackduo/utilities/amount/amount_unit.dart'; + +class AmountInputFormatter extends TextInputFormatter { + final int decimals; + final String locale; + final AmountUnit? unit; + + AmountInputFormatter({ + required this.decimals, + required this.locale, + this.unit, + }); + + @override + TextEditingValue formatEditUpdate( + TextEditingValue oldValue, TextEditingValue newValue) { + // get number symbols for decimal place and group separator + final numberSymbols = numberFormatSymbols[locale] as NumberSymbols? ?? + numberFormatSymbols[locale.substring(0, 2)] as NumberSymbols?; + + final decimalSeparator = numberSymbols?.DECIMAL_SEP ?? "."; + final groupSeparator = numberSymbols?.GROUP_SEP ?? ","; + + String newText = newValue.text.replaceAll(groupSeparator, ""); + + final selectionIndexFromTheRight = + newValue.text.length - newValue.selection.end; + + String? fraction; + if (newText.contains(decimalSeparator)) { + final parts = newText.split(decimalSeparator); + + if (parts.length > 2) { + return oldValue; + } + + final fractionDigits = + unit == null ? decimals : max(decimals - unit!.shift, 0); + + if (newText.startsWith(decimalSeparator)) { + if (newText.length - 1 > fractionDigits) { + newText = newText.substring(0, fractionDigits + 1); + } + + return TextEditingValue( + text: newText, + selection: TextSelection.collapsed( + offset: newText.length - selectionIndexFromTheRight, + ), + ); + } + + newText = parts.first; + if (parts.length == 2) { + fraction = parts.last; + } else { + fraction = ""; + } + + if (fraction.length > fractionDigits) { + fraction = fraction.substring(0, fractionDigits); + } + } + + String newString; + final val = BigInt.tryParse(newText); + if (val == null || val < BigInt.one) { + newString = newText; + } else { + // insert group separator + final regex = RegExp(r'\B(?=(\d{3})+(?!\d))'); + newString = newText.replaceAllMapped( + regex, + (m) => "${m.group(0)}${numberSymbols?.GROUP_SEP ?? ","}", + ); + } + + if (fraction != null) { + newString += decimalSeparator; + if (fraction.isNotEmpty) { + newString += fraction; + } + } + + return TextEditingValue( + text: newString, + selection: TextSelection.collapsed( + offset: newString.length - selectionIndexFromTheRight, + ), + ); + } +} diff --git a/lib/utilities/amount/amount_unit.dart b/lib/utilities/amount/amount_unit.dart index 114fbaa579..afaf31639b 100644 --- a/lib/utilities/amount/amount_unit.dart +++ b/lib/utilities/amount/amount_unit.dart @@ -6,6 +6,7 @@ import 'package:intl/number_symbols_data.dart'; import 'package:stackduo/utilities/amount/amount.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; +// preserve index order as index is used to store value in preferences enum AmountUnit { normal(0), milli(3), @@ -14,10 +15,25 @@ enum AmountUnit { pico(12), femto(15), atto(18), + zepto(21), + yocto(24), + ronto(27), + quecto(30), ; const AmountUnit(this.shift); final int shift; + + static List valuesForCoin(Coin coin) { + switch (coin) { + case Coin.bitcoinTestNet: + case Coin.bitcoin: + return AmountUnit.values.sublist(0, 4); + + case Coin.monero: + return AmountUnit.values.sublist(0, 5); + } + } } extension AmountUnitExt on AmountUnit { @@ -30,21 +46,144 @@ extension AmountUnitExt on AmountUnit { case AmountUnit.micro: return "µ${coin.ticker}"; case AmountUnit.nano: - if (coin == Coin.monero) { + // if (coin == Coin.ethereum) { + // return "gwei"; + // } else + if ( + // coin == Coin.wownero || + coin == Coin.monero + // || + // coin == Coin.nano || + // coin == Coin.banano + ) { return "n${coin.ticker}"; } else { return "sats"; } case AmountUnit.pico: - if (coin == Coin.monero) { + // if (coin == Coin.ethereum) { + // return "mwei"; + // } else + if ( + // coin == Coin.wownero || + coin == Coin.monero + // || + // coin == Coin.nano || + // coin == Coin.banano + ) { return "p${coin.ticker}"; } else { return "invalid"; } case AmountUnit.femto: + // if (coin == Coin.ethereum) { + // return "kwei"; + // } else if (coin == Coin.nano || coin == Coin.banano) { + // return "f${coin.ticker}"; + // } else { + // return "invalid"; + // } case AmountUnit.atto: + // if (coin == Coin.ethereum) { + // return "wei"; + // } else if (coin == Coin.nano || coin == Coin.banano) { + // return "a${coin.ticker}"; + // } else { + // return "invalid"; + // } + case AmountUnit.zepto: + // if (coin == Coin.nano || coin == Coin.banano) { + // return "z${coin.ticker}"; + // } else { + // return "invalid"; + // } + case AmountUnit.yocto: + // if (coin == Coin.nano || coin == Coin.banano) { + // return "y${coin.ticker}"; + // } else { + // return "invalid"; + // } + case AmountUnit.ronto: + // if (coin == Coin.nano || coin == Coin.banano) { + // return "r${coin.ticker}"; + // } else { + // return "invalid"; + // } + case AmountUnit.quecto: + // if (coin == Coin.nano || coin == Coin.banano) { + // return "q${coin.ticker}"; + // } else { return "invalid"; + // } + } + } + + String unitForContract(dynamic contract) { + switch (this) { + // case AmountUnit.normal: + // return contract.symbol; + // case AmountUnit.milli: + // return "m${contract.symbol}"; + // case AmountUnit.micro: + // return "µ${contract.symbol}"; + // case AmountUnit.nano: + // return "gwei"; + // case AmountUnit.pico: + // return "mwei"; + // case AmountUnit.femto: + // return "kwei"; + // case AmountUnit.atto: + // return "wei"; + default: + throw ArgumentError( + "Duo has no eth", + ); + } + } + + Amount? tryParse( + String value, { + required String locale, + required Coin coin, + dynamic tokenContract, + }) { + final precisionLost = value.startsWith("~"); + + final parts = (precisionLost ? value.substring(1) : value).split(" "); + + if (parts.first.isEmpty) { + return null; + } + + String str = parts.first; + if (str.startsWith(RegExp(r'[+-]'))) { + str = str.substring(1); + } + + if (str.isEmpty) { + return null; + } + + // get number symbols for decimal place and group separator + final numberSymbols = numberFormatSymbols[locale] as NumberSymbols? ?? + numberFormatSymbols[locale.substring(0, 2)] as NumberSymbols?; + + final groupSeparator = numberSymbols?.GROUP_SEP ?? ","; + final decimalSeparator = numberSymbols?.DECIMAL_SEP ?? "."; + + str = str.replaceAll(groupSeparator, ""); + + final decimalString = str.replaceFirst(decimalSeparator, "."); + final Decimal? decimal = Decimal.tryParse(decimalString); + + if (decimal == null) { + return null; } + + final int decimalPlaces = tokenContract?.decimals as int? ?? coin.decimals; + final realShift = math.min(shift, decimalPlaces); + + return decimal.shift(0 - realShift).toAmount(fractionDigits: decimalPlaces); } String displayAmount({ @@ -52,8 +191,13 @@ extension AmountUnitExt on AmountUnit { required String locale, required Coin coin, required int maxDecimalPlaces, + bool withUnitName = true, + bool indicatePrecisionLoss = true, + String? overrideUnit, + dynamic? tokenContract, }) { assert(maxDecimalPlaces >= 0); + // ensure we don't shift past minimum atomic value final realShift = math.min(shift, amount.fractionDigits); @@ -69,18 +213,55 @@ extension AmountUnitExt on AmountUnit { // start building the return value with just the whole value String returnValue = wholeNumber.toString(); + // get number symbols for decimal place and group separator + final numberSymbols = numberFormatSymbols[locale] as NumberSymbols? ?? + numberFormatSymbols[locale.substring(0, 2)] as NumberSymbols?; + + // insert group separator + final regex = RegExp(r'\B(?=(\d{3})+(?!\d))'); + returnValue = returnValue.replaceAllMapped( + regex, + (m) => "${m.group(0)}${numberSymbols?.GROUP_SEP ?? ","}", + ); + + // if true and withUnitName is true, we will show "~" prepended on amount + bool didLosePrecision = false; + // if any decimal places should be shown continue building the return value if (places > 0) { // get the fractional value final Decimal fraction = shifted - shifted.truncate(); - // get final decimal based on max precision wanted - final int actualDecimalPlaces = math.min(places, maxDecimalPlaces); + // get final decimal based on max precision wanted while ensuring that + // maxDecimalPlaces doesn't exceed the max per coin + final int updatedMax; + if (tokenContract != null) { + updatedMax = maxDecimalPlaces > (tokenContract.decimals as int) + ? tokenContract.decimals as int + : maxDecimalPlaces; + } else { + updatedMax = + maxDecimalPlaces > coin.decimals ? coin.decimals : maxDecimalPlaces; + } + final int actualDecimalPlaces = math.min(places, updatedMax); // get remainder string without the prepending "0." - String remainder = fraction.toString().substring(2); + final fractionString = fraction.toString(); + String remainder; + if (fractionString.length > 2) { + remainder = fraction.toString().substring(2); + } else { + remainder = "0"; + } if (remainder.length > actualDecimalPlaces) { + // check for loss of precision + final remainingRemainder = + BigInt.tryParse(remainder.substring(actualDecimalPlaces)); + if (remainingRemainder != null) { + didLosePrecision = remainingRemainder > BigInt.zero; + } + // trim unwanted trailing digits remainder = remainder.substring(0, actualDecimalPlaces); } else if (remainder.length < actualDecimalPlaces) { @@ -91,17 +272,29 @@ extension AmountUnitExt on AmountUnit { } // get decimal separator based on locale - final String separator = - (numberFormatSymbols[locale] as NumberSymbols?)?.DECIMAL_SEP ?? - (numberFormatSymbols[locale.substring(0, 2)] as NumberSymbols?) - ?.DECIMAL_SEP ?? - "."; + final String separator = numberSymbols?.DECIMAL_SEP ?? "."; // append separator and fractional amount returnValue += "$separator$remainder"; } + if (!withUnitName && !indicatePrecisionLoss) { + return returnValue; + } + + if (didLosePrecision && indicatePrecisionLoss) { + returnValue = "~$returnValue"; + } + + if (!withUnitName && indicatePrecisionLoss) { + return returnValue; + } + // return the value with the proper unit symbol - return "$returnValue ${unitForCoin(coin)}"; + if (tokenContract != null) { + overrideUnit = unitForContract(tokenContract); + } + + return "$returnValue ${overrideUnit ?? unitForCoin(coin)}"; } } diff --git a/lib/utilities/assets.dart b/lib/utilities/assets.dart index 12df8e1c70..aa2c1e05c9 100644 --- a/lib/utilities/assets.dart +++ b/lib/utilities/assets.dart @@ -187,7 +187,7 @@ class _SVG { String get exchange3 => "assets/svg/exchange-3.svg"; String get messageQuestion => "assets/svg/message-question-1.svg"; String get list => "assets/svg/list-ul.svg"; - String get unclaimedPaynym => "assets/svg/unclaimed.png"; + String get unclaimedPaynym => "assets/svg/unclaimed.svg"; String get trocadorRatingA => "assets/svg/trocador_rating_a.svg"; String get trocadorRatingB => "assets/svg/trocador_rating_b.svg"; diff --git a/lib/utilities/block_explorers.dart b/lib/utilities/block_explorers.dart index 7d3836db77..322ee953ca 100644 --- a/lib/utilities/block_explorers.dart +++ b/lib/utilities/block_explorers.dart @@ -1,4 +1,4 @@ -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/block_explorer.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; @@ -29,6 +29,7 @@ Future setBlockExplorerForCoin({ ); } +// Returns the block explorer URL for the given coin and txid Uri getBlockExplorerTransactionUrlFor({ required Coin coin, required String txid, diff --git a/lib/utilities/clipboard_interface.dart b/lib/utilities/clipboard_interface.dart index 80cdf8a479..b1451cb317 100644 --- a/lib/utilities/clipboard_interface.dart +++ b/lib/utilities/clipboard_interface.dart @@ -23,8 +23,8 @@ class FakeClipboard implements ClipboardInterface { String? _value; @override - Future getData(String format) async { - return ClipboardData(text: _value); + Future getData(String format) async { + return _value == null ? null : ClipboardData(text: _value!); } @override diff --git a/lib/utilities/constants.dart b/lib/utilities/constants.dart index 28751adecb..e566caaea6 100644 --- a/lib/utilities/constants.dart +++ b/lib/utilities/constants.dart @@ -25,9 +25,15 @@ abstract class Constants { // static bool enableBuy = enableExchange; // // true; // true for development, - //TODO: correct for monero? - static const int _satsPerCoinMonero = 1000000000000; - static const int _satsPerCoin = 100000000; + static final BigInt _satsPerCoinECash = BigInt.from(100); + static final BigInt _satsPerCoinEthereum = BigInt.from(1000000000000000000); + static final BigInt _satsPerCoinMonero = BigInt.from(1000000000000); + static final BigInt _satsPerCoinWownero = BigInt.from(100000000000); + static final BigInt _satsPerCoinNano = + BigInt.parse("1000000000000000000000000000000"); // 1*10^30 + static final BigInt _satsPerCoinBanano = + BigInt.parse("100000000000000000000000000000"); // 1*10^29 + static final BigInt _satsPerCoin = BigInt.from(100000000); static const int _decimalPlaces = 8; static const int _decimalPlacesWownero = 11; static const int _decimalPlacesMonero = 12; @@ -35,17 +41,14 @@ abstract class Constants { static const int notificationsMax = 0xFFFFFFFF; static const Duration networkAliveTimerDuration = Duration(seconds: 10); - static const int pinLength = 4; - // Enable Logger.print statements static const bool disableLogger = false; - static const int currentHiveDbVersion = 9; static const int currentDataVersion = 10; static const int rescanV1 = 1; - static int satsPerCoin(Coin coin) { + static BigInt satsPerCoin(Coin coin) { switch (coin) { case Coin.bitcoin: case Coin.bitcoinTestNet: @@ -94,8 +97,16 @@ abstract class Constants { } } - static const int seedPhraseWordCountBip39 = 24; - static const int seedPhraseWordCountMonero = 25; + static int defaultSeedPhraseLengthFor({required Coin coin}) { + switch (coin) { + case Coin.bitcoin: + case Coin.bitcoinTestNet: + return 12; + + case Coin.monero: + return 25; + } + } static const Map monthMapShort = { 1: 'Jan', diff --git a/lib/utilities/db_version_migration.dart b/lib/utilities/db_version_migration.dart index 4a594ff24e..5fbabcf914 100644 --- a/lib/utilities/db_version_migration.dart +++ b/lib/utilities/db_version_migration.dart @@ -1,7 +1,7 @@ import 'package:hive/hive.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/contact.dart'; import 'package:stackduo/models/exchange/change_now/exchange_transaction.dart'; import 'package:stackduo/models/exchange/response_objects/trade.dart'; diff --git a/lib/utilities/delete_everything.dart b/lib/utilities/delete_everything.dart deleted file mode 100644 index c8ba5f41c3..0000000000 --- a/lib/utilities/delete_everything.dart +++ /dev/null @@ -1,30 +0,0 @@ -import 'package:stackduo/hive/db.dart'; -import 'package:stackduo/utilities/logger.dart'; - -Future deleteEverything() async { - try { - await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameAddressBook); - await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameDebugInfo); - await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameNodeModels); - await DB.instance.deleteBoxFromDisk(boxName: DB.boxNamePrimaryNodes); - await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameAllWalletsData); - await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameNotifications); - await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameWatchedTransactions); - await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameWatchedTrades); - await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameTrades); - await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameTradesV2); - await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameTradeNotes); - await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameTradeLookup); - await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameFavoriteWallets); - await DB.instance.deleteBoxFromDisk(boxName: DB.boxNamePrefs); - await DB.instance - .deleteBoxFromDisk(boxName: DB.boxNameWalletsToDeleteOnStart); - await DB.instance.deleteBoxFromDisk(boxName: DB.boxNamePriceCache); - await DB.instance.deleteBoxFromDisk(boxName: DB.boxNameDBInfo); - await DB.instance.deleteBoxFromDisk(boxName: "theme"); - return true; - } catch (e, s) { - Logging.instance.log("$e $s", level: LogLevel.Error); - return false; - } -} diff --git a/lib/utilities/desktop_password_service.dart b/lib/utilities/desktop_password_service.dart index d71dbd7b6e..d0812e0899 100644 --- a/lib/utilities/desktop_password_service.dart +++ b/lib/utilities/desktop_password_service.dart @@ -1,8 +1,8 @@ import 'package:hive/hive.dart'; import 'package:stack_wallet_backup/secure_storage.dart'; -import 'package:stackduo/hive/db.dart'; import 'package:stackduo/utilities/logger.dart'; +const String kBoxNameDesktopData = "desktopData"; const String _kKeyBlobKey = "swbKeyBlobKeyStringID"; const String _kKeyBlobVersionKey = "swbKeyBlobVersionKeyStringID"; @@ -52,14 +52,8 @@ class DPS { kLatestBlobVersion, ); - final box = await Hive.openBox(DB.boxNameDesktopData); - await DB.instance.put( - boxName: DB.boxNameDesktopData, - key: _kKeyBlobKey, - value: await _handler!.getKeyBlob(), - ); + await _put(key: _kKeyBlobKey, value: await _handler!.getKeyBlob()); await _updateStoredKeyBlobVersion(kLatestBlobVersion); - await box.close(); } catch (e, s) { Logging.instance.log( "${_getMessageFromException(e)}\n$s", @@ -75,19 +69,13 @@ class DPS { "DPS: attempted to re initialize with existing passphrase"); } - final box = await Hive.openBox(DB.boxNameDesktopData); - final keyBlob = DB.instance.get( - boxName: DB.boxNameDesktopData, - key: _kKeyBlobKey, - ); - await box.close(); - - if (keyBlob == null) { - throw Exception( - "DPS: failed to find keyBlob while attempting to initialize with existing passphrase"); - } - try { + final keyBlob = await _get(key: _kKeyBlobKey); + + if (keyBlob == null) { + throw Exception( + "DPS: failed to find keyBlob while attempting to initialize with existing passphrase"); + } final blobVersion = await _getStoredKeyBlobVersion(); _handler = await StorageCryptoHandler.fromExisting( passphrase, @@ -97,14 +85,8 @@ class DPS { if (blobVersion < kLatestBlobVersion) { // update blob await _handler!.resetPassphrase(passphrase, kLatestBlobVersion); - final box = await Hive.openBox(DB.boxNameDesktopData); - await DB.instance.put( - boxName: DB.boxNameDesktopData, - key: _kKeyBlobKey, - value: await _handler!.getKeyBlob(), - ); + await _put(key: _kKeyBlobKey, value: await _handler!.getKeyBlob()); await _updateStoredKeyBlobVersion(kLatestBlobVersion); - await box.close(); } } catch (e, s) { Logging.instance.log( @@ -116,19 +98,13 @@ class DPS { } Future verifyPassphrase(String passphrase) async { - final box = await Hive.openBox(DB.boxNameDesktopData); - final keyBlob = DB.instance.get( - boxName: DB.boxNameDesktopData, - key: _kKeyBlobKey, - ); - await box.close(); - - if (keyBlob == null) { - // no passphrase key blob found so any passphrase is technically bad - return false; - } - try { + final keyBlob = await _get(key: _kKeyBlobKey); + + if (keyBlob == null) { + // no passphrase key blob found so any passphrase is technically bad + return false; + } final blobVersion = await _getStoredKeyBlobVersion(); await StorageCryptoHandler.fromExisting(passphrase, keyBlob, blobVersion); // existing passphrase matches key blob @@ -147,35 +123,25 @@ class DPS { String passphraseOld, String passphraseNew, ) async { - final box = await Hive.openBox(DB.boxNameDesktopData); - final keyBlob = DB.instance.get( - boxName: DB.boxNameDesktopData, - key: _kKeyBlobKey, - ); - await box.close(); - - if (keyBlob == null) { - // no passphrase key blob found so any passphrase is technically bad - return false; - } + try { + final keyBlob = await _get(key: _kKeyBlobKey); - if (!(await verifyPassphrase(passphraseOld))) { - return false; - } + if (keyBlob == null) { + // no passphrase key blob found so any passphrase is technically bad + return false; + } - final blobVersion = await _getStoredKeyBlobVersion(); + if (!(await verifyPassphrase(passphraseOld))) { + return false; + } - try { + final blobVersion = await _getStoredKeyBlobVersion(); await _handler!.resetPassphrase(passphraseNew, blobVersion); - - final box = await Hive.openBox(DB.boxNameDesktopData); - await DB.instance.put( - boxName: DB.boxNameDesktopData, + await _put( key: _kKeyBlobKey, value: await _handler!.getKeyBlob(), ); await _updateStoredKeyBlobVersion(blobVersion); - await box.close(); // successfully updated passphrase return true; @@ -189,28 +155,54 @@ class DPS { } Future hasPassword() async { - final keyBlob = DB.instance.get( - boxName: DB.boxNameDesktopData, - key: _kKeyBlobKey, - ); + final keyBlob = await _get(key: _kKeyBlobKey); return keyBlob != null; } Future _getStoredKeyBlobVersion() async { - final box = await Hive.openBox(DB.boxNameDesktopData); - final keyBlobVersionString = DB.instance.get( - boxName: DB.boxNameDesktopData, - key: _kKeyBlobVersionKey, - ); - await box.close(); + final keyBlobVersionString = await _get(key: _kKeyBlobVersionKey); return int.tryParse(keyBlobVersionString ?? "1") ?? 1; } Future _updateStoredKeyBlobVersion(int version) async { - await DB.instance.put( - boxName: DB.boxNameDesktopData, - key: _kKeyBlobVersionKey, - value: version.toString(), - ); + await _put(key: _kKeyBlobVersionKey, value: version.toString()); + } + + Future _put({required String key, required String value}) async { + Box? box; + try { + box = await Hive.openBox(kBoxNameDesktopData); + await box.put(key, value); + } catch (e, s) { + Logging.instance.log( + "DPS failed put($key): $e\n$s", + level: LogLevel.Fatal, + ); + } finally { + await box?.close(); + } + } + + Future _get({required String key}) async { + String? value; + Box? box; + try { + box = await Hive.openBox(kBoxNameDesktopData); + value = box.get(key); + } catch (e, s) { + Logging.instance.log( + "DPS failed get($key): $e\n$s", + level: LogLevel.Fatal, + ); + } finally { + await box?.close(); + } + return value; + } + + /// Dangerous. Used in one place and should not be called anywhere else. + @Deprecated("Don't use this if at all possible") + Future deleteBox() async { + await Hive.deleteBoxFromDisk(kBoxNameDesktopData); } } diff --git a/lib/utilities/enums/fee_rate_type_enum.dart b/lib/utilities/enums/fee_rate_type_enum.dart index 95374453e4..dafd49e34d 100644 --- a/lib/utilities/enums/fee_rate_type_enum.dart +++ b/lib/utilities/enums/fee_rate_type_enum.dart @@ -1,4 +1,4 @@ -enum FeeRateType { fast, average, slow } +enum FeeRateType { fast, average, slow, custom } extension FeeRateTypeExt on FeeRateType { String get prettyName { @@ -9,6 +9,8 @@ extension FeeRateTypeExt on FeeRateType { return "Average"; case FeeRateType.slow: return "Slow"; + case FeeRateType.custom: + return "Custom"; } } } diff --git a/lib/utilities/prefs.dart b/lib/utilities/prefs.dart index 6e989d49f3..6ced2f232b 100644 --- a/lib/utilities/prefs.dart +++ b/lib/utilities/prefs.dart @@ -1,7 +1,9 @@ import 'package:flutter/cupertino.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; +import 'package:stackduo/utilities/amount/amount_unit.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/backup_frequency_type.dart'; +import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/enums/languages_enum.dart'; import 'package:stackduo/utilities/enums/sync_type_enum.dart'; import 'package:uuid/uuid.dart'; @@ -46,6 +48,8 @@ class Prefs extends ChangeNotifier { _themeId = await _getThemeId(); _systemBrightnessLightThemeId = await _getSystemBrightnessLightThemeId(); _systemBrightnessDarkThemeId = await _getSystemBrightnessDarkTheme(); + await _setAmountUnits(); + await _setMaxDecimals(); _initialized = true; } @@ -796,4 +800,63 @@ class Prefs extends ChangeNotifier { ) as String? ?? "dark"; } + + // coin amount unit settings + + final Map _amountUnits = {}; + + AmountUnit amountUnit(Coin coin) => _amountUnits[coin] ?? AmountUnit.normal; + + void updateAmountUnit({required Coin coin, required AmountUnit amountUnit}) { + if (this.amountUnit(coin) != amountUnit) { + DB.instance.put( + boxName: DB.boxNamePrefs, + key: "amountUnitFor${coin.name}", + value: amountUnit.index, + ); + _amountUnits[coin] = amountUnit; + notifyListeners(); + } + } + + Future _setAmountUnits() async { + for (final coin in Coin.values) { + final unitIndex = await DB.instance.get( + boxName: DB.boxNamePrefs, + key: "amountUnitFor${coin.name}", + ) as int? ?? + 0; // 0 is "normal" + _amountUnits[coin] = AmountUnit.values[unitIndex]; + } + } + + // coin precision setting (max decimal places to show) + + final Map _amountDecimals = {}; + + int maxDecimals(Coin coin) => _amountDecimals[coin] ?? coin.decimals; + + void updateMaxDecimals({required Coin coin, required int maxDecimals}) { + if (this.maxDecimals(coin) != maxDecimals) { + DB.instance.put( + boxName: DB.boxNamePrefs, + key: "maxDecimalsFor${coin.name}", + value: maxDecimals, + ); + _amountDecimals[coin] = maxDecimals; + notifyListeners(); + } + } + + Future _setMaxDecimals() async { + for (final coin in Coin.values) { + final decimals = await DB.instance.get( + boxName: DB.boxNamePrefs, + key: "maxDecimalsFor${coin.name}", + ) as int? ?? + (coin.decimals > 18 ? 18 : coin.decimals); + // use some sane max rather than up to 30 that nano uses + _amountDecimals[coin] = decimals; + } + } } diff --git a/lib/utilities/stack_file_system.dart b/lib/utilities/stack_file_system.dart index 54bc9824ee..b82954bca3 100644 --- a/lib/utilities/stack_file_system.dart +++ b/lib/utilities/stack_file_system.dart @@ -63,16 +63,15 @@ abstract class StackFileSystem { } } - static Future applicationThemesDirectory() async { + static Future initThemesDir() async { final root = await applicationRootDirectory(); - // if (Util.isDesktop) { + final dir = Directory("${root.path}/themes"); if (!dir.existsSync()) { await dir.create(); } - return dir; - // } else { - // return root; - // } + themesDir = dir; } + + static Directory? themesDir; } diff --git a/lib/utilities/util.dart b/lib/utilities/util.dart index 6a31fae04b..ecd9a7cca8 100644 --- a/lib/utilities/util.dart +++ b/lib/utilities/util.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; +import 'dart:developer'; import 'dart:io'; import 'package:device_info_plus/device_info_plus.dart'; @@ -50,4 +52,15 @@ abstract class Util { } return MaterialColor(color.value, swatch); } + + static void printJson(dynamic json) { + if (json is Map || json is List) { + final spaces = ' ' * 4; + final encoder = JsonEncoder.withIndent(spaces); + final pretty = encoder.convert(json); + log(pretty); + } else { + log(dynamic.toString()); + } + } } diff --git a/lib/widgets/address_book_card.dart b/lib/widgets/address_book_card.dart index 633045af89..fd4f34184a 100644 --- a/lib/widgets/address_book_card.dart +++ b/lib/widgets/address_book_card.dart @@ -120,29 +120,31 @@ class _AddressBookCardState extends ConsumerState { const SizedBox( width: 16, ), - if (isDesktop && !desktopSendFrom) const Spacer(), - if (isDesktop) - Text( - coinsString, - style: STextStyles.label(context), - ), - if (!isDesktop) - Column( - crossAxisAlignment: CrossAxisAlignment.start, + Expanded( + child: Column( + crossAxisAlignment: isDesktop && !desktopSendFrom + ? CrossAxisAlignment.end + : CrossAxisAlignment.start, children: [ - Text( - contact.name, - style: STextStyles.itemSubtitle12(context), - ), - const SizedBox( - height: 4, - ), + if (!isDesktop) + Text( + contact.name, + style: STextStyles.itemSubtitle12(context), + ), + if (!isDesktop) + const SizedBox( + height: 4, + ), Text( coinsString, style: STextStyles.label(context), + textAlign: isDesktop && !desktopSendFrom + ? TextAlign.right + : TextAlign.left, ), ], ), + ), if (isDesktop && desktopSendFrom) const Spacer(), if (isDesktop && desktopSendFrom) SvgPicture.asset( diff --git a/lib/widgets/animated_widgets/rotating_arrows.dart b/lib/widgets/animated_widgets/rotating_arrows.dart index dc16973b40..6532e94c33 100644 --- a/lib/widgets/animated_widgets/rotating_arrows.dart +++ b/lib/widgets/animated_widgets/rotating_arrows.dart @@ -7,6 +7,8 @@ class RotatingArrowsController { VoidCallback? forward; VoidCallback? repeat; VoidCallback? stop; + + bool hasLoadedAnimation = false; } class RotatingArrows extends StatefulWidget { @@ -76,6 +78,7 @@ class _RotatingArrowsState extends State ), onLoaded: (composition) { animationController.duration = composition.duration; + widget.controller?.hasLoadedAnimation = true; // if controller was not set just assume continuous repeat if (widget.spinByDefault) { diff --git a/lib/widgets/coin_card.dart b/lib/widgets/coin_card.dart new file mode 100644 index 0000000000..421e71ca14 --- /dev/null +++ b/lib/widgets/coin_card.dart @@ -0,0 +1,126 @@ +/* + * This file is part of Stack Wallet. + * + * Copyright (c) 2023 Cypher Stack + * All Rights Reserved. + * The code is distributed under GPLv3 license, see LICENSE file for details. + * Generated by Cypher Stack on 2023-05-26 + * + */ + +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:stackduo/providers/providers.dart'; +import 'package:stackduo/themes/coin_card_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/utilities/assets.dart'; +import 'package:stackduo/utilities/constants.dart'; + +class CoinCard extends ConsumerWidget { + const CoinCard({ + super.key, + required this.walletId, + required this.width, + required this.height, + }); + + final String walletId; + final double width; + final double height; + + @override + Widget build(BuildContext context, WidgetRef ref) { + final coin = ref.watch( + walletsChangeNotifierProvider + .select((value) => value.getManager(walletId).coin), + ); + + final bool hasCardImageBg = ref.watch(coinCardProvider(coin)) != null; + + return Stack( + children: [ + if (hasCardImageBg) + Container( + width: width, + height: height, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + image: DecorationImage( + fit: BoxFit.cover, + image: FileImage( + File( + ref.watch(coinCardProvider(coin))!, + ), + ), + ), + ), + ), + if (!hasCardImageBg) + Container( + width: width, + height: height, + decoration: BoxDecoration( + color: Theme.of(context) + .extension()! + .colorForCoin(coin), + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + ), + ), + if (!hasCardImageBg) + Column( + children: [ + const Spacer(), + SizedBox( + height: width * 0.3, + child: Row( + children: [ + const Spacer( + flex: 9, + ), + SvgPicture.asset( + Assets.svg.ellipse2, + height: width * 0.3, + ), + // ), + const Spacer( + flex: 2, + ), + ], + ), + ), + ], + ), + if (!hasCardImageBg) + Row( + children: [ + const Spacer( + flex: 5, + ), + SizedBox( + width: width * 0.45, + child: Column( + children: [ + SvgPicture.asset( + Assets.svg.ellipse1, + width: width * 0.45, + ), + const Spacer(), + ], + ), + ), + const Spacer( + flex: 1, + ), + ], + ), + ], + ); + } +} diff --git a/lib/widgets/custom_buttons/app_bar_icon_button.dart b/lib/widgets/custom_buttons/app_bar_icon_button.dart index 0eba786dd2..ab423a9b25 100644 --- a/lib/widgets/custom_buttons/app_bar_icon_button.dart +++ b/lib/widgets/custom_buttons/app_bar_icon_button.dart @@ -36,8 +36,8 @@ class AppBarIconButton extends StatelessWidget { boxShadow: shadows, ), child: Semantics( - label: semanticsLabel, excludeSemantics: true, + label: semanticsLabel, child: MaterialButton( splashColor: Theme.of(context).extension()!.highlight, padding: EdgeInsets.zero, @@ -72,32 +72,32 @@ class AppBarBackButton extends StatelessWidget { Widget build(BuildContext context) { final isDesktop = Util.isDesktop; return Padding( - padding: isDesktop - ? const EdgeInsets.symmetric( - vertical: 20, - horizontal: 24, - ) - : const EdgeInsets.all(10), - child: AppBarIconButton( - semanticsLabel: semanticsLabel, - size: size ?? - (isDesktop - ? isCompact - ? 42 - : 56 - : 32), - color: isDesktop - ? Theme.of(context).extension()!.textFieldDefaultBG - : Theme.of(context).extension()!.background, - shadows: const [], - icon: SvgPicture.asset( - Assets.svg.arrowLeft, - width: iconSize ?? (isCompact ? 18 : 24), - height: iconSize ?? (isCompact ? 18 : 24), - color: Theme.of(context).extension()!.topNavIconPrimary, - ), - onPressed: onPressed ?? Navigator.of(context).pop, - ), - ); + padding: isDesktop + ? const EdgeInsets.symmetric( + vertical: 20, + horizontal: 24, + ) + : const EdgeInsets.all(10), + child: AppBarIconButton( + semanticsLabel: semanticsLabel, + size: size ?? + (isDesktop + ? isCompact + ? 42 + : 56 + : 32), + color: isDesktop + ? Theme.of(context).extension()!.textFieldDefaultBG + : Theme.of(context).extension()!.background, + shadows: const [], + icon: SvgPicture.asset( + Assets.svg.arrowLeft, + width: iconSize ?? (isCompact ? 18 : 24), + height: iconSize ?? (isCompact ? 18 : 24), + color: + Theme.of(context).extension()!.topNavIconPrimary, + ), + onPressed: onPressed ?? Navigator.of(context).pop, + )); } } diff --git a/lib/widgets/custom_page_view/custom_page_view.dart b/lib/widgets/custom_page_view/custom_page_view.dart index e0fe151105..e7e00fd9b7 100644 --- a/lib/widgets/custom_page_view/custom_page_view.dart +++ b/lib/widgets/custom_page_view/custom_page_view.dart @@ -255,6 +255,7 @@ class PageMetrics extends FixedScrollMetrics { required double? pixels, required double? viewportDimension, required AxisDirection axisDirection, + required double devicePixelRatio, required this.viewportFraction, }) : super( minScrollExtent: minScrollExtent, @@ -262,6 +263,7 @@ class PageMetrics extends FixedScrollMetrics { pixels: pixels, viewportDimension: viewportDimension, axisDirection: axisDirection, + devicePixelRatio: devicePixelRatio, ); @override @@ -271,6 +273,7 @@ class PageMetrics extends FixedScrollMetrics { double? pixels, double? viewportDimension, AxisDirection? axisDirection, + double? devicePixelRatio, double? viewportFraction, }) { return PageMetrics( @@ -282,6 +285,7 @@ class PageMetrics extends FixedScrollMetrics { viewportDimension: viewportDimension ?? (hasViewportDimension ? this.viewportDimension : null), axisDirection: axisDirection ?? this.axisDirection, + devicePixelRatio: devicePixelRatio ?? this.devicePixelRatio, viewportFraction: viewportFraction ?? this.viewportFraction, ); } @@ -397,7 +401,7 @@ class _PagePosition extends ScrollPositionWithSingleContext @override void saveScrollOffset() { - PageStorage.of(context.storageContext)?.writeState(context.storageContext, + PageStorage.of(context.storageContext).writeState(context.storageContext, _cachedPage ?? getPageFromPixels(pixels, viewportDimension)); } @@ -405,7 +409,7 @@ class _PagePosition extends ScrollPositionWithSingleContext void restoreScrollOffset() { if (!hasPixels) { final double? value = PageStorage.of(context.storageContext) - ?.readState(context.storageContext) as double?; + .readState(context.storageContext) as double?; if (value != null) _pageToUseOnStartup = value; } } @@ -472,6 +476,7 @@ class _PagePosition extends ScrollPositionWithSingleContext double? pixels, double? viewportDimension, AxisDirection? axisDirection, + double? devicePixelRatio, double? viewportFraction, }) { return PageMetrics( @@ -483,6 +488,7 @@ class _PagePosition extends ScrollPositionWithSingleContext viewportDimension: viewportDimension ?? (hasViewportDimension ? this.viewportDimension : null), axisDirection: axisDirection ?? this.axisDirection, + devicePixelRatio: devicePixelRatio ?? this.devicePixelRatio, viewportFraction: viewportFraction ?? this.viewportFraction, ); } diff --git a/lib/widgets/custom_pin_put/custom_pin_put.dart b/lib/widgets/custom_pin_put/custom_pin_put.dart index ac8c8b7e0f..3d9e303425 100644 --- a/lib/widgets/custom_pin_put/custom_pin_put.dart +++ b/lib/widgets/custom_pin_put/custom_pin_put.dart @@ -53,8 +53,10 @@ class CustomPinPut extends StatefulWidget { this.mainAxisSize = MainAxisSize.max, this.autofillHints, this.customKey, - }) : assert(fieldsCount > 0), - super(key: key); + this.onPinLengthChanged, + }) : super(key: key); + + final void Function(int)? onPinLengthChanged; final double? width; final double? height; diff --git a/lib/widgets/custom_pin_put/custom_pin_put_state.dart b/lib/widgets/custom_pin_put/custom_pin_put_state.dart index 3ff6dbd582..dcadabfda3 100644 --- a/lib/widgets/custom_pin_put/custom_pin_put_state.dart +++ b/lib/widgets/custom_pin_put/custom_pin_put_state.dart @@ -1,3 +1,5 @@ +import 'dart:math'; + import 'package:flutter/material.dart'; import 'package:stackduo/widgets/custom_pin_put/custom_pin_put.dart'; import 'package:stackduo/widgets/custom_pin_put/pin_keyboard.dart'; @@ -10,6 +12,13 @@ class CustomPinPutState extends State int get selectedIndex => _controller.value.text.length; + int _pinCount = 0; + int get pinCount => _pinCount; + set pinCount(int newCount) { + _pinCount = newCount; + widget.onPinLengthChanged?.call(newCount); + } + @override void initState() { _controller = widget.controller ?? TextEditingController(); @@ -50,22 +59,19 @@ class CustomPinPutState extends State @override Widget build(BuildContext context) { - // final bool randomize = ref - // .read(prefsChangeNotifierProvider) - // .randomizePIN; return SizedBox( width: widget.width, height: widget.height, child: Column( children: [ SizedBox( - width: (30 * widget.fieldsCount) - 18, + width: max((30 * pinCount) - 18, 1), child: Stack( children: [ _hiddenTextField, Align( alignment: Alignment.bottomCenter, - child: _fields, + child: _fields(pinCount), ), ], ), @@ -75,15 +81,22 @@ class CustomPinPutState extends State isRandom: widget.isRandom, customKey: widget.customKey, onNumberKeyPressed: (number) { - if (_controller.text.length < widget.fieldsCount) { - _controller.text += number; - } + _controller.text += number; + + // add a set state and have the counter increment + setState(() { + pinCount = _controller.text.length; + }); }, onBackPressed: () { final text = _controller.text; if (text.isNotEmpty) { _controller.text = text.substring(0, text.length - 1); + setState(() { + pinCount = _controller.text.length; + }); } + // decrement counter here }, onSubmitPressed: () { final pin = _controller.value.text; @@ -117,7 +130,7 @@ class CustomPinPutState extends State textCapitalization: widget.textCapitalization, inputFormatters: widget.inputFormatters, enableInteractiveSelection: false, - maxLength: widget.fieldsCount, + maxLength: 10, showCursor: false, scrollPadding: EdgeInsets.zero, decoration: widget.inputDecoration, @@ -127,21 +140,22 @@ class CustomPinPutState extends State ); } - Widget get _fields { + // have it include an int as a param + Widget _fields(int count) { return ValueListenableBuilder( valueListenable: _textControllerValue, builder: (BuildContext context, value, Widget? child) { return Row( mainAxisSize: widget.mainAxisSize, mainAxisAlignment: widget.fieldsAlignment, - children: _buildFieldsWithSeparator(), + children: _buildFieldsWithSeparator(count), ); }, ); } - List _buildFieldsWithSeparator() { - final fields = Iterable.generate(widget.fieldsCount).map((index) { + List _buildFieldsWithSeparator(int count) { + final fields = Iterable.generate(count).map((index) { return _getField(index); }).toList(); diff --git a/lib/widgets/desktop/desktop_fee_dialog.dart b/lib/widgets/desktop/desktop_fee_dialog.dart new file mode 100644 index 0000000000..3b9cf93f2d --- /dev/null +++ b/lib/widgets/desktop/desktop_fee_dialog.dart @@ -0,0 +1,381 @@ +import 'package:cw_core/monero_transaction_priority.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:stackduo/models/models.dart'; +import 'package:stackduo/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart'; +import 'package:stackduo/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_fee_dropdown.dart'; +import 'package:stackduo/providers/global/wallets_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; +import 'package:stackduo/utilities/constants.dart'; +import 'package:stackduo/utilities/enums/coin_enum.dart'; +import 'package:stackduo/utilities/enums/fee_rate_type_enum.dart'; +import 'package:stackduo/utilities/text_styles.dart'; +import 'package:stackduo/widgets/animated_text.dart'; +import 'package:stackduo/widgets/desktop/desktop_dialog.dart'; +import 'package:stackduo/widgets/desktop/desktop_dialog_close_button.dart'; + +class DesktopFeeDialog extends ConsumerStatefulWidget { + const DesktopFeeDialog({ + Key? key, + required this.walletId, + this.isToken = false, + }) : super(key: key); + + final String walletId; + final bool isToken; + + @override + ConsumerState createState() => _DesktopFeeDialogState(); +} + +class _DesktopFeeDialogState extends ConsumerState { + late final String walletId; + + FeeObject? feeObject; + FeeRateType feeRateType = FeeRateType.average; + + Future feeFor({ + required Amount amount, + required FeeRateType feeRateType, + required int feeRate, + required Coin coin, + }) async { + switch (feeRateType) { + case FeeRateType.fast: + if (ref.read(feeSheetSessionCacheProvider).fast[amount] == null) { + // if (widget.isToken == false) { + final manager = + ref.read(walletsChangeNotifierProvider).getManager(walletId); + + if (coin == Coin.monero) { + final fee = await manager.estimateFeeFor( + amount, MoneroTransactionPriority.fast.raw!); + ref.read(feeSheetSessionCacheProvider).fast[amount] = fee; + // } else if ((coin == Coin.firo || coin == Coin.firoTestNet) && + // ref.read(publicPrivateBalanceStateProvider.state).state != + // "Private") { + // ref.read(feeSheetSessionCacheProvider).fast[amount] = + // await (manager.wallet as FiroWallet) + // .estimateFeeForPublic(amount, feeRate); + } else { + ref.read(feeSheetSessionCacheProvider).fast[amount] = + await manager.estimateFeeFor(amount, feeRate); + } + // } else { + // final tokenWallet = ref.read(tokenServiceProvider)!; + // final fee = tokenWallet.estimateFeeFor(feeRate); + // ref.read(tokenFeeSessionCacheProvider).fast[amount] = fee; + // } + } + return ref.read(feeSheetSessionCacheProvider).fast[amount]!; + + case FeeRateType.average: + if (ref.read(feeSheetSessionCacheProvider).average[amount] == null) { + // if (widget.isToken == false) { + final manager = + ref.read(walletsChangeNotifierProvider).getManager(walletId); + + if (coin == Coin.monero) { + final fee = await manager.estimateFeeFor( + amount, MoneroTransactionPriority.regular.raw!); + ref.read(feeSheetSessionCacheProvider).average[amount] = fee; + // } else if ((coin == Coin.firo || coin == Coin.firoTestNet) && + // ref.read(publicPrivateBalanceStateProvider.state).state != + // "Private") { + // ref.read(feeSheetSessionCacheProvider).average[amount] = + // await (manager.wallet as FiroWallet) + // .estimateFeeForPublic(amount, feeRate); + } else { + ref.read(feeSheetSessionCacheProvider).average[amount] = + await manager.estimateFeeFor(amount, feeRate); + } + // } else { + // final tokenWallet = ref.read(tokenServiceProvider)!; + // final fee = tokenWallet.estimateFeeFor(feeRate); + // ref.read(tokenFeeSessionCacheProvider).average[amount] = fee; + // } + } + return ref.read(feeSheetSessionCacheProvider).average[amount]!; + + case FeeRateType.slow: + if (ref.read(feeSheetSessionCacheProvider).slow[amount] == null) { + // if (widget.isToken == false) { + final manager = + ref.read(walletsChangeNotifierProvider).getManager(walletId); + + if (coin == Coin.monero) { + final fee = await manager.estimateFeeFor( + amount, MoneroTransactionPriority.slow.raw!); + ref.read(feeSheetSessionCacheProvider).slow[amount] = fee; + // } else if ((coin == Coin.firo || coin == Coin.firoTestNet) && + // ref.read(publicPrivateBalanceStateProvider.state).state != + // "Private") { + // ref.read(feeSheetSessionCacheProvider).slow[amount] = + // await (manager.wallet as FiroWallet) + // .estimateFeeForPublic(amount, feeRate); + } else { + ref.read(feeSheetSessionCacheProvider).slow[amount] = + await manager.estimateFeeFor(amount, feeRate); + } + // } else { + // final tokenWallet = ref.read(tokenServiceProvider)!; + // final fee = tokenWallet.estimateFeeFor(feeRate); + // ref.read(tokenFeeSessionCacheProvider).slow[amount] = fee; + // } + } + return ref.read(feeSheetSessionCacheProvider).slow[amount]!; + + default: + return Amount.zero; + } + } + + @override + void initState() { + walletId = widget.walletId; + super.initState(); + } + + @override + Widget build(BuildContext context) { + return DesktopDialog( + maxWidth: 450, + maxHeight: double.infinity, + child: FutureBuilder( + future: ref.watch( + walletsChangeNotifierProvider.select( + (value) => value.getManager(walletId).fees, + ), + ), + builder: (context, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.done && + snapshot.hasData) { + feeObject = snapshot.data!; + } + + return Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: const EdgeInsets.only(left: 32), + child: Text( + "Choose fee", + style: STextStyles.desktopH3(context), + ), + ), + const DesktopDialogCloseButton(), + ], + ), + ...FeeRateType.values.map( + (e) => Padding( + padding: const EdgeInsets.only( + left: 32, + right: 32, + bottom: 16, + ), + child: DesktopFeeItem( + feeObject: feeObject, + feeRateType: e, + walletId: walletId, + feeFor: feeFor, + isSelected: false, + ), + ), + ), + const SizedBox( + height: 16, + ), + ], + ); + }, + ), + ); + } +} + +class DesktopFeeItem extends ConsumerStatefulWidget { + const DesktopFeeItem({ + Key? key, + required this.feeObject, + required this.feeRateType, + required this.walletId, + required this.feeFor, + required this.isSelected, + }) : super(key: key); + + final FeeObject? feeObject; + final FeeRateType feeRateType; + final String walletId; + final Future Function({ + required Amount amount, + required FeeRateType feeRateType, + required int feeRate, + required Coin coin, + }) feeFor; + final bool isSelected; + + @override + ConsumerState createState() => _DesktopFeeItemState(); +} + +class _DesktopFeeItemState extends ConsumerState { + String? feeString; + String? timeString; + + static const stringsToLoopThrough = [ + "Calculating", + "Calculating.", + "Calculating..", + "Calculating...", + ]; + + String estimatedTimeToBeIncludedInNextBlock( + int targetBlockTime, int estimatedNumberOfBlocks) { + int time = targetBlockTime * estimatedNumberOfBlocks; + + int hours = (time / 3600).floor(); + if (hours > 1) { + return "~$hours hours"; + } else if (hours == 1) { + return "~$hours hour"; + } + + // less than an hour + + final string = (time / 60).toStringAsFixed(1); + + if (string == "1.0") { + return "~1 minute"; + } else { + if (string.endsWith(".0")) { + return "~${(time / 60).floor()} minutes"; + } + return "~$string minutes"; + } + } + + @override + Widget build(BuildContext context) { + debugPrint("BUILD: $runtimeType : ${widget.feeRateType}"); + + return MaterialButton( + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + onPressed: () { + Navigator.of(context).pop( + ( + widget.feeRateType, + feeString, + timeString, + ), + ); + }, + child: Builder( + builder: (_) { + if (widget.feeRateType == FeeRateType.custom) { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + widget.feeRateType.prettyName, + style: + STextStyles.desktopTextExtraExtraSmall(context).copyWith( + color: Theme.of(context) + .extension()! + .textFieldActiveText, + ), + textAlign: TextAlign.left, + ), + ], + ); + } + + final manager = ref.watch(walletsChangeNotifierProvider + .select((value) => value.getManager(widget.walletId))); + + if (widget.feeObject == null) { + return AnimatedText( + stringsToLoopThrough: stringsToLoopThrough, + style: STextStyles.desktopTextExtraExtraSmall(context).copyWith( + color: Theme.of(context) + .extension()! + .textFieldActiveText, + ), + ); + } else { + return FutureBuilder( + future: widget.feeFor( + coin: manager.coin, + feeRateType: widget.feeRateType, + feeRate: widget.feeRateType == FeeRateType.fast + ? widget.feeObject!.fast + : widget.feeRateType == FeeRateType.slow + ? widget.feeObject!.slow + : widget.feeObject!.medium, + amount: ref.watch(sendAmountProvider.state).state, + ), + builder: (_, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.done && + snapshot.hasData) { + feeString = "${widget.feeRateType.prettyName} " + "(~${ref.watch(pAmountFormatter(manager.coin)).format( + snapshot.data!, + indicatePrecisionLoss: false, + )})"; + + timeString = estimatedTimeToBeIncludedInNextBlock( + Constants.targetBlockTimeInSeconds(manager.coin), + widget.feeRateType == FeeRateType.fast + ? widget.feeObject!.numberOfBlocksFast + : widget.feeRateType == FeeRateType.slow + ? widget.feeObject!.numberOfBlocksSlow + : widget.feeObject!.numberOfBlocksAverage, + ); + + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + feeString!, + style: STextStyles.desktopTextExtraExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textFieldActiveText, + ), + textAlign: TextAlign.left, + ), + if (widget.feeObject != null) + Text( + timeString!, + style: STextStyles.desktopTextExtraExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textFieldActiveSearchIconRight, + ), + ), + ], + ); + } else { + return AnimatedText( + stringsToLoopThrough: stringsToLoopThrough, + style: STextStyles.desktopTextExtraExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textFieldActiveText, + ), + ); + } + }, + ); + } + }, + ), + ); + } +} diff --git a/lib/widgets/fee_slider.dart b/lib/widgets/fee_slider.dart new file mode 100644 index 0000000000..7a225063ce --- /dev/null +++ b/lib/widgets/fee_slider.dart @@ -0,0 +1,56 @@ +import 'dart:math'; + +import 'package:flutter/material.dart'; +import 'package:stackduo/utilities/text_styles.dart'; + +class FeeSlider extends StatefulWidget { + const FeeSlider({ + super.key, + required this.onSatVByteChanged, + }); + + final void Function(int) onSatVByteChanged; + + @override + State createState() => _FeeSliderState(); +} + +class _FeeSliderState extends State { + static const int min = 1; + static const int max = 4; + + double sliderValue = 0; + + int rate = min; + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "sat/vByte", + style: STextStyles.smallMed12(context), + ), + Text( + "$rate", + style: STextStyles.smallMed12(context), + ), + ], + ), + Slider( + value: sliderValue, + onChanged: (value) { + setState(() { + sliderValue = value; + rate = pow(sliderValue * (max - min) + min, 4).toInt(); + }); + widget.onSatVByteChanged(rate); + }, + ), + ], + ); + } +} diff --git a/lib/widgets/gradient_card.dart b/lib/widgets/gradient_card.dart new file mode 100644 index 0000000000..9d103cb59c --- /dev/null +++ b/lib/widgets/gradient_card.dart @@ -0,0 +1,44 @@ +/* + * This file is part of Stack Wallet. + * + * Copyright (c) 2023 Cypher Stack + * All Rights Reserved. + * The code is distributed under GPLv3 license, see LICENSE file for details. + * Generated by Cypher Stack on 2023-05-26 + * + */ + +// import 'package:flutter/material.dart'; +// import 'package:stackduo/utilities/cfcolors.dart'; +// const GradientCard( +// {Key key, +// this.child, +// @required this.gradient, +// this.backgroundColorForTransparentGradient = Colors.white, +// this.circularBorderRadius = 0.0}) +// : super(key: key); +// +// final Widget child; +// final Gradient gradient; +// final Color backgroundColorForTransparentGradient; +// final double circularBorderRadius; +// +// @override +// Widget build(BuildContext context) { +// return Material( +// color: backgroundColorForTransparentGradient, +// borderRadius: BorderRadius.circular(circularBorderRadius), +// elevation: 0, +// child: Container( +// decoration: BoxDecoration( +// gradient: gradient, +// borderRadius: BorderRadius.circular(circularBorderRadius), +// boxShadow: [ +// CFColors.standardBoxShadow, +// ], +// ), +// child: child, +// ), +// ); +// } +// } diff --git a/lib/widgets/managed_favorite.dart b/lib/widgets/managed_favorite.dart index da4b473465..db75b78bc6 100644 --- a/lib/widgets/managed_favorite.dart +++ b/lib/widgets/managed_favorite.dart @@ -6,8 +6,9 @@ import 'package:flutter_svg/svg.dart'; import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/themes/coin_icon_provider.dart'; import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/constants.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/custom_buttons/favorite_toggle.dart'; @@ -34,6 +35,14 @@ class _ManagedFavoriteCardState extends ConsumerState { final isDesktop = Util.isDesktop; + final balance = ref.watch( + walletsChangeNotifierProvider.select( + (value) => value.getManager(widget.walletId).balance, + ), + ); + + final Amount total = balance.total; + return RoundedWhiteContainer( padding: EdgeInsets.all(isDesktop ? 0 : 4.0), child: RawMaterialButton( @@ -107,14 +116,11 @@ class _ManagedFavoriteCardState extends ConsumerState { ), Expanded( child: Text( - "${manager.balance.total.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ), - decimalPlaces: manager.coin.decimals, - )} ${manager.coin.ticker}", + ref + .watch( + pAmountFormatter(manager.coin), + ) + .format(total), style: STextStyles.itemSubtitle(context), ), ), @@ -150,14 +156,11 @@ class _ManagedFavoriteCardState extends ConsumerState { height: 2, ), Text( - "${manager.balance.total.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ), - decimalPlaces: manager.coin.decimals, - )} ${manager.coin.ticker}", + ref + .watch( + pAmountFormatter(manager.coin), + ) + .format(total), style: STextStyles.itemSubtitle(context), ), ], diff --git a/lib/widgets/textfields/exchange_textfield.dart b/lib/widgets/textfields/exchange_textfield.dart index a32fde585c..c904f9f308 100644 --- a/lib/widgets/textfields/exchange_textfield.dart +++ b/lib/widgets/textfields/exchange_textfield.dart @@ -1,14 +1,16 @@ import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:stackduo/models/exchange/aggregate_currency.dart'; +import 'package:stackduo/providers/global/locale_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/utilities/amount/amount_input_formatter.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/loading_indicator.dart'; -class ExchangeTextField extends StatefulWidget { +class ExchangeTextField extends ConsumerStatefulWidget { const ExchangeTextField({ Key? key, this.borderRadius = 0, @@ -44,10 +46,10 @@ class ExchangeTextField extends StatefulWidget { final AggregateCurrency? currency; @override - State createState() => _ExchangeTextFieldState(); + ConsumerState createState() => _ExchangeTextFieldState(); } -class _ExchangeTextFieldState extends State { +class _ExchangeTextFieldState extends ConsumerState { late final TextEditingController controller; late final FocusNode focusNode; late final TextStyle textStyle; @@ -119,12 +121,17 @@ class _ExchangeTextFieldState extends State { ), ), inputFormatters: [ - // regex to validate a crypto amount with 8 decimal places - TextInputFormatter.withFunction((oldValue, newValue) => - RegExp(r'^([0-9]*[,.]?[0-9]{0,8}|[,.][0-9]{0,8})$') - .hasMatch(newValue.text) - ? newValue - : oldValue), + AmountInputFormatter( + decimals: 8, // todo change this + locale: ref.watch(localeServiceChangeNotifierProvider + .select((value) => value.locale)), + ), + // // regex to validate a crypto amount with 8 decimal places + // TextInputFormatter.withFunction((oldValue, newValue) => + // RegExp(r'^([0-9]*[,.]?[0-9]{0,8}|[,.][0-9]{0,8})$') + // .hasMatch(newValue.text) + // ? newValue + // : oldValue), ], ), ), diff --git a/lib/widgets/trade_card.dart b/lib/widgets/trade_card.dart index 12b57d9b53..a4968995e9 100644 --- a/lib/widgets/trade_card.dart +++ b/lib/widgets/trade_card.dart @@ -24,7 +24,7 @@ class TradeCard extends ConsumerWidget { final Trade trade; final VoidCallback onTap; - String _fetchIconAssetForStatus(String statusString, ThemeAssets assets) { + String _fetchIconAssetForStatus(String statusString, IThemeAssets assets) { ChangeNowTransactionStatus? status; try { if (statusString.toLowerCase().startsWith("waiting")) { @@ -89,11 +89,7 @@ class TradeCard extends ConsumerWidget { File( _fetchIconAssetForStatus( trade.status, - ref.watch( - themeProvider.select( - (value) => value.assets, - ), - ), + ref.watch(themeAssetsProvider), ), ), width: 32, diff --git a/lib/widgets/transaction_card.dart b/lib/widgets/transaction_card.dart index 60fb0c8e7c..21c6100020 100644 --- a/lib/widgets/transaction_card.dart +++ b/lib/widgets/transaction_card.dart @@ -8,6 +8,7 @@ import 'package:stackduo/pages/wallet_view/transaction_views/transaction_details import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/format.dart'; @@ -33,9 +34,11 @@ class TransactionCard extends ConsumerStatefulWidget { class _TransactionCardState extends ConsumerState { late final Transaction _transaction; late final String walletId; + late final bool isTokenTx; late final String prefix; late final String unit; late final Coin coin; + late final dynamic tokenContract; String whatIsIt( TransactionType type, @@ -92,6 +95,7 @@ class _TransactionCardState extends ConsumerState { void initState() { walletId = widget.walletId; _transaction = widget.transaction; + isTokenTx = _transaction.subType == TransactionSubType.ethToken; if (Util.isDesktop) { if (_transaction.type == TransactionType.outgoing) { prefix = "-"; @@ -108,6 +112,8 @@ class _TransactionCardState extends ConsumerState { .getManager(widget.walletId) .coin; + tokenContract = null; + unit = coin.ticker; super.initState(); } @@ -216,9 +222,7 @@ class _TransactionCardState extends ConsumerState { final amount = _transaction.realAmount; return Text( - "$prefix${amount.localizedStringAsFixed( - locale: locale, - )} $unit", + "$prefix${ref.watch(pAmountFormatter(coin)).format(amount, ethContract: tokenContract)}", style: STextStyles.itemSubtitle12(context), ); }, @@ -261,9 +265,8 @@ class _TransactionCardState extends ConsumerState { "$prefix${Amount.fromDecimal( amount.decimal * price, fractionDigits: 2, - ).localizedStringAsFixed( + ).fiatString( locale: locale, - decimalPlaces: 2, )} $baseCurrency", style: STextStyles.label(context), ); diff --git a/lib/widgets/wallet_card.dart b/lib/widgets/wallet_card.dart index 0a14b87c56..6fcc523e27 100644 --- a/lib/widgets/wallet_card.dart +++ b/lib/widgets/wallet_card.dart @@ -17,11 +17,13 @@ class SimpleWalletCard extends ConsumerWidget { const SimpleWalletCard({ Key? key, required this.walletId, + this.contractAddress, this.popPrevious = false, this.desktopNavigatorState, }) : super(key: key); final String walletId; + final String? contractAddress; final bool popPrevious; final NavigatorState? desktopNavigatorState; @@ -81,6 +83,7 @@ class SimpleWalletCard extends ConsumerWidget { ), child: WalletInfoRow( walletId: walletId, + contractAddress: null, onPressedDesktop: Util.isDesktop ? () => _openWallet(context, ref) : null, ), diff --git a/lib/widgets/wallet_info_row/sub_widgets/wallet_info_row_balance.dart b/lib/widgets/wallet_info_row/sub_widgets/wallet_info_row_balance.dart index db4eedcaa3..4cb60bef07 100644 --- a/lib/widgets/wallet_info_row/sub_widgets/wallet_info_row_balance.dart +++ b/lib/widgets/wallet_info_row/sub_widgets/wallet_info_row_balance.dart @@ -1,10 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:stackduo/providers/providers.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/util.dart'; class WalletInfoRowBalance extends ConsumerWidget { @@ -23,24 +23,25 @@ class WalletInfoRowBalance extends ConsumerWidget { .watch(walletsChangeNotifierProvider.notifier) .getManagerProvider(walletId)); - final locale = ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ); - Amount totalBalance; - int decimals; - String unit; + // EthContract? contract; + // if (contractAddress == null) { totalBalance = manager.balance.total; - unit = manager.coin.ticker; - decimals = manager.coin.decimals; + // if (manager.coin == Coin.firo || manager.coin == Coin.firoTestNet) { + // totalBalance = + // totalBalance + (manager.wallet as FiroWallet).balancePrivate.total; + // } + // contract = null; + // } else { + // final ethWallet = manager.wallet as EthereumWallet; + // contract = MainDB.instance.getEthContractSync(contractAddress!)!; + // totalBalance = ethWallet.getCachedTokenBalance(contract).total; + // } return Text( - "${totalBalance.localizedStringAsFixed( - locale: locale, - decimalPlaces: decimals, - )} $unit", + ref + .watch(pAmountFormatter(manager.coin)) + .format(totalBalance, ethContract: null), style: Util.isDesktop ? STextStyles.desktopTextExtraSmall(context).copyWith( color: Theme.of(context).extension()!.textSubtitle1, diff --git a/lib/widgets/wallet_info_row/sub_widgets/wallet_info_row_coin_icon.dart b/lib/widgets/wallet_info_row/sub_widgets/wallet_info_row_coin_icon.dart index a15857c8c0..a49da1cb75 100644 --- a/lib/widgets/wallet_info_row/sub_widgets/wallet_info_row_coin_icon.dart +++ b/lib/widgets/wallet_info_row/sub_widgets/wallet_info_row_coin_icon.dart @@ -3,6 +3,10 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:isar/isar.dart'; +import 'package:stackduo/models/isar/exchange_cache/currency.dart'; +import 'package:stackduo/services/exchange/change_now/change_now_exchange.dart'; +import 'package:stackduo/services/exchange/exchange_data_loading_service.dart'; import 'package:stackduo/themes/coin_icon_provider.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/constants.dart'; @@ -13,13 +17,30 @@ class WalletInfoCoinIcon extends ConsumerWidget { Key? key, required this.coin, this.size = 32, + this.contractAddress, }) : super(key: key); final Coin coin; + final String? contractAddress; final double size; @override Widget build(BuildContext context, WidgetRef ref) { + Currency? currency; + if (contractAddress != null) { + currency = ExchangeDataLoadingService.instance.isar.currencies + .where() + .exchangeNameEqualTo(ChangeNowExchange.exchangeName) + .filter() + .tokenContractEqualTo( + contractAddress!, + caseSensitive: false, + ) + .and() + .imageIsNotEmpty() + .findFirstSync(); + } + return Container( width: size, height: size, @@ -33,14 +54,20 @@ class WalletInfoCoinIcon extends ConsumerWidget { ), ), child: Padding( - padding: const EdgeInsets.all(4), - child: SvgPicture.file( - File( - ref.watch(coinIconProvider(coin)), - ), - width: 20, - height: 20, - ), + padding: EdgeInsets.all(size / 5), + child: currency != null && currency.image.isNotEmpty + ? SvgPicture.network( + currency.image, + width: 20, + height: 20, + ) + : SvgPicture.file( + File( + ref.watch(coinIconProvider(coin)), + ), + width: 20, + height: 20, + ), ), ); } diff --git a/lib/widgets/wallet_info_row/wallet_info_row.dart b/lib/widgets/wallet_info_row/wallet_info_row.dart index 93f4f95775..f00425ed25 100644 --- a/lib/widgets/wallet_info_row/wallet_info_row.dart +++ b/lib/widgets/wallet_info_row/wallet_info_row.dart @@ -13,10 +13,12 @@ class WalletInfoRow extends ConsumerWidget { Key? key, required this.walletId, this.onPressedDesktop, + this.contractAddress, this.padding = const EdgeInsets.all(0), }) : super(key: key); final String walletId; + final String? contractAddress; final VoidCallback? onPressedDesktop; final EdgeInsets padding; @@ -26,6 +28,12 @@ class WalletInfoRow extends ConsumerWidget { .watch(walletsChangeNotifierProvider.notifier) .getManagerProvider(walletId)); + // EthContract? contract; + // if (contractAddress != null) { + // contract = ref.watch(mainDBProvider + // .select((value) => value.getEthContractSync(contractAddress!))); + // } + if (Util.isDesktop) { return Padding( padding: padding, @@ -39,19 +47,42 @@ class WalletInfoRow extends ConsumerWidget { children: [ WalletInfoCoinIcon( coin: manager.coin, + contractAddress: contractAddress, ), const SizedBox( width: 12, ), + // contract != null + // ? Row( + // children: [ + // Text( + // contract.name, + // style: + // STextStyles.desktopTextExtraSmall(context) + // .copyWith( + // color: Theme.of(context) + // .extension()! + // .textDark, + // ), + // ), + // const SizedBox( + // width: 4, + // ), + // CoinTickerTag( + // walletId: walletId, + // ), + // ], + // ) + // : Text( - manager.walletName, - style: - STextStyles.desktopTextExtraSmall(context).copyWith( - color: Theme.of(context) - .extension()! - .textDark, - ), - ), + manager.walletName, + style: STextStyles.desktopTextExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textDark, + ), + ), ], ), ), @@ -59,6 +90,7 @@ class WalletInfoRow extends ConsumerWidget { flex: 4, child: WalletInfoRowBalance( walletId: walletId, + contractAddress: contractAddress, ), ), Expanded( @@ -82,6 +114,7 @@ class WalletInfoRow extends ConsumerWidget { children: [ WalletInfoCoinIcon( coin: manager.coin, + contractAddress: contractAddress, ), const SizedBox( width: 12, @@ -91,15 +124,32 @@ class WalletInfoRow extends ConsumerWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ + // contract != null + // ? Row( + // children: [ + // Text( + // contract.name, + // style: STextStyles.titleBold12(context), + // ), + // const SizedBox( + // width: 4, + // ), + // CoinTickerTag( + // walletId: walletId, + // ), + // ], + // ) + // : Text( - manager.walletName, - style: STextStyles.titleBold12(context), - ), + manager.walletName, + style: STextStyles.titleBold12(context), + ), const SizedBox( height: 2, ), WalletInfoRowBalance( walletId: walletId, + contractAddress: contractAddress, ), ], ), diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 5dfa9cfa19..77eddb2e3f 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,14 +5,14 @@ import FlutterMacOS import Foundation -import connectivity_plus_macos +import connectivity_plus import desktop_drop import device_info_plus import devicelocale import flutter_local_notifications import flutter_secure_storage_macos import isar_flutter_libs -import package_info_plus_macos +import package_info_plus import path_provider_foundation import share_plus import shared_preferences_foundation @@ -27,7 +27,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) DevicelocalePlugin.register(with: registry.registrar(forPlugin: "DevicelocalePlugin")) FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin")) - FlutterSecureStorageMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStorageMacosPlugin")) + FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin")) IsarFlutterLibsPlugin.register(with: registry.registrar(forPlugin: "IsarFlutterLibsPlugin")) FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) diff --git a/pubspec.lock b/pubspec.lock index 8bbd5d3fe0..171a10c62f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,26 +5,18 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "4897882604d919befd350648c7f91926a9d5de99e67b455bf0917cc2362f4bb8" + sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a url: "https://pub.dev" source: hosted - version: "47.0.0" + version: "61.0.0" analyzer: dependency: "direct dev" description: name: analyzer - sha256: "690e335554a8385bc9d787117d9eb52c0c03ee207a607e593de3c9d71b1cfe80" + sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 url: "https://pub.dev" source: hosted - version: "4.7.0" - animations: - dependency: "direct main" - description: - name: animations - sha256: fe8a6bdca435f718bb1dc8a11661b2c22504c6da40ef934cee8327ed77934164 - url: "https://pub.dev" - source: hosted - version: "2.0.7" + version: "5.13.0" another_flushbar: dependency: "direct main" description: @@ -33,14 +25,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.12.29" - app_settings: - dependency: "direct main" - description: - name: app_settings - sha256: "66715a323ac36d6c8201035ba678777c0d2ea869e4d7064300d95af10c3bb8cb" - url: "https://pub.dev" - source: hosted - version: "4.2.0" archive: dependency: "direct main" description: @@ -69,24 +53,24 @@ packages: dependency: "direct main" description: name: async - sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" url: "https://pub.dev" source: hosted - version: "2.10.0" + version: "2.11.0" barcode_scan2: dependency: "direct main" description: name: barcode_scan2 - sha256: f9af9252b8f3f5fa446f5456fd45f8871d09f883d8389a1d608b39231bfbc3fa + sha256: "0b0625d27841a21e36e896195d86b2aada335e3c486f63647cce701495718e16" url: "https://pub.dev" source: hosted - version: "4.2.3" + version: "4.2.4" bech32: dependency: "direct main" description: path: "." - ref: "22279d4bb24ed541b431acd269a1bc50af0f36a0" - resolved-ref: "22279d4bb24ed541b431acd269a1bc50af0f36a0" + ref: b6d2a5b4cd17311d917787c0f9505f04932659b1 + resolved-ref: b6d2a5b4cd17311d917787c0f9505f04932659b1 url: "https://github.com/cypherstack/bech32.git" source: git version: "0.2.1" @@ -102,8 +86,8 @@ packages: dependency: "direct main" description: path: "." - ref: "3bef5acc21340f3cc78df0ad1dce5868a3ed68a5" - resolved-ref: "3bef5acc21340f3cc78df0ad1dce5868a3ed68a5" + ref: "0cd6d54e2860bea68fc50c801cb9db2a760192fb" + resolved-ref: "0cd6d54e2860bea68fc50c801cb9db2a760192fb" url: "https://github.com/cypherstack/stack-bip39.git" source: git version: "1.0.6" @@ -111,26 +95,17 @@ packages: dependency: "direct main" description: path: "." - ref: "38847255d035c0f6ec5bc93d19130ec804cf90e9" - resolved-ref: "38847255d035c0f6ec5bc93d19130ec804cf90e9" + ref: "081ca1863c2feba00c35bb5b297902f12f499941" + resolved-ref: "081ca1863c2feba00c35bb5b297902f12f499941" url: "https://github.com/cypherstack/bip47.git" source: git version: "2.0.0" - bitbox: - dependency: "direct main" - description: - path: "." - ref: ea65073efbaf395a5557e8cd7bd72f195cd7eb11 - resolved-ref: ea65073efbaf395a5557e8cd7bd72f195cd7eb11 - url: "https://github.com/Quppy/bitbox-flutter.git" - source: git - version: "1.0.1" bitcoindart: dependency: "direct main" description: path: "." - ref: "004d6f82dff7389b561e5078b4649adcd2d9c10f" - resolved-ref: "004d6f82dff7389b561e5078b4649adcd2d9c10f" + ref: af6d6c27edfe2e7cc35772ed2684eb4cc826f0e4 + resolved-ref: af6d6c27edfe2e7cc35772ed2684eb4cc826f0e4 url: "https://github.com/cypherstack/bitcoindart.git" source: git version: "3.0.1" @@ -170,10 +145,10 @@ packages: dependency: transitive description: name: build_daemon - sha256: "6bc5544ea6ce4428266e7ea680e945c68806c4aae2da0eb5e9ccf38df8d6acbf" + sha256: "5f02d73eb2ba16483e693f80bee4f088563a820e47d1027d4cdfe62b5bb43e65" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "4.0.0" build_resolvers: dependency: transitive description: @@ -186,10 +161,10 @@ packages: dependency: "direct dev" description: name: build_runner - sha256: "93f05c041932674be039b0a2323d6cf57e5f2bbf884a3c0382f9e53fc45ebace" + sha256: "5e1929ad37d48bd382b124266cb8e521de5548d406a45a5ae6656c13dab73e37" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.4.5" build_runner_core: dependency: transitive description: @@ -218,10 +193,10 @@ packages: dependency: transitive description: name: characters - sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" checked_yaml: dependency: transitive description: @@ -250,42 +225,26 @@ packages: dependency: transitive description: name: code_builder - sha256: "0d43dd1288fd145de1ecc9a3948ad4a6d5a82f0a14c4fdd0892260787d975cbe" + sha256: "4ad01d6e56db961d29661561effde45e519939fdaeb46c351275b182eac70189" url: "https://pub.dev" source: hosted - version: "4.4.0" + version: "4.5.0" collection: dependency: transitive description: name: collection - sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" url: "https://pub.dev" source: hosted - version: "1.17.0" + version: "1.17.1" connectivity_plus: dependency: "direct main" description: name: connectivity_plus - sha256: e18bbd0243342ceca6fb33718fd2737c468c1a881ad7fed4b0a47258b5838d9d - url: "https://pub.dev" - source: hosted - version: "2.3.6+1" - connectivity_plus_linux: - dependency: transitive - description: - name: connectivity_plus_linux - sha256: "3caf859d001f10407b8e48134c761483e4495ae38094ffcca97193f6c271f5e2" + sha256: "8599ae9edca5ff96163fca3e36f8e481ea917d1e71cdad912c084b5579913f34" url: "https://pub.dev" source: hosted - version: "1.3.1" - connectivity_plus_macos: - dependency: transitive - description: - name: connectivity_plus_macos - sha256: "488d2de1e47e1224ad486e501b20b088686ba1f4ee9c4420ecbc3b9824f0b920" - url: "https://pub.dev" - source: hosted - version: "1.2.6" + version: "4.0.1" connectivity_plus_platform_interface: dependency: transitive description: @@ -294,38 +253,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.4" - connectivity_plus_web: - dependency: transitive - description: - name: connectivity_plus_web - sha256: "81332be1b4baf8898fed17bb4fdef27abb7c6fd990bf98c54fd978478adf2f1a" - url: "https://pub.dev" - source: hosted - version: "1.2.5" - connectivity_plus_windows: - dependency: transitive - description: - name: connectivity_plus_windows - sha256: "535b0404b4d5605c4dd8453d67e5d6d2ea0dd36e3b477f50f31af51b0aeab9dd" - url: "https://pub.dev" - source: hosted - version: "1.2.2" convert: dependency: transitive description: name: convert - sha256: "196284f26f69444b7f5c50692b55ec25da86d9e500451dc09333bf2e3ad69259" + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.1.1" coverage: dependency: transitive description: name: coverage - sha256: "525ac94733f9ce82507a050bfd62ad89eb1dcbc56308e1e2e17ab11abeee4a75" + sha256: "2fb815080e44a09b85e0f2ca8a820b15053982b2e714b59267719e8a9ff17097" url: "https://pub.dev" source: hosted - version: "1.5.0" + version: "1.6.3" cross_file: dependency: transitive description: @@ -379,13 +322,6 @@ packages: relative: true source: path version: "0.0.1" - cw_wownero: - dependency: transitive - description: - path: "crypto_plugins/flutter_libmonero/cw_wownero" - relative: true - source: path - version: "0.0.1" dart_base_x: dependency: transitive description: @@ -470,34 +406,34 @@ packages: dependency: "direct main" description: name: device_info_plus - sha256: "8d99246809e63d93e4e68fade79495d81f445ad735bde2b129b19c0adddcaf1a" + sha256: "2c35b6d1682b028e42d07b3aee4b98fa62996c10bc12cb651ec856a80d6a761b" url: "https://pub.dev" source: hosted - version: "7.0.1" + version: "9.0.2" device_info_plus_platform_interface: dependency: transitive description: name: device_info_plus_platform_interface - sha256: "8b8b65e598b84fdb82c26cf9b3f05a6c4978636e99b0c070bae5905a24728199" + sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64 url: "https://pub.dev" source: hosted - version: "6.0.1" + version: "7.0.0" devicelocale: dependency: "direct main" description: name: devicelocale - sha256: "5fd46b8c2a987b1c14b1551433be1974dbca5ec6ab00e7d53288b5197a21863e" + sha256: "09cc0bce937b34dafcaac0b2a9b350d763dd16770f15e59560b7abaaaad3d65b" url: "https://pub.dev" source: hosted - version: "0.5.5" + version: "0.6.0" dropdown_button2: dependency: "direct main" description: name: dropdown_button2 - sha256: "1a00301a1ec87666b1f1938f373865e3f5fb3056e4e36e1b3c2c0dc0c11f4737" + sha256: "107444581478342c6511040c2eb52850748400df4f3295df3da8be75693180a5" url: "https://pub.dev" source: hosted - version: "1.7.2" + version: "2.1.4" emojis: dependency: "direct main" description: @@ -558,10 +494,10 @@ packages: dependency: "direct main" description: name: file_picker - sha256: d090ae03df98b0247b82e5928f44d1b959867049d18d73635e2e0bc3f49542b9 + sha256: b1729fc96627dd44012d0a901558177418818d6bd428df59dcfeb594e5f66432 url: "https://pub.dev" source: hosted - version: "5.2.5" + version: "5.3.2" fixnum: dependency: transitive description: @@ -570,14 +506,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" - flare_flutter: - dependency: "direct main" - description: - name: flare_flutter - sha256: "99d63c60f00fac81249ce6410ee015d7b125c63d8278a30da81edf3317a1f6a0" - url: "https://pub.dev" - source: hosted - version: "3.0.2" flutter: dependency: "direct main" description: flutter @@ -663,10 +591,10 @@ packages: dependency: transitive description: name: flutter_plugin_android_lifecycle - sha256: "60fc7b78455b94e6de2333d2f95196d32cf5c22f4b0b0520a628804cb463503b" + sha256: "950e77c2bbe1692bc0874fc7fb491b96a4dc340457f4ea1641443d0a6c1ea360" url: "https://pub.dev" source: hosted - version: "2.0.7" + version: "2.0.15" flutter_riverpod: dependency: "direct main" description: @@ -679,18 +607,18 @@ packages: dependency: "direct main" description: name: flutter_rounded_date_picker - sha256: "369f7c63c1518d24c63f5da889ea9a6fb9a0a6f105ba9d22ccbba7665475784f" + sha256: e6aa2dc5d3b44e8bbe85ef901be69eac59ba4136427f11f4c8b2a303e1e774e7 url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.4" flutter_secure_storage: dependency: "direct main" description: name: flutter_secure_storage - sha256: "5abe3d5c25ab435e48c47fb61bac25606062a305fac637c2f020e25abd30014a" + sha256: "98352186ee7ad3639ccc77ad7924b773ff6883076ab952437d20f18a61f0a7c5" url: "https://pub.dev" source: hosted - version: "5.1.2" + version: "8.0.0" flutter_secure_storage_linux: dependency: transitive description: @@ -703,10 +631,10 @@ packages: dependency: transitive description: name: flutter_secure_storage_macos - sha256: "388f76fd0f093e7415a39ec4c169ae7cceeee6d9f9ba529d788a13f2be4de7bd" + sha256: "083add01847fc1c80a07a08e1ed6927e9acd9618a35e330239d4422cd2a58c50" url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "3.0.0" flutter_secure_storage_platform_interface: dependency: transitive description: @@ -727,18 +655,10 @@ packages: dependency: transitive description: name: flutter_secure_storage_windows - sha256: ca89c8059cf439985aa83c59619b3674c7ef6cc2e86943d169a7369d6a69cab5 + sha256: fc2910ec9b28d60598216c29ea763b3a96c401f0ce1d13cdf69ccb0e5c93c3ee url: "https://pub.dev" source: hosted - version: "1.1.3" - flutter_spinkit: - dependency: "direct main" - description: - name: flutter_spinkit - sha256: "77a2117c0517ff909221f3160b8eb20052ab5216107581168af574ac1f05dff8" - url: "https://pub.dev" - source: hosted - version: "5.1.0" + version: "2.0.0" flutter_svg: dependency: "direct main" description: @@ -769,10 +689,10 @@ packages: dependency: transitive description: name: frontend_server_client - sha256: "4f4a162323c86ffc1245765cfe138872b8f069deb42f7dbb36115fa27f31469b" + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "3.2.0" fuchsia_remote_debug_protocol: dependency: transitive description: flutter @@ -790,10 +710,10 @@ packages: dependency: "direct main" description: name: google_fonts - sha256: e70521755a6b08c6bde14ddae27dff5bf21010033888fc61da6c595f8a9f58c1 + sha256: "6b6f10f0ce3c42f6552d1c70d2c28d764cf22bb487f50f66cca31dcd5194f4d6" url: "https://pub.dev" source: hosted - version: "2.3.3" + version: "4.0.4" graphs: dependency: transitive description: @@ -830,10 +750,10 @@ packages: dependency: "direct dev" description: name: hive_generator - sha256: "81fd20125cb2ce8fd23623d7744ffbaf653aae93706c9bd3bf7019ea0ace3938" + sha256: "65998cc4d2cd9680a3d9709d893d2f6bb15e6c1f92626c3f1fa650b4b3281521" url: "https://pub.dev" source: hosted - version: "1.1.3" + version: "2.0.0" hive_test: dependency: "direct dev" description: @@ -939,10 +859,10 @@ packages: dependency: transitive description: name: js - sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 url: "https://pub.dev" source: hosted - version: "0.6.5" + version: "0.6.7" json_annotation: dependency: transitive description: @@ -951,14 +871,6 @@ packages: url: "https://pub.dev" source: hosted version: "4.8.0" - jsonrpc2: - dependency: "direct main" - description: - name: jsonrpc2 - sha256: "98a71b834240ca6d003499ab8f28d1c35aa8ca90235b51e972e0f70596b86bd3" - url: "https://pub.dev" - source: hosted - version: "3.0.1" keyboard_dismisser: dependency: "direct main" description: @@ -995,18 +907,18 @@ packages: dependency: "direct main" description: name: lottie - sha256: "893da7a0022ec2fcaa616f34529a081f617e86cc501105b856e5a3184c58c7c2" + sha256: f461105d3a35887b27089abf9c292334478dd292f7b47ecdccb6ae5c37a22c80 url: "https://pub.dev" source: hosted - version: "1.4.3" + version: "2.4.0" matcher: dependency: transitive description: name: matcher - sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" url: "https://pub.dev" source: hosted - version: "0.12.13" + version: "0.12.15" material_color_utilities: dependency: transitive description: @@ -1019,10 +931,10 @@ packages: dependency: transitive description: name: meta - sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.9.1" mime: dependency: transitive description: @@ -1051,10 +963,10 @@ packages: dependency: "direct dev" description: name: mockito - sha256: "2a8a17b82b1bde04d514e75d90d634a0ac23f6cb4991f6098009dd56836aeafe" + sha256: "7d5b53bcd556c1bc7ffbe4e4d5a19c3e112b7e925e9e172dd7c6ad0630812616" url: "https://pub.dev" source: hosted - version: "5.3.2" + version: "5.4.2" mocktail: dependency: transitive description: @@ -1099,58 +1011,26 @@ packages: dependency: "direct main" description: name: package_info_plus - sha256: f62d7253edc197fe3c88d7c2ddab82d68f555e778d55390ccc3537eca8e8d637 - url: "https://pub.dev" - source: hosted - version: "1.4.3+1" - package_info_plus_linux: - dependency: transitive - description: - name: package_info_plus_linux - sha256: "04b575f44233d30edbb80a94e57cad9107aada334fc02aabb42b6becd13c43fc" - url: "https://pub.dev" - source: hosted - version: "1.0.5" - package_info_plus_macos: - dependency: transitive - description: - name: package_info_plus_macos - sha256: a2ad8b4acf4cd479d4a0afa5a74ea3f5b1c7563b77e52cc32b3ee6956d5482a6 + sha256: ceb027f6bc6a60674a233b4a90a7658af1aebdea833da0b5b53c1e9821a78c7b url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "4.0.2" package_info_plus_platform_interface: dependency: transitive description: name: package_info_plus_platform_interface - sha256: f7a0c8f1e7e981bc65f8b64137a53fd3c195b18d429fba960babc59a5a1c7ae8 - url: "https://pub.dev" - source: hosted - version: "1.0.2" - package_info_plus_web: - dependency: transitive - description: - name: package_info_plus_web - sha256: f0829327eb534789e0a16ccac8936a80beed4e2401c4d3a74f3f39094a822d3b + sha256: "9bc8ba46813a4cc42c66ab781470711781940780fd8beddd0c3da62506d3a6c6" url: "https://pub.dev" source: hosted - version: "1.0.6" - package_info_plus_windows: - dependency: transitive - description: - name: package_info_plus_windows - sha256: "79524f11c42dd9078b96d797b3cf79c0a2883a50c4920dc43da8562c115089bc" - url: "https://pub.dev" - source: hosted - version: "2.1.0" + version: "2.0.1" path: dependency: transitive description: name: path - sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.8.3" path_drawing: dependency: transitive description: @@ -1171,10 +1051,10 @@ packages: dependency: "direct main" description: name: path_provider - sha256: dcea5feb97d8abf90cab9e9030b497fb7c3cbf26b7a1fe9e3ef7dcb0a1ddec95 + sha256: "3087813781ab814e4157b172f1a11c46be20179fcc9bea043e0fba36bc0acaa2" url: "https://pub.dev" source: hosted - version: "2.0.12" + version: "2.0.15" path_provider_android: dependency: transitive description: @@ -1211,10 +1091,10 @@ packages: dependency: transitive description: name: path_provider_windows - sha256: bcabbe399d4042b8ee687e17548d5d3f527255253b4a639f5f8d2094a9c2b45c + sha256: "1cb68ba4cd3a795033de62ba1b7b4564dace301f952de6bfb3cd91b202b6ee96" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.7" permission_handler: dependency: "direct main" description: @@ -1275,10 +1155,10 @@ packages: dependency: transitive description: name: plugin_platform_interface - sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a + sha256: "6a2128648c854906c53fa8e33986fc0247a1116122f9534dd20e3ab9e16a32bc" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.4" pointycastle: dependency: "direct main" description: @@ -1331,20 +1211,20 @@ packages: dependency: transitive description: name: qr - sha256: "5c4208b4dc0d55c3184d10d83ee0ded6212dc2b5e2ba17c5a0c0aab279128d21" + sha256: "64957a3930367bf97cc211a5af99551d630f2f4625e38af10edd6b19131b64b3" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "3.0.1" qr_flutter: dependency: "direct main" description: name: qr_flutter - sha256: c5c121c54cb6dd837b9b9d57eb7bc7ec6df4aee741032060c8833a678c80b87e + sha256: "5095f0fc6e3f71d08adef8feccc8cea4f12eec18a2e31c2e8d82cb6019f4b097" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "4.1.0" rational: - dependency: "direct main" + dependency: transitive description: name: rational sha256: ba58e9e18df9abde280e8b10051e4bce85091e41e8e7e411b6cde2e738d357cf @@ -1359,22 +1239,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.3" - rpc_dispatcher: - dependency: transitive - description: - name: rpc_dispatcher - sha256: b6ddcae58b3fbc1172a7c2dc8ab30d2f1090db8c7a728e4405bd10142dc48a47 - url: "https://pub.dev" - source: hosted - version: "1.0.1" - rpc_exceptions: - dependency: transitive - description: - name: rpc_exceptions - sha256: "09b2e5f3f805b65a262b40e3410d79fb916ff5be2a65e2f6b8b0eeef7aa965b7" - url: "https://pub.dev" - source: hosted - version: "1.0.1" rxdart: dependency: "direct main" description: @@ -1387,18 +1251,18 @@ packages: dependency: "direct main" description: name: share_plus - sha256: "8c6892037b1824e2d7e8f59d54b3105932899008642e6372e5079c6939b4b625" + sha256: ed3fcea4f789ed95913328e629c0c53e69e80e08b6c24542f1b3576046c614e8 url: "https://pub.dev" source: hosted - version: "6.3.1" + version: "7.0.2" share_plus_platform_interface: dependency: transitive description: name: share_plus_platform_interface - sha256: "82ddd4ab9260c295e6e39612d4ff00390b9a7a21f1bb1da771e2f232d80ab8a1" + sha256: "0c6e61471bd71b04a138b8b588fa388e66d8b005e6f2deda63371c5c505a0981" url: "https://pub.dev" source: hosted - version: "3.2.0" + version: "3.2.1" shared_preferences: dependency: transitive description: @@ -1544,8 +1408,8 @@ packages: dependency: "direct main" description: path: "." - ref: e4b08d2b8965a5ae49bd57f598fa9011dd0c25e9 - resolved-ref: e4b08d2b8965a5ae49bd57f598fa9011dd0c25e9 + ref: ee1da8a9ba1cbeb50c5b354ea1fd5a25b7c5a3ed + resolved-ref: ee1da8a9ba1cbeb50c5b354ea1fd5a25b7c5a3ed url: "https://github.com/cypherstack/stack_wallet_backup.git" source: git version: "0.0.1" @@ -1609,26 +1473,26 @@ packages: dependency: transitive description: name: test - sha256: a5fcd2d25eeadbb6589e80198a47d6a464ba3e2049da473943b8af9797900c2d + sha256: "3dac9aecf2c3991d09b9cdde4f98ded7b30804a88a0d7e4e7e1678e78d6b97f4" url: "https://pub.dev" source: hosted - version: "1.22.0" + version: "1.24.1" test_api: dependency: transitive description: name: test_api - sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb url: "https://pub.dev" source: hosted - version: "0.4.16" + version: "0.5.1" test_core: dependency: transitive description: name: test_core - sha256: "0ef9755ec6d746951ba0aabe62f874b707690b5ede0fecc818b138fcc9b14888" + sha256: "5138dbffb77b2289ecb12b81c11ba46036590b72a64a7a90d6ffb880f1a29e93" url: "https://pub.dev" source: hosted - version: "0.4.20" + version: "0.5.1" time: dependency: transitive description: @@ -1661,14 +1525,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.1" - toast: - dependency: "direct main" - description: - name: toast - sha256: bedb96d37030acf9c4c06a7ac2ffd1f1f365e780cda9458c9e24e6a1e1ab6fd9 - url: "https://pub.dev" - source: hosted - version: "0.1.5" tuple: dependency: "direct main" description: @@ -1721,10 +1577,10 @@ packages: dependency: transitive description: name: url_launcher_linux - sha256: "318c42cba924e18180c029be69caf0a1a710191b9ec49bb42b5998fdcccee3cc" + sha256: "207f4ddda99b95b4d4868320a352d374b0b7e05eefad95a4a26f57da413443f5" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.5" url_launcher_macos: dependency: transitive description: @@ -1737,26 +1593,26 @@ packages: dependency: transitive description: name: url_launcher_platform_interface - sha256: "4eae912628763eb48fc214522e58e942fd16ce195407dbf45638239523c759a6" + sha256: bfdfa402f1f3298637d71ca8ecfe840b4696698213d5346e9d12d4ab647ee2ea url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.3" url_launcher_web: dependency: transitive description: name: url_launcher_web - sha256: "44d79408ce9f07052095ef1f9a693c258d6373dc3944249374e30eff7219ccb0" + sha256: "6bb1e5d7fe53daf02a8fee85352432a40b1f868a81880e99ec7440113d5cfcab" url: "https://pub.dev" source: hosted - version: "2.0.14" + version: "2.0.17" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - sha256: b6217370f8eb1fd85c8890c539f5a639a01ab209a36db82c921ebeacefc7a615 + sha256: "254708f17f7c20a9c8c471f67d86d76d4a3f9c1591aad1e15292008aceb82771" url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.6" uuid: dependency: "direct main" description: @@ -1777,10 +1633,10 @@ packages: dependency: transitive description: name: vm_service - sha256: e7fb6c2282f7631712b69c19d1bff82f3767eea33a2321c14fa59ad67ea391c7 + sha256: f6deed8ed625c52864792459709183da231ebf66ff0cf09e69b573227c377efe url: "https://pub.dev" source: hosted - version: "9.4.0" + version: "11.3.0" wakelock: dependency: "direct main" description: @@ -1814,13 +1670,14 @@ packages: source: hosted version: "0.4.0" wakelock_windows: - dependency: transitive + dependency: "direct overridden" description: - name: wakelock_windows - sha256: "857f77b3fe6ae82dd045455baa626bc4b93cb9bb6c86bf3f27c182167c3a5567" - url: "https://pub.dev" - source: hosted - version: "0.2.1" + path: wakelock_windows + ref: "2a9bca63a540771f241d688562351482b2cf234c" + resolved-ref: "2a9bca63a540771f241d688562351482b2cf234c" + url: "https://github.com/diegotori/wakelock" + source: git + version: "0.2.2" watcher: dependency: transitive description: @@ -1841,10 +1698,10 @@ packages: dependency: transitive description: name: webdriver - sha256: ef67178f0cc7e32c1494645b11639dd1335f1d18814aa8435113a92e9ef9d841 + sha256: "3c923e918918feeb90c4c9fdf1fe39220fa4c0e8e2c0fffaded174498ef86c49" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" webkit_inspection_protocol: dependency: transitive description: @@ -1865,10 +1722,18 @@ packages: dependency: transitive description: name: win32 - sha256: c9ebe7ee4ab0c2194e65d3a07d8c54c5d00bb001b76081c4a04cdb8448b59e46 + sha256: "7dacfda1edcca378031db9905ad7d7bd56b29fd1a90b0908b71a52a12c41e36b" + url: "https://pub.dev" + source: hosted + version: "5.0.3" + win32_registry: + dependency: transitive + description: + name: win32_registry + sha256: e4506d60b7244251bc59df15656a3093501c37fb5af02105a944d73eb95be4c9 url: "https://pub.dev" source: hosted - version: "3.1.3" + version: "1.1.1" window_size: dependency: "direct main" description: @@ -1919,5 +1784,5 @@ packages: source: hosted version: "1.0.0" sdks: - dart: ">=2.18.5 <3.0.0" - flutter: ">=3.3.0" + dart: ">=3.0.2 <4.0.0" + flutter: ">=3.10.5" diff --git a/pubspec.yaml b/pubspec.yaml index db089f07fa..88c17d0743 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,10 +11,11 @@ description: Stack Duo # 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.0.6+9 +version: 1.0.10+15 environment: - sdk: ">=2.17.0 <3.0.0" + sdk: ">=3.0.2 <4.0.0" + flutter: ^3.10.5 dependencies: flutter: @@ -22,47 +23,36 @@ dependencies: ffi: ^2.0.1 mutex: ^3.0.0 websocket_universal: ^0.5.1 - flutter_libmonero: path: ./crypto_plugins/flutter_libmonero cw_monero: path: ./crypto_plugins/flutter_libmonero/cw_monero - cw_core: path: ./crypto_plugins/flutter_libmonero/cw_core - -# firo_flutter: -# git: -# url: https://github.com/cypherstack/firo_flutter.git -# ref: update - # path: ./crypto_plugins/firo_flutter - bitcoindart: git: url: https://github.com/cypherstack/bitcoindart.git - ref: 004d6f82dff7389b561e5078b4649adcd2d9c10f + ref: af6d6c27edfe2e7cc35772ed2684eb4cc826f0e4 stack_wallet_backup: git: url: https://github.com/cypherstack/stack_wallet_backup.git - ref: e4b08d2b8965a5ae49bd57f598fa9011dd0c25e9 + ref: ee1da8a9ba1cbeb50c5b354ea1fd5a25b7c5a3ed bip47: git: url: https://github.com/cypherstack/bip47.git - ref: 38847255d035c0f6ec5bc93d19130ec804cf90e9 + ref: 081ca1863c2feba00c35bb5b297902f12f499941 # Utility plugins -# provider: ^6.0.1 - http: ^0.13.4 + http: ^0.13.0 local_auth: ^1.1.10 permission_handler: ^10.0.0 flutter_local_notifications: ^9.4.0 rxdart: ^0.27.3 -# filesystem_picker: ^3.0.0-beta.1 zxcvbn: ^1.0.0 dart_numerics: ^0.0.6 @@ -75,63 +65,51 @@ dependencies: bip39: git: url: https://github.com/cypherstack/stack-bip39.git - ref: 3bef5acc21340f3cc78df0ad1dce5868a3ed68a5 - bitbox: - git: - url: https://github.com/Quppy/bitbox-flutter.git - ref: ea65073efbaf395a5557e8cd7bd72f195cd7eb11 + ref: 0cd6d54e2860bea68fc50c801cb9db2a760192fb bip32: ^2.0.0 bech32: git: url: https://github.com/cypherstack/bech32.git - ref: 22279d4bb24ed541b431acd269a1bc50af0f36a0 + ref: b6d2a5b4cd17311d917787c0f9505f04932659b1 bs58check: ^1.0.2 # Storage plugins - flutter_secure_storage: ^5.0.2 + flutter_secure_storage: ^8.0.0 hive: ^2.0.5 hive_flutter: ^1.1.0 - path_provider: ^2.0.8 + path_provider: ^2.0.15 # UI/Component plugins flutter_native_splash: ^2.2.4 - animations: ^2.0.2 - toast: ^0.1.5 - flare_flutter: ^3.0.2 - google_fonts: ^2.2.0 + google_fonts: ^4.0.4 url_launcher: ^6.0.5 flutter_svg: ^1.0.1 flutter_feather_icons: ^2.0.0+1 - flutter_spinkit: ^5.1.0 decimal: ^2.1.0 event_bus: ^2.0.0 uuid: ^3.0.5 - flutter_rounded_date_picker: ^3.0.1 + flutter_rounded_date_picker: ^3.0.4 crypto: ^3.0.2 - jsonrpc2: ^3.0.1 - barcode_scan2: ^4.2.0 - app_settings: ^4.1.1 + barcode_scan2: ^4.2.4 wakelock: ^0.6.2 intl: ^0.17.0 - devicelocale: ^0.5.0 - device_info_plus: ^7.0.1 + devicelocale: ^0.6.0 + device_info_plus: ^9.0.2 keyboard_dismisser: ^3.0.0 another_flushbar: ^1.10.28 tuple: ^2.0.0 flutter_riverpod: ^1.0.3 - qr_flutter: ^4.0.0 - share_plus: ^6.3.0 + qr_flutter: ^4.1.0 + share_plus: ^7.0.2 emojis: ^0.9.9 pointycastle: ^3.6.0 - package_info_plus: ^1.4.2 - lottie: ^1.3.0 -# shared_preferences: ^2.0.15 - file_picker: ^5.0.1 - connectivity_plus: 2.3.6+1 -# document_file_save_plus: ^1.0.5 + package_info_plus: ^4.0.2 + lottie: ^2.3.2 + file_picker: ^5.3.1 + connectivity_plus: ^4.0.1 isar: 3.0.5 isar_flutter_libs: 3.0.5 # contains the binaries - dropdown_button2: 1.7.2 + dropdown_button2: ^2.1.3 string_validator: ^0.3.0 equatable: ^2.0.5 async: ^2.10.0 @@ -139,7 +117,6 @@ dependencies: dart_bs58: ^1.0.1 dart_bs58check: ^3.0.2 hex: ^0.2.0 - rational: ^2.2.2 archive: ^3.3.2 desktop_drop: ^0.4.1 @@ -150,13 +127,13 @@ dev_dependencies: sdk: flutter build_runner: ^2.1.7 flutter_launcher_icons: ^0.11.0 - hive_generator: ^1.1.2 + hive_generator: ^2.0.0 dependency_validator: ^3.1.2 hive_test: ^1.0.1 - mockito: ^5.1.0 + mockito: ^5.4.1 mockingjay: ^0.2.0 # lint: ^1.10.0 - analyzer: ^4.6.0 + analyzer: ^5.13.0 import_sorter: ^4.6.0 flutter_lints: ^2.0.1 isar_generator: 3.0.5 @@ -182,11 +159,21 @@ flutter_native_splash: android_disable_fullscreen: true dependency_overrides: - bip39: + + # required for dart 3, at least until a fix is merged upstream + wakelock_windows: git: - url: https://github.com/cypherstack/stack-bip39.git - ref: 3bef5acc21340f3cc78df0ad1dce5868a3ed68a5 - crypto: 3.0.2 + url: https://github.com/diegotori/wakelock + ref: 2a9bca63a540771f241d688562351482b2cf234c + path: wakelock_windows + + # required for libmonero - can remove once libmonero has been updated, PR has been merged in swb + stack_wallet_backup: + git: + url: https://github.com/cypherstack/stack_wallet_backup.git + ref: ee1da8a9ba1cbeb50c5b354ea1fd5a25b7c5a3ed + + # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec @@ -331,7 +318,6 @@ flutter: # exchange icons - assets/svg/exchange_icons/ - # lottie animations # basic - assets/lottie/test2.json diff --git a/test/cached_electrumx_test.dart b/test/cached_electrumx_test.dart index c3df6c2e80..4390138686 100644 --- a/test/cached_electrumx_test.dart +++ b/test/cached_electrumx_test.dart @@ -13,6 +13,10 @@ void main() { group("tests using mock hive", () { setUp(() async { await setUpTestHive(); + // await Hive.openBox( + // DB.instance.boxNameUsedSerialsCache(coin: Coin.firo)); + // await Hive.openBox(DB.instance.boxNameSetCache(coin: Coin.firo)); + // await Hive.openBox(DB.instance.boxNameTxCache(coin: Coin.firo)); }); group("getAnonymitySet", () { // test("empty set cache call", () async { @@ -142,11 +146,7 @@ void main() { useSSL: true, ); - final client = CachedElectrumX.from( - node: node, - prefs: MockPrefs(), - failovers: [], - electrumXClient: MockElectrumX()); + final client = CachedElectrumX.from(electrumXClient: MockElectrumX()); expect(client, isA()); }); diff --git a/test/cached_electrumx_test.mocks.dart b/test/cached_electrumx_test.mocks.dart index 598fefec56..79b13f9fdd 100644 --- a/test/cached_electrumx_test.mocks.dart +++ b/test/cached_electrumx_test.mocks.dart @@ -1,15 +1,16 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/cached_electrumx_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i4; -import 'dart:ui' as _i8; import 'package:decimal/decimal.dart' as _i2; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/electrumx_rpc/electrumx.dart' as _i3; +import 'package:stackduo/utilities/amount/amount_unit.dart' as _i8; import 'package:stackduo/utilities/enums/backup_frequency_type.dart' as _i7; +import 'package:stackduo/utilities/enums/coin_enum.dart' as _i9; import 'package:stackduo/utilities/enums/sync_type_enum.dart' as _i6; import 'package:stackduo/utilities/prefs.dart' as _i5; @@ -782,7 +783,55 @@ class MockPrefs extends _i1.Mock implements _i5.Prefs { returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - void addListener(_i8.VoidCallback? listener) => super.noSuchMethod( + _i8.AmountUnit amountUnit(_i9.Coin? coin) => (super.noSuchMethod( + Invocation.method( + #amountUnit, + [coin], + ), + returnValue: _i8.AmountUnit.normal, + ) as _i8.AmountUnit); + @override + void updateAmountUnit({ + required _i9.Coin? coin, + required _i8.AmountUnit? amountUnit, + }) => + super.noSuchMethod( + Invocation.method( + #updateAmountUnit, + [], + { + #coin: coin, + #amountUnit: amountUnit, + }, + ), + returnValueForMissingStub: null, + ); + @override + int maxDecimals(_i9.Coin? coin) => (super.noSuchMethod( + Invocation.method( + #maxDecimals, + [coin], + ), + returnValue: 0, + ) as int); + @override + void updateMaxDecimals({ + required _i9.Coin? coin, + required int? maxDecimals, + }) => + super.noSuchMethod( + Invocation.method( + #updateMaxDecimals, + [], + { + #coin: coin, + #maxDecimals: maxDecimals, + }, + ), + returnValueForMissingStub: null, + ); + @override + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -790,7 +839,7 @@ class MockPrefs extends _i1.Mock implements _i5.Prefs { returnValueForMissingStub: null, ); @override - void removeListener(_i8.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/electrumx_test.dart b/test/electrumx_test.dart index 1280ebdb9d..d8f3022fa6 100644 --- a/test/electrumx_test.dart +++ b/test/electrumx_test.dart @@ -1,1214 +1,1303 @@ -import 'package:flutter_test/flutter_test.dart'; -import 'package:mockito/annotations.dart'; -import 'package:mockito/mockito.dart'; -import 'package:stackduo/electrumx_rpc/electrumx.dart'; -import 'package:stackduo/electrumx_rpc/rpc.dart'; -import 'package:stackduo/utilities/prefs.dart'; - -import 'electrumx_test.mocks.dart'; -import 'sample_data/get_anonymity_set_sample_data.dart'; -import 'sample_data/get_used_serials_sample_data.dart'; -import 'sample_data/transaction_data_samples.dart'; - -@GenerateMocks([JsonRPC, Prefs]) -void main() { - group("factory constructors and getters", () { - test("electrumxnode .from factory", () { - final nodeA = ElectrumXNode( - address: "some address", - port: 1, - name: "some name", - id: "some ID", - useSSL: true, - ); - - final nodeB = ElectrumXNode.from(nodeA); - - expect(nodeB.toString(), nodeA.toString()); - expect(nodeA == nodeB, false); - }); - - test("electrumx .from factory", () { - final node = ElectrumXNode( - address: "some address", - port: 1, - name: "some name", - id: "some ID", - useSSL: true, - ); - - final mockPrefs = MockPrefs(); - - final client = - ElectrumX.from(node: node, failovers: [], prefs: mockPrefs); - - expect(client.useSSL, node.useSSL); - expect(client.host, node.address); - expect(client.port, node.port); - expect(client.rpcClient, null); - - verifyNoMoreInteractions(mockPrefs); - }); - }); - - test("Server error", () { - final mockClient = MockJsonRPC(); - const command = "blockchain.transaction.get"; - const jsonArgs = '["",true]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenAnswer( - (_) async => { - "jsonrpc": "2.0", - "error": { - "code": 1, - "message": "None should be a transaction hash", - }, - "id": "some requestId", - }, - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - failovers: [], - prefs: mockPrefs); - - expect(() => client.getTransaction(requestID: "some requestId", txHash: ''), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - group("getBlockHeadTip", () { - test("getBlockHeadTip success", () async { - final mockClient = MockJsonRPC(); - const command = "blockchain.headers.subscribe"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenAnswer( - (_) async => { - "jsonrpc": "2.0", - "result": {"height": 520481, "hex": "some block hex string"}, - "id": "some requestId" - }, - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = - await (client.getBlockHeadTip(requestID: "some requestId")); - - expect(result["height"], 520481); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getBlockHeadTip throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "blockchain.headers.subscribe"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect(() => client.getBlockHeadTip(requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("ping", () { - test("ping success", () async { - final mockClient = MockJsonRPC(); - const command = "server.ping"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenAnswer( - (_) async => {"jsonrpc": "2.0", "result": null, "id": "some requestId"}, - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.ping(requestID: "some requestId"); - - expect(result, true); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("ping throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "server.ping"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect(() => client.ping(requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getServerFeatures", () { - test("getServerFeatures success", () async { - final mockClient = MockJsonRPC(); - const command = "server.features"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenAnswer( - (_) async => { - "jsonrpc": "2.0", - "result": { - "genesis_hash": - "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943", - "hosts": { - "0.0.0.0": {"tcp_port": 51001, "ssl_port": 51002} - }, - "protocol_max": "1.0", - "protocol_min": "1.0", - "pruning": null, - "server_version": "ElectrumX 1.0.17", - "hash_function": "sha256" - }, - "id": "some requestId" - }, - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = - await client.getServerFeatures(requestID: "some requestId"); - - expect(result, { - "genesis_hash": - "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943", - "hosts": { - "0.0.0.0": {"tcp_port": 51001, "ssl_port": 51002} - }, - "protocol_max": "1.0", - "protocol_min": "1.0", - "pruning": null, - "server_version": "ElectrumX 1.0.17", - "hash_function": "sha256", - }); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getServerFeatures throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "server.features"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect(() => client.getServerFeatures(requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("broadcastTransaction", () { - test("broadcastTransaction success", () async { - final mockClient = MockJsonRPC(); - const command = "blockchain.transaction.broadcast"; - const jsonArgs = '["some raw transaction string"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenAnswer( - (_) async => { - "jsonrpc": "2.0", - "result": "the txid of the rawtx", - "id": "some requestId" - }, - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.broadcastTransaction( - rawTx: "some raw transaction string", requestID: "some requestId"); - - expect(result, "the txid of the rawtx"); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("broadcastTransaction throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "blockchain.transaction.broadcast"; - const jsonArgs = '["some raw transaction string"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => client.broadcastTransaction( - rawTx: "some raw transaction string", - requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getBalance", () { - test("getBalance success", () async { - final mockClient = MockJsonRPC(); - const command = "blockchain.scripthash.get_balance"; - const jsonArgs = '["dummy hash"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenAnswer( - (_) async => { - "jsonrpc": "2.0", - "result": { - "confirmed": 103873966, - "unconfirmed": 23684400, - }, - "id": "some requestId" - }, - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getBalance( - scripthash: "dummy hash", requestID: "some requestId"); - - expect(result, {"confirmed": 103873966, "unconfirmed": 23684400}); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getBalance throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "blockchain.scripthash.get_balance"; - const jsonArgs = '["dummy hash"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => client.getBalance( - scripthash: "dummy hash", requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getHistory", () { - test("getHistory success", () async { - final mockClient = MockJsonRPC(); - const command = "blockchain.scripthash.get_history"; - const jsonArgs = '["dummy hash"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenAnswer( - (_) async => { - "jsonrpc": "2.0", - "result": [ - { - "height": 200004, - "tx_hash": - "acc3758bd2a26f869fcc67d48ff30b96464d476bca82c1cd6656e7d506816412" - }, - { - "height": 215008, - "tx_hash": - "f3e1bf48975b8d6060a9de8884296abb80be618dc00ae3cb2f6cee3085e09403" - } - ], - "id": "some requestId" - }, - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getHistory( - scripthash: "dummy hash", requestID: "some requestId"); - - expect(result, [ - { - "height": 200004, - "tx_hash": - "acc3758bd2a26f869fcc67d48ff30b96464d476bca82c1cd6656e7d506816412" - }, - { - "height": 215008, - "tx_hash": - "f3e1bf48975b8d6060a9de8884296abb80be618dc00ae3cb2f6cee3085e09403" - } - ]); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getHistory throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "blockchain.scripthash.get_history"; - const jsonArgs = '["dummy hash"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => client.getHistory( - scripthash: "dummy hash", requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getUTXOs", () { - test("getUTXOs success", () async { - final mockClient = MockJsonRPC(); - const command = "blockchain.scripthash.listunspent"; - const jsonArgs = '["dummy hash"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenAnswer( - (_) async => { - "jsonrpc": "2.0", - "result": [ - { - "tx_pos": 0, - "value": 45318048, - "tx_hash": - "9f2c45a12db0144909b5db269415f7319179105982ac70ed80d76ea79d923ebf", - "height": 437146 - }, - { - "tx_pos": 0, - "value": 919195, - "tx_hash": - "3d2290c93436a3e964cfc2f0950174d8847b1fbe3946432c4784e168da0f019f", - "height": 441696 - } - ], - "id": "some requestId" - }, - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getUTXOs( - scripthash: "dummy hash", requestID: "some requestId"); - - expect(result, [ - { - "tx_pos": 0, - "value": 45318048, - "tx_hash": - "9f2c45a12db0144909b5db269415f7319179105982ac70ed80d76ea79d923ebf", - "height": 437146 - }, - { - "tx_pos": 0, - "value": 919195, - "tx_hash": - "3d2290c93436a3e964cfc2f0950174d8847b1fbe3946432c4784e168da0f019f", - "height": 441696 - } - ]); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getUTXOs throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "blockchain.scripthash.listunspent"; - const jsonArgs = '["dummy hash"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => client.getUTXOs( - scripthash: "dummy hash", requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getTransaction", () { - test("getTransaction success", () async { - final mockClient = MockJsonRPC(); - const command = "blockchain.transaction.get"; - const jsonArgs = '["${SampleGetTransactionData.txHash0}",true]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenAnswer( - (_) async => { - "jsonrpc": "2.0", - "result": SampleGetTransactionData.txData0, - "id": "some requestId" - }, - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getTransaction( - txHash: SampleGetTransactionData.txHash0, - verbose: true, - requestID: "some requestId"); - - expect(result, SampleGetTransactionData.txData0); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getTransaction throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "blockchain.transaction.get"; - const jsonArgs = '["${SampleGetTransactionData.txHash0}",true]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => client.getTransaction( - txHash: SampleGetTransactionData.txHash0, - requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getAnonymitySet", () { - test("getAnonymitySet success", () async { - final mockClient = MockJsonRPC(); - const command = "lelantus.getanonymityset"; - const jsonArgs = '["1",""]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenAnswer( - (_) async => { - "jsonrpc": "2.0", - "result": GetAnonymitySetSampleData.data, - "id": "some requestId" - }, - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getAnonymitySet( - groupId: "1", blockhash: "", requestID: "some requestId"); - - expect(result, GetAnonymitySetSampleData.data); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getAnonymitySet throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "lelantus.getanonymityset"; - const jsonArgs = '["1",""]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => - client.getAnonymitySet(groupId: "1", requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getMintData", () { - test("getMintData success", () async { - final mockClient = MockJsonRPC(); - const command = "lelantus.getmintmetadata"; - const jsonArgs = '["some mints"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenAnswer( - (_) async => { - "jsonrpc": "2.0", - "result": "mint meta data", - "id": "some requestId" - }, - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getMintData( - mints: "some mints", requestID: "some requestId"); - - expect(result, "mint meta data"); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getMintData throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "lelantus.getmintmetadata"; - const jsonArgs = '["some mints"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => client.getMintData( - mints: "some mints", requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getUsedCoinSerials", () { - test("getUsedCoinSerials success", () async { - final mockClient = MockJsonRPC(); - const command = "lelantus.getusedcoinserials"; - const jsonArgs = '["0"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenAnswer( - (_) async => { - "jsonrpc": "2.0", - "result": GetUsedSerialsSampleData.serials, - "id": "some requestId" - }, - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getUsedCoinSerials( - requestID: "some requestId", startNumber: 0); - - expect(result, GetUsedSerialsSampleData.serials); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getUsedCoinSerials throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "lelantus.getusedcoinserials"; - const jsonArgs = '["0"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => client.getUsedCoinSerials( - requestID: "some requestId", startNumber: 0), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getLatestCoinId", () { - test("getLatestCoinId success", () async { - final mockClient = MockJsonRPC(); - const command = "lelantus.getlatestcoinid"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenAnswer( - (_) async => {"jsonrpc": "2.0", "result": 1, "id": "some requestId"}, - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getLatestCoinId(requestID: "some requestId"); - - expect(result, 1); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getLatestCoinId throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "lelantus.getlatestcoinid"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect(() => client.getLatestCoinId(requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getCoinsForRecovery", () { - test("getCoinsForRecovery success", () async { - final mockClient = MockJsonRPC(); - const command = "lelantus.getanonymityset"; - const jsonArgs = '["1",""]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenAnswer( - (_) async => { - "jsonrpc": "2.0", - "result": GetAnonymitySetSampleData.data, - "id": "some requestId" - }, - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getAnonymitySet( - groupId: "1", blockhash: "", requestID: "some requestId"); - - expect(result, GetAnonymitySetSampleData.data); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getAnonymitySet throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "lelantus.getanonymityset"; - const jsonArgs = '["1",""]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => - client.getAnonymitySet(groupId: "1", requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getMintData", () { - test("getMintData success", () async { - final mockClient = MockJsonRPC(); - const command = "lelantus.getmintmetadata"; - const jsonArgs = '["some mints"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenAnswer( - (_) async => { - "jsonrpc": "2.0", - "result": "mint meta data", - "id": "some requestId" - }, - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getMintData( - mints: "some mints", requestID: "some requestId"); - - expect(result, "mint meta data"); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getMintData throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "lelantus.getmintmetadata"; - const jsonArgs = '["some mints"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => client.getMintData( - mints: "some mints", requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getUsedCoinSerials", () { - test("getUsedCoinSerials success", () async { - final mockClient = MockJsonRPC(); - const command = "lelantus.getusedcoinserials"; - const jsonArgs = '["0"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenAnswer( - (_) async => { - "jsonrpc": "2.0", - "result": GetUsedSerialsSampleData.serials, - "id": "some requestId" - }, - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getUsedCoinSerials( - requestID: "some requestId", startNumber: 0); - - expect(result, GetUsedSerialsSampleData.serials); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getUsedCoinSerials throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "lelantus.getusedcoinserials"; - const jsonArgs = '["0"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => client.getUsedCoinSerials( - requestID: "some requestId", startNumber: 0), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getLatestCoinId", () { - test("getLatestCoinId success", () async { - final mockClient = MockJsonRPC(); - const command = "lelantus.getlatestcoinid"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenAnswer( - (_) async => {"jsonrpc": "2.0", "result": 1, "id": "some requestId"}, - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getLatestCoinId(requestID: "some requestId"); - - expect(result, 1); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getLatestCoinId throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "lelantus.getlatestcoinid"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect(() => client.getLatestCoinId(requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getFeeRate", () { - test("getFeeRate success", () async { - final mockClient = MockJsonRPC(); - const command = "blockchain.getfeerate"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenAnswer( - (_) async => { - "jsonrpc": "2.0", - "result": { - "rate": 1000, - }, - "id": "some requestId" - }, - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getFeeRate(requestID: "some requestId"); - - expect(result, {"rate": 1000}); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getFeeRate throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "blockchain.getfeerate"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId","method": "$command","params": $jsonArgs}'), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect(() => client.getFeeRate(requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - test("rpcClient is null throws with bad server info", () { - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - client: null, - port: -10, - host: "_ :sa %", - useSSL: false, - prefs: mockPrefs, - failovers: [], - ); - - expect(() => client.getFeeRate(), throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); -} +// import 'package:flutter_test/flutter_test.dart'; +// import 'package:mockito/annotations.dart'; +// import 'package:mockito/mockito.dart'; +// import 'package:stackwallet/electrumx_rpc/electrumx.dart'; +// import 'package:stackwallet/electrumx_rpc/rpc.dart'; +// import 'package:stackwallet/utilities/prefs.dart'; +// +// import 'electrumx_test.mocks.dart'; +// import 'sample_data/get_anonymity_set_sample_data.dart'; +// import 'sample_data/get_used_serials_sample_data.dart'; +// import 'sample_data/transaction_data_samples.dart'; +// +// @GenerateMocks([JsonRPC, Prefs]) +// void main() { +// group("factory constructors and getters", () { +// test("electrumxnode .from factory", () { +// final nodeA = ElectrumXNode( +// address: "some address", +// port: 1, +// name: "some name", +// id: "some ID", +// useSSL: true, +// ); +// +// final nodeB = ElectrumXNode.from(nodeA); +// +// expect(nodeB.toString(), nodeA.toString()); +// expect(nodeA == nodeB, false); +// }); +// +// test("electrumx .from factory", () { +// final node = ElectrumXNode( +// address: "some address", +// port: 1, +// name: "some name", +// id: "some ID", +// useSSL: true, +// ); +// +// final mockPrefs = MockPrefs(); +// +// final client = +// ElectrumX.from(node: node, failovers: [], prefs: mockPrefs); +// +// expect(client.useSSL, node.useSSL); +// expect(client.host, node.address); +// expect(client.port, node.port); +// expect(client.rpcClient, null); +// +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// test("Server error", () { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.transaction.get"; +// const jsonArgs = '["",true]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "error": { +// "code": 1, +// "message": "None should be a transaction hash", +// }, +// "id": "some requestId", +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// failovers: [], +// prefs: mockPrefs); +// +// expect(() => client.getTransaction(requestID: "some requestId", txHash: ''), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// group("getBlockHeadTip", () { +// test("getBlockHeadTip success", () async { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.headers.subscribe"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": {"height": 520481, "hex": "some block hex string"}, +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = +// await (client.getBlockHeadTip(requestID: "some requestId")); +// +// expect(result["height"], 520481); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getBlockHeadTip throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.headers.subscribe"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect(() => client.getBlockHeadTip(requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("ping", () { +// test("ping success", () async { +// final mockClient = MockJsonRPC(); +// const command = "server.ping"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": null, +// "id": "some requestId", +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.ping(requestID: "some requestId"); +// +// expect(result, true); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("ping throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "server.ping"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect(() => client.ping(requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getServerFeatures", () { +// test("getServerFeatures success", () async { +// final mockClient = MockJsonRPC(); +// const command = "server.features"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": { +// "genesis_hash": +// "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943", +// "hosts": { +// "0.0.0.0": {"tcp_port": 51001, "ssl_port": 51002} +// }, +// "protocol_max": "1.0", +// "protocol_min": "1.0", +// "pruning": null, +// "server_version": "ElectrumX 1.0.17", +// "hash_function": "sha256" +// }, +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = +// await client.getServerFeatures(requestID: "some requestId"); +// +// expect(result, { +// "genesis_hash": +// "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943", +// "hosts": { +// "0.0.0.0": {"tcp_port": 51001, "ssl_port": 51002} +// }, +// "protocol_max": "1.0", +// "protocol_min": "1.0", +// "pruning": null, +// "server_version": "ElectrumX 1.0.17", +// "hash_function": "sha256", +// }); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getServerFeatures throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "server.features"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect(() => client.getServerFeatures(requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("broadcastTransaction", () { +// test("broadcastTransaction success", () async { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.transaction.broadcast"; +// const jsonArgs = '["some raw transaction string"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": "the txid of the rawtx", +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.broadcastTransaction( +// rawTx: "some raw transaction string", requestID: "some requestId"); +// +// expect(result, "the txid of the rawtx"); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("broadcastTransaction throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.transaction.broadcast"; +// const jsonArgs = '["some raw transaction string"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => client.broadcastTransaction( +// rawTx: "some raw transaction string", +// requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getBalance", () { +// test("getBalance success", () async { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.scripthash.get_balance"; +// const jsonArgs = '["dummy hash"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": { +// "confirmed": 103873966, +// "unconfirmed": 23684400, +// }, +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getBalance( +// scripthash: "dummy hash", requestID: "some requestId"); +// +// expect(result, {"confirmed": 103873966, "unconfirmed": 23684400}); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getBalance throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.scripthash.get_balance"; +// const jsonArgs = '["dummy hash"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => client.getBalance( +// scripthash: "dummy hash", requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getHistory", () { +// test("getHistory success", () async { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.scripthash.get_history"; +// const jsonArgs = '["dummy hash"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": [ +// { +// "height": 200004, +// "tx_hash": +// "acc3758bd2a26f869fcc67d48ff30b96464d476bca82c1cd6656e7d506816412" +// }, +// { +// "height": 215008, +// "tx_hash": +// "f3e1bf48975b8d6060a9de8884296abb80be618dc00ae3cb2f6cee3085e09403" +// } +// ], +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getHistory( +// scripthash: "dummy hash", requestID: "some requestId"); +// +// expect(result, [ +// { +// "height": 200004, +// "tx_hash": +// "acc3758bd2a26f869fcc67d48ff30b96464d476bca82c1cd6656e7d506816412" +// }, +// { +// "height": 215008, +// "tx_hash": +// "f3e1bf48975b8d6060a9de8884296abb80be618dc00ae3cb2f6cee3085e09403" +// } +// ]); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getHistory throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.scripthash.get_history"; +// const jsonArgs = '["dummy hash"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => client.getHistory( +// scripthash: "dummy hash", requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getUTXOs", () { +// test("getUTXOs success", () async { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.scripthash.listunspent"; +// const jsonArgs = '["dummy hash"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": [ +// { +// "tx_pos": 0, +// "value": 45318048, +// "tx_hash": +// "9f2c45a12db0144909b5db269415f7319179105982ac70ed80d76ea79d923ebf", +// "height": 437146 +// }, +// { +// "tx_pos": 0, +// "value": 919195, +// "tx_hash": +// "3d2290c93436a3e964cfc2f0950174d8847b1fbe3946432c4784e168da0f019f", +// "height": 441696 +// } +// ], +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getUTXOs( +// scripthash: "dummy hash", requestID: "some requestId"); +// +// expect(result, [ +// { +// "tx_pos": 0, +// "value": 45318048, +// "tx_hash": +// "9f2c45a12db0144909b5db269415f7319179105982ac70ed80d76ea79d923ebf", +// "height": 437146 +// }, +// { +// "tx_pos": 0, +// "value": 919195, +// "tx_hash": +// "3d2290c93436a3e964cfc2f0950174d8847b1fbe3946432c4784e168da0f019f", +// "height": 441696 +// } +// ]); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getUTXOs throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.scripthash.listunspent"; +// const jsonArgs = '["dummy hash"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => client.getUTXOs( +// scripthash: "dummy hash", requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getTransaction", () { +// test("getTransaction success", () async { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.transaction.get"; +// const jsonArgs = '["${SampleGetTransactionData.txHash0}",true]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": SampleGetTransactionData.txData0, +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getTransaction( +// txHash: SampleGetTransactionData.txHash0, +// verbose: true, +// requestID: "some requestId"); +// +// expect(result, SampleGetTransactionData.txData0); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getTransaction throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.transaction.get"; +// const jsonArgs = '["${SampleGetTransactionData.txHash0}",true]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => client.getTransaction( +// txHash: SampleGetTransactionData.txHash0, +// requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getAnonymitySet", () { +// test("getAnonymitySet success", () async { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getanonymityset"; +// const jsonArgs = '["1",""]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": GetAnonymitySetSampleData.data, +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getAnonymitySet( +// groupId: "1", blockhash: "", requestID: "some requestId"); +// +// expect(result, GetAnonymitySetSampleData.data); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getAnonymitySet throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getanonymityset"; +// const jsonArgs = '["1",""]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => +// client.getAnonymitySet(groupId: "1", requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getMintData", () { +// test("getMintData success", () async { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getmintmetadata"; +// const jsonArgs = '["some mints"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": "mint meta data", +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getMintData( +// mints: "some mints", requestID: "some requestId"); +// +// expect(result, "mint meta data"); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getMintData throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getmintmetadata"; +// const jsonArgs = '["some mints"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => client.getMintData( +// mints: "some mints", requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getUsedCoinSerials", () { +// test("getUsedCoinSerials success", () async { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getusedcoinserials"; +// const jsonArgs = '["0"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": GetUsedSerialsSampleData.serials, +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getUsedCoinSerials( +// requestID: "some requestId", startNumber: 0); +// +// expect(result, GetUsedSerialsSampleData.serials); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getUsedCoinSerials throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getusedcoinserials"; +// const jsonArgs = '["0"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => client.getUsedCoinSerials( +// requestID: "some requestId", startNumber: 0), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getLatestCoinId", () { +// test("getLatestCoinId success", () async { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getlatestcoinid"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": 1, +// "id": "some requestId", +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getLatestCoinId(requestID: "some requestId"); +// +// expect(result, 1); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getLatestCoinId throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getlatestcoinid"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => client.getLatestCoinId( +// requestID: "some requestId", +// ), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getCoinsForRecovery", () { +// test("getCoinsForRecovery success", () async { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getanonymityset"; +// const jsonArgs = '["1",""]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": GetAnonymitySetSampleData.data, +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getAnonymitySet( +// groupId: "1", blockhash: "", requestID: "some requestId"); +// +// expect(result, GetAnonymitySetSampleData.data); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getAnonymitySet throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getanonymityset"; +// const jsonArgs = '["1",""]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => client.getAnonymitySet( +// groupId: "1", +// requestID: "some requestId", +// ), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getMintData", () { +// test("getMintData success", () async { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getmintmetadata"; +// const jsonArgs = '["some mints"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": "mint meta data", +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getMintData( +// mints: "some mints", requestID: "some requestId"); +// +// expect(result, "mint meta data"); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getMintData throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getmintmetadata"; +// const jsonArgs = '["some mints"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => client.getMintData( +// mints: "some mints", +// requestID: "some requestId", +// ), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getUsedCoinSerials", () { +// test("getUsedCoinSerials success", () async { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getusedcoinserials"; +// const jsonArgs = '["0"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": GetUsedSerialsSampleData.serials, +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getUsedCoinSerials( +// requestID: "some requestId", startNumber: 0); +// +// expect(result, GetUsedSerialsSampleData.serials); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getUsedCoinSerials throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getusedcoinserials"; +// const jsonArgs = '["0"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => client.getUsedCoinSerials( +// requestID: "some requestId", startNumber: 0), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getLatestCoinId", () { +// test("getLatestCoinId success", () async { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getlatestcoinid"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": 1, +// "id": "some requestId", +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getLatestCoinId(requestID: "some requestId"); +// +// expect(result, 1); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getLatestCoinId throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getlatestcoinid"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect(() => client.getLatestCoinId(requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getFeeRate", () { +// test("getFeeRate success", () async { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.getfeerate"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": { +// "rate": 1000, +// }, +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getFeeRate(requestID: "some requestId"); +// +// expect(result, {"rate": 1000}); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getFeeRate throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.getfeerate"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect(() => client.getFeeRate(requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// test("rpcClient is null throws with bad server info", () { +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// client: null, +// port: -10, +// host: "_ :sa %", +// useSSL: false, +// prefs: mockPrefs, +// failovers: [], +// ); +// +// expect(() => client.getFeeRate(), throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// } diff --git a/test/electrumx_test.mocks.dart b/test/electrumx_test.mocks.dart deleted file mode 100644 index 2f3abf3472..0000000000 --- a/test/electrumx_test.mocks.dart +++ /dev/null @@ -1,537 +0,0 @@ -// Mocks generated by Mockito 5.3.2 from annotations -// in stackduo/test/electrumx_test.dart. -// Do not manually edit this file. - -// ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i3; -import 'dart:ui' as _i7; - -import 'package:mockito/mockito.dart' as _i1; -import 'package:stackduo/electrumx_rpc/rpc.dart' as _i2; -import 'package:stackduo/utilities/enums/backup_frequency_type.dart' as _i6; -import 'package:stackduo/utilities/enums/sync_type_enum.dart' as _i5; -import 'package:stackduo/utilities/prefs.dart' as _i4; - -// ignore_for_file: type=lint -// ignore_for_file: avoid_redundant_argument_values -// ignore_for_file: avoid_setters_without_getters -// ignore_for_file: comment_references -// ignore_for_file: implementation_imports -// ignore_for_file: invalid_use_of_visible_for_testing_member -// ignore_for_file: prefer_const_constructors -// ignore_for_file: unnecessary_parenthesis -// ignore_for_file: camel_case_types -// ignore_for_file: subtype_of_sealed_class - -class _FakeDuration_0 extends _i1.SmartFake implements Duration { - _FakeDuration_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -/// A class which mocks [JsonRPC]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockJsonRPC extends _i1.Mock implements _i2.JsonRPC { - MockJsonRPC() { - _i1.throwOnMissingStub(this); - } - - @override - bool get useSSL => (super.noSuchMethod( - Invocation.getter(#useSSL), - returnValue: false, - ) as bool); - @override - set useSSL(bool? _useSSL) => super.noSuchMethod( - Invocation.setter( - #useSSL, - _useSSL, - ), - returnValueForMissingStub: null, - ); - @override - String get host => (super.noSuchMethod( - Invocation.getter(#host), - returnValue: '', - ) as String); - @override - set host(String? _host) => super.noSuchMethod( - Invocation.setter( - #host, - _host, - ), - returnValueForMissingStub: null, - ); - @override - int get port => (super.noSuchMethod( - Invocation.getter(#port), - returnValue: 0, - ) as int); - @override - set port(int? _port) => super.noSuchMethod( - Invocation.setter( - #port, - _port, - ), - returnValueForMissingStub: null, - ); - @override - Duration get connectionTimeout => (super.noSuchMethod( - Invocation.getter(#connectionTimeout), - returnValue: _FakeDuration_0( - this, - Invocation.getter(#connectionTimeout), - ), - ) as Duration); - @override - set connectionTimeout(Duration? _connectionTimeout) => super.noSuchMethod( - Invocation.setter( - #connectionTimeout, - _connectionTimeout, - ), - returnValueForMissingStub: null, - ); - @override - _i3.Future request(String? jsonRpcRequest) => (super.noSuchMethod( - Invocation.method( - #request, - [jsonRpcRequest], - ), - returnValue: _i3.Future.value(), - ) as _i3.Future); -} - -/// A class which mocks [Prefs]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockPrefs extends _i1.Mock implements _i4.Prefs { - MockPrefs() { - _i1.throwOnMissingStub(this); - } - - @override - bool get isInitialized => (super.noSuchMethod( - Invocation.getter(#isInitialized), - returnValue: false, - ) as bool); - @override - int get lastUnlockedTimeout => (super.noSuchMethod( - Invocation.getter(#lastUnlockedTimeout), - returnValue: 0, - ) as int); - @override - set lastUnlockedTimeout(int? lastUnlockedTimeout) => super.noSuchMethod( - Invocation.setter( - #lastUnlockedTimeout, - lastUnlockedTimeout, - ), - returnValueForMissingStub: null, - ); - @override - int get lastUnlocked => (super.noSuchMethod( - Invocation.getter(#lastUnlocked), - returnValue: 0, - ) as int); - @override - set lastUnlocked(int? lastUnlocked) => super.noSuchMethod( - Invocation.setter( - #lastUnlocked, - lastUnlocked, - ), - returnValueForMissingStub: null, - ); - @override - int get currentNotificationId => (super.noSuchMethod( - Invocation.getter(#currentNotificationId), - returnValue: 0, - ) as int); - @override - List get walletIdsSyncOnStartup => (super.noSuchMethod( - Invocation.getter(#walletIdsSyncOnStartup), - returnValue: [], - ) as List); - @override - set walletIdsSyncOnStartup(List? walletIdsSyncOnStartup) => - super.noSuchMethod( - Invocation.setter( - #walletIdsSyncOnStartup, - walletIdsSyncOnStartup, - ), - returnValueForMissingStub: null, - ); - @override - _i5.SyncingType get syncType => (super.noSuchMethod( - Invocation.getter(#syncType), - returnValue: _i5.SyncingType.currentWalletOnly, - ) as _i5.SyncingType); - @override - set syncType(_i5.SyncingType? syncType) => super.noSuchMethod( - Invocation.setter( - #syncType, - syncType, - ), - returnValueForMissingStub: null, - ); - @override - bool get wifiOnly => (super.noSuchMethod( - Invocation.getter(#wifiOnly), - returnValue: false, - ) as bool); - @override - set wifiOnly(bool? wifiOnly) => super.noSuchMethod( - Invocation.setter( - #wifiOnly, - wifiOnly, - ), - returnValueForMissingStub: null, - ); - @override - bool get showFavoriteWallets => (super.noSuchMethod( - Invocation.getter(#showFavoriteWallets), - returnValue: false, - ) as bool); - @override - set showFavoriteWallets(bool? showFavoriteWallets) => super.noSuchMethod( - Invocation.setter( - #showFavoriteWallets, - showFavoriteWallets, - ), - returnValueForMissingStub: null, - ); - @override - String get language => (super.noSuchMethod( - Invocation.getter(#language), - returnValue: '', - ) as String); - @override - set language(String? newLanguage) => super.noSuchMethod( - Invocation.setter( - #language, - newLanguage, - ), - returnValueForMissingStub: null, - ); - @override - String get currency => (super.noSuchMethod( - Invocation.getter(#currency), - returnValue: '', - ) as String); - @override - set currency(String? newCurrency) => super.noSuchMethod( - Invocation.setter( - #currency, - newCurrency, - ), - returnValueForMissingStub: null, - ); - @override - bool get randomizePIN => (super.noSuchMethod( - Invocation.getter(#randomizePIN), - returnValue: false, - ) as bool); - @override - set randomizePIN(bool? randomizePIN) => super.noSuchMethod( - Invocation.setter( - #randomizePIN, - randomizePIN, - ), - returnValueForMissingStub: null, - ); - @override - bool get useBiometrics => (super.noSuchMethod( - Invocation.getter(#useBiometrics), - returnValue: false, - ) as bool); - @override - set useBiometrics(bool? useBiometrics) => super.noSuchMethod( - Invocation.setter( - #useBiometrics, - useBiometrics, - ), - returnValueForMissingStub: null, - ); - @override - bool get hasPin => (super.noSuchMethod( - Invocation.getter(#hasPin), - returnValue: false, - ) as bool); - @override - set hasPin(bool? hasPin) => super.noSuchMethod( - Invocation.setter( - #hasPin, - hasPin, - ), - returnValueForMissingStub: null, - ); - @override - int get familiarity => (super.noSuchMethod( - Invocation.getter(#familiarity), - returnValue: 0, - ) as int); - @override - set familiarity(int? familiarity) => super.noSuchMethod( - Invocation.setter( - #familiarity, - familiarity, - ), - returnValueForMissingStub: null, - ); - @override - bool get showTestNetCoins => (super.noSuchMethod( - Invocation.getter(#showTestNetCoins), - returnValue: false, - ) as bool); - @override - set showTestNetCoins(bool? showTestNetCoins) => super.noSuchMethod( - Invocation.setter( - #showTestNetCoins, - showTestNetCoins, - ), - returnValueForMissingStub: null, - ); - @override - bool get isAutoBackupEnabled => (super.noSuchMethod( - Invocation.getter(#isAutoBackupEnabled), - returnValue: false, - ) as bool); - @override - set isAutoBackupEnabled(bool? isAutoBackupEnabled) => super.noSuchMethod( - Invocation.setter( - #isAutoBackupEnabled, - isAutoBackupEnabled, - ), - returnValueForMissingStub: null, - ); - @override - set autoBackupLocation(String? autoBackupLocation) => super.noSuchMethod( - Invocation.setter( - #autoBackupLocation, - autoBackupLocation, - ), - returnValueForMissingStub: null, - ); - @override - _i6.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( - Invocation.getter(#backupFrequencyType), - returnValue: _i6.BackupFrequencyType.everyTenMinutes, - ) as _i6.BackupFrequencyType); - @override - set backupFrequencyType(_i6.BackupFrequencyType? backupFrequencyType) => - super.noSuchMethod( - Invocation.setter( - #backupFrequencyType, - backupFrequencyType, - ), - returnValueForMissingStub: null, - ); - @override - set lastAutoBackup(DateTime? lastAutoBackup) => super.noSuchMethod( - Invocation.setter( - #lastAutoBackup, - lastAutoBackup, - ), - returnValueForMissingStub: null, - ); - @override - bool get hideBlockExplorerWarning => (super.noSuchMethod( - Invocation.getter(#hideBlockExplorerWarning), - returnValue: false, - ) as bool); - @override - set hideBlockExplorerWarning(bool? hideBlockExplorerWarning) => - super.noSuchMethod( - Invocation.setter( - #hideBlockExplorerWarning, - hideBlockExplorerWarning, - ), - returnValueForMissingStub: null, - ); - @override - bool get gotoWalletOnStartup => (super.noSuchMethod( - Invocation.getter(#gotoWalletOnStartup), - returnValue: false, - ) as bool); - @override - set gotoWalletOnStartup(bool? gotoWalletOnStartup) => super.noSuchMethod( - Invocation.setter( - #gotoWalletOnStartup, - gotoWalletOnStartup, - ), - returnValueForMissingStub: null, - ); - @override - set startupWalletId(String? startupWalletId) => super.noSuchMethod( - Invocation.setter( - #startupWalletId, - startupWalletId, - ), - returnValueForMissingStub: null, - ); - @override - bool get externalCalls => (super.noSuchMethod( - Invocation.getter(#externalCalls), - returnValue: false, - ) as bool); - @override - set externalCalls(bool? externalCalls) => super.noSuchMethod( - Invocation.setter( - #externalCalls, - externalCalls, - ), - returnValueForMissingStub: null, - ); - @override - bool get enableCoinControl => (super.noSuchMethod( - Invocation.getter(#enableCoinControl), - returnValue: false, - ) as bool); - @override - set enableCoinControl(bool? enableCoinControl) => super.noSuchMethod( - Invocation.setter( - #enableCoinControl, - enableCoinControl, - ), - returnValueForMissingStub: null, - ); - @override - bool get enableSystemBrightness => (super.noSuchMethod( - Invocation.getter(#enableSystemBrightness), - returnValue: false, - ) as bool); - @override - set enableSystemBrightness(bool? enableSystemBrightness) => - super.noSuchMethod( - Invocation.setter( - #enableSystemBrightness, - enableSystemBrightness, - ), - returnValueForMissingStub: null, - ); - @override - String get themeId => (super.noSuchMethod( - Invocation.getter(#themeId), - returnValue: '', - ) as String); - @override - set themeId(String? themeId) => super.noSuchMethod( - Invocation.setter( - #themeId, - themeId, - ), - returnValueForMissingStub: null, - ); - @override - String get systemBrightnessLightThemeId => (super.noSuchMethod( - Invocation.getter(#systemBrightnessLightThemeId), - returnValue: '', - ) as String); - @override - set systemBrightnessLightThemeId(String? systemBrightnessLightThemeId) => - super.noSuchMethod( - Invocation.setter( - #systemBrightnessLightThemeId, - systemBrightnessLightThemeId, - ), - returnValueForMissingStub: null, - ); - @override - String get systemBrightnessDarkThemeId => (super.noSuchMethod( - Invocation.getter(#systemBrightnessDarkThemeId), - returnValue: '', - ) as String); - @override - set systemBrightnessDarkThemeId(String? systemBrightnessDarkThemeId) => - super.noSuchMethod( - Invocation.setter( - #systemBrightnessDarkThemeId, - systemBrightnessDarkThemeId, - ), - returnValueForMissingStub: null, - ); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - _i3.Future init() => (super.noSuchMethod( - Invocation.method( - #init, - [], - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); - @override - _i3.Future incrementCurrentNotificationIndex() => (super.noSuchMethod( - Invocation.method( - #incrementCurrentNotificationIndex, - [], - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); - @override - _i3.Future isExternalCallsSet() => (super.noSuchMethod( - Invocation.method( - #isExternalCallsSet, - [], - ), - returnValue: _i3.Future.value(false), - ) as _i3.Future); - @override - _i3.Future saveUserID(String? userId) => (super.noSuchMethod( - Invocation.method( - #saveUserID, - [userId], - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); - @override - _i3.Future saveSignupEpoch(int? signupEpoch) => (super.noSuchMethod( - Invocation.method( - #saveSignupEpoch, - [signupEpoch], - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); - @override - void addListener(_i7.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} diff --git a/test/flutter_secure_storage_interface_test.mocks.dart b/test/flutter_secure_storage_interface_test.mocks.dart index f37422cdc8..f310de330a 100644 --- a/test/flutter_secure_storage_interface_test.mocks.dart +++ b/test/flutter_secure_storage_interface_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/flutter_secure_storage_interface_test.dart. // Do not manually edit this file. diff --git a/test/hive/db_test.dart b/test/hive/db_test.dart index 486bf13d38..d9c9bf4054 100644 --- a/test/hive/db_test.dart +++ b/test/hive/db_test.dart @@ -1,12 +1,10 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:hive_test/hive_test.dart'; -import 'package:stackduo/hive/db.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; +import 'package:stackduo/db/hive/db.dart'; void main() { group("DB box names", () { test("address book", () => expect(DB.boxNameAddressBook, "addressBook")); - test("debug info", () => expect(DB.boxNameDebugInfo, "debugInfoBox")); test("nodes", () => expect(DB.boxNameNodeModels, "nodeModels")); test("primary nodes", () => expect(DB.boxNamePrimaryNodes, "primaryNodes")); test("wallets info", () => expect(DB.boxNameAllWalletsData, "wallets")); @@ -33,26 +31,6 @@ void main() { expect(DB.boxNameWalletsToDeleteOnStart, "walletsToDeleteOnStart")); test("price cache", () => expect(DB.boxNamePriceCache, "priceAPIPrice24hCache")); - - test("boxNameTxCache", () { - for (final coin in Coin.values) { - expect(DB.instance.boxNameTxCache(coin: coin), "${coin.name}_txCache"); - } - }); - - test("boxNameSetCache", () { - for (final coin in Coin.values) { - expect(DB.instance.boxNameSetCache(coin: coin), - "${coin.name}_anonymitySetCache"); - } - }); - - test("boxNameUsedSerialsCache", () { - for (final coin in Coin.values) { - expect(DB.instance.boxNameUsedSerialsCache(coin: coin), - "${coin.name}_usedSerialsCache"); - } - }); }); group("tests requiring test hive environment", () { diff --git a/test/json_rpc_test.dart b/test/json_rpc_test.dart index b7a613631f..d6af195464 100644 --- a/test/json_rpc_test.dart +++ b/test/json_rpc_test.dart @@ -17,7 +17,7 @@ void main() { '{"jsonrpc": "2.0", "id": "some id","method": "server.ping","params": []}'; final result = await jsonRPC.request(jsonRequestString); - expect(result, {"jsonrpc": "2.0", "result": null, "id": "some id"}); + expect(result.data, {"jsonrpc": "2.0", "result": null, "id": "some id"}); }); test("JsonRPC.request fails due to SocketException", () async { diff --git a/test/models/transactions_model_test.dart b/test/models/transactions_model_test.dart index 176452694d..3fca565111 100644 --- a/test/models/transactions_model_test.dart +++ b/test/models/transactions_model_test.dart @@ -118,7 +118,7 @@ void main() { ] }); expect(txChunk.toString(), - "timestamp: 993260735 transactions: [\n {txid: txid, type: txType, subType: mint, value: 10, fee: 1, height: 1, confirm: true, confirmations: 1, address: address, timestamp: 1876352482, worthNow: 1, inputs: [], slateid: slateId } \n]"); + "timestamp: 993260735 transactions: [\n {txid: txid, type: txType, subType: mint, value: 10, fee: 1, height: 1, confirm: true, confirmations: 1, address: address, timestamp: 1876352482, worthNow: 1, inputs: [], slateid: slateId, numberOfMessages: null } \n]"); }); }); diff --git a/test/models/type_adapter_tests/lelantus_coin_adapter_test.mocks.dart b/test/models/type_adapter_tests/lelantus_coin_adapter_test.mocks.dart index 5a3f0677f2..1d3200c428 100644 --- a/test/models/type_adapter_tests/lelantus_coin_adapter_test.mocks.dart +++ b/test/models/type_adapter_tests/lelantus_coin_adapter_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/models/type_adapter_tests/lelantus_coin_adapter_test.dart. // Do not manually edit this file. diff --git a/test/models/type_adapter_tests/transactions_model_adapter_test.mocks.dart b/test/models/type_adapter_tests/transactions_model_adapter_test.mocks.dart index 8d92283c8d..2f14b40091 100644 --- a/test/models/type_adapter_tests/transactions_model_adapter_test.mocks.dart +++ b/test/models/type_adapter_tests/transactions_model_adapter_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/models/type_adapter_tests/transactions_model_adapter_test.dart. // Do not manually edit this file. diff --git a/test/models/type_adapter_tests/utxo_model_adapter_test.mocks.dart b/test/models/type_adapter_tests/utxo_model_adapter_test.mocks.dart index 86b0748d53..dc060f6385 100644 --- a/test/models/type_adapter_tests/utxo_model_adapter_test.mocks.dart +++ b/test/models/type_adapter_tests/utxo_model_adapter_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/models/type_adapter_tests/utxo_model_adapter_test.dart. // Do not manually edit this file. diff --git a/test/notifications/notification_card_test.dart b/test/notifications/notification_card_test.dart index 30fe71ed88..55a9dcae50 100644 --- a/test/notifications/notification_card_test.dart +++ b/test/notifications/notification_card_test.dart @@ -1,23 +1,41 @@ import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:stackduo/models/notification_model.dart'; -import 'package:stackduo/notifications/notification_card.dart'; -import 'package:stackduo/utilities/assets.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/models/notification_model.dart'; +import 'package:stackwallet/notifications/notification_card.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/themes/theme_service.dart'; +import 'package:stackwallet/utilities/assets.dart'; +import '../sample_data/theme_json.dart'; +import 'notification_card_test.mocks.dart'; + +@GenerateMocks([ + ThemeService, +]) void main() { testWidgets("test notification card", (widgetTester) async { final key = UniqueKey(); + final mockThemeService = MockThemeService(); + final theme = StackTheme.fromJson( + json: lightThemeJsonMap, + ); + + when(mockThemeService.getTheme(themeId: "light")).thenAnswer( + (_) => theme, + ); + final notificationCard = NotificationCard( key: key, notification: NotificationModel( id: 1, title: "notification title", description: "notification description", - iconAssetName: Assets.svg.iconFor(coin: Coin.bitcoin), + iconAssetName: Assets.svg.plus, date: DateTime.parse("1662544771"), walletId: "wallet id", read: true, @@ -26,14 +44,21 @@ void main() { ); await widgetTester.pumpWidget( - MaterialApp( - theme: ThemeData( - extensions: [ - StackColors.fromStackColorTheme(LightColors()), - ], - ), - home: Material( - child: notificationCard, + ProviderScope( + overrides: [ + pThemeService.overrideWithValue(mockThemeService), + ], + child: MaterialApp( + theme: ThemeData( + extensions: [ + StackColors.fromStackColorTheme( + theme, + ), + ], + ), + home: Material( + child: notificationCard, + ), ), ), ); diff --git a/test/pages/send_view/send_view_test.dart b/test/pages/send_view/send_view_test.dart index 5e0e1ff0f3..975554c8da 100644 --- a/test/pages/send_view/send_view_test.dart +++ b/test/pages/send_view/send_view_test.dart @@ -3,21 +3,24 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; -import 'package:stackduo/models/send_view_auto_fill_data.dart'; -import 'package:stackduo/pages/send_view/send_view.dart'; -import 'package:stackduo/providers/providers.dart'; -import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart'; -import 'package:stackduo/services/coins/coin_service.dart'; -import 'package:stackduo/services/coins/manager.dart'; -import 'package:stackduo/services/locale_service.dart'; -import 'package:stackduo/services/node_service.dart'; -import 'package:stackduo/services/wallets.dart'; -import 'package:stackduo/services/wallets_service.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; -import 'package:stackduo/utilities/prefs.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; - +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/models/send_view_auto_fill_data.dart'; +import 'package:stackwallet/pages/send_view/send_view.dart'; +import 'package:stackwallet/providers/providers.dart'; +import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart'; +import 'package:stackwallet/services/coins/coin_service.dart'; +import 'package:stackwallet/services/coins/manager.dart'; +import 'package:stackwallet/services/locale_service.dart'; +import 'package:stackwallet/services/node_service.dart'; +import 'package:stackwallet/services/wallets.dart'; +import 'package:stackwallet/services/wallets_service.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/themes/theme_service.dart'; +import 'package:stackwallet/utilities/amount/amount_unit.dart'; +import 'package:stackwallet/utilities/enums/coin_enum.dart'; +import 'package:stackwallet/utilities/prefs.dart'; + +import '../../sample_data/theme_json.dart'; import 'send_view_test.mocks.dart'; @GenerateMocks([ @@ -26,6 +29,7 @@ import 'send_view_test.mocks.dart'; NodeService, BitcoinWallet, LocaleService, + ThemeService, Prefs, ], customMocks: [ MockSpec(returnNullOnMissingStub: true), @@ -38,6 +42,7 @@ void main() { final mockNodeService = MockNodeService(); final CoinServiceAPI wallet = MockBitcoinWallet(); final mockLocaleService = MockLocaleService(); + final mockThemeService = MockThemeService(); final mockPrefs = MockPrefs(); when(wallet.coin).thenAnswer((_) => Coin.bitcoin); @@ -51,8 +56,16 @@ void main() { .thenAnswer((realInvocation) => manager); when(mockLocaleService.locale).thenAnswer((_) => "en_US"); + when(mockThemeService.getTheme(themeId: "light")).thenAnswer( + (_) => StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ); when(mockPrefs.currency).thenAnswer((_) => "USD"); when(mockPrefs.enableCoinControl).thenAnswer((_) => false); + when(mockPrefs.amountUnit(Coin.bitcoin)).thenAnswer( + (_) => AmountUnit.normal, + ); when(wallet.validateAddress("send to address")) .thenAnswer((realInvocation) => true); @@ -66,13 +79,16 @@ void main() { localeServiceChangeNotifierProvider .overrideWithValue(mockLocaleService), prefsChangeNotifierProvider.overrideWithValue(mockPrefs), + pThemeService.overrideWithValue(mockThemeService), // previewTxButtonStateProvider ], child: MaterialApp( theme: ThemeData( extensions: [ StackColors.fromStackColorTheme( - LightColors(), + StackTheme.fromJson( + json: lightThemeJsonMap, + ), ), ], ), @@ -102,6 +118,7 @@ void main() { final CoinServiceAPI wallet = MockBitcoinWallet(); final mockLocaleService = MockLocaleService(); final mockPrefs = MockPrefs(); + final mockThemeService = MockThemeService(); when(wallet.coin).thenAnswer((_) => Coin.bitcoin); when(wallet.walletName).thenAnswer((_) => "some wallet"); @@ -116,8 +133,16 @@ void main() { when(mockLocaleService.locale).thenAnswer((_) => "en_US"); when(mockPrefs.currency).thenAnswer((_) => "USD"); when(mockPrefs.enableCoinControl).thenAnswer((_) => false); + when(mockPrefs.amountUnit(Coin.bitcoin)).thenAnswer( + (_) => AmountUnit.normal, + ); when(wallet.validateAddress("send to address")) .thenAnswer((realInvocation) => false); + when(mockThemeService.getTheme(themeId: "light")).thenAnswer( + (_) => StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ); // when(manager.isOwnAddress("send to address")) // .thenAnswer((realInvocation) => Future(() => true)); @@ -132,13 +157,16 @@ void main() { localeServiceChangeNotifierProvider .overrideWithValue(mockLocaleService), prefsChangeNotifierProvider.overrideWithValue(mockPrefs), + pThemeService.overrideWithValue(mockThemeService) // previewTxButtonStateProvider ], child: MaterialApp( theme: ThemeData( extensions: [ StackColors.fromStackColorTheme( - LightColors(), + StackTheme.fromJson( + json: lightThemeJsonMap, + ), ), ], ), diff --git a/test/pages/send_view/send_view_test.mocks.dart b/test/pages/send_view/send_view_test.mocks.dart deleted file mode 100644 index 60041c9d9f..0000000000 --- a/test/pages/send_view/send_view_test.mocks.dart +++ /dev/null @@ -1,3323 +0,0 @@ -// Mocks generated by Mockito 5.3.2 from annotations -// in stackduo/test/pages/send_view/send_view_test.dart. -// Do not manually edit this file. - -// ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i23; -import 'dart:typed_data' as _i30; -import 'dart:ui' as _i25; - -import 'package:bip32/bip32.dart' as _i17; -import 'package:bip47/bip47.dart' as _i19; -import 'package:bitcoindart/bitcoindart.dart' as _i14; -import 'package:flutter/foundation.dart' as _i4; -import 'package:flutter_riverpod/flutter_riverpod.dart' as _i5; -import 'package:mockito/mockito.dart' as _i1; -import 'package:stackduo/db/main_db.dart' as _i13; -import 'package:stackduo/electrumx_rpc/cached_electrumx.dart' as _i11; -import 'package:stackduo/electrumx_rpc/electrumx.dart' as _i10; -import 'package:stackduo/models/balance.dart' as _i12; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i18; -import 'package:stackduo/models/node_model.dart' as _i26; -import 'package:stackduo/models/paymint/fee_object_model.dart' as _i9; -import 'package:stackduo/models/signing_data.dart' as _i29; -import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart' as _i27; -import 'package:stackduo/services/coins/coin_service.dart' as _i20; -import 'package:stackduo/services/coins/manager.dart' as _i6; -import 'package:stackduo/services/locale_service.dart' as _i31; -import 'package:stackduo/services/node_service.dart' as _i3; -import 'package:stackduo/services/transaction_notification_tracker.dart' as _i8; -import 'package:stackduo/services/wallets.dart' as _i21; -import 'package:stackduo/services/wallets_service.dart' as _i2; -import 'package:stackduo/utilities/amount/amount.dart' as _i15; -import 'package:stackduo/utilities/enums/backup_frequency_type.dart' as _i33; -import 'package:stackduo/utilities/enums/coin_enum.dart' as _i22; -import 'package:stackduo/utilities/enums/derive_path_type_enum.dart' as _i28; -import 'package:stackduo/utilities/enums/sync_type_enum.dart' as _i32; -import 'package:stackduo/utilities/flutter_secure_storage_interface.dart' - as _i7; -import 'package:stackduo/utilities/prefs.dart' as _i24; -import 'package:tuple/tuple.dart' as _i16; - -// ignore_for_file: type=lint -// ignore_for_file: avoid_redundant_argument_values -// ignore_for_file: avoid_setters_without_getters -// ignore_for_file: comment_references -// ignore_for_file: implementation_imports -// ignore_for_file: invalid_use_of_visible_for_testing_member -// ignore_for_file: prefer_const_constructors -// ignore_for_file: unnecessary_parenthesis -// ignore_for_file: camel_case_types -// ignore_for_file: subtype_of_sealed_class - -class _FakeWalletsService_0 extends _i1.SmartFake - implements _i2.WalletsService { - _FakeWalletsService_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeNodeService_1 extends _i1.SmartFake implements _i3.NodeService { - _FakeNodeService_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeChangeNotifierProvider_2 - extends _i1.SmartFake implements _i5.ChangeNotifierProvider { - _FakeChangeNotifierProvider_2( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeManager_3 extends _i1.SmartFake implements _i6.Manager { - _FakeManager_3( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeSecureStorageInterface_4 extends _i1.SmartFake - implements _i7.SecureStorageInterface { - _FakeSecureStorageInterface_4( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeTransactionNotificationTracker_5 extends _i1.SmartFake - implements _i8.TransactionNotificationTracker { - _FakeTransactionNotificationTracker_5( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeFeeObject_6 extends _i1.SmartFake implements _i9.FeeObject { - _FakeFeeObject_6( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeElectrumX_7 extends _i1.SmartFake implements _i10.ElectrumX { - _FakeElectrumX_7( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeCachedElectrumX_8 extends _i1.SmartFake - implements _i11.CachedElectrumX { - _FakeCachedElectrumX_8( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeBalance_9 extends _i1.SmartFake implements _i12.Balance { - _FakeBalance_9( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeMainDB_10 extends _i1.SmartFake implements _i13.MainDB { - _FakeMainDB_10( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeNetworkType_11 extends _i1.SmartFake implements _i14.NetworkType { - _FakeNetworkType_11( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeElectrumXNode_12 extends _i1.SmartFake - implements _i10.ElectrumXNode { - _FakeElectrumXNode_12( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeAmount_13 extends _i1.SmartFake implements _i15.Amount { - _FakeAmount_13( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeTuple2_14 extends _i1.SmartFake - implements _i16.Tuple2 { - _FakeTuple2_14( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeBIP32_15 extends _i1.SmartFake implements _i17.BIP32 { - _FakeBIP32_15( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeAddress_16 extends _i1.SmartFake implements _i18.Address { - _FakeAddress_16( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakePaymentCode_17 extends _i1.SmartFake implements _i19.PaymentCode { - _FakePaymentCode_17( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeCoinServiceAPI_18 extends _i1.SmartFake - implements _i20.CoinServiceAPI { - _FakeCoinServiceAPI_18( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -/// A class which mocks [Wallets]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockWallets extends _i1.Mock implements _i21.Wallets { - MockWallets() { - _i1.throwOnMissingStub(this); - } - - @override - _i2.WalletsService get walletsService => (super.noSuchMethod( - Invocation.getter(#walletsService), - returnValue: _FakeWalletsService_0( - this, - Invocation.getter(#walletsService), - ), - ) as _i2.WalletsService); - @override - set walletsService(_i2.WalletsService? _walletsService) => super.noSuchMethod( - Invocation.setter( - #walletsService, - _walletsService, - ), - returnValueForMissingStub: null, - ); - @override - _i3.NodeService get nodeService => (super.noSuchMethod( - Invocation.getter(#nodeService), - returnValue: _FakeNodeService_1( - this, - Invocation.getter(#nodeService), - ), - ) as _i3.NodeService); - @override - set nodeService(_i3.NodeService? _nodeService) => super.noSuchMethod( - Invocation.setter( - #nodeService, - _nodeService, - ), - returnValueForMissingStub: null, - ); - @override - bool get hasWallets => (super.noSuchMethod( - Invocation.getter(#hasWallets), - returnValue: false, - ) as bool); - @override - List<_i5.ChangeNotifierProvider<_i6.Manager>> get managerProviders => - (super.noSuchMethod( - Invocation.getter(#managerProviders), - returnValue: <_i5.ChangeNotifierProvider<_i6.Manager>>[], - ) as List<_i5.ChangeNotifierProvider<_i6.Manager>>); - @override - List<_i6.Manager> get managers => (super.noSuchMethod( - Invocation.getter(#managers), - returnValue: <_i6.Manager>[], - ) as List<_i6.Manager>); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - List getWalletIdsFor({required _i22.Coin? coin}) => - (super.noSuchMethod( - Invocation.method( - #getWalletIdsFor, - [], - {#coin: coin}, - ), - returnValue: [], - ) as List); - @override - List<_i16.Tuple2<_i22.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>> - getManagerProvidersByCoin() => (super.noSuchMethod( - Invocation.method( - #getManagerProvidersByCoin, - [], - ), - returnValue: < - _i16.Tuple2<_i22.Coin, - List<_i5.ChangeNotifierProvider<_i6.Manager>>>>[], - ) as List< - _i16.Tuple2<_i22.Coin, - List<_i5.ChangeNotifierProvider<_i6.Manager>>>>); - @override - List<_i5.ChangeNotifierProvider<_i6.Manager>> getManagerProvidersForCoin( - _i22.Coin? coin) => - (super.noSuchMethod( - Invocation.method( - #getManagerProvidersForCoin, - [coin], - ), - returnValue: <_i5.ChangeNotifierProvider<_i6.Manager>>[], - ) as List<_i5.ChangeNotifierProvider<_i6.Manager>>); - @override - _i5.ChangeNotifierProvider<_i6.Manager> getManagerProvider( - String? walletId) => - (super.noSuchMethod( - Invocation.method( - #getManagerProvider, - [walletId], - ), - returnValue: _FakeChangeNotifierProvider_2<_i6.Manager>( - this, - Invocation.method( - #getManagerProvider, - [walletId], - ), - ), - ) as _i5.ChangeNotifierProvider<_i6.Manager>); - @override - _i6.Manager getManager(String? walletId) => (super.noSuchMethod( - Invocation.method( - #getManager, - [walletId], - ), - returnValue: _FakeManager_3( - this, - Invocation.method( - #getManager, - [walletId], - ), - ), - ) as _i6.Manager); - @override - void addWallet({ - required String? walletId, - required _i6.Manager? manager, - }) => - super.noSuchMethod( - Invocation.method( - #addWallet, - [], - { - #walletId: walletId, - #manager: manager, - }, - ), - returnValueForMissingStub: null, - ); - @override - void removeWallet({required String? walletId}) => super.noSuchMethod( - Invocation.method( - #removeWallet, - [], - {#walletId: walletId}, - ), - returnValueForMissingStub: null, - ); - @override - _i23.Future load(_i24.Prefs? prefs) => (super.noSuchMethod( - Invocation.method( - #load, - [prefs], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future loadAfterStackRestore( - _i24.Prefs? prefs, - List<_i6.Manager>? managers, - ) => - (super.noSuchMethod( - Invocation.method( - #loadAfterStackRestore, - [ - prefs, - managers, - ], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [WalletsService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockWalletsService extends _i1.Mock implements _i2.WalletsService { - MockWalletsService() { - _i1.throwOnMissingStub(this); - } - - @override - _i23.Future> get walletNames => - (super.noSuchMethod( - Invocation.getter(#walletNames), - returnValue: _i23.Future>.value( - {}), - ) as _i23.Future>); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - _i23.Future renameWallet({ - required String? from, - required String? to, - required bool? shouldNotifyListeners, - }) => - (super.noSuchMethod( - Invocation.method( - #renameWallet, - [], - { - #from: from, - #to: to, - #shouldNotifyListeners: shouldNotifyListeners, - }, - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - Map fetchWalletsData() => (super.noSuchMethod( - Invocation.method( - #fetchWalletsData, - [], - ), - returnValue: {}, - ) as Map); - @override - _i23.Future addExistingStackWallet({ - required String? name, - required String? walletId, - required _i22.Coin? coin, - required bool? shouldNotifyListeners, - }) => - (super.noSuchMethod( - Invocation.method( - #addExistingStackWallet, - [], - { - #name: name, - #walletId: walletId, - #coin: coin, - #shouldNotifyListeners: shouldNotifyListeners, - }, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future addNewWallet({ - required String? name, - required _i22.Coin? coin, - required bool? shouldNotifyListeners, - }) => - (super.noSuchMethod( - Invocation.method( - #addNewWallet, - [], - { - #name: name, - #coin: coin, - #shouldNotifyListeners: shouldNotifyListeners, - }, - ), - returnValue: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future> getFavoriteWalletIds() => (super.noSuchMethod( - Invocation.method( - #getFavoriteWalletIds, - [], - ), - returnValue: _i23.Future>.value([]), - ) as _i23.Future>); - @override - _i23.Future saveFavoriteWalletIds(List? walletIds) => - (super.noSuchMethod( - Invocation.method( - #saveFavoriteWalletIds, - [walletIds], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future addFavorite(String? walletId) => (super.noSuchMethod( - Invocation.method( - #addFavorite, - [walletId], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future removeFavorite(String? walletId) => (super.noSuchMethod( - Invocation.method( - #removeFavorite, - [walletId], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future moveFavorite({ - required int? fromIndex, - required int? toIndex, - }) => - (super.noSuchMethod( - Invocation.method( - #moveFavorite, - [], - { - #fromIndex: fromIndex, - #toIndex: toIndex, - }, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future checkForDuplicate(String? name) => (super.noSuchMethod( - Invocation.method( - #checkForDuplicate, - [name], - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - _i23.Future getWalletId(String? walletName) => (super.noSuchMethod( - Invocation.method( - #getWalletId, - [walletName], - ), - returnValue: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future isMnemonicVerified({required String? walletId}) => - (super.noSuchMethod( - Invocation.method( - #isMnemonicVerified, - [], - {#walletId: walletId}, - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - _i23.Future setMnemonicVerified({required String? walletId}) => - (super.noSuchMethod( - Invocation.method( - #setMnemonicVerified, - [], - {#walletId: walletId}, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future deleteWallet( - String? name, - bool? shouldNotifyListeners, - ) => - (super.noSuchMethod( - Invocation.method( - #deleteWallet, - [ - name, - shouldNotifyListeners, - ], - ), - returnValue: _i23.Future.value(0), - ) as _i23.Future); - @override - _i23.Future refreshWallets(bool? shouldNotifyListeners) => - (super.noSuchMethod( - Invocation.method( - #refreshWallets, - [shouldNotifyListeners], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [NodeService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockNodeService extends _i1.Mock implements _i3.NodeService { - MockNodeService() { - _i1.throwOnMissingStub(this); - } - - @override - _i7.SecureStorageInterface get secureStorageInterface => (super.noSuchMethod( - Invocation.getter(#secureStorageInterface), - returnValue: _FakeSecureStorageInterface_4( - this, - Invocation.getter(#secureStorageInterface), - ), - ) as _i7.SecureStorageInterface); - @override - List<_i26.NodeModel> get primaryNodes => (super.noSuchMethod( - Invocation.getter(#primaryNodes), - returnValue: <_i26.NodeModel>[], - ) as List<_i26.NodeModel>); - @override - List<_i26.NodeModel> get nodes => (super.noSuchMethod( - Invocation.getter(#nodes), - returnValue: <_i26.NodeModel>[], - ) as List<_i26.NodeModel>); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - _i23.Future updateDefaults() => (super.noSuchMethod( - Invocation.method( - #updateDefaults, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future setPrimaryNodeFor({ - required _i22.Coin? coin, - required _i26.NodeModel? node, - bool? shouldNotifyListeners = false, - }) => - (super.noSuchMethod( - Invocation.method( - #setPrimaryNodeFor, - [], - { - #coin: coin, - #node: node, - #shouldNotifyListeners: shouldNotifyListeners, - }, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i26.NodeModel? getPrimaryNodeFor({required _i22.Coin? coin}) => - (super.noSuchMethod(Invocation.method( - #getPrimaryNodeFor, - [], - {#coin: coin}, - )) as _i26.NodeModel?); - @override - List<_i26.NodeModel> getNodesFor(_i22.Coin? coin) => (super.noSuchMethod( - Invocation.method( - #getNodesFor, - [coin], - ), - returnValue: <_i26.NodeModel>[], - ) as List<_i26.NodeModel>); - @override - _i26.NodeModel? getNodeById({required String? id}) => - (super.noSuchMethod(Invocation.method( - #getNodeById, - [], - {#id: id}, - )) as _i26.NodeModel?); - @override - List<_i26.NodeModel> failoverNodesFor({required _i22.Coin? coin}) => - (super.noSuchMethod( - Invocation.method( - #failoverNodesFor, - [], - {#coin: coin}, - ), - returnValue: <_i26.NodeModel>[], - ) as List<_i26.NodeModel>); - @override - _i23.Future add( - _i26.NodeModel? node, - String? password, - bool? shouldNotifyListeners, - ) => - (super.noSuchMethod( - Invocation.method( - #add, - [ - node, - password, - shouldNotifyListeners, - ], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future delete( - String? id, - bool? shouldNotifyListeners, - ) => - (super.noSuchMethod( - Invocation.method( - #delete, - [ - id, - shouldNotifyListeners, - ], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future setEnabledState( - String? id, - bool? enabled, - bool? shouldNotifyListeners, - ) => - (super.noSuchMethod( - Invocation.method( - #setEnabledState, - [ - id, - enabled, - shouldNotifyListeners, - ], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future edit( - _i26.NodeModel? editedNode, - String? password, - bool? shouldNotifyListeners, - ) => - (super.noSuchMethod( - Invocation.method( - #edit, - [ - editedNode, - password, - shouldNotifyListeners, - ], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future updateCommunityNodes() => (super.noSuchMethod( - Invocation.method( - #updateCommunityNodes, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [BitcoinWallet]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockBitcoinWallet extends _i1.Mock implements _i27.BitcoinWallet { - MockBitcoinWallet() { - _i1.throwOnMissingStub(this); - } - - @override - set timer(_i23.Timer? _timer) => super.noSuchMethod( - Invocation.setter( - #timer, - _timer, - ), - returnValueForMissingStub: null, - ); - @override - _i8.TransactionNotificationTracker get txTracker => (super.noSuchMethod( - Invocation.getter(#txTracker), - returnValue: _FakeTransactionNotificationTracker_5( - this, - Invocation.getter(#txTracker), - ), - ) as _i8.TransactionNotificationTracker); - @override - set txTracker(_i8.TransactionNotificationTracker? _txTracker) => - super.noSuchMethod( - Invocation.setter( - #txTracker, - _txTracker, - ), - returnValueForMissingStub: null, - ); - @override - bool get longMutex => (super.noSuchMethod( - Invocation.getter(#longMutex), - returnValue: false, - ) as bool); - @override - set longMutex(bool? _longMutex) => super.noSuchMethod( - Invocation.setter( - #longMutex, - _longMutex, - ), - returnValueForMissingStub: null, - ); - @override - bool get refreshMutex => (super.noSuchMethod( - Invocation.getter(#refreshMutex), - returnValue: false, - ) as bool); - @override - set refreshMutex(bool? _refreshMutex) => super.noSuchMethod( - Invocation.setter( - #refreshMutex, - _refreshMutex, - ), - returnValueForMissingStub: null, - ); - @override - bool get isActive => (super.noSuchMethod( - Invocation.getter(#isActive), - returnValue: false, - ) as bool); - @override - set isActive(bool? _isActive) => super.noSuchMethod( - Invocation.setter( - #isActive, - _isActive, - ), - returnValueForMissingStub: null, - ); - @override - set isFavorite(bool? markFavorite) => super.noSuchMethod( - Invocation.setter( - #isFavorite, - markFavorite, - ), - returnValueForMissingStub: null, - ); - @override - bool get isFavorite => (super.noSuchMethod( - Invocation.getter(#isFavorite), - returnValue: false, - ) as bool); - @override - _i22.Coin get coin => (super.noSuchMethod( - Invocation.getter(#coin), - returnValue: _i22.Coin.bitcoin, - ) as _i22.Coin); - @override - _i23.Future> get utxos => (super.noSuchMethod( - Invocation.getter(#utxos), - returnValue: _i23.Future>.value(<_i18.UTXO>[]), - ) as _i23.Future>); - @override - _i23.Future> get transactions => (super.noSuchMethod( - Invocation.getter(#transactions), - returnValue: - _i23.Future>.value(<_i18.Transaction>[]), - ) as _i23.Future>); - @override - _i23.Future get currentReceivingAddress => (super.noSuchMethod( - Invocation.getter(#currentReceivingAddress), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - _i23.Future get currentChangeAddress => (super.noSuchMethod( - Invocation.getter(#currentChangeAddress), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - _i23.Future get currentChangeAddressP2PKH => (super.noSuchMethod( - Invocation.getter(#currentChangeAddressP2PKH), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - bool get hasCalledExit => (super.noSuchMethod( - Invocation.getter(#hasCalledExit), - returnValue: false, - ) as bool); - @override - _i23.Future<_i9.FeeObject> get fees => (super.noSuchMethod( - Invocation.getter(#fees), - returnValue: _i23.Future<_i9.FeeObject>.value(_FakeFeeObject_6( - this, - Invocation.getter(#fees), - )), - ) as _i23.Future<_i9.FeeObject>); - @override - _i23.Future get maxFee => (super.noSuchMethod( - Invocation.getter(#maxFee), - returnValue: _i23.Future.value(0), - ) as _i23.Future); - @override - _i23.Future> get mnemonic => (super.noSuchMethod( - Invocation.getter(#mnemonic), - returnValue: _i23.Future>.value([]), - ) as _i23.Future>); - @override - _i23.Future get mnemonicString => (super.noSuchMethod( - Invocation.getter(#mnemonicString), - returnValue: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future get mnemonicPassphrase => (super.noSuchMethod( - Invocation.getter(#mnemonicPassphrase), - returnValue: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future get chainHeight => (super.noSuchMethod( - Invocation.getter(#chainHeight), - returnValue: _i23.Future.value(0), - ) as _i23.Future); - @override - int get storedChainHeight => (super.noSuchMethod( - Invocation.getter(#storedChainHeight), - returnValue: 0, - ) as int); - @override - bool get shouldAutoSync => (super.noSuchMethod( - Invocation.getter(#shouldAutoSync), - returnValue: false, - ) as bool); - @override - set shouldAutoSync(bool? shouldAutoSync) => super.noSuchMethod( - Invocation.setter( - #shouldAutoSync, - shouldAutoSync, - ), - returnValueForMissingStub: null, - ); - @override - bool get isRefreshing => (super.noSuchMethod( - Invocation.getter(#isRefreshing), - returnValue: false, - ) as bool); - @override - bool get isConnected => (super.noSuchMethod( - Invocation.getter(#isConnected), - returnValue: false, - ) as bool); - @override - String get walletId => (super.noSuchMethod( - Invocation.getter(#walletId), - returnValue: '', - ) as String); - @override - String get walletName => (super.noSuchMethod( - Invocation.getter(#walletName), - returnValue: '', - ) as String); - @override - set walletName(String? newName) => super.noSuchMethod( - Invocation.setter( - #walletName, - newName, - ), - returnValueForMissingStub: null, - ); - @override - _i10.ElectrumX get electrumXClient => (super.noSuchMethod( - Invocation.getter(#electrumXClient), - returnValue: _FakeElectrumX_7( - this, - Invocation.getter(#electrumXClient), - ), - ) as _i10.ElectrumX); - @override - _i11.CachedElectrumX get cachedElectrumXClient => (super.noSuchMethod( - Invocation.getter(#cachedElectrumXClient), - returnValue: _FakeCachedElectrumX_8( - this, - Invocation.getter(#cachedElectrumXClient), - ), - ) as _i11.CachedElectrumX); - @override - _i12.Balance get balance => (super.noSuchMethod( - Invocation.getter(#balance), - returnValue: _FakeBalance_9( - this, - Invocation.getter(#balance), - ), - ) as _i12.Balance); - @override - _i23.Future get xpub => (super.noSuchMethod( - Invocation.getter(#xpub), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - set onIsActiveWalletChanged(void Function(bool)? _onIsActiveWalletChanged) => - super.noSuchMethod( - Invocation.setter( - #onIsActiveWalletChanged, - _onIsActiveWalletChanged, - ), - returnValueForMissingStub: null, - ); - @override - _i13.MainDB get db => (super.noSuchMethod( - Invocation.getter(#db), - returnValue: _FakeMainDB_10( - this, - Invocation.getter(#db), - ), - ) as _i13.MainDB); - @override - _i14.NetworkType get networkType => (super.noSuchMethod( - Invocation.getter(#networkType), - returnValue: _FakeNetworkType_11( - this, - Invocation.getter(#networkType), - ), - ) as _i14.NetworkType); - @override - _i23.Future exit() => (super.noSuchMethod( - Invocation.method( - #exit, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i28.DerivePathType addressType({required String? address}) => - (super.noSuchMethod( - Invocation.method( - #addressType, - [], - {#address: address}, - ), - returnValue: _i28.DerivePathType.bip44, - ) as _i28.DerivePathType); - @override - _i23.Future recoverFromMnemonic({ - required String? mnemonic, - String? mnemonicPassphrase, - required int? maxUnusedAddressGap, - required int? maxNumberOfIndexesToCheck, - required int? height, - }) => - (super.noSuchMethod( - Invocation.method( - #recoverFromMnemonic, - [], - { - #mnemonic: mnemonic, - #mnemonicPassphrase: mnemonicPassphrase, - #maxUnusedAddressGap: maxUnusedAddressGap, - #maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, - #height: height, - }, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future getTransactionCacheEarly(List? allAddresses) => - (super.noSuchMethod( - Invocation.method( - #getTransactionCacheEarly, - [allAddresses], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future refreshIfThereIsNewData() => (super.noSuchMethod( - Invocation.method( - #refreshIfThereIsNewData, - [], - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - _i23.Future getAllTxsToWatch() => (super.noSuchMethod( - Invocation.method( - #getAllTxsToWatch, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future refresh() => (super.noSuchMethod( - Invocation.method( - #refresh, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future> prepareSend({ - required String? address, - required _i15.Amount? amount, - Map? args, - }) => - (super.noSuchMethod( - Invocation.method( - #prepareSend, - [], - { - #address: address, - #amount: amount, - #args: args, - }, - ), - returnValue: - _i23.Future>.value({}), - ) as _i23.Future>); - @override - _i23.Future confirmSend({required Map? txData}) => - (super.noSuchMethod( - Invocation.method( - #confirmSend, - [], - {#txData: txData}, - ), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - _i23.Future testNetworkConnection() => (super.noSuchMethod( - Invocation.method( - #testNetworkConnection, - [], - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - void startNetworkAlivePinging() => super.noSuchMethod( - Invocation.method( - #startNetworkAlivePinging, - [], - ), - returnValueForMissingStub: null, - ); - @override - void stopNetworkAlivePinging() => super.noSuchMethod( - Invocation.method( - #stopNetworkAlivePinging, - [], - ), - returnValueForMissingStub: null, - ); - @override - _i23.Future initializeNew() => (super.noSuchMethod( - Invocation.method( - #initializeNew, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future initializeExisting() => (super.noSuchMethod( - Invocation.method( - #initializeExisting, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future updateSentCachedTxData(Map? txData) => - (super.noSuchMethod( - Invocation.method( - #updateSentCachedTxData, - [txData], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - bool validateAddress(String? address) => (super.noSuchMethod( - Invocation.method( - #validateAddress, - [address], - ), - returnValue: false, - ) as bool); - @override - _i23.Future updateNode(bool? shouldRefresh) => (super.noSuchMethod( - Invocation.method( - #updateNode, - [shouldRefresh], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future<_i10.ElectrumXNode> getCurrentNode() => (super.noSuchMethod( - Invocation.method( - #getCurrentNode, - [], - ), - returnValue: - _i23.Future<_i10.ElectrumXNode>.value(_FakeElectrumXNode_12( - this, - Invocation.method( - #getCurrentNode, - [], - ), - )), - ) as _i23.Future<_i10.ElectrumXNode>); - @override - _i23.Future>> fastFetch( - List? allTxHashes) => - (super.noSuchMethod( - Invocation.method( - #fastFetch, - [allTxHashes], - ), - returnValue: _i23.Future>>.value( - >[]), - ) as _i23.Future>>); - @override - _i23.Future getTxCount({required String? address}) => - (super.noSuchMethod( - Invocation.method( - #getTxCount, - [], - {#address: address}, - ), - returnValue: _i23.Future.value(0), - ) as _i23.Future); - @override - _i23.Future checkCurrentReceivingAddressesForTransactions() => - (super.noSuchMethod( - Invocation.method( - #checkCurrentReceivingAddressesForTransactions, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future checkCurrentChangeAddressesForTransactions() => - (super.noSuchMethod( - Invocation.method( - #checkCurrentChangeAddressesForTransactions, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - int estimateTxFee({ - required int? vSize, - required int? feeRatePerKB, - }) => - (super.noSuchMethod( - Invocation.method( - #estimateTxFee, - [], - { - #vSize: vSize, - #feeRatePerKB: feeRatePerKB, - }, - ), - returnValue: 0, - ) as int); - @override - dynamic coinSelection({ - required int? satoshiAmountToSend, - required int? selectedTxFeeRate, - required String? recipientAddress, - required bool? coinControl, - required bool? isSendAll, - int? additionalOutputs = 0, - List<_i18.UTXO>? utxos, - }) => - super.noSuchMethod(Invocation.method( - #coinSelection, - [], - { - #satoshiAmountToSend: satoshiAmountToSend, - #selectedTxFeeRate: selectedTxFeeRate, - #recipientAddress: recipientAddress, - #coinControl: coinControl, - #isSendAll: isSendAll, - #additionalOutputs: additionalOutputs, - #utxos: utxos, - }, - )); - @override - _i23.Future> fetchBuildTxData( - List<_i18.UTXO>? utxosToUse) => - (super.noSuchMethod( - Invocation.method( - #fetchBuildTxData, - [utxosToUse], - ), - returnValue: - _i23.Future>.value(<_i29.SigningData>[]), - ) as _i23.Future>); - @override - _i23.Future> buildTransaction({ - required List<_i29.SigningData>? utxoSigningData, - required List? recipients, - required List? satoshiAmounts, - }) => - (super.noSuchMethod( - Invocation.method( - #buildTransaction, - [], - { - #utxoSigningData: utxoSigningData, - #recipients: recipients, - #satoshiAmounts: satoshiAmounts, - }, - ), - returnValue: - _i23.Future>.value({}), - ) as _i23.Future>); - @override - _i23.Future fullRescan( - int? maxUnusedAddressGap, - int? maxNumberOfIndexesToCheck, - ) => - (super.noSuchMethod( - Invocation.method( - #fullRescan, - [ - maxUnusedAddressGap, - maxNumberOfIndexesToCheck, - ], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future<_i15.Amount> estimateFeeFor( - _i15.Amount? amount, - int? feeRate, - ) => - (super.noSuchMethod( - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - returnValue: _i23.Future<_i15.Amount>.value(_FakeAmount_13( - this, - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - )), - ) as _i23.Future<_i15.Amount>); - @override - _i15.Amount roughFeeEstimate( - int? inputCount, - int? outputCount, - int? feeRatePerKB, - ) => - (super.noSuchMethod( - Invocation.method( - #roughFeeEstimate, - [ - inputCount, - outputCount, - feeRatePerKB, - ], - ), - returnValue: _FakeAmount_13( - this, - Invocation.method( - #roughFeeEstimate, - [ - inputCount, - outputCount, - feeRatePerKB, - ], - ), - ), - ) as _i15.Amount); - @override - _i23.Future<_i15.Amount> sweepAllEstimate(int? feeRate) => - (super.noSuchMethod( - Invocation.method( - #sweepAllEstimate, - [feeRate], - ), - returnValue: _i23.Future<_i15.Amount>.value(_FakeAmount_13( - this, - Invocation.method( - #sweepAllEstimate, - [feeRate], - ), - )), - ) as _i23.Future<_i15.Amount>); - @override - _i23.Future generateNewAddress() => (super.noSuchMethod( - Invocation.method( - #generateNewAddress, - [], - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - void initCache( - String? walletId, - _i22.Coin? coin, - ) => - super.noSuchMethod( - Invocation.method( - #initCache, - [ - walletId, - coin, - ], - ), - returnValueForMissingStub: null, - ); - @override - _i23.Future updateCachedId(String? id) => (super.noSuchMethod( - Invocation.method( - #updateCachedId, - [id], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - int getCachedChainHeight() => (super.noSuchMethod( - Invocation.method( - #getCachedChainHeight, - [], - ), - returnValue: 0, - ) as int); - @override - _i23.Future updateCachedChainHeight(int? height) => (super.noSuchMethod( - Invocation.method( - #updateCachedChainHeight, - [height], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - bool getCachedIsFavorite() => (super.noSuchMethod( - Invocation.method( - #getCachedIsFavorite, - [], - ), - returnValue: false, - ) as bool); - @override - _i23.Future updateCachedIsFavorite(bool? isFavorite) => - (super.noSuchMethod( - Invocation.method( - #updateCachedIsFavorite, - [isFavorite], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i12.Balance getCachedBalance() => (super.noSuchMethod( - Invocation.method( - #getCachedBalance, - [], - ), - returnValue: _FakeBalance_9( - this, - Invocation.method( - #getCachedBalance, - [], - ), - ), - ) as _i12.Balance); - @override - _i23.Future updateCachedBalance(_i12.Balance? balance) => - (super.noSuchMethod( - Invocation.method( - #updateCachedBalance, - [balance], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i12.Balance getCachedBalanceSecondary() => (super.noSuchMethod( - Invocation.method( - #getCachedBalanceSecondary, - [], - ), - returnValue: _FakeBalance_9( - this, - Invocation.method( - #getCachedBalanceSecondary, - [], - ), - ), - ) as _i12.Balance); - @override - _i23.Future updateCachedBalanceSecondary(_i12.Balance? balance) => - (super.noSuchMethod( - Invocation.method( - #updateCachedBalanceSecondary, - [balance], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - void initWalletDB({_i13.MainDB? mockableOverride}) => super.noSuchMethod( - Invocation.method( - #initWalletDB, - [], - {#mockableOverride: mockableOverride}, - ), - returnValueForMissingStub: null, - ); - @override - _i23.Future<_i16.Tuple2<_i18.Transaction, _i18.Address>> parseTransaction( - Map? txData, - dynamic electrumxClient, - List<_i18.Address>? myAddresses, - _i22.Coin? coin, - int? minConfirms, - String? walletId, - ) => - (super.noSuchMethod( - Invocation.method( - #parseTransaction, - [ - txData, - electrumxClient, - myAddresses, - coin, - minConfirms, - walletId, - ], - ), - returnValue: - _i23.Future<_i16.Tuple2<_i18.Transaction, _i18.Address>>.value( - _FakeTuple2_14<_i18.Transaction, _i18.Address>( - this, - Invocation.method( - #parseTransaction, - [ - txData, - electrumxClient, - myAddresses, - coin, - minConfirms, - walletId, - ], - ), - )), - ) as _i23.Future<_i16.Tuple2<_i18.Transaction, _i18.Address>>); - @override - void initPaynymWalletInterface({ - required String? walletId, - required String? walletName, - required _i14.NetworkType? network, - required _i22.Coin? coin, - required _i13.MainDB? db, - required _i10.ElectrumX? electrumXClient, - required _i7.SecureStorageInterface? secureStorage, - required int? dustLimit, - required int? dustLimitP2PKH, - required int? minConfirms, - required _i23.Future Function()? getMnemonicString, - required _i23.Future Function()? getMnemonicPassphrase, - required _i23.Future Function()? getChainHeight, - required _i23.Future Function()? getCurrentChangeAddress, - required int Function({ - required int feeRatePerKB, - required int vSize, - })? - estimateTxFee, - required _i23.Future> Function({ - required String address, - required _i15.Amount amount, - Map? args, - })? - prepareSend, - required _i23.Future Function({required String address})? getTxCount, - required _i23.Future> Function(List<_i18.UTXO>)? - fetchBuildTxData, - required _i23.Future Function()? refresh, - required _i23.Future Function()? checkChangeAddressForTransactions, - }) => - super.noSuchMethod( - Invocation.method( - #initPaynymWalletInterface, - [], - { - #walletId: walletId, - #walletName: walletName, - #network: network, - #coin: coin, - #db: db, - #electrumXClient: electrumXClient, - #secureStorage: secureStorage, - #dustLimit: dustLimit, - #dustLimitP2PKH: dustLimitP2PKH, - #minConfirms: minConfirms, - #getMnemonicString: getMnemonicString, - #getMnemonicPassphrase: getMnemonicPassphrase, - #getChainHeight: getChainHeight, - #getCurrentChangeAddress: getCurrentChangeAddress, - #estimateTxFee: estimateTxFee, - #prepareSend: prepareSend, - #getTxCount: getTxCount, - #fetchBuildTxData: fetchBuildTxData, - #refresh: refresh, - #checkChangeAddressForTransactions: - checkChangeAddressForTransactions, - }, - ), - returnValueForMissingStub: null, - ); - @override - _i23.Future<_i17.BIP32> getBip47BaseNode() => (super.noSuchMethod( - Invocation.method( - #getBip47BaseNode, - [], - ), - returnValue: _i23.Future<_i17.BIP32>.value(_FakeBIP32_15( - this, - Invocation.method( - #getBip47BaseNode, - [], - ), - )), - ) as _i23.Future<_i17.BIP32>); - @override - _i23.Future<_i30.Uint8List> getPrivateKeyForPaynymReceivingAddress({ - required String? paymentCodeString, - required int? index, - }) => - (super.noSuchMethod( - Invocation.method( - #getPrivateKeyForPaynymReceivingAddress, - [], - { - #paymentCodeString: paymentCodeString, - #index: index, - }, - ), - returnValue: _i23.Future<_i30.Uint8List>.value(_i30.Uint8List(0)), - ) as _i23.Future<_i30.Uint8List>); - @override - _i23.Future<_i18.Address> currentReceivingPaynymAddress({ - required _i19.PaymentCode? sender, - required bool? isSegwit, - }) => - (super.noSuchMethod( - Invocation.method( - #currentReceivingPaynymAddress, - [], - { - #sender: sender, - #isSegwit: isSegwit, - }, - ), - returnValue: _i23.Future<_i18.Address>.value(_FakeAddress_16( - this, - Invocation.method( - #currentReceivingPaynymAddress, - [], - { - #sender: sender, - #isSegwit: isSegwit, - }, - ), - )), - ) as _i23.Future<_i18.Address>); - @override - _i23.Future checkCurrentPaynymReceivingAddressForTransactions({ - required _i19.PaymentCode? sender, - required bool? isSegwit, - }) => - (super.noSuchMethod( - Invocation.method( - #checkCurrentPaynymReceivingAddressForTransactions, - [], - { - #sender: sender, - #isSegwit: isSegwit, - }, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future checkAllCurrentReceivingPaynymAddressesForTransactions() => - (super.noSuchMethod( - Invocation.method( - #checkAllCurrentReceivingPaynymAddressesForTransactions, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future<_i17.BIP32> deriveNotificationBip32Node() => (super.noSuchMethod( - Invocation.method( - #deriveNotificationBip32Node, - [], - ), - returnValue: _i23.Future<_i17.BIP32>.value(_FakeBIP32_15( - this, - Invocation.method( - #deriveNotificationBip32Node, - [], - ), - )), - ) as _i23.Future<_i17.BIP32>); - @override - _i23.Future<_i19.PaymentCode> getPaymentCode({required bool? isSegwit}) => - (super.noSuchMethod( - Invocation.method( - #getPaymentCode, - [], - {#isSegwit: isSegwit}, - ), - returnValue: _i23.Future<_i19.PaymentCode>.value(_FakePaymentCode_17( - this, - Invocation.method( - #getPaymentCode, - [], - {#isSegwit: isSegwit}, - ), - )), - ) as _i23.Future<_i19.PaymentCode>); - @override - _i23.Future<_i30.Uint8List> signWithNotificationKey(_i30.Uint8List? data) => - (super.noSuchMethod( - Invocation.method( - #signWithNotificationKey, - [data], - ), - returnValue: _i23.Future<_i30.Uint8List>.value(_i30.Uint8List(0)), - ) as _i23.Future<_i30.Uint8List>); - @override - _i23.Future signStringWithNotificationKey(String? data) => - (super.noSuchMethod( - Invocation.method( - #signStringWithNotificationKey, - [data], - ), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - _i23.Future> preparePaymentCodeSend({ - required _i19.PaymentCode? paymentCode, - required bool? isSegwit, - required _i15.Amount? amount, - Map? args, - }) => - (super.noSuchMethod( - Invocation.method( - #preparePaymentCodeSend, - [], - { - #paymentCode: paymentCode, - #isSegwit: isSegwit, - #amount: amount, - #args: args, - }, - ), - returnValue: - _i23.Future>.value({}), - ) as _i23.Future>); - @override - _i23.Future<_i18.Address> nextUnusedSendAddressFrom({ - required _i19.PaymentCode? pCode, - required bool? isSegwit, - required _i17.BIP32? privateKeyNode, - int? startIndex = 0, - }) => - (super.noSuchMethod( - Invocation.method( - #nextUnusedSendAddressFrom, - [], - { - #pCode: pCode, - #isSegwit: isSegwit, - #privateKeyNode: privateKeyNode, - #startIndex: startIndex, - }, - ), - returnValue: _i23.Future<_i18.Address>.value(_FakeAddress_16( - this, - Invocation.method( - #nextUnusedSendAddressFrom, - [], - { - #pCode: pCode, - #isSegwit: isSegwit, - #privateKeyNode: privateKeyNode, - #startIndex: startIndex, - }, - ), - )), - ) as _i23.Future<_i18.Address>); - @override - _i23.Future> prepareNotificationTx({ - required int? selectedTxFeeRate, - required String? targetPaymentCodeString, - int? additionalOutputs = 0, - List<_i18.UTXO>? utxos, - }) => - (super.noSuchMethod( - Invocation.method( - #prepareNotificationTx, - [], - { - #selectedTxFeeRate: selectedTxFeeRate, - #targetPaymentCodeString: targetPaymentCodeString, - #additionalOutputs: additionalOutputs, - #utxos: utxos, - }, - ), - returnValue: - _i23.Future>.value({}), - ) as _i23.Future>); - @override - _i23.Future broadcastNotificationTx( - {required Map? preparedTx}) => - (super.noSuchMethod( - Invocation.method( - #broadcastNotificationTx, - [], - {#preparedTx: preparedTx}, - ), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - _i23.Future hasConnected(String? paymentCodeString) => - (super.noSuchMethod( - Invocation.method( - #hasConnected, - [paymentCodeString], - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - _i23.Future<_i19.PaymentCode?> unBlindedPaymentCodeFromTransaction( - {required _i18.Transaction? transaction}) => - (super.noSuchMethod( - Invocation.method( - #unBlindedPaymentCodeFromTransaction, - [], - {#transaction: transaction}, - ), - returnValue: _i23.Future<_i19.PaymentCode?>.value(), - ) as _i23.Future<_i19.PaymentCode?>); - @override - _i23.Future<_i19.PaymentCode?> unBlindedPaymentCodeFromTransactionBad( - {required _i18.Transaction? transaction}) => - (super.noSuchMethod( - Invocation.method( - #unBlindedPaymentCodeFromTransactionBad, - [], - {#transaction: transaction}, - ), - returnValue: _i23.Future<_i19.PaymentCode?>.value(), - ) as _i23.Future<_i19.PaymentCode?>); - @override - _i23.Future> - getAllPaymentCodesFromNotificationTransactions() => (super.noSuchMethod( - Invocation.method( - #getAllPaymentCodesFromNotificationTransactions, - [], - ), - returnValue: - _i23.Future>.value(<_i19.PaymentCode>[]), - ) as _i23.Future>); - @override - _i23.Future checkForNotificationTransactionsTo( - Set? otherCodeStrings) => - (super.noSuchMethod( - Invocation.method( - #checkForNotificationTransactionsTo, - [otherCodeStrings], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future restoreAllHistory({ - required int? maxUnusedAddressGap, - required int? maxNumberOfIndexesToCheck, - required Set? paymentCodeStrings, - }) => - (super.noSuchMethod( - Invocation.method( - #restoreAllHistory, - [], - { - #maxUnusedAddressGap: maxUnusedAddressGap, - #maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, - #paymentCodeStrings: paymentCodeStrings, - }, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future restoreHistoryWith({ - required _i19.PaymentCode? other, - required bool? checkSegwitAsWell, - required int? maxUnusedAddressGap, - required int? maxNumberOfIndexesToCheck, - }) => - (super.noSuchMethod( - Invocation.method( - #restoreHistoryWith, - [], - { - #other: other, - #checkSegwitAsWell: checkSegwitAsWell, - #maxUnusedAddressGap: maxUnusedAddressGap, - #maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, - }, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future<_i18.Address> getMyNotificationAddress() => (super.noSuchMethod( - Invocation.method( - #getMyNotificationAddress, - [], - ), - returnValue: _i23.Future<_i18.Address>.value(_FakeAddress_16( - this, - Invocation.method( - #getMyNotificationAddress, - [], - ), - )), - ) as _i23.Future<_i18.Address>); - @override - _i23.Future> lookupKey(String? paymentCodeString) => - (super.noSuchMethod( - Invocation.method( - #lookupKey, - [paymentCodeString], - ), - returnValue: _i23.Future>.value([]), - ) as _i23.Future>); - @override - _i23.Future paymentCodeStringByKey(String? key) => - (super.noSuchMethod( - Invocation.method( - #paymentCodeStringByKey, - [key], - ), - returnValue: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future storeCode(String? paymentCodeString) => - (super.noSuchMethod( - Invocation.method( - #storeCode, - [paymentCodeString], - ), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - void initCoinControlInterface({ - required String? walletId, - required String? walletName, - required _i22.Coin? coin, - required _i13.MainDB? db, - required _i23.Future Function()? getChainHeight, - required _i23.Future Function(_i12.Balance)? refreshedBalanceCallback, - }) => - super.noSuchMethod( - Invocation.method( - #initCoinControlInterface, - [], - { - #walletId: walletId, - #walletName: walletName, - #coin: coin, - #db: db, - #getChainHeight: getChainHeight, - #refreshedBalanceCallback: refreshedBalanceCallback, - }, - ), - returnValueForMissingStub: null, - ); - @override - _i23.Future refreshBalance({bool? notify = false}) => - (super.noSuchMethod( - Invocation.method( - #refreshBalance, - [], - {#notify: notify}, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); -} - -/// A class which mocks [LocaleService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockLocaleService extends _i1.Mock implements _i31.LocaleService { - MockLocaleService() { - _i1.throwOnMissingStub(this); - } - - @override - String get locale => (super.noSuchMethod( - Invocation.getter(#locale), - returnValue: '', - ) as String); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - _i23.Future loadLocale({bool? notify = true}) => (super.noSuchMethod( - Invocation.method( - #loadLocale, - [], - {#notify: notify}, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [Prefs]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockPrefs extends _i1.Mock implements _i24.Prefs { - MockPrefs() { - _i1.throwOnMissingStub(this); - } - - @override - bool get isInitialized => (super.noSuchMethod( - Invocation.getter(#isInitialized), - returnValue: false, - ) as bool); - @override - int get lastUnlockedTimeout => (super.noSuchMethod( - Invocation.getter(#lastUnlockedTimeout), - returnValue: 0, - ) as int); - @override - set lastUnlockedTimeout(int? lastUnlockedTimeout) => super.noSuchMethod( - Invocation.setter( - #lastUnlockedTimeout, - lastUnlockedTimeout, - ), - returnValueForMissingStub: null, - ); - @override - int get lastUnlocked => (super.noSuchMethod( - Invocation.getter(#lastUnlocked), - returnValue: 0, - ) as int); - @override - set lastUnlocked(int? lastUnlocked) => super.noSuchMethod( - Invocation.setter( - #lastUnlocked, - lastUnlocked, - ), - returnValueForMissingStub: null, - ); - @override - int get currentNotificationId => (super.noSuchMethod( - Invocation.getter(#currentNotificationId), - returnValue: 0, - ) as int); - @override - List get walletIdsSyncOnStartup => (super.noSuchMethod( - Invocation.getter(#walletIdsSyncOnStartup), - returnValue: [], - ) as List); - @override - set walletIdsSyncOnStartup(List? walletIdsSyncOnStartup) => - super.noSuchMethod( - Invocation.setter( - #walletIdsSyncOnStartup, - walletIdsSyncOnStartup, - ), - returnValueForMissingStub: null, - ); - @override - _i32.SyncingType get syncType => (super.noSuchMethod( - Invocation.getter(#syncType), - returnValue: _i32.SyncingType.currentWalletOnly, - ) as _i32.SyncingType); - @override - set syncType(_i32.SyncingType? syncType) => super.noSuchMethod( - Invocation.setter( - #syncType, - syncType, - ), - returnValueForMissingStub: null, - ); - @override - bool get wifiOnly => (super.noSuchMethod( - Invocation.getter(#wifiOnly), - returnValue: false, - ) as bool); - @override - set wifiOnly(bool? wifiOnly) => super.noSuchMethod( - Invocation.setter( - #wifiOnly, - wifiOnly, - ), - returnValueForMissingStub: null, - ); - @override - bool get showFavoriteWallets => (super.noSuchMethod( - Invocation.getter(#showFavoriteWallets), - returnValue: false, - ) as bool); - @override - set showFavoriteWallets(bool? showFavoriteWallets) => super.noSuchMethod( - Invocation.setter( - #showFavoriteWallets, - showFavoriteWallets, - ), - returnValueForMissingStub: null, - ); - @override - String get language => (super.noSuchMethod( - Invocation.getter(#language), - returnValue: '', - ) as String); - @override - set language(String? newLanguage) => super.noSuchMethod( - Invocation.setter( - #language, - newLanguage, - ), - returnValueForMissingStub: null, - ); - @override - String get currency => (super.noSuchMethod( - Invocation.getter(#currency), - returnValue: '', - ) as String); - @override - set currency(String? newCurrency) => super.noSuchMethod( - Invocation.setter( - #currency, - newCurrency, - ), - returnValueForMissingStub: null, - ); - @override - bool get randomizePIN => (super.noSuchMethod( - Invocation.getter(#randomizePIN), - returnValue: false, - ) as bool); - @override - set randomizePIN(bool? randomizePIN) => super.noSuchMethod( - Invocation.setter( - #randomizePIN, - randomizePIN, - ), - returnValueForMissingStub: null, - ); - @override - bool get useBiometrics => (super.noSuchMethod( - Invocation.getter(#useBiometrics), - returnValue: false, - ) as bool); - @override - set useBiometrics(bool? useBiometrics) => super.noSuchMethod( - Invocation.setter( - #useBiometrics, - useBiometrics, - ), - returnValueForMissingStub: null, - ); - @override - bool get hasPin => (super.noSuchMethod( - Invocation.getter(#hasPin), - returnValue: false, - ) as bool); - @override - set hasPin(bool? hasPin) => super.noSuchMethod( - Invocation.setter( - #hasPin, - hasPin, - ), - returnValueForMissingStub: null, - ); - @override - int get familiarity => (super.noSuchMethod( - Invocation.getter(#familiarity), - returnValue: 0, - ) as int); - @override - set familiarity(int? familiarity) => super.noSuchMethod( - Invocation.setter( - #familiarity, - familiarity, - ), - returnValueForMissingStub: null, - ); - @override - bool get showTestNetCoins => (super.noSuchMethod( - Invocation.getter(#showTestNetCoins), - returnValue: false, - ) as bool); - @override - set showTestNetCoins(bool? showTestNetCoins) => super.noSuchMethod( - Invocation.setter( - #showTestNetCoins, - showTestNetCoins, - ), - returnValueForMissingStub: null, - ); - @override - bool get isAutoBackupEnabled => (super.noSuchMethod( - Invocation.getter(#isAutoBackupEnabled), - returnValue: false, - ) as bool); - @override - set isAutoBackupEnabled(bool? isAutoBackupEnabled) => super.noSuchMethod( - Invocation.setter( - #isAutoBackupEnabled, - isAutoBackupEnabled, - ), - returnValueForMissingStub: null, - ); - @override - set autoBackupLocation(String? autoBackupLocation) => super.noSuchMethod( - Invocation.setter( - #autoBackupLocation, - autoBackupLocation, - ), - returnValueForMissingStub: null, - ); - @override - _i33.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( - Invocation.getter(#backupFrequencyType), - returnValue: _i33.BackupFrequencyType.everyTenMinutes, - ) as _i33.BackupFrequencyType); - @override - set backupFrequencyType(_i33.BackupFrequencyType? backupFrequencyType) => - super.noSuchMethod( - Invocation.setter( - #backupFrequencyType, - backupFrequencyType, - ), - returnValueForMissingStub: null, - ); - @override - set lastAutoBackup(DateTime? lastAutoBackup) => super.noSuchMethod( - Invocation.setter( - #lastAutoBackup, - lastAutoBackup, - ), - returnValueForMissingStub: null, - ); - @override - bool get hideBlockExplorerWarning => (super.noSuchMethod( - Invocation.getter(#hideBlockExplorerWarning), - returnValue: false, - ) as bool); - @override - set hideBlockExplorerWarning(bool? hideBlockExplorerWarning) => - super.noSuchMethod( - Invocation.setter( - #hideBlockExplorerWarning, - hideBlockExplorerWarning, - ), - returnValueForMissingStub: null, - ); - @override - bool get gotoWalletOnStartup => (super.noSuchMethod( - Invocation.getter(#gotoWalletOnStartup), - returnValue: false, - ) as bool); - @override - set gotoWalletOnStartup(bool? gotoWalletOnStartup) => super.noSuchMethod( - Invocation.setter( - #gotoWalletOnStartup, - gotoWalletOnStartup, - ), - returnValueForMissingStub: null, - ); - @override - set startupWalletId(String? startupWalletId) => super.noSuchMethod( - Invocation.setter( - #startupWalletId, - startupWalletId, - ), - returnValueForMissingStub: null, - ); - @override - bool get externalCalls => (super.noSuchMethod( - Invocation.getter(#externalCalls), - returnValue: false, - ) as bool); - @override - set externalCalls(bool? externalCalls) => super.noSuchMethod( - Invocation.setter( - #externalCalls, - externalCalls, - ), - returnValueForMissingStub: null, - ); - @override - bool get enableCoinControl => (super.noSuchMethod( - Invocation.getter(#enableCoinControl), - returnValue: false, - ) as bool); - @override - set enableCoinControl(bool? enableCoinControl) => super.noSuchMethod( - Invocation.setter( - #enableCoinControl, - enableCoinControl, - ), - returnValueForMissingStub: null, - ); - @override - bool get enableSystemBrightness => (super.noSuchMethod( - Invocation.getter(#enableSystemBrightness), - returnValue: false, - ) as bool); - @override - set enableSystemBrightness(bool? enableSystemBrightness) => - super.noSuchMethod( - Invocation.setter( - #enableSystemBrightness, - enableSystemBrightness, - ), - returnValueForMissingStub: null, - ); - @override - String get themeId => (super.noSuchMethod( - Invocation.getter(#themeId), - returnValue: '', - ) as String); - @override - set themeId(String? themeId) => super.noSuchMethod( - Invocation.setter( - #themeId, - themeId, - ), - returnValueForMissingStub: null, - ); - @override - String get systemBrightnessLightThemeId => (super.noSuchMethod( - Invocation.getter(#systemBrightnessLightThemeId), - returnValue: '', - ) as String); - @override - set systemBrightnessLightThemeId(String? systemBrightnessLightThemeId) => - super.noSuchMethod( - Invocation.setter( - #systemBrightnessLightThemeId, - systemBrightnessLightThemeId, - ), - returnValueForMissingStub: null, - ); - @override - String get systemBrightnessDarkThemeId => (super.noSuchMethod( - Invocation.getter(#systemBrightnessDarkThemeId), - returnValue: '', - ) as String); - @override - set systemBrightnessDarkThemeId(String? systemBrightnessDarkThemeId) => - super.noSuchMethod( - Invocation.setter( - #systemBrightnessDarkThemeId, - systemBrightnessDarkThemeId, - ), - returnValueForMissingStub: null, - ); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - _i23.Future init() => (super.noSuchMethod( - Invocation.method( - #init, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future incrementCurrentNotificationIndex() => (super.noSuchMethod( - Invocation.method( - #incrementCurrentNotificationIndex, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future isExternalCallsSet() => (super.noSuchMethod( - Invocation.method( - #isExternalCallsSet, - [], - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - _i23.Future saveUserID(String? userId) => (super.noSuchMethod( - Invocation.method( - #saveUserID, - [userId], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future saveSignupEpoch(int? signupEpoch) => (super.noSuchMethod( - Invocation.method( - #saveSignupEpoch, - [signupEpoch], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [Manager]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i6.Manager { - @override - bool get isActiveWallet => (super.noSuchMethod( - Invocation.getter(#isActiveWallet), - returnValue: false, - ) as bool); - @override - set isActiveWallet(bool? isActive) => super.noSuchMethod( - Invocation.setter( - #isActiveWallet, - isActive, - ), - returnValueForMissingStub: null, - ); - @override - _i20.CoinServiceAPI get wallet => (super.noSuchMethod( - Invocation.getter(#wallet), - returnValue: _FakeCoinServiceAPI_18( - this, - Invocation.getter(#wallet), - ), - ) as _i20.CoinServiceAPI); - @override - bool get hasBackgroundRefreshListener => (super.noSuchMethod( - Invocation.getter(#hasBackgroundRefreshListener), - returnValue: false, - ) as bool); - @override - _i22.Coin get coin => (super.noSuchMethod( - Invocation.getter(#coin), - returnValue: _i22.Coin.bitcoin, - ) as _i22.Coin); - @override - bool get isRefreshing => (super.noSuchMethod( - Invocation.getter(#isRefreshing), - returnValue: false, - ) as bool); - @override - bool get shouldAutoSync => (super.noSuchMethod( - Invocation.getter(#shouldAutoSync), - returnValue: false, - ) as bool); - @override - set shouldAutoSync(bool? shouldAutoSync) => super.noSuchMethod( - Invocation.setter( - #shouldAutoSync, - shouldAutoSync, - ), - returnValueForMissingStub: null, - ); - @override - bool get isFavorite => (super.noSuchMethod( - Invocation.getter(#isFavorite), - returnValue: false, - ) as bool); - @override - set isFavorite(bool? markFavorite) => super.noSuchMethod( - Invocation.setter( - #isFavorite, - markFavorite, - ), - returnValueForMissingStub: null, - ); - @override - _i23.Future<_i9.FeeObject> get fees => (super.noSuchMethod( - Invocation.getter(#fees), - returnValue: _i23.Future<_i9.FeeObject>.value(_FakeFeeObject_6( - this, - Invocation.getter(#fees), - )), - ) as _i23.Future<_i9.FeeObject>); - @override - _i23.Future get maxFee => (super.noSuchMethod( - Invocation.getter(#maxFee), - returnValue: _i23.Future.value(0), - ) as _i23.Future); - @override - _i23.Future get currentReceivingAddress => (super.noSuchMethod( - Invocation.getter(#currentReceivingAddress), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - _i12.Balance get balance => (super.noSuchMethod( - Invocation.getter(#balance), - returnValue: _FakeBalance_9( - this, - Invocation.getter(#balance), - ), - ) as _i12.Balance); - @override - _i23.Future> get transactions => (super.noSuchMethod( - Invocation.getter(#transactions), - returnValue: - _i23.Future>.value(<_i18.Transaction>[]), - ) as _i23.Future>); - @override - _i23.Future> get utxos => (super.noSuchMethod( - Invocation.getter(#utxos), - returnValue: _i23.Future>.value(<_i18.UTXO>[]), - ) as _i23.Future>); - @override - set walletName(String? newName) => super.noSuchMethod( - Invocation.setter( - #walletName, - newName, - ), - returnValueForMissingStub: null, - ); - @override - String get walletName => (super.noSuchMethod( - Invocation.getter(#walletName), - returnValue: '', - ) as String); - @override - String get walletId => (super.noSuchMethod( - Invocation.getter(#walletId), - returnValue: '', - ) as String); - @override - _i23.Future> get mnemonic => (super.noSuchMethod( - Invocation.getter(#mnemonic), - returnValue: _i23.Future>.value([]), - ) as _i23.Future>); - @override - _i23.Future get mnemonicPassphrase => (super.noSuchMethod( - Invocation.getter(#mnemonicPassphrase), - returnValue: _i23.Future.value(), - ) as _i23.Future); - @override - bool get isConnected => (super.noSuchMethod( - Invocation.getter(#isConnected), - returnValue: false, - ) as bool); - @override - int get currentHeight => (super.noSuchMethod( - Invocation.getter(#currentHeight), - returnValue: 0, - ) as int); - @override - bool get hasPaynymSupport => (super.noSuchMethod( - Invocation.getter(#hasPaynymSupport), - returnValue: false, - ) as bool); - @override - bool get hasCoinControlSupport => (super.noSuchMethod( - Invocation.getter(#hasCoinControlSupport), - returnValue: false, - ) as bool); - @override - bool get hasWhirlpoolSupport => (super.noSuchMethod( - Invocation.getter(#hasWhirlpoolSupport), - returnValue: false, - ) as bool); - @override - int get rescanOnOpenVersion => (super.noSuchMethod( - Invocation.getter(#rescanOnOpenVersion), - returnValue: 0, - ) as int); - @override - bool get hasXPub => (super.noSuchMethod( - Invocation.getter(#hasXPub), - returnValue: false, - ) as bool); - @override - _i23.Future get xpub => (super.noSuchMethod( - Invocation.getter(#xpub), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - _i23.Future updateNode(bool? shouldRefresh) => (super.noSuchMethod( - Invocation.method( - #updateNode, - [shouldRefresh], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - _i23.Future> prepareSend({ - required String? address, - required _i15.Amount? amount, - Map? args, - }) => - (super.noSuchMethod( - Invocation.method( - #prepareSend, - [], - { - #address: address, - #amount: amount, - #args: args, - }, - ), - returnValue: - _i23.Future>.value({}), - ) as _i23.Future>); - @override - _i23.Future confirmSend({required Map? txData}) => - (super.noSuchMethod( - Invocation.method( - #confirmSend, - [], - {#txData: txData}, - ), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - _i23.Future refresh() => (super.noSuchMethod( - Invocation.method( - #refresh, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - bool validateAddress(String? address) => (super.noSuchMethod( - Invocation.method( - #validateAddress, - [address], - ), - returnValue: false, - ) as bool); - @override - _i23.Future testNetworkConnection() => (super.noSuchMethod( - Invocation.method( - #testNetworkConnection, - [], - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - _i23.Future initializeNew() => (super.noSuchMethod( - Invocation.method( - #initializeNew, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future initializeExisting() => (super.noSuchMethod( - Invocation.method( - #initializeExisting, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future recoverFromMnemonic({ - required String? mnemonic, - String? mnemonicPassphrase, - required int? maxUnusedAddressGap, - required int? maxNumberOfIndexesToCheck, - required int? height, - }) => - (super.noSuchMethod( - Invocation.method( - #recoverFromMnemonic, - [], - { - #mnemonic: mnemonic, - #mnemonicPassphrase: mnemonicPassphrase, - #maxUnusedAddressGap: maxUnusedAddressGap, - #maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, - #height: height, - }, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future exitCurrentWallet() => (super.noSuchMethod( - Invocation.method( - #exitCurrentWallet, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future fullRescan( - int? maxUnusedAddressGap, - int? maxNumberOfIndexesToCheck, - ) => - (super.noSuchMethod( - Invocation.method( - #fullRescan, - [ - maxUnusedAddressGap, - maxNumberOfIndexesToCheck, - ], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future<_i15.Amount> estimateFeeFor( - _i15.Amount? amount, - int? feeRate, - ) => - (super.noSuchMethod( - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - returnValue: _i23.Future<_i15.Amount>.value(_FakeAmount_13( - this, - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - )), - ) as _i23.Future<_i15.Amount>); - @override - _i23.Future generateNewAddress() => (super.noSuchMethod( - Invocation.method( - #generateNewAddress, - [], - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - _i23.Future resetRescanOnOpen() => (super.noSuchMethod( - Invocation.method( - #resetRescanOnOpen, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [CoinServiceAPI]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockCoinServiceAPI extends _i1.Mock implements _i20.CoinServiceAPI { - @override - set onIsActiveWalletChanged(void Function(bool)? _onIsActiveWalletChanged) => - super.noSuchMethod( - Invocation.setter( - #onIsActiveWalletChanged, - _onIsActiveWalletChanged, - ), - returnValueForMissingStub: null, - ); - @override - _i22.Coin get coin => (super.noSuchMethod( - Invocation.getter(#coin), - returnValue: _i22.Coin.bitcoin, - ) as _i22.Coin); - @override - bool get isRefreshing => (super.noSuchMethod( - Invocation.getter(#isRefreshing), - returnValue: false, - ) as bool); - @override - bool get shouldAutoSync => (super.noSuchMethod( - Invocation.getter(#shouldAutoSync), - returnValue: false, - ) as bool); - @override - set shouldAutoSync(bool? shouldAutoSync) => super.noSuchMethod( - Invocation.setter( - #shouldAutoSync, - shouldAutoSync, - ), - returnValueForMissingStub: null, - ); - @override - bool get isFavorite => (super.noSuchMethod( - Invocation.getter(#isFavorite), - returnValue: false, - ) as bool); - @override - set isFavorite(bool? markFavorite) => super.noSuchMethod( - Invocation.setter( - #isFavorite, - markFavorite, - ), - returnValueForMissingStub: null, - ); - @override - _i23.Future<_i9.FeeObject> get fees => (super.noSuchMethod( - Invocation.getter(#fees), - returnValue: _i23.Future<_i9.FeeObject>.value(_FakeFeeObject_6( - this, - Invocation.getter(#fees), - )), - ) as _i23.Future<_i9.FeeObject>); - @override - _i23.Future get maxFee => (super.noSuchMethod( - Invocation.getter(#maxFee), - returnValue: _i23.Future.value(0), - ) as _i23.Future); - @override - _i23.Future get currentReceivingAddress => (super.noSuchMethod( - Invocation.getter(#currentReceivingAddress), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - _i12.Balance get balance => (super.noSuchMethod( - Invocation.getter(#balance), - returnValue: _FakeBalance_9( - this, - Invocation.getter(#balance), - ), - ) as _i12.Balance); - @override - _i23.Future> get transactions => (super.noSuchMethod( - Invocation.getter(#transactions), - returnValue: - _i23.Future>.value(<_i18.Transaction>[]), - ) as _i23.Future>); - @override - _i23.Future> get utxos => (super.noSuchMethod( - Invocation.getter(#utxos), - returnValue: _i23.Future>.value(<_i18.UTXO>[]), - ) as _i23.Future>); - @override - set walletName(String? newName) => super.noSuchMethod( - Invocation.setter( - #walletName, - newName, - ), - returnValueForMissingStub: null, - ); - @override - String get walletName => (super.noSuchMethod( - Invocation.getter(#walletName), - returnValue: '', - ) as String); - @override - String get walletId => (super.noSuchMethod( - Invocation.getter(#walletId), - returnValue: '', - ) as String); - @override - _i23.Future> get mnemonic => (super.noSuchMethod( - Invocation.getter(#mnemonic), - returnValue: _i23.Future>.value([]), - ) as _i23.Future>); - @override - _i23.Future get mnemonicString => (super.noSuchMethod( - Invocation.getter(#mnemonicString), - returnValue: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future get mnemonicPassphrase => (super.noSuchMethod( - Invocation.getter(#mnemonicPassphrase), - returnValue: _i23.Future.value(), - ) as _i23.Future); - @override - bool get hasCalledExit => (super.noSuchMethod( - Invocation.getter(#hasCalledExit), - returnValue: false, - ) as bool); - @override - bool get isConnected => (super.noSuchMethod( - Invocation.getter(#isConnected), - returnValue: false, - ) as bool); - @override - int get storedChainHeight => (super.noSuchMethod( - Invocation.getter(#storedChainHeight), - returnValue: 0, - ) as int); - @override - _i23.Future> prepareSend({ - required String? address, - required _i15.Amount? amount, - Map? args, - }) => - (super.noSuchMethod( - Invocation.method( - #prepareSend, - [], - { - #address: address, - #amount: amount, - #args: args, - }, - ), - returnValue: - _i23.Future>.value({}), - ) as _i23.Future>); - @override - _i23.Future confirmSend({required Map? txData}) => - (super.noSuchMethod( - Invocation.method( - #confirmSend, - [], - {#txData: txData}, - ), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - _i23.Future refresh() => (super.noSuchMethod( - Invocation.method( - #refresh, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future updateNode(bool? shouldRefresh) => (super.noSuchMethod( - Invocation.method( - #updateNode, - [shouldRefresh], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - bool validateAddress(String? address) => (super.noSuchMethod( - Invocation.method( - #validateAddress, - [address], - ), - returnValue: false, - ) as bool); - @override - _i23.Future testNetworkConnection() => (super.noSuchMethod( - Invocation.method( - #testNetworkConnection, - [], - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - _i23.Future recoverFromMnemonic({ - required String? mnemonic, - String? mnemonicPassphrase, - required int? maxUnusedAddressGap, - required int? maxNumberOfIndexesToCheck, - required int? height, - }) => - (super.noSuchMethod( - Invocation.method( - #recoverFromMnemonic, - [], - { - #mnemonic: mnemonic, - #mnemonicPassphrase: mnemonicPassphrase, - #maxUnusedAddressGap: maxUnusedAddressGap, - #maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, - #height: height, - }, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future initializeNew() => (super.noSuchMethod( - Invocation.method( - #initializeNew, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future initializeExisting() => (super.noSuchMethod( - Invocation.method( - #initializeExisting, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future exit() => (super.noSuchMethod( - Invocation.method( - #exit, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future fullRescan( - int? maxUnusedAddressGap, - int? maxNumberOfIndexesToCheck, - ) => - (super.noSuchMethod( - Invocation.method( - #fullRescan, - [ - maxUnusedAddressGap, - maxNumberOfIndexesToCheck, - ], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future<_i15.Amount> estimateFeeFor( - _i15.Amount? amount, - int? feeRate, - ) => - (super.noSuchMethod( - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - returnValue: _i23.Future<_i15.Amount>.value(_FakeAmount_13( - this, - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - )), - ) as _i23.Future<_i15.Amount>); - @override - _i23.Future generateNewAddress() => (super.noSuchMethod( - Invocation.method( - #generateNewAddress, - [], - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - _i23.Future updateSentCachedTxData(Map? txData) => - (super.noSuchMethod( - Invocation.method( - #updateSentCachedTxData, - [txData], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); -} diff --git a/test/price_test.dart b/test/price_test.dart index f9e2930e17..6a361f38a9 100644 --- a/test/price_test.dart +++ b/test/price_test.dart @@ -6,7 +6,7 @@ import 'package:hive_test/hive_test.dart'; import 'package:http/http.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/services/price.dart'; import 'price_test.mocks.dart'; diff --git a/test/price_test.mocks.dart b/test/price_test.mocks.dart index df95b18a57..f9f667a66f 100644 --- a/test/price_test.mocks.dart +++ b/test/price_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/price_test.dart. // Do not manually edit this file. diff --git a/test/sample_data/theme_json_v2.dart b/test/sample_data/theme_json_v2.dart new file mode 100644 index 0000000000..3f9fbfb7f3 --- /dev/null +++ b/test/sample_data/theme_json_v2.dart @@ -0,0 +1,252 @@ +const Map lightThemeJsonMap = { + "name": "Light", + "version": 2, + "id": "light", + "brightness": "light", + "colors": { + // keys for coin colors must match the Coin enum name value exactly + "coin": { + "bitcoin": "0xFFFCC17B", + "litecoin": "0xFF7FA6E1", + "bitcoincash": "0xFF7BCFB8", + "firo": "0xFFFF897A", + "dogecoin": "0xFFFFE079", + "eCash": "0xFFC5C7CB", + "epicCash": "0xFFC5C7CB", + "ethereum": "0xFFA7ADE9", + "monero": "0xFFFF9E6B", + "namecoin": "0xFF91B1E1", + "wownero": "0xFFED80C1", + "particl": "0xFF8175BD" + }, + "background": "0xFFF7F7F7", + "background_app_bar": "0xFFF7F7F7", + "overlay": "0xFF111215", + "accent_color_blue": "0xFF0052DF", + "accent_color_green": "0xFF4CC0A0", + "accent_color_yellow": "0xFFF7D65D", + "accent_color_red": "0xFFD34E50", + "accent_color_orange": "0xFFFEA68D", + "accent_color_dark": "0xFF232323", + "shadow": "0x0F2D3132", + "text_dark_one": "0xFF232323", + "text_dark_two": "0xFF414141", + "text_dark_three": "0xFF747778", + "text_white": "0xFFFFFFFF", + "text_favorite": "0xFF232323", + "text_error": "0xFF930006", + "text_restore": "0xFF111215", + "text_subtitle_one": "0xFF8E9192", + "text_subtitle_two": "0xFFA9ACAC", + "text_subtitle_three": "0xFFC4C7C7", + "text_subtitle_four": "0xFFE0E3E3", + "text_subtitle_five": "0xFFEEEFF1", + "text_subtitle_six": "0xFFF5F5F5", + "button_back_primary": "0xFF232323", + "button_back_secondary": "0xFFE0E3E3", + "button_back_primary_disabled": "0xFFD7D7D7", + "button_back_secondary_disabled": "0xFFF0F1F1", + "button_back_border": "0xFF232323", + "button_back_border_disabled": "0xFFB6B6B6", + "button_back_border_secondary": "0xFFE0E3E3", + "button_back_border_secondary_disabled": "0xFFF0F1F1", + "number_back_default": "0xFFFFFFFF", + "numpad_back_default": "0xFF232323", + "bottom_nav_back": "0xFFFFFFFF", + "button_text_primary": "0xFFFFFFFF", + "button_text_secondary": "0xFF232323", + "button_text_primary_disabled": "0xFFF8F8F8", + "button_text_secondary_disabled": "0xFFB7B7B7", + "button_text_border": "0xFF232323", + "button_text_disabled": "0xFFB6B6B6", + "button_text_borderless": "0xFF0052DF", + "button_text_borderless_disabled": "0xFFB6B6B6", + "number_text_default": "0xFF232323", + "numpad_text_default": "0xFFFFFFFF", + "bottom_nav_text": "0xFF232323", + "custom_text_button_enabled_text": "0xFF0052DF", + "custom_text_button_disabled_text": "0xFF8E9192", + "switch_bg_on": "0xFF0052DF", + "switch_bg_off": "0xFFD8E4FB", + "switch_bg_disabled": "0xFFC5C6C9", + "switch_circle_on": "0xFFDAE2FF", + "switch_circle_off": "0xFFFBFCFF", + "switch_circle_disabled": "0xFFFBFCFF", + "step_indicator_bg_check": "0xFFD9E2FF", + "step_indicator_bg_number": "0xFFD9E2FF", + "step_indicator_bg_inactive": "0xFFCDCDCD", + "step_indicator_bg_lines": "0xFF0056D2", + "step_indicator_bg_lines_inactive": "0xFFCDCDCD", + "step_indicator_icon_text": "0xFF0056D2", + "step_indicator_icon_number": "0xFF0056D2", + "step_indicator_icon_inactive": "0xFFF7F7F7", + "checkbox_bg_checked": "0xFF0056D2", + "checkbox_border_empty": "0xFF8E9192", + "checkbox_bg_disabled": "0xFFADC7EC", + "checkbox_icon_checked": "0xFFFFFFFF", + "checkbox_icon_disabled": "0xFFFFFFFF", + "checkbox_text_label": "0xFF232323", + "snack_bar_back_success": "0xFFB9E9D4", + "snack_bar_back_error": "0xFFFFDAD4", + "snack_bar_back_info": "0xFFDAE2FF", + "snack_bar_text_success": "0xFF006C4D", + "snack_bar_text_error": "0xFF930006", + "snack_bar_text_info": "0xFF002A78", + "bottom_nav_icon_back": "0xFFA2A2A2", + "bottom_nav_icon_icon": "0xFF232323", + "bottom_nav_icon_icon_highlighted": "0xFF232323", + "top_nav_icon_primary": "0xFF232323", + "top_nav_icon_green": "0xFF00A578", + "top_nav_icon_yellow": "0xFFF4C517", + "top_nav_icon_red": "0xFFC00205", + "settings_icon_back": "0xFFE0E3E3", + "settings_icon_icon": "0xFF232323", + "settings_icon_back_two": "0xFF94D6C4", + "settings_icon_element": "0xFF00A578", + "text_field_active_bg": "0xFFEEEFF1", + "text_field_default_bg": "0xFFEEEFF1", + "text_field_error_bg": "0xFFFFDAD4", + "text_field_success_bg": "0xFFB9E9D4", + "text_field_error_border": "0xFFFFDAD4", + "text_field_success_border": "0xFFB9E9D4", + "text_field_active_search_icon_left": "0xFFA9ACAC", + "text_field_default_search_icon_left": "0xFFA9ACAC", + "text_field_error_search_icon_left": "0xFF930006", + "text_field_success_search_icon_left": "0xFF006C4D", + "text_field_active_text": "0xFF232323", + "text_field_default_text": "0xFFA9ACAC", + "text_field_error_text": "0xFF000000", + "text_field_success_text": "0xFF000000", + "text_field_active_label": "0xFFA9ACAC", + "text_field_error_label": "0xFF930006", + "text_field_success_label": "0xFF006C4D", + "text_field_active_search_icon_right": "0xFF747778", + "text_field_default_search_icon_right": "0xFF747778", + "text_field_error_search_icon_right": "0xFF930006", + "text_field_success_search_icon_right": "0xFF006C4D", + "settings_item_level_two_active_bg": "0xFFFFFFFF", + "settings_item_level_two_active_text": "0xFF232323", + "settings_item_level_two_active_sub": "0xFF8E9192", + "radio_button_icon_border": "0xFF0056D2", + "radio_button_icon_border_disabled": "0xFF8F909A", + "radio_button_border_enabled": "0xFF0056D2", + "radio_button_border_disabled": "0xFF8F909A", + "radio_button_icon_circle": "0xFF0056D2", + "radio_button_icon_enabled": "0xFF0056D2", + "radio_button_text_enabled": "0xFF44464E", + "radio_button_text_disabled": "0xFF44464E", + "radio_button_label_enabled": "0xFF8E9192", + "radio_button_label_disabled": "0xFF8E9192", + "info_item_bg": "0xFFFFFFFF", + "info_item_label": "0xFF8E9192", + "info_item_text": "0xFF232323", + "info_item_icons": "0xFF0056D2", + "popup_bg": "0xFFFFFFFF", + "currency_list_item_bg": "0xFFF9F9FC", + "sw_bg": "0xFFFFFFFF", + "sw_mid": "0xFFFFFFFF", + "sw_bottom": "0xFF232323", + "bottom_nav_shadow": "0xFF282E33", + "favorite_star_active": "0xFF0056D2", + "favorite_star_inactive": "0xFFC4C7C7", + "splash": "0x358E9192", + "highlight": "0x44A9ACAC", + "warning_foreground": "0xFF232323", + "warning_background": "0xFFFFDAD3", + "loading_overlay_text_color": "0xFFF7F7F7", + "my_stack_contact_icon_bg": "0xFFEEEFF1", + "text_confirm_total_amount": "0xFF232323", + "text_selected_word_table_iterm": "0xFF232323", + "rate_type_toggle_color_on": "0xFFEEEFF1", + "rate_type_toggle_color_off": "0xFFFFFFFF", + "rate_type_toggle_desktop_color_on": "0xFFEEEFF1", + "rate_type_toggle_desktop_color_off": "0xFFE0E3E3", + "eth_tag_text": "0xFFFFFFFF", + "eth_tag_bg": "0xFF4D5798", + "eth_wallet_tag_text": "0xFF4D5798", + "eth_wallet_tag_bg": "0xFFF0F3FD", + "token_summary_text_primary": "0xFF232323", + "token_summary_text_secondary": "0xFF8488AB", + "token_summary_bg": "0xFFE9EAFF", + "token_summary_button_bg": "0xFFFFFFFF", + "token_summary_icon": "0xFF424A97", + "box_shadows": { + "standard": { + "color": "0x0F2D3132", + "spread_radius": 3.0, + "blur_radius": 4.0 + }, + "home_view_button_bar": { + "color": "0x0F2D3132", + "spread_radius": 3.0, + "blur_radius": 4.0 + } + } + }, + "assets": { + "coin_placeholder": "dummy.svg", + // keys for coin assets must match the Coin enum name value exactly + "coins": { + "icons": { + "bitcoin": "dummy.svg", + "litecoin": "dummy.svg", + "bitcoincash": "dummy.svg", + "dogecoin": "dummy.svg", + "eCash": "dummy.svg", + "epicCash": "dummy.svg", + "ethereum": "dummy.svg", + "firo": "dummy.svg", + "monero": "dummy.svg", + "wownero": "dummy.svg", + "namecoin": "dummy.svg", + "particl": "dummy.svg" + }, + "images": { + "bitcoin": "dummy.svg", + "litecoin": "dummy.svg", + "bitcoincash": "dummy.svg", + "dogecoin": "dummy.svg", + "eCash": "dummy.svg", + "epicCash": "dummy.svg", + "ethereum": "dummy.svg", + "firo": "dummy.svg", + "monero": "dummy.svg", + "wownero": "dummy.svg", + "namecoin": "dummy.svg", + "particl": "dummy.svg" + }, + "secondaries": { + "bitcoin": "dummy.svg", + "litecoin": "dummy.svg", + "bitcoincash": "dummy.svg", + "dogecoin": "dummy.svg", + "eCash": "dummy.svg", + "epicCash": "dummy.svg", + "ethereum": "dummy.svg", + "firo": "dummy.svg", + "monero": "dummy.svg", + "wownero": "dummy.svg", + "namecoin": "dummy.svg", + "particl": "dummy.svg" + } + }, + "bell_new": "dummy.svg", + "persona_incognito": "dummy.svg.svg", + "persona_easy": "dummy.svg", + "stack": "dummy.svg", + "stack_icon": "dummy.svg", + "receive": "dummy.svg", + "receive_pending": "dummy.svg", + "receive_cancelled": "dummy.svg", + "send": "dummy.svg", + "tx_exchange": "dummy.svg", + "tx_exchange_pending": "dummy.svg", + "tx_exchange_failed": "dummy.svg", + "buy": "dummy.svg", + "exchange": "dummy.svg", + "send_pending": "dummy.svg", + "send_cancelled": "dummy.svg", + "theme_selector": "dummy.svg", + "theme_preview": "dummy.png" + } +}; diff --git a/test/screen_tests/address_book_view/address_book_view_screen_test.mocks.dart b/test/screen_tests/address_book_view/address_book_view_screen_test.mocks.dart index d25eea4d02..52f3544c16 100644 --- a/test/screen_tests/address_book_view/address_book_view_screen_test.mocks.dart +++ b/test/screen_tests/address_book_view/address_book_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/address_book_view/address_book_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i4; -import 'dart:ui' as _i5; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/isar/models/contact_entry.dart' as _i2; @@ -112,7 +111,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - void addListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -120,7 +119,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: null, ); @override - void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.mocks.dart b/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.mocks.dart index 2188808b67..1a1b2d646b 100644 --- a/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.mocks.dart +++ b/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.mocks.dart @@ -1,23 +1,22 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i9; -import 'dart:ui' as _i11; import 'package:barcode_scan2/barcode_scan2.dart' as _i2; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i6; import 'package:stackduo/models/isar/models/contact_entry.dart' as _i3; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i14; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i13; import 'package:stackduo/models/models.dart' as _i5; import 'package:stackduo/services/address_book_service.dart' as _i10; import 'package:stackduo/services/coins/coin_service.dart' as _i4; -import 'package:stackduo/services/coins/manager.dart' as _i12; +import 'package:stackduo/services/coins/manager.dart' as _i11; import 'package:stackduo/utilities/amount/amount.dart' as _i7; import 'package:stackduo/utilities/barcode_scanner_interface.dart' as _i8; -import 'package:stackduo/utilities/enums/coin_enum.dart' as _i13; +import 'package:stackduo/utilities/enums/coin_enum.dart' as _i12; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -201,7 +200,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - void addListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -209,7 +208,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: null, ); @override - void removeListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -237,7 +236,7 @@ class MockAddressBookService extends _i1.Mock /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i12.Manager { +class MockManager extends _i1.Mock implements _i11.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -265,10 +264,10 @@ class MockManager extends _i1.Mock implements _i12.Manager { returnValue: false, ) as bool); @override - _i13.Coin get coin => (super.noSuchMethod( + _i12.Coin get coin => (super.noSuchMethod( Invocation.getter(#coin), - returnValue: _i13.Coin.bitcoin, - ) as _i13.Coin); + returnValue: _i12.Coin.bitcoin, + ) as _i12.Coin); @override bool get isRefreshing => (super.noSuchMethod( Invocation.getter(#isRefreshing), @@ -327,16 +326,16 @@ class MockManager extends _i1.Mock implements _i12.Manager { ), ) as _i6.Balance); @override - _i9.Future> get transactions => (super.noSuchMethod( + _i9.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i9.Future>.value(<_i14.Transaction>[]), - ) as _i9.Future>); + _i9.Future>.value(<_i13.Transaction>[]), + ) as _i9.Future>); @override - _i9.Future> get utxos => (super.noSuchMethod( + _i9.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i9.Future>.value(<_i14.UTXO>[]), - ) as _i9.Future>); + returnValue: _i9.Future>.value(<_i13.UTXO>[]), + ) as _i9.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -386,6 +385,11 @@ class MockManager extends _i1.Mock implements _i12.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -589,7 +593,7 @@ class MockManager extends _i1.Mock implements _i12.Manager { returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - void addListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -597,7 +601,7 @@ class MockManager extends _i1.Mock implements _i12.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.mocks.dart b/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.mocks.dart index a2d4fd3742..69df025e9b 100644 --- a/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.mocks.dart +++ b/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.mocks.dart @@ -1,23 +1,22 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i9; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i5; import 'package:stackduo/models/isar/models/contact_entry.dart' as _i2; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i12; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i11; import 'package:stackduo/models/models.dart' as _i4; import 'package:stackduo/services/address_book_service.dart' as _i7; import 'package:stackduo/services/coins/coin_service.dart' as _i3; -import 'package:stackduo/services/coins/manager.dart' as _i10; -import 'package:stackduo/services/locale_service.dart' as _i14; -import 'package:stackduo/services/notes_service.dart' as _i13; +import 'package:stackduo/services/coins/manager.dart' as _i9; +import 'package:stackduo/services/locale_service.dart' as _i13; +import 'package:stackduo/services/notes_service.dart' as _i12; import 'package:stackduo/utilities/amount/amount.dart' as _i6; -import 'package:stackduo/utilities/enums/coin_enum.dart' as _i11; +import 'package:stackduo/utilities/enums/coin_enum.dart' as _i10; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -162,7 +161,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -170,7 +169,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -198,7 +197,7 @@ class MockAddressBookService extends _i1.Mock /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i10.Manager { +class MockManager extends _i1.Mock implements _i9.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -226,10 +225,10 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValue: false, ) as bool); @override - _i11.Coin get coin => (super.noSuchMethod( + _i10.Coin get coin => (super.noSuchMethod( Invocation.getter(#coin), - returnValue: _i11.Coin.bitcoin, - ) as _i11.Coin); + returnValue: _i10.Coin.bitcoin, + ) as _i10.Coin); @override bool get isRefreshing => (super.noSuchMethod( Invocation.getter(#isRefreshing), @@ -288,16 +287,16 @@ class MockManager extends _i1.Mock implements _i10.Manager { ), ) as _i5.Balance); @override - _i8.Future> get transactions => (super.noSuchMethod( + _i8.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i8.Future>.value(<_i12.Transaction>[]), - ) as _i8.Future>); + _i8.Future>.value(<_i11.Transaction>[]), + ) as _i8.Future>); @override - _i8.Future> get utxos => (super.noSuchMethod( + _i8.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i8.Future>.value(<_i12.UTXO>[]), - ) as _i8.Future>); + returnValue: _i8.Future>.value(<_i11.UTXO>[]), + ) as _i8.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -347,6 +346,11 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -550,7 +554,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -558,7 +562,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -578,7 +582,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { /// A class which mocks [NotesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNotesService extends _i1.Mock implements _i13.NotesService { +class MockNotesService extends _i1.Mock implements _i12.NotesService { @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), @@ -644,7 +648,7 @@ class MockNotesService extends _i1.Mock implements _i13.NotesService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -652,7 +656,7 @@ class MockNotesService extends _i1.Mock implements _i13.NotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -680,7 +684,7 @@ class MockNotesService extends _i1.Mock implements _i13.NotesService { /// A class which mocks [LocaleService]. /// /// See the documentation for Mockito's code generation for more information. -class MockLocaleService extends _i1.Mock implements _i14.LocaleService { +class MockLocaleService extends _i1.Mock implements _i13.LocaleService { @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), @@ -702,7 +706,7 @@ class MockLocaleService extends _i1.Mock implements _i14.LocaleService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -710,7 +714,7 @@ class MockLocaleService extends _i1.Mock implements _i14.LocaleService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.mocks.dart b/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.mocks.dart index aac8644df1..50a1edf60c 100644 --- a/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.mocks.dart +++ b/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.mocks.dart @@ -1,21 +1,20 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i9; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i5; import 'package:stackduo/models/isar/models/contact_entry.dart' as _i2; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i12; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i11; import 'package:stackduo/models/models.dart' as _i4; import 'package:stackduo/services/address_book_service.dart' as _i7; import 'package:stackduo/services/coins/coin_service.dart' as _i3; -import 'package:stackduo/services/coins/manager.dart' as _i10; +import 'package:stackduo/services/coins/manager.dart' as _i9; import 'package:stackduo/utilities/amount/amount.dart' as _i6; -import 'package:stackduo/utilities/enums/coin_enum.dart' as _i11; +import 'package:stackduo/utilities/enums/coin_enum.dart' as _i10; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -160,7 +159,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -168,7 +167,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -196,7 +195,7 @@ class MockAddressBookService extends _i1.Mock /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i10.Manager { +class MockManager extends _i1.Mock implements _i9.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -224,10 +223,10 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValue: false, ) as bool); @override - _i11.Coin get coin => (super.noSuchMethod( + _i10.Coin get coin => (super.noSuchMethod( Invocation.getter(#coin), - returnValue: _i11.Coin.bitcoin, - ) as _i11.Coin); + returnValue: _i10.Coin.bitcoin, + ) as _i10.Coin); @override bool get isRefreshing => (super.noSuchMethod( Invocation.getter(#isRefreshing), @@ -286,16 +285,16 @@ class MockManager extends _i1.Mock implements _i10.Manager { ), ) as _i5.Balance); @override - _i8.Future> get transactions => (super.noSuchMethod( + _i8.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i8.Future>.value(<_i12.Transaction>[]), - ) as _i8.Future>); + _i8.Future>.value(<_i11.Transaction>[]), + ) as _i8.Future>); @override - _i8.Future> get utxos => (super.noSuchMethod( + _i8.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i8.Future>.value(<_i12.UTXO>[]), - ) as _i8.Future>); + returnValue: _i8.Future>.value(<_i11.UTXO>[]), + ) as _i8.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -345,6 +344,11 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -548,7 +552,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -556,7 +560,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/exchange/exchange_view_test.mocks.dart b/test/screen_tests/exchange/exchange_view_test.mocks.dart index 4fa685de2d..98d94d5d85 100644 --- a/test/screen_tests/exchange/exchange_view_test.mocks.dart +++ b/test/screen_tests/exchange/exchange_view_test.mocks.dart @@ -1,34 +1,35 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/exchange/exchange_view_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i6; -import 'dart:ui' as _i7; -import 'package:decimal/decimal.dart' as _i14; -import 'package:http/http.dart' as _i12; +import 'package:decimal/decimal.dart' as _i15; +import 'package:http/http.dart' as _i13; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/exchange/change_now/cn_exchange_estimate.dart' - as _i17; + as _i18; import 'package:stackduo/models/exchange/change_now/exchange_transaction.dart' - as _i19; -import 'package:stackduo/models/exchange/change_now/exchange_transaction_status.dart' as _i20; +import 'package:stackduo/models/exchange/change_now/exchange_transaction_status.dart' + as _i21; import 'package:stackduo/models/exchange/response_objects/estimate.dart' - as _i16; + as _i17; import 'package:stackduo/models/exchange/response_objects/fixed_rate_market.dart' - as _i18; -import 'package:stackduo/models/exchange/response_objects/range.dart' as _i15; -import 'package:stackduo/models/exchange/response_objects/trade.dart' as _i9; -import 'package:stackduo/models/isar/exchange_cache/currency.dart' as _i13; -import 'package:stackduo/models/isar/exchange_cache/pair.dart' as _i21; + as _i19; +import 'package:stackduo/models/exchange/response_objects/range.dart' as _i16; +import 'package:stackduo/models/exchange/response_objects/trade.dart' as _i10; +import 'package:stackduo/models/isar/exchange_cache/currency.dart' as _i14; +import 'package:stackduo/models/isar/exchange_cache/pair.dart' as _i22; import 'package:stackduo/services/exchange/change_now/change_now_api.dart' - as _i11; + as _i12; import 'package:stackduo/services/exchange/exchange_response.dart' as _i2; -import 'package:stackduo/services/trade_notes_service.dart' as _i10; -import 'package:stackduo/services/trade_service.dart' as _i8; +import 'package:stackduo/services/trade_notes_service.dart' as _i11; +import 'package:stackduo/services/trade_service.dart' as _i9; +import 'package:stackduo/utilities/amount/amount_unit.dart' as _i7; import 'package:stackduo/utilities/enums/backup_frequency_type.dart' as _i5; +import 'package:stackduo/utilities/enums/coin_enum.dart' as _i8; import 'package:stackduo/utilities/enums/sync_type_enum.dart' as _i4; import 'package:stackduo/utilities/prefs.dart' as _i3; @@ -451,7 +452,55 @@ class MockPrefs extends _i1.Mock implements _i3.Prefs { returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); @override - void addListener(_i7.VoidCallback? listener) => super.noSuchMethod( + _i7.AmountUnit amountUnit(_i8.Coin? coin) => (super.noSuchMethod( + Invocation.method( + #amountUnit, + [coin], + ), + returnValue: _i7.AmountUnit.normal, + ) as _i7.AmountUnit); + @override + void updateAmountUnit({ + required _i8.Coin? coin, + required _i7.AmountUnit? amountUnit, + }) => + super.noSuchMethod( + Invocation.method( + #updateAmountUnit, + [], + { + #coin: coin, + #amountUnit: amountUnit, + }, + ), + returnValueForMissingStub: null, + ); + @override + int maxDecimals(_i8.Coin? coin) => (super.noSuchMethod( + Invocation.method( + #maxDecimals, + [coin], + ), + returnValue: 0, + ) as int); + @override + void updateMaxDecimals({ + required _i8.Coin? coin, + required int? maxDecimals, + }) => + super.noSuchMethod( + Invocation.method( + #updateMaxDecimals, + [], + { + #coin: coin, + #maxDecimals: maxDecimals, + }, + ), + returnValueForMissingStub: null, + ); + @override + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -459,7 +508,7 @@ class MockPrefs extends _i1.Mock implements _i3.Prefs { returnValueForMissingStub: null, ); @override - void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -487,29 +536,29 @@ class MockPrefs extends _i1.Mock implements _i3.Prefs { /// A class which mocks [TradesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockTradesService extends _i1.Mock implements _i8.TradesService { +class MockTradesService extends _i1.Mock implements _i9.TradesService { MockTradesService() { _i1.throwOnMissingStub(this); } @override - List<_i9.Trade> get trades => (super.noSuchMethod( + List<_i10.Trade> get trades => (super.noSuchMethod( Invocation.getter(#trades), - returnValue: <_i9.Trade>[], - ) as List<_i9.Trade>); + returnValue: <_i10.Trade>[], + ) as List<_i10.Trade>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); @override - _i9.Trade? get(String? tradeId) => (super.noSuchMethod(Invocation.method( + _i10.Trade? get(String? tradeId) => (super.noSuchMethod(Invocation.method( #get, [tradeId], - )) as _i9.Trade?); + )) as _i10.Trade?); @override _i6.Future add({ - required _i9.Trade? trade, + required _i10.Trade? trade, required bool? shouldNotifyListeners, }) => (super.noSuchMethod( @@ -526,7 +575,7 @@ class MockTradesService extends _i1.Mock implements _i8.TradesService { ) as _i6.Future); @override _i6.Future edit({ - required _i9.Trade? trade, + required _i10.Trade? trade, required bool? shouldNotifyListeners, }) => (super.noSuchMethod( @@ -543,7 +592,7 @@ class MockTradesService extends _i1.Mock implements _i8.TradesService { ) as _i6.Future); @override _i6.Future delete({ - required _i9.Trade? trade, + required _i10.Trade? trade, required bool? shouldNotifyListeners, }) => (super.noSuchMethod( @@ -576,7 +625,7 @@ class MockTradesService extends _i1.Mock implements _i8.TradesService { returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); @override - void addListener(_i7.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -584,7 +633,7 @@ class MockTradesService extends _i1.Mock implements _i8.TradesService { returnValueForMissingStub: null, ); @override - void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -612,7 +661,7 @@ class MockTradesService extends _i1.Mock implements _i8.TradesService { /// A class which mocks [TradeNotesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockTradeNotesService extends _i1.Mock implements _i10.TradeNotesService { +class MockTradeNotesService extends _i1.Mock implements _i11.TradeNotesService { MockTradeNotesService() { _i1.throwOnMissingStub(this); } @@ -664,7 +713,7 @@ class MockTradeNotesService extends _i1.Mock implements _i10.TradeNotesService { returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); @override - void addListener(_i7.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -672,7 +721,7 @@ class MockTradeNotesService extends _i1.Mock implements _i10.TradeNotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -700,13 +749,13 @@ class MockTradeNotesService extends _i1.Mock implements _i10.TradeNotesService { /// A class which mocks [ChangeNowAPI]. /// /// See the documentation for Mockito's code generation for more information. -class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { +class MockChangeNowAPI extends _i1.Mock implements _i12.ChangeNowAPI { MockChangeNowAPI() { _i1.throwOnMissingStub(this); } @override - set client(_i12.Client? _client) => super.noSuchMethod( + set client(_i13.Client? _client) => super.noSuchMethod( Invocation.setter( #client, _client, @@ -714,7 +763,7 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { returnValueForMissingStub: null, ); @override - _i6.Future<_i2.ExchangeResponse>> getAvailableCurrencies({ + _i6.Future<_i2.ExchangeResponse>> getAvailableCurrencies({ bool? fixedRate, bool? active, }) => @@ -728,8 +777,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), returnValue: - _i6.Future<_i2.ExchangeResponse>>.value( - _FakeExchangeResponse_0>( + _i6.Future<_i2.ExchangeResponse>>.value( + _FakeExchangeResponse_0>( this, Invocation.method( #getAvailableCurrencies, @@ -740,9 +789,26 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), )), - ) as _i6.Future<_i2.ExchangeResponse>>); + ) as _i6.Future<_i2.ExchangeResponse>>); + @override + _i6.Future<_i2.ExchangeResponse>> getCurrenciesV2() => + (super.noSuchMethod( + Invocation.method( + #getCurrenciesV2, + [], + ), + returnValue: + _i6.Future<_i2.ExchangeResponse>>.value( + _FakeExchangeResponse_0>( + this, + Invocation.method( + #getCurrenciesV2, + [], + ), + )), + ) as _i6.Future<_i2.ExchangeResponse>>); @override - _i6.Future<_i2.ExchangeResponse>> getPairedCurrencies({ + _i6.Future<_i2.ExchangeResponse>> getPairedCurrencies({ required String? ticker, bool? fixedRate, }) => @@ -756,8 +822,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), returnValue: - _i6.Future<_i2.ExchangeResponse>>.value( - _FakeExchangeResponse_0>( + _i6.Future<_i2.ExchangeResponse>>.value( + _FakeExchangeResponse_0>( this, Invocation.method( #getPairedCurrencies, @@ -768,9 +834,9 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), )), - ) as _i6.Future<_i2.ExchangeResponse>>); + ) as _i6.Future<_i2.ExchangeResponse>>); @override - _i6.Future<_i2.ExchangeResponse<_i14.Decimal>> getMinimalExchangeAmount({ + _i6.Future<_i2.ExchangeResponse<_i15.Decimal>> getMinimalExchangeAmount({ required String? fromTicker, required String? toTicker, String? apiKey, @@ -785,8 +851,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { #apiKey: apiKey, }, ), - returnValue: _i6.Future<_i2.ExchangeResponse<_i14.Decimal>>.value( - _FakeExchangeResponse_0<_i14.Decimal>( + returnValue: _i6.Future<_i2.ExchangeResponse<_i15.Decimal>>.value( + _FakeExchangeResponse_0<_i15.Decimal>( this, Invocation.method( #getMinimalExchangeAmount, @@ -798,9 +864,9 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), )), - ) as _i6.Future<_i2.ExchangeResponse<_i14.Decimal>>); + ) as _i6.Future<_i2.ExchangeResponse<_i15.Decimal>>); @override - _i6.Future<_i2.ExchangeResponse<_i15.Range>> getRange({ + _i6.Future<_i2.ExchangeResponse<_i16.Range>> getRange({ required String? fromTicker, required String? toTicker, required bool? isFixedRate, @@ -817,8 +883,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { #apiKey: apiKey, }, ), - returnValue: _i6.Future<_i2.ExchangeResponse<_i15.Range>>.value( - _FakeExchangeResponse_0<_i15.Range>( + returnValue: _i6.Future<_i2.ExchangeResponse<_i16.Range>>.value( + _FakeExchangeResponse_0<_i16.Range>( this, Invocation.method( #getRange, @@ -831,12 +897,12 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), )), - ) as _i6.Future<_i2.ExchangeResponse<_i15.Range>>); + ) as _i6.Future<_i2.ExchangeResponse<_i16.Range>>); @override - _i6.Future<_i2.ExchangeResponse<_i16.Estimate>> getEstimatedExchangeAmount({ + _i6.Future<_i2.ExchangeResponse<_i17.Estimate>> getEstimatedExchangeAmount({ required String? fromTicker, required String? toTicker, - required _i14.Decimal? fromAmount, + required _i15.Decimal? fromAmount, String? apiKey, }) => (super.noSuchMethod( @@ -850,8 +916,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { #apiKey: apiKey, }, ), - returnValue: _i6.Future<_i2.ExchangeResponse<_i16.Estimate>>.value( - _FakeExchangeResponse_0<_i16.Estimate>( + returnValue: _i6.Future<_i2.ExchangeResponse<_i17.Estimate>>.value( + _FakeExchangeResponse_0<_i17.Estimate>( this, Invocation.method( #getEstimatedExchangeAmount, @@ -864,13 +930,13 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), )), - ) as _i6.Future<_i2.ExchangeResponse<_i16.Estimate>>); + ) as _i6.Future<_i2.ExchangeResponse<_i17.Estimate>>); @override - _i6.Future<_i2.ExchangeResponse<_i16.Estimate>> + _i6.Future<_i2.ExchangeResponse<_i17.Estimate>> getEstimatedExchangeAmountFixedRate({ required String? fromTicker, required String? toTicker, - required _i14.Decimal? fromAmount, + required _i15.Decimal? fromAmount, required bool? reversed, bool? useRateId = true, String? apiKey, @@ -888,8 +954,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { #apiKey: apiKey, }, ), - returnValue: _i6.Future<_i2.ExchangeResponse<_i16.Estimate>>.value( - _FakeExchangeResponse_0<_i16.Estimate>( + returnValue: _i6.Future<_i2.ExchangeResponse<_i17.Estimate>>.value( + _FakeExchangeResponse_0<_i17.Estimate>( this, Invocation.method( #getEstimatedExchangeAmountFixedRate, @@ -904,17 +970,17 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), )), - ) as _i6.Future<_i2.ExchangeResponse<_i16.Estimate>>); + ) as _i6.Future<_i2.ExchangeResponse<_i17.Estimate>>); @override - _i6.Future<_i2.ExchangeResponse<_i17.CNExchangeEstimate>> + _i6.Future<_i2.ExchangeResponse<_i18.CNExchangeEstimate>> getEstimatedExchangeAmountV2({ required String? fromTicker, required String? toTicker, - required _i17.CNEstimateType? fromOrTo, - required _i14.Decimal? amount, + required _i18.CNEstimateType? fromOrTo, + required _i15.Decimal? amount, String? fromNetwork, String? toNetwork, - _i17.CNFlowType? flow = _i17.CNFlowType.standard, + _i18.CNFlowType? flow = _i18.CNFlowType.standard, String? apiKey, }) => (super.noSuchMethod( @@ -933,8 +999,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), returnValue: - _i6.Future<_i2.ExchangeResponse<_i17.CNExchangeEstimate>>.value( - _FakeExchangeResponse_0<_i17.CNExchangeEstimate>( + _i6.Future<_i2.ExchangeResponse<_i18.CNExchangeEstimate>>.value( + _FakeExchangeResponse_0<_i18.CNExchangeEstimate>( this, Invocation.method( #getEstimatedExchangeAmountV2, @@ -951,9 +1017,9 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), )), - ) as _i6.Future<_i2.ExchangeResponse<_i17.CNExchangeEstimate>>); + ) as _i6.Future<_i2.ExchangeResponse<_i18.CNExchangeEstimate>>); @override - _i6.Future<_i2.ExchangeResponse>> + _i6.Future<_i2.ExchangeResponse>> getAvailableFixedRateMarkets({String? apiKey}) => (super.noSuchMethod( Invocation.method( #getAvailableFixedRateMarkets, @@ -961,8 +1027,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { {#apiKey: apiKey}, ), returnValue: _i6.Future< - _i2.ExchangeResponse>>.value( - _FakeExchangeResponse_0>( + _i2.ExchangeResponse>>.value( + _FakeExchangeResponse_0>( this, Invocation.method( #getAvailableFixedRateMarkets, @@ -970,14 +1036,14 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { {#apiKey: apiKey}, ), )), - ) as _i6.Future<_i2.ExchangeResponse>>); + ) as _i6.Future<_i2.ExchangeResponse>>); @override - _i6.Future<_i2.ExchangeResponse<_i19.ExchangeTransaction>> + _i6.Future<_i2.ExchangeResponse<_i20.ExchangeTransaction>> createStandardExchangeTransaction({ required String? fromTicker, required String? toTicker, required String? receivingAddress, - required _i14.Decimal? amount, + required _i15.Decimal? amount, String? extraId = r'', String? userId = r'', String? contactEmail = r'', @@ -1003,8 +1069,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), returnValue: _i6.Future< - _i2.ExchangeResponse<_i19.ExchangeTransaction>>.value( - _FakeExchangeResponse_0<_i19.ExchangeTransaction>( + _i2.ExchangeResponse<_i20.ExchangeTransaction>>.value( + _FakeExchangeResponse_0<_i20.ExchangeTransaction>( this, Invocation.method( #createStandardExchangeTransaction, @@ -1023,14 +1089,14 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), )), - ) as _i6.Future<_i2.ExchangeResponse<_i19.ExchangeTransaction>>); + ) as _i6.Future<_i2.ExchangeResponse<_i20.ExchangeTransaction>>); @override - _i6.Future<_i2.ExchangeResponse<_i19.ExchangeTransaction>> + _i6.Future<_i2.ExchangeResponse<_i20.ExchangeTransaction>> createFixedRateExchangeTransaction({ required String? fromTicker, required String? toTicker, required String? receivingAddress, - required _i14.Decimal? amount, + required _i15.Decimal? amount, required String? rateId, required bool? reversed, String? extraId = r'', @@ -1060,8 +1126,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), returnValue: _i6.Future< - _i2.ExchangeResponse<_i19.ExchangeTransaction>>.value( - _FakeExchangeResponse_0<_i19.ExchangeTransaction>( + _i2.ExchangeResponse<_i20.ExchangeTransaction>>.value( + _FakeExchangeResponse_0<_i20.ExchangeTransaction>( this, Invocation.method( #createFixedRateExchangeTransaction, @@ -1082,9 +1148,9 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), )), - ) as _i6.Future<_i2.ExchangeResponse<_i19.ExchangeTransaction>>); + ) as _i6.Future<_i2.ExchangeResponse<_i20.ExchangeTransaction>>); @override - _i6.Future<_i2.ExchangeResponse<_i20.ExchangeTransactionStatus>> + _i6.Future<_i2.ExchangeResponse<_i21.ExchangeTransactionStatus>> getTransactionStatus({ required String? id, String? apiKey, @@ -1099,8 +1165,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), returnValue: _i6.Future< - _i2.ExchangeResponse<_i20.ExchangeTransactionStatus>>.value( - _FakeExchangeResponse_0<_i20.ExchangeTransactionStatus>( + _i2.ExchangeResponse<_i21.ExchangeTransactionStatus>>.value( + _FakeExchangeResponse_0<_i21.ExchangeTransactionStatus>( this, Invocation.method( #getTransactionStatus, @@ -1112,9 +1178,9 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { ), )), ) as _i6 - .Future<_i2.ExchangeResponse<_i20.ExchangeTransactionStatus>>); + .Future<_i2.ExchangeResponse<_i21.ExchangeTransactionStatus>>); @override - _i6.Future<_i2.ExchangeResponse>> + _i6.Future<_i2.ExchangeResponse>> getAvailableFloatingRatePairs({bool? includePartners = false}) => (super.noSuchMethod( Invocation.method( @@ -1123,8 +1189,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { {#includePartners: includePartners}, ), returnValue: - _i6.Future<_i2.ExchangeResponse>>.value( - _FakeExchangeResponse_0>( + _i6.Future<_i2.ExchangeResponse>>.value( + _FakeExchangeResponse_0>( this, Invocation.method( #getAvailableFloatingRatePairs, @@ -1132,5 +1198,5 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { {#includePartners: includePartners}, ), )), - ) as _i6.Future<_i2.ExchangeResponse>>); + ) as _i6.Future<_i2.ExchangeResponse>>); } diff --git a/test/screen_tests/lockscreen_view_screen_test.mocks.dart b/test/screen_tests/lockscreen_view_screen_test.mocks.dart index c93aee6b0d..27cf63a5a5 100644 --- a/test/screen_tests/lockscreen_view_screen_test.mocks.dart +++ b/test/screen_tests/lockscreen_view_screen_test.mocks.dart @@ -1,19 +1,18 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/lockscreen_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i5; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i14; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i13; import 'package:stackduo/models/models.dart' as _i4; -import 'package:stackduo/models/node_model.dart' as _i12; +import 'package:stackduo/models/node_model.dart' as _i11; import 'package:stackduo/services/coins/coin_service.dart' as _i3; -import 'package:stackduo/services/coins/manager.dart' as _i13; -import 'package:stackduo/services/node_service.dart' as _i11; +import 'package:stackduo/services/coins/manager.dart' as _i12; +import 'package:stackduo/services/node_service.dart' as _i10; import 'package:stackduo/services/wallets_service.dart' as _i7; import 'package:stackduo/utilities/amount/amount.dart' as _i6; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i9; @@ -280,7 +279,7 @@ class MockWalletsService extends _i1.Mock implements _i7.WalletsService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -288,7 +287,7 @@ class MockWalletsService extends _i1.Mock implements _i7.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -316,7 +315,7 @@ class MockWalletsService extends _i1.Mock implements _i7.WalletsService { /// A class which mocks [NodeService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNodeService extends _i1.Mock implements _i11.NodeService { +class MockNodeService extends _i1.Mock implements _i10.NodeService { @override _i2.SecureStorageInterface get secureStorageInterface => (super.noSuchMethod( Invocation.getter(#secureStorageInterface), @@ -326,15 +325,15 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { ), ) as _i2.SecureStorageInterface); @override - List<_i12.NodeModel> get primaryNodes => (super.noSuchMethod( + List<_i11.NodeModel> get primaryNodes => (super.noSuchMethod( Invocation.getter(#primaryNodes), - returnValue: <_i12.NodeModel>[], - ) as List<_i12.NodeModel>); + returnValue: <_i11.NodeModel>[], + ) as List<_i11.NodeModel>); @override - List<_i12.NodeModel> get nodes => (super.noSuchMethod( + List<_i11.NodeModel> get nodes => (super.noSuchMethod( Invocation.getter(#nodes), - returnValue: <_i12.NodeModel>[], - ) as List<_i12.NodeModel>); + returnValue: <_i11.NodeModel>[], + ) as List<_i11.NodeModel>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), @@ -352,7 +351,7 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { @override _i8.Future setPrimaryNodeFor({ required _i9.Coin? coin, - required _i12.NodeModel? node, + required _i11.NodeModel? node, bool? shouldNotifyListeners = false, }) => (super.noSuchMethod( @@ -369,40 +368,40 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - _i12.NodeModel? getPrimaryNodeFor({required _i9.Coin? coin}) => + _i11.NodeModel? getPrimaryNodeFor({required _i9.Coin? coin}) => (super.noSuchMethod(Invocation.method( #getPrimaryNodeFor, [], {#coin: coin}, - )) as _i12.NodeModel?); + )) as _i11.NodeModel?); @override - List<_i12.NodeModel> getNodesFor(_i9.Coin? coin) => (super.noSuchMethod( + List<_i11.NodeModel> getNodesFor(_i9.Coin? coin) => (super.noSuchMethod( Invocation.method( #getNodesFor, [coin], ), - returnValue: <_i12.NodeModel>[], - ) as List<_i12.NodeModel>); + returnValue: <_i11.NodeModel>[], + ) as List<_i11.NodeModel>); @override - _i12.NodeModel? getNodeById({required String? id}) => + _i11.NodeModel? getNodeById({required String? id}) => (super.noSuchMethod(Invocation.method( #getNodeById, [], {#id: id}, - )) as _i12.NodeModel?); + )) as _i11.NodeModel?); @override - List<_i12.NodeModel> failoverNodesFor({required _i9.Coin? coin}) => + List<_i11.NodeModel> failoverNodesFor({required _i9.Coin? coin}) => (super.noSuchMethod( Invocation.method( #failoverNodesFor, [], {#coin: coin}, ), - returnValue: <_i12.NodeModel>[], - ) as List<_i12.NodeModel>); + returnValue: <_i11.NodeModel>[], + ) as List<_i11.NodeModel>); @override _i8.Future add( - _i12.NodeModel? node, + _i11.NodeModel? node, String? password, bool? shouldNotifyListeners, ) => @@ -454,7 +453,7 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { ) as _i8.Future); @override _i8.Future edit( - _i12.NodeModel? editedNode, + _i11.NodeModel? editedNode, String? password, bool? shouldNotifyListeners, ) => @@ -480,7 +479,7 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -488,7 +487,7 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -516,7 +515,7 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i13.Manager { +class MockManager extends _i1.Mock implements _i12.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -606,16 +605,16 @@ class MockManager extends _i1.Mock implements _i13.Manager { ), ) as _i5.Balance); @override - _i8.Future> get transactions => (super.noSuchMethod( + _i8.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i8.Future>.value(<_i14.Transaction>[]), - ) as _i8.Future>); + _i8.Future>.value(<_i13.Transaction>[]), + ) as _i8.Future>); @override - _i8.Future> get utxos => (super.noSuchMethod( + _i8.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i8.Future>.value(<_i14.UTXO>[]), - ) as _i8.Future>); + returnValue: _i8.Future>.value(<_i13.UTXO>[]), + ) as _i8.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -665,6 +664,11 @@ class MockManager extends _i1.Mock implements _i13.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -868,7 +872,7 @@ class MockManager extends _i1.Mock implements _i13.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -876,7 +880,7 @@ class MockManager extends _i1.Mock implements _i13.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/main_view_tests/main_view_screen_testA_test.mocks.dart b/test/screen_tests/main_view_tests/main_view_screen_testA_test.mocks.dart index 5df61cd295..26a5c4fc16 100644 --- a/test/screen_tests/main_view_tests/main_view_screen_testA_test.mocks.dart +++ b/test/screen_tests/main_view_tests/main_view_screen_testA_test.mocks.dart @@ -1,19 +1,18 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/main_view_tests/main_view_screen_testA_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i7; -import 'dart:ui' as _i9; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i11; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i10; import 'package:stackduo/models/models.dart' as _i3; import 'package:stackduo/services/coins/coin_service.dart' as _i2; -import 'package:stackduo/services/coins/manager.dart' as _i10; -import 'package:stackduo/services/locale_service.dart' as _i13; -import 'package:stackduo/services/notes_service.dart' as _i12; +import 'package:stackduo/services/coins/manager.dart' as _i9; +import 'package:stackduo/services/locale_service.dart' as _i12; +import 'package:stackduo/services/notes_service.dart' as _i11; import 'package:stackduo/services/wallets_service.dart' as _i6; import 'package:stackduo/utilities/amount/amount.dart' as _i5; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i8; @@ -267,7 +266,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -275,7 +274,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -303,7 +302,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i10.Manager { +class MockManager extends _i1.Mock implements _i9.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -393,16 +392,16 @@ class MockManager extends _i1.Mock implements _i10.Manager { ), ) as _i4.Balance); @override - _i7.Future> get transactions => (super.noSuchMethod( + _i7.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i7.Future>.value(<_i11.Transaction>[]), - ) as _i7.Future>); + _i7.Future>.value(<_i10.Transaction>[]), + ) as _i7.Future>); @override - _i7.Future> get utxos => (super.noSuchMethod( + _i7.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i7.Future>.value(<_i11.UTXO>[]), - ) as _i7.Future>); + returnValue: _i7.Future>.value(<_i10.UTXO>[]), + ) as _i7.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -452,6 +451,11 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -655,7 +659,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -663,7 +667,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -683,7 +687,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { /// A class which mocks [NotesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNotesService extends _i1.Mock implements _i12.NotesService { +class MockNotesService extends _i1.Mock implements _i11.NotesService { @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), @@ -749,7 +753,7 @@ class MockNotesService extends _i1.Mock implements _i12.NotesService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -757,7 +761,7 @@ class MockNotesService extends _i1.Mock implements _i12.NotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -785,7 +789,7 @@ class MockNotesService extends _i1.Mock implements _i12.NotesService { /// A class which mocks [LocaleService]. /// /// See the documentation for Mockito's code generation for more information. -class MockLocaleService extends _i1.Mock implements _i13.LocaleService { +class MockLocaleService extends _i1.Mock implements _i12.LocaleService { @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), @@ -807,7 +811,7 @@ class MockLocaleService extends _i1.Mock implements _i13.LocaleService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -815,7 +819,7 @@ class MockLocaleService extends _i1.Mock implements _i13.LocaleService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/main_view_tests/main_view_screen_testB_test.mocks.dart b/test/screen_tests/main_view_tests/main_view_screen_testB_test.mocks.dart index 60597cc765..22f5cf2f7b 100644 --- a/test/screen_tests/main_view_tests/main_view_screen_testB_test.mocks.dart +++ b/test/screen_tests/main_view_tests/main_view_screen_testB_test.mocks.dart @@ -1,19 +1,18 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/main_view_tests/main_view_screen_testB_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i7; -import 'dart:ui' as _i9; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i11; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i10; import 'package:stackduo/models/models.dart' as _i3; import 'package:stackduo/services/coins/coin_service.dart' as _i2; -import 'package:stackduo/services/coins/manager.dart' as _i10; -import 'package:stackduo/services/locale_service.dart' as _i13; -import 'package:stackduo/services/notes_service.dart' as _i12; +import 'package:stackduo/services/coins/manager.dart' as _i9; +import 'package:stackduo/services/locale_service.dart' as _i12; +import 'package:stackduo/services/notes_service.dart' as _i11; import 'package:stackduo/services/wallets_service.dart' as _i6; import 'package:stackduo/utilities/amount/amount.dart' as _i5; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i8; @@ -267,7 +266,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -275,7 +274,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -303,7 +302,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i10.Manager { +class MockManager extends _i1.Mock implements _i9.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -393,16 +392,16 @@ class MockManager extends _i1.Mock implements _i10.Manager { ), ) as _i4.Balance); @override - _i7.Future> get transactions => (super.noSuchMethod( + _i7.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i7.Future>.value(<_i11.Transaction>[]), - ) as _i7.Future>); + _i7.Future>.value(<_i10.Transaction>[]), + ) as _i7.Future>); @override - _i7.Future> get utxos => (super.noSuchMethod( + _i7.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i7.Future>.value(<_i11.UTXO>[]), - ) as _i7.Future>); + returnValue: _i7.Future>.value(<_i10.UTXO>[]), + ) as _i7.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -452,6 +451,11 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -655,7 +659,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -663,7 +667,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -683,7 +687,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { /// A class which mocks [NotesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNotesService extends _i1.Mock implements _i12.NotesService { +class MockNotesService extends _i1.Mock implements _i11.NotesService { @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), @@ -749,7 +753,7 @@ class MockNotesService extends _i1.Mock implements _i12.NotesService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -757,7 +761,7 @@ class MockNotesService extends _i1.Mock implements _i12.NotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -785,7 +789,7 @@ class MockNotesService extends _i1.Mock implements _i12.NotesService { /// A class which mocks [LocaleService]. /// /// See the documentation for Mockito's code generation for more information. -class MockLocaleService extends _i1.Mock implements _i13.LocaleService { +class MockLocaleService extends _i1.Mock implements _i12.LocaleService { @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), @@ -807,7 +811,7 @@ class MockLocaleService extends _i1.Mock implements _i13.LocaleService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -815,7 +819,7 @@ class MockLocaleService extends _i1.Mock implements _i13.LocaleService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/main_view_tests/main_view_screen_testC_test.mocks.dart b/test/screen_tests/main_view_tests/main_view_screen_testC_test.mocks.dart index 5b08e0385e..a296ab840c 100644 --- a/test/screen_tests/main_view_tests/main_view_screen_testC_test.mocks.dart +++ b/test/screen_tests/main_view_tests/main_view_screen_testC_test.mocks.dart @@ -1,19 +1,18 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/main_view_tests/main_view_screen_testC_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i7; -import 'dart:ui' as _i9; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i11; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i10; import 'package:stackduo/models/models.dart' as _i3; import 'package:stackduo/services/coins/coin_service.dart' as _i2; -import 'package:stackduo/services/coins/manager.dart' as _i10; -import 'package:stackduo/services/locale_service.dart' as _i13; -import 'package:stackduo/services/notes_service.dart' as _i12; +import 'package:stackduo/services/coins/manager.dart' as _i9; +import 'package:stackduo/services/locale_service.dart' as _i12; +import 'package:stackduo/services/notes_service.dart' as _i11; import 'package:stackduo/services/wallets_service.dart' as _i6; import 'package:stackduo/utilities/amount/amount.dart' as _i5; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i8; @@ -267,7 +266,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -275,7 +274,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -303,7 +302,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i10.Manager { +class MockManager extends _i1.Mock implements _i9.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -393,16 +392,16 @@ class MockManager extends _i1.Mock implements _i10.Manager { ), ) as _i4.Balance); @override - _i7.Future> get transactions => (super.noSuchMethod( + _i7.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i7.Future>.value(<_i11.Transaction>[]), - ) as _i7.Future>); + _i7.Future>.value(<_i10.Transaction>[]), + ) as _i7.Future>); @override - _i7.Future> get utxos => (super.noSuchMethod( + _i7.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i7.Future>.value(<_i11.UTXO>[]), - ) as _i7.Future>); + returnValue: _i7.Future>.value(<_i10.UTXO>[]), + ) as _i7.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -452,6 +451,11 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -655,7 +659,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -663,7 +667,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -683,7 +687,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { /// A class which mocks [NotesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNotesService extends _i1.Mock implements _i12.NotesService { +class MockNotesService extends _i1.Mock implements _i11.NotesService { @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), @@ -749,7 +753,7 @@ class MockNotesService extends _i1.Mock implements _i12.NotesService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -757,7 +761,7 @@ class MockNotesService extends _i1.Mock implements _i12.NotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -785,7 +789,7 @@ class MockNotesService extends _i1.Mock implements _i12.NotesService { /// A class which mocks [LocaleService]. /// /// See the documentation for Mockito's code generation for more information. -class MockLocaleService extends _i1.Mock implements _i13.LocaleService { +class MockLocaleService extends _i1.Mock implements _i12.LocaleService { @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), @@ -807,7 +811,7 @@ class MockLocaleService extends _i1.Mock implements _i13.LocaleService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -815,7 +819,7 @@ class MockLocaleService extends _i1.Mock implements _i13.LocaleService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/onboarding/backup_key_view_screen_test.mocks.dart b/test/screen_tests/onboarding/backup_key_view_screen_test.mocks.dart index 6cd533c0b8..cc5c0cf449 100644 --- a/test/screen_tests/onboarding/backup_key_view_screen_test.mocks.dart +++ b/test/screen_tests/onboarding/backup_key_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/onboarding/backup_key_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; @@ -219,6 +218,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -422,7 +426,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -430,7 +434,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/onboarding/backup_key_warning_view_screen_test.mocks.dart b/test/screen_tests/onboarding/backup_key_warning_view_screen_test.mocks.dart index 65990a7d5c..b9f6f7d32e 100644 --- a/test/screen_tests/onboarding/backup_key_warning_view_screen_test.mocks.dart +++ b/test/screen_tests/onboarding/backup_key_warning_view_screen_test.mocks.dart @@ -1,17 +1,16 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/onboarding/backup_key_warning_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i7; -import 'dart:ui' as _i9; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i11; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i10; import 'package:stackduo/models/models.dart' as _i3; import 'package:stackduo/services/coins/coin_service.dart' as _i2; -import 'package:stackduo/services/coins/manager.dart' as _i10; +import 'package:stackduo/services/coins/manager.dart' as _i9; import 'package:stackduo/services/wallets_service.dart' as _i6; import 'package:stackduo/utilities/amount/amount.dart' as _i5; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i8; @@ -265,7 +264,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -273,7 +272,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -301,7 +300,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i10.Manager { +class MockManager extends _i1.Mock implements _i9.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -391,16 +390,16 @@ class MockManager extends _i1.Mock implements _i10.Manager { ), ) as _i4.Balance); @override - _i7.Future> get transactions => (super.noSuchMethod( + _i7.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i7.Future>.value(<_i11.Transaction>[]), - ) as _i7.Future>); + _i7.Future>.value(<_i10.Transaction>[]), + ) as _i7.Future>); @override - _i7.Future> get utxos => (super.noSuchMethod( + _i7.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i7.Future>.value(<_i11.UTXO>[]), - ) as _i7.Future>); + returnValue: _i7.Future>.value(<_i10.UTXO>[]), + ) as _i7.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -450,6 +449,11 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -653,7 +657,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -661,7 +665,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/onboarding/create_pin_view_screen_test.mocks.dart b/test/screen_tests/onboarding/create_pin_view_screen_test.mocks.dart index 08aad855cc..6cdbfe1538 100644 --- a/test/screen_tests/onboarding/create_pin_view_screen_test.mocks.dart +++ b/test/screen_tests/onboarding/create_pin_view_screen_test.mocks.dart @@ -1,19 +1,18 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/onboarding/create_pin_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i5; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i14; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i13; import 'package:stackduo/models/models.dart' as _i4; -import 'package:stackduo/models/node_model.dart' as _i12; +import 'package:stackduo/models/node_model.dart' as _i11; import 'package:stackduo/services/coins/coin_service.dart' as _i3; -import 'package:stackduo/services/coins/manager.dart' as _i13; -import 'package:stackduo/services/node_service.dart' as _i11; +import 'package:stackduo/services/coins/manager.dart' as _i12; +import 'package:stackduo/services/node_service.dart' as _i10; import 'package:stackduo/services/wallets_service.dart' as _i7; import 'package:stackduo/utilities/amount/amount.dart' as _i6; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i9; @@ -280,7 +279,7 @@ class MockWalletsService extends _i1.Mock implements _i7.WalletsService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -288,7 +287,7 @@ class MockWalletsService extends _i1.Mock implements _i7.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -316,7 +315,7 @@ class MockWalletsService extends _i1.Mock implements _i7.WalletsService { /// A class which mocks [NodeService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNodeService extends _i1.Mock implements _i11.NodeService { +class MockNodeService extends _i1.Mock implements _i10.NodeService { @override _i2.SecureStorageInterface get secureStorageInterface => (super.noSuchMethod( Invocation.getter(#secureStorageInterface), @@ -326,15 +325,15 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { ), ) as _i2.SecureStorageInterface); @override - List<_i12.NodeModel> get primaryNodes => (super.noSuchMethod( + List<_i11.NodeModel> get primaryNodes => (super.noSuchMethod( Invocation.getter(#primaryNodes), - returnValue: <_i12.NodeModel>[], - ) as List<_i12.NodeModel>); + returnValue: <_i11.NodeModel>[], + ) as List<_i11.NodeModel>); @override - List<_i12.NodeModel> get nodes => (super.noSuchMethod( + List<_i11.NodeModel> get nodes => (super.noSuchMethod( Invocation.getter(#nodes), - returnValue: <_i12.NodeModel>[], - ) as List<_i12.NodeModel>); + returnValue: <_i11.NodeModel>[], + ) as List<_i11.NodeModel>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), @@ -352,7 +351,7 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { @override _i8.Future setPrimaryNodeFor({ required _i9.Coin? coin, - required _i12.NodeModel? node, + required _i11.NodeModel? node, bool? shouldNotifyListeners = false, }) => (super.noSuchMethod( @@ -369,40 +368,40 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - _i12.NodeModel? getPrimaryNodeFor({required _i9.Coin? coin}) => + _i11.NodeModel? getPrimaryNodeFor({required _i9.Coin? coin}) => (super.noSuchMethod(Invocation.method( #getPrimaryNodeFor, [], {#coin: coin}, - )) as _i12.NodeModel?); + )) as _i11.NodeModel?); @override - List<_i12.NodeModel> getNodesFor(_i9.Coin? coin) => (super.noSuchMethod( + List<_i11.NodeModel> getNodesFor(_i9.Coin? coin) => (super.noSuchMethod( Invocation.method( #getNodesFor, [coin], ), - returnValue: <_i12.NodeModel>[], - ) as List<_i12.NodeModel>); + returnValue: <_i11.NodeModel>[], + ) as List<_i11.NodeModel>); @override - _i12.NodeModel? getNodeById({required String? id}) => + _i11.NodeModel? getNodeById({required String? id}) => (super.noSuchMethod(Invocation.method( #getNodeById, [], {#id: id}, - )) as _i12.NodeModel?); + )) as _i11.NodeModel?); @override - List<_i12.NodeModel> failoverNodesFor({required _i9.Coin? coin}) => + List<_i11.NodeModel> failoverNodesFor({required _i9.Coin? coin}) => (super.noSuchMethod( Invocation.method( #failoverNodesFor, [], {#coin: coin}, ), - returnValue: <_i12.NodeModel>[], - ) as List<_i12.NodeModel>); + returnValue: <_i11.NodeModel>[], + ) as List<_i11.NodeModel>); @override _i8.Future add( - _i12.NodeModel? node, + _i11.NodeModel? node, String? password, bool? shouldNotifyListeners, ) => @@ -454,7 +453,7 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { ) as _i8.Future); @override _i8.Future edit( - _i12.NodeModel? editedNode, + _i11.NodeModel? editedNode, String? password, bool? shouldNotifyListeners, ) => @@ -480,7 +479,7 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -488,7 +487,7 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -516,7 +515,7 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i13.Manager { +class MockManager extends _i1.Mock implements _i12.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -606,16 +605,16 @@ class MockManager extends _i1.Mock implements _i13.Manager { ), ) as _i5.Balance); @override - _i8.Future> get transactions => (super.noSuchMethod( + _i8.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i8.Future>.value(<_i14.Transaction>[]), - ) as _i8.Future>); + _i8.Future>.value(<_i13.Transaction>[]), + ) as _i8.Future>); @override - _i8.Future> get utxos => (super.noSuchMethod( + _i8.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i8.Future>.value(<_i14.UTXO>[]), - ) as _i8.Future>); + returnValue: _i8.Future>.value(<_i13.UTXO>[]), + ) as _i8.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -665,6 +664,11 @@ class MockManager extends _i1.Mock implements _i13.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -868,7 +872,7 @@ class MockManager extends _i1.Mock implements _i13.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -876,7 +880,7 @@ class MockManager extends _i1.Mock implements _i13.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/onboarding/name_your_wallet_view_screen_test.mocks.dart b/test/screen_tests/onboarding/name_your_wallet_view_screen_test.mocks.dart index 841db542c5..61b791b308 100644 --- a/test/screen_tests/onboarding/name_your_wallet_view_screen_test.mocks.dart +++ b/test/screen_tests/onboarding/name_your_wallet_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/onboarding/name_your_wallet_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i3; -import 'dart:ui' as _i5; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/services/wallets_service.dart' as _i2; @@ -218,7 +217,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - void addListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -226,7 +225,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/onboarding/restore_wallet_view_screen_test.mocks.dart b/test/screen_tests/onboarding/restore_wallet_view_screen_test.mocks.dart index fd1b01af88..b096c588b9 100644 --- a/test/screen_tests/onboarding/restore_wallet_view_screen_test.mocks.dart +++ b/test/screen_tests/onboarding/restore_wallet_view_screen_test.mocks.dart @@ -1,20 +1,19 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/onboarding/restore_wallet_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i9; -import 'dart:ui' as _i12; import 'package:barcode_scan2/barcode_scan2.dart' as _i2; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i5; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i14; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i13; import 'package:stackduo/models/models.dart' as _i4; -import 'package:stackduo/models/node_model.dart' as _i16; +import 'package:stackduo/models/node_model.dart' as _i15; import 'package:stackduo/services/coins/coin_service.dart' as _i3; -import 'package:stackduo/services/coins/manager.dart' as _i13; -import 'package:stackduo/services/node_service.dart' as _i15; +import 'package:stackduo/services/coins/manager.dart' as _i12; +import 'package:stackduo/services/node_service.dart' as _i14; import 'package:stackduo/services/wallets_service.dart' as _i10; import 'package:stackduo/utilities/amount/amount.dart' as _i6; import 'package:stackduo/utilities/barcode_scanner_interface.dart' as _i8; @@ -321,7 +320,7 @@ class MockWalletsService extends _i1.Mock implements _i10.WalletsService { returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - void addListener(_i12.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -329,7 +328,7 @@ class MockWalletsService extends _i1.Mock implements _i10.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -357,7 +356,7 @@ class MockWalletsService extends _i1.Mock implements _i10.WalletsService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i13.Manager { +class MockManager extends _i1.Mock implements _i12.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -447,16 +446,16 @@ class MockManager extends _i1.Mock implements _i13.Manager { ), ) as _i5.Balance); @override - _i9.Future> get transactions => (super.noSuchMethod( + _i9.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i9.Future>.value(<_i14.Transaction>[]), - ) as _i9.Future>); + _i9.Future>.value(<_i13.Transaction>[]), + ) as _i9.Future>); @override - _i9.Future> get utxos => (super.noSuchMethod( + _i9.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i9.Future>.value(<_i14.UTXO>[]), - ) as _i9.Future>); + returnValue: _i9.Future>.value(<_i13.UTXO>[]), + ) as _i9.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -506,6 +505,11 @@ class MockManager extends _i1.Mock implements _i13.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -709,7 +713,7 @@ class MockManager extends _i1.Mock implements _i13.Manager { returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - void addListener(_i12.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -717,7 +721,7 @@ class MockManager extends _i1.Mock implements _i13.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -737,7 +741,7 @@ class MockManager extends _i1.Mock implements _i13.Manager { /// A class which mocks [NodeService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNodeService extends _i1.Mock implements _i15.NodeService { +class MockNodeService extends _i1.Mock implements _i14.NodeService { @override _i7.SecureStorageInterface get secureStorageInterface => (super.noSuchMethod( Invocation.getter(#secureStorageInterface), @@ -747,15 +751,15 @@ class MockNodeService extends _i1.Mock implements _i15.NodeService { ), ) as _i7.SecureStorageInterface); @override - List<_i16.NodeModel> get primaryNodes => (super.noSuchMethod( + List<_i15.NodeModel> get primaryNodes => (super.noSuchMethod( Invocation.getter(#primaryNodes), - returnValue: <_i16.NodeModel>[], - ) as List<_i16.NodeModel>); + returnValue: <_i15.NodeModel>[], + ) as List<_i15.NodeModel>); @override - List<_i16.NodeModel> get nodes => (super.noSuchMethod( + List<_i15.NodeModel> get nodes => (super.noSuchMethod( Invocation.getter(#nodes), - returnValue: <_i16.NodeModel>[], - ) as List<_i16.NodeModel>); + returnValue: <_i15.NodeModel>[], + ) as List<_i15.NodeModel>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), @@ -773,7 +777,7 @@ class MockNodeService extends _i1.Mock implements _i15.NodeService { @override _i9.Future setPrimaryNodeFor({ required _i11.Coin? coin, - required _i16.NodeModel? node, + required _i15.NodeModel? node, bool? shouldNotifyListeners = false, }) => (super.noSuchMethod( @@ -790,40 +794,40 @@ class MockNodeService extends _i1.Mock implements _i15.NodeService { returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - _i16.NodeModel? getPrimaryNodeFor({required _i11.Coin? coin}) => + _i15.NodeModel? getPrimaryNodeFor({required _i11.Coin? coin}) => (super.noSuchMethod(Invocation.method( #getPrimaryNodeFor, [], {#coin: coin}, - )) as _i16.NodeModel?); + )) as _i15.NodeModel?); @override - List<_i16.NodeModel> getNodesFor(_i11.Coin? coin) => (super.noSuchMethod( + List<_i15.NodeModel> getNodesFor(_i11.Coin? coin) => (super.noSuchMethod( Invocation.method( #getNodesFor, [coin], ), - returnValue: <_i16.NodeModel>[], - ) as List<_i16.NodeModel>); + returnValue: <_i15.NodeModel>[], + ) as List<_i15.NodeModel>); @override - _i16.NodeModel? getNodeById({required String? id}) => + _i15.NodeModel? getNodeById({required String? id}) => (super.noSuchMethod(Invocation.method( #getNodeById, [], {#id: id}, - )) as _i16.NodeModel?); + )) as _i15.NodeModel?); @override - List<_i16.NodeModel> failoverNodesFor({required _i11.Coin? coin}) => + List<_i15.NodeModel> failoverNodesFor({required _i11.Coin? coin}) => (super.noSuchMethod( Invocation.method( #failoverNodesFor, [], {#coin: coin}, ), - returnValue: <_i16.NodeModel>[], - ) as List<_i16.NodeModel>); + returnValue: <_i15.NodeModel>[], + ) as List<_i15.NodeModel>); @override _i9.Future add( - _i16.NodeModel? node, + _i15.NodeModel? node, String? password, bool? shouldNotifyListeners, ) => @@ -875,7 +879,7 @@ class MockNodeService extends _i1.Mock implements _i15.NodeService { ) as _i9.Future); @override _i9.Future edit( - _i16.NodeModel? editedNode, + _i15.NodeModel? editedNode, String? password, bool? shouldNotifyListeners, ) => @@ -901,7 +905,7 @@ class MockNodeService extends _i1.Mock implements _i15.NodeService { returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - void addListener(_i12.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -909,7 +913,7 @@ class MockNodeService extends _i1.Mock implements _i15.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/onboarding/verify_backup_key_view_screen_test.mocks.dart b/test/screen_tests/onboarding/verify_backup_key_view_screen_test.mocks.dart index 0543f8e196..8c829f1fdf 100644 --- a/test/screen_tests/onboarding/verify_backup_key_view_screen_test.mocks.dart +++ b/test/screen_tests/onboarding/verify_backup_key_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/onboarding/verify_backup_key_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; @@ -219,6 +218,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -422,7 +426,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -430,7 +434,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_subviews/currency_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/currency_view_screen_test.mocks.dart index f336f7484a..ff11120acd 100644 --- a/test/screen_tests/settings_view/settings_subviews/currency_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/currency_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/settings_view/settings_subviews/currency_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; @@ -219,6 +218,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -422,7 +426,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -430,7 +434,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/add_custom_node_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/add_custom_node_view_screen_test.mocks.dart index 57ce3c89c9..74eae8db65 100644 --- a/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/add_custom_node_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/add_custom_node_view_screen_test.mocks.dart @@ -1,18 +1,17 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/add_custom_node_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i9; -import 'dart:ui' as _i11; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i5; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i13; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i12; import 'package:stackduo/models/models.dart' as _i4; import 'package:stackduo/models/node_model.dart' as _i8; import 'package:stackduo/services/coins/coin_service.dart' as _i3; -import 'package:stackduo/services/coins/manager.dart' as _i12; +import 'package:stackduo/services/coins/manager.dart' as _i11; import 'package:stackduo/services/node_service.dart' as _i7; import 'package:stackduo/utilities/amount/amount.dart' as _i6; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i10; @@ -249,7 +248,7 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService { returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - void addListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -257,7 +256,7 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -285,7 +284,7 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i12.Manager { +class MockManager extends _i1.Mock implements _i11.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -375,16 +374,16 @@ class MockManager extends _i1.Mock implements _i12.Manager { ), ) as _i5.Balance); @override - _i9.Future> get transactions => (super.noSuchMethod( + _i9.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i9.Future>.value(<_i13.Transaction>[]), - ) as _i9.Future>); + _i9.Future>.value(<_i12.Transaction>[]), + ) as _i9.Future>); @override - _i9.Future> get utxos => (super.noSuchMethod( + _i9.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i9.Future>.value(<_i13.UTXO>[]), - ) as _i9.Future>); + returnValue: _i9.Future>.value(<_i12.UTXO>[]), + ) as _i9.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -434,6 +433,11 @@ class MockManager extends _i1.Mock implements _i12.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -637,7 +641,7 @@ class MockManager extends _i1.Mock implements _i12.Manager { returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - void addListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -645,7 +649,7 @@ class MockManager extends _i1.Mock implements _i12.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/node_details_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/node_details_view_screen_test.mocks.dart index b26913fc5b..da35759477 100644 --- a/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/node_details_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/node_details_view_screen_test.mocks.dart @@ -1,18 +1,17 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/node_details_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i9; -import 'dart:ui' as _i11; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i5; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i13; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i12; import 'package:stackduo/models/models.dart' as _i4; import 'package:stackduo/models/node_model.dart' as _i8; import 'package:stackduo/services/coins/coin_service.dart' as _i3; -import 'package:stackduo/services/coins/manager.dart' as _i12; +import 'package:stackduo/services/coins/manager.dart' as _i11; import 'package:stackduo/services/node_service.dart' as _i7; import 'package:stackduo/utilities/amount/amount.dart' as _i6; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i10; @@ -249,7 +248,7 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService { returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - void addListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -257,7 +256,7 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -285,7 +284,7 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i12.Manager { +class MockManager extends _i1.Mock implements _i11.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -375,16 +374,16 @@ class MockManager extends _i1.Mock implements _i12.Manager { ), ) as _i5.Balance); @override - _i9.Future> get transactions => (super.noSuchMethod( + _i9.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i9.Future>.value(<_i13.Transaction>[]), - ) as _i9.Future>); + _i9.Future>.value(<_i12.Transaction>[]), + ) as _i9.Future>); @override - _i9.Future> get utxos => (super.noSuchMethod( + _i9.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i9.Future>.value(<_i13.UTXO>[]), - ) as _i9.Future>); + returnValue: _i9.Future>.value(<_i12.UTXO>[]), + ) as _i9.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -434,6 +433,11 @@ class MockManager extends _i1.Mock implements _i12.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -637,7 +641,7 @@ class MockManager extends _i1.Mock implements _i12.Manager { returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - void addListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -645,7 +649,7 @@ class MockManager extends _i1.Mock implements _i12.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_subviews/network_settings_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/network_settings_view_screen_test.mocks.dart index 84bef55464..a2fb14c5de 100644 --- a/test/screen_tests/settings_view/settings_subviews/network_settings_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/network_settings_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/settings_view/settings_subviews/network_settings_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i5; -import 'dart:ui' as _i7; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/node_model.dart' as _i4; @@ -202,7 +201,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override - void addListener(_i7.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -210,7 +209,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_subviews/wallet_backup_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/wallet_backup_view_screen_test.mocks.dart index f003f64a3f..12447d37ab 100644 --- a/test/screen_tests/settings_view/settings_subviews/wallet_backup_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/wallet_backup_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/settings_view/settings_subviews/wallet_backup_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; @@ -219,6 +218,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -422,7 +426,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -430,7 +434,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/change_pin_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/change_pin_view_screen_test.mocks.dart index 4ee0bcfc5c..f4cb358fab 100644 --- a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/change_pin_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/change_pin_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/change_pin_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i3; -import 'dart:ui' as _i5; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/services/wallets_service.dart' as _i2; @@ -218,7 +217,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - void addListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -226,7 +225,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rename_wallet_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rename_wallet_view_screen_test.mocks.dart index 9958098922..eb1987bd7e 100644 --- a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rename_wallet_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rename_wallet_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rename_wallet_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i3; -import 'dart:ui' as _i5; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/services/wallets_service.dart' as _i2; @@ -218,7 +217,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - void addListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -226,7 +225,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rescan_warning_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rescan_warning_view_screen_test.mocks.dart index 2c8a3e794d..c32ecedb42 100644 --- a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rescan_warning_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rescan_warning_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rescan_warning_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; @@ -219,6 +218,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -422,7 +426,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -430,7 +434,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/wallet_delete_mnemonic_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/wallet_delete_mnemonic_view_screen_test.mocks.dart index f4c82b201c..1e9ebd9465 100644 --- a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/wallet_delete_mnemonic_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/wallet_delete_mnemonic_view_screen_test.mocks.dart @@ -1,17 +1,16 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/wallet_delete_mnemonic_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i7; -import 'dart:ui' as _i9; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i11; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i10; import 'package:stackduo/models/models.dart' as _i3; import 'package:stackduo/services/coins/coin_service.dart' as _i2; -import 'package:stackduo/services/coins/manager.dart' as _i10; +import 'package:stackduo/services/coins/manager.dart' as _i9; import 'package:stackduo/services/wallets_service.dart' as _i6; import 'package:stackduo/utilities/amount/amount.dart' as _i5; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i8; @@ -265,7 +264,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -273,7 +272,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -301,7 +300,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i10.Manager { +class MockManager extends _i1.Mock implements _i9.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -391,16 +390,16 @@ class MockManager extends _i1.Mock implements _i10.Manager { ), ) as _i4.Balance); @override - _i7.Future> get transactions => (super.noSuchMethod( + _i7.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i7.Future>.value(<_i11.Transaction>[]), - ) as _i7.Future>); + _i7.Future>.value(<_i10.Transaction>[]), + ) as _i7.Future>); @override - _i7.Future> get utxos => (super.noSuchMethod( + _i7.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i7.Future>.value(<_i11.UTXO>[]), - ) as _i7.Future>); + returnValue: _i7.Future>.value(<_i10.UTXO>[]), + ) as _i7.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -450,6 +449,11 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -653,7 +657,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -661,7 +665,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_subviews/wallet_settings_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/wallet_settings_view_screen_test.mocks.dart index db4ad51c94..76cc998355 100644 --- a/test/screen_tests/settings_view/settings_subviews/wallet_settings_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/wallet_settings_view_screen_test.mocks.dart @@ -1,26 +1,24 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/settings_view/settings_subviews/wallet_settings_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i9; -import 'dart:ui' as _i15; +import 'dart:async' as _i8; -import 'package:local_auth/auth_strings.dart' as _i12; -import 'package:local_auth/local_auth.dart' as _i11; +import 'package:local_auth/auth_strings.dart' as _i11; +import 'package:local_auth/local_auth.dart' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/electrumx_rpc/cached_electrumx.dart' as _i7; -import 'package:stackduo/electrumx_rpc/electrumx.dart' as _i8; +import 'package:stackduo/electrumx_rpc/electrumx.dart' as _i2; import 'package:stackduo/models/balance.dart' as _i5; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i17; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i15; import 'package:stackduo/models/models.dart' as _i4; import 'package:stackduo/services/coins/coin_service.dart' as _i3; -import 'package:stackduo/services/coins/manager.dart' as _i16; -import 'package:stackduo/services/wallets_service.dart' as _i14; +import 'package:stackduo/services/coins/manager.dart' as _i14; +import 'package:stackduo/services/wallets_service.dart' as _i13; import 'package:stackduo/utilities/amount/amount.dart' as _i6; -import 'package:stackduo/utilities/biometrics.dart' as _i13; -import 'package:stackduo/utilities/enums/coin_enum.dart' as _i10; -import 'package:stackduo/utilities/prefs.dart' as _i2; +import 'package:stackduo/utilities/biometrics.dart' as _i12; +import 'package:stackduo/utilities/enums/coin_enum.dart' as _i9; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -33,8 +31,8 @@ import 'package:stackduo/utilities/prefs.dart' as _i2; // ignore_for_file: camel_case_types // ignore_for_file: subtype_of_sealed_class -class _FakePrefs_0 extends _i1.SmartFake implements _i2.Prefs { - _FakePrefs_0( +class _FakeElectrumX_0 extends _i1.SmartFake implements _i2.ElectrumX { + _FakeElectrumX_0( Object parent, Invocation parentInvocation, ) : super( @@ -93,38 +91,18 @@ class MockCachedElectrumX extends _i1.Mock implements _i7.CachedElectrumX { } @override - String get server => (super.noSuchMethod( - Invocation.getter(#server), - returnValue: '', - ) as String); - @override - int get port => (super.noSuchMethod( - Invocation.getter(#port), - returnValue: 0, - ) as int); - @override - bool get useSSL => (super.noSuchMethod( - Invocation.getter(#useSSL), - returnValue: false, - ) as bool); - @override - _i2.Prefs get prefs => (super.noSuchMethod( - Invocation.getter(#prefs), - returnValue: _FakePrefs_0( + _i2.ElectrumX get electrumXClient => (super.noSuchMethod( + Invocation.getter(#electrumXClient), + returnValue: _FakeElectrumX_0( this, - Invocation.getter(#prefs), + Invocation.getter(#electrumXClient), ), - ) as _i2.Prefs); - @override - List<_i8.ElectrumXNode> get failovers => (super.noSuchMethod( - Invocation.getter(#failovers), - returnValue: <_i8.ElectrumXNode>[], - ) as List<_i8.ElectrumXNode>); + ) as _i2.ElectrumX); @override - _i9.Future> getAnonymitySet({ + _i8.Future> getAnonymitySet({ required String? groupId, String? blockhash = r'', - required _i10.Coin? coin, + required _i9.Coin? coin, }) => (super.noSuchMethod( Invocation.method( @@ -137,8 +115,8 @@ class MockCachedElectrumX extends _i1.Mock implements _i7.CachedElectrumX { }, ), returnValue: - _i9.Future>.value({}), - ) as _i9.Future>); + _i8.Future>.value({}), + ) as _i8.Future>); @override String base64ToHex(String? source) => (super.noSuchMethod( Invocation.method( @@ -156,9 +134,9 @@ class MockCachedElectrumX extends _i1.Mock implements _i7.CachedElectrumX { returnValue: '', ) as String); @override - _i9.Future> getTransaction({ + _i8.Future> getTransaction({ required String? txHash, - required _i10.Coin? coin, + required _i9.Coin? coin, bool? verbose = true, }) => (super.noSuchMethod( @@ -172,11 +150,11 @@ class MockCachedElectrumX extends _i1.Mock implements _i7.CachedElectrumX { }, ), returnValue: - _i9.Future>.value({}), - ) as _i9.Future>); + _i8.Future>.value({}), + ) as _i8.Future>); @override - _i9.Future> getUsedCoinSerials({ - required _i10.Coin? coin, + _i8.Future> getUsedCoinSerials({ + required _i9.Coin? coin, int? startNumber = 0, }) => (super.noSuchMethod( @@ -188,43 +166,43 @@ class MockCachedElectrumX extends _i1.Mock implements _i7.CachedElectrumX { #startNumber: startNumber, }, ), - returnValue: _i9.Future>.value([]), - ) as _i9.Future>); + returnValue: _i8.Future>.value([]), + ) as _i8.Future>); @override - _i9.Future clearSharedTransactionCache({required _i10.Coin? coin}) => + _i8.Future clearSharedTransactionCache({required _i9.Coin? coin}) => (super.noSuchMethod( Invocation.method( #clearSharedTransactionCache, [], {#coin: coin}, ), - returnValue: _i9.Future.value(), - returnValueForMissingStub: _i9.Future.value(), - ) as _i9.Future); + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) as _i8.Future); } /// A class which mocks [LocalAuthentication]. /// /// See the documentation for Mockito's code generation for more information. class MockLocalAuthentication extends _i1.Mock - implements _i11.LocalAuthentication { + implements _i10.LocalAuthentication { MockLocalAuthentication() { _i1.throwOnMissingStub(this); } @override - _i9.Future get canCheckBiometrics => (super.noSuchMethod( + _i8.Future get canCheckBiometrics => (super.noSuchMethod( Invocation.getter(#canCheckBiometrics), - returnValue: _i9.Future.value(false), - ) as _i9.Future); + returnValue: _i8.Future.value(false), + ) as _i8.Future); @override - _i9.Future authenticateWithBiometrics({ + _i8.Future authenticateWithBiometrics({ required String? localizedReason, bool? useErrorDialogs = true, bool? stickyAuth = false, - _i12.AndroidAuthMessages? androidAuthStrings = - const _i12.AndroidAuthMessages(), - _i12.IOSAuthMessages? iOSAuthStrings = const _i12.IOSAuthMessages(), + _i11.AndroidAuthMessages? androidAuthStrings = + const _i11.AndroidAuthMessages(), + _i11.IOSAuthMessages? iOSAuthStrings = const _i11.IOSAuthMessages(), bool? sensitiveTransaction = true, }) => (super.noSuchMethod( @@ -240,16 +218,16 @@ class MockLocalAuthentication extends _i1.Mock #sensitiveTransaction: sensitiveTransaction, }, ), - returnValue: _i9.Future.value(false), - ) as _i9.Future); + returnValue: _i8.Future.value(false), + ) as _i8.Future); @override - _i9.Future authenticate({ + _i8.Future authenticate({ required String? localizedReason, bool? useErrorDialogs = true, bool? stickyAuth = false, - _i12.AndroidAuthMessages? androidAuthStrings = - const _i12.AndroidAuthMessages(), - _i12.IOSAuthMessages? iOSAuthStrings = const _i12.IOSAuthMessages(), + _i11.AndroidAuthMessages? androidAuthStrings = + const _i11.AndroidAuthMessages(), + _i11.IOSAuthMessages? iOSAuthStrings = const _i11.IOSAuthMessages(), bool? sensitiveTransaction = true, bool? biometricOnly = false, }) => @@ -267,46 +245,46 @@ class MockLocalAuthentication extends _i1.Mock #biometricOnly: biometricOnly, }, ), - returnValue: _i9.Future.value(false), - ) as _i9.Future); + returnValue: _i8.Future.value(false), + ) as _i8.Future); @override - _i9.Future stopAuthentication() => (super.noSuchMethod( + _i8.Future stopAuthentication() => (super.noSuchMethod( Invocation.method( #stopAuthentication, [], ), - returnValue: _i9.Future.value(false), - ) as _i9.Future); + returnValue: _i8.Future.value(false), + ) as _i8.Future); @override - _i9.Future isDeviceSupported() => (super.noSuchMethod( + _i8.Future isDeviceSupported() => (super.noSuchMethod( Invocation.method( #isDeviceSupported, [], ), - returnValue: _i9.Future.value(false), - ) as _i9.Future); + returnValue: _i8.Future.value(false), + ) as _i8.Future); @override - _i9.Future> getAvailableBiometrics() => + _i8.Future> getAvailableBiometrics() => (super.noSuchMethod( Invocation.method( #getAvailableBiometrics, [], ), returnValue: - _i9.Future>.value(<_i11.BiometricType>[]), - ) as _i9.Future>); + _i8.Future>.value(<_i10.BiometricType>[]), + ) as _i8.Future>); } /// A class which mocks [Biometrics]. /// /// See the documentation for Mockito's code generation for more information. -class MockBiometrics extends _i1.Mock implements _i13.Biometrics { +class MockBiometrics extends _i1.Mock implements _i12.Biometrics { MockBiometrics() { _i1.throwOnMissingStub(this); } @override - _i9.Future authenticate({ + _i8.Future authenticate({ required String? cancelButtonText, required String? localizedReason, required String? title, @@ -321,28 +299,28 @@ class MockBiometrics extends _i1.Mock implements _i13.Biometrics { #title: title, }, ), - returnValue: _i9.Future.value(false), - ) as _i9.Future); + returnValue: _i8.Future.value(false), + ) as _i8.Future); } /// A class which mocks [WalletsService]. /// /// See the documentation for Mockito's code generation for more information. -class MockWalletsService extends _i1.Mock implements _i14.WalletsService { +class MockWalletsService extends _i1.Mock implements _i13.WalletsService { @override - _i9.Future> get walletNames => + _i8.Future> get walletNames => (super.noSuchMethod( Invocation.getter(#walletNames), - returnValue: _i9.Future>.value( - {}), - ) as _i9.Future>); + returnValue: _i8.Future>.value( + {}), + ) as _i8.Future>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); @override - _i9.Future renameWallet({ + _i8.Future renameWallet({ required String? from, required String? to, required bool? shouldNotifyListeners, @@ -357,21 +335,21 @@ class MockWalletsService extends _i1.Mock implements _i14.WalletsService { #shouldNotifyListeners: shouldNotifyListeners, }, ), - returnValue: _i9.Future.value(false), - ) as _i9.Future); + returnValue: _i8.Future.value(false), + ) as _i8.Future); @override - Map fetchWalletsData() => (super.noSuchMethod( + Map fetchWalletsData() => (super.noSuchMethod( Invocation.method( #fetchWalletsData, [], ), - returnValue: {}, - ) as Map); + returnValue: {}, + ) as Map); @override - _i9.Future addExistingStackWallet({ + _i8.Future addExistingStackWallet({ required String? name, required String? walletId, - required _i10.Coin? coin, + required _i9.Coin? coin, required bool? shouldNotifyListeners, }) => (super.noSuchMethod( @@ -385,13 +363,13 @@ class MockWalletsService extends _i1.Mock implements _i14.WalletsService { #shouldNotifyListeners: shouldNotifyListeners, }, ), - returnValue: _i9.Future.value(), - returnValueForMissingStub: _i9.Future.value(), - ) as _i9.Future); + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) as _i8.Future); @override - _i9.Future addNewWallet({ + _i8.Future addNewWallet({ required String? name, - required _i10.Coin? coin, + required _i9.Coin? coin, required bool? shouldNotifyListeners, }) => (super.noSuchMethod( @@ -404,46 +382,46 @@ class MockWalletsService extends _i1.Mock implements _i14.WalletsService { #shouldNotifyListeners: shouldNotifyListeners, }, ), - returnValue: _i9.Future.value(), - ) as _i9.Future); + returnValue: _i8.Future.value(), + ) as _i8.Future); @override - _i9.Future> getFavoriteWalletIds() => (super.noSuchMethod( + _i8.Future> getFavoriteWalletIds() => (super.noSuchMethod( Invocation.method( #getFavoriteWalletIds, [], ), - returnValue: _i9.Future>.value([]), - ) as _i9.Future>); + returnValue: _i8.Future>.value([]), + ) as _i8.Future>); @override - _i9.Future saveFavoriteWalletIds(List? walletIds) => + _i8.Future saveFavoriteWalletIds(List? walletIds) => (super.noSuchMethod( Invocation.method( #saveFavoriteWalletIds, [walletIds], ), - returnValue: _i9.Future.value(), - returnValueForMissingStub: _i9.Future.value(), - ) as _i9.Future); + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) as _i8.Future); @override - _i9.Future addFavorite(String? walletId) => (super.noSuchMethod( + _i8.Future addFavorite(String? walletId) => (super.noSuchMethod( Invocation.method( #addFavorite, [walletId], ), - returnValue: _i9.Future.value(), - returnValueForMissingStub: _i9.Future.value(), - ) as _i9.Future); + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) as _i8.Future); @override - _i9.Future removeFavorite(String? walletId) => (super.noSuchMethod( + _i8.Future removeFavorite(String? walletId) => (super.noSuchMethod( Invocation.method( #removeFavorite, [walletId], ), - returnValue: _i9.Future.value(), - returnValueForMissingStub: _i9.Future.value(), - ) as _i9.Future); + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) as _i8.Future); @override - _i9.Future moveFavorite({ + _i8.Future moveFavorite({ required int? fromIndex, required int? toIndex, }) => @@ -456,48 +434,48 @@ class MockWalletsService extends _i1.Mock implements _i14.WalletsService { #toIndex: toIndex, }, ), - returnValue: _i9.Future.value(), - returnValueForMissingStub: _i9.Future.value(), - ) as _i9.Future); + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) as _i8.Future); @override - _i9.Future checkForDuplicate(String? name) => (super.noSuchMethod( + _i8.Future checkForDuplicate(String? name) => (super.noSuchMethod( Invocation.method( #checkForDuplicate, [name], ), - returnValue: _i9.Future.value(false), - ) as _i9.Future); + returnValue: _i8.Future.value(false), + ) as _i8.Future); @override - _i9.Future getWalletId(String? walletName) => (super.noSuchMethod( + _i8.Future getWalletId(String? walletName) => (super.noSuchMethod( Invocation.method( #getWalletId, [walletName], ), - returnValue: _i9.Future.value(), - ) as _i9.Future); + returnValue: _i8.Future.value(), + ) as _i8.Future); @override - _i9.Future isMnemonicVerified({required String? walletId}) => + _i8.Future isMnemonicVerified({required String? walletId}) => (super.noSuchMethod( Invocation.method( #isMnemonicVerified, [], {#walletId: walletId}, ), - returnValue: _i9.Future.value(false), - ) as _i9.Future); + returnValue: _i8.Future.value(false), + ) as _i8.Future); @override - _i9.Future setMnemonicVerified({required String? walletId}) => + _i8.Future setMnemonicVerified({required String? walletId}) => (super.noSuchMethod( Invocation.method( #setMnemonicVerified, [], {#walletId: walletId}, ), - returnValue: _i9.Future.value(), - returnValueForMissingStub: _i9.Future.value(), - ) as _i9.Future); + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) as _i8.Future); @override - _i9.Future deleteWallet( + _i8.Future deleteWallet( String? name, bool? shouldNotifyListeners, ) => @@ -509,20 +487,20 @@ class MockWalletsService extends _i1.Mock implements _i14.WalletsService { shouldNotifyListeners, ], ), - returnValue: _i9.Future.value(0), - ) as _i9.Future); + returnValue: _i8.Future.value(0), + ) as _i8.Future); @override - _i9.Future refreshWallets(bool? shouldNotifyListeners) => + _i8.Future refreshWallets(bool? shouldNotifyListeners) => (super.noSuchMethod( Invocation.method( #refreshWallets, [shouldNotifyListeners], ), - returnValue: _i9.Future.value(), - returnValueForMissingStub: _i9.Future.value(), - ) as _i9.Future); + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) as _i8.Future); @override - void addListener(_i15.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -530,7 +508,7 @@ class MockWalletsService extends _i1.Mock implements _i14.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i15.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -558,7 +536,7 @@ class MockWalletsService extends _i1.Mock implements _i14.WalletsService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i16.Manager { +class MockManager extends _i1.Mock implements _i14.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -586,10 +564,10 @@ class MockManager extends _i1.Mock implements _i16.Manager { returnValue: false, ) as bool); @override - _i10.Coin get coin => (super.noSuchMethod( + _i9.Coin get coin => (super.noSuchMethod( Invocation.getter(#coin), - returnValue: _i10.Coin.bitcoin, - ) as _i10.Coin); + returnValue: _i9.Coin.bitcoin, + ) as _i9.Coin); @override bool get isRefreshing => (super.noSuchMethod( Invocation.getter(#isRefreshing), @@ -622,23 +600,23 @@ class MockManager extends _i1.Mock implements _i16.Manager { returnValueForMissingStub: null, ); @override - _i9.Future<_i4.FeeObject> get fees => (super.noSuchMethod( + _i8.Future<_i4.FeeObject> get fees => (super.noSuchMethod( Invocation.getter(#fees), - returnValue: _i9.Future<_i4.FeeObject>.value(_FakeFeeObject_2( + returnValue: _i8.Future<_i4.FeeObject>.value(_FakeFeeObject_2( this, Invocation.getter(#fees), )), - ) as _i9.Future<_i4.FeeObject>); + ) as _i8.Future<_i4.FeeObject>); @override - _i9.Future get maxFee => (super.noSuchMethod( + _i8.Future get maxFee => (super.noSuchMethod( Invocation.getter(#maxFee), - returnValue: _i9.Future.value(0), - ) as _i9.Future); + returnValue: _i8.Future.value(0), + ) as _i8.Future); @override - _i9.Future get currentReceivingAddress => (super.noSuchMethod( + _i8.Future get currentReceivingAddress => (super.noSuchMethod( Invocation.getter(#currentReceivingAddress), - returnValue: _i9.Future.value(''), - ) as _i9.Future); + returnValue: _i8.Future.value(''), + ) as _i8.Future); @override _i5.Balance get balance => (super.noSuchMethod( Invocation.getter(#balance), @@ -648,16 +626,16 @@ class MockManager extends _i1.Mock implements _i16.Manager { ), ) as _i5.Balance); @override - _i9.Future> get transactions => (super.noSuchMethod( + _i8.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i9.Future>.value(<_i17.Transaction>[]), - ) as _i9.Future>); + _i8.Future>.value(<_i15.Transaction>[]), + ) as _i8.Future>); @override - _i9.Future> get utxos => (super.noSuchMethod( + _i8.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i9.Future>.value(<_i17.UTXO>[]), - ) as _i9.Future>); + returnValue: _i8.Future>.value(<_i15.UTXO>[]), + ) as _i8.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -677,15 +655,15 @@ class MockManager extends _i1.Mock implements _i16.Manager { returnValue: '', ) as String); @override - _i9.Future> get mnemonic => (super.noSuchMethod( + _i8.Future> get mnemonic => (super.noSuchMethod( Invocation.getter(#mnemonic), - returnValue: _i9.Future>.value([]), - ) as _i9.Future>); + returnValue: _i8.Future>.value([]), + ) as _i8.Future>); @override - _i9.Future get mnemonicPassphrase => (super.noSuchMethod( + _i8.Future get mnemonicPassphrase => (super.noSuchMethod( Invocation.getter(#mnemonicPassphrase), - returnValue: _i9.Future.value(), - ) as _i9.Future); + returnValue: _i8.Future.value(), + ) as _i8.Future); @override bool get isConnected => (super.noSuchMethod( Invocation.getter(#isConnected), @@ -707,6 +685,11 @@ class MockManager extends _i1.Mock implements _i16.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -722,24 +705,24 @@ class MockManager extends _i1.Mock implements _i16.Manager { returnValue: false, ) as bool); @override - _i9.Future get xpub => (super.noSuchMethod( + _i8.Future get xpub => (super.noSuchMethod( Invocation.getter(#xpub), - returnValue: _i9.Future.value(''), - ) as _i9.Future); + returnValue: _i8.Future.value(''), + ) as _i8.Future); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); @override - _i9.Future updateNode(bool? shouldRefresh) => (super.noSuchMethod( + _i8.Future updateNode(bool? shouldRefresh) => (super.noSuchMethod( Invocation.method( #updateNode, [shouldRefresh], ), - returnValue: _i9.Future.value(), - returnValueForMissingStub: _i9.Future.value(), - ) as _i9.Future); + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) as _i8.Future); @override void dispose() => super.noSuchMethod( Invocation.method( @@ -749,7 +732,7 @@ class MockManager extends _i1.Mock implements _i16.Manager { returnValueForMissingStub: null, ); @override - _i9.Future> prepareSend({ + _i8.Future> prepareSend({ required String? address, required _i6.Amount? amount, Map? args, @@ -765,27 +748,27 @@ class MockManager extends _i1.Mock implements _i16.Manager { }, ), returnValue: - _i9.Future>.value({}), - ) as _i9.Future>); + _i8.Future>.value({}), + ) as _i8.Future>); @override - _i9.Future confirmSend({required Map? txData}) => + _i8.Future confirmSend({required Map? txData}) => (super.noSuchMethod( Invocation.method( #confirmSend, [], {#txData: txData}, ), - returnValue: _i9.Future.value(''), - ) as _i9.Future); + returnValue: _i8.Future.value(''), + ) as _i8.Future); @override - _i9.Future refresh() => (super.noSuchMethod( + _i8.Future refresh() => (super.noSuchMethod( Invocation.method( #refresh, [], ), - returnValue: _i9.Future.value(), - returnValueForMissingStub: _i9.Future.value(), - ) as _i9.Future); + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) as _i8.Future); @override bool validateAddress(String? address) => (super.noSuchMethod( Invocation.method( @@ -795,33 +778,33 @@ class MockManager extends _i1.Mock implements _i16.Manager { returnValue: false, ) as bool); @override - _i9.Future testNetworkConnection() => (super.noSuchMethod( + _i8.Future testNetworkConnection() => (super.noSuchMethod( Invocation.method( #testNetworkConnection, [], ), - returnValue: _i9.Future.value(false), - ) as _i9.Future); + returnValue: _i8.Future.value(false), + ) as _i8.Future); @override - _i9.Future initializeNew() => (super.noSuchMethod( + _i8.Future initializeNew() => (super.noSuchMethod( Invocation.method( #initializeNew, [], ), - returnValue: _i9.Future.value(), - returnValueForMissingStub: _i9.Future.value(), - ) as _i9.Future); + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) as _i8.Future); @override - _i9.Future initializeExisting() => (super.noSuchMethod( + _i8.Future initializeExisting() => (super.noSuchMethod( Invocation.method( #initializeExisting, [], ), - returnValue: _i9.Future.value(), - returnValueForMissingStub: _i9.Future.value(), - ) as _i9.Future); + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) as _i8.Future); @override - _i9.Future recoverFromMnemonic({ + _i8.Future recoverFromMnemonic({ required String? mnemonic, String? mnemonicPassphrase, required int? maxUnusedAddressGap, @@ -840,20 +823,20 @@ class MockManager extends _i1.Mock implements _i16.Manager { #height: height, }, ), - returnValue: _i9.Future.value(), - returnValueForMissingStub: _i9.Future.value(), - ) as _i9.Future); + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) as _i8.Future); @override - _i9.Future exitCurrentWallet() => (super.noSuchMethod( + _i8.Future exitCurrentWallet() => (super.noSuchMethod( Invocation.method( #exitCurrentWallet, [], ), - returnValue: _i9.Future.value(), - returnValueForMissingStub: _i9.Future.value(), - ) as _i9.Future); + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) as _i8.Future); @override - _i9.Future fullRescan( + _i8.Future fullRescan( int? maxUnusedAddressGap, int? maxNumberOfIndexesToCheck, ) => @@ -865,11 +848,11 @@ class MockManager extends _i1.Mock implements _i16.Manager { maxNumberOfIndexesToCheck, ], ), - returnValue: _i9.Future.value(), - returnValueForMissingStub: _i9.Future.value(), - ) as _i9.Future); + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) as _i8.Future); @override - _i9.Future<_i6.Amount> estimateFeeFor( + _i8.Future<_i6.Amount> estimateFeeFor( _i6.Amount? amount, int? feeRate, ) => @@ -881,7 +864,7 @@ class MockManager extends _i1.Mock implements _i16.Manager { feeRate, ], ), - returnValue: _i9.Future<_i6.Amount>.value(_FakeAmount_4( + returnValue: _i8.Future<_i6.Amount>.value(_FakeAmount_4( this, Invocation.method( #estimateFeeFor, @@ -891,26 +874,26 @@ class MockManager extends _i1.Mock implements _i16.Manager { ], ), )), - ) as _i9.Future<_i6.Amount>); + ) as _i8.Future<_i6.Amount>); @override - _i9.Future generateNewAddress() => (super.noSuchMethod( + _i8.Future generateNewAddress() => (super.noSuchMethod( Invocation.method( #generateNewAddress, [], ), - returnValue: _i9.Future.value(false), - ) as _i9.Future); + returnValue: _i8.Future.value(false), + ) as _i8.Future); @override - _i9.Future resetRescanOnOpen() => (super.noSuchMethod( + _i8.Future resetRescanOnOpen() => (super.noSuchMethod( Invocation.method( #resetRescanOnOpen, [], ), - returnValue: _i9.Future.value(), - returnValueForMissingStub: _i9.Future.value(), - ) as _i9.Future); + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) as _i8.Future); @override - void addListener(_i15.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -918,7 +901,7 @@ class MockManager extends _i1.Mock implements _i16.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i15.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_view_screen_test.mocks.dart index 9adc92a2cb..3a2cbf82d2 100644 --- a/test/screen_tests/settings_view/settings_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_view_screen_test.mocks.dart @@ -1,17 +1,16 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/settings_view/settings_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i7; -import 'dart:ui' as _i9; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i11; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i10; import 'package:stackduo/models/models.dart' as _i3; import 'package:stackduo/services/coins/coin_service.dart' as _i2; -import 'package:stackduo/services/coins/manager.dart' as _i10; +import 'package:stackduo/services/coins/manager.dart' as _i9; import 'package:stackduo/services/wallets_service.dart' as _i6; import 'package:stackduo/utilities/amount/amount.dart' as _i5; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i8; @@ -265,7 +264,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -273,7 +272,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -301,7 +300,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i10.Manager { +class MockManager extends _i1.Mock implements _i9.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -391,16 +390,16 @@ class MockManager extends _i1.Mock implements _i10.Manager { ), ) as _i4.Balance); @override - _i7.Future> get transactions => (super.noSuchMethod( + _i7.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i7.Future>.value(<_i11.Transaction>[]), - ) as _i7.Future>); + _i7.Future>.value(<_i10.Transaction>[]), + ) as _i7.Future>); @override - _i7.Future> get utxos => (super.noSuchMethod( + _i7.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i7.Future>.value(<_i11.UTXO>[]), - ) as _i7.Future>); + returnValue: _i7.Future>.value(<_i10.UTXO>[]), + ) as _i7.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -450,6 +449,11 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -653,7 +657,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -661,7 +665,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.mocks.dart b/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.mocks.dart index 22a63e60a6..c67bf0e5e0 100644 --- a/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.mocks.dart +++ b/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.mocks.dart @@ -1,15 +1,14 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i4; -import 'dart:ui' as _i5; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/isar/models/contact_entry.dart' as _i2; -import 'package:stackduo/services/address_book_service.dart' as _i6; -import 'package:stackduo/services/locale_service.dart' as _i7; +import 'package:stackduo/services/address_book_service.dart' as _i5; +import 'package:stackduo/services/locale_service.dart' as _i6; import 'package:stackduo/services/notes_service.dart' as _i3; // ignore_for_file: type=lint @@ -102,7 +101,7 @@ class MockNotesService extends _i1.Mock implements _i3.NotesService { returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - void addListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -110,7 +109,7 @@ class MockNotesService extends _i1.Mock implements _i3.NotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -139,7 +138,7 @@ class MockNotesService extends _i1.Mock implements _i3.NotesService { /// /// See the documentation for Mockito's code generation for more information. class MockAddressBookService extends _i1.Mock - implements _i6.AddressBookService { + implements _i5.AddressBookService { @override List<_i2.ContactEntry> get contacts => (super.noSuchMethod( Invocation.getter(#contacts), @@ -216,7 +215,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - void addListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -224,7 +223,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: null, ); @override - void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -252,7 +251,7 @@ class MockAddressBookService extends _i1.Mock /// A class which mocks [LocaleService]. /// /// See the documentation for Mockito's code generation for more information. -class MockLocaleService extends _i1.Mock implements _i7.LocaleService { +class MockLocaleService extends _i1.Mock implements _i6.LocaleService { @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), @@ -274,7 +273,7 @@ class MockLocaleService extends _i1.Mock implements _i7.LocaleService { returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - void addListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -282,7 +281,7 @@ class MockLocaleService extends _i1.Mock implements _i7.LocaleService { returnValueForMissingStub: null, ); @override - void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/transaction_subviews/transaction_search_results_view_screen_test.mocks.dart b/test/screen_tests/transaction_subviews/transaction_search_results_view_screen_test.mocks.dart index 865675c14d..ab5382202f 100644 --- a/test/screen_tests/transaction_subviews/transaction_search_results_view_screen_test.mocks.dart +++ b/test/screen_tests/transaction_subviews/transaction_search_results_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/transaction_subviews/transaction_search_results_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; @@ -12,8 +11,8 @@ import 'package:stackduo/models/isar/models/isar_models.dart' as _i9; import 'package:stackduo/models/models.dart' as _i3; import 'package:stackduo/services/coins/coin_service.dart' as _i2; import 'package:stackduo/services/coins/manager.dart' as _i6; -import 'package:stackduo/services/locale_service.dart' as _i12; -import 'package:stackduo/services/notes_service.dart' as _i11; +import 'package:stackduo/services/locale_service.dart' as _i11; +import 'package:stackduo/services/notes_service.dart' as _i10; import 'package:stackduo/utilities/amount/amount.dart' as _i5; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i7; @@ -221,6 +220,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -424,7 +428,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -432,7 +436,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -452,7 +456,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { /// A class which mocks [NotesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNotesService extends _i1.Mock implements _i11.NotesService { +class MockNotesService extends _i1.Mock implements _i10.NotesService { @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), @@ -518,7 +522,7 @@ class MockNotesService extends _i1.Mock implements _i11.NotesService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -526,7 +530,7 @@ class MockNotesService extends _i1.Mock implements _i11.NotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -554,7 +558,7 @@ class MockNotesService extends _i1.Mock implements _i11.NotesService { /// A class which mocks [LocaleService]. /// /// See the documentation for Mockito's code generation for more information. -class MockLocaleService extends _i1.Mock implements _i12.LocaleService { +class MockLocaleService extends _i1.Mock implements _i11.LocaleService { @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), @@ -576,7 +580,7 @@ class MockLocaleService extends _i1.Mock implements _i12.LocaleService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -584,7 +588,7 @@ class MockLocaleService extends _i1.Mock implements _i12.LocaleService { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.mocks.dart b/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.mocks.dart index 0b8520813d..2cbcd57fee 100644 --- a/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.mocks.dart +++ b/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.mocks.dart @@ -1,15 +1,14 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i4; -import 'dart:ui' as _i5; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/isar/models/contact_entry.dart' as _i2; import 'package:stackduo/services/address_book_service.dart' as _i3; -import 'package:stackduo/services/notes_service.dart' as _i6; +import 'package:stackduo/services/notes_service.dart' as _i5; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -113,7 +112,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - void addListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -121,7 +120,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: null, ); @override - void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -149,7 +148,7 @@ class MockAddressBookService extends _i1.Mock /// A class which mocks [NotesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNotesService extends _i1.Mock implements _i6.NotesService { +class MockNotesService extends _i1.Mock implements _i5.NotesService { @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), @@ -215,7 +214,7 @@ class MockNotesService extends _i1.Mock implements _i6.NotesService { returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - void addListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -223,7 +222,7 @@ class MockNotesService extends _i1.Mock implements _i6.NotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/wallet_view/confirm_send_view_screen_test.mocks.dart b/test/screen_tests/wallet_view/confirm_send_view_screen_test.mocks.dart index 08d1ce9dd7..5b874e20bd 100644 --- a/test/screen_tests/wallet_view/confirm_send_view_screen_test.mocks.dart +++ b/test/screen_tests/wallet_view/confirm_send_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/wallet_view/confirm_send_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; @@ -12,7 +11,7 @@ import 'package:stackduo/models/isar/models/isar_models.dart' as _i9; import 'package:stackduo/models/models.dart' as _i3; import 'package:stackduo/services/coins/coin_service.dart' as _i2; import 'package:stackduo/services/coins/manager.dart' as _i6; -import 'package:stackduo/services/notes_service.dart' as _i11; +import 'package:stackduo/services/notes_service.dart' as _i10; import 'package:stackduo/utilities/amount/amount.dart' as _i5; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i7; @@ -220,6 +219,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -423,7 +427,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -431,7 +435,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -451,7 +455,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { /// A class which mocks [NotesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNotesService extends _i1.Mock implements _i11.NotesService { +class MockNotesService extends _i1.Mock implements _i10.NotesService { @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), @@ -517,7 +521,7 @@ class MockNotesService extends _i1.Mock implements _i11.NotesService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -525,7 +529,7 @@ class MockNotesService extends _i1.Mock implements _i11.NotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/wallet_view/receive_view_screen_test.mocks.dart b/test/screen_tests/wallet_view/receive_view_screen_test.mocks.dart index 91c7e023c7..5a7116c687 100644 --- a/test/screen_tests/wallet_view/receive_view_screen_test.mocks.dart +++ b/test/screen_tests/wallet_view/receive_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/wallet_view/receive_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; @@ -219,6 +218,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -422,7 +426,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -430,7 +434,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/wallet_view/send_view_screen_test.mocks.dart b/test/screen_tests/wallet_view/send_view_screen_test.mocks.dart index f6d4d33dfd..d62512015e 100644 --- a/test/screen_tests/wallet_view/send_view_screen_test.mocks.dart +++ b/test/screen_tests/wallet_view/send_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/wallet_view/send_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i12; import 'package:barcode_scan2/barcode_scan2.dart' as _i2; import 'package:mockito/mockito.dart' as _i1; @@ -13,7 +12,7 @@ import 'package:stackduo/models/isar/models/isar_models.dart' as _i11; import 'package:stackduo/models/models.dart' as _i4; import 'package:stackduo/services/coins/coin_service.dart' as _i3; import 'package:stackduo/services/coins/manager.dart' as _i9; -import 'package:stackduo/services/notes_service.dart' as _i13; +import 'package:stackduo/services/notes_service.dart' as _i12; import 'package:stackduo/utilities/amount/amount.dart' as _i6; import 'package:stackduo/utilities/barcode_scanner_interface.dart' as _i7; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i10; @@ -261,6 +260,11 @@ class MockManager extends _i1.Mock implements _i9.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -464,7 +468,7 @@ class MockManager extends _i1.Mock implements _i9.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i12.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -472,7 +476,7 @@ class MockManager extends _i1.Mock implements _i9.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -492,7 +496,7 @@ class MockManager extends _i1.Mock implements _i9.Manager { /// A class which mocks [NotesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNotesService extends _i1.Mock implements _i13.NotesService { +class MockNotesService extends _i1.Mock implements _i12.NotesService { @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), @@ -558,7 +562,7 @@ class MockNotesService extends _i1.Mock implements _i13.NotesService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i12.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -566,7 +570,7 @@ class MockNotesService extends _i1.Mock implements _i13.NotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/wallet_view/wallet_view_screen_test.mocks.dart b/test/screen_tests/wallet_view/wallet_view_screen_test.mocks.dart index f097be991a..6ccae9c67e 100644 --- a/test/screen_tests/wallet_view/wallet_view_screen_test.mocks.dart +++ b/test/screen_tests/wallet_view/wallet_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/wallet_view/wallet_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; @@ -12,8 +11,8 @@ import 'package:stackduo/models/isar/models/isar_models.dart' as _i9; import 'package:stackduo/models/models.dart' as _i3; import 'package:stackduo/services/coins/coin_service.dart' as _i2; import 'package:stackduo/services/coins/manager.dart' as _i6; -import 'package:stackduo/services/locale_service.dart' as _i12; -import 'package:stackduo/services/notes_service.dart' as _i11; +import 'package:stackduo/services/locale_service.dart' as _i11; +import 'package:stackduo/services/notes_service.dart' as _i10; import 'package:stackduo/utilities/amount/amount.dart' as _i5; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i7; @@ -221,6 +220,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -424,7 +428,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -432,7 +436,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -452,7 +456,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { /// A class which mocks [NotesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNotesService extends _i1.Mock implements _i11.NotesService { +class MockNotesService extends _i1.Mock implements _i10.NotesService { @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), @@ -518,7 +522,7 @@ class MockNotesService extends _i1.Mock implements _i11.NotesService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -526,7 +530,7 @@ class MockNotesService extends _i1.Mock implements _i11.NotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -554,7 +558,7 @@ class MockNotesService extends _i1.Mock implements _i11.NotesService { /// A class which mocks [LocaleService]. /// /// See the documentation for Mockito's code generation for more information. -class MockLocaleService extends _i1.Mock implements _i12.LocaleService { +class MockLocaleService extends _i1.Mock implements _i11.LocaleService { @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), @@ -576,7 +580,7 @@ class MockLocaleService extends _i1.Mock implements _i12.LocaleService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -584,7 +588,7 @@ class MockLocaleService extends _i1.Mock implements _i12.LocaleService { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/services/change_now/change_now_test.mocks.dart b/test/services/change_now/change_now_test.mocks.dart index 9251ea6eb7..ac466dff9a 100644 --- a/test/services/change_now/change_now_test.mocks.dart +++ b/test/services/change_now/change_now_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/services/change_now/change_now_test.dart. // Do not manually edit this file. diff --git a/test/services/coins/bitcoin/bitcoin_wallet_test.mocks.dart b/test/services/coins/bitcoin/bitcoin_wallet_test.mocks.dart index 139ef28fd8..36bed59f43 100644 --- a/test/services/coins/bitcoin/bitcoin_wallet_test.mocks.dart +++ b/test/services/coins/bitcoin/bitcoin_wallet_test.mocks.dart @@ -1,17 +1,16 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/services/coins/bitcoin/bitcoin_wallet_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i5; +import 'dart:async' as _i4; import 'package:decimal/decimal.dart' as _i2; import 'package:mockito/mockito.dart' as _i1; -import 'package:stackduo/electrumx_rpc/cached_electrumx.dart' as _i6; -import 'package:stackduo/electrumx_rpc/electrumx.dart' as _i4; -import 'package:stackduo/services/transaction_notification_tracker.dart' as _i8; -import 'package:stackduo/utilities/enums/coin_enum.dart' as _i7; -import 'package:stackduo/utilities/prefs.dart' as _i3; +import 'package:stackduo/electrumx_rpc/cached_electrumx.dart' as _i5; +import 'package:stackduo/electrumx_rpc/electrumx.dart' as _i3; +import 'package:stackduo/services/transaction_notification_tracker.dart' as _i7; +import 'package:stackduo/utilities/enums/coin_enum.dart' as _i6; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -34,8 +33,8 @@ class _FakeDecimal_0 extends _i1.SmartFake implements _i2.Decimal { ); } -class _FakePrefs_1 extends _i1.SmartFake implements _i3.Prefs { - _FakePrefs_1( +class _FakeElectrumX_1 extends _i1.SmartFake implements _i3.ElectrumX { + _FakeElectrumX_1( Object parent, Invocation parentInvocation, ) : super( @@ -47,13 +46,13 @@ class _FakePrefs_1 extends _i1.SmartFake implements _i3.Prefs { /// A class which mocks [ElectrumX]. /// /// See the documentation for Mockito's code generation for more information. -class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { +class MockElectrumX extends _i1.Mock implements _i3.ElectrumX { MockElectrumX() { _i1.throwOnMissingStub(this); } @override - set failovers(List<_i4.ElectrumXNode>? _failovers) => super.noSuchMethod( + set failovers(List<_i3.ElectrumXNode>? _failovers) => super.noSuchMethod( Invocation.setter( #failovers, _failovers, @@ -89,7 +88,7 @@ class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { returnValue: false, ) as bool); @override - _i5.Future request({ + _i4.Future request({ required String? command, List? args = const [], Duration? connectionTimeout = const Duration(seconds: 60), @@ -108,10 +107,10 @@ class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { #retries: retries, }, ), - returnValue: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i4.Future.value(), + ) as _i4.Future); @override - _i5.Future>> batchRequest({ + _i4.Future>> batchRequest({ required String? command, required Map>? args, Duration? connectionTimeout = const Duration(seconds: 60), @@ -128,11 +127,11 @@ class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { #retries: retries, }, ), - returnValue: _i5.Future>>.value( + returnValue: _i4.Future>>.value( >[]), - ) as _i5.Future>>); + ) as _i4.Future>>); @override - _i5.Future ping({ + _i4.Future ping({ String? requestID, int? retryCount = 1, }) => @@ -145,10 +144,10 @@ class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { #retryCount: retryCount, }, ), - returnValue: _i5.Future.value(false), - ) as _i5.Future); + returnValue: _i4.Future.value(false), + ) as _i4.Future); @override - _i5.Future> getBlockHeadTip({String? requestID}) => + _i4.Future> getBlockHeadTip({String? requestID}) => (super.noSuchMethod( Invocation.method( #getBlockHeadTip, @@ -156,10 +155,10 @@ class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { {#requestID: requestID}, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i4.Future>.value({}), + ) as _i4.Future>); @override - _i5.Future> getServerFeatures({String? requestID}) => + _i4.Future> getServerFeatures({String? requestID}) => (super.noSuchMethod( Invocation.method( #getServerFeatures, @@ -167,10 +166,10 @@ class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { {#requestID: requestID}, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i4.Future>.value({}), + ) as _i4.Future>); @override - _i5.Future broadcastTransaction({ + _i4.Future broadcastTransaction({ required String? rawTx, String? requestID, }) => @@ -183,10 +182,10 @@ class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { #requestID: requestID, }, ), - returnValue: _i5.Future.value(''), - ) as _i5.Future); + returnValue: _i4.Future.value(''), + ) as _i4.Future); @override - _i5.Future> getBalance({ + _i4.Future> getBalance({ required String? scripthash, String? requestID, }) => @@ -200,10 +199,10 @@ class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i4.Future>.value({}), + ) as _i4.Future>); @override - _i5.Future>> getHistory({ + _i4.Future>> getHistory({ required String? scripthash, String? requestID, }) => @@ -216,11 +215,11 @@ class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { #requestID: requestID, }, ), - returnValue: _i5.Future>>.value( + returnValue: _i4.Future>>.value( >[]), - ) as _i5.Future>>); + ) as _i4.Future>>); @override - _i5.Future>>> getBatchHistory( + _i4.Future>>> getBatchHistory( {required Map>? args}) => (super.noSuchMethod( Invocation.method( @@ -228,11 +227,11 @@ class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { [], {#args: args}, ), - returnValue: _i5.Future>>>.value( + returnValue: _i4.Future>>>.value( >>{}), - ) as _i5.Future>>>); + ) as _i4.Future>>>); @override - _i5.Future>> getUTXOs({ + _i4.Future>> getUTXOs({ required String? scripthash, String? requestID, }) => @@ -245,11 +244,11 @@ class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { #requestID: requestID, }, ), - returnValue: _i5.Future>>.value( + returnValue: _i4.Future>>.value( >[]), - ) as _i5.Future>>); + ) as _i4.Future>>); @override - _i5.Future>>> getBatchUTXOs( + _i4.Future>>> getBatchUTXOs( {required Map>? args}) => (super.noSuchMethod( Invocation.method( @@ -257,11 +256,11 @@ class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { [], {#args: args}, ), - returnValue: _i5.Future>>>.value( + returnValue: _i4.Future>>>.value( >>{}), - ) as _i5.Future>>>); + ) as _i4.Future>>>); @override - _i5.Future> getTransaction({ + _i4.Future> getTransaction({ required String? txHash, bool? verbose = true, String? requestID, @@ -277,10 +276,10 @@ class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i4.Future>.value({}), + ) as _i4.Future>); @override - _i5.Future> getAnonymitySet({ + _i4.Future> getAnonymitySet({ String? groupId = r'1', String? blockhash = r'', String? requestID, @@ -296,10 +295,10 @@ class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i4.Future>.value({}), + ) as _i4.Future>); @override - _i5.Future getMintData({ + _i4.Future getMintData({ dynamic mints, String? requestID, }) => @@ -312,10 +311,10 @@ class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { #requestID: requestID, }, ), - returnValue: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i4.Future.value(), + ) as _i4.Future); @override - _i5.Future> getUsedCoinSerials({ + _i4.Future> getUsedCoinSerials({ String? requestID, required int? startNumber, }) => @@ -329,19 +328,19 @@ class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i4.Future>.value({}), + ) as _i4.Future>); @override - _i5.Future getLatestCoinId({String? requestID}) => (super.noSuchMethod( + _i4.Future getLatestCoinId({String? requestID}) => (super.noSuchMethod( Invocation.method( #getLatestCoinId, [], {#requestID: requestID}, ), - returnValue: _i5.Future.value(0), - ) as _i5.Future); + returnValue: _i4.Future.value(0), + ) as _i4.Future); @override - _i5.Future> getFeeRate({String? requestID}) => + _i4.Future> getFeeRate({String? requestID}) => (super.noSuchMethod( Invocation.method( #getFeeRate, @@ -349,10 +348,10 @@ class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { {#requestID: requestID}, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i4.Future>.value({}), + ) as _i4.Future>); @override - _i5.Future<_i2.Decimal> estimateFee({ + _i4.Future<_i2.Decimal> estimateFee({ String? requestID, required int? blocks, }) => @@ -365,7 +364,7 @@ class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { #blocks: blocks, }, ), - returnValue: _i5.Future<_i2.Decimal>.value(_FakeDecimal_0( + returnValue: _i4.Future<_i2.Decimal>.value(_FakeDecimal_0( this, Invocation.method( #estimateFee, @@ -376,15 +375,15 @@ class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { }, ), )), - ) as _i5.Future<_i2.Decimal>); + ) as _i4.Future<_i2.Decimal>); @override - _i5.Future<_i2.Decimal> relayFee({String? requestID}) => (super.noSuchMethod( + _i4.Future<_i2.Decimal> relayFee({String? requestID}) => (super.noSuchMethod( Invocation.method( #relayFee, [], {#requestID: requestID}, ), - returnValue: _i5.Future<_i2.Decimal>.value(_FakeDecimal_0( + returnValue: _i4.Future<_i2.Decimal>.value(_FakeDecimal_0( this, Invocation.method( #relayFee, @@ -392,50 +391,30 @@ class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { {#requestID: requestID}, ), )), - ) as _i5.Future<_i2.Decimal>); + ) as _i4.Future<_i2.Decimal>); } /// A class which mocks [CachedElectrumX]. /// /// See the documentation for Mockito's code generation for more information. -class MockCachedElectrumX extends _i1.Mock implements _i6.CachedElectrumX { +class MockCachedElectrumX extends _i1.Mock implements _i5.CachedElectrumX { MockCachedElectrumX() { _i1.throwOnMissingStub(this); } @override - String get server => (super.noSuchMethod( - Invocation.getter(#server), - returnValue: '', - ) as String); - @override - int get port => (super.noSuchMethod( - Invocation.getter(#port), - returnValue: 0, - ) as int); - @override - bool get useSSL => (super.noSuchMethod( - Invocation.getter(#useSSL), - returnValue: false, - ) as bool); - @override - _i3.Prefs get prefs => (super.noSuchMethod( - Invocation.getter(#prefs), - returnValue: _FakePrefs_1( + _i3.ElectrumX get electrumXClient => (super.noSuchMethod( + Invocation.getter(#electrumXClient), + returnValue: _FakeElectrumX_1( this, - Invocation.getter(#prefs), + Invocation.getter(#electrumXClient), ), - ) as _i3.Prefs); - @override - List<_i4.ElectrumXNode> get failovers => (super.noSuchMethod( - Invocation.getter(#failovers), - returnValue: <_i4.ElectrumXNode>[], - ) as List<_i4.ElectrumXNode>); + ) as _i3.ElectrumX); @override - _i5.Future> getAnonymitySet({ + _i4.Future> getAnonymitySet({ required String? groupId, String? blockhash = r'', - required _i7.Coin? coin, + required _i6.Coin? coin, }) => (super.noSuchMethod( Invocation.method( @@ -448,8 +427,8 @@ class MockCachedElectrumX extends _i1.Mock implements _i6.CachedElectrumX { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i4.Future>.value({}), + ) as _i4.Future>); @override String base64ToHex(String? source) => (super.noSuchMethod( Invocation.method( @@ -467,9 +446,9 @@ class MockCachedElectrumX extends _i1.Mock implements _i6.CachedElectrumX { returnValue: '', ) as String); @override - _i5.Future> getTransaction({ + _i4.Future> getTransaction({ required String? txHash, - required _i7.Coin? coin, + required _i6.Coin? coin, bool? verbose = true, }) => (super.noSuchMethod( @@ -483,11 +462,11 @@ class MockCachedElectrumX extends _i1.Mock implements _i6.CachedElectrumX { }, ), returnValue: - _i5.Future>.value({}), - ) as _i5.Future>); + _i4.Future>.value({}), + ) as _i4.Future>); @override - _i5.Future> getUsedCoinSerials({ - required _i7.Coin? coin, + _i4.Future> getUsedCoinSerials({ + required _i6.Coin? coin, int? startNumber = 0, }) => (super.noSuchMethod( @@ -499,26 +478,26 @@ class MockCachedElectrumX extends _i1.Mock implements _i6.CachedElectrumX { #startNumber: startNumber, }, ), - returnValue: _i5.Future>.value([]), - ) as _i5.Future>); + returnValue: _i4.Future>.value([]), + ) as _i4.Future>); @override - _i5.Future clearSharedTransactionCache({required _i7.Coin? coin}) => + _i4.Future clearSharedTransactionCache({required _i6.Coin? coin}) => (super.noSuchMethod( Invocation.method( #clearSharedTransactionCache, [], {#coin: coin}, ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); } /// A class which mocks [TransactionNotificationTracker]. /// /// See the documentation for Mockito's code generation for more information. class MockTransactionNotificationTracker extends _i1.Mock - implements _i8.TransactionNotificationTracker { + implements _i7.TransactionNotificationTracker { MockTransactionNotificationTracker() { _i1.throwOnMissingStub(this); } @@ -547,14 +526,14 @@ class MockTransactionNotificationTracker extends _i1.Mock returnValue: false, ) as bool); @override - _i5.Future addNotifiedPending(String? txid) => (super.noSuchMethod( + _i4.Future addNotifiedPending(String? txid) => (super.noSuchMethod( Invocation.method( #addNotifiedPending, [txid], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override bool wasNotifiedConfirmed(String? txid) => (super.noSuchMethod( Invocation.method( @@ -564,21 +543,21 @@ class MockTransactionNotificationTracker extends _i1.Mock returnValue: false, ) as bool); @override - _i5.Future addNotifiedConfirmed(String? txid) => (super.noSuchMethod( + _i4.Future addNotifiedConfirmed(String? txid) => (super.noSuchMethod( Invocation.method( #addNotifiedConfirmed, [txid], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override - _i5.Future deleteTransaction(String? txid) => (super.noSuchMethod( + _i4.Future deleteTransaction(String? txid) => (super.noSuchMethod( Invocation.method( #deleteTransaction, [txid], ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); } diff --git a/test/services/coins/bitcoincash/bitcoincash_wallet_test.mocks.dart b/test/services/coins/bitcoincash/bitcoincash_wallet_test.mocks.dart new file mode 100644 index 0000000000..2e39e6916c --- /dev/null +++ b/test/services/coins/bitcoincash/bitcoincash_wallet_test.mocks.dart @@ -0,0 +1,564 @@ +// Mocks generated by Mockito 5.3.2 from annotations +// in stackwallet/test/services/coins/bitcoincash/bitcoincash_wallet_test.dart. +// Do not manually edit this file. + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'dart:async' as _i4; + +import 'package:decimal/decimal.dart' as _i2; +import 'package:mockito/mockito.dart' as _i1; +import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i5; +import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i3; +import 'package:stackwallet/services/transaction_notification_tracker.dart' + as _i7; +import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i6; + +// ignore_for_file: type=lint +// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_setters_without_getters +// ignore_for_file: comment_references +// ignore_for_file: implementation_imports +// ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class + +class _FakeDecimal_0 extends _i1.SmartFake implements _i2.Decimal { + _FakeDecimal_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeElectrumX_1 extends _i1.SmartFake implements _i3.ElectrumX { + _FakeElectrumX_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +/// A class which mocks [ElectrumX]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockElectrumX extends _i1.Mock implements _i3.ElectrumX { + MockElectrumX() { + _i1.throwOnMissingStub(this); + } + + @override + set failovers(List<_i3.ElectrumXNode>? _failovers) => super.noSuchMethod( + Invocation.setter( + #failovers, + _failovers, + ), + returnValueForMissingStub: null, + ); + @override + int get currentFailoverIndex => (super.noSuchMethod( + Invocation.getter(#currentFailoverIndex), + returnValue: 0, + ) as int); + @override + set currentFailoverIndex(int? _currentFailoverIndex) => super.noSuchMethod( + Invocation.setter( + #currentFailoverIndex, + _currentFailoverIndex, + ), + returnValueForMissingStub: null, + ); + @override + String get host => (super.noSuchMethod( + Invocation.getter(#host), + returnValue: '', + ) as String); + @override + int get port => (super.noSuchMethod( + Invocation.getter(#port), + returnValue: 0, + ) as int); + @override + bool get useSSL => (super.noSuchMethod( + Invocation.getter(#useSSL), + returnValue: false, + ) as bool); + @override + _i4.Future request({ + required String? command, + List? args = const [], + Duration? connectionTimeout = const Duration(seconds: 60), + String? requestID, + int? retries = 2, + }) => + (super.noSuchMethod( + Invocation.method( + #request, + [], + { + #command: command, + #args: args, + #connectionTimeout: connectionTimeout, + #requestID: requestID, + #retries: retries, + }, + ), + returnValue: _i4.Future.value(), + ) as _i4.Future); + @override + _i4.Future>> batchRequest({ + required String? command, + required Map>? args, + Duration? connectionTimeout = const Duration(seconds: 60), + int? retries = 2, + }) => + (super.noSuchMethod( + Invocation.method( + #batchRequest, + [], + { + #command: command, + #args: args, + #connectionTimeout: connectionTimeout, + #retries: retries, + }, + ), + returnValue: _i4.Future>>.value( + >[]), + ) as _i4.Future>>); + @override + _i4.Future ping({ + String? requestID, + int? retryCount = 1, + }) => + (super.noSuchMethod( + Invocation.method( + #ping, + [], + { + #requestID: requestID, + #retryCount: retryCount, + }, + ), + returnValue: _i4.Future.value(false), + ) as _i4.Future); + @override + _i4.Future> getBlockHeadTip({String? requestID}) => + (super.noSuchMethod( + Invocation.method( + #getBlockHeadTip, + [], + {#requestID: requestID}, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future> getServerFeatures({String? requestID}) => + (super.noSuchMethod( + Invocation.method( + #getServerFeatures, + [], + {#requestID: requestID}, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future broadcastTransaction({ + required String? rawTx, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #broadcastTransaction, + [], + { + #rawTx: rawTx, + #requestID: requestID, + }, + ), + returnValue: _i4.Future.value(''), + ) as _i4.Future); + @override + _i4.Future> getBalance({ + required String? scripthash, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getBalance, + [], + { + #scripthash: scripthash, + #requestID: requestID, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future>> getHistory({ + required String? scripthash, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getHistory, + [], + { + #scripthash: scripthash, + #requestID: requestID, + }, + ), + returnValue: _i4.Future>>.value( + >[]), + ) as _i4.Future>>); + @override + _i4.Future>>> getBatchHistory( + {required Map>? args}) => + (super.noSuchMethod( + Invocation.method( + #getBatchHistory, + [], + {#args: args}, + ), + returnValue: _i4.Future>>>.value( + >>{}), + ) as _i4.Future>>>); + @override + _i4.Future>> getUTXOs({ + required String? scripthash, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getUTXOs, + [], + { + #scripthash: scripthash, + #requestID: requestID, + }, + ), + returnValue: _i4.Future>>.value( + >[]), + ) as _i4.Future>>); + @override + _i4.Future>>> getBatchUTXOs( + {required Map>? args}) => + (super.noSuchMethod( + Invocation.method( + #getBatchUTXOs, + [], + {#args: args}, + ), + returnValue: _i4.Future>>>.value( + >>{}), + ) as _i4.Future>>>); + @override + _i4.Future> getTransaction({ + required String? txHash, + bool? verbose = true, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getTransaction, + [], + { + #txHash: txHash, + #verbose: verbose, + #requestID: requestID, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future> getAnonymitySet({ + String? groupId = r'1', + String? blockhash = r'', + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getAnonymitySet, + [], + { + #groupId: groupId, + #blockhash: blockhash, + #requestID: requestID, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future getMintData({ + dynamic mints, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getMintData, + [], + { + #mints: mints, + #requestID: requestID, + }, + ), + returnValue: _i4.Future.value(), + ) as _i4.Future); + @override + _i4.Future> getUsedCoinSerials({ + String? requestID, + required int? startNumber, + }) => + (super.noSuchMethod( + Invocation.method( + #getUsedCoinSerials, + [], + { + #requestID: requestID, + #startNumber: startNumber, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future getLatestCoinId({String? requestID}) => (super.noSuchMethod( + Invocation.method( + #getLatestCoinId, + [], + {#requestID: requestID}, + ), + returnValue: _i4.Future.value(0), + ) as _i4.Future); + @override + _i4.Future> getFeeRate({String? requestID}) => + (super.noSuchMethod( + Invocation.method( + #getFeeRate, + [], + {#requestID: requestID}, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future<_i2.Decimal> estimateFee({ + String? requestID, + required int? blocks, + }) => + (super.noSuchMethod( + Invocation.method( + #estimateFee, + [], + { + #requestID: requestID, + #blocks: blocks, + }, + ), + returnValue: _i4.Future<_i2.Decimal>.value(_FakeDecimal_0( + this, + Invocation.method( + #estimateFee, + [], + { + #requestID: requestID, + #blocks: blocks, + }, + ), + )), + ) as _i4.Future<_i2.Decimal>); + @override + _i4.Future<_i2.Decimal> relayFee({String? requestID}) => (super.noSuchMethod( + Invocation.method( + #relayFee, + [], + {#requestID: requestID}, + ), + returnValue: _i4.Future<_i2.Decimal>.value(_FakeDecimal_0( + this, + Invocation.method( + #relayFee, + [], + {#requestID: requestID}, + ), + )), + ) as _i4.Future<_i2.Decimal>); +} + +/// A class which mocks [CachedElectrumX]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockCachedElectrumX extends _i1.Mock implements _i5.CachedElectrumX { + MockCachedElectrumX() { + _i1.throwOnMissingStub(this); + } + + @override + _i3.ElectrumX get electrumXClient => (super.noSuchMethod( + Invocation.getter(#electrumXClient), + returnValue: _FakeElectrumX_1( + this, + Invocation.getter(#electrumXClient), + ), + ) as _i3.ElectrumX); + @override + _i4.Future> getAnonymitySet({ + required String? groupId, + String? blockhash = r'', + required _i6.Coin? coin, + }) => + (super.noSuchMethod( + Invocation.method( + #getAnonymitySet, + [], + { + #groupId: groupId, + #blockhash: blockhash, + #coin: coin, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + String base64ToHex(String? source) => (super.noSuchMethod( + Invocation.method( + #base64ToHex, + [source], + ), + returnValue: '', + ) as String); + @override + String base64ToReverseHex(String? source) => (super.noSuchMethod( + Invocation.method( + #base64ToReverseHex, + [source], + ), + returnValue: '', + ) as String); + @override + _i4.Future> getTransaction({ + required String? txHash, + required _i6.Coin? coin, + bool? verbose = true, + }) => + (super.noSuchMethod( + Invocation.method( + #getTransaction, + [], + { + #txHash: txHash, + #coin: coin, + #verbose: verbose, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future> getUsedCoinSerials({ + required _i6.Coin? coin, + int? startNumber = 0, + }) => + (super.noSuchMethod( + Invocation.method( + #getUsedCoinSerials, + [], + { + #coin: coin, + #startNumber: startNumber, + }, + ), + returnValue: _i4.Future>.value([]), + ) as _i4.Future>); + @override + _i4.Future clearSharedTransactionCache({required _i6.Coin? coin}) => + (super.noSuchMethod( + Invocation.method( + #clearSharedTransactionCache, + [], + {#coin: coin}, + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); +} + +/// A class which mocks [TransactionNotificationTracker]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockTransactionNotificationTracker extends _i1.Mock + implements _i7.TransactionNotificationTracker { + MockTransactionNotificationTracker() { + _i1.throwOnMissingStub(this); + } + + @override + String get walletId => (super.noSuchMethod( + Invocation.getter(#walletId), + returnValue: '', + ) as String); + @override + List get pendings => (super.noSuchMethod( + Invocation.getter(#pendings), + returnValue: [], + ) as List); + @override + List get confirmeds => (super.noSuchMethod( + Invocation.getter(#confirmeds), + returnValue: [], + ) as List); + @override + bool wasNotifiedPending(String? txid) => (super.noSuchMethod( + Invocation.method( + #wasNotifiedPending, + [txid], + ), + returnValue: false, + ) as bool); + @override + _i4.Future addNotifiedPending(String? txid) => (super.noSuchMethod( + Invocation.method( + #addNotifiedPending, + [txid], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override + bool wasNotifiedConfirmed(String? txid) => (super.noSuchMethod( + Invocation.method( + #wasNotifiedConfirmed, + [txid], + ), + returnValue: false, + ) as bool); + @override + _i4.Future addNotifiedConfirmed(String? txid) => (super.noSuchMethod( + Invocation.method( + #addNotifiedConfirmed, + [txid], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override + _i4.Future deleteTransaction(String? txid) => (super.noSuchMethod( + Invocation.method( + #deleteTransaction, + [txid], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); +} diff --git a/test/services/coins/dogecoin/dogecoin_wallet_test.mocks.dart b/test/services/coins/dogecoin/dogecoin_wallet_test.mocks.dart new file mode 100644 index 0000000000..cd9adfe0f8 --- /dev/null +++ b/test/services/coins/dogecoin/dogecoin_wallet_test.mocks.dart @@ -0,0 +1,564 @@ +// Mocks generated by Mockito 5.3.2 from annotations +// in stackwallet/test/services/coins/dogecoin/dogecoin_wallet_test.dart. +// Do not manually edit this file. + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'dart:async' as _i4; + +import 'package:decimal/decimal.dart' as _i2; +import 'package:mockito/mockito.dart' as _i1; +import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i5; +import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i3; +import 'package:stackwallet/services/transaction_notification_tracker.dart' + as _i7; +import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i6; + +// ignore_for_file: type=lint +// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_setters_without_getters +// ignore_for_file: comment_references +// ignore_for_file: implementation_imports +// ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class + +class _FakeDecimal_0 extends _i1.SmartFake implements _i2.Decimal { + _FakeDecimal_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeElectrumX_1 extends _i1.SmartFake implements _i3.ElectrumX { + _FakeElectrumX_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +/// A class which mocks [ElectrumX]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockElectrumX extends _i1.Mock implements _i3.ElectrumX { + MockElectrumX() { + _i1.throwOnMissingStub(this); + } + + @override + set failovers(List<_i3.ElectrumXNode>? _failovers) => super.noSuchMethod( + Invocation.setter( + #failovers, + _failovers, + ), + returnValueForMissingStub: null, + ); + @override + int get currentFailoverIndex => (super.noSuchMethod( + Invocation.getter(#currentFailoverIndex), + returnValue: 0, + ) as int); + @override + set currentFailoverIndex(int? _currentFailoverIndex) => super.noSuchMethod( + Invocation.setter( + #currentFailoverIndex, + _currentFailoverIndex, + ), + returnValueForMissingStub: null, + ); + @override + String get host => (super.noSuchMethod( + Invocation.getter(#host), + returnValue: '', + ) as String); + @override + int get port => (super.noSuchMethod( + Invocation.getter(#port), + returnValue: 0, + ) as int); + @override + bool get useSSL => (super.noSuchMethod( + Invocation.getter(#useSSL), + returnValue: false, + ) as bool); + @override + _i4.Future request({ + required String? command, + List? args = const [], + Duration? connectionTimeout = const Duration(seconds: 60), + String? requestID, + int? retries = 2, + }) => + (super.noSuchMethod( + Invocation.method( + #request, + [], + { + #command: command, + #args: args, + #connectionTimeout: connectionTimeout, + #requestID: requestID, + #retries: retries, + }, + ), + returnValue: _i4.Future.value(), + ) as _i4.Future); + @override + _i4.Future>> batchRequest({ + required String? command, + required Map>? args, + Duration? connectionTimeout = const Duration(seconds: 60), + int? retries = 2, + }) => + (super.noSuchMethod( + Invocation.method( + #batchRequest, + [], + { + #command: command, + #args: args, + #connectionTimeout: connectionTimeout, + #retries: retries, + }, + ), + returnValue: _i4.Future>>.value( + >[]), + ) as _i4.Future>>); + @override + _i4.Future ping({ + String? requestID, + int? retryCount = 1, + }) => + (super.noSuchMethod( + Invocation.method( + #ping, + [], + { + #requestID: requestID, + #retryCount: retryCount, + }, + ), + returnValue: _i4.Future.value(false), + ) as _i4.Future); + @override + _i4.Future> getBlockHeadTip({String? requestID}) => + (super.noSuchMethod( + Invocation.method( + #getBlockHeadTip, + [], + {#requestID: requestID}, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future> getServerFeatures({String? requestID}) => + (super.noSuchMethod( + Invocation.method( + #getServerFeatures, + [], + {#requestID: requestID}, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future broadcastTransaction({ + required String? rawTx, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #broadcastTransaction, + [], + { + #rawTx: rawTx, + #requestID: requestID, + }, + ), + returnValue: _i4.Future.value(''), + ) as _i4.Future); + @override + _i4.Future> getBalance({ + required String? scripthash, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getBalance, + [], + { + #scripthash: scripthash, + #requestID: requestID, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future>> getHistory({ + required String? scripthash, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getHistory, + [], + { + #scripthash: scripthash, + #requestID: requestID, + }, + ), + returnValue: _i4.Future>>.value( + >[]), + ) as _i4.Future>>); + @override + _i4.Future>>> getBatchHistory( + {required Map>? args}) => + (super.noSuchMethod( + Invocation.method( + #getBatchHistory, + [], + {#args: args}, + ), + returnValue: _i4.Future>>>.value( + >>{}), + ) as _i4.Future>>>); + @override + _i4.Future>> getUTXOs({ + required String? scripthash, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getUTXOs, + [], + { + #scripthash: scripthash, + #requestID: requestID, + }, + ), + returnValue: _i4.Future>>.value( + >[]), + ) as _i4.Future>>); + @override + _i4.Future>>> getBatchUTXOs( + {required Map>? args}) => + (super.noSuchMethod( + Invocation.method( + #getBatchUTXOs, + [], + {#args: args}, + ), + returnValue: _i4.Future>>>.value( + >>{}), + ) as _i4.Future>>>); + @override + _i4.Future> getTransaction({ + required String? txHash, + bool? verbose = true, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getTransaction, + [], + { + #txHash: txHash, + #verbose: verbose, + #requestID: requestID, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future> getAnonymitySet({ + String? groupId = r'1', + String? blockhash = r'', + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getAnonymitySet, + [], + { + #groupId: groupId, + #blockhash: blockhash, + #requestID: requestID, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future getMintData({ + dynamic mints, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getMintData, + [], + { + #mints: mints, + #requestID: requestID, + }, + ), + returnValue: _i4.Future.value(), + ) as _i4.Future); + @override + _i4.Future> getUsedCoinSerials({ + String? requestID, + required int? startNumber, + }) => + (super.noSuchMethod( + Invocation.method( + #getUsedCoinSerials, + [], + { + #requestID: requestID, + #startNumber: startNumber, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future getLatestCoinId({String? requestID}) => (super.noSuchMethod( + Invocation.method( + #getLatestCoinId, + [], + {#requestID: requestID}, + ), + returnValue: _i4.Future.value(0), + ) as _i4.Future); + @override + _i4.Future> getFeeRate({String? requestID}) => + (super.noSuchMethod( + Invocation.method( + #getFeeRate, + [], + {#requestID: requestID}, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future<_i2.Decimal> estimateFee({ + String? requestID, + required int? blocks, + }) => + (super.noSuchMethod( + Invocation.method( + #estimateFee, + [], + { + #requestID: requestID, + #blocks: blocks, + }, + ), + returnValue: _i4.Future<_i2.Decimal>.value(_FakeDecimal_0( + this, + Invocation.method( + #estimateFee, + [], + { + #requestID: requestID, + #blocks: blocks, + }, + ), + )), + ) as _i4.Future<_i2.Decimal>); + @override + _i4.Future<_i2.Decimal> relayFee({String? requestID}) => (super.noSuchMethod( + Invocation.method( + #relayFee, + [], + {#requestID: requestID}, + ), + returnValue: _i4.Future<_i2.Decimal>.value(_FakeDecimal_0( + this, + Invocation.method( + #relayFee, + [], + {#requestID: requestID}, + ), + )), + ) as _i4.Future<_i2.Decimal>); +} + +/// A class which mocks [CachedElectrumX]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockCachedElectrumX extends _i1.Mock implements _i5.CachedElectrumX { + MockCachedElectrumX() { + _i1.throwOnMissingStub(this); + } + + @override + _i3.ElectrumX get electrumXClient => (super.noSuchMethod( + Invocation.getter(#electrumXClient), + returnValue: _FakeElectrumX_1( + this, + Invocation.getter(#electrumXClient), + ), + ) as _i3.ElectrumX); + @override + _i4.Future> getAnonymitySet({ + required String? groupId, + String? blockhash = r'', + required _i6.Coin? coin, + }) => + (super.noSuchMethod( + Invocation.method( + #getAnonymitySet, + [], + { + #groupId: groupId, + #blockhash: blockhash, + #coin: coin, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + String base64ToHex(String? source) => (super.noSuchMethod( + Invocation.method( + #base64ToHex, + [source], + ), + returnValue: '', + ) as String); + @override + String base64ToReverseHex(String? source) => (super.noSuchMethod( + Invocation.method( + #base64ToReverseHex, + [source], + ), + returnValue: '', + ) as String); + @override + _i4.Future> getTransaction({ + required String? txHash, + required _i6.Coin? coin, + bool? verbose = true, + }) => + (super.noSuchMethod( + Invocation.method( + #getTransaction, + [], + { + #txHash: txHash, + #coin: coin, + #verbose: verbose, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future> getUsedCoinSerials({ + required _i6.Coin? coin, + int? startNumber = 0, + }) => + (super.noSuchMethod( + Invocation.method( + #getUsedCoinSerials, + [], + { + #coin: coin, + #startNumber: startNumber, + }, + ), + returnValue: _i4.Future>.value([]), + ) as _i4.Future>); + @override + _i4.Future clearSharedTransactionCache({required _i6.Coin? coin}) => + (super.noSuchMethod( + Invocation.method( + #clearSharedTransactionCache, + [], + {#coin: coin}, + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); +} + +/// A class which mocks [TransactionNotificationTracker]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockTransactionNotificationTracker extends _i1.Mock + implements _i7.TransactionNotificationTracker { + MockTransactionNotificationTracker() { + _i1.throwOnMissingStub(this); + } + + @override + String get walletId => (super.noSuchMethod( + Invocation.getter(#walletId), + returnValue: '', + ) as String); + @override + List get pendings => (super.noSuchMethod( + Invocation.getter(#pendings), + returnValue: [], + ) as List); + @override + List get confirmeds => (super.noSuchMethod( + Invocation.getter(#confirmeds), + returnValue: [], + ) as List); + @override + bool wasNotifiedPending(String? txid) => (super.noSuchMethod( + Invocation.method( + #wasNotifiedPending, + [txid], + ), + returnValue: false, + ) as bool); + @override + _i4.Future addNotifiedPending(String? txid) => (super.noSuchMethod( + Invocation.method( + #addNotifiedPending, + [txid], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override + bool wasNotifiedConfirmed(String? txid) => (super.noSuchMethod( + Invocation.method( + #wasNotifiedConfirmed, + [txid], + ), + returnValue: false, + ) as bool); + @override + _i4.Future addNotifiedConfirmed(String? txid) => (super.noSuchMethod( + Invocation.method( + #addNotifiedConfirmed, + [txid], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override + _i4.Future deleteTransaction(String? txid) => (super.noSuchMethod( + Invocation.method( + #deleteTransaction, + [txid], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); +} diff --git a/test/services/coins/firo/firo_wallet_test.mocks.dart b/test/services/coins/firo/firo_wallet_test.mocks.dart new file mode 100644 index 0000000000..56864bfdb8 --- /dev/null +++ b/test/services/coins/firo/firo_wallet_test.mocks.dart @@ -0,0 +1,1152 @@ +// Mocks generated by Mockito 5.3.2 from annotations +// in stackwallet/test/services/coins/firo/firo_wallet_test.dart. +// Do not manually edit this file. + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'dart:async' as _i5; + +import 'package:decimal/decimal.dart' as _i2; +import 'package:isar/isar.dart' as _i4; +import 'package:mockito/mockito.dart' as _i1; +import 'package:stackwallet/db/isar/main_db.dart' as _i9; +import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i6; +import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i3; +import 'package:stackwallet/models/isar/models/block_explorer.dart' as _i11; +import 'package:stackwallet/models/isar/models/contact_entry.dart' as _i10; +import 'package:stackwallet/models/isar/models/isar_models.dart' as _i12; +import 'package:stackwallet/services/transaction_notification_tracker.dart' + as _i8; +import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i7; +import 'package:tuple/tuple.dart' as _i13; + +// ignore_for_file: type=lint +// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_setters_without_getters +// ignore_for_file: comment_references +// ignore_for_file: implementation_imports +// ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class + +class _FakeDecimal_0 extends _i1.SmartFake implements _i2.Decimal { + _FakeDecimal_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeElectrumX_1 extends _i1.SmartFake implements _i3.ElectrumX { + _FakeElectrumX_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeIsar_2 extends _i1.SmartFake implements _i4.Isar { + _FakeIsar_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeQueryBuilder_3 extends _i1.SmartFake + implements _i4.QueryBuilder { + _FakeQueryBuilder_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +/// A class which mocks [ElectrumX]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockElectrumX extends _i1.Mock implements _i3.ElectrumX { + MockElectrumX() { + _i1.throwOnMissingStub(this); + } + + @override + set failovers(List<_i3.ElectrumXNode>? _failovers) => super.noSuchMethod( + Invocation.setter( + #failovers, + _failovers, + ), + returnValueForMissingStub: null, + ); + @override + int get currentFailoverIndex => (super.noSuchMethod( + Invocation.getter(#currentFailoverIndex), + returnValue: 0, + ) as int); + @override + set currentFailoverIndex(int? _currentFailoverIndex) => super.noSuchMethod( + Invocation.setter( + #currentFailoverIndex, + _currentFailoverIndex, + ), + returnValueForMissingStub: null, + ); + @override + String get host => (super.noSuchMethod( + Invocation.getter(#host), + returnValue: '', + ) as String); + @override + int get port => (super.noSuchMethod( + Invocation.getter(#port), + returnValue: 0, + ) as int); + @override + bool get useSSL => (super.noSuchMethod( + Invocation.getter(#useSSL), + returnValue: false, + ) as bool); + @override + _i5.Future request({ + required String? command, + List? args = const [], + Duration? connectionTimeout = const Duration(seconds: 60), + String? requestID, + int? retries = 2, + }) => + (super.noSuchMethod( + Invocation.method( + #request, + [], + { + #command: command, + #args: args, + #connectionTimeout: connectionTimeout, + #requestID: requestID, + #retries: retries, + }, + ), + returnValue: _i5.Future.value(), + ) as _i5.Future); + @override + _i5.Future>> batchRequest({ + required String? command, + required Map>? args, + Duration? connectionTimeout = const Duration(seconds: 60), + int? retries = 2, + }) => + (super.noSuchMethod( + Invocation.method( + #batchRequest, + [], + { + #command: command, + #args: args, + #connectionTimeout: connectionTimeout, + #retries: retries, + }, + ), + returnValue: _i5.Future>>.value( + >[]), + ) as _i5.Future>>); + @override + _i5.Future ping({ + String? requestID, + int? retryCount = 1, + }) => + (super.noSuchMethod( + Invocation.method( + #ping, + [], + { + #requestID: requestID, + #retryCount: retryCount, + }, + ), + returnValue: _i5.Future.value(false), + ) as _i5.Future); + @override + _i5.Future> getBlockHeadTip({String? requestID}) => + (super.noSuchMethod( + Invocation.method( + #getBlockHeadTip, + [], + {#requestID: requestID}, + ), + returnValue: + _i5.Future>.value({}), + ) as _i5.Future>); + @override + _i5.Future> getServerFeatures({String? requestID}) => + (super.noSuchMethod( + Invocation.method( + #getServerFeatures, + [], + {#requestID: requestID}, + ), + returnValue: + _i5.Future>.value({}), + ) as _i5.Future>); + @override + _i5.Future broadcastTransaction({ + required String? rawTx, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #broadcastTransaction, + [], + { + #rawTx: rawTx, + #requestID: requestID, + }, + ), + returnValue: _i5.Future.value(''), + ) as _i5.Future); + @override + _i5.Future> getBalance({ + required String? scripthash, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getBalance, + [], + { + #scripthash: scripthash, + #requestID: requestID, + }, + ), + returnValue: + _i5.Future>.value({}), + ) as _i5.Future>); + @override + _i5.Future>> getHistory({ + required String? scripthash, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getHistory, + [], + { + #scripthash: scripthash, + #requestID: requestID, + }, + ), + returnValue: _i5.Future>>.value( + >[]), + ) as _i5.Future>>); + @override + _i5.Future>>> getBatchHistory( + {required Map>? args}) => + (super.noSuchMethod( + Invocation.method( + #getBatchHistory, + [], + {#args: args}, + ), + returnValue: _i5.Future>>>.value( + >>{}), + ) as _i5.Future>>>); + @override + _i5.Future>> getUTXOs({ + required String? scripthash, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getUTXOs, + [], + { + #scripthash: scripthash, + #requestID: requestID, + }, + ), + returnValue: _i5.Future>>.value( + >[]), + ) as _i5.Future>>); + @override + _i5.Future>>> getBatchUTXOs( + {required Map>? args}) => + (super.noSuchMethod( + Invocation.method( + #getBatchUTXOs, + [], + {#args: args}, + ), + returnValue: _i5.Future>>>.value( + >>{}), + ) as _i5.Future>>>); + @override + _i5.Future> getTransaction({ + required String? txHash, + bool? verbose = true, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getTransaction, + [], + { + #txHash: txHash, + #verbose: verbose, + #requestID: requestID, + }, + ), + returnValue: + _i5.Future>.value({}), + ) as _i5.Future>); + @override + _i5.Future> getAnonymitySet({ + String? groupId = r'1', + String? blockhash = r'', + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getAnonymitySet, + [], + { + #groupId: groupId, + #blockhash: blockhash, + #requestID: requestID, + }, + ), + returnValue: + _i5.Future>.value({}), + ) as _i5.Future>); + @override + _i5.Future getMintData({ + dynamic mints, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getMintData, + [], + { + #mints: mints, + #requestID: requestID, + }, + ), + returnValue: _i5.Future.value(), + ) as _i5.Future); + @override + _i5.Future> getUsedCoinSerials({ + String? requestID, + required int? startNumber, + }) => + (super.noSuchMethod( + Invocation.method( + #getUsedCoinSerials, + [], + { + #requestID: requestID, + #startNumber: startNumber, + }, + ), + returnValue: + _i5.Future>.value({}), + ) as _i5.Future>); + @override + _i5.Future getLatestCoinId({String? requestID}) => (super.noSuchMethod( + Invocation.method( + #getLatestCoinId, + [], + {#requestID: requestID}, + ), + returnValue: _i5.Future.value(0), + ) as _i5.Future); + @override + _i5.Future> getFeeRate({String? requestID}) => + (super.noSuchMethod( + Invocation.method( + #getFeeRate, + [], + {#requestID: requestID}, + ), + returnValue: + _i5.Future>.value({}), + ) as _i5.Future>); + @override + _i5.Future<_i2.Decimal> estimateFee({ + String? requestID, + required int? blocks, + }) => + (super.noSuchMethod( + Invocation.method( + #estimateFee, + [], + { + #requestID: requestID, + #blocks: blocks, + }, + ), + returnValue: _i5.Future<_i2.Decimal>.value(_FakeDecimal_0( + this, + Invocation.method( + #estimateFee, + [], + { + #requestID: requestID, + #blocks: blocks, + }, + ), + )), + ) as _i5.Future<_i2.Decimal>); + @override + _i5.Future<_i2.Decimal> relayFee({String? requestID}) => (super.noSuchMethod( + Invocation.method( + #relayFee, + [], + {#requestID: requestID}, + ), + returnValue: _i5.Future<_i2.Decimal>.value(_FakeDecimal_0( + this, + Invocation.method( + #relayFee, + [], + {#requestID: requestID}, + ), + )), + ) as _i5.Future<_i2.Decimal>); +} + +/// A class which mocks [CachedElectrumX]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockCachedElectrumX extends _i1.Mock implements _i6.CachedElectrumX { + MockCachedElectrumX() { + _i1.throwOnMissingStub(this); + } + + @override + _i3.ElectrumX get electrumXClient => (super.noSuchMethod( + Invocation.getter(#electrumXClient), + returnValue: _FakeElectrumX_1( + this, + Invocation.getter(#electrumXClient), + ), + ) as _i3.ElectrumX); + @override + _i5.Future> getAnonymitySet({ + required String? groupId, + String? blockhash = r'', + required _i7.Coin? coin, + }) => + (super.noSuchMethod( + Invocation.method( + #getAnonymitySet, + [], + { + #groupId: groupId, + #blockhash: blockhash, + #coin: coin, + }, + ), + returnValue: + _i5.Future>.value({}), + ) as _i5.Future>); + @override + String base64ToHex(String? source) => (super.noSuchMethod( + Invocation.method( + #base64ToHex, + [source], + ), + returnValue: '', + ) as String); + @override + String base64ToReverseHex(String? source) => (super.noSuchMethod( + Invocation.method( + #base64ToReverseHex, + [source], + ), + returnValue: '', + ) as String); + @override + _i5.Future> getTransaction({ + required String? txHash, + required _i7.Coin? coin, + bool? verbose = true, + }) => + (super.noSuchMethod( + Invocation.method( + #getTransaction, + [], + { + #txHash: txHash, + #coin: coin, + #verbose: verbose, + }, + ), + returnValue: + _i5.Future>.value({}), + ) as _i5.Future>); + @override + _i5.Future> getUsedCoinSerials({ + required _i7.Coin? coin, + int? startNumber = 0, + }) => + (super.noSuchMethod( + Invocation.method( + #getUsedCoinSerials, + [], + { + #coin: coin, + #startNumber: startNumber, + }, + ), + returnValue: _i5.Future>.value([]), + ) as _i5.Future>); + @override + _i5.Future clearSharedTransactionCache({required _i7.Coin? coin}) => + (super.noSuchMethod( + Invocation.method( + #clearSharedTransactionCache, + [], + {#coin: coin}, + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); +} + +/// A class which mocks [TransactionNotificationTracker]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockTransactionNotificationTracker extends _i1.Mock + implements _i8.TransactionNotificationTracker { + MockTransactionNotificationTracker() { + _i1.throwOnMissingStub(this); + } + + @override + String get walletId => (super.noSuchMethod( + Invocation.getter(#walletId), + returnValue: '', + ) as String); + @override + List get pendings => (super.noSuchMethod( + Invocation.getter(#pendings), + returnValue: [], + ) as List); + @override + List get confirmeds => (super.noSuchMethod( + Invocation.getter(#confirmeds), + returnValue: [], + ) as List); + @override + bool wasNotifiedPending(String? txid) => (super.noSuchMethod( + Invocation.method( + #wasNotifiedPending, + [txid], + ), + returnValue: false, + ) as bool); + @override + _i5.Future addNotifiedPending(String? txid) => (super.noSuchMethod( + Invocation.method( + #addNotifiedPending, + [txid], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override + bool wasNotifiedConfirmed(String? txid) => (super.noSuchMethod( + Invocation.method( + #wasNotifiedConfirmed, + [txid], + ), + returnValue: false, + ) as bool); + @override + _i5.Future addNotifiedConfirmed(String? txid) => (super.noSuchMethod( + Invocation.method( + #addNotifiedConfirmed, + [txid], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override + _i5.Future deleteTransaction(String? txid) => (super.noSuchMethod( + Invocation.method( + #deleteTransaction, + [txid], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); +} + +/// A class which mocks [MainDB]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockMainDB extends _i1.Mock implements _i9.MainDB { + MockMainDB() { + _i1.throwOnMissingStub(this); + } + + @override + _i4.Isar get isar => (super.noSuchMethod( + Invocation.getter(#isar), + returnValue: _FakeIsar_2( + this, + Invocation.getter(#isar), + ), + ) as _i4.Isar); + @override + _i5.Future initMainDB({_i4.Isar? mock}) => (super.noSuchMethod( + Invocation.method( + #initMainDB, + [], + {#mock: mock}, + ), + returnValue: _i5.Future.value(false), + ) as _i5.Future); + @override + List<_i10.ContactEntry> getContactEntries() => (super.noSuchMethod( + Invocation.method( + #getContactEntries, + [], + ), + returnValue: <_i10.ContactEntry>[], + ) as List<_i10.ContactEntry>); + @override + _i5.Future deleteContactEntry({required String? id}) => + (super.noSuchMethod( + Invocation.method( + #deleteContactEntry, + [], + {#id: id}, + ), + returnValue: _i5.Future.value(false), + ) as _i5.Future); + @override + _i5.Future isContactEntryExists({required String? id}) => + (super.noSuchMethod( + Invocation.method( + #isContactEntryExists, + [], + {#id: id}, + ), + returnValue: _i5.Future.value(false), + ) as _i5.Future); + @override + _i10.ContactEntry? getContactEntry({required String? id}) => + (super.noSuchMethod(Invocation.method( + #getContactEntry, + [], + {#id: id}, + )) as _i10.ContactEntry?); + @override + _i5.Future putContactEntry( + {required _i10.ContactEntry? contactEntry}) => + (super.noSuchMethod( + Invocation.method( + #putContactEntry, + [], + {#contactEntry: contactEntry}, + ), + returnValue: _i5.Future.value(false), + ) as _i5.Future); + @override + _i11.TransactionBlockExplorer? getTransactionBlockExplorer( + {required _i7.Coin? coin}) => + (super.noSuchMethod(Invocation.method( + #getTransactionBlockExplorer, + [], + {#coin: coin}, + )) as _i11.TransactionBlockExplorer?); + @override + _i5.Future putTransactionBlockExplorer( + _i11.TransactionBlockExplorer? explorer) => + (super.noSuchMethod( + Invocation.method( + #putTransactionBlockExplorer, + [explorer], + ), + returnValue: _i5.Future.value(0), + ) as _i5.Future); + @override + _i4.QueryBuilder<_i12.Address, _i12.Address, _i4.QAfterWhereClause> + getAddresses(String? walletId) => (super.noSuchMethod( + Invocation.method( + #getAddresses, + [walletId], + ), + returnValue: _FakeQueryBuilder_3<_i12.Address, _i12.Address, + _i4.QAfterWhereClause>( + this, + Invocation.method( + #getAddresses, + [walletId], + ), + ), + ) as _i4 + .QueryBuilder<_i12.Address, _i12.Address, _i4.QAfterWhereClause>); + @override + _i5.Future putAddress(_i12.Address? address) => (super.noSuchMethod( + Invocation.method( + #putAddress, + [address], + ), + returnValue: _i5.Future.value(0), + ) as _i5.Future); + @override + _i5.Future> putAddresses(List<_i12.Address>? addresses) => + (super.noSuchMethod( + Invocation.method( + #putAddresses, + [addresses], + ), + returnValue: _i5.Future>.value([]), + ) as _i5.Future>); + @override + _i5.Future> updateOrPutAddresses(List<_i12.Address>? addresses) => + (super.noSuchMethod( + Invocation.method( + #updateOrPutAddresses, + [addresses], + ), + returnValue: _i5.Future>.value([]), + ) as _i5.Future>); + @override + _i5.Future<_i12.Address?> getAddress( + String? walletId, + String? address, + ) => + (super.noSuchMethod( + Invocation.method( + #getAddress, + [ + walletId, + address, + ], + ), + returnValue: _i5.Future<_i12.Address?>.value(), + ) as _i5.Future<_i12.Address?>); + @override + _i5.Future updateAddress( + _i12.Address? oldAddress, + _i12.Address? newAddress, + ) => + (super.noSuchMethod( + Invocation.method( + #updateAddress, + [ + oldAddress, + newAddress, + ], + ), + returnValue: _i5.Future.value(0), + ) as _i5.Future); + @override + _i4.QueryBuilder<_i12.Transaction, _i12.Transaction, _i4.QAfterWhereClause> + getTransactions(String? walletId) => (super.noSuchMethod( + Invocation.method( + #getTransactions, + [walletId], + ), + returnValue: _FakeQueryBuilder_3<_i12.Transaction, _i12.Transaction, + _i4.QAfterWhereClause>( + this, + Invocation.method( + #getTransactions, + [walletId], + ), + ), + ) as _i4.QueryBuilder<_i12.Transaction, _i12.Transaction, + _i4.QAfterWhereClause>); + @override + _i5.Future putTransaction(_i12.Transaction? transaction) => + (super.noSuchMethod( + Invocation.method( + #putTransaction, + [transaction], + ), + returnValue: _i5.Future.value(0), + ) as _i5.Future); + @override + _i5.Future> putTransactions(List<_i12.Transaction>? transactions) => + (super.noSuchMethod( + Invocation.method( + #putTransactions, + [transactions], + ), + returnValue: _i5.Future>.value([]), + ) as _i5.Future>); + @override + _i5.Future<_i12.Transaction?> getTransaction( + String? walletId, + String? txid, + ) => + (super.noSuchMethod( + Invocation.method( + #getTransaction, + [ + walletId, + txid, + ], + ), + returnValue: _i5.Future<_i12.Transaction?>.value(), + ) as _i5.Future<_i12.Transaction?>); + @override + _i5.Stream<_i12.Transaction?> watchTransaction({ + required int? id, + bool? fireImmediately = false, + }) => + (super.noSuchMethod( + Invocation.method( + #watchTransaction, + [], + { + #id: id, + #fireImmediately: fireImmediately, + }, + ), + returnValue: _i5.Stream<_i12.Transaction?>.empty(), + ) as _i5.Stream<_i12.Transaction?>); + @override + _i4.QueryBuilder<_i12.UTXO, _i12.UTXO, _i4.QAfterWhereClause> getUTXOs( + String? walletId) => + (super.noSuchMethod( + Invocation.method( + #getUTXOs, + [walletId], + ), + returnValue: + _FakeQueryBuilder_3<_i12.UTXO, _i12.UTXO, _i4.QAfterWhereClause>( + this, + Invocation.method( + #getUTXOs, + [walletId], + ), + ), + ) as _i4.QueryBuilder<_i12.UTXO, _i12.UTXO, _i4.QAfterWhereClause>); + @override + _i5.Future putUTXO(_i12.UTXO? utxo) => (super.noSuchMethod( + Invocation.method( + #putUTXO, + [utxo], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override + _i5.Future putUTXOs(List<_i12.UTXO>? utxos) => (super.noSuchMethod( + Invocation.method( + #putUTXOs, + [utxos], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override + _i5.Future updateUTXOs( + String? walletId, + List<_i12.UTXO>? utxos, + ) => + (super.noSuchMethod( + Invocation.method( + #updateUTXOs, + [ + walletId, + utxos, + ], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override + _i5.Stream<_i12.UTXO?> watchUTXO({ + required int? id, + bool? fireImmediately = false, + }) => + (super.noSuchMethod( + Invocation.method( + #watchUTXO, + [], + { + #id: id, + #fireImmediately: fireImmediately, + }, + ), + returnValue: _i5.Stream<_i12.UTXO?>.empty(), + ) as _i5.Stream<_i12.UTXO?>); + @override + _i4.QueryBuilder<_i12.TransactionNote, _i12.TransactionNote, + _i4.QAfterWhereClause> getTransactionNotes( + String? walletId) => + (super.noSuchMethod( + Invocation.method( + #getTransactionNotes, + [walletId], + ), + returnValue: _FakeQueryBuilder_3<_i12.TransactionNote, + _i12.TransactionNote, _i4.QAfterWhereClause>( + this, + Invocation.method( + #getTransactionNotes, + [walletId], + ), + ), + ) as _i4.QueryBuilder<_i12.TransactionNote, _i12.TransactionNote, + _i4.QAfterWhereClause>); + @override + _i5.Future putTransactionNote(_i12.TransactionNote? transactionNote) => + (super.noSuchMethod( + Invocation.method( + #putTransactionNote, + [transactionNote], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override + _i5.Future putTransactionNotes( + List<_i12.TransactionNote>? transactionNotes) => + (super.noSuchMethod( + Invocation.method( + #putTransactionNotes, + [transactionNotes], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override + _i5.Future<_i12.TransactionNote?> getTransactionNote( + String? walletId, + String? txid, + ) => + (super.noSuchMethod( + Invocation.method( + #getTransactionNote, + [ + walletId, + txid, + ], + ), + returnValue: _i5.Future<_i12.TransactionNote?>.value(), + ) as _i5.Future<_i12.TransactionNote?>); + @override + _i5.Stream<_i12.TransactionNote?> watchTransactionNote({ + required int? id, + bool? fireImmediately = false, + }) => + (super.noSuchMethod( + Invocation.method( + #watchTransactionNote, + [], + { + #id: id, + #fireImmediately: fireImmediately, + }, + ), + returnValue: _i5.Stream<_i12.TransactionNote?>.empty(), + ) as _i5.Stream<_i12.TransactionNote?>); + @override + _i4.QueryBuilder<_i12.AddressLabel, _i12.AddressLabel, _i4.QAfterWhereClause> + getAddressLabels(String? walletId) => (super.noSuchMethod( + Invocation.method( + #getAddressLabels, + [walletId], + ), + returnValue: _FakeQueryBuilder_3<_i12.AddressLabel, + _i12.AddressLabel, _i4.QAfterWhereClause>( + this, + Invocation.method( + #getAddressLabels, + [walletId], + ), + ), + ) as _i4.QueryBuilder<_i12.AddressLabel, _i12.AddressLabel, + _i4.QAfterWhereClause>); + @override + _i5.Future putAddressLabel(_i12.AddressLabel? addressLabel) => + (super.noSuchMethod( + Invocation.method( + #putAddressLabel, + [addressLabel], + ), + returnValue: _i5.Future.value(0), + ) as _i5.Future); + @override + int putAddressLabelSync(_i12.AddressLabel? addressLabel) => + (super.noSuchMethod( + Invocation.method( + #putAddressLabelSync, + [addressLabel], + ), + returnValue: 0, + ) as int); + @override + _i5.Future putAddressLabels(List<_i12.AddressLabel>? addressLabels) => + (super.noSuchMethod( + Invocation.method( + #putAddressLabels, + [addressLabels], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override + _i5.Future<_i12.AddressLabel?> getAddressLabel( + String? walletId, + String? addressString, + ) => + (super.noSuchMethod( + Invocation.method( + #getAddressLabel, + [ + walletId, + addressString, + ], + ), + returnValue: _i5.Future<_i12.AddressLabel?>.value(), + ) as _i5.Future<_i12.AddressLabel?>); + @override + _i12.AddressLabel? getAddressLabelSync( + String? walletId, + String? addressString, + ) => + (super.noSuchMethod(Invocation.method( + #getAddressLabelSync, + [ + walletId, + addressString, + ], + )) as _i12.AddressLabel?); + @override + _i5.Stream<_i12.AddressLabel?> watchAddressLabel({ + required int? id, + bool? fireImmediately = false, + }) => + (super.noSuchMethod( + Invocation.method( + #watchAddressLabel, + [], + { + #id: id, + #fireImmediately: fireImmediately, + }, + ), + returnValue: _i5.Stream<_i12.AddressLabel?>.empty(), + ) as _i5.Stream<_i12.AddressLabel?>); + @override + _i5.Future updateAddressLabel(_i12.AddressLabel? addressLabel) => + (super.noSuchMethod( + Invocation.method( + #updateAddressLabel, + [addressLabel], + ), + returnValue: _i5.Future.value(0), + ) as _i5.Future); + @override + _i5.Future deleteWalletBlockchainData(String? walletId) => + (super.noSuchMethod( + Invocation.method( + #deleteWalletBlockchainData, + [walletId], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override + _i5.Future deleteAddressLabels(String? walletId) => (super.noSuchMethod( + Invocation.method( + #deleteAddressLabels, + [walletId], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override + _i5.Future deleteTransactionNotes(String? walletId) => + (super.noSuchMethod( + Invocation.method( + #deleteTransactionNotes, + [walletId], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override + _i5.Future addNewTransactionData( + List<_i13.Tuple2<_i12.Transaction, _i12.Address?>>? transactionsData, + String? walletId, + ) => + (super.noSuchMethod( + Invocation.method( + #addNewTransactionData, + [ + transactionsData, + walletId, + ], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override + _i4.QueryBuilder<_i12.EthContract, _i12.EthContract, _i4.QWhere> + getEthContracts() => (super.noSuchMethod( + Invocation.method( + #getEthContracts, + [], + ), + returnValue: _FakeQueryBuilder_3<_i12.EthContract, _i12.EthContract, + _i4.QWhere>( + this, + Invocation.method( + #getEthContracts, + [], + ), + ), + ) as _i4 + .QueryBuilder<_i12.EthContract, _i12.EthContract, _i4.QWhere>); + @override + _i5.Future<_i12.EthContract?> getEthContract(String? contractAddress) => + (super.noSuchMethod( + Invocation.method( + #getEthContract, + [contractAddress], + ), + returnValue: _i5.Future<_i12.EthContract?>.value(), + ) as _i5.Future<_i12.EthContract?>); + @override + _i12.EthContract? getEthContractSync(String? contractAddress) => + (super.noSuchMethod(Invocation.method( + #getEthContractSync, + [contractAddress], + )) as _i12.EthContract?); + @override + _i5.Future putEthContract(_i12.EthContract? contract) => + (super.noSuchMethod( + Invocation.method( + #putEthContract, + [contract], + ), + returnValue: _i5.Future.value(0), + ) as _i5.Future); + @override + _i5.Future putEthContracts(List<_i12.EthContract>? contracts) => + (super.noSuchMethod( + Invocation.method( + #putEthContracts, + [contracts], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); +} diff --git a/test/services/coins/manager_test.dart b/test/services/coins/manager_test.dart index 52a31b1b7c..ffabd39163 100644 --- a/test/services/coins/manager_test.dart +++ b/test/services/coins/manager_test.dart @@ -1,338 +1,352 @@ -import 'package:flutter_test/flutter_test.dart'; -import 'package:mockito/annotations.dart'; -import 'package:mockito/mockito.dart'; -import 'package:stackduo/electrumx_rpc/electrumx.dart'; -import 'package:stackduo/models/balance.dart'; -import 'package:stackduo/models/isar/models/isar_models.dart'; -import 'package:stackduo/models/paymint/fee_object_model.dart'; -import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart'; -import 'package:stackduo/services/coins/coin_service.dart'; -import 'package:stackduo/services/coins/manager.dart'; -import 'package:stackduo/utilities/amount/amount.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; - -// import '../../pages/send_view/send_view_test.mocks.dart'; -import 'manager_test.mocks.dart'; - -@GenerateMocks([BitcoinWallet, ElectrumX]) -void main() { - test("Manager should have a backgroundRefreshListener on initialization", () { - final manager = Manager(MockBitcoinWallet()); - - expect(manager.hasBackgroundRefreshListener, true); - }); - - test("get coin", () { - final CoinServiceAPI wallet = MockBitcoinWallet(); - when(wallet.coin).thenAnswer((_) => Coin.bitcoin); - final manager = Manager(wallet); - - expect(manager.coin, Coin.bitcoin); - }); - - test("fees", () async { - final CoinServiceAPI wallet = MockBitcoinWallet(); - when(wallet.fees).thenAnswer((_) async => FeeObject( - fast: 10, - medium: 5, - slow: 1, - numberOfBlocksFast: 4, - numberOfBlocksSlow: 2, - numberOfBlocksAverage: 3)); - - final manager = Manager(wallet); - - final feeObject = await manager.fees; - - expect(feeObject.fast, 10); - expect(feeObject.medium, 5); - expect(feeObject.slow, 1); - expect(feeObject.numberOfBlocksFast, 4); - expect(feeObject.numberOfBlocksAverage, 3); - expect(feeObject.numberOfBlocksSlow, 2); - }); - - test("maxFee", () async { - final CoinServiceAPI wallet = MockBitcoinWallet(); - when(wallet.maxFee).thenAnswer((_) async => 10); - - final manager = Manager(wallet); - - final fee = await manager.maxFee; - - expect(fee, 10); - }); - - test("get currentReceivingAddress", () async { - final CoinServiceAPI wallet = MockBitcoinWallet(); - when(wallet.currentReceivingAddress) - .thenAnswer((_) async => "Some address string"); - - final manager = Manager(wallet); - - expect(await manager.currentReceivingAddress, "Some address string"); - }); - - group("get balances", () { - test("balance", () async { - final CoinServiceAPI wallet = MockBitcoinWallet(); - when(wallet.balance).thenAnswer( - (_) => Balance( - total: 10.toAmountAsRaw(fractionDigits: 8), - spendable: 1.toAmountAsRaw(fractionDigits: 8), - blockedTotal: 0.toAmountAsRaw(fractionDigits: 8), - pendingSpendable: 9.toAmountAsRaw(fractionDigits: 8), - ), - ); - - final manager = Manager(wallet); - - expect(manager.balance.total.raw.toInt(), 10); - expect(manager.balance.spendable.raw.toInt(), 1); - expect(manager.balance.blockedTotal.raw.toInt(), 0); - expect(manager.balance.pendingSpendable.raw.toInt(), 9); - }); - }); - - test("transactions", () async { - final CoinServiceAPI wallet = MockBitcoinWallet(); - final tx = Transaction( - walletId: "walletId", - txid: "txid", - timestamp: 6, - type: TransactionType.incoming, - subType: TransactionSubType.mint, - amount: 123, - fee: 3, - height: 123, - isCancelled: false, - isLelantus: true, - slateId: null, - otherData: null, - inputs: [], - outputs: [], - amountString: '', - nonce: null, - ); - when(wallet.transactions).thenAnswer((_) async => [ - tx, - ]); - - final manager = Manager(wallet); - - final result = await manager.transactions; - - expect(result.length, 1); - - expect(result.first, tx); - }); - - test("refresh", () async { - final CoinServiceAPI wallet = MockBitcoinWallet(); - when(wallet.refresh()).thenAnswer((_) => Future(() => {})); - - final manager = Manager(wallet); - - await manager.refresh(); - - verify(wallet.refresh()).called(1); - }); - - test("get walletName", () { - final CoinServiceAPI wallet = MockBitcoinWallet(); - when(wallet.walletName).thenAnswer((_) => "Some wallet name"); - final manager = Manager(wallet); - - expect(manager.walletName, "Some wallet name"); - }); - - test("get walletId", () { - final CoinServiceAPI wallet = MockBitcoinWallet(); - when(wallet.walletId).thenAnswer((_) => "Some wallet ID"); - - final manager = Manager(wallet); - - expect(manager.walletId, "Some wallet ID"); - }); - - group("validateAddress", () { - test("some valid address", () { - final CoinServiceAPI wallet = MockBitcoinWallet(); - when(wallet.validateAddress("a valid address")).thenAnswer((_) => true); - - final manager = Manager(wallet); - - expect(manager.validateAddress("a valid address"), true); - }); - - test("some invalid address", () { - final CoinServiceAPI wallet = MockBitcoinWallet(); - when(wallet.validateAddress("an invalid address")) - .thenAnswer((_) => false); - - final manager = Manager(wallet); - - expect(manager.validateAddress("an invalid address"), false); - }); - }); - - test("get mnemonic", () async { - final CoinServiceAPI wallet = MockBitcoinWallet(); - when(wallet.mnemonic) - .thenAnswer((_) async => ["Some", "seed", "word", "list"]); - - final manager = Manager(wallet); - - expect(await manager.mnemonic, ["Some", "seed", "word", "list"]); - }); - - test("testNetworkConnection", () async { - final CoinServiceAPI wallet = MockBitcoinWallet(); - when(wallet.testNetworkConnection()).thenAnswer((_) async => true); - - final manager = Manager(wallet); - - expect(await manager.testNetworkConnection(), true); - }); - - group("recoverFromMnemonic", () { - test("successfully recover", () async { - final CoinServiceAPI wallet = MockBitcoinWallet(); - when(wallet.recoverFromMnemonic( - mnemonic: "Some valid mnemonic", - maxUnusedAddressGap: 20, - maxNumberOfIndexesToCheck: 1000, - height: 0)) - .thenAnswer((realInvocation) => Future(() => {})); - - final manager = Manager(wallet); - - await manager.recoverFromMnemonic( - mnemonic: "Some valid mnemonic", - maxUnusedAddressGap: 20, - maxNumberOfIndexesToCheck: 1000, - height: 0); - - verify(wallet.recoverFromMnemonic( - mnemonic: "Some valid mnemonic", - maxUnusedAddressGap: 20, - maxNumberOfIndexesToCheck: 1000, - height: 0)) - .called(1); - }); - - test("failed recovery", () async { - final CoinServiceAPI wallet = MockBitcoinWallet(); - when(wallet.recoverFromMnemonic( - mnemonic: "Some invalid mnemonic", - maxUnusedAddressGap: 20, - maxNumberOfIndexesToCheck: 1000, - height: 0)) - .thenThrow(Exception("Invalid mnemonic")); - - final manager = Manager(wallet); - - expect( - () => manager.recoverFromMnemonic( - mnemonic: "Some invalid mnemonic", - maxUnusedAddressGap: 20, - maxNumberOfIndexesToCheck: 1000, - height: 0), - throwsA(isA())); - - verify(wallet.recoverFromMnemonic( - mnemonic: "Some invalid mnemonic", - maxUnusedAddressGap: 20, - maxNumberOfIndexesToCheck: 1000, - height: 0)) - .called(1); - }); - - test("failed recovery due to some other error", () async { - final CoinServiceAPI wallet = MockBitcoinWallet(); - when(wallet.recoverFromMnemonic( - mnemonic: "Some valid mnemonic", - maxUnusedAddressGap: 20, - maxNumberOfIndexesToCheck: 1000, - height: 0)) - .thenThrow(Error()); - - final manager = Manager(wallet); - - expect( - () => manager.recoverFromMnemonic( - mnemonic: "Some valid mnemonic", - maxUnusedAddressGap: 20, - maxNumberOfIndexesToCheck: 1000, - height: 0), - throwsA(isA())); - - verify(wallet.recoverFromMnemonic( - mnemonic: "Some valid mnemonic", - maxUnusedAddressGap: 20, - maxNumberOfIndexesToCheck: 1000, - height: 0)) - .called(1); - }); - }); - - test("exitCurrentWallet", () async { - final CoinServiceAPI wallet = MockBitcoinWallet(); - when(wallet.exit()).thenAnswer((realInvocation) => Future(() => {})); - when(wallet.walletId).thenAnswer((realInvocation) => "some id"); - when(wallet.walletName).thenAnswer((realInvocation) => "some name"); - - final manager = Manager(wallet); - - await manager.exitCurrentWallet(); - - verify(wallet.exit()).called(1); - verify(wallet.walletName).called(1); - verify(wallet.walletId).called(1); - - expect(manager.hasBackgroundRefreshListener, false); - }); - - test("dispose", () async { - final CoinServiceAPI wallet = MockBitcoinWallet(); - when(wallet.exit()).thenAnswer((realInvocation) => Future(() => {})); - when(wallet.walletId).thenAnswer((realInvocation) => "some id"); - when(wallet.walletName).thenAnswer((realInvocation) => "some name"); - - final manager = Manager(wallet); - - expect(() => manager.dispose(), returnsNormally); - }); - - test("fullRescan succeeds", () { - final CoinServiceAPI wallet = MockBitcoinWallet(); - when(wallet.fullRescan(20, 1000)).thenAnswer((_) async {}); - - final manager = Manager(wallet); - - expect(() => manager.fullRescan(20, 1000), returnsNormally); - }); - - test("fullRescan fails", () { - final CoinServiceAPI wallet = MockBitcoinWallet(); - when(wallet.fullRescan(20, 1000)).thenThrow(Exception()); - - final manager = Manager(wallet); - - expect(() => manager.fullRescan(20, 1000), throwsA(isA())); - }); - - // test("act on event", () async { - // final CoinServiceAPI wallet = MockFiroWallet(); - // when(wallet.exit()).thenAnswer((realInvocation) => Future(() => {})); - // - // final manager = Manager(wallet); - // - // expect( - // () => GlobalEventBus.instance.fire(UpdatedInBackgroundEvent( - // "act on event - test message", "wallet ID")), - // returnsNormally); - // - // expect(() => manager.dispose(), returnsNormally); - // }); -} +// import 'package:decimal/decimal.dart'; +// import 'package:flutter_test/flutter_test.dart'; +// import 'package:mockito/annotations.dart'; +// import 'package:mockito/mockito.dart'; +// import 'package:stackwallet/electrumx_rpc/electrumx.dart'; +// import 'package:stackwallet/models/balance.dart'; +// import 'package:stackwallet/models/isar/models/isar_models.dart'; +// import 'package:stackwallet/models/paymint/fee_object_model.dart'; +// import 'package:stackwallet/services/coins/coin_service.dart'; +// import 'package:stackwallet/services/coins/firo/firo_wallet.dart'; +// import 'package:stackwallet/services/coins/manager.dart'; +// import 'package:stackwallet/utilities/amount/amount.dart'; +// import 'package:stackwallet/utilities/enums/coin_enum.dart'; +// +// import 'manager_test.mocks.dart'; +// +// /// quick amount constructor wrapper. Using an int is bad practice but for +// /// testing with small amounts this should be fine +// Amount _a(int i) => Amount.fromDecimal( +// Decimal.fromInt(i), +// fractionDigits: 8, +// ); +// +// @GenerateMocks([FiroWallet, ElectrumX]) +// void main() { +// test("Manager should have a backgroundRefreshListener on initialization", () { +// final manager = Manager(MockFiroWallet()); +// +// expect(manager.hasBackgroundRefreshListener, true); +// }); +// +// test("get coin", () { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.coin).thenAnswer((_) => Coin.firo); +// final manager = Manager(wallet); +// +// expect(manager.coin, Coin.firo); +// }); +// +// test("fees", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.fees).thenAnswer((_) async => FeeObject( +// fast: 10, +// medium: 5, +// slow: 1, +// numberOfBlocksFast: 4, +// numberOfBlocksSlow: 2, +// numberOfBlocksAverage: 3)); +// +// final manager = Manager(wallet); +// +// final feeObject = await manager.fees; +// +// expect(feeObject.fast, 10); +// expect(feeObject.medium, 5); +// expect(feeObject.slow, 1); +// expect(feeObject.numberOfBlocksFast, 4); +// expect(feeObject.numberOfBlocksAverage, 3); +// expect(feeObject.numberOfBlocksSlow, 2); +// }); +// +// test("maxFee", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.maxFee).thenAnswer((_) async => 10); +// +// final manager = Manager(wallet); +// +// final fee = await manager.maxFee; +// +// expect(fee, 10); +// }); +// +// test("get currentReceivingAddress", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.currentReceivingAddress) +// .thenAnswer((_) async => "Some address string"); +// +// final manager = Manager(wallet); +// +// expect(await manager.currentReceivingAddress, "Some address string"); +// }); +// +// group("get balances", () { +// test("balance", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// final balance = Balance( +// total: _a(10), +// spendable: _a(1), +// blockedTotal: _a(0), +// pendingSpendable: _a(9), +// ); +// +// when(wallet.coin).thenAnswer((_) => Coin.firo); +// when(wallet.balance).thenAnswer( +// (_) => balance, +// ); +// +// final manager = Manager(wallet); +// +// expect(manager.balance, balance); +// }); +// }); +// +// test("transactions", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// +// when(wallet.coin).thenAnswer((realInvocation) => Coin.firo); +// +// final tx = Transaction( +// walletId: "walletId", +// txid: "txid", +// timestamp: 6, +// type: TransactionType.incoming, +// subType: TransactionSubType.mint, +// amount: 123, +// amountString: Amount( +// rawValue: BigInt.from(123), +// fractionDigits: wallet.coin.decimals, +// ).toJsonString(), +// fee: 3, +// height: 123, +// isCancelled: false, +// isLelantus: true, +// slateId: null, +// otherData: null, +// nonce: null, +// inputs: [], +// outputs: [], +// numberOfMessages: null, +// ); +// when(wallet.transactions).thenAnswer((_) async => [ +// tx, +// ]); +// +// final manager = Manager(wallet); +// +// final result = await manager.transactions; +// +// expect(result.length, 1); +// +// expect(result.first, tx); +// }); +// +// test("refresh", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.refresh()).thenAnswer((_) => Future(() => {})); +// +// final manager = Manager(wallet); +// +// await manager.refresh(); +// +// verify(wallet.refresh()).called(1); +// }); +// +// test("get walletName", () { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.walletName).thenAnswer((_) => "Some wallet name"); +// final manager = Manager(wallet); +// +// expect(manager.walletName, "Some wallet name"); +// }); +// +// test("get walletId", () { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.walletId).thenAnswer((_) => "Some wallet ID"); +// +// final manager = Manager(wallet); +// +// expect(manager.walletId, "Some wallet ID"); +// }); +// +// group("validateAddress", () { +// test("some valid address", () { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.validateAddress("a valid address")).thenAnswer((_) => true); +// +// final manager = Manager(wallet); +// +// expect(manager.validateAddress("a valid address"), true); +// }); +// +// test("some invalid address", () { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.validateAddress("an invalid address")) +// .thenAnswer((_) => false); +// +// final manager = Manager(wallet); +// +// expect(manager.validateAddress("an invalid address"), false); +// }); +// }); +// +// test("get mnemonic", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.mnemonic) +// .thenAnswer((_) async => ["Some", "seed", "word", "list"]); +// +// final manager = Manager(wallet); +// +// expect(await manager.mnemonic, ["Some", "seed", "word", "list"]); +// }); +// +// test("testNetworkConnection", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.testNetworkConnection()).thenAnswer((_) async => true); +// +// final manager = Manager(wallet); +// +// expect(await manager.testNetworkConnection(), true); +// }); +// +// group("recoverFromMnemonic", () { +// test("successfully recover", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.recoverFromMnemonic( +// mnemonic: "Some valid mnemonic", +// maxUnusedAddressGap: 20, +// maxNumberOfIndexesToCheck: 1000, +// height: 0)) +// .thenAnswer((realInvocation) => Future(() => {})); +// +// final manager = Manager(wallet); +// +// await manager.recoverFromMnemonic( +// mnemonic: "Some valid mnemonic", +// maxUnusedAddressGap: 20, +// maxNumberOfIndexesToCheck: 1000, +// height: 0); +// +// verify(wallet.recoverFromMnemonic( +// mnemonic: "Some valid mnemonic", +// maxUnusedAddressGap: 20, +// maxNumberOfIndexesToCheck: 1000, +// height: 0)) +// .called(1); +// }); +// +// test("failed recovery", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.recoverFromMnemonic( +// mnemonic: "Some invalid mnemonic", +// maxUnusedAddressGap: 20, +// maxNumberOfIndexesToCheck: 1000, +// height: 0)) +// .thenThrow(Exception("Invalid mnemonic")); +// +// final manager = Manager(wallet); +// +// expect( +// () => manager.recoverFromMnemonic( +// mnemonic: "Some invalid mnemonic", +// maxUnusedAddressGap: 20, +// maxNumberOfIndexesToCheck: 1000, +// height: 0), +// throwsA(isA())); +// +// verify(wallet.recoverFromMnemonic( +// mnemonic: "Some invalid mnemonic", +// maxUnusedAddressGap: 20, +// maxNumberOfIndexesToCheck: 1000, +// height: 0)) +// .called(1); +// }); +// +// test("failed recovery due to some other error", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.recoverFromMnemonic( +// mnemonic: "Some valid mnemonic", +// maxUnusedAddressGap: 20, +// maxNumberOfIndexesToCheck: 1000, +// height: 0)) +// .thenThrow(Error()); +// +// final manager = Manager(wallet); +// +// expect( +// () => manager.recoverFromMnemonic( +// mnemonic: "Some valid mnemonic", +// maxUnusedAddressGap: 20, +// maxNumberOfIndexesToCheck: 1000, +// height: 0), +// throwsA(isA())); +// +// verify(wallet.recoverFromMnemonic( +// mnemonic: "Some valid mnemonic", +// maxUnusedAddressGap: 20, +// maxNumberOfIndexesToCheck: 1000, +// height: 0)) +// .called(1); +// }); +// }); +// +// test("exitCurrentWallet", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.exit()).thenAnswer((realInvocation) => Future(() => {})); +// when(wallet.walletId).thenAnswer((realInvocation) => "some id"); +// when(wallet.walletName).thenAnswer((realInvocation) => "some name"); +// +// final manager = Manager(wallet); +// +// await manager.exitCurrentWallet(); +// +// verify(wallet.exit()).called(1); +// verify(wallet.walletName).called(1); +// verify(wallet.walletId).called(1); +// +// expect(manager.hasBackgroundRefreshListener, false); +// }); +// +// test("dispose", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.exit()).thenAnswer((realInvocation) => Future(() => {})); +// when(wallet.walletId).thenAnswer((realInvocation) => "some id"); +// when(wallet.walletName).thenAnswer((realInvocation) => "some name"); +// +// final manager = Manager(wallet); +// +// expect(() => manager.dispose(), returnsNormally); +// }); +// +// test("fullRescan succeeds", () { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.fullRescan(20, 1000)).thenAnswer((_) async {}); +// +// final manager = Manager(wallet); +// +// expect(() => manager.fullRescan(20, 1000), returnsNormally); +// }); +// +// test("fullRescan fails", () { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.fullRescan(20, 1000)).thenThrow(Exception()); +// +// final manager = Manager(wallet); +// +// expect(() => manager.fullRescan(20, 1000), throwsA(isA())); +// }); +// +// // test("act on event", () async { +// // final CoinServiceAPI wallet = MockFiroWallet(); +// // when(wallet.exit()).thenAnswer((realInvocation) => Future(() => {})); +// // +// // final manager = Manager(wallet); +// // +// // expect( +// // () => GlobalEventBus.instance.fire(UpdatedInBackgroundEvent( +// // "act on event - test message", "wallet ID")), +// // returnsNormally); +// // +// // expect(() => manager.dispose(), returnsNormally); +// // }); +// } diff --git a/test/services/coins/manager_test.mocks.dart b/test/services/coins/manager_test.mocks.dart deleted file mode 100644 index ad1c81f328..0000000000 --- a/test/services/coins/manager_test.mocks.dart +++ /dev/null @@ -1,1781 +0,0 @@ -// Mocks generated by Mockito 5.3.2 from annotations -// in stackduo/test/services/coins/manager_test.dart. -// Do not manually edit this file. - -// ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i16; -import 'dart:typed_data' as _i21; - -import 'package:bip32/bip32.dart' as _i11; -import 'package:bip47/bip47.dart' as _i13; -import 'package:bitcoindart/bitcoindart.dart' as _i8; -import 'package:decimal/decimal.dart' as _i14; -import 'package:mockito/mockito.dart' as _i1; -import 'package:stackduo/db/main_db.dart' as _i7; -import 'package:stackduo/electrumx_rpc/cached_electrumx.dart' as _i5; -import 'package:stackduo/electrumx_rpc/electrumx.dart' as _i4; -import 'package:stackduo/models/balance.dart' as _i6; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i12; -import 'package:stackduo/models/paymint/fee_object_model.dart' as _i3; -import 'package:stackduo/models/signing_data.dart' as _i19; -import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart' as _i15; -import 'package:stackduo/services/transaction_notification_tracker.dart' as _i2; -import 'package:stackduo/utilities/amount/amount.dart' as _i9; -import 'package:stackduo/utilities/enums/coin_enum.dart' as _i17; -import 'package:stackduo/utilities/enums/derive_path_type_enum.dart' as _i18; -import 'package:stackduo/utilities/flutter_secure_storage_interface.dart' - as _i20; -import 'package:tuple/tuple.dart' as _i10; - -// ignore_for_file: type=lint -// ignore_for_file: avoid_redundant_argument_values -// ignore_for_file: avoid_setters_without_getters -// ignore_for_file: comment_references -// ignore_for_file: implementation_imports -// ignore_for_file: invalid_use_of_visible_for_testing_member -// ignore_for_file: prefer_const_constructors -// ignore_for_file: unnecessary_parenthesis -// ignore_for_file: camel_case_types -// ignore_for_file: subtype_of_sealed_class - -class _FakeTransactionNotificationTracker_0 extends _i1.SmartFake - implements _i2.TransactionNotificationTracker { - _FakeTransactionNotificationTracker_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeFeeObject_1 extends _i1.SmartFake implements _i3.FeeObject { - _FakeFeeObject_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeElectrumX_2 extends _i1.SmartFake implements _i4.ElectrumX { - _FakeElectrumX_2( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeCachedElectrumX_3 extends _i1.SmartFake - implements _i5.CachedElectrumX { - _FakeCachedElectrumX_3( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeBalance_4 extends _i1.SmartFake implements _i6.Balance { - _FakeBalance_4( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeMainDB_5 extends _i1.SmartFake implements _i7.MainDB { - _FakeMainDB_5( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeNetworkType_6 extends _i1.SmartFake implements _i8.NetworkType { - _FakeNetworkType_6( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeElectrumXNode_7 extends _i1.SmartFake implements _i4.ElectrumXNode { - _FakeElectrumXNode_7( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeAmount_8 extends _i1.SmartFake implements _i9.Amount { - _FakeAmount_8( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeTuple2_9 extends _i1.SmartFake - implements _i10.Tuple2 { - _FakeTuple2_9( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeBIP32_10 extends _i1.SmartFake implements _i11.BIP32 { - _FakeBIP32_10( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeAddress_11 extends _i1.SmartFake implements _i12.Address { - _FakeAddress_11( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakePaymentCode_12 extends _i1.SmartFake implements _i13.PaymentCode { - _FakePaymentCode_12( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeDecimal_13 extends _i1.SmartFake implements _i14.Decimal { - _FakeDecimal_13( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -/// A class which mocks [BitcoinWallet]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockBitcoinWallet extends _i1.Mock implements _i15.BitcoinWallet { - MockBitcoinWallet() { - _i1.throwOnMissingStub(this); - } - - @override - set timer(_i16.Timer? _timer) => super.noSuchMethod( - Invocation.setter( - #timer, - _timer, - ), - returnValueForMissingStub: null, - ); - @override - _i2.TransactionNotificationTracker get txTracker => (super.noSuchMethod( - Invocation.getter(#txTracker), - returnValue: _FakeTransactionNotificationTracker_0( - this, - Invocation.getter(#txTracker), - ), - ) as _i2.TransactionNotificationTracker); - @override - set txTracker(_i2.TransactionNotificationTracker? _txTracker) => - super.noSuchMethod( - Invocation.setter( - #txTracker, - _txTracker, - ), - returnValueForMissingStub: null, - ); - @override - bool get longMutex => (super.noSuchMethod( - Invocation.getter(#longMutex), - returnValue: false, - ) as bool); - @override - set longMutex(bool? _longMutex) => super.noSuchMethod( - Invocation.setter( - #longMutex, - _longMutex, - ), - returnValueForMissingStub: null, - ); - @override - bool get refreshMutex => (super.noSuchMethod( - Invocation.getter(#refreshMutex), - returnValue: false, - ) as bool); - @override - set refreshMutex(bool? _refreshMutex) => super.noSuchMethod( - Invocation.setter( - #refreshMutex, - _refreshMutex, - ), - returnValueForMissingStub: null, - ); - @override - bool get isActive => (super.noSuchMethod( - Invocation.getter(#isActive), - returnValue: false, - ) as bool); - @override - set isActive(bool? _isActive) => super.noSuchMethod( - Invocation.setter( - #isActive, - _isActive, - ), - returnValueForMissingStub: null, - ); - @override - set isFavorite(bool? markFavorite) => super.noSuchMethod( - Invocation.setter( - #isFavorite, - markFavorite, - ), - returnValueForMissingStub: null, - ); - @override - bool get isFavorite => (super.noSuchMethod( - Invocation.getter(#isFavorite), - returnValue: false, - ) as bool); - @override - _i17.Coin get coin => (super.noSuchMethod( - Invocation.getter(#coin), - returnValue: _i17.Coin.bitcoin, - ) as _i17.Coin); - @override - _i16.Future> get utxos => (super.noSuchMethod( - Invocation.getter(#utxos), - returnValue: _i16.Future>.value(<_i12.UTXO>[]), - ) as _i16.Future>); - @override - _i16.Future> get transactions => (super.noSuchMethod( - Invocation.getter(#transactions), - returnValue: - _i16.Future>.value(<_i12.Transaction>[]), - ) as _i16.Future>); - @override - _i16.Future get currentReceivingAddress => (super.noSuchMethod( - Invocation.getter(#currentReceivingAddress), - returnValue: _i16.Future.value(''), - ) as _i16.Future); - @override - _i16.Future get currentChangeAddress => (super.noSuchMethod( - Invocation.getter(#currentChangeAddress), - returnValue: _i16.Future.value(''), - ) as _i16.Future); - @override - _i16.Future get currentChangeAddressP2PKH => (super.noSuchMethod( - Invocation.getter(#currentChangeAddressP2PKH), - returnValue: _i16.Future.value(''), - ) as _i16.Future); - @override - bool get hasCalledExit => (super.noSuchMethod( - Invocation.getter(#hasCalledExit), - returnValue: false, - ) as bool); - @override - _i16.Future<_i3.FeeObject> get fees => (super.noSuchMethod( - Invocation.getter(#fees), - returnValue: _i16.Future<_i3.FeeObject>.value(_FakeFeeObject_1( - this, - Invocation.getter(#fees), - )), - ) as _i16.Future<_i3.FeeObject>); - @override - _i16.Future get maxFee => (super.noSuchMethod( - Invocation.getter(#maxFee), - returnValue: _i16.Future.value(0), - ) as _i16.Future); - @override - _i16.Future> get mnemonic => (super.noSuchMethod( - Invocation.getter(#mnemonic), - returnValue: _i16.Future>.value([]), - ) as _i16.Future>); - @override - _i16.Future get mnemonicString => (super.noSuchMethod( - Invocation.getter(#mnemonicString), - returnValue: _i16.Future.value(), - ) as _i16.Future); - @override - _i16.Future get mnemonicPassphrase => (super.noSuchMethod( - Invocation.getter(#mnemonicPassphrase), - returnValue: _i16.Future.value(), - ) as _i16.Future); - @override - _i16.Future get chainHeight => (super.noSuchMethod( - Invocation.getter(#chainHeight), - returnValue: _i16.Future.value(0), - ) as _i16.Future); - @override - int get storedChainHeight => (super.noSuchMethod( - Invocation.getter(#storedChainHeight), - returnValue: 0, - ) as int); - @override - bool get shouldAutoSync => (super.noSuchMethod( - Invocation.getter(#shouldAutoSync), - returnValue: false, - ) as bool); - @override - set shouldAutoSync(bool? shouldAutoSync) => super.noSuchMethod( - Invocation.setter( - #shouldAutoSync, - shouldAutoSync, - ), - returnValueForMissingStub: null, - ); - @override - bool get isRefreshing => (super.noSuchMethod( - Invocation.getter(#isRefreshing), - returnValue: false, - ) as bool); - @override - bool get isConnected => (super.noSuchMethod( - Invocation.getter(#isConnected), - returnValue: false, - ) as bool); - @override - String get walletId => (super.noSuchMethod( - Invocation.getter(#walletId), - returnValue: '', - ) as String); - @override - String get walletName => (super.noSuchMethod( - Invocation.getter(#walletName), - returnValue: '', - ) as String); - @override - set walletName(String? newName) => super.noSuchMethod( - Invocation.setter( - #walletName, - newName, - ), - returnValueForMissingStub: null, - ); - @override - _i4.ElectrumX get electrumXClient => (super.noSuchMethod( - Invocation.getter(#electrumXClient), - returnValue: _FakeElectrumX_2( - this, - Invocation.getter(#electrumXClient), - ), - ) as _i4.ElectrumX); - @override - _i5.CachedElectrumX get cachedElectrumXClient => (super.noSuchMethod( - Invocation.getter(#cachedElectrumXClient), - returnValue: _FakeCachedElectrumX_3( - this, - Invocation.getter(#cachedElectrumXClient), - ), - ) as _i5.CachedElectrumX); - @override - _i6.Balance get balance => (super.noSuchMethod( - Invocation.getter(#balance), - returnValue: _FakeBalance_4( - this, - Invocation.getter(#balance), - ), - ) as _i6.Balance); - @override - _i16.Future get xpub => (super.noSuchMethod( - Invocation.getter(#xpub), - returnValue: _i16.Future.value(''), - ) as _i16.Future); - @override - set onIsActiveWalletChanged(void Function(bool)? _onIsActiveWalletChanged) => - super.noSuchMethod( - Invocation.setter( - #onIsActiveWalletChanged, - _onIsActiveWalletChanged, - ), - returnValueForMissingStub: null, - ); - @override - _i7.MainDB get db => (super.noSuchMethod( - Invocation.getter(#db), - returnValue: _FakeMainDB_5( - this, - Invocation.getter(#db), - ), - ) as _i7.MainDB); - @override - _i8.NetworkType get networkType => (super.noSuchMethod( - Invocation.getter(#networkType), - returnValue: _FakeNetworkType_6( - this, - Invocation.getter(#networkType), - ), - ) as _i8.NetworkType); - @override - _i16.Future exit() => (super.noSuchMethod( - Invocation.method( - #exit, - [], - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); - @override - _i18.DerivePathType addressType({required String? address}) => - (super.noSuchMethod( - Invocation.method( - #addressType, - [], - {#address: address}, - ), - returnValue: _i18.DerivePathType.bip44, - ) as _i18.DerivePathType); - @override - _i16.Future recoverFromMnemonic({ - required String? mnemonic, - String? mnemonicPassphrase, - required int? maxUnusedAddressGap, - required int? maxNumberOfIndexesToCheck, - required int? height, - }) => - (super.noSuchMethod( - Invocation.method( - #recoverFromMnemonic, - [], - { - #mnemonic: mnemonic, - #mnemonicPassphrase: mnemonicPassphrase, - #maxUnusedAddressGap: maxUnusedAddressGap, - #maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, - #height: height, - }, - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); - @override - _i16.Future getTransactionCacheEarly(List? allAddresses) => - (super.noSuchMethod( - Invocation.method( - #getTransactionCacheEarly, - [allAddresses], - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); - @override - _i16.Future refreshIfThereIsNewData() => (super.noSuchMethod( - Invocation.method( - #refreshIfThereIsNewData, - [], - ), - returnValue: _i16.Future.value(false), - ) as _i16.Future); - @override - _i16.Future getAllTxsToWatch() => (super.noSuchMethod( - Invocation.method( - #getAllTxsToWatch, - [], - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); - @override - _i16.Future refresh() => (super.noSuchMethod( - Invocation.method( - #refresh, - [], - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); - @override - _i16.Future> prepareSend({ - required String? address, - required _i9.Amount? amount, - Map? args, - }) => - (super.noSuchMethod( - Invocation.method( - #prepareSend, - [], - { - #address: address, - #amount: amount, - #args: args, - }, - ), - returnValue: - _i16.Future>.value({}), - ) as _i16.Future>); - @override - _i16.Future confirmSend({required Map? txData}) => - (super.noSuchMethod( - Invocation.method( - #confirmSend, - [], - {#txData: txData}, - ), - returnValue: _i16.Future.value(''), - ) as _i16.Future); - @override - _i16.Future testNetworkConnection() => (super.noSuchMethod( - Invocation.method( - #testNetworkConnection, - [], - ), - returnValue: _i16.Future.value(false), - ) as _i16.Future); - @override - void startNetworkAlivePinging() => super.noSuchMethod( - Invocation.method( - #startNetworkAlivePinging, - [], - ), - returnValueForMissingStub: null, - ); - @override - void stopNetworkAlivePinging() => super.noSuchMethod( - Invocation.method( - #stopNetworkAlivePinging, - [], - ), - returnValueForMissingStub: null, - ); - @override - _i16.Future initializeNew() => (super.noSuchMethod( - Invocation.method( - #initializeNew, - [], - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); - @override - _i16.Future initializeExisting() => (super.noSuchMethod( - Invocation.method( - #initializeExisting, - [], - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); - @override - _i16.Future updateSentCachedTxData(Map? txData) => - (super.noSuchMethod( - Invocation.method( - #updateSentCachedTxData, - [txData], - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); - @override - bool validateAddress(String? address) => (super.noSuchMethod( - Invocation.method( - #validateAddress, - [address], - ), - returnValue: false, - ) as bool); - @override - _i16.Future updateNode(bool? shouldRefresh) => (super.noSuchMethod( - Invocation.method( - #updateNode, - [shouldRefresh], - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); - @override - _i16.Future<_i4.ElectrumXNode> getCurrentNode() => (super.noSuchMethod( - Invocation.method( - #getCurrentNode, - [], - ), - returnValue: _i16.Future<_i4.ElectrumXNode>.value(_FakeElectrumXNode_7( - this, - Invocation.method( - #getCurrentNode, - [], - ), - )), - ) as _i16.Future<_i4.ElectrumXNode>); - @override - _i16.Future>> fastFetch( - List? allTxHashes) => - (super.noSuchMethod( - Invocation.method( - #fastFetch, - [allTxHashes], - ), - returnValue: _i16.Future>>.value( - >[]), - ) as _i16.Future>>); - @override - _i16.Future getTxCount({required String? address}) => - (super.noSuchMethod( - Invocation.method( - #getTxCount, - [], - {#address: address}, - ), - returnValue: _i16.Future.value(0), - ) as _i16.Future); - @override - _i16.Future checkCurrentReceivingAddressesForTransactions() => - (super.noSuchMethod( - Invocation.method( - #checkCurrentReceivingAddressesForTransactions, - [], - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); - @override - _i16.Future checkCurrentChangeAddressesForTransactions() => - (super.noSuchMethod( - Invocation.method( - #checkCurrentChangeAddressesForTransactions, - [], - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); - @override - int estimateTxFee({ - required int? vSize, - required int? feeRatePerKB, - }) => - (super.noSuchMethod( - Invocation.method( - #estimateTxFee, - [], - { - #vSize: vSize, - #feeRatePerKB: feeRatePerKB, - }, - ), - returnValue: 0, - ) as int); - @override - dynamic coinSelection({ - required int? satoshiAmountToSend, - required int? selectedTxFeeRate, - required String? recipientAddress, - required bool? coinControl, - required bool? isSendAll, - int? additionalOutputs = 0, - List<_i12.UTXO>? utxos, - }) => - super.noSuchMethod(Invocation.method( - #coinSelection, - [], - { - #satoshiAmountToSend: satoshiAmountToSend, - #selectedTxFeeRate: selectedTxFeeRate, - #recipientAddress: recipientAddress, - #coinControl: coinControl, - #isSendAll: isSendAll, - #additionalOutputs: additionalOutputs, - #utxos: utxos, - }, - )); - @override - _i16.Future> fetchBuildTxData( - List<_i12.UTXO>? utxosToUse) => - (super.noSuchMethod( - Invocation.method( - #fetchBuildTxData, - [utxosToUse], - ), - returnValue: - _i16.Future>.value(<_i19.SigningData>[]), - ) as _i16.Future>); - @override - _i16.Future> buildTransaction({ - required List<_i19.SigningData>? utxoSigningData, - required List? recipients, - required List? satoshiAmounts, - }) => - (super.noSuchMethod( - Invocation.method( - #buildTransaction, - [], - { - #utxoSigningData: utxoSigningData, - #recipients: recipients, - #satoshiAmounts: satoshiAmounts, - }, - ), - returnValue: - _i16.Future>.value({}), - ) as _i16.Future>); - @override - _i16.Future fullRescan( - int? maxUnusedAddressGap, - int? maxNumberOfIndexesToCheck, - ) => - (super.noSuchMethod( - Invocation.method( - #fullRescan, - [ - maxUnusedAddressGap, - maxNumberOfIndexesToCheck, - ], - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); - @override - _i16.Future<_i9.Amount> estimateFeeFor( - _i9.Amount? amount, - int? feeRate, - ) => - (super.noSuchMethod( - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - returnValue: _i16.Future<_i9.Amount>.value(_FakeAmount_8( - this, - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - )), - ) as _i16.Future<_i9.Amount>); - @override - _i9.Amount roughFeeEstimate( - int? inputCount, - int? outputCount, - int? feeRatePerKB, - ) => - (super.noSuchMethod( - Invocation.method( - #roughFeeEstimate, - [ - inputCount, - outputCount, - feeRatePerKB, - ], - ), - returnValue: _FakeAmount_8( - this, - Invocation.method( - #roughFeeEstimate, - [ - inputCount, - outputCount, - feeRatePerKB, - ], - ), - ), - ) as _i9.Amount); - @override - _i16.Future<_i9.Amount> sweepAllEstimate(int? feeRate) => (super.noSuchMethod( - Invocation.method( - #sweepAllEstimate, - [feeRate], - ), - returnValue: _i16.Future<_i9.Amount>.value(_FakeAmount_8( - this, - Invocation.method( - #sweepAllEstimate, - [feeRate], - ), - )), - ) as _i16.Future<_i9.Amount>); - @override - _i16.Future generateNewAddress() => (super.noSuchMethod( - Invocation.method( - #generateNewAddress, - [], - ), - returnValue: _i16.Future.value(false), - ) as _i16.Future); - @override - void initCache( - String? walletId, - _i17.Coin? coin, - ) => - super.noSuchMethod( - Invocation.method( - #initCache, - [ - walletId, - coin, - ], - ), - returnValueForMissingStub: null, - ); - @override - _i16.Future updateCachedId(String? id) => (super.noSuchMethod( - Invocation.method( - #updateCachedId, - [id], - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); - @override - int getCachedChainHeight() => (super.noSuchMethod( - Invocation.method( - #getCachedChainHeight, - [], - ), - returnValue: 0, - ) as int); - @override - _i16.Future updateCachedChainHeight(int? height) => (super.noSuchMethod( - Invocation.method( - #updateCachedChainHeight, - [height], - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); - @override - bool getCachedIsFavorite() => (super.noSuchMethod( - Invocation.method( - #getCachedIsFavorite, - [], - ), - returnValue: false, - ) as bool); - @override - _i16.Future updateCachedIsFavorite(bool? isFavorite) => - (super.noSuchMethod( - Invocation.method( - #updateCachedIsFavorite, - [isFavorite], - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); - @override - _i6.Balance getCachedBalance() => (super.noSuchMethod( - Invocation.method( - #getCachedBalance, - [], - ), - returnValue: _FakeBalance_4( - this, - Invocation.method( - #getCachedBalance, - [], - ), - ), - ) as _i6.Balance); - @override - _i16.Future updateCachedBalance(_i6.Balance? balance) => - (super.noSuchMethod( - Invocation.method( - #updateCachedBalance, - [balance], - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); - @override - _i6.Balance getCachedBalanceSecondary() => (super.noSuchMethod( - Invocation.method( - #getCachedBalanceSecondary, - [], - ), - returnValue: _FakeBalance_4( - this, - Invocation.method( - #getCachedBalanceSecondary, - [], - ), - ), - ) as _i6.Balance); - @override - _i16.Future updateCachedBalanceSecondary(_i6.Balance? balance) => - (super.noSuchMethod( - Invocation.method( - #updateCachedBalanceSecondary, - [balance], - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); - @override - void initWalletDB({_i7.MainDB? mockableOverride}) => super.noSuchMethod( - Invocation.method( - #initWalletDB, - [], - {#mockableOverride: mockableOverride}, - ), - returnValueForMissingStub: null, - ); - @override - _i16.Future<_i10.Tuple2<_i12.Transaction, _i12.Address>> parseTransaction( - Map? txData, - dynamic electrumxClient, - List<_i12.Address>? myAddresses, - _i17.Coin? coin, - int? minConfirms, - String? walletId, - ) => - (super.noSuchMethod( - Invocation.method( - #parseTransaction, - [ - txData, - electrumxClient, - myAddresses, - coin, - minConfirms, - walletId, - ], - ), - returnValue: - _i16.Future<_i10.Tuple2<_i12.Transaction, _i12.Address>>.value( - _FakeTuple2_9<_i12.Transaction, _i12.Address>( - this, - Invocation.method( - #parseTransaction, - [ - txData, - electrumxClient, - myAddresses, - coin, - minConfirms, - walletId, - ], - ), - )), - ) as _i16.Future<_i10.Tuple2<_i12.Transaction, _i12.Address>>); - @override - void initPaynymWalletInterface({ - required String? walletId, - required String? walletName, - required _i8.NetworkType? network, - required _i17.Coin? coin, - required _i7.MainDB? db, - required _i4.ElectrumX? electrumXClient, - required _i20.SecureStorageInterface? secureStorage, - required int? dustLimit, - required int? dustLimitP2PKH, - required int? minConfirms, - required _i16.Future Function()? getMnemonicString, - required _i16.Future Function()? getMnemonicPassphrase, - required _i16.Future Function()? getChainHeight, - required _i16.Future Function()? getCurrentChangeAddress, - required int Function({ - required int feeRatePerKB, - required int vSize, - })? - estimateTxFee, - required _i16.Future> Function({ - required String address, - required _i9.Amount amount, - Map? args, - })? - prepareSend, - required _i16.Future Function({required String address})? getTxCount, - required _i16.Future> Function(List<_i12.UTXO>)? - fetchBuildTxData, - required _i16.Future Function()? refresh, - required _i16.Future Function()? checkChangeAddressForTransactions, - }) => - super.noSuchMethod( - Invocation.method( - #initPaynymWalletInterface, - [], - { - #walletId: walletId, - #walletName: walletName, - #network: network, - #coin: coin, - #db: db, - #electrumXClient: electrumXClient, - #secureStorage: secureStorage, - #dustLimit: dustLimit, - #dustLimitP2PKH: dustLimitP2PKH, - #minConfirms: minConfirms, - #getMnemonicString: getMnemonicString, - #getMnemonicPassphrase: getMnemonicPassphrase, - #getChainHeight: getChainHeight, - #getCurrentChangeAddress: getCurrentChangeAddress, - #estimateTxFee: estimateTxFee, - #prepareSend: prepareSend, - #getTxCount: getTxCount, - #fetchBuildTxData: fetchBuildTxData, - #refresh: refresh, - #checkChangeAddressForTransactions: - checkChangeAddressForTransactions, - }, - ), - returnValueForMissingStub: null, - ); - @override - _i16.Future<_i11.BIP32> getBip47BaseNode() => (super.noSuchMethod( - Invocation.method( - #getBip47BaseNode, - [], - ), - returnValue: _i16.Future<_i11.BIP32>.value(_FakeBIP32_10( - this, - Invocation.method( - #getBip47BaseNode, - [], - ), - )), - ) as _i16.Future<_i11.BIP32>); - @override - _i16.Future<_i21.Uint8List> getPrivateKeyForPaynymReceivingAddress({ - required String? paymentCodeString, - required int? index, - }) => - (super.noSuchMethod( - Invocation.method( - #getPrivateKeyForPaynymReceivingAddress, - [], - { - #paymentCodeString: paymentCodeString, - #index: index, - }, - ), - returnValue: _i16.Future<_i21.Uint8List>.value(_i21.Uint8List(0)), - ) as _i16.Future<_i21.Uint8List>); - @override - _i16.Future<_i12.Address> currentReceivingPaynymAddress({ - required _i13.PaymentCode? sender, - required bool? isSegwit, - }) => - (super.noSuchMethod( - Invocation.method( - #currentReceivingPaynymAddress, - [], - { - #sender: sender, - #isSegwit: isSegwit, - }, - ), - returnValue: _i16.Future<_i12.Address>.value(_FakeAddress_11( - this, - Invocation.method( - #currentReceivingPaynymAddress, - [], - { - #sender: sender, - #isSegwit: isSegwit, - }, - ), - )), - ) as _i16.Future<_i12.Address>); - @override - _i16.Future checkCurrentPaynymReceivingAddressForTransactions({ - required _i13.PaymentCode? sender, - required bool? isSegwit, - }) => - (super.noSuchMethod( - Invocation.method( - #checkCurrentPaynymReceivingAddressForTransactions, - [], - { - #sender: sender, - #isSegwit: isSegwit, - }, - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); - @override - _i16.Future checkAllCurrentReceivingPaynymAddressesForTransactions() => - (super.noSuchMethod( - Invocation.method( - #checkAllCurrentReceivingPaynymAddressesForTransactions, - [], - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); - @override - _i16.Future<_i11.BIP32> deriveNotificationBip32Node() => (super.noSuchMethod( - Invocation.method( - #deriveNotificationBip32Node, - [], - ), - returnValue: _i16.Future<_i11.BIP32>.value(_FakeBIP32_10( - this, - Invocation.method( - #deriveNotificationBip32Node, - [], - ), - )), - ) as _i16.Future<_i11.BIP32>); - @override - _i16.Future<_i13.PaymentCode> getPaymentCode({required bool? isSegwit}) => - (super.noSuchMethod( - Invocation.method( - #getPaymentCode, - [], - {#isSegwit: isSegwit}, - ), - returnValue: _i16.Future<_i13.PaymentCode>.value(_FakePaymentCode_12( - this, - Invocation.method( - #getPaymentCode, - [], - {#isSegwit: isSegwit}, - ), - )), - ) as _i16.Future<_i13.PaymentCode>); - @override - _i16.Future<_i21.Uint8List> signWithNotificationKey(_i21.Uint8List? data) => - (super.noSuchMethod( - Invocation.method( - #signWithNotificationKey, - [data], - ), - returnValue: _i16.Future<_i21.Uint8List>.value(_i21.Uint8List(0)), - ) as _i16.Future<_i21.Uint8List>); - @override - _i16.Future signStringWithNotificationKey(String? data) => - (super.noSuchMethod( - Invocation.method( - #signStringWithNotificationKey, - [data], - ), - returnValue: _i16.Future.value(''), - ) as _i16.Future); - @override - _i16.Future> preparePaymentCodeSend({ - required _i13.PaymentCode? paymentCode, - required bool? isSegwit, - required _i9.Amount? amount, - Map? args, - }) => - (super.noSuchMethod( - Invocation.method( - #preparePaymentCodeSend, - [], - { - #paymentCode: paymentCode, - #isSegwit: isSegwit, - #amount: amount, - #args: args, - }, - ), - returnValue: - _i16.Future>.value({}), - ) as _i16.Future>); - @override - _i16.Future<_i12.Address> nextUnusedSendAddressFrom({ - required _i13.PaymentCode? pCode, - required bool? isSegwit, - required _i11.BIP32? privateKeyNode, - int? startIndex = 0, - }) => - (super.noSuchMethod( - Invocation.method( - #nextUnusedSendAddressFrom, - [], - { - #pCode: pCode, - #isSegwit: isSegwit, - #privateKeyNode: privateKeyNode, - #startIndex: startIndex, - }, - ), - returnValue: _i16.Future<_i12.Address>.value(_FakeAddress_11( - this, - Invocation.method( - #nextUnusedSendAddressFrom, - [], - { - #pCode: pCode, - #isSegwit: isSegwit, - #privateKeyNode: privateKeyNode, - #startIndex: startIndex, - }, - ), - )), - ) as _i16.Future<_i12.Address>); - @override - _i16.Future> prepareNotificationTx({ - required int? selectedTxFeeRate, - required String? targetPaymentCodeString, - int? additionalOutputs = 0, - List<_i12.UTXO>? utxos, - }) => - (super.noSuchMethod( - Invocation.method( - #prepareNotificationTx, - [], - { - #selectedTxFeeRate: selectedTxFeeRate, - #targetPaymentCodeString: targetPaymentCodeString, - #additionalOutputs: additionalOutputs, - #utxos: utxos, - }, - ), - returnValue: - _i16.Future>.value({}), - ) as _i16.Future>); - @override - _i16.Future broadcastNotificationTx( - {required Map? preparedTx}) => - (super.noSuchMethod( - Invocation.method( - #broadcastNotificationTx, - [], - {#preparedTx: preparedTx}, - ), - returnValue: _i16.Future.value(''), - ) as _i16.Future); - @override - _i16.Future hasConnected(String? paymentCodeString) => - (super.noSuchMethod( - Invocation.method( - #hasConnected, - [paymentCodeString], - ), - returnValue: _i16.Future.value(false), - ) as _i16.Future); - @override - _i16.Future<_i13.PaymentCode?> unBlindedPaymentCodeFromTransaction( - {required _i12.Transaction? transaction}) => - (super.noSuchMethod( - Invocation.method( - #unBlindedPaymentCodeFromTransaction, - [], - {#transaction: transaction}, - ), - returnValue: _i16.Future<_i13.PaymentCode?>.value(), - ) as _i16.Future<_i13.PaymentCode?>); - @override - _i16.Future<_i13.PaymentCode?> unBlindedPaymentCodeFromTransactionBad( - {required _i12.Transaction? transaction}) => - (super.noSuchMethod( - Invocation.method( - #unBlindedPaymentCodeFromTransactionBad, - [], - {#transaction: transaction}, - ), - returnValue: _i16.Future<_i13.PaymentCode?>.value(), - ) as _i16.Future<_i13.PaymentCode?>); - @override - _i16.Future> - getAllPaymentCodesFromNotificationTransactions() => (super.noSuchMethod( - Invocation.method( - #getAllPaymentCodesFromNotificationTransactions, - [], - ), - returnValue: - _i16.Future>.value(<_i13.PaymentCode>[]), - ) as _i16.Future>); - @override - _i16.Future checkForNotificationTransactionsTo( - Set? otherCodeStrings) => - (super.noSuchMethod( - Invocation.method( - #checkForNotificationTransactionsTo, - [otherCodeStrings], - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); - @override - _i16.Future restoreAllHistory({ - required int? maxUnusedAddressGap, - required int? maxNumberOfIndexesToCheck, - required Set? paymentCodeStrings, - }) => - (super.noSuchMethod( - Invocation.method( - #restoreAllHistory, - [], - { - #maxUnusedAddressGap: maxUnusedAddressGap, - #maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, - #paymentCodeStrings: paymentCodeStrings, - }, - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); - @override - _i16.Future restoreHistoryWith({ - required _i13.PaymentCode? other, - required bool? checkSegwitAsWell, - required int? maxUnusedAddressGap, - required int? maxNumberOfIndexesToCheck, - }) => - (super.noSuchMethod( - Invocation.method( - #restoreHistoryWith, - [], - { - #other: other, - #checkSegwitAsWell: checkSegwitAsWell, - #maxUnusedAddressGap: maxUnusedAddressGap, - #maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, - }, - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); - @override - _i16.Future<_i12.Address> getMyNotificationAddress() => (super.noSuchMethod( - Invocation.method( - #getMyNotificationAddress, - [], - ), - returnValue: _i16.Future<_i12.Address>.value(_FakeAddress_11( - this, - Invocation.method( - #getMyNotificationAddress, - [], - ), - )), - ) as _i16.Future<_i12.Address>); - @override - _i16.Future> lookupKey(String? paymentCodeString) => - (super.noSuchMethod( - Invocation.method( - #lookupKey, - [paymentCodeString], - ), - returnValue: _i16.Future>.value([]), - ) as _i16.Future>); - @override - _i16.Future paymentCodeStringByKey(String? key) => - (super.noSuchMethod( - Invocation.method( - #paymentCodeStringByKey, - [key], - ), - returnValue: _i16.Future.value(), - ) as _i16.Future); - @override - _i16.Future storeCode(String? paymentCodeString) => - (super.noSuchMethod( - Invocation.method( - #storeCode, - [paymentCodeString], - ), - returnValue: _i16.Future.value(''), - ) as _i16.Future); - @override - void initCoinControlInterface({ - required String? walletId, - required String? walletName, - required _i17.Coin? coin, - required _i7.MainDB? db, - required _i16.Future Function()? getChainHeight, - required _i16.Future Function(_i6.Balance)? refreshedBalanceCallback, - }) => - super.noSuchMethod( - Invocation.method( - #initCoinControlInterface, - [], - { - #walletId: walletId, - #walletName: walletName, - #coin: coin, - #db: db, - #getChainHeight: getChainHeight, - #refreshedBalanceCallback: refreshedBalanceCallback, - }, - ), - returnValueForMissingStub: null, - ); - @override - _i16.Future refreshBalance({bool? notify = false}) => - (super.noSuchMethod( - Invocation.method( - #refreshBalance, - [], - {#notify: notify}, - ), - returnValue: _i16.Future.value(), - returnValueForMissingStub: _i16.Future.value(), - ) as _i16.Future); -} - -/// A class which mocks [ElectrumX]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { - MockElectrumX() { - _i1.throwOnMissingStub(this); - } - - @override - set failovers(List<_i4.ElectrumXNode>? _failovers) => super.noSuchMethod( - Invocation.setter( - #failovers, - _failovers, - ), - returnValueForMissingStub: null, - ); - @override - int get currentFailoverIndex => (super.noSuchMethod( - Invocation.getter(#currentFailoverIndex), - returnValue: 0, - ) as int); - @override - set currentFailoverIndex(int? _currentFailoverIndex) => super.noSuchMethod( - Invocation.setter( - #currentFailoverIndex, - _currentFailoverIndex, - ), - returnValueForMissingStub: null, - ); - @override - String get host => (super.noSuchMethod( - Invocation.getter(#host), - returnValue: '', - ) as String); - @override - int get port => (super.noSuchMethod( - Invocation.getter(#port), - returnValue: 0, - ) as int); - @override - bool get useSSL => (super.noSuchMethod( - Invocation.getter(#useSSL), - returnValue: false, - ) as bool); - @override - _i16.Future request({ - required String? command, - List? args = const [], - Duration? connectionTimeout = const Duration(seconds: 60), - String? requestID, - int? retries = 2, - }) => - (super.noSuchMethod( - Invocation.method( - #request, - [], - { - #command: command, - #args: args, - #connectionTimeout: connectionTimeout, - #requestID: requestID, - #retries: retries, - }, - ), - returnValue: _i16.Future.value(), - ) as _i16.Future); - @override - _i16.Future>> batchRequest({ - required String? command, - required Map>? args, - Duration? connectionTimeout = const Duration(seconds: 60), - int? retries = 2, - }) => - (super.noSuchMethod( - Invocation.method( - #batchRequest, - [], - { - #command: command, - #args: args, - #connectionTimeout: connectionTimeout, - #retries: retries, - }, - ), - returnValue: _i16.Future>>.value( - >[]), - ) as _i16.Future>>); - @override - _i16.Future ping({ - String? requestID, - int? retryCount = 1, - }) => - (super.noSuchMethod( - Invocation.method( - #ping, - [], - { - #requestID: requestID, - #retryCount: retryCount, - }, - ), - returnValue: _i16.Future.value(false), - ) as _i16.Future); - @override - _i16.Future> getBlockHeadTip({String? requestID}) => - (super.noSuchMethod( - Invocation.method( - #getBlockHeadTip, - [], - {#requestID: requestID}, - ), - returnValue: - _i16.Future>.value({}), - ) as _i16.Future>); - @override - _i16.Future> getServerFeatures({String? requestID}) => - (super.noSuchMethod( - Invocation.method( - #getServerFeatures, - [], - {#requestID: requestID}, - ), - returnValue: - _i16.Future>.value({}), - ) as _i16.Future>); - @override - _i16.Future broadcastTransaction({ - required String? rawTx, - String? requestID, - }) => - (super.noSuchMethod( - Invocation.method( - #broadcastTransaction, - [], - { - #rawTx: rawTx, - #requestID: requestID, - }, - ), - returnValue: _i16.Future.value(''), - ) as _i16.Future); - @override - _i16.Future> getBalance({ - required String? scripthash, - String? requestID, - }) => - (super.noSuchMethod( - Invocation.method( - #getBalance, - [], - { - #scripthash: scripthash, - #requestID: requestID, - }, - ), - returnValue: - _i16.Future>.value({}), - ) as _i16.Future>); - @override - _i16.Future>> getHistory({ - required String? scripthash, - String? requestID, - }) => - (super.noSuchMethod( - Invocation.method( - #getHistory, - [], - { - #scripthash: scripthash, - #requestID: requestID, - }, - ), - returnValue: _i16.Future>>.value( - >[]), - ) as _i16.Future>>); - @override - _i16.Future>>> getBatchHistory( - {required Map>? args}) => - (super.noSuchMethod( - Invocation.method( - #getBatchHistory, - [], - {#args: args}, - ), - returnValue: _i16.Future>>>.value( - >>{}), - ) as _i16.Future>>>); - @override - _i16.Future>> getUTXOs({ - required String? scripthash, - String? requestID, - }) => - (super.noSuchMethod( - Invocation.method( - #getUTXOs, - [], - { - #scripthash: scripthash, - #requestID: requestID, - }, - ), - returnValue: _i16.Future>>.value( - >[]), - ) as _i16.Future>>); - @override - _i16.Future>>> getBatchUTXOs( - {required Map>? args}) => - (super.noSuchMethod( - Invocation.method( - #getBatchUTXOs, - [], - {#args: args}, - ), - returnValue: _i16.Future>>>.value( - >>{}), - ) as _i16.Future>>>); - @override - _i16.Future> getTransaction({ - required String? txHash, - bool? verbose = true, - String? requestID, - }) => - (super.noSuchMethod( - Invocation.method( - #getTransaction, - [], - { - #txHash: txHash, - #verbose: verbose, - #requestID: requestID, - }, - ), - returnValue: - _i16.Future>.value({}), - ) as _i16.Future>); - @override - _i16.Future> getAnonymitySet({ - String? groupId = r'1', - String? blockhash = r'', - String? requestID, - }) => - (super.noSuchMethod( - Invocation.method( - #getAnonymitySet, - [], - { - #groupId: groupId, - #blockhash: blockhash, - #requestID: requestID, - }, - ), - returnValue: - _i16.Future>.value({}), - ) as _i16.Future>); - @override - _i16.Future getMintData({ - dynamic mints, - String? requestID, - }) => - (super.noSuchMethod( - Invocation.method( - #getMintData, - [], - { - #mints: mints, - #requestID: requestID, - }, - ), - returnValue: _i16.Future.value(), - ) as _i16.Future); - @override - _i16.Future> getUsedCoinSerials({ - String? requestID, - required int? startNumber, - }) => - (super.noSuchMethod( - Invocation.method( - #getUsedCoinSerials, - [], - { - #requestID: requestID, - #startNumber: startNumber, - }, - ), - returnValue: - _i16.Future>.value({}), - ) as _i16.Future>); - @override - _i16.Future getLatestCoinId({String? requestID}) => (super.noSuchMethod( - Invocation.method( - #getLatestCoinId, - [], - {#requestID: requestID}, - ), - returnValue: _i16.Future.value(0), - ) as _i16.Future); - @override - _i16.Future> getFeeRate({String? requestID}) => - (super.noSuchMethod( - Invocation.method( - #getFeeRate, - [], - {#requestID: requestID}, - ), - returnValue: - _i16.Future>.value({}), - ) as _i16.Future>); - @override - _i16.Future<_i14.Decimal> estimateFee({ - String? requestID, - required int? blocks, - }) => - (super.noSuchMethod( - Invocation.method( - #estimateFee, - [], - { - #requestID: requestID, - #blocks: blocks, - }, - ), - returnValue: _i16.Future<_i14.Decimal>.value(_FakeDecimal_13( - this, - Invocation.method( - #estimateFee, - [], - { - #requestID: requestID, - #blocks: blocks, - }, - ), - )), - ) as _i16.Future<_i14.Decimal>); - @override - _i16.Future<_i14.Decimal> relayFee({String? requestID}) => - (super.noSuchMethod( - Invocation.method( - #relayFee, - [], - {#requestID: requestID}, - ), - returnValue: _i16.Future<_i14.Decimal>.value(_FakeDecimal_13( - this, - Invocation.method( - #relayFee, - [], - {#requestID: requestID}, - ), - )), - ) as _i16.Future<_i14.Decimal>); -} diff --git a/test/services/coins/namecoin/namecoin_wallet_test.mocks.dart b/test/services/coins/namecoin/namecoin_wallet_test.mocks.dart new file mode 100644 index 0000000000..ec242c79c9 --- /dev/null +++ b/test/services/coins/namecoin/namecoin_wallet_test.mocks.dart @@ -0,0 +1,564 @@ +// Mocks generated by Mockito 5.3.2 from annotations +// in stackwallet/test/services/coins/namecoin/namecoin_wallet_test.dart. +// Do not manually edit this file. + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'dart:async' as _i4; + +import 'package:decimal/decimal.dart' as _i2; +import 'package:mockito/mockito.dart' as _i1; +import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i5; +import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i3; +import 'package:stackwallet/services/transaction_notification_tracker.dart' + as _i7; +import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i6; + +// ignore_for_file: type=lint +// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_setters_without_getters +// ignore_for_file: comment_references +// ignore_for_file: implementation_imports +// ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class + +class _FakeDecimal_0 extends _i1.SmartFake implements _i2.Decimal { + _FakeDecimal_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeElectrumX_1 extends _i1.SmartFake implements _i3.ElectrumX { + _FakeElectrumX_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +/// A class which mocks [ElectrumX]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockElectrumX extends _i1.Mock implements _i3.ElectrumX { + MockElectrumX() { + _i1.throwOnMissingStub(this); + } + + @override + set failovers(List<_i3.ElectrumXNode>? _failovers) => super.noSuchMethod( + Invocation.setter( + #failovers, + _failovers, + ), + returnValueForMissingStub: null, + ); + @override + int get currentFailoverIndex => (super.noSuchMethod( + Invocation.getter(#currentFailoverIndex), + returnValue: 0, + ) as int); + @override + set currentFailoverIndex(int? _currentFailoverIndex) => super.noSuchMethod( + Invocation.setter( + #currentFailoverIndex, + _currentFailoverIndex, + ), + returnValueForMissingStub: null, + ); + @override + String get host => (super.noSuchMethod( + Invocation.getter(#host), + returnValue: '', + ) as String); + @override + int get port => (super.noSuchMethod( + Invocation.getter(#port), + returnValue: 0, + ) as int); + @override + bool get useSSL => (super.noSuchMethod( + Invocation.getter(#useSSL), + returnValue: false, + ) as bool); + @override + _i4.Future request({ + required String? command, + List? args = const [], + Duration? connectionTimeout = const Duration(seconds: 60), + String? requestID, + int? retries = 2, + }) => + (super.noSuchMethod( + Invocation.method( + #request, + [], + { + #command: command, + #args: args, + #connectionTimeout: connectionTimeout, + #requestID: requestID, + #retries: retries, + }, + ), + returnValue: _i4.Future.value(), + ) as _i4.Future); + @override + _i4.Future>> batchRequest({ + required String? command, + required Map>? args, + Duration? connectionTimeout = const Duration(seconds: 60), + int? retries = 2, + }) => + (super.noSuchMethod( + Invocation.method( + #batchRequest, + [], + { + #command: command, + #args: args, + #connectionTimeout: connectionTimeout, + #retries: retries, + }, + ), + returnValue: _i4.Future>>.value( + >[]), + ) as _i4.Future>>); + @override + _i4.Future ping({ + String? requestID, + int? retryCount = 1, + }) => + (super.noSuchMethod( + Invocation.method( + #ping, + [], + { + #requestID: requestID, + #retryCount: retryCount, + }, + ), + returnValue: _i4.Future.value(false), + ) as _i4.Future); + @override + _i4.Future> getBlockHeadTip({String? requestID}) => + (super.noSuchMethod( + Invocation.method( + #getBlockHeadTip, + [], + {#requestID: requestID}, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future> getServerFeatures({String? requestID}) => + (super.noSuchMethod( + Invocation.method( + #getServerFeatures, + [], + {#requestID: requestID}, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future broadcastTransaction({ + required String? rawTx, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #broadcastTransaction, + [], + { + #rawTx: rawTx, + #requestID: requestID, + }, + ), + returnValue: _i4.Future.value(''), + ) as _i4.Future); + @override + _i4.Future> getBalance({ + required String? scripthash, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getBalance, + [], + { + #scripthash: scripthash, + #requestID: requestID, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future>> getHistory({ + required String? scripthash, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getHistory, + [], + { + #scripthash: scripthash, + #requestID: requestID, + }, + ), + returnValue: _i4.Future>>.value( + >[]), + ) as _i4.Future>>); + @override + _i4.Future>>> getBatchHistory( + {required Map>? args}) => + (super.noSuchMethod( + Invocation.method( + #getBatchHistory, + [], + {#args: args}, + ), + returnValue: _i4.Future>>>.value( + >>{}), + ) as _i4.Future>>>); + @override + _i4.Future>> getUTXOs({ + required String? scripthash, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getUTXOs, + [], + { + #scripthash: scripthash, + #requestID: requestID, + }, + ), + returnValue: _i4.Future>>.value( + >[]), + ) as _i4.Future>>); + @override + _i4.Future>>> getBatchUTXOs( + {required Map>? args}) => + (super.noSuchMethod( + Invocation.method( + #getBatchUTXOs, + [], + {#args: args}, + ), + returnValue: _i4.Future>>>.value( + >>{}), + ) as _i4.Future>>>); + @override + _i4.Future> getTransaction({ + required String? txHash, + bool? verbose = true, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getTransaction, + [], + { + #txHash: txHash, + #verbose: verbose, + #requestID: requestID, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future> getAnonymitySet({ + String? groupId = r'1', + String? blockhash = r'', + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getAnonymitySet, + [], + { + #groupId: groupId, + #blockhash: blockhash, + #requestID: requestID, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future getMintData({ + dynamic mints, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getMintData, + [], + { + #mints: mints, + #requestID: requestID, + }, + ), + returnValue: _i4.Future.value(), + ) as _i4.Future); + @override + _i4.Future> getUsedCoinSerials({ + String? requestID, + required int? startNumber, + }) => + (super.noSuchMethod( + Invocation.method( + #getUsedCoinSerials, + [], + { + #requestID: requestID, + #startNumber: startNumber, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future getLatestCoinId({String? requestID}) => (super.noSuchMethod( + Invocation.method( + #getLatestCoinId, + [], + {#requestID: requestID}, + ), + returnValue: _i4.Future.value(0), + ) as _i4.Future); + @override + _i4.Future> getFeeRate({String? requestID}) => + (super.noSuchMethod( + Invocation.method( + #getFeeRate, + [], + {#requestID: requestID}, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future<_i2.Decimal> estimateFee({ + String? requestID, + required int? blocks, + }) => + (super.noSuchMethod( + Invocation.method( + #estimateFee, + [], + { + #requestID: requestID, + #blocks: blocks, + }, + ), + returnValue: _i4.Future<_i2.Decimal>.value(_FakeDecimal_0( + this, + Invocation.method( + #estimateFee, + [], + { + #requestID: requestID, + #blocks: blocks, + }, + ), + )), + ) as _i4.Future<_i2.Decimal>); + @override + _i4.Future<_i2.Decimal> relayFee({String? requestID}) => (super.noSuchMethod( + Invocation.method( + #relayFee, + [], + {#requestID: requestID}, + ), + returnValue: _i4.Future<_i2.Decimal>.value(_FakeDecimal_0( + this, + Invocation.method( + #relayFee, + [], + {#requestID: requestID}, + ), + )), + ) as _i4.Future<_i2.Decimal>); +} + +/// A class which mocks [CachedElectrumX]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockCachedElectrumX extends _i1.Mock implements _i5.CachedElectrumX { + MockCachedElectrumX() { + _i1.throwOnMissingStub(this); + } + + @override + _i3.ElectrumX get electrumXClient => (super.noSuchMethod( + Invocation.getter(#electrumXClient), + returnValue: _FakeElectrumX_1( + this, + Invocation.getter(#electrumXClient), + ), + ) as _i3.ElectrumX); + @override + _i4.Future> getAnonymitySet({ + required String? groupId, + String? blockhash = r'', + required _i6.Coin? coin, + }) => + (super.noSuchMethod( + Invocation.method( + #getAnonymitySet, + [], + { + #groupId: groupId, + #blockhash: blockhash, + #coin: coin, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + String base64ToHex(String? source) => (super.noSuchMethod( + Invocation.method( + #base64ToHex, + [source], + ), + returnValue: '', + ) as String); + @override + String base64ToReverseHex(String? source) => (super.noSuchMethod( + Invocation.method( + #base64ToReverseHex, + [source], + ), + returnValue: '', + ) as String); + @override + _i4.Future> getTransaction({ + required String? txHash, + required _i6.Coin? coin, + bool? verbose = true, + }) => + (super.noSuchMethod( + Invocation.method( + #getTransaction, + [], + { + #txHash: txHash, + #coin: coin, + #verbose: verbose, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future> getUsedCoinSerials({ + required _i6.Coin? coin, + int? startNumber = 0, + }) => + (super.noSuchMethod( + Invocation.method( + #getUsedCoinSerials, + [], + { + #coin: coin, + #startNumber: startNumber, + }, + ), + returnValue: _i4.Future>.value([]), + ) as _i4.Future>); + @override + _i4.Future clearSharedTransactionCache({required _i6.Coin? coin}) => + (super.noSuchMethod( + Invocation.method( + #clearSharedTransactionCache, + [], + {#coin: coin}, + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); +} + +/// A class which mocks [TransactionNotificationTracker]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockTransactionNotificationTracker extends _i1.Mock + implements _i7.TransactionNotificationTracker { + MockTransactionNotificationTracker() { + _i1.throwOnMissingStub(this); + } + + @override + String get walletId => (super.noSuchMethod( + Invocation.getter(#walletId), + returnValue: '', + ) as String); + @override + List get pendings => (super.noSuchMethod( + Invocation.getter(#pendings), + returnValue: [], + ) as List); + @override + List get confirmeds => (super.noSuchMethod( + Invocation.getter(#confirmeds), + returnValue: [], + ) as List); + @override + bool wasNotifiedPending(String? txid) => (super.noSuchMethod( + Invocation.method( + #wasNotifiedPending, + [txid], + ), + returnValue: false, + ) as bool); + @override + _i4.Future addNotifiedPending(String? txid) => (super.noSuchMethod( + Invocation.method( + #addNotifiedPending, + [txid], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override + bool wasNotifiedConfirmed(String? txid) => (super.noSuchMethod( + Invocation.method( + #wasNotifiedConfirmed, + [txid], + ), + returnValue: false, + ) as bool); + @override + _i4.Future addNotifiedConfirmed(String? txid) => (super.noSuchMethod( + Invocation.method( + #addNotifiedConfirmed, + [txid], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override + _i4.Future deleteTransaction(String? txid) => (super.noSuchMethod( + Invocation.method( + #deleteTransaction, + [txid], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); +} diff --git a/test/services/coins/particl/particl_wallet_test.mocks.dart b/test/services/coins/particl/particl_wallet_test.mocks.dart new file mode 100644 index 0000000000..e4677cc8ef --- /dev/null +++ b/test/services/coins/particl/particl_wallet_test.mocks.dart @@ -0,0 +1,564 @@ +// Mocks generated by Mockito 5.3.2 from annotations +// in stackwallet/test/services/coins/particl/particl_wallet_test.dart. +// Do not manually edit this file. + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'dart:async' as _i4; + +import 'package:decimal/decimal.dart' as _i2; +import 'package:mockito/mockito.dart' as _i1; +import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i5; +import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i3; +import 'package:stackwallet/services/transaction_notification_tracker.dart' + as _i7; +import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i6; + +// ignore_for_file: type=lint +// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_setters_without_getters +// ignore_for_file: comment_references +// ignore_for_file: implementation_imports +// ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class + +class _FakeDecimal_0 extends _i1.SmartFake implements _i2.Decimal { + _FakeDecimal_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeElectrumX_1 extends _i1.SmartFake implements _i3.ElectrumX { + _FakeElectrumX_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +/// A class which mocks [ElectrumX]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockElectrumX extends _i1.Mock implements _i3.ElectrumX { + MockElectrumX() { + _i1.throwOnMissingStub(this); + } + + @override + set failovers(List<_i3.ElectrumXNode>? _failovers) => super.noSuchMethod( + Invocation.setter( + #failovers, + _failovers, + ), + returnValueForMissingStub: null, + ); + @override + int get currentFailoverIndex => (super.noSuchMethod( + Invocation.getter(#currentFailoverIndex), + returnValue: 0, + ) as int); + @override + set currentFailoverIndex(int? _currentFailoverIndex) => super.noSuchMethod( + Invocation.setter( + #currentFailoverIndex, + _currentFailoverIndex, + ), + returnValueForMissingStub: null, + ); + @override + String get host => (super.noSuchMethod( + Invocation.getter(#host), + returnValue: '', + ) as String); + @override + int get port => (super.noSuchMethod( + Invocation.getter(#port), + returnValue: 0, + ) as int); + @override + bool get useSSL => (super.noSuchMethod( + Invocation.getter(#useSSL), + returnValue: false, + ) as bool); + @override + _i4.Future request({ + required String? command, + List? args = const [], + Duration? connectionTimeout = const Duration(seconds: 60), + String? requestID, + int? retries = 2, + }) => + (super.noSuchMethod( + Invocation.method( + #request, + [], + { + #command: command, + #args: args, + #connectionTimeout: connectionTimeout, + #requestID: requestID, + #retries: retries, + }, + ), + returnValue: _i4.Future.value(), + ) as _i4.Future); + @override + _i4.Future>> batchRequest({ + required String? command, + required Map>? args, + Duration? connectionTimeout = const Duration(seconds: 60), + int? retries = 2, + }) => + (super.noSuchMethod( + Invocation.method( + #batchRequest, + [], + { + #command: command, + #args: args, + #connectionTimeout: connectionTimeout, + #retries: retries, + }, + ), + returnValue: _i4.Future>>.value( + >[]), + ) as _i4.Future>>); + @override + _i4.Future ping({ + String? requestID, + int? retryCount = 1, + }) => + (super.noSuchMethod( + Invocation.method( + #ping, + [], + { + #requestID: requestID, + #retryCount: retryCount, + }, + ), + returnValue: _i4.Future.value(false), + ) as _i4.Future); + @override + _i4.Future> getBlockHeadTip({String? requestID}) => + (super.noSuchMethod( + Invocation.method( + #getBlockHeadTip, + [], + {#requestID: requestID}, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future> getServerFeatures({String? requestID}) => + (super.noSuchMethod( + Invocation.method( + #getServerFeatures, + [], + {#requestID: requestID}, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future broadcastTransaction({ + required String? rawTx, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #broadcastTransaction, + [], + { + #rawTx: rawTx, + #requestID: requestID, + }, + ), + returnValue: _i4.Future.value(''), + ) as _i4.Future); + @override + _i4.Future> getBalance({ + required String? scripthash, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getBalance, + [], + { + #scripthash: scripthash, + #requestID: requestID, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future>> getHistory({ + required String? scripthash, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getHistory, + [], + { + #scripthash: scripthash, + #requestID: requestID, + }, + ), + returnValue: _i4.Future>>.value( + >[]), + ) as _i4.Future>>); + @override + _i4.Future>>> getBatchHistory( + {required Map>? args}) => + (super.noSuchMethod( + Invocation.method( + #getBatchHistory, + [], + {#args: args}, + ), + returnValue: _i4.Future>>>.value( + >>{}), + ) as _i4.Future>>>); + @override + _i4.Future>> getUTXOs({ + required String? scripthash, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getUTXOs, + [], + { + #scripthash: scripthash, + #requestID: requestID, + }, + ), + returnValue: _i4.Future>>.value( + >[]), + ) as _i4.Future>>); + @override + _i4.Future>>> getBatchUTXOs( + {required Map>? args}) => + (super.noSuchMethod( + Invocation.method( + #getBatchUTXOs, + [], + {#args: args}, + ), + returnValue: _i4.Future>>>.value( + >>{}), + ) as _i4.Future>>>); + @override + _i4.Future> getTransaction({ + required String? txHash, + bool? verbose = true, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getTransaction, + [], + { + #txHash: txHash, + #verbose: verbose, + #requestID: requestID, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future> getAnonymitySet({ + String? groupId = r'1', + String? blockhash = r'', + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getAnonymitySet, + [], + { + #groupId: groupId, + #blockhash: blockhash, + #requestID: requestID, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future getMintData({ + dynamic mints, + String? requestID, + }) => + (super.noSuchMethod( + Invocation.method( + #getMintData, + [], + { + #mints: mints, + #requestID: requestID, + }, + ), + returnValue: _i4.Future.value(), + ) as _i4.Future); + @override + _i4.Future> getUsedCoinSerials({ + String? requestID, + required int? startNumber, + }) => + (super.noSuchMethod( + Invocation.method( + #getUsedCoinSerials, + [], + { + #requestID: requestID, + #startNumber: startNumber, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future getLatestCoinId({String? requestID}) => (super.noSuchMethod( + Invocation.method( + #getLatestCoinId, + [], + {#requestID: requestID}, + ), + returnValue: _i4.Future.value(0), + ) as _i4.Future); + @override + _i4.Future> getFeeRate({String? requestID}) => + (super.noSuchMethod( + Invocation.method( + #getFeeRate, + [], + {#requestID: requestID}, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future<_i2.Decimal> estimateFee({ + String? requestID, + required int? blocks, + }) => + (super.noSuchMethod( + Invocation.method( + #estimateFee, + [], + { + #requestID: requestID, + #blocks: blocks, + }, + ), + returnValue: _i4.Future<_i2.Decimal>.value(_FakeDecimal_0( + this, + Invocation.method( + #estimateFee, + [], + { + #requestID: requestID, + #blocks: blocks, + }, + ), + )), + ) as _i4.Future<_i2.Decimal>); + @override + _i4.Future<_i2.Decimal> relayFee({String? requestID}) => (super.noSuchMethod( + Invocation.method( + #relayFee, + [], + {#requestID: requestID}, + ), + returnValue: _i4.Future<_i2.Decimal>.value(_FakeDecimal_0( + this, + Invocation.method( + #relayFee, + [], + {#requestID: requestID}, + ), + )), + ) as _i4.Future<_i2.Decimal>); +} + +/// A class which mocks [CachedElectrumX]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockCachedElectrumX extends _i1.Mock implements _i5.CachedElectrumX { + MockCachedElectrumX() { + _i1.throwOnMissingStub(this); + } + + @override + _i3.ElectrumX get electrumXClient => (super.noSuchMethod( + Invocation.getter(#electrumXClient), + returnValue: _FakeElectrumX_1( + this, + Invocation.getter(#electrumXClient), + ), + ) as _i3.ElectrumX); + @override + _i4.Future> getAnonymitySet({ + required String? groupId, + String? blockhash = r'', + required _i6.Coin? coin, + }) => + (super.noSuchMethod( + Invocation.method( + #getAnonymitySet, + [], + { + #groupId: groupId, + #blockhash: blockhash, + #coin: coin, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + String base64ToHex(String? source) => (super.noSuchMethod( + Invocation.method( + #base64ToHex, + [source], + ), + returnValue: '', + ) as String); + @override + String base64ToReverseHex(String? source) => (super.noSuchMethod( + Invocation.method( + #base64ToReverseHex, + [source], + ), + returnValue: '', + ) as String); + @override + _i4.Future> getTransaction({ + required String? txHash, + required _i6.Coin? coin, + bool? verbose = true, + }) => + (super.noSuchMethod( + Invocation.method( + #getTransaction, + [], + { + #txHash: txHash, + #coin: coin, + #verbose: verbose, + }, + ), + returnValue: + _i4.Future>.value({}), + ) as _i4.Future>); + @override + _i4.Future> getUsedCoinSerials({ + required _i6.Coin? coin, + int? startNumber = 0, + }) => + (super.noSuchMethod( + Invocation.method( + #getUsedCoinSerials, + [], + { + #coin: coin, + #startNumber: startNumber, + }, + ), + returnValue: _i4.Future>.value([]), + ) as _i4.Future>); + @override + _i4.Future clearSharedTransactionCache({required _i6.Coin? coin}) => + (super.noSuchMethod( + Invocation.method( + #clearSharedTransactionCache, + [], + {#coin: coin}, + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); +} + +/// A class which mocks [TransactionNotificationTracker]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockTransactionNotificationTracker extends _i1.Mock + implements _i7.TransactionNotificationTracker { + MockTransactionNotificationTracker() { + _i1.throwOnMissingStub(this); + } + + @override + String get walletId => (super.noSuchMethod( + Invocation.getter(#walletId), + returnValue: '', + ) as String); + @override + List get pendings => (super.noSuchMethod( + Invocation.getter(#pendings), + returnValue: [], + ) as List); + @override + List get confirmeds => (super.noSuchMethod( + Invocation.getter(#confirmeds), + returnValue: [], + ) as List); + @override + bool wasNotifiedPending(String? txid) => (super.noSuchMethod( + Invocation.method( + #wasNotifiedPending, + [txid], + ), + returnValue: false, + ) as bool); + @override + _i4.Future addNotifiedPending(String? txid) => (super.noSuchMethod( + Invocation.method( + #addNotifiedPending, + [txid], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override + bool wasNotifiedConfirmed(String? txid) => (super.noSuchMethod( + Invocation.method( + #wasNotifiedConfirmed, + [txid], + ), + returnValue: false, + ) as bool); + @override + _i4.Future addNotifiedConfirmed(String? txid) => (super.noSuchMethod( + Invocation.method( + #addNotifiedConfirmed, + [txid], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + @override + _i4.Future deleteTransaction(String? txid) => (super.noSuchMethod( + Invocation.method( + #deleteTransaction, + [txid], + ), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); +} diff --git a/test/services/node_service_test.dart b/test/services/node_service_test.dart index 1c5f53aa73..4439e44b24 100644 --- a/test/services/node_service_test.dart +++ b/test/services/node_service_test.dart @@ -1,7 +1,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:hive/hive.dart'; import 'package:hive_test/hive_test.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/node_model.dart'; import 'package:stackduo/services/node_service.dart'; import 'package:stackduo/utilities/default_nodes.dart'; diff --git a/test/services/wallets_service_test.dart b/test/services/wallets_service_test.dart index eb598a0d91..b60e331603 100644 --- a/test/services/wallets_service_test.dart +++ b/test/services/wallets_service_test.dart @@ -2,7 +2,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:hive/hive.dart'; import 'package:hive_test/hive_test.dart'; import 'package:mockito/annotations.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/services/wallets_service.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/flutter_secure_storage_interface.dart'; diff --git a/test/services/wallets_service_test.mocks.dart b/test/services/wallets_service_test.mocks.dart index e9f2199404..f3caf16e4a 100644 --- a/test/services/wallets_service_test.mocks.dart +++ b/test/services/wallets_service_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/services/wallets_service_test.dart. // Do not manually edit this file. diff --git a/test/widget_tests/address_book_card_test.dart b/test/widget_tests/address_book_card_test.dart index 93ddbc3f4b..670afc7137 100644 --- a/test/widget_tests/address_book_card_test.dart +++ b/test/widget_tests/address_book_card_test.dart @@ -55,8 +55,6 @@ void main() { StackColors.fromStackColorTheme( StackTheme.fromJson( json: lightThemeJsonMap, - applicationThemesDirectoryPath: - applicationThemesDirectoryPath, ), ), ], diff --git a/test/widget_tests/address_book_card_test.mocks.dart b/test/widget_tests/address_book_card_test.mocks.dart index 186bb028be..9b66437f88 100644 --- a/test/widget_tests/address_book_card_test.mocks.dart +++ b/test/widget_tests/address_book_card_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/widget_tests/address_book_card_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i4; -import 'dart:ui' as _i5; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/isar/models/contact_entry.dart' as _i2; @@ -116,7 +115,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - void addListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -124,7 +123,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: null, ); @override - void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/widget_tests/animated_text_test.dart b/test/widget_tests/animated_text_test.dart index d00468b783..ff358dfb06 100644 --- a/test/widget_tests/animated_text_test.dart +++ b/test/widget_tests/animated_text_test.dart @@ -1,8 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/animated_text.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/widgets/animated_text.dart'; + +import '../sample_data/theme_json.dart'; void main() { testWidgets("Widget displays first word in strings list", @@ -23,7 +25,11 @@ void main() { MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: const Material( diff --git a/test/widget_tests/custom_buttons/app_bar_icon_button_test.dart b/test/widget_tests/custom_buttons/app_bar_icon_button_test.dart index 5a3d9c69fd..cdc2ccbefa 100644 --- a/test/widget_tests/custom_buttons/app_bar_icon_button_test.dart +++ b/test/widget_tests/custom_buttons/app_bar_icon_button_test.dart @@ -1,8 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/custom_buttons/app_bar_icon_button.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart'; + +import '../../sample_data/theme_json.dart'; void main() { testWidgets("AppBarIconButton test", (tester) async { @@ -23,7 +25,11 @@ void main() { MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: Material( diff --git a/test/widget_tests/custom_buttons/draggable_switch_button_test.dart b/test/widget_tests/custom_buttons/draggable_switch_button_test.dart index 8ba4c41ccd..2919e05ff5 100644 --- a/test/widget_tests/custom_buttons/draggable_switch_button_test.dart +++ b/test/widget_tests/custom_buttons/draggable_switch_button_test.dart @@ -1,8 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/custom_buttons/draggable_switch_button.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/widgets/custom_buttons/draggable_switch_button.dart'; + +import '../../sample_data/theme_json.dart'; void main() { testWidgets("DraggableSwitchButton tapped", (tester) async { @@ -19,7 +21,11 @@ void main() { MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: button, @@ -46,7 +52,11 @@ void main() { MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: SizedBox( @@ -78,7 +88,11 @@ void main() { MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: SizedBox( diff --git a/test/widget_tests/custom_buttons/favorite_toggle_test.dart b/test/widget_tests/custom_buttons/favorite_toggle_test.dart index 83aa1e0f92..90dbc55461 100644 --- a/test/widget_tests/custom_buttons/favorite_toggle_test.dart +++ b/test/widget_tests/custom_buttons/favorite_toggle_test.dart @@ -2,22 +2,41 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/custom_buttons/favorite_toggle.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/themes/theme_service.dart'; +import 'package:stackwallet/widgets/custom_buttons/favorite_toggle.dart'; +import '../../sample_data/theme_json.dart'; +import 'favorite_toggle_test.mocks.dart'; + +@GenerateMocks([ + ThemeService, +]) void main() { testWidgets("Test widget build", (widgetTester) async { final key = UniqueKey(); + final mockThemeService = MockThemeService(); + when(mockThemeService.getTheme(themeId: "light")).thenAnswer( + (_) => StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ); await widgetTester.pumpWidget( ProviderScope( - overrides: [], + overrides: [ + pThemeService.overrideWithValue(mockThemeService), + ], child: MaterialApp( theme: ThemeData( extensions: [ StackColors.fromStackColorTheme( - LightColors(), + StackTheme.fromJson( + json: lightThemeJsonMap, + ), ), ], ), diff --git a/test/widget_tests/custom_loading_overlay_test.dart b/test/widget_tests/custom_loading_overlay_test.dart index 97704b08ca..6d0eddb75d 100644 --- a/test/widget_tests/custom_loading_overlay_test.dart +++ b/test/widget_tests/custom_loading_overlay_test.dart @@ -1,23 +1,49 @@ import 'package:event_bus/event_bus.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/custom_loading_overlay.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/themes/theme_service.dart'; +import 'package:stackwallet/widgets/custom_loading_overlay.dart'; +import '../sample_data/theme_json.dart'; +import 'custom_loading_overlay_test.mocks.dart'; + +@GenerateMocks([ + ThemeService, +]) void main() { - testWidgets("Test wiget displays correct text", (widgetTester) async { + testWidgets("Test widget displays correct text", (widgetTester) async { final eventBus = EventBus(); + final mockThemeService = MockThemeService(); + when(mockThemeService.getTheme(themeId: "light")).thenAnswer( + (_) => StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ); + await widgetTester.pumpWidget( - MaterialApp( - theme: ThemeData( - extensions: [ - StackColors.fromStackColorTheme(LightColors()), - ], - ), - home: Material( - child: CustomLoadingOverlay( - message: "Updating exchange rate", eventBus: eventBus), + ProviderScope( + overrides: [ + pThemeService.overrideWithValue(mockThemeService), + ], + child: MaterialApp( + theme: ThemeData( + extensions: [ + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), + ], + ), + home: Material( + child: CustomLoadingOverlay( + message: "Updating exchange rate", eventBus: eventBus), + ), ), ), ); diff --git a/test/widget_tests/custom_pin_put_test.dart b/test/widget_tests/custom_pin_put_test.dart index 4e6d06a5a0..7fecada7e5 100644 --- a/test/widget_tests/custom_pin_put_test.dart +++ b/test/widget_tests/custom_pin_put_test.dart @@ -6,48 +6,108 @@ import 'package:stackduo/utilities/theme/stack_colors.dart'; import 'package:stackduo/widgets/custom_pin_put/custom_pin_put.dart'; import 'package:stackduo/widgets/custom_pin_put/pin_keyboard.dart'; -void main() { - group("CustomPinPut tests", () { - testWidgets("CustomPinPut with 4 fields builds correctly", (tester) async { - const pinPut = CustomPinPut(fieldsCount: 4); +class PinWidget extends StatefulWidget { + const PinWidget({ + super.key, + this.onSubmit, + this.controller, + required this.pinAnimation, + required this.isRandom, + }); + + final void Function(String)? onSubmit; + final TextEditingController? controller; + final bool isRandom; + final PinAnimationType pinAnimation; + + @override + PinWidgetState createState() => PinWidgetState(); +} + +class PinWidgetState extends State { + int pinCount = 1; + + @override + Widget build(BuildContext context) { + bool submittedPinMatches = false; + + return CustomPinPut( + fieldsCount: pinCount, + isRandom: widget.isRandom, + useNativeKeyboard: false, + eachFieldHeight: 12, + eachFieldWidth: 12, + textStyle: STextStyles.label(context).copyWith( + fontSize: 1, + ), + obscureText: "", + onPinLengthChanged: (newLength) { + setState(() { + pinCount = newLength; + }); + }, + onSubmit: widget.onSubmit, + controller: widget.controller, + pinAnimationType: widget.pinAnimation, + ); + } +} +void main() { + group("CustomPinPut tests, non-random PIN", () { + testWidgets("CustomPinPut with 4 fields builds correctly, non-random PIN", + (tester) async { await tester.pumpWidget( MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: const Material( - child: pinPut, + child: PinWidget( + pinAnimation: PinAnimationType.none, + isRandom: false, + ), ), ), ); // expects 5 here. Four + the actual text field text - expect(find.text(""), findsNWidgets(5)); + expect(find.text(""), findsNWidgets(1)); expect(find.byType(PinKeyboard), findsOneWidget); expect(find.byType(BackspaceKey), findsOneWidget); expect(find.byType(NumberKey), findsNWidgets(10)); }); - testWidgets("CustomPinPut entering a pin successfully", (tester) async { + testWidgets("CustomPinPut entering a pin successfully, non-random PIN", + (tester) async { bool submittedPinMatches = false; - final pinPut = CustomPinPut( - fieldsCount: 4, - onSubmit: (pin) => submittedPinMatches = pin == "1234", - useNativeKeyboard: false, - ); await tester.pumpWidget( MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: Material( - child: pinPut, + child: PinWidget( + pinAnimation: PinAnimationType.none, + isRandom: false, + onSubmit: (pin) { + submittedPinMatches = pin == "1234"; + print("pin entered: $pin"); + }, + ), ), ), ); @@ -69,27 +129,262 @@ void main() { await tester.tap(find.byWidgetPredicate( (widget) => widget is NumberKey && widget.number == "4")); await tester.pumpAndSettle(); + await tester.tap(find.byType(SubmitKey)); + await tester.pumpAndSettle(); expect(submittedPinMatches, true); }); - testWidgets("CustomPinPut pin enter fade animation", (tester) async { + testWidgets("CustomPinPut pin enter fade animation, non-random PIN", + (tester) async { final controller = TextEditingController(); - final pinPut = CustomPinPut( - fieldsCount: 4, - pinAnimationType: PinAnimationType.fade, - controller: controller, + + await tester.pumpWidget( + MaterialApp( + theme: ThemeData( + extensions: [ + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), + ], + ), + home: Material( + child: PinWidget( + pinAnimation: PinAnimationType.none, + isRandom: false, + controller: controller, + ), + ), + ), + ); + + await tester.tap(find.byWidgetPredicate( + (widget) => widget is NumberKey && widget.number == "1")); + await tester.pumpAndSettle(); + expect(controller.text, "1"); + + await tester.tap(find.byType(BackspaceKey)); + await tester.pumpAndSettle(); + expect(controller.text, ""); + }); + + testWidgets("CustomPinPut pin enter scale animation, non-random PIN", + (tester) async { + final controller = TextEditingController(); + + await tester.pumpWidget( + MaterialApp( + theme: ThemeData( + extensions: [ + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), + ], + ), + home: Material( + child: PinWidget( + pinAnimation: PinAnimationType.scale, + isRandom: false, + controller: controller, + ), + ), + ), + ); + + await tester.tap(find.byWidgetPredicate( + (widget) => widget is NumberKey && widget.number == "1")); + await tester.pumpAndSettle(); + expect(controller.text, "1"); + + await tester.tap(find.byType(BackspaceKey)); + await tester.pumpAndSettle(); + expect(controller.text, ""); + }); + + testWidgets("CustomPinPut pin enter rotate animation, non-random PIN", + (tester) async { + final controller = TextEditingController(); + + await tester.pumpWidget( + MaterialApp( + theme: ThemeData( + extensions: [ + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), + ], + ), + home: Material( + child: PinWidget( + pinAnimation: PinAnimationType.rotation, + isRandom: false, + controller: controller, + ), + ), + ), ); + await tester.tap(find.byWidgetPredicate( + (widget) => widget is NumberKey && widget.number == "1")); + await tester.pumpAndSettle(); + expect(controller.text, "1"); + + await tester.tap(find.byType(BackspaceKey)); + await tester.pumpAndSettle(); + expect(controller.text, ""); + }); + }); + + testWidgets("PinKeyboard builds correctly, non-random PIN", (tester) async { + final keyboard = PinKeyboard( + onNumberKeyPressed: (_) {}, + onBackPressed: () {}, + onSubmitPressed: () {}, + isRandom: false, + ); + + await tester.pumpWidget( + MaterialApp( + theme: ThemeData( + extensions: [ + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), + ], + ), + home: Material( + child: keyboard, + ), + ), + ); + + expect(find.byType(BackspaceKey), findsOneWidget); + expect(find.byType(SubmitKey), findsOneWidget); + expect(find.byType(NumberKey), findsNWidgets(10)); + expect(find.text("0"), findsOneWidget); + expect(find.text("1"), findsOneWidget); + expect(find.text("2"), findsOneWidget); + expect(find.text("3"), findsOneWidget); + expect(find.text("4"), findsOneWidget); + expect(find.text("5"), findsOneWidget); + expect(find.text("6"), findsOneWidget); + expect(find.text("7"), findsOneWidget); + expect(find.text("8"), findsOneWidget); + expect(find.text("9"), findsOneWidget); + expect(find.byType(SvgPicture), findsNWidgets(2)); + }); + + group("CustomPinPut tests, with random PIN", () { + testWidgets("CustomPinPut with 4 fields builds correctly, with random PIN", + (tester) async { + await tester.pumpWidget( + MaterialApp( + theme: ThemeData( + extensions: [ + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), + ], + ), + home: const Material( + child: PinWidget( + pinAnimation: PinAnimationType.none, + isRandom: true, + ), + ), + ), + ); + + // expects 5 here. Four + the actual text field text + expect(find.text(""), findsNWidgets(1)); + expect(find.byType(PinKeyboard), findsOneWidget); + expect(find.byType(BackspaceKey), findsOneWidget); + expect(find.byType(NumberKey), findsNWidgets(10)); + }); + + // testWidgets("CustomPinPut entering a pin successfully, with random PIN", + // (tester) async { + // bool submittedPinMatches = false; + // + // await tester.pumpWidget( + // MaterialApp( + // theme: ThemeData( + // extensions: [ + // StackColors.fromStackColorTheme( + // StackTheme.fromJson( + // json: lightThemeJsonMap, + // + // ), + // ), + // ], + // ), + // home: Material( + // child: PinWidget( + // pinAnimation: PinAnimationType.none, + // isRandom: true, + // onSubmit: (pin) { + // submittedPinMatches = pin == "1234"; + // print("pin entered: $pin"); + // }, + // ), + // ), + // ), + // ); + // + // await tester.tap(find.byWidgetPredicate( + // (widget) => widget is NumberKey && widget.number == "1")); + // await tester.pumpAndSettle(); + // await tester.tap(find.byWidgetPredicate( + // (widget) => widget is NumberKey && widget.number == "2")); + // await tester.pumpAndSettle(); + // await tester.tap(find.byWidgetPredicate( + // (widget) => widget is NumberKey && widget.number == "6")); + // await tester.pumpAndSettle(); + // await tester.tap(find.byType(BackspaceKey)); + // await tester.pumpAndSettle(); + // await tester.tap(find.byWidgetPredicate( + // (widget) => widget is NumberKey && widget.number == "3")); + // await tester.pumpAndSettle(); + // await tester.tap(find.byWidgetPredicate( + // (widget) => widget is NumberKey && widget.number == "4")); + // await tester.pumpAndSettle(); + // await tester.tap(find.byType(SubmitKey)); + // await tester.pumpAndSettle(); + // + // expect(submittedPinMatches, true); + // }); + + testWidgets("CustomPinPut pin enter fade animation, with random PIN", + (tester) async { + final controller = TextEditingController(); + await tester.pumpWidget( MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: Material( - child: pinPut, + child: PinWidget( + pinAnimation: PinAnimationType.fade, + isRandom: true, + controller: controller, + ), ), ), ); @@ -104,23 +399,33 @@ void main() { expect(controller.text, ""); }); - testWidgets("CustomPinPut pin enter scale animation", (tester) async { + testWidgets("CustomPinPut pin enter scale animation, with random PIN", + (tester) async { final controller = TextEditingController(); final pinPut = CustomPinPut( fieldsCount: 4, pinAnimationType: PinAnimationType.scale, controller: controller, + isRandom: true, ); await tester.pumpWidget( MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: Material( - child: pinPut, + child: PinWidget( + isRandom: true, + controller: controller, + pinAnimation: PinAnimationType.scale, + ), ), ), ); @@ -135,23 +440,33 @@ void main() { expect(controller.text, ""); }); - testWidgets("CustomPinPut pin enter rotate animation", (tester) async { + testWidgets("CustomPinPut pin enter rotate animation, with random PIN", + (tester) async { final controller = TextEditingController(); final pinPut = CustomPinPut( fieldsCount: 4, pinAnimationType: PinAnimationType.rotation, controller: controller, + isRandom: true, ); await tester.pumpWidget( MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: Material( - child: pinPut, + child: PinWidget( + isRandom: true, + controller: controller, + pinAnimation: PinAnimationType.rotation, + ), ), ), ); @@ -167,18 +482,23 @@ void main() { }); }); - testWidgets("PinKeyboard builds correctly", (tester) async { + testWidgets("PinKeyboard builds correctly, with random PIN", (tester) async { final keyboard = PinKeyboard( onNumberKeyPressed: (_) {}, onBackPressed: () {}, onSubmitPressed: () {}, + isRandom: true, ); await tester.pumpWidget( MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: Material( @@ -188,6 +508,7 @@ void main() { ); expect(find.byType(BackspaceKey), findsOneWidget); + expect(find.byType(SubmitKey), findsOneWidget); expect(find.byType(NumberKey), findsNWidgets(10)); expect(find.text("0"), findsOneWidget); expect(find.text("1"), findsOneWidget); @@ -199,6 +520,6 @@ void main() { expect(find.text("7"), findsOneWidget); expect(find.text("8"), findsOneWidget); expect(find.text("9"), findsOneWidget); - expect(find.byType(SvgPicture), findsOneWidget); + expect(find.byType(SvgPicture), findsNWidgets(2)); }); } diff --git a/test/widget_tests/desktop/custom_text_button_test.dart b/test/widget_tests/desktop/custom_text_button_test.dart index f04ca597e9..b1e4054c91 100644 --- a/test/widget_tests/desktop/custom_text_button_test.dart +++ b/test/widget_tests/desktop/custom_text_button_test.dart @@ -1,9 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/utilities/util.dart'; -import 'package:stackduo/widgets/desktop/custom_text_button.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/widgets/desktop/custom_text_button.dart'; + +import '../../sample_data/theme_json.dart'; void main() { testWidgets("Test text button ", (widgetTester) async { @@ -13,7 +14,11 @@ void main() { MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: Material( diff --git a/test/widget_tests/desktop/desktop_app_bar_test.dart b/test/widget_tests/desktop/desktop_app_bar_test.dart index 0c90c59445..8ddc453abe 100644 --- a/test/widget_tests/desktop/desktop_app_bar_test.dart +++ b/test/widget_tests/desktop/desktop_app_bar_test.dart @@ -1,10 +1,12 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:stackduo/pages_desktop_specific/my_stack_view/exit_to_my_stack_button.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/custom_buttons/app_bar_icon_button.dart'; -import 'package:stackduo/widgets/desktop/desktop_app_bar.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/pages_desktop_specific/my_stack_view/exit_to_my_stack_button.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart'; +import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart'; + +import '../../sample_data/theme_json.dart'; void main() { testWidgets("Test DesktopAppBar widget", (widgetTester) async { @@ -14,7 +16,11 @@ void main() { MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: Material( diff --git a/test/widget_tests/desktop/desktop_dialog_close_button_test.dart b/test/widget_tests/desktop/desktop_dialog_close_button_test.dart index dab3b4c65b..ec8b4ce396 100644 --- a/test/widget_tests/desktop/desktop_dialog_close_button_test.dart +++ b/test/widget_tests/desktop/desktop_dialog_close_button_test.dart @@ -2,10 +2,12 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockingjay/mockingjay.dart' as mockingjay; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/custom_buttons/app_bar_icon_button.dart'; -import 'package:stackduo/widgets/desktop/desktop_dialog_close_button.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart'; +import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart'; + +import '../../sample_data/theme_json.dart'; void main() { testWidgets("test DesktopDialog button pressed", (widgetTester) async { @@ -19,7 +21,11 @@ void main() { child: MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: mockingjay.MockNavigatorProvider( diff --git a/test/widget_tests/desktop/desktop_dialog_test.dart b/test/widget_tests/desktop/desktop_dialog_test.dart index b5f6cc4d2e..5eafb6f8c9 100644 --- a/test/widget_tests/desktop/desktop_dialog_test.dart +++ b/test/widget_tests/desktop/desktop_dialog_test.dart @@ -1,9 +1,11 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/desktop/desktop_dialog.dart'; -import 'package:stackduo/widgets/desktop/desktop_dialog_close_button.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/widgets/desktop/desktop_dialog.dart'; +import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart'; + +import '../../sample_data/theme_json.dart'; void main() { testWidgets("test DesktopDialog builds", (widgetTester) async { @@ -13,7 +15,11 @@ void main() { MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: Material( diff --git a/test/widget_tests/desktop/desktop_scaffold_test.dart b/test/widget_tests/desktop/desktop_scaffold_test.dart index ab996c0bb4..8abb4cf5a7 100644 --- a/test/widget_tests/desktop/desktop_scaffold_test.dart +++ b/test/widget_tests/desktop/desktop_scaffold_test.dart @@ -1,23 +1,48 @@ import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/desktop/desktop_scaffold.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/themes/theme_service.dart'; +import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart'; +import '../../sample_data/theme_json.dart'; +import 'desktop_scaffold_test.mocks.dart'; + +@GenerateMocks([ + ThemeService, +]) void main() { testWidgets("test DesktopScaffold", (widgetTester) async { final key = UniqueKey(); + final mockThemeService = MockThemeService(); + when(mockThemeService.getTheme(themeId: "light")).thenAnswer( + (_) => StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ); await widgetTester.pumpWidget( - MaterialApp( - theme: ThemeData( - extensions: [ - StackColors.fromStackColorTheme(LightColors()), - ], - ), - home: Material( - child: DesktopScaffold( - key: key, - body: const SizedBox(), + ProviderScope( + overrides: [ + pThemeService.overrideWithValue(mockThemeService), + ], + child: MaterialApp( + theme: ThemeData( + extensions: [ + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), + ], + ), + home: Material( + child: DesktopScaffold( + key: key, + body: const SizedBox(), + ), ), ), ), @@ -26,20 +51,35 @@ void main() { testWidgets("Test MasterScaffold for non desktop", (widgetTester) async { final key = UniqueKey(); + final mockThemeService = MockThemeService(); + when(mockThemeService.getTheme(themeId: "light")).thenAnswer( + (_) => StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ); await widgetTester.pumpWidget( - MaterialApp( - theme: ThemeData( - extensions: [ - StackColors.fromStackColorTheme(LightColors()), - ], - ), - home: Material( - child: MasterScaffold( - key: key, - body: const SizedBox(), - appBar: AppBar(), - isDesktop: false, + ProviderScope( + overrides: [ + pThemeService.overrideWithValue(mockThemeService), + ], + child: MaterialApp( + theme: ThemeData( + extensions: [ + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), + ], + ), + home: Material( + child: MasterScaffold( + key: key, + body: const SizedBox(), + appBar: AppBar(), + isDesktop: false, + ), ), ), ), @@ -48,20 +88,36 @@ void main() { testWidgets("Test MasterScaffold for desktop", (widgetTester) async { final key = UniqueKey(); + final mockThemeService = MockThemeService(); + + when(mockThemeService.getTheme(themeId: "light")).thenAnswer( + (_) => StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ); await widgetTester.pumpWidget( - MaterialApp( - theme: ThemeData( - extensions: [ - StackColors.fromStackColorTheme(LightColors()), - ], - ), - home: Material( - child: MasterScaffold( - key: key, - body: const SizedBox(), - appBar: AppBar(), - isDesktop: true, + ProviderScope( + overrides: [ + pThemeService.overrideWithValue(mockThemeService), + ], + child: MaterialApp( + theme: ThemeData( + extensions: [ + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), + ], + ), + home: Material( + child: MasterScaffold( + key: key, + body: const SizedBox(), + appBar: AppBar(), + isDesktop: true, + ), ), ), ), diff --git a/test/widget_tests/emoji_select_sheet_test.dart b/test/widget_tests/emoji_select_sheet_test.dart index 5f973e94f9..15be7b1538 100644 --- a/test/widget_tests/emoji_select_sheet_test.dart +++ b/test/widget_tests/emoji_select_sheet_test.dart @@ -3,9 +3,11 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockingjay/mockingjay.dart' as mockingjay; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/emoji_select_sheet.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/widgets/emoji_select_sheet.dart'; + +import '../sample_data/theme_json.dart'; void main() { testWidgets("Widget displays correctly", (tester) async { @@ -15,7 +17,11 @@ void main() { MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: const Material( @@ -39,7 +45,11 @@ void main() { child: MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: mockingjay.MockNavigatorProvider( diff --git a/test/widget_tests/icon_widgets/addressbook_icon_test.dart b/test/widget_tests/icon_widgets/addressbook_icon_test.dart index fd0407cd65..ad8470898d 100644 --- a/test/widget_tests/icon_widgets/addressbook_icon_test.dart +++ b/test/widget_tests/icon_widgets/addressbook_icon_test.dart @@ -1,9 +1,11 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/icon_widgets/addressbook_icon.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/widgets/icon_widgets/addressbook_icon.dart'; + +import '../../sample_data/theme_json.dart'; void main() { testWidgets("test address book icon widget", (widgetTester) async { @@ -16,7 +18,11 @@ void main() { MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: Material( diff --git a/test/widget_tests/managed_favorite_test.dart b/test/widget_tests/managed_favorite_test.dart index bb6997035c..3d8bb66faf 100644 --- a/test/widget_tests/managed_favorite_test.dart +++ b/test/widget_tests/managed_favorite_test.dart @@ -1,30 +1,44 @@ +import 'package:decimal/decimal.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; -import 'package:stackduo/models/balance.dart'; -import 'package:stackduo/providers/providers.dart'; -import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart'; -import 'package:stackduo/services/coins/coin_service.dart'; -import 'package:stackduo/services/coins/manager.dart'; -import 'package:stackduo/services/locale_service.dart'; -import 'package:stackduo/services/node_service.dart'; -import 'package:stackduo/services/wallets.dart'; -import 'package:stackduo/services/wallets_service.dart'; -import 'package:stackduo/utilities/amount/amount.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; -import 'package:stackduo/utilities/listenable_list.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/managed_favorite.dart'; +import 'package:stackwallet/models/balance.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/providers/providers.dart'; +import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart'; +import 'package:stackwallet/services/coins/coin_service.dart'; +import 'package:stackwallet/services/coins/manager.dart'; +import 'package:stackwallet/services/locale_service.dart'; +import 'package:stackwallet/services/node_service.dart'; +import 'package:stackwallet/services/wallets.dart'; +import 'package:stackwallet/services/wallets_service.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/themes/theme_service.dart'; +import 'package:stackwallet/utilities/amount/amount.dart'; +import 'package:stackwallet/utilities/amount/amount_unit.dart'; +import 'package:stackwallet/utilities/enums/coin_enum.dart'; +import 'package:stackwallet/utilities/listenable_list.dart'; +import 'package:stackwallet/utilities/prefs.dart'; +import 'package:stackwallet/widgets/managed_favorite.dart'; +import '../sample_data/theme_json.dart'; import 'managed_favorite_test.mocks.dart'; +/// quick amount constructor wrapper. Using an int is bad practice but for +/// testing with small amounts this should be fine +Amount _a(int i) => Amount.fromDecimal( + Decimal.fromInt(i), + fractionDigits: 8, + ); + @GenerateMocks([ Wallets, WalletsService, BitcoinWallet, + ThemeService, + Prefs, LocaleService ], customMocks: [ MockSpec(returnNullOnMissingStub: true), @@ -35,20 +49,34 @@ void main() { testWidgets("Test wallet info row displays correctly", (widgetTester) async { final wallets = MockWallets(); final CoinServiceAPI wallet = MockBitcoinWallet(); + final mockThemeService = MockThemeService(); + final mockPrefs = MockPrefs(); + when(mockThemeService.getTheme(themeId: "light")).thenAnswer( + (_) => StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ); when(wallet.coin).thenAnswer((_) => Coin.bitcoin); when(wallet.walletName).thenAnswer((_) => "some wallet"); when(wallet.walletId).thenAnswer((_) => "some wallet id"); + when(mockPrefs.amountUnit(Coin.bitcoin)).thenAnswer( + (_) => AmountUnit.normal, + ); + when(mockPrefs.maxDecimals(Coin.bitcoin)).thenAnswer( + (_) => 8, + ); + final manager = Manager(wallet); when(wallets.getManager("some wallet id")) .thenAnswer((realInvocation) => manager); when(manager.balance).thenAnswer( (realInvocation) => Balance( - total: 10.toAmountAsRaw(fractionDigits: 8), - spendable: 10.toAmountAsRaw(fractionDigits: 8), - blockedTotal: 0.toAmountAsRaw(fractionDigits: 8), - pendingSpendable: 0.toAmountAsRaw(fractionDigits: 8), + total: _a(10), + spendable: _a(10), + blockedTotal: _a(0), + pendingSpendable: _a(0), ), ); @@ -59,12 +87,16 @@ void main() { ProviderScope( overrides: [ walletsChangeNotifierProvider.overrideWithValue(wallets), + pThemeService.overrideWithValue(mockThemeService), + prefsChangeNotifierProvider.overrideWithValue(mockPrefs), ], child: MaterialApp( theme: ThemeData( extensions: [ StackColors.fromStackColorTheme( - LightColors(), + StackTheme.fromJson( + json: lightThemeJsonMap, + ), ), ], ), @@ -86,10 +118,20 @@ void main() { final CoinServiceAPI wallet = MockBitcoinWallet(); final mockLocaleService = MockLocaleService(); final mockWalletsService = MockWalletsService(); + final mockThemeService = MockThemeService(); + final mockPrefs = MockPrefs(); + when(mockThemeService.getTheme(themeId: "light")).thenAnswer( + (_) => StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ); when(wallet.coin).thenAnswer((_) => Coin.bitcoin); when(wallet.walletName).thenAnswer((_) => "some wallet"); when(wallet.walletId).thenAnswer((_) => "some wallet id"); + when(mockPrefs.amountUnit(Coin.bitcoin)).thenAnswer( + (_) => AmountUnit.normal, + ); final manager = Manager(wallet); @@ -97,15 +139,19 @@ void main() { .thenAnswer((realInvocation) => manager); when(manager.balance).thenAnswer( (realInvocation) => Balance( - total: 10.toAmountAsRaw(fractionDigits: 8), - spendable: 10.toAmountAsRaw(fractionDigits: 8), - blockedTotal: 0.toAmountAsRaw(fractionDigits: 8), - pendingSpendable: 0.toAmountAsRaw(fractionDigits: 8), + total: _a(10), + spendable: _a(10), + blockedTotal: _a(0), + pendingSpendable: _a(0), ), ); when(manager.isFavorite).thenAnswer((realInvocation) => false); + when(mockPrefs.maxDecimals(Coin.bitcoin)).thenAnswer( + (_) => 8, + ); + when(mockLocaleService.locale).thenAnswer((_) => "en_US"); when(wallets.getManagerProvider("some wallet id")).thenAnswer( @@ -126,14 +172,18 @@ void main() { .overrideWithValue(mockLocaleService), favoritesProvider.overrideWithValue(favorites), nonFavoritesProvider.overrideWithValue(nonfavorites), + pThemeService.overrideWithValue(mockThemeService), walletsServiceChangeNotifierProvider - .overrideWithValue(mockWalletsService) + .overrideWithValue(mockWalletsService), + prefsChangeNotifierProvider.overrideWithValue(mockPrefs), ], child: MaterialApp( theme: ThemeData( extensions: [ StackColors.fromStackColorTheme( - LightColors(), + StackTheme.fromJson( + json: lightThemeJsonMap, + ), ), ], ), @@ -154,11 +204,22 @@ void main() { final CoinServiceAPI wallet = MockBitcoinWallet(); final mockLocaleService = MockLocaleService(); final mockWalletsService = MockWalletsService(); + final mockThemeService = MockThemeService(); + final mockPrefs = MockPrefs(); + when(mockThemeService.getTheme(themeId: "light")).thenAnswer( + (_) => StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ); when(wallet.coin).thenAnswer((_) => Coin.bitcoin); when(wallet.walletName).thenAnswer((_) => "some wallet"); when(wallet.walletId).thenAnswer((_) => "some wallet id"); + when(mockPrefs.maxDecimals(Coin.bitcoin)).thenAnswer( + (_) => 8, + ); + final manager = Manager(wallet); when(wallets.getManager("some wallet id")) @@ -167,12 +228,15 @@ void main() { when(manager.isFavorite).thenAnswer((realInvocation) => true); when(manager.balance).thenAnswer( (realInvocation) => Balance( - total: 10.toAmountAsRaw(fractionDigits: 8), - spendable: 10.toAmountAsRaw(fractionDigits: 8), - blockedTotal: 0.toAmountAsRaw(fractionDigits: 8), - pendingSpendable: 0.toAmountAsRaw(fractionDigits: 8), + total: _a(10), + spendable: _a(10), + blockedTotal: _a(0), + pendingSpendable: _a(0), ), ); + when(mockPrefs.amountUnit(Coin.bitcoin)).thenAnswer( + (_) => AmountUnit.normal, + ); when(mockLocaleService.locale).thenAnswer((_) => "en_US"); @@ -194,6 +258,8 @@ void main() { .overrideWithValue(mockLocaleService), favoritesProvider.overrideWithValue(favorites), nonFavoritesProvider.overrideWithValue(nonfavorites), + pThemeService.overrideWithValue(mockThemeService), + prefsChangeNotifierProvider.overrideWithValue(mockPrefs), walletsServiceChangeNotifierProvider .overrideWithValue(mockWalletsService) ], @@ -201,7 +267,9 @@ void main() { theme: ThemeData( extensions: [ StackColors.fromStackColorTheme( - LightColors(), + StackTheme.fromJson( + json: lightThemeJsonMap, + ), ), ], ), diff --git a/test/widget_tests/managed_favorite_test.mocks.dart b/test/widget_tests/managed_favorite_test.mocks.dart index 7b5cab81e6..0984ce454e 100644 --- a/test/widget_tests/managed_favorite_test.mocks.dart +++ b/test/widget_tests/managed_favorite_test.mocks.dart @@ -1,11 +1,10 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/widget_tests/managed_favorite_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i23; -import 'dart:typed_data' as _i29; -import 'dart:ui' as _i25; +import 'dart:typed_data' as _i28; import 'package:bip32/bip32.dart' as _i16; import 'package:bip47/bip47.dart' as _i18; @@ -13,25 +12,25 @@ import 'package:bitcoindart/bitcoindart.dart' as _i13; import 'package:flutter/foundation.dart' as _i4; import 'package:flutter_riverpod/flutter_riverpod.dart' as _i5; import 'package:mockito/mockito.dart' as _i1; -import 'package:stackduo/db/main_db.dart' as _i12; +import 'package:stackduo/db/isar/main_db.dart' as _i12; import 'package:stackduo/electrumx_rpc/cached_electrumx.dart' as _i10; import 'package:stackduo/electrumx_rpc/electrumx.dart' as _i9; import 'package:stackduo/models/balance.dart' as _i11; import 'package:stackduo/models/isar/models/isar_models.dart' as _i17; -import 'package:stackduo/models/node_model.dart' as _i31; +import 'package:stackduo/models/node_model.dart' as _i30; import 'package:stackduo/models/paymint/fee_object_model.dart' as _i8; -import 'package:stackduo/models/signing_data.dart' as _i28; -import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart' as _i26; +import 'package:stackduo/models/signing_data.dart' as _i27; +import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart' as _i25; import 'package:stackduo/services/coins/coin_service.dart' as _i20; import 'package:stackduo/services/coins/manager.dart' as _i6; -import 'package:stackduo/services/locale_service.dart' as _i30; +import 'package:stackduo/services/locale_service.dart' as _i29; import 'package:stackduo/services/node_service.dart' as _i3; import 'package:stackduo/services/transaction_notification_tracker.dart' as _i7; import 'package:stackduo/services/wallets.dart' as _i21; import 'package:stackduo/services/wallets_service.dart' as _i2; import 'package:stackduo/utilities/amount/amount.dart' as _i14; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i22; -import 'package:stackduo/utilities/enums/derive_path_type_enum.dart' as _i27; +import 'package:stackduo/utilities/enums/derive_path_type_enum.dart' as _i26; import 'package:stackduo/utilities/flutter_secure_storage_interface.dart' as _i19; import 'package:stackduo/utilities/prefs.dart' as _i24; @@ -428,7 +427,7 @@ class MockWallets extends _i1.Mock implements _i21.Wallets { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -436,7 +435,7 @@ class MockWallets extends _i1.Mock implements _i21.Wallets { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -654,7 +653,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -662,7 +661,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -690,7 +689,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { /// A class which mocks [BitcoinWallet]. /// /// See the documentation for Mockito's code generation for more information. -class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { +class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet { MockBitcoinWallet() { _i1.throwOnMissingStub(this); } @@ -951,15 +950,15 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - _i27.DerivePathType addressType({required String? address}) => + _i26.DerivePathType addressType({required String? address}) => (super.noSuchMethod( Invocation.method( #addressType, [], {#address: address}, ), - returnValue: _i27.DerivePathType.bip44, - ) as _i27.DerivePathType); + returnValue: _i26.DerivePathType.bip44, + ) as _i26.DerivePathType); @override _i23.Future recoverFromMnemonic({ required String? mnemonic, @@ -1195,6 +1194,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { required String? recipientAddress, required bool? coinControl, required bool? isSendAll, + int? satsPerVByte, int? additionalOutputs = 0, List<_i17.UTXO>? utxos, }) => @@ -1207,12 +1207,13 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { #recipientAddress: recipientAddress, #coinControl: coinControl, #isSendAll: isSendAll, + #satsPerVByte: satsPerVByte, #additionalOutputs: additionalOutputs, #utxos: utxos, }, )); @override - _i23.Future> fetchBuildTxData( + _i23.Future> fetchBuildTxData( List<_i17.UTXO>? utxosToUse) => (super.noSuchMethod( Invocation.method( @@ -1220,11 +1221,11 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { [utxosToUse], ), returnValue: - _i23.Future>.value(<_i28.SigningData>[]), - ) as _i23.Future>); + _i23.Future>.value(<_i27.SigningData>[]), + ) as _i23.Future>); @override _i23.Future> buildTransaction({ - required List<_i28.SigningData>? utxoSigningData, + required List<_i27.SigningData>? utxoSigningData, required List? recipients, required List? satoshiAmounts, }) => @@ -1513,7 +1514,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { })? prepareSend, required _i23.Future Function({required String address})? getTxCount, - required _i23.Future> Function(List<_i17.UTXO>)? + required _i23.Future> Function(List<_i17.UTXO>)? fetchBuildTxData, required _i23.Future Function()? refresh, required _i23.Future Function()? checkChangeAddressForTransactions, @@ -1563,7 +1564,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { )), ) as _i23.Future<_i16.BIP32>); @override - _i23.Future<_i29.Uint8List> getPrivateKeyForPaynymReceivingAddress({ + _i23.Future<_i28.Uint8List> getPrivateKeyForPaynymReceivingAddress({ required String? paymentCodeString, required int? index, }) => @@ -1576,8 +1577,8 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { #index: index, }, ), - returnValue: _i23.Future<_i29.Uint8List>.value(_i29.Uint8List(0)), - ) as _i23.Future<_i29.Uint8List>); + returnValue: _i23.Future<_i28.Uint8List>.value(_i28.Uint8List(0)), + ) as _i23.Future<_i28.Uint8List>); @override _i23.Future<_i17.Address> currentReceivingPaynymAddress({ required _i18.PaymentCode? sender, @@ -1663,14 +1664,14 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { )), ) as _i23.Future<_i18.PaymentCode>); @override - _i23.Future<_i29.Uint8List> signWithNotificationKey(_i29.Uint8List? data) => + _i23.Future<_i28.Uint8List> signWithNotificationKey(_i28.Uint8List? data) => (super.noSuchMethod( Invocation.method( #signWithNotificationKey, [data], ), - returnValue: _i23.Future<_i29.Uint8List>.value(_i29.Uint8List(0)), - ) as _i23.Future<_i29.Uint8List>); + returnValue: _i23.Future<_i28.Uint8List>.value(_i28.Uint8List(0)), + ) as _i23.Future<_i28.Uint8List>); @override _i23.Future signStringWithNotificationKey(String? data) => (super.noSuchMethod( @@ -1938,7 +1939,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { /// A class which mocks [LocaleService]. /// /// See the documentation for Mockito's code generation for more information. -class MockLocaleService extends _i1.Mock implements _i30.LocaleService { +class MockLocaleService extends _i1.Mock implements _i29.LocaleService { MockLocaleService() { _i1.throwOnMissingStub(this); } @@ -1964,7 +1965,7 @@ class MockLocaleService extends _i1.Mock implements _i30.LocaleService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -1972,7 +1973,7 @@ class MockLocaleService extends _i1.Mock implements _i30.LocaleService { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -2010,15 +2011,15 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { ), ) as _i19.SecureStorageInterface); @override - List<_i31.NodeModel> get primaryNodes => (super.noSuchMethod( + List<_i30.NodeModel> get primaryNodes => (super.noSuchMethod( Invocation.getter(#primaryNodes), - returnValue: <_i31.NodeModel>[], - ) as List<_i31.NodeModel>); + returnValue: <_i30.NodeModel>[], + ) as List<_i30.NodeModel>); @override - List<_i31.NodeModel> get nodes => (super.noSuchMethod( + List<_i30.NodeModel> get nodes => (super.noSuchMethod( Invocation.getter(#nodes), - returnValue: <_i31.NodeModel>[], - ) as List<_i31.NodeModel>); + returnValue: <_i30.NodeModel>[], + ) as List<_i30.NodeModel>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), @@ -2036,7 +2037,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { @override _i23.Future setPrimaryNodeFor({ required _i22.Coin? coin, - required _i31.NodeModel? node, + required _i30.NodeModel? node, bool? shouldNotifyListeners = false, }) => (super.noSuchMethod( @@ -2053,40 +2054,40 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - _i31.NodeModel? getPrimaryNodeFor({required _i22.Coin? coin}) => + _i30.NodeModel? getPrimaryNodeFor({required _i22.Coin? coin}) => (super.noSuchMethod(Invocation.method( #getPrimaryNodeFor, [], {#coin: coin}, - )) as _i31.NodeModel?); + )) as _i30.NodeModel?); @override - List<_i31.NodeModel> getNodesFor(_i22.Coin? coin) => (super.noSuchMethod( + List<_i30.NodeModel> getNodesFor(_i22.Coin? coin) => (super.noSuchMethod( Invocation.method( #getNodesFor, [coin], ), - returnValue: <_i31.NodeModel>[], - ) as List<_i31.NodeModel>); + returnValue: <_i30.NodeModel>[], + ) as List<_i30.NodeModel>); @override - _i31.NodeModel? getNodeById({required String? id}) => + _i30.NodeModel? getNodeById({required String? id}) => (super.noSuchMethod(Invocation.method( #getNodeById, [], {#id: id}, - )) as _i31.NodeModel?); + )) as _i30.NodeModel?); @override - List<_i31.NodeModel> failoverNodesFor({required _i22.Coin? coin}) => + List<_i30.NodeModel> failoverNodesFor({required _i22.Coin? coin}) => (super.noSuchMethod( Invocation.method( #failoverNodesFor, [], {#coin: coin}, ), - returnValue: <_i31.NodeModel>[], - ) as List<_i31.NodeModel>); + returnValue: <_i30.NodeModel>[], + ) as List<_i30.NodeModel>); @override _i23.Future add( - _i31.NodeModel? node, + _i30.NodeModel? node, String? password, bool? shouldNotifyListeners, ) => @@ -2138,7 +2139,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { ) as _i23.Future); @override _i23.Future edit( - _i31.NodeModel? editedNode, + _i30.NodeModel? editedNode, String? password, bool? shouldNotifyListeners, ) => @@ -2164,7 +2165,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -2172,7 +2173,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -2349,6 +2350,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -2552,7 +2558,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -2560,7 +2566,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/widget_tests/node_card_test.dart b/test/widget_tests/node_card_test.dart index 358ac34fee..b8e1266963 100644 --- a/test/widget_tests/node_card_test.dart +++ b/test/widget_tests/node_card_test.dart @@ -4,16 +4,17 @@ import 'package:flutter_svg/svg.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; -import 'package:stackduo/models/node_model.dart'; -import 'package:stackduo/providers/providers.dart'; -import 'package:stackduo/services/node_service.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/utilities/util.dart'; -import 'package:stackduo/widgets/node_card.dart'; -import 'package:stackduo/widgets/node_options_sheet.dart'; - +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/models/node_model.dart'; +import 'package:stackwallet/providers/providers.dart'; +import 'package:stackwallet/services/node_service.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/utilities/enums/coin_enum.dart'; +import 'package:stackwallet/utilities/util.dart'; +import 'package:stackwallet/widgets/node_card.dart'; +import 'package:stackwallet/widgets/node_options_sheet.dart'; + +import '../sample_data/theme_json.dart'; import 'node_card_test.mocks.dart'; @GenerateMocks([NodeService]) @@ -54,7 +55,9 @@ void main() { theme: ThemeData( extensions: [ StackColors.fromStackColorTheme( - LightColors(), + StackTheme.fromJson( + json: lightThemeJsonMap, + ), ), ], ), @@ -112,7 +115,9 @@ void main() { theme: ThemeData( extensions: [ StackColors.fromStackColorTheme( - LightColors(), + StackTheme.fromJson( + json: lightThemeJsonMap, + ), ), ], ), @@ -171,7 +176,9 @@ void main() { theme: ThemeData( extensions: [ StackColors.fromStackColorTheme( - LightColors(), + StackTheme.fromJson( + json: lightThemeJsonMap, + ), ), ], ), diff --git a/test/widget_tests/node_card_test.mocks.dart b/test/widget_tests/node_card_test.mocks.dart index 59c032c4c9..790991f1e9 100644 --- a/test/widget_tests/node_card_test.mocks.dart +++ b/test/widget_tests/node_card_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/widget_tests/node_card_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i5; -import 'dart:ui' as _i7; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/node_model.dart' as _i4; @@ -206,7 +205,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override - void addListener(_i7.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -214,7 +213,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/widget_tests/node_options_sheet_test.dart b/test/widget_tests/node_options_sheet_test.dart index 508e156703..b80e4682d2 100644 --- a/test/widget_tests/node_options_sheet_test.dart +++ b/test/widget_tests/node_options_sheet_test.dart @@ -5,17 +5,18 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:mockingjay/mockingjay.dart' as mockingjay; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; -import 'package:stackduo/models/node_model.dart'; -import 'package:stackduo/providers/providers.dart'; -import 'package:stackduo/services/node_service.dart'; -import 'package:stackduo/services/wallets.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; -import 'package:stackduo/utilities/prefs.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/node_options_sheet.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/models/node_model.dart'; +import 'package:stackwallet/providers/providers.dart'; +import 'package:stackwallet/services/node_service.dart'; +import 'package:stackwallet/services/wallets.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/utilities/enums/coin_enum.dart'; +import 'package:stackwallet/utilities/prefs.dart'; +import 'package:stackwallet/widgets/node_options_sheet.dart'; import 'package:tuple/tuple.dart'; +import '../sample_data/theme_json.dart'; import 'node_options_sheet_test.mocks.dart'; @GenerateMocks([Wallets, Prefs, NodeService]) @@ -60,7 +61,9 @@ void main() { theme: ThemeData( extensions: [ StackColors.fromStackColorTheme( - LightColors(), + StackTheme.fromJson( + json: lightThemeJsonMap, + ), ), ], ), @@ -129,7 +132,11 @@ void main() { child: MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: mockingjay.MockNavigatorProvider( @@ -192,7 +199,9 @@ void main() { theme: ThemeData( extensions: [ StackColors.fromStackColorTheme( - LightColors(), + StackTheme.fromJson( + json: lightThemeJsonMap, + ), ), ], ), diff --git a/test/widget_tests/node_options_sheet_test.mocks.dart b/test/widget_tests/node_options_sheet_test.mocks.dart index 56bfe69497..03ca0e9fae 100644 --- a/test/widget_tests/node_options_sheet_test.mocks.dart +++ b/test/widget_tests/node_options_sheet_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/widget_tests/node_options_sheet_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i11; -import 'dart:ui' as _i13; import 'package:flutter/foundation.dart' as _i4; import 'package:flutter_riverpod/flutter_riverpod.dart' as _i5; @@ -14,9 +13,10 @@ import 'package:stackduo/services/coins/manager.dart' as _i6; import 'package:stackduo/services/node_service.dart' as _i3; import 'package:stackduo/services/wallets.dart' as _i8; import 'package:stackduo/services/wallets_service.dart' as _i2; -import 'package:stackduo/utilities/enums/backup_frequency_type.dart' as _i15; +import 'package:stackduo/utilities/amount/amount_unit.dart' as _i15; +import 'package:stackduo/utilities/enums/backup_frequency_type.dart' as _i14; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i9; -import 'package:stackduo/utilities/enums/sync_type_enum.dart' as _i14; +import 'package:stackduo/utilities/enums/sync_type_enum.dart' as _i13; import 'package:stackduo/utilities/flutter_secure_storage_interface.dart' as _i7; import 'package:stackduo/utilities/prefs.dart' as _i12; @@ -269,7 +269,7 @@ class MockWallets extends _i1.Mock implements _i8.Wallets { returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override - void addListener(_i13.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -277,7 +277,7 @@ class MockWallets extends _i1.Mock implements _i8.Wallets { returnValueForMissingStub: null, ); @override - void removeListener(_i13.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -353,12 +353,12 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { returnValueForMissingStub: null, ); @override - _i14.SyncingType get syncType => (super.noSuchMethod( + _i13.SyncingType get syncType => (super.noSuchMethod( Invocation.getter(#syncType), - returnValue: _i14.SyncingType.currentWalletOnly, - ) as _i14.SyncingType); + returnValue: _i13.SyncingType.currentWalletOnly, + ) as _i13.SyncingType); @override - set syncType(_i14.SyncingType? syncType) => super.noSuchMethod( + set syncType(_i13.SyncingType? syncType) => super.noSuchMethod( Invocation.setter( #syncType, syncType, @@ -504,12 +504,12 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { returnValueForMissingStub: null, ); @override - _i15.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( + _i14.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( Invocation.getter(#backupFrequencyType), - returnValue: _i15.BackupFrequencyType.everyTenMinutes, - ) as _i15.BackupFrequencyType); + returnValue: _i14.BackupFrequencyType.everyTenMinutes, + ) as _i14.BackupFrequencyType); @override - set backupFrequencyType(_i15.BackupFrequencyType? backupFrequencyType) => + set backupFrequencyType(_i14.BackupFrequencyType? backupFrequencyType) => super.noSuchMethod( Invocation.setter( #backupFrequencyType, @@ -691,7 +691,55 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override - void addListener(_i13.VoidCallback? listener) => super.noSuchMethod( + _i15.AmountUnit amountUnit(_i9.Coin? coin) => (super.noSuchMethod( + Invocation.method( + #amountUnit, + [coin], + ), + returnValue: _i15.AmountUnit.normal, + ) as _i15.AmountUnit); + @override + void updateAmountUnit({ + required _i9.Coin? coin, + required _i15.AmountUnit? amountUnit, + }) => + super.noSuchMethod( + Invocation.method( + #updateAmountUnit, + [], + { + #coin: coin, + #amountUnit: amountUnit, + }, + ), + returnValueForMissingStub: null, + ); + @override + int maxDecimals(_i9.Coin? coin) => (super.noSuchMethod( + Invocation.method( + #maxDecimals, + [coin], + ), + returnValue: 0, + ) as int); + @override + void updateMaxDecimals({ + required _i9.Coin? coin, + required int? maxDecimals, + }) => + super.noSuchMethod( + Invocation.method( + #updateMaxDecimals, + [], + { + #coin: coin, + #maxDecimals: maxDecimals, + }, + ), + returnValueForMissingStub: null, + ); + @override + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -699,7 +747,7 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { returnValueForMissingStub: null, ); @override - void removeListener(_i13.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -895,7 +943,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override - void addListener(_i13.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -903,7 +951,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i13.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/widget_tests/progress_bar_test.dart b/test/widget_tests/progress_bar_test.dart index 04751b78d0..681a5ac0c5 100644 --- a/test/widget_tests/progress_bar_test.dart +++ b/test/widget_tests/progress_bar_test.dart @@ -1,26 +1,30 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/progress_bar.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/widgets/progress_bar.dart'; + +import '../sample_data/theme_json.dart'; void main() { testWidgets("Widget build", (widgetTester) async { + final theme = StackTheme.fromJson( + json: lightThemeJsonMap, + ); await widgetTester.pumpWidget( MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme(theme), ], ), home: Material( child: ProgressBar( width: 20, height: 10, - fillColor: - StackColors.fromStackColorTheme(LightColors()).accentColorRed, - backgroundColor: StackColors.fromStackColorTheme(LightColors()) - .accentColorYellow, + fillColor: StackColors.fromStackColorTheme(theme).accentColorRed, + backgroundColor: + StackColors.fromStackColorTheme(theme).accentColorYellow, percent: 30), ), ), diff --git a/test/widget_tests/shake/shake_test.dart b/test/widget_tests/shake/shake_test.dart index edaf3bbfec..ab9a80fed9 100644 --- a/test/widget_tests/shake/shake_test.dart +++ b/test/widget_tests/shake/shake_test.dart @@ -1,8 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/shake/shake.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/widgets/shake/shake.dart'; + +import '../../sample_data/theme_json.dart'; void main() { testWidgets("Widget build", (widgetTester) async { @@ -10,21 +12,26 @@ void main() { MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: Material( child: Shake( - animationRange: 10, - controller: ShakeController(), - animationDuration: const Duration(milliseconds: 200), - child: Column( - children: const [ - Center( - child: Text("Enter Pin"), - ) - ], - )), + animationRange: 10, + controller: ShakeController(), + animationDuration: const Duration(milliseconds: 200), + child: const Column( + children: [ + Center( + child: Text("Enter Pin"), + ) + ], + ), + ), ), ), ); diff --git a/test/widget_tests/stack_dialog_test.dart b/test/widget_tests/stack_dialog_test.dart index 109f7e3ffa..0f42ab80ac 100644 --- a/test/widget_tests/stack_dialog_test.dart +++ b/test/widget_tests/stack_dialog_test.dart @@ -2,9 +2,11 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockingjay/mockingjay.dart' as mockingjay; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/stack_dialog.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/widgets/stack_dialog.dart'; + +import '../sample_data/theme_json.dart'; void main() { testWidgets("test StackDialogBase", (widgetTester) async { @@ -12,7 +14,11 @@ void main() { MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: const Material( @@ -29,7 +35,11 @@ void main() { MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: const Material( @@ -60,7 +70,11 @@ void main() { child: MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: mockingjay.MockNavigatorProvider( diff --git a/test/widget_tests/table_view/table_view_cell_test.dart b/test/widget_tests/table_view/table_view_cell_test.dart index e6ffe9ddf7..14e66eb5ee 100644 --- a/test/widget_tests/table_view/table_view_cell_test.dart +++ b/test/widget_tests/table_view/table_view_cell_test.dart @@ -1,8 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/table_view/table_view_cell.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/widgets/table_view/table_view_cell.dart'; + +import '../../sample_data/theme_json.dart'; void main() { testWidgets("Widget build correctly", (widgetTester) async { @@ -11,7 +13,11 @@ void main() { MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: const Material( diff --git a/test/widget_tests/table_view/table_view_row_test.dart b/test/widget_tests/table_view/table_view_row_test.dart index 3c7a9495c1..4a84f0e64e 100644 --- a/test/widget_tests/table_view/table_view_row_test.dart +++ b/test/widget_tests/table_view/table_view_row_test.dart @@ -3,26 +3,29 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; -import 'package:stackduo/models/balance.dart'; -import 'package:stackduo/pages_desktop_specific/my_stack_view/coin_wallets_table.dart'; -import 'package:stackduo/providers/providers.dart'; -import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart'; -import 'package:stackduo/services/coins/coin_service.dart'; -import 'package:stackduo/services/coins/manager.dart'; -import 'package:stackduo/services/wallets.dart'; -import 'package:stackduo/services/wallets_service.dart'; -import 'package:stackduo/utilities/amount/amount.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/table_view/table_view_cell.dart'; -import 'package:stackduo/widgets/table_view/table_view_row.dart'; +import 'package:stackwallet/models/balance.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/pages_desktop_specific/my_stack_view/coin_wallets_table.dart'; +import 'package:stackwallet/providers/providers.dart'; +import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart'; +import 'package:stackwallet/services/coins/coin_service.dart'; +import 'package:stackwallet/services/coins/manager.dart'; +import 'package:stackwallet/services/wallets.dart'; +import 'package:stackwallet/services/wallets_service.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/themes/theme_service.dart'; +import 'package:stackwallet/utilities/amount/amount.dart'; +import 'package:stackwallet/utilities/enums/coin_enum.dart'; +import 'package:stackwallet/widgets/table_view/table_view_cell.dart'; +import 'package:stackwallet/widgets/table_view/table_view_row.dart'; +import '../../sample_data/theme_json.dart'; import 'table_view_row_test.mocks.dart'; @GenerateMocks([ Wallets, WalletsService, + ThemeService, BitcoinWallet ], customMocks: [ MockSpec(returnNullOnMissingStub: true), @@ -30,18 +33,26 @@ import 'table_view_row_test.mocks.dart'; ]) void main() { testWidgets('Test table view row', (widgetTester) async { + widgetTester.binding.window.physicalSizeTestValue = const Size(2500, 1800); + final mockWallet = MockWallets(); + final mockThemeService = MockThemeService(); final CoinServiceAPI wallet = MockBitcoinWallet(); when(wallet.coin).thenAnswer((_) => Coin.bitcoin); + when(mockThemeService.getTheme(themeId: "light")).thenAnswer( + (_) => StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ); when(wallet.walletName).thenAnswer((_) => "some wallet"); when(wallet.walletId).thenAnswer((_) => "Wallet id 1"); when(wallet.balance).thenAnswer( (_) => Balance( - total: 0.toAmountAsRaw(fractionDigits: 8), - spendable: 0.toAmountAsRaw(fractionDigits: 8), - blockedTotal: 0.toAmountAsRaw(fractionDigits: 8), - pendingSpendable: 0.toAmountAsRaw(fractionDigits: 8), + total: Amount.zero, + spendable: Amount.zero, + blockedTotal: Amount.zero, + pendingSpendable: Amount.zero, ), ); @@ -56,30 +67,32 @@ void main() { when(mockWallet.getManagerProvider("wallet id 2")).thenAnswer( (realInvocation) => ChangeNotifierProvider((ref) => manager)); - final walletIds = mockWallet.getWalletIdsFor(coin: Coin.bitcoin); - await widgetTester.pumpWidget( ProviderScope( overrides: [ walletsChangeNotifierProvider.overrideWithValue(mockWallet), + pThemeService.overrideWithValue(mockThemeService), ], child: MaterialApp( theme: ThemeData( extensions: [ StackColors.fromStackColorTheme( - LightColors(), + StackTheme.fromJson( + json: lightThemeJsonMap, + ), ), ], ), home: Material( child: TableViewRow( - cells: [ - for (int j = 1; j <= 5; j++) - TableViewCell(flex: 16, child: Text("Some Text ${j}")) - ], - expandingChild: const CoinWalletsTable( - coin: Coin.bitcoin, - )), + cells: [ + for (int j = 1; j <= 5; j++) + TableViewCell(flex: 16, child: Text("Some ${j}")) + ], + expandingChild: const CoinWalletsTable( + coin: Coin.bitcoin, + ), + ), ), ), ), @@ -87,7 +100,7 @@ void main() { await widgetTester.pumpAndSettle(); - expect(find.text("Some Text 1"), findsOneWidget); + expect(find.text("Some 1"), findsOneWidget); expect(find.byType(TableViewRow), findsWidgets); expect(find.byType(TableViewCell), findsWidgets); expect(find.byType(CoinWalletsTable), findsWidgets); diff --git a/test/widget_tests/table_view/table_view_row_test.mocks.dart b/test/widget_tests/table_view/table_view_row_test.mocks.dart index 66646e6bcf..feca2694f3 100644 --- a/test/widget_tests/table_view/table_view_row_test.mocks.dart +++ b/test/widget_tests/table_view/table_view_row_test.mocks.dart @@ -1,11 +1,10 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/widget_tests/table_view/table_view_row_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i22; -import 'dart:typed_data' as _i29; -import 'dart:ui' as _i24; +import 'dart:typed_data' as _i28; import 'package:bip32/bip32.dart' as _i16; import 'package:bip47/bip47.dart' as _i18; @@ -13,14 +12,14 @@ import 'package:bitcoindart/bitcoindart.dart' as _i13; import 'package:flutter/foundation.dart' as _i4; import 'package:flutter_riverpod/flutter_riverpod.dart' as _i5; import 'package:mockito/mockito.dart' as _i1; -import 'package:stackduo/db/main_db.dart' as _i12; +import 'package:stackduo/db/isar/main_db.dart' as _i12; import 'package:stackduo/electrumx_rpc/cached_electrumx.dart' as _i10; import 'package:stackduo/electrumx_rpc/electrumx.dart' as _i9; import 'package:stackduo/models/balance.dart' as _i11; import 'package:stackduo/models/isar/models/isar_models.dart' as _i17; import 'package:stackduo/models/paymint/fee_object_model.dart' as _i8; -import 'package:stackduo/models/signing_data.dart' as _i27; -import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart' as _i25; +import 'package:stackduo/models/signing_data.dart' as _i26; +import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart' as _i24; import 'package:stackduo/services/coins/coin_service.dart' as _i19; import 'package:stackduo/services/coins/manager.dart' as _i6; import 'package:stackduo/services/node_service.dart' as _i3; @@ -29,9 +28,9 @@ import 'package:stackduo/services/wallets.dart' as _i20; import 'package:stackduo/services/wallets_service.dart' as _i2; import 'package:stackduo/utilities/amount/amount.dart' as _i14; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i21; -import 'package:stackduo/utilities/enums/derive_path_type_enum.dart' as _i26; +import 'package:stackduo/utilities/enums/derive_path_type_enum.dart' as _i25; import 'package:stackduo/utilities/flutter_secure_storage_interface.dart' - as _i28; + as _i27; import 'package:stackduo/utilities/prefs.dart' as _i23; import 'package:tuple/tuple.dart' as _i15; @@ -415,7 +414,7 @@ class MockWallets extends _i1.Mock implements _i20.Wallets { returnValueForMissingStub: _i22.Future.value(), ) as _i22.Future); @override - void addListener(_i24.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -423,7 +422,7 @@ class MockWallets extends _i1.Mock implements _i20.Wallets { returnValueForMissingStub: null, ); @override - void removeListener(_i24.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -641,7 +640,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: _i22.Future.value(), ) as _i22.Future); @override - void addListener(_i24.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -649,7 +648,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i24.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -677,7 +676,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { /// A class which mocks [BitcoinWallet]. /// /// See the documentation for Mockito's code generation for more information. -class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet { +class MockBitcoinWallet extends _i1.Mock implements _i24.BitcoinWallet { MockBitcoinWallet() { _i1.throwOnMissingStub(this); } @@ -938,15 +937,15 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet { returnValueForMissingStub: _i22.Future.value(), ) as _i22.Future); @override - _i26.DerivePathType addressType({required String? address}) => + _i25.DerivePathType addressType({required String? address}) => (super.noSuchMethod( Invocation.method( #addressType, [], {#address: address}, ), - returnValue: _i26.DerivePathType.bip44, - ) as _i26.DerivePathType); + returnValue: _i25.DerivePathType.bip44, + ) as _i25.DerivePathType); @override _i22.Future recoverFromMnemonic({ required String? mnemonic, @@ -1182,6 +1181,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet { required String? recipientAddress, required bool? coinControl, required bool? isSendAll, + int? satsPerVByte, int? additionalOutputs = 0, List<_i17.UTXO>? utxos, }) => @@ -1194,12 +1194,13 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet { #recipientAddress: recipientAddress, #coinControl: coinControl, #isSendAll: isSendAll, + #satsPerVByte: satsPerVByte, #additionalOutputs: additionalOutputs, #utxos: utxos, }, )); @override - _i22.Future> fetchBuildTxData( + _i22.Future> fetchBuildTxData( List<_i17.UTXO>? utxosToUse) => (super.noSuchMethod( Invocation.method( @@ -1207,11 +1208,11 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet { [utxosToUse], ), returnValue: - _i22.Future>.value(<_i27.SigningData>[]), - ) as _i22.Future>); + _i22.Future>.value(<_i26.SigningData>[]), + ) as _i22.Future>); @override _i22.Future> buildTransaction({ - required List<_i27.SigningData>? utxoSigningData, + required List<_i26.SigningData>? utxoSigningData, required List? recipients, required List? satoshiAmounts, }) => @@ -1480,7 +1481,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet { required _i21.Coin? coin, required _i12.MainDB? db, required _i9.ElectrumX? electrumXClient, - required _i28.SecureStorageInterface? secureStorage, + required _i27.SecureStorageInterface? secureStorage, required int? dustLimit, required int? dustLimitP2PKH, required int? minConfirms, @@ -1500,7 +1501,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet { })? prepareSend, required _i22.Future Function({required String address})? getTxCount, - required _i22.Future> Function(List<_i17.UTXO>)? + required _i22.Future> Function(List<_i17.UTXO>)? fetchBuildTxData, required _i22.Future Function()? refresh, required _i22.Future Function()? checkChangeAddressForTransactions, @@ -1550,7 +1551,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet { )), ) as _i22.Future<_i16.BIP32>); @override - _i22.Future<_i29.Uint8List> getPrivateKeyForPaynymReceivingAddress({ + _i22.Future<_i28.Uint8List> getPrivateKeyForPaynymReceivingAddress({ required String? paymentCodeString, required int? index, }) => @@ -1563,8 +1564,8 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet { #index: index, }, ), - returnValue: _i22.Future<_i29.Uint8List>.value(_i29.Uint8List(0)), - ) as _i22.Future<_i29.Uint8List>); + returnValue: _i22.Future<_i28.Uint8List>.value(_i28.Uint8List(0)), + ) as _i22.Future<_i28.Uint8List>); @override _i22.Future<_i17.Address> currentReceivingPaynymAddress({ required _i18.PaymentCode? sender, @@ -1650,14 +1651,14 @@ class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet { )), ) as _i22.Future<_i18.PaymentCode>); @override - _i22.Future<_i29.Uint8List> signWithNotificationKey(_i29.Uint8List? data) => + _i22.Future<_i28.Uint8List> signWithNotificationKey(_i28.Uint8List? data) => (super.noSuchMethod( Invocation.method( #signWithNotificationKey, [data], ), - returnValue: _i22.Future<_i29.Uint8List>.value(_i29.Uint8List(0)), - ) as _i22.Future<_i29.Uint8List>); + returnValue: _i22.Future<_i28.Uint8List>.value(_i28.Uint8List(0)), + ) as _i22.Future<_i28.Uint8List>); @override _i22.Future signStringWithNotificationKey(String? data) => (super.noSuchMethod( @@ -2074,6 +2075,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -2277,7 +2283,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i22.Future.value(), ) as _i22.Future); @override - void addListener(_i24.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -2285,7 +2291,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i24.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/widget_tests/table_view/table_view_test.dart b/test/widget_tests/table_view/table_view_test.dart index ce77622b23..67813ec5f9 100644 --- a/test/widget_tests/table_view/table_view_test.dart +++ b/test/widget_tests/table_view/table_view_test.dart @@ -1,10 +1,12 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/table_view/table_view.dart'; -import 'package:stackduo/widgets/table_view/table_view_cell.dart'; -import 'package:stackduo/widgets/table_view/table_view_row.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/widgets/table_view/table_view.dart'; +import 'package:stackwallet/widgets/table_view/table_view_cell.dart'; +import 'package:stackwallet/widgets/table_view/table_view_row.dart'; + +import '../../sample_data/theme_json.dart'; void main() { testWidgets("Test create table row widget ", (widgetTester) async { @@ -12,7 +14,11 @@ void main() { MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: Material( diff --git a/test/widget_tests/textfield_icon_button_test.dart b/test/widget_tests/textfield_icon_button_test.dart index 0abf892b19..8ce9400cd8 100644 --- a/test/widget_tests/textfield_icon_button_test.dart +++ b/test/widget_tests/textfield_icon_button_test.dart @@ -1,9 +1,11 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/icon_widgets/x_icon.dart'; -import 'package:stackduo/widgets/textfield_icon_button.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/widgets/icon_widgets/x_icon.dart'; +import 'package:stackwallet/widgets/textfield_icon_button.dart'; + +import '../sample_data/theme_json.dart'; void main() { testWidgets("test", (widgetTester) async { @@ -11,7 +13,11 @@ void main() { MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: const Material( diff --git a/test/widget_tests/trade_card_test.dart b/test/widget_tests/trade_card_test.dart index 8100873041..d42c00b852 100644 --- a/test/widget_tests/trade_card_test.dart +++ b/test/widget_tests/trade_card_test.dart @@ -1,13 +1,28 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:stackduo/models/exchange/response_objects/trade.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/trade_card.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; +import 'package:stackwallet/models/exchange/response_objects/trade.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/themes/theme_service.dart'; +import 'package:stackwallet/widgets/trade_card.dart'; +import '../sample_data/theme_json.dart'; +import 'trade_card_test.mocks.dart'; + +@GenerateMocks([ + ThemeService, +]) void main() { testWidgets("Test Trade card builds", (widgetTester) async { + final mockThemeService = MockThemeService(); + when(mockThemeService.getTheme(themeId: "light")).thenAnswer( + (_) => StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ); final trade = Trade( uuid: "uuid", tradeId: "trade id", @@ -34,12 +49,16 @@ void main() { await widgetTester.pumpWidget( ProviderScope( - overrides: [], + overrides: [ + pThemeService.overrideWithValue(mockThemeService), + ], child: MaterialApp( theme: ThemeData( extensions: [ StackColors.fromStackColorTheme( - LightColors(), + StackTheme.fromJson( + json: lightThemeJsonMap, + ), ), ], ), diff --git a/test/widget_tests/transaction_card_test.dart b/test/widget_tests/transaction_card_test.dart index 9bbd93deef..c4b89fb4af 100644 --- a/test/widget_tests/transaction_card_test.dart +++ b/test/widget_tests/transaction_card_test.dart @@ -1,3 +1,4 @@ +import 'package:decimal/decimal.dart'; import 'package:flutter/material.dart'; import 'package:flutter_feather_icons/flutter_feather_icons.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -5,33 +6,46 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:mockingjay/mockingjay.dart' as mockingjay; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; -import 'package:stackduo/models/isar/models/blockchain_data/address.dart'; -import 'package:stackduo/models/isar/models/blockchain_data/transaction.dart'; -import 'package:stackduo/pages/wallet_view/transaction_views/transaction_details_view.dart'; -import 'package:stackduo/providers/providers.dart'; -import 'package:stackduo/services/coins/coin_service.dart'; -import 'package:stackduo/services/coins/manager.dart'; -import 'package:stackduo/services/locale_service.dart'; -import 'package:stackduo/services/notes_service.dart'; -import 'package:stackduo/services/price_service.dart'; -import 'package:stackduo/services/wallets.dart'; -import 'package:stackduo/utilities/amount/amount.dart'; -import 'package:stackduo/utilities/prefs.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/utilities/util.dart'; -import 'package:stackduo/widgets/transaction_card.dart'; - +import 'package:stackwallet/db/isar/main_db.dart'; +import 'package:stackwallet/models/isar/models/isar_models.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/pages/wallet_view/transaction_views/transaction_details_view.dart'; +import 'package:stackwallet/providers/db/main_db_provider.dart'; +import 'package:stackwallet/providers/global/locale_provider.dart'; +import 'package:stackwallet/providers/global/prefs_provider.dart'; +import 'package:stackwallet/providers/global/price_provider.dart'; +import 'package:stackwallet/providers/global/wallets_provider.dart'; +import 'package:stackwallet/services/coins/coin_service.dart'; +import 'package:stackwallet/services/coins/firo/firo_wallet.dart'; +import 'package:stackwallet/services/coins/manager.dart'; +import 'package:stackwallet/services/locale_service.dart'; +import 'package:stackwallet/services/notes_service.dart'; +import 'package:stackwallet/services/price_service.dart'; +import 'package:stackwallet/services/wallets.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/themes/theme_service.dart'; +import 'package:stackwallet/utilities/amount/amount.dart'; +import 'package:stackwallet/utilities/amount/amount_unit.dart'; +import 'package:stackwallet/utilities/enums/coin_enum.dart'; +import 'package:stackwallet/utilities/prefs.dart'; +import 'package:stackwallet/utilities/util.dart'; +import 'package:stackwallet/widgets/transaction_card.dart'; +import 'package:tuple/tuple.dart'; + +import '../sample_data/theme_json.dart'; import 'transaction_card_test.mocks.dart'; @GenerateMocks([ Wallets, Manager, CoinServiceAPI, + FiroWallet, LocaleService, Prefs, PriceService, - NotesService + NotesService, + ThemeService, + MainDB, ], customMocks: []) void main() { TestWidgetsFlutterBinding.ensureInitialized(); @@ -41,12 +55,18 @@ void main() { final wallets = MockWallets(); final mockPrefs = MockPrefs(); final mockPriceService = MockPriceService(); + final mockThemeService = MockThemeService(); + final mockDB = MockMainDB(); final tx = Transaction( txid: "some txid", timestamp: 1648595998, type: TransactionType.outgoing, amount: 100000000, + amountString: Amount( + rawValue: BigInt.from(100000000), + fractionDigits: Coin.firo.decimals, + ).toJsonString(), fee: 3794, height: 450123, subType: TransactionSubType.none, @@ -55,10 +75,10 @@ void main() { isLelantus: null, slateId: '', otherData: '', + nonce: null, inputs: [], outputs: [], - amountString: Amount.zero.toJsonString(), - nonce: null, + numberOfMessages: null, )..address.value = Address( walletId: "walletId", value: "", @@ -68,10 +88,37 @@ void main() { type: AddressType.p2pkh, subType: AddressSubType.receiving); + final CoinServiceAPI wallet = MockFiroWallet(); + + when(mockThemeService.getTheme(themeId: "light")).thenAnswer( + (_) => StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ); + when(wallet.coin.ticker).thenAnswer((_) => "FIRO"); when(mockLocaleService.locale).thenAnswer((_) => "en_US"); when(mockPrefs.currency).thenAnswer((_) => "USD"); when(mockPrefs.externalCalls).thenAnswer((_) => true); + when(mockPriceService.getPrice(Coin.firo)) + .thenAnswer((realInvocation) => Tuple2(Decimal.ten, 0.00)); + + when(wallet.coin).thenAnswer((_) => Coin.firo); + when(wallets.getManager("wallet-id")) + .thenAnswer((realInvocation) => Manager(wallet)); + + when(wallet.storedChainHeight).thenAnswer((_) => 6000000); + + when(mockPrefs.amountUnit(Coin.firo)).thenAnswer( + (_) => AmountUnit.normal, + ); + when(mockPrefs.maxDecimals(Coin.firo)).thenAnswer( + (_) => 8, + ); + + when(mockDB.getEthContractSync("")).thenAnswer( + (_) => null, + ); // await tester.pumpWidget( ProviderScope( @@ -79,14 +126,18 @@ void main() { walletsChangeNotifierProvider.overrideWithValue(wallets), localeServiceChangeNotifierProvider .overrideWithValue(mockLocaleService), + pThemeService.overrideWithValue(mockThemeService), prefsChangeNotifierProvider.overrideWithValue(mockPrefs), - priceAnd24hChangeNotifierProvider.overrideWithValue(mockPriceService) + priceAnd24hChangeNotifierProvider.overrideWithValue(mockPriceService), + mainDBProvider.overrideWithValue(mockDB), ], child: MaterialApp( theme: ThemeData( extensions: [ StackColors.fromStackColorTheme( - LightColors(), + StackTheme.fromJson( + json: lightThemeJsonMap, + ), ), ], ), @@ -118,8 +169,10 @@ void main() { verify(mockLocaleService.addListener(any)).called(1); verify(mockPrefs.currency).called(1); + verify(mockPriceService.getPrice(Coin.firo)).called(1); + verify(wallet.coin.ticker).called(1); - verify(mockLocaleService.locale).called(1); + verify(mockLocaleService.locale).called(2); verifyNoMoreInteractions(mockManager); verifyNoMoreInteractions(mockLocaleService); @@ -131,12 +184,18 @@ void main() { final wallets = MockWallets(); final mockPrefs = MockPrefs(); final mockPriceService = MockPriceService(); + final mockThemeService = MockThemeService(); + final mockDB = MockMainDB(); final tx = Transaction( txid: "some txid", timestamp: 1648595998, type: TransactionType.outgoing, amount: 9659, + amountString: Amount( + rawValue: BigInt.from(9659), + fractionDigits: Coin.firo.decimals, + ).toJsonString(), fee: 3794, height: 450123, subType: TransactionSubType.mint, @@ -145,10 +204,10 @@ void main() { isLelantus: null, slateId: '', otherData: '', + nonce: null, inputs: [], outputs: [], - amountString: Amount.zero.toJsonString(), - nonce: null, + numberOfMessages: null, )..address.value = Address( walletId: "walletId", value: "", @@ -158,10 +217,36 @@ void main() { type: AddressType.p2pkh, subType: AddressSubType.receiving); + final CoinServiceAPI wallet = MockFiroWallet(); + + when(mockThemeService.getTheme(themeId: "light")).thenAnswer( + (_) => StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ); + when(wallet.coin.ticker).thenAnswer((_) => "FIRO"); when(mockLocaleService.locale).thenAnswer((_) => "en_US"); when(mockPrefs.currency).thenAnswer((_) => "USD"); when(mockPrefs.externalCalls).thenAnswer((_) => true); + when(mockPriceService.getPrice(Coin.firo)) + .thenAnswer((realInvocation) => Tuple2(Decimal.ten, 0.00)); + + when(wallet.coin).thenAnswer((_) => Coin.firo); + when(wallet.storedChainHeight).thenAnswer((_) => 6000000); + when(mockPrefs.amountUnit(Coin.firo)).thenAnswer( + (_) => AmountUnit.normal, + ); + when(mockPrefs.maxDecimals(Coin.firo)).thenAnswer( + (_) => 8, + ); + + when(mockDB.getEthContractSync("")).thenAnswer( + (_) => null, + ); + + when(wallets.getManager("wallet-id")) + .thenAnswer((realInvocation) => Manager(wallet)); // await tester.pumpWidget( ProviderScope( @@ -170,13 +255,17 @@ void main() { localeServiceChangeNotifierProvider .overrideWithValue(mockLocaleService), prefsChangeNotifierProvider.overrideWithValue(mockPrefs), + pThemeService.overrideWithValue(mockThemeService), + mainDBProvider.overrideWithValue(mockDB), priceAnd24hChangeNotifierProvider.overrideWithValue(mockPriceService) ], child: MaterialApp( theme: ThemeData( extensions: [ StackColors.fromStackColorTheme( - LightColors(), + StackTheme.fromJson( + json: lightThemeJsonMap, + ), ), ], ), @@ -206,8 +295,10 @@ void main() { verify(mockLocaleService.addListener(any)).called(1); verify(mockPrefs.currency).called(1); + verify(mockPriceService.getPrice(Coin.firo)).called(1); + verify(wallet.coin.ticker).called(1); - verify(mockLocaleService.locale).called(1); + verify(mockLocaleService.locale).called(2); verifyNoMoreInteractions(mockManager); verifyNoMoreInteractions(mockLocaleService); @@ -219,12 +310,18 @@ void main() { final wallets = MockWallets(); final mockPrefs = MockPrefs(); final mockPriceService = MockPriceService(); + final mockThemeService = MockThemeService(); + final mockDB = MockMainDB(); final tx = Transaction( txid: "some txid", timestamp: 1648595998, type: TransactionType.incoming, amount: 100000000, + amountString: Amount( + rawValue: BigInt.from(100000000), + fractionDigits: Coin.firo.decimals, + ).toJsonString(), fee: 3794, height: 450123, subType: TransactionSubType.none, @@ -233,10 +330,10 @@ void main() { isLelantus: null, slateId: '', otherData: '', + nonce: null, inputs: [], outputs: [], - amountString: Amount.zero.toJsonString(), - nonce: null, + numberOfMessages: null, )..address.value = Address( walletId: "walletId", value: "", @@ -246,9 +343,37 @@ void main() { type: AddressType.p2pkh, subType: AddressSubType.receiving); + final CoinServiceAPI wallet = MockFiroWallet(); + + when(mockThemeService.getTheme(themeId: "light")).thenAnswer( + (_) => StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ); + when(wallet.coin.ticker).thenAnswer((_) => "FIRO"); when(mockLocaleService.locale).thenAnswer((_) => "en_US"); when(mockPrefs.currency).thenAnswer((_) => "USD"); when(mockPrefs.externalCalls).thenAnswer((_) => true); + when(mockPriceService.getPrice(Coin.firo)) + .thenAnswer((realInvocation) => Tuple2(Decimal.ten, 0.00)); + + when(wallet.coin).thenAnswer((_) => Coin.firo); + + when(wallets.getManager("wallet-id")) + .thenAnswer((realInvocation) => Manager(wallet)); + + when(wallet.storedChainHeight).thenAnswer((_) => 6000000); + + when(mockPrefs.amountUnit(Coin.firo)).thenAnswer( + (_) => AmountUnit.normal, + ); + when(mockPrefs.maxDecimals(Coin.firo)).thenAnswer( + (_) => 8, + ); + + when(mockDB.getEthContractSync("")).thenAnswer( + (_) => null, + ); await tester.pumpWidget( ProviderScope( @@ -257,13 +382,17 @@ void main() { localeServiceChangeNotifierProvider .overrideWithValue(mockLocaleService), prefsChangeNotifierProvider.overrideWithValue(mockPrefs), + pThemeService.overrideWithValue(mockThemeService), + mainDBProvider.overrideWithValue(mockDB), priceAnd24hChangeNotifierProvider.overrideWithValue(mockPriceService) ], child: MaterialApp( theme: ThemeData( extensions: [ StackColors.fromStackColorTheme( - LightColors(), + StackTheme.fromJson( + json: lightThemeJsonMap, + ), ), ], ), @@ -285,8 +414,10 @@ void main() { verify(mockLocaleService.addListener(any)).called(1); verify(mockPrefs.currency).called(1); + verify(mockPriceService.getPrice(Coin.firo)).called(1); + verify(wallet.coin.ticker).called(1); - verify(mockLocaleService.locale).called(1); + verify(mockLocaleService.locale).called(2); verifyNoMoreInteractions(mockManager); verifyNoMoreInteractions(mockLocaleService); @@ -298,6 +429,8 @@ void main() { final wallets = MockWallets(); final mockPrefs = MockPrefs(); final mockPriceService = MockPriceService(); + final mockThemeService = MockThemeService(); + final mockDB = MockMainDB(); final navigator = mockingjay.MockNavigator(); final tx = Transaction( @@ -305,6 +438,10 @@ void main() { timestamp: 1648595998, type: TransactionType.outgoing, amount: 100000000, + amountString: Amount( + rawValue: BigInt.from(100000000), + fractionDigits: Coin.firo.decimals, + ).toJsonString(), fee: 3794, height: 450123, subType: TransactionSubType.none, @@ -313,10 +450,10 @@ void main() { isLelantus: null, slateId: '', otherData: '', + nonce: null, inputs: [], outputs: [], - amountString: Amount.zero.toJsonString(), - nonce: null, + numberOfMessages: null, )..address.value = Address( walletId: "walletId", value: "", @@ -326,9 +463,42 @@ void main() { type: AddressType.p2pkh, subType: AddressSubType.receiving); + final CoinServiceAPI wallet = MockFiroWallet(); + + when(mockThemeService.getTheme(themeId: "light")).thenAnswer( + (_) => StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ); + when(wallet.coin.ticker).thenAnswer((_) => "FIRO"); when(mockLocaleService.locale).thenAnswer((_) => "en_US"); when(mockPrefs.currency).thenAnswer((_) => "USD"); when(mockPrefs.externalCalls).thenAnswer((_) => true); + when(mockPriceService.getPrice(Coin.firo)) + .thenAnswer((realInvocation) => Tuple2(Decimal.ten, 0.00)); + + when(wallet.coin).thenAnswer((_) => Coin.firo); + + when(wallets.getManager("wallet id")) + .thenAnswer((realInvocation) => Manager(wallet)); + + when(wallet.storedChainHeight).thenAnswer((_) => 6000000); + + mockingjay + .when(() => navigator.pushNamed("/transactionDetails", + arguments: Tuple3(tx, Coin.firo, "wallet id"))) + .thenAnswer((_) async => {}); + + when(mockPrefs.amountUnit(Coin.firo)).thenAnswer( + (_) => AmountUnit.normal, + ); + when(mockPrefs.maxDecimals(Coin.firo)).thenAnswer( + (_) => 8, + ); + + when(mockDB.getEthContractSync("")).thenAnswer( + (_) => null, + ); await tester.pumpWidget( ProviderScope( @@ -337,12 +507,18 @@ void main() { localeServiceChangeNotifierProvider .overrideWithValue(mockLocaleService), prefsChangeNotifierProvider.overrideWithValue(mockPrefs), + pThemeService.overrideWithValue(mockThemeService), + mainDBProvider.overrideWithValue(mockDB), priceAnd24hChangeNotifierProvider.overrideWithValue(mockPriceService) ], child: MaterialApp( theme: ThemeData( extensions: [ - StackColors.fromStackColorTheme(LightColors()), + StackColors.fromStackColorTheme( + StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ), ], ), home: mockingjay.MockNavigatorProvider( @@ -360,17 +536,20 @@ void main() { verify(mockLocaleService.addListener(any)).called(1); verify(mockPrefs.currency).called(2); - verify(mockLocaleService.locale).called(4); + verify(mockLocaleService.locale).called(3); + verify(wallet.coin.ticker).called(1); + verify(wallet.storedChainHeight).called(2); + verifyNoMoreInteractions(wallet); verifyNoMoreInteractions(mockLocaleService); if (Util.isDesktop) { expect(find.byType(TransactionDetailsView), findsOneWidget); } else { - // mockingjay - // .verify(() => navigator.pushNamed("/transactionDetails", - // arguments: Tuple3(tx, Coin.firo, "wallet id"))) - // .called(1); + mockingjay + .verify(() => navigator.pushNamed("/transactionDetails", + arguments: Tuple3(tx, Coin.firo, "wallet id"))) + .called(1); } }); } diff --git a/test/widget_tests/transaction_card_test.mocks.dart b/test/widget_tests/transaction_card_test.mocks.dart deleted file mode 100644 index 5e7fa925d3..0000000000 --- a/test/widget_tests/transaction_card_test.mocks.dart +++ /dev/null @@ -1,1754 +0,0 @@ -// Mocks generated by Mockito 5.3.2 from annotations -// in stackduo/test/widget_tests/transaction_card_test.dart. -// Do not manually edit this file. - -// ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i14; -import 'dart:ui' as _i16; - -import 'package:decimal/decimal.dart' as _i22; -import 'package:flutter/foundation.dart' as _i4; -import 'package:flutter_riverpod/flutter_riverpod.dart' as _i5; -import 'package:mockito/mockito.dart' as _i1; -import 'package:stackduo/models/balance.dart' as _i9; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i17; -import 'package:stackduo/models/models.dart' as _i8; -import 'package:stackduo/services/coins/coin_service.dart' as _i7; -import 'package:stackduo/services/coins/manager.dart' as _i6; -import 'package:stackduo/services/locale_service.dart' as _i18; -import 'package:stackduo/services/node_service.dart' as _i3; -import 'package:stackduo/services/notes_service.dart' as _i23; -import 'package:stackduo/services/price_service.dart' as _i21; -import 'package:stackduo/services/wallets.dart' as _i12; -import 'package:stackduo/services/wallets_service.dart' as _i2; -import 'package:stackduo/utilities/amount/amount.dart' as _i10; -import 'package:stackduo/utilities/enums/backup_frequency_type.dart' as _i20; -import 'package:stackduo/utilities/enums/coin_enum.dart' as _i13; -import 'package:stackduo/utilities/enums/sync_type_enum.dart' as _i19; -import 'package:stackduo/utilities/prefs.dart' as _i15; -import 'package:tuple/tuple.dart' as _i11; - -// ignore_for_file: type=lint -// ignore_for_file: avoid_redundant_argument_values -// ignore_for_file: avoid_setters_without_getters -// ignore_for_file: comment_references -// ignore_for_file: implementation_imports -// ignore_for_file: invalid_use_of_visible_for_testing_member -// ignore_for_file: prefer_const_constructors -// ignore_for_file: unnecessary_parenthesis -// ignore_for_file: camel_case_types -// ignore_for_file: subtype_of_sealed_class - -class _FakeWalletsService_0 extends _i1.SmartFake - implements _i2.WalletsService { - _FakeWalletsService_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeNodeService_1 extends _i1.SmartFake implements _i3.NodeService { - _FakeNodeService_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeChangeNotifierProvider_2 - extends _i1.SmartFake implements _i5.ChangeNotifierProvider { - _FakeChangeNotifierProvider_2( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeManager_3 extends _i1.SmartFake implements _i6.Manager { - _FakeManager_3( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeCoinServiceAPI_4 extends _i1.SmartFake - implements _i7.CoinServiceAPI { - _FakeCoinServiceAPI_4( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeFeeObject_5 extends _i1.SmartFake implements _i8.FeeObject { - _FakeFeeObject_5( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeBalance_6 extends _i1.SmartFake implements _i9.Balance { - _FakeBalance_6( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeAmount_7 extends _i1.SmartFake implements _i10.Amount { - _FakeAmount_7( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeDuration_8 extends _i1.SmartFake implements Duration { - _FakeDuration_8( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeTuple2_9 extends _i1.SmartFake - implements _i11.Tuple2 { - _FakeTuple2_9( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -/// A class which mocks [Wallets]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockWallets extends _i1.Mock implements _i12.Wallets { - MockWallets() { - _i1.throwOnMissingStub(this); - } - - @override - _i2.WalletsService get walletsService => (super.noSuchMethod( - Invocation.getter(#walletsService), - returnValue: _FakeWalletsService_0( - this, - Invocation.getter(#walletsService), - ), - ) as _i2.WalletsService); - @override - set walletsService(_i2.WalletsService? _walletsService) => super.noSuchMethod( - Invocation.setter( - #walletsService, - _walletsService, - ), - returnValueForMissingStub: null, - ); - @override - _i3.NodeService get nodeService => (super.noSuchMethod( - Invocation.getter(#nodeService), - returnValue: _FakeNodeService_1( - this, - Invocation.getter(#nodeService), - ), - ) as _i3.NodeService); - @override - set nodeService(_i3.NodeService? _nodeService) => super.noSuchMethod( - Invocation.setter( - #nodeService, - _nodeService, - ), - returnValueForMissingStub: null, - ); - @override - bool get hasWallets => (super.noSuchMethod( - Invocation.getter(#hasWallets), - returnValue: false, - ) as bool); - @override - List<_i5.ChangeNotifierProvider<_i6.Manager>> get managerProviders => - (super.noSuchMethod( - Invocation.getter(#managerProviders), - returnValue: <_i5.ChangeNotifierProvider<_i6.Manager>>[], - ) as List<_i5.ChangeNotifierProvider<_i6.Manager>>); - @override - List<_i6.Manager> get managers => (super.noSuchMethod( - Invocation.getter(#managers), - returnValue: <_i6.Manager>[], - ) as List<_i6.Manager>); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - List getWalletIdsFor({required _i13.Coin? coin}) => - (super.noSuchMethod( - Invocation.method( - #getWalletIdsFor, - [], - {#coin: coin}, - ), - returnValue: [], - ) as List); - @override - List<_i11.Tuple2<_i13.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>> - getManagerProvidersByCoin() => (super.noSuchMethod( - Invocation.method( - #getManagerProvidersByCoin, - [], - ), - returnValue: < - _i11.Tuple2<_i13.Coin, - List<_i5.ChangeNotifierProvider<_i6.Manager>>>>[], - ) as List< - _i11.Tuple2<_i13.Coin, - List<_i5.ChangeNotifierProvider<_i6.Manager>>>>); - @override - List<_i5.ChangeNotifierProvider<_i6.Manager>> getManagerProvidersForCoin( - _i13.Coin? coin) => - (super.noSuchMethod( - Invocation.method( - #getManagerProvidersForCoin, - [coin], - ), - returnValue: <_i5.ChangeNotifierProvider<_i6.Manager>>[], - ) as List<_i5.ChangeNotifierProvider<_i6.Manager>>); - @override - _i5.ChangeNotifierProvider<_i6.Manager> getManagerProvider( - String? walletId) => - (super.noSuchMethod( - Invocation.method( - #getManagerProvider, - [walletId], - ), - returnValue: _FakeChangeNotifierProvider_2<_i6.Manager>( - this, - Invocation.method( - #getManagerProvider, - [walletId], - ), - ), - ) as _i5.ChangeNotifierProvider<_i6.Manager>); - @override - _i6.Manager getManager(String? walletId) => (super.noSuchMethod( - Invocation.method( - #getManager, - [walletId], - ), - returnValue: _FakeManager_3( - this, - Invocation.method( - #getManager, - [walletId], - ), - ), - ) as _i6.Manager); - @override - void addWallet({ - required String? walletId, - required _i6.Manager? manager, - }) => - super.noSuchMethod( - Invocation.method( - #addWallet, - [], - { - #walletId: walletId, - #manager: manager, - }, - ), - returnValueForMissingStub: null, - ); - @override - void removeWallet({required String? walletId}) => super.noSuchMethod( - Invocation.method( - #removeWallet, - [], - {#walletId: walletId}, - ), - returnValueForMissingStub: null, - ); - @override - _i14.Future load(_i15.Prefs? prefs) => (super.noSuchMethod( - Invocation.method( - #load, - [prefs], - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - _i14.Future loadAfterStackRestore( - _i15.Prefs? prefs, - List<_i6.Manager>? managers, - ) => - (super.noSuchMethod( - Invocation.method( - #loadAfterStackRestore, - [ - prefs, - managers, - ], - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [Manager]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i6.Manager { - MockManager() { - _i1.throwOnMissingStub(this); - } - - @override - bool get isActiveWallet => (super.noSuchMethod( - Invocation.getter(#isActiveWallet), - returnValue: false, - ) as bool); - @override - set isActiveWallet(bool? isActive) => super.noSuchMethod( - Invocation.setter( - #isActiveWallet, - isActive, - ), - returnValueForMissingStub: null, - ); - @override - _i7.CoinServiceAPI get wallet => (super.noSuchMethod( - Invocation.getter(#wallet), - returnValue: _FakeCoinServiceAPI_4( - this, - Invocation.getter(#wallet), - ), - ) as _i7.CoinServiceAPI); - @override - bool get hasBackgroundRefreshListener => (super.noSuchMethod( - Invocation.getter(#hasBackgroundRefreshListener), - returnValue: false, - ) as bool); - @override - _i13.Coin get coin => (super.noSuchMethod( - Invocation.getter(#coin), - returnValue: _i13.Coin.bitcoin, - ) as _i13.Coin); - @override - bool get isRefreshing => (super.noSuchMethod( - Invocation.getter(#isRefreshing), - returnValue: false, - ) as bool); - @override - bool get shouldAutoSync => (super.noSuchMethod( - Invocation.getter(#shouldAutoSync), - returnValue: false, - ) as bool); - @override - set shouldAutoSync(bool? shouldAutoSync) => super.noSuchMethod( - Invocation.setter( - #shouldAutoSync, - shouldAutoSync, - ), - returnValueForMissingStub: null, - ); - @override - bool get isFavorite => (super.noSuchMethod( - Invocation.getter(#isFavorite), - returnValue: false, - ) as bool); - @override - set isFavorite(bool? markFavorite) => super.noSuchMethod( - Invocation.setter( - #isFavorite, - markFavorite, - ), - returnValueForMissingStub: null, - ); - @override - _i14.Future<_i8.FeeObject> get fees => (super.noSuchMethod( - Invocation.getter(#fees), - returnValue: _i14.Future<_i8.FeeObject>.value(_FakeFeeObject_5( - this, - Invocation.getter(#fees), - )), - ) as _i14.Future<_i8.FeeObject>); - @override - _i14.Future get maxFee => (super.noSuchMethod( - Invocation.getter(#maxFee), - returnValue: _i14.Future.value(0), - ) as _i14.Future); - @override - _i14.Future get currentReceivingAddress => (super.noSuchMethod( - Invocation.getter(#currentReceivingAddress), - returnValue: _i14.Future.value(''), - ) as _i14.Future); - @override - _i9.Balance get balance => (super.noSuchMethod( - Invocation.getter(#balance), - returnValue: _FakeBalance_6( - this, - Invocation.getter(#balance), - ), - ) as _i9.Balance); - @override - _i14.Future> get transactions => (super.noSuchMethod( - Invocation.getter(#transactions), - returnValue: - _i14.Future>.value(<_i17.Transaction>[]), - ) as _i14.Future>); - @override - _i14.Future> get utxos => (super.noSuchMethod( - Invocation.getter(#utxos), - returnValue: _i14.Future>.value(<_i17.UTXO>[]), - ) as _i14.Future>); - @override - set walletName(String? newName) => super.noSuchMethod( - Invocation.setter( - #walletName, - newName, - ), - returnValueForMissingStub: null, - ); - @override - String get walletName => (super.noSuchMethod( - Invocation.getter(#walletName), - returnValue: '', - ) as String); - @override - String get walletId => (super.noSuchMethod( - Invocation.getter(#walletId), - returnValue: '', - ) as String); - @override - _i14.Future> get mnemonic => (super.noSuchMethod( - Invocation.getter(#mnemonic), - returnValue: _i14.Future>.value([]), - ) as _i14.Future>); - @override - _i14.Future get mnemonicPassphrase => (super.noSuchMethod( - Invocation.getter(#mnemonicPassphrase), - returnValue: _i14.Future.value(), - ) as _i14.Future); - @override - bool get isConnected => (super.noSuchMethod( - Invocation.getter(#isConnected), - returnValue: false, - ) as bool); - @override - int get currentHeight => (super.noSuchMethod( - Invocation.getter(#currentHeight), - returnValue: 0, - ) as int); - @override - bool get hasPaynymSupport => (super.noSuchMethod( - Invocation.getter(#hasPaynymSupport), - returnValue: false, - ) as bool); - @override - bool get hasCoinControlSupport => (super.noSuchMethod( - Invocation.getter(#hasCoinControlSupport), - returnValue: false, - ) as bool); - @override - bool get hasWhirlpoolSupport => (super.noSuchMethod( - Invocation.getter(#hasWhirlpoolSupport), - returnValue: false, - ) as bool); - @override - int get rescanOnOpenVersion => (super.noSuchMethod( - Invocation.getter(#rescanOnOpenVersion), - returnValue: 0, - ) as int); - @override - bool get hasXPub => (super.noSuchMethod( - Invocation.getter(#hasXPub), - returnValue: false, - ) as bool); - @override - _i14.Future get xpub => (super.noSuchMethod( - Invocation.getter(#xpub), - returnValue: _i14.Future.value(''), - ) as _i14.Future); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - _i14.Future updateNode(bool? shouldRefresh) => (super.noSuchMethod( - Invocation.method( - #updateNode, - [shouldRefresh], - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - _i14.Future> prepareSend({ - required String? address, - required _i10.Amount? amount, - Map? args, - }) => - (super.noSuchMethod( - Invocation.method( - #prepareSend, - [], - { - #address: address, - #amount: amount, - #args: args, - }, - ), - returnValue: - _i14.Future>.value({}), - ) as _i14.Future>); - @override - _i14.Future confirmSend({required Map? txData}) => - (super.noSuchMethod( - Invocation.method( - #confirmSend, - [], - {#txData: txData}, - ), - returnValue: _i14.Future.value(''), - ) as _i14.Future); - @override - _i14.Future refresh() => (super.noSuchMethod( - Invocation.method( - #refresh, - [], - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - bool validateAddress(String? address) => (super.noSuchMethod( - Invocation.method( - #validateAddress, - [address], - ), - returnValue: false, - ) as bool); - @override - _i14.Future testNetworkConnection() => (super.noSuchMethod( - Invocation.method( - #testNetworkConnection, - [], - ), - returnValue: _i14.Future.value(false), - ) as _i14.Future); - @override - _i14.Future initializeNew() => (super.noSuchMethod( - Invocation.method( - #initializeNew, - [], - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - _i14.Future initializeExisting() => (super.noSuchMethod( - Invocation.method( - #initializeExisting, - [], - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - _i14.Future recoverFromMnemonic({ - required String? mnemonic, - String? mnemonicPassphrase, - required int? maxUnusedAddressGap, - required int? maxNumberOfIndexesToCheck, - required int? height, - }) => - (super.noSuchMethod( - Invocation.method( - #recoverFromMnemonic, - [], - { - #mnemonic: mnemonic, - #mnemonicPassphrase: mnemonicPassphrase, - #maxUnusedAddressGap: maxUnusedAddressGap, - #maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, - #height: height, - }, - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - _i14.Future exitCurrentWallet() => (super.noSuchMethod( - Invocation.method( - #exitCurrentWallet, - [], - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - _i14.Future fullRescan( - int? maxUnusedAddressGap, - int? maxNumberOfIndexesToCheck, - ) => - (super.noSuchMethod( - Invocation.method( - #fullRescan, - [ - maxUnusedAddressGap, - maxNumberOfIndexesToCheck, - ], - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - _i14.Future<_i10.Amount> estimateFeeFor( - _i10.Amount? amount, - int? feeRate, - ) => - (super.noSuchMethod( - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - returnValue: _i14.Future<_i10.Amount>.value(_FakeAmount_7( - this, - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - )), - ) as _i14.Future<_i10.Amount>); - @override - _i14.Future generateNewAddress() => (super.noSuchMethod( - Invocation.method( - #generateNewAddress, - [], - ), - returnValue: _i14.Future.value(false), - ) as _i14.Future); - @override - _i14.Future resetRescanOnOpen() => (super.noSuchMethod( - Invocation.method( - #resetRescanOnOpen, - [], - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [CoinServiceAPI]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockCoinServiceAPI extends _i1.Mock implements _i7.CoinServiceAPI { - MockCoinServiceAPI() { - _i1.throwOnMissingStub(this); - } - - @override - set onIsActiveWalletChanged(void Function(bool)? _onIsActiveWalletChanged) => - super.noSuchMethod( - Invocation.setter( - #onIsActiveWalletChanged, - _onIsActiveWalletChanged, - ), - returnValueForMissingStub: null, - ); - @override - _i13.Coin get coin => (super.noSuchMethod( - Invocation.getter(#coin), - returnValue: _i13.Coin.bitcoin, - ) as _i13.Coin); - @override - bool get isRefreshing => (super.noSuchMethod( - Invocation.getter(#isRefreshing), - returnValue: false, - ) as bool); - @override - bool get shouldAutoSync => (super.noSuchMethod( - Invocation.getter(#shouldAutoSync), - returnValue: false, - ) as bool); - @override - set shouldAutoSync(bool? shouldAutoSync) => super.noSuchMethod( - Invocation.setter( - #shouldAutoSync, - shouldAutoSync, - ), - returnValueForMissingStub: null, - ); - @override - bool get isFavorite => (super.noSuchMethod( - Invocation.getter(#isFavorite), - returnValue: false, - ) as bool); - @override - set isFavorite(bool? markFavorite) => super.noSuchMethod( - Invocation.setter( - #isFavorite, - markFavorite, - ), - returnValueForMissingStub: null, - ); - @override - _i14.Future<_i8.FeeObject> get fees => (super.noSuchMethod( - Invocation.getter(#fees), - returnValue: _i14.Future<_i8.FeeObject>.value(_FakeFeeObject_5( - this, - Invocation.getter(#fees), - )), - ) as _i14.Future<_i8.FeeObject>); - @override - _i14.Future get maxFee => (super.noSuchMethod( - Invocation.getter(#maxFee), - returnValue: _i14.Future.value(0), - ) as _i14.Future); - @override - _i14.Future get currentReceivingAddress => (super.noSuchMethod( - Invocation.getter(#currentReceivingAddress), - returnValue: _i14.Future.value(''), - ) as _i14.Future); - @override - _i9.Balance get balance => (super.noSuchMethod( - Invocation.getter(#balance), - returnValue: _FakeBalance_6( - this, - Invocation.getter(#balance), - ), - ) as _i9.Balance); - @override - _i14.Future> get transactions => (super.noSuchMethod( - Invocation.getter(#transactions), - returnValue: - _i14.Future>.value(<_i17.Transaction>[]), - ) as _i14.Future>); - @override - _i14.Future> get utxos => (super.noSuchMethod( - Invocation.getter(#utxos), - returnValue: _i14.Future>.value(<_i17.UTXO>[]), - ) as _i14.Future>); - @override - set walletName(String? newName) => super.noSuchMethod( - Invocation.setter( - #walletName, - newName, - ), - returnValueForMissingStub: null, - ); - @override - String get walletName => (super.noSuchMethod( - Invocation.getter(#walletName), - returnValue: '', - ) as String); - @override - String get walletId => (super.noSuchMethod( - Invocation.getter(#walletId), - returnValue: '', - ) as String); - @override - _i14.Future> get mnemonic => (super.noSuchMethod( - Invocation.getter(#mnemonic), - returnValue: _i14.Future>.value([]), - ) as _i14.Future>); - @override - _i14.Future get mnemonicString => (super.noSuchMethod( - Invocation.getter(#mnemonicString), - returnValue: _i14.Future.value(), - ) as _i14.Future); - @override - _i14.Future get mnemonicPassphrase => (super.noSuchMethod( - Invocation.getter(#mnemonicPassphrase), - returnValue: _i14.Future.value(), - ) as _i14.Future); - @override - bool get hasCalledExit => (super.noSuchMethod( - Invocation.getter(#hasCalledExit), - returnValue: false, - ) as bool); - @override - bool get isConnected => (super.noSuchMethod( - Invocation.getter(#isConnected), - returnValue: false, - ) as bool); - @override - int get storedChainHeight => (super.noSuchMethod( - Invocation.getter(#storedChainHeight), - returnValue: 0, - ) as int); - @override - _i14.Future> prepareSend({ - required String? address, - required _i10.Amount? amount, - Map? args, - }) => - (super.noSuchMethod( - Invocation.method( - #prepareSend, - [], - { - #address: address, - #amount: amount, - #args: args, - }, - ), - returnValue: - _i14.Future>.value({}), - ) as _i14.Future>); - @override - _i14.Future confirmSend({required Map? txData}) => - (super.noSuchMethod( - Invocation.method( - #confirmSend, - [], - {#txData: txData}, - ), - returnValue: _i14.Future.value(''), - ) as _i14.Future); - @override - _i14.Future refresh() => (super.noSuchMethod( - Invocation.method( - #refresh, - [], - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - _i14.Future updateNode(bool? shouldRefresh) => (super.noSuchMethod( - Invocation.method( - #updateNode, - [shouldRefresh], - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - bool validateAddress(String? address) => (super.noSuchMethod( - Invocation.method( - #validateAddress, - [address], - ), - returnValue: false, - ) as bool); - @override - _i14.Future testNetworkConnection() => (super.noSuchMethod( - Invocation.method( - #testNetworkConnection, - [], - ), - returnValue: _i14.Future.value(false), - ) as _i14.Future); - @override - _i14.Future recoverFromMnemonic({ - required String? mnemonic, - String? mnemonicPassphrase, - required int? maxUnusedAddressGap, - required int? maxNumberOfIndexesToCheck, - required int? height, - }) => - (super.noSuchMethod( - Invocation.method( - #recoverFromMnemonic, - [], - { - #mnemonic: mnemonic, - #mnemonicPassphrase: mnemonicPassphrase, - #maxUnusedAddressGap: maxUnusedAddressGap, - #maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, - #height: height, - }, - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - _i14.Future initializeNew() => (super.noSuchMethod( - Invocation.method( - #initializeNew, - [], - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - _i14.Future initializeExisting() => (super.noSuchMethod( - Invocation.method( - #initializeExisting, - [], - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - _i14.Future exit() => (super.noSuchMethod( - Invocation.method( - #exit, - [], - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - _i14.Future fullRescan( - int? maxUnusedAddressGap, - int? maxNumberOfIndexesToCheck, - ) => - (super.noSuchMethod( - Invocation.method( - #fullRescan, - [ - maxUnusedAddressGap, - maxNumberOfIndexesToCheck, - ], - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - _i14.Future<_i10.Amount> estimateFeeFor( - _i10.Amount? amount, - int? feeRate, - ) => - (super.noSuchMethod( - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - returnValue: _i14.Future<_i10.Amount>.value(_FakeAmount_7( - this, - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - )), - ) as _i14.Future<_i10.Amount>); - @override - _i14.Future generateNewAddress() => (super.noSuchMethod( - Invocation.method( - #generateNewAddress, - [], - ), - returnValue: _i14.Future.value(false), - ) as _i14.Future); - @override - _i14.Future updateSentCachedTxData(Map? txData) => - (super.noSuchMethod( - Invocation.method( - #updateSentCachedTxData, - [txData], - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); -} - -/// A class which mocks [LocaleService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockLocaleService extends _i1.Mock implements _i18.LocaleService { - MockLocaleService() { - _i1.throwOnMissingStub(this); - } - - @override - String get locale => (super.noSuchMethod( - Invocation.getter(#locale), - returnValue: '', - ) as String); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - _i14.Future loadLocale({bool? notify = true}) => (super.noSuchMethod( - Invocation.method( - #loadLocale, - [], - {#notify: notify}, - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [Prefs]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockPrefs extends _i1.Mock implements _i15.Prefs { - MockPrefs() { - _i1.throwOnMissingStub(this); - } - - @override - bool get isInitialized => (super.noSuchMethod( - Invocation.getter(#isInitialized), - returnValue: false, - ) as bool); - @override - int get lastUnlockedTimeout => (super.noSuchMethod( - Invocation.getter(#lastUnlockedTimeout), - returnValue: 0, - ) as int); - @override - set lastUnlockedTimeout(int? lastUnlockedTimeout) => super.noSuchMethod( - Invocation.setter( - #lastUnlockedTimeout, - lastUnlockedTimeout, - ), - returnValueForMissingStub: null, - ); - @override - int get lastUnlocked => (super.noSuchMethod( - Invocation.getter(#lastUnlocked), - returnValue: 0, - ) as int); - @override - set lastUnlocked(int? lastUnlocked) => super.noSuchMethod( - Invocation.setter( - #lastUnlocked, - lastUnlocked, - ), - returnValueForMissingStub: null, - ); - @override - int get currentNotificationId => (super.noSuchMethod( - Invocation.getter(#currentNotificationId), - returnValue: 0, - ) as int); - @override - List get walletIdsSyncOnStartup => (super.noSuchMethod( - Invocation.getter(#walletIdsSyncOnStartup), - returnValue: [], - ) as List); - @override - set walletIdsSyncOnStartup(List? walletIdsSyncOnStartup) => - super.noSuchMethod( - Invocation.setter( - #walletIdsSyncOnStartup, - walletIdsSyncOnStartup, - ), - returnValueForMissingStub: null, - ); - @override - _i19.SyncingType get syncType => (super.noSuchMethod( - Invocation.getter(#syncType), - returnValue: _i19.SyncingType.currentWalletOnly, - ) as _i19.SyncingType); - @override - set syncType(_i19.SyncingType? syncType) => super.noSuchMethod( - Invocation.setter( - #syncType, - syncType, - ), - returnValueForMissingStub: null, - ); - @override - bool get wifiOnly => (super.noSuchMethod( - Invocation.getter(#wifiOnly), - returnValue: false, - ) as bool); - @override - set wifiOnly(bool? wifiOnly) => super.noSuchMethod( - Invocation.setter( - #wifiOnly, - wifiOnly, - ), - returnValueForMissingStub: null, - ); - @override - bool get showFavoriteWallets => (super.noSuchMethod( - Invocation.getter(#showFavoriteWallets), - returnValue: false, - ) as bool); - @override - set showFavoriteWallets(bool? showFavoriteWallets) => super.noSuchMethod( - Invocation.setter( - #showFavoriteWallets, - showFavoriteWallets, - ), - returnValueForMissingStub: null, - ); - @override - String get language => (super.noSuchMethod( - Invocation.getter(#language), - returnValue: '', - ) as String); - @override - set language(String? newLanguage) => super.noSuchMethod( - Invocation.setter( - #language, - newLanguage, - ), - returnValueForMissingStub: null, - ); - @override - String get currency => (super.noSuchMethod( - Invocation.getter(#currency), - returnValue: '', - ) as String); - @override - set currency(String? newCurrency) => super.noSuchMethod( - Invocation.setter( - #currency, - newCurrency, - ), - returnValueForMissingStub: null, - ); - @override - bool get randomizePIN => (super.noSuchMethod( - Invocation.getter(#randomizePIN), - returnValue: false, - ) as bool); - @override - set randomizePIN(bool? randomizePIN) => super.noSuchMethod( - Invocation.setter( - #randomizePIN, - randomizePIN, - ), - returnValueForMissingStub: null, - ); - @override - bool get useBiometrics => (super.noSuchMethod( - Invocation.getter(#useBiometrics), - returnValue: false, - ) as bool); - @override - set useBiometrics(bool? useBiometrics) => super.noSuchMethod( - Invocation.setter( - #useBiometrics, - useBiometrics, - ), - returnValueForMissingStub: null, - ); - @override - bool get hasPin => (super.noSuchMethod( - Invocation.getter(#hasPin), - returnValue: false, - ) as bool); - @override - set hasPin(bool? hasPin) => super.noSuchMethod( - Invocation.setter( - #hasPin, - hasPin, - ), - returnValueForMissingStub: null, - ); - @override - int get familiarity => (super.noSuchMethod( - Invocation.getter(#familiarity), - returnValue: 0, - ) as int); - @override - set familiarity(int? familiarity) => super.noSuchMethod( - Invocation.setter( - #familiarity, - familiarity, - ), - returnValueForMissingStub: null, - ); - @override - bool get showTestNetCoins => (super.noSuchMethod( - Invocation.getter(#showTestNetCoins), - returnValue: false, - ) as bool); - @override - set showTestNetCoins(bool? showTestNetCoins) => super.noSuchMethod( - Invocation.setter( - #showTestNetCoins, - showTestNetCoins, - ), - returnValueForMissingStub: null, - ); - @override - bool get isAutoBackupEnabled => (super.noSuchMethod( - Invocation.getter(#isAutoBackupEnabled), - returnValue: false, - ) as bool); - @override - set isAutoBackupEnabled(bool? isAutoBackupEnabled) => super.noSuchMethod( - Invocation.setter( - #isAutoBackupEnabled, - isAutoBackupEnabled, - ), - returnValueForMissingStub: null, - ); - @override - set autoBackupLocation(String? autoBackupLocation) => super.noSuchMethod( - Invocation.setter( - #autoBackupLocation, - autoBackupLocation, - ), - returnValueForMissingStub: null, - ); - @override - _i20.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( - Invocation.getter(#backupFrequencyType), - returnValue: _i20.BackupFrequencyType.everyTenMinutes, - ) as _i20.BackupFrequencyType); - @override - set backupFrequencyType(_i20.BackupFrequencyType? backupFrequencyType) => - super.noSuchMethod( - Invocation.setter( - #backupFrequencyType, - backupFrequencyType, - ), - returnValueForMissingStub: null, - ); - @override - set lastAutoBackup(DateTime? lastAutoBackup) => super.noSuchMethod( - Invocation.setter( - #lastAutoBackup, - lastAutoBackup, - ), - returnValueForMissingStub: null, - ); - @override - bool get hideBlockExplorerWarning => (super.noSuchMethod( - Invocation.getter(#hideBlockExplorerWarning), - returnValue: false, - ) as bool); - @override - set hideBlockExplorerWarning(bool? hideBlockExplorerWarning) => - super.noSuchMethod( - Invocation.setter( - #hideBlockExplorerWarning, - hideBlockExplorerWarning, - ), - returnValueForMissingStub: null, - ); - @override - bool get gotoWalletOnStartup => (super.noSuchMethod( - Invocation.getter(#gotoWalletOnStartup), - returnValue: false, - ) as bool); - @override - set gotoWalletOnStartup(bool? gotoWalletOnStartup) => super.noSuchMethod( - Invocation.setter( - #gotoWalletOnStartup, - gotoWalletOnStartup, - ), - returnValueForMissingStub: null, - ); - @override - set startupWalletId(String? startupWalletId) => super.noSuchMethod( - Invocation.setter( - #startupWalletId, - startupWalletId, - ), - returnValueForMissingStub: null, - ); - @override - bool get externalCalls => (super.noSuchMethod( - Invocation.getter(#externalCalls), - returnValue: false, - ) as bool); - @override - set externalCalls(bool? externalCalls) => super.noSuchMethod( - Invocation.setter( - #externalCalls, - externalCalls, - ), - returnValueForMissingStub: null, - ); - @override - bool get enableCoinControl => (super.noSuchMethod( - Invocation.getter(#enableCoinControl), - returnValue: false, - ) as bool); - @override - set enableCoinControl(bool? enableCoinControl) => super.noSuchMethod( - Invocation.setter( - #enableCoinControl, - enableCoinControl, - ), - returnValueForMissingStub: null, - ); - @override - bool get enableSystemBrightness => (super.noSuchMethod( - Invocation.getter(#enableSystemBrightness), - returnValue: false, - ) as bool); - @override - set enableSystemBrightness(bool? enableSystemBrightness) => - super.noSuchMethod( - Invocation.setter( - #enableSystemBrightness, - enableSystemBrightness, - ), - returnValueForMissingStub: null, - ); - @override - String get themeId => (super.noSuchMethod( - Invocation.getter(#themeId), - returnValue: '', - ) as String); - @override - set themeId(String? themeId) => super.noSuchMethod( - Invocation.setter( - #themeId, - themeId, - ), - returnValueForMissingStub: null, - ); - @override - String get systemBrightnessLightThemeId => (super.noSuchMethod( - Invocation.getter(#systemBrightnessLightThemeId), - returnValue: '', - ) as String); - @override - set systemBrightnessLightThemeId(String? systemBrightnessLightThemeId) => - super.noSuchMethod( - Invocation.setter( - #systemBrightnessLightThemeId, - systemBrightnessLightThemeId, - ), - returnValueForMissingStub: null, - ); - @override - String get systemBrightnessDarkThemeId => (super.noSuchMethod( - Invocation.getter(#systemBrightnessDarkThemeId), - returnValue: '', - ) as String); - @override - set systemBrightnessDarkThemeId(String? systemBrightnessDarkThemeId) => - super.noSuchMethod( - Invocation.setter( - #systemBrightnessDarkThemeId, - systemBrightnessDarkThemeId, - ), - returnValueForMissingStub: null, - ); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - _i14.Future init() => (super.noSuchMethod( - Invocation.method( - #init, - [], - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - _i14.Future incrementCurrentNotificationIndex() => (super.noSuchMethod( - Invocation.method( - #incrementCurrentNotificationIndex, - [], - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - _i14.Future isExternalCallsSet() => (super.noSuchMethod( - Invocation.method( - #isExternalCallsSet, - [], - ), - returnValue: _i14.Future.value(false), - ) as _i14.Future); - @override - _i14.Future saveUserID(String? userId) => (super.noSuchMethod( - Invocation.method( - #saveUserID, - [userId], - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - _i14.Future saveSignupEpoch(int? signupEpoch) => (super.noSuchMethod( - Invocation.method( - #saveSignupEpoch, - [signupEpoch], - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [PriceService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockPriceService extends _i1.Mock implements _i21.PriceService { - MockPriceService() { - _i1.throwOnMissingStub(this); - } - - @override - String get baseTicker => (super.noSuchMethod( - Invocation.getter(#baseTicker), - returnValue: '', - ) as String); - @override - set baseTicker(String? _baseTicker) => super.noSuchMethod( - Invocation.setter( - #baseTicker, - _baseTicker, - ), - returnValueForMissingStub: null, - ); - @override - Duration get updateInterval => (super.noSuchMethod( - Invocation.getter(#updateInterval), - returnValue: _FakeDuration_8( - this, - Invocation.getter(#updateInterval), - ), - ) as Duration); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - _i11.Tuple2<_i22.Decimal, double> getPrice(_i13.Coin? coin) => - (super.noSuchMethod( - Invocation.method( - #getPrice, - [coin], - ), - returnValue: _FakeTuple2_9<_i22.Decimal, double>( - this, - Invocation.method( - #getPrice, - [coin], - ), - ), - ) as _i11.Tuple2<_i22.Decimal, double>); - @override - _i14.Future updatePrice() => (super.noSuchMethod( - Invocation.method( - #updatePrice, - [], - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - void cancel() => super.noSuchMethod( - Invocation.method( - #cancel, - [], - ), - returnValueForMissingStub: null, - ); - @override - void start(bool? rightAway) => super.noSuchMethod( - Invocation.method( - #start, - [rightAway], - ), - returnValueForMissingStub: null, - ); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [NotesService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockNotesService extends _i1.Mock implements _i23.NotesService { - MockNotesService() { - _i1.throwOnMissingStub(this); - } - - @override - String get walletId => (super.noSuchMethod( - Invocation.getter(#walletId), - returnValue: '', - ) as String); - @override - Map get notesSync => (super.noSuchMethod( - Invocation.getter(#notesSync), - returnValue: {}, - ) as Map); - @override - _i14.Future> get notes => (super.noSuchMethod( - Invocation.getter(#notes), - returnValue: _i14.Future>.value({}), - ) as _i14.Future>); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - _i14.Future> search(String? text) => (super.noSuchMethod( - Invocation.method( - #search, - [text], - ), - returnValue: _i14.Future>.value({}), - ) as _i14.Future>); - @override - _i14.Future getNoteFor({required String? txid}) => - (super.noSuchMethod( - Invocation.method( - #getNoteFor, - [], - {#txid: txid}, - ), - returnValue: _i14.Future.value(''), - ) as _i14.Future); - @override - _i14.Future editOrAddNote({ - required String? txid, - required String? note, - }) => - (super.noSuchMethod( - Invocation.method( - #editOrAddNote, - [], - { - #txid: txid, - #note: note, - }, - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - _i14.Future deleteNote({required String? txid}) => (super.noSuchMethod( - Invocation.method( - #deleteNote, - [], - {#txid: txid}, - ), - returnValue: _i14.Future.value(), - returnValueForMissingStub: _i14.Future.value(), - ) as _i14.Future); - @override - void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} diff --git a/test/widget_tests/wallet_card_test.mocks.dart b/test/widget_tests/wallet_card_test.mocks.dart new file mode 100644 index 0000000000..af955c4778 --- /dev/null +++ b/test/widget_tests/wallet_card_test.mocks.dart @@ -0,0 +1,1861 @@ +// Mocks generated by Mockito 5.3.2 from annotations +// in stackwallet/test/widget_tests/wallet_card_test.dart. +// Do not manually edit this file. + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'dart:async' as _i21; +import 'dart:typed_data' as _i28; +import 'dart:ui' as _i23; + +import 'package:bip32/bip32.dart' as _i16; +import 'package:bip47/bip47.dart' as _i18; +import 'package:bitcoindart/bitcoindart.dart' as _i13; +import 'package:flutter/foundation.dart' as _i4; +import 'package:flutter_riverpod/flutter_riverpod.dart' as _i5; +import 'package:mockito/mockito.dart' as _i1; +import 'package:stackwallet/db/isar/main_db.dart' as _i12; +import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i10; +import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i9; +import 'package:stackwallet/models/balance.dart' as _i11; +import 'package:stackwallet/models/isar/models/isar_models.dart' as _i17; +import 'package:stackwallet/models/isar/stack_theme.dart' as _i31; +import 'package:stackwallet/models/paymint/fee_object_model.dart' as _i8; +import 'package:stackwallet/models/signing_data.dart' as _i26; +import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart' as _i24; +import 'package:stackwallet/services/coins/manager.dart' as _i6; +import 'package:stackwallet/services/locale_service.dart' as _i29; +import 'package:stackwallet/services/node_service.dart' as _i3; +import 'package:stackwallet/services/transaction_notification_tracker.dart' + as _i7; +import 'package:stackwallet/services/wallets.dart' as _i19; +import 'package:stackwallet/services/wallets_service.dart' as _i2; +import 'package:stackwallet/themes/theme_service.dart' as _i30; +import 'package:stackwallet/utilities/amount/amount.dart' as _i14; +import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i20; +import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart' as _i25; +import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart' + as _i27; +import 'package:stackwallet/utilities/prefs.dart' as _i22; +import 'package:tuple/tuple.dart' as _i15; + +// ignore_for_file: type=lint +// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_setters_without_getters +// ignore_for_file: comment_references +// ignore_for_file: implementation_imports +// ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class + +class _FakeWalletsService_0 extends _i1.SmartFake + implements _i2.WalletsService { + _FakeWalletsService_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeNodeService_1 extends _i1.SmartFake implements _i3.NodeService { + _FakeNodeService_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeChangeNotifierProvider_2 + extends _i1.SmartFake implements _i5.ChangeNotifierProvider { + _FakeChangeNotifierProvider_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeManager_3 extends _i1.SmartFake implements _i6.Manager { + _FakeManager_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeTransactionNotificationTracker_4 extends _i1.SmartFake + implements _i7.TransactionNotificationTracker { + _FakeTransactionNotificationTracker_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeFeeObject_5 extends _i1.SmartFake implements _i8.FeeObject { + _FakeFeeObject_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeElectrumX_6 extends _i1.SmartFake implements _i9.ElectrumX { + _FakeElectrumX_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeCachedElectrumX_7 extends _i1.SmartFake + implements _i10.CachedElectrumX { + _FakeCachedElectrumX_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeBalance_8 extends _i1.SmartFake implements _i11.Balance { + _FakeBalance_8( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeMainDB_9 extends _i1.SmartFake implements _i12.MainDB { + _FakeMainDB_9( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeNetworkType_10 extends _i1.SmartFake implements _i13.NetworkType { + _FakeNetworkType_10( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeElectrumXNode_11 extends _i1.SmartFake implements _i9.ElectrumXNode { + _FakeElectrumXNode_11( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeAmount_12 extends _i1.SmartFake implements _i14.Amount { + _FakeAmount_12( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeTuple2_13 extends _i1.SmartFake + implements _i15.Tuple2 { + _FakeTuple2_13( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeBIP32_14 extends _i1.SmartFake implements _i16.BIP32 { + _FakeBIP32_14( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeAddress_15 extends _i1.SmartFake implements _i17.Address { + _FakeAddress_15( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakePaymentCode_16 extends _i1.SmartFake implements _i18.PaymentCode { + _FakePaymentCode_16( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +/// A class which mocks [Wallets]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockWallets extends _i1.Mock implements _i19.Wallets { + MockWallets() { + _i1.throwOnMissingStub(this); + } + + @override + _i2.WalletsService get walletsService => (super.noSuchMethod( + Invocation.getter(#walletsService), + returnValue: _FakeWalletsService_0( + this, + Invocation.getter(#walletsService), + ), + ) as _i2.WalletsService); + @override + set walletsService(_i2.WalletsService? _walletsService) => super.noSuchMethod( + Invocation.setter( + #walletsService, + _walletsService, + ), + returnValueForMissingStub: null, + ); + @override + _i3.NodeService get nodeService => (super.noSuchMethod( + Invocation.getter(#nodeService), + returnValue: _FakeNodeService_1( + this, + Invocation.getter(#nodeService), + ), + ) as _i3.NodeService); + @override + set nodeService(_i3.NodeService? _nodeService) => super.noSuchMethod( + Invocation.setter( + #nodeService, + _nodeService, + ), + returnValueForMissingStub: null, + ); + @override + bool get hasWallets => (super.noSuchMethod( + Invocation.getter(#hasWallets), + returnValue: false, + ) as bool); + @override + List<_i5.ChangeNotifierProvider<_i6.Manager>> get managerProviders => + (super.noSuchMethod( + Invocation.getter(#managerProviders), + returnValue: <_i5.ChangeNotifierProvider<_i6.Manager>>[], + ) as List<_i5.ChangeNotifierProvider<_i6.Manager>>); + @override + List<_i6.Manager> get managers => (super.noSuchMethod( + Invocation.getter(#managers), + returnValue: <_i6.Manager>[], + ) as List<_i6.Manager>); + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); + @override + void dispose() => super.noSuchMethod( + Invocation.method( + #dispose, + [], + ), + returnValueForMissingStub: null, + ); + @override + List getWalletIdsFor({required _i20.Coin? coin}) => + (super.noSuchMethod( + Invocation.method( + #getWalletIdsFor, + [], + {#coin: coin}, + ), + returnValue: [], + ) as List); + @override + List<_i15.Tuple2<_i20.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>> + getManagerProvidersByCoin() => (super.noSuchMethod( + Invocation.method( + #getManagerProvidersByCoin, + [], + ), + returnValue: < + _i15.Tuple2<_i20.Coin, + List<_i5.ChangeNotifierProvider<_i6.Manager>>>>[], + ) as List< + _i15.Tuple2<_i20.Coin, + List<_i5.ChangeNotifierProvider<_i6.Manager>>>>); + @override + List<_i5.ChangeNotifierProvider<_i6.Manager>> getManagerProvidersForCoin( + _i20.Coin? coin) => + (super.noSuchMethod( + Invocation.method( + #getManagerProvidersForCoin, + [coin], + ), + returnValue: <_i5.ChangeNotifierProvider<_i6.Manager>>[], + ) as List<_i5.ChangeNotifierProvider<_i6.Manager>>); + @override + _i5.ChangeNotifierProvider<_i6.Manager> getManagerProvider( + String? walletId) => + (super.noSuchMethod( + Invocation.method( + #getManagerProvider, + [walletId], + ), + returnValue: _FakeChangeNotifierProvider_2<_i6.Manager>( + this, + Invocation.method( + #getManagerProvider, + [walletId], + ), + ), + ) as _i5.ChangeNotifierProvider<_i6.Manager>); + @override + _i6.Manager getManager(String? walletId) => (super.noSuchMethod( + Invocation.method( + #getManager, + [walletId], + ), + returnValue: _FakeManager_3( + this, + Invocation.method( + #getManager, + [walletId], + ), + ), + ) as _i6.Manager); + @override + void addWallet({ + required String? walletId, + required _i6.Manager? manager, + }) => + super.noSuchMethod( + Invocation.method( + #addWallet, + [], + { + #walletId: walletId, + #manager: manager, + }, + ), + returnValueForMissingStub: null, + ); + @override + void removeWallet({required String? walletId}) => super.noSuchMethod( + Invocation.method( + #removeWallet, + [], + {#walletId: walletId}, + ), + returnValueForMissingStub: null, + ); + @override + _i21.Future load(_i22.Prefs? prefs) => (super.noSuchMethod( + Invocation.method( + #load, + [prefs], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + _i21.Future loadAfterStackRestore( + _i22.Prefs? prefs, + List<_i6.Manager>? managers, + ) => + (super.noSuchMethod( + Invocation.method( + #loadAfterStackRestore, + [ + prefs, + managers, + ], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + void addListener(_i23.VoidCallback? listener) => super.noSuchMethod( + Invocation.method( + #addListener, + [listener], + ), + returnValueForMissingStub: null, + ); + @override + void removeListener(_i23.VoidCallback? listener) => super.noSuchMethod( + Invocation.method( + #removeListener, + [listener], + ), + returnValueForMissingStub: null, + ); + @override + void notifyListeners() => super.noSuchMethod( + Invocation.method( + #notifyListeners, + [], + ), + returnValueForMissingStub: null, + ); +} + +/// A class which mocks [BitcoinWallet]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockBitcoinWallet extends _i1.Mock implements _i24.BitcoinWallet { + MockBitcoinWallet() { + _i1.throwOnMissingStub(this); + } + + @override + set timer(_i21.Timer? _timer) => super.noSuchMethod( + Invocation.setter( + #timer, + _timer, + ), + returnValueForMissingStub: null, + ); + @override + _i7.TransactionNotificationTracker get txTracker => (super.noSuchMethod( + Invocation.getter(#txTracker), + returnValue: _FakeTransactionNotificationTracker_4( + this, + Invocation.getter(#txTracker), + ), + ) as _i7.TransactionNotificationTracker); + @override + set txTracker(_i7.TransactionNotificationTracker? _txTracker) => + super.noSuchMethod( + Invocation.setter( + #txTracker, + _txTracker, + ), + returnValueForMissingStub: null, + ); + @override + bool get longMutex => (super.noSuchMethod( + Invocation.getter(#longMutex), + returnValue: false, + ) as bool); + @override + set longMutex(bool? _longMutex) => super.noSuchMethod( + Invocation.setter( + #longMutex, + _longMutex, + ), + returnValueForMissingStub: null, + ); + @override + bool get refreshMutex => (super.noSuchMethod( + Invocation.getter(#refreshMutex), + returnValue: false, + ) as bool); + @override + set refreshMutex(bool? _refreshMutex) => super.noSuchMethod( + Invocation.setter( + #refreshMutex, + _refreshMutex, + ), + returnValueForMissingStub: null, + ); + @override + bool get isActive => (super.noSuchMethod( + Invocation.getter(#isActive), + returnValue: false, + ) as bool); + @override + set isActive(bool? _isActive) => super.noSuchMethod( + Invocation.setter( + #isActive, + _isActive, + ), + returnValueForMissingStub: null, + ); + @override + set isFavorite(bool? markFavorite) => super.noSuchMethod( + Invocation.setter( + #isFavorite, + markFavorite, + ), + returnValueForMissingStub: null, + ); + @override + bool get isFavorite => (super.noSuchMethod( + Invocation.getter(#isFavorite), + returnValue: false, + ) as bool); + @override + _i20.Coin get coin => (super.noSuchMethod( + Invocation.getter(#coin), + returnValue: _i20.Coin.bitcoin, + ) as _i20.Coin); + @override + _i21.Future> get utxos => (super.noSuchMethod( + Invocation.getter(#utxos), + returnValue: _i21.Future>.value(<_i17.UTXO>[]), + ) as _i21.Future>); + @override + _i21.Future> get transactions => (super.noSuchMethod( + Invocation.getter(#transactions), + returnValue: + _i21.Future>.value(<_i17.Transaction>[]), + ) as _i21.Future>); + @override + _i21.Future get currentReceivingAddress => (super.noSuchMethod( + Invocation.getter(#currentReceivingAddress), + returnValue: _i21.Future.value(''), + ) as _i21.Future); + @override + _i21.Future get currentChangeAddress => (super.noSuchMethod( + Invocation.getter(#currentChangeAddress), + returnValue: _i21.Future.value(''), + ) as _i21.Future); + @override + _i21.Future get currentChangeAddressP2PKH => (super.noSuchMethod( + Invocation.getter(#currentChangeAddressP2PKH), + returnValue: _i21.Future.value(''), + ) as _i21.Future); + @override + bool get hasCalledExit => (super.noSuchMethod( + Invocation.getter(#hasCalledExit), + returnValue: false, + ) as bool); + @override + _i21.Future<_i8.FeeObject> get fees => (super.noSuchMethod( + Invocation.getter(#fees), + returnValue: _i21.Future<_i8.FeeObject>.value(_FakeFeeObject_5( + this, + Invocation.getter(#fees), + )), + ) as _i21.Future<_i8.FeeObject>); + @override + _i21.Future get maxFee => (super.noSuchMethod( + Invocation.getter(#maxFee), + returnValue: _i21.Future.value(0), + ) as _i21.Future); + @override + _i21.Future> get mnemonic => (super.noSuchMethod( + Invocation.getter(#mnemonic), + returnValue: _i21.Future>.value([]), + ) as _i21.Future>); + @override + _i21.Future get mnemonicString => (super.noSuchMethod( + Invocation.getter(#mnemonicString), + returnValue: _i21.Future.value(), + ) as _i21.Future); + @override + _i21.Future get mnemonicPassphrase => (super.noSuchMethod( + Invocation.getter(#mnemonicPassphrase), + returnValue: _i21.Future.value(), + ) as _i21.Future); + @override + _i21.Future get chainHeight => (super.noSuchMethod( + Invocation.getter(#chainHeight), + returnValue: _i21.Future.value(0), + ) as _i21.Future); + @override + int get storedChainHeight => (super.noSuchMethod( + Invocation.getter(#storedChainHeight), + returnValue: 0, + ) as int); + @override + bool get shouldAutoSync => (super.noSuchMethod( + Invocation.getter(#shouldAutoSync), + returnValue: false, + ) as bool); + @override + set shouldAutoSync(bool? shouldAutoSync) => super.noSuchMethod( + Invocation.setter( + #shouldAutoSync, + shouldAutoSync, + ), + returnValueForMissingStub: null, + ); + @override + bool get isRefreshing => (super.noSuchMethod( + Invocation.getter(#isRefreshing), + returnValue: false, + ) as bool); + @override + bool get isConnected => (super.noSuchMethod( + Invocation.getter(#isConnected), + returnValue: false, + ) as bool); + @override + String get walletId => (super.noSuchMethod( + Invocation.getter(#walletId), + returnValue: '', + ) as String); + @override + String get walletName => (super.noSuchMethod( + Invocation.getter(#walletName), + returnValue: '', + ) as String); + @override + set walletName(String? newName) => super.noSuchMethod( + Invocation.setter( + #walletName, + newName, + ), + returnValueForMissingStub: null, + ); + @override + _i9.ElectrumX get electrumXClient => (super.noSuchMethod( + Invocation.getter(#electrumXClient), + returnValue: _FakeElectrumX_6( + this, + Invocation.getter(#electrumXClient), + ), + ) as _i9.ElectrumX); + @override + _i10.CachedElectrumX get cachedElectrumXClient => (super.noSuchMethod( + Invocation.getter(#cachedElectrumXClient), + returnValue: _FakeCachedElectrumX_7( + this, + Invocation.getter(#cachedElectrumXClient), + ), + ) as _i10.CachedElectrumX); + @override + _i11.Balance get balance => (super.noSuchMethod( + Invocation.getter(#balance), + returnValue: _FakeBalance_8( + this, + Invocation.getter(#balance), + ), + ) as _i11.Balance); + @override + _i21.Future get xpub => (super.noSuchMethod( + Invocation.getter(#xpub), + returnValue: _i21.Future.value(''), + ) as _i21.Future); + @override + set onIsActiveWalletChanged(void Function(bool)? _onIsActiveWalletChanged) => + super.noSuchMethod( + Invocation.setter( + #onIsActiveWalletChanged, + _onIsActiveWalletChanged, + ), + returnValueForMissingStub: null, + ); + @override + _i12.MainDB get db => (super.noSuchMethod( + Invocation.getter(#db), + returnValue: _FakeMainDB_9( + this, + Invocation.getter(#db), + ), + ) as _i12.MainDB); + @override + _i13.NetworkType get networkType => (super.noSuchMethod( + Invocation.getter(#networkType), + returnValue: _FakeNetworkType_10( + this, + Invocation.getter(#networkType), + ), + ) as _i13.NetworkType); + @override + _i21.Future exit() => (super.noSuchMethod( + Invocation.method( + #exit, + [], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + _i25.DerivePathType addressType({required String? address}) => + (super.noSuchMethod( + Invocation.method( + #addressType, + [], + {#address: address}, + ), + returnValue: _i25.DerivePathType.bip44, + ) as _i25.DerivePathType); + @override + _i21.Future recoverFromMnemonic({ + required String? mnemonic, + String? mnemonicPassphrase, + required int? maxUnusedAddressGap, + required int? maxNumberOfIndexesToCheck, + required int? height, + }) => + (super.noSuchMethod( + Invocation.method( + #recoverFromMnemonic, + [], + { + #mnemonic: mnemonic, + #mnemonicPassphrase: mnemonicPassphrase, + #maxUnusedAddressGap: maxUnusedAddressGap, + #maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, + #height: height, + }, + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + _i21.Future getTransactionCacheEarly(List? allAddresses) => + (super.noSuchMethod( + Invocation.method( + #getTransactionCacheEarly, + [allAddresses], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + _i21.Future refreshIfThereIsNewData() => (super.noSuchMethod( + Invocation.method( + #refreshIfThereIsNewData, + [], + ), + returnValue: _i21.Future.value(false), + ) as _i21.Future); + @override + _i21.Future getAllTxsToWatch() => (super.noSuchMethod( + Invocation.method( + #getAllTxsToWatch, + [], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + _i21.Future refresh() => (super.noSuchMethod( + Invocation.method( + #refresh, + [], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + _i21.Future> prepareSend({ + required String? address, + required _i14.Amount? amount, + Map? args, + }) => + (super.noSuchMethod( + Invocation.method( + #prepareSend, + [], + { + #address: address, + #amount: amount, + #args: args, + }, + ), + returnValue: + _i21.Future>.value({}), + ) as _i21.Future>); + @override + _i21.Future confirmSend({required Map? txData}) => + (super.noSuchMethod( + Invocation.method( + #confirmSend, + [], + {#txData: txData}, + ), + returnValue: _i21.Future.value(''), + ) as _i21.Future); + @override + _i21.Future testNetworkConnection() => (super.noSuchMethod( + Invocation.method( + #testNetworkConnection, + [], + ), + returnValue: _i21.Future.value(false), + ) as _i21.Future); + @override + void startNetworkAlivePinging() => super.noSuchMethod( + Invocation.method( + #startNetworkAlivePinging, + [], + ), + returnValueForMissingStub: null, + ); + @override + void stopNetworkAlivePinging() => super.noSuchMethod( + Invocation.method( + #stopNetworkAlivePinging, + [], + ), + returnValueForMissingStub: null, + ); + @override + _i21.Future initializeNew() => (super.noSuchMethod( + Invocation.method( + #initializeNew, + [], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + _i21.Future initializeExisting() => (super.noSuchMethod( + Invocation.method( + #initializeExisting, + [], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + _i21.Future updateSentCachedTxData(Map? txData) => + (super.noSuchMethod( + Invocation.method( + #updateSentCachedTxData, + [txData], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + bool validateAddress(String? address) => (super.noSuchMethod( + Invocation.method( + #validateAddress, + [address], + ), + returnValue: false, + ) as bool); + @override + _i21.Future updateNode(bool? shouldRefresh) => (super.noSuchMethod( + Invocation.method( + #updateNode, + [shouldRefresh], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + _i21.Future<_i9.ElectrumXNode> getCurrentNode() => (super.noSuchMethod( + Invocation.method( + #getCurrentNode, + [], + ), + returnValue: _i21.Future<_i9.ElectrumXNode>.value(_FakeElectrumXNode_11( + this, + Invocation.method( + #getCurrentNode, + [], + ), + )), + ) as _i21.Future<_i9.ElectrumXNode>); + @override + _i21.Future>> fastFetch( + List? allTxHashes) => + (super.noSuchMethod( + Invocation.method( + #fastFetch, + [allTxHashes], + ), + returnValue: _i21.Future>>.value( + >[]), + ) as _i21.Future>>); + @override + _i21.Future getTxCount({required String? address}) => + (super.noSuchMethod( + Invocation.method( + #getTxCount, + [], + {#address: address}, + ), + returnValue: _i21.Future.value(0), + ) as _i21.Future); + @override + _i21.Future checkCurrentReceivingAddressesForTransactions() => + (super.noSuchMethod( + Invocation.method( + #checkCurrentReceivingAddressesForTransactions, + [], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + _i21.Future checkCurrentChangeAddressesForTransactions() => + (super.noSuchMethod( + Invocation.method( + #checkCurrentChangeAddressesForTransactions, + [], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + int estimateTxFee({ + required int? vSize, + required int? feeRatePerKB, + }) => + (super.noSuchMethod( + Invocation.method( + #estimateTxFee, + [], + { + #vSize: vSize, + #feeRatePerKB: feeRatePerKB, + }, + ), + returnValue: 0, + ) as int); + @override + dynamic coinSelection({ + required int? satoshiAmountToSend, + required int? selectedTxFeeRate, + required String? recipientAddress, + required bool? coinControl, + required bool? isSendAll, + int? additionalOutputs = 0, + List<_i17.UTXO>? utxos, + }) => + super.noSuchMethod(Invocation.method( + #coinSelection, + [], + { + #satoshiAmountToSend: satoshiAmountToSend, + #selectedTxFeeRate: selectedTxFeeRate, + #recipientAddress: recipientAddress, + #coinControl: coinControl, + #isSendAll: isSendAll, + #additionalOutputs: additionalOutputs, + #utxos: utxos, + }, + )); + @override + _i21.Future> fetchBuildTxData( + List<_i17.UTXO>? utxosToUse) => + (super.noSuchMethod( + Invocation.method( + #fetchBuildTxData, + [utxosToUse], + ), + returnValue: + _i21.Future>.value(<_i26.SigningData>[]), + ) as _i21.Future>); + @override + _i21.Future> buildTransaction({ + required List<_i26.SigningData>? utxoSigningData, + required List? recipients, + required List? satoshiAmounts, + }) => + (super.noSuchMethod( + Invocation.method( + #buildTransaction, + [], + { + #utxoSigningData: utxoSigningData, + #recipients: recipients, + #satoshiAmounts: satoshiAmounts, + }, + ), + returnValue: + _i21.Future>.value({}), + ) as _i21.Future>); + @override + _i21.Future fullRescan( + int? maxUnusedAddressGap, + int? maxNumberOfIndexesToCheck, + ) => + (super.noSuchMethod( + Invocation.method( + #fullRescan, + [ + maxUnusedAddressGap, + maxNumberOfIndexesToCheck, + ], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + _i21.Future<_i14.Amount> estimateFeeFor( + _i14.Amount? amount, + int? feeRate, + ) => + (super.noSuchMethod( + Invocation.method( + #estimateFeeFor, + [ + amount, + feeRate, + ], + ), + returnValue: _i21.Future<_i14.Amount>.value(_FakeAmount_12( + this, + Invocation.method( + #estimateFeeFor, + [ + amount, + feeRate, + ], + ), + )), + ) as _i21.Future<_i14.Amount>); + @override + _i14.Amount roughFeeEstimate( + int? inputCount, + int? outputCount, + int? feeRatePerKB, + ) => + (super.noSuchMethod( + Invocation.method( + #roughFeeEstimate, + [ + inputCount, + outputCount, + feeRatePerKB, + ], + ), + returnValue: _FakeAmount_12( + this, + Invocation.method( + #roughFeeEstimate, + [ + inputCount, + outputCount, + feeRatePerKB, + ], + ), + ), + ) as _i14.Amount); + @override + _i21.Future<_i14.Amount> sweepAllEstimate(int? feeRate) => + (super.noSuchMethod( + Invocation.method( + #sweepAllEstimate, + [feeRate], + ), + returnValue: _i21.Future<_i14.Amount>.value(_FakeAmount_12( + this, + Invocation.method( + #sweepAllEstimate, + [feeRate], + ), + )), + ) as _i21.Future<_i14.Amount>); + @override + _i21.Future generateNewAddress() => (super.noSuchMethod( + Invocation.method( + #generateNewAddress, + [], + ), + returnValue: _i21.Future.value(false), + ) as _i21.Future); + @override + void initCache( + String? walletId, + _i20.Coin? coin, + ) => + super.noSuchMethod( + Invocation.method( + #initCache, + [ + walletId, + coin, + ], + ), + returnValueForMissingStub: null, + ); + @override + _i21.Future updateCachedId(String? id) => (super.noSuchMethod( + Invocation.method( + #updateCachedId, + [id], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + int getCachedChainHeight() => (super.noSuchMethod( + Invocation.method( + #getCachedChainHeight, + [], + ), + returnValue: 0, + ) as int); + @override + _i21.Future updateCachedChainHeight(int? height) => (super.noSuchMethod( + Invocation.method( + #updateCachedChainHeight, + [height], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + bool getCachedIsFavorite() => (super.noSuchMethod( + Invocation.method( + #getCachedIsFavorite, + [], + ), + returnValue: false, + ) as bool); + @override + _i21.Future updateCachedIsFavorite(bool? isFavorite) => + (super.noSuchMethod( + Invocation.method( + #updateCachedIsFavorite, + [isFavorite], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + _i11.Balance getCachedBalance() => (super.noSuchMethod( + Invocation.method( + #getCachedBalance, + [], + ), + returnValue: _FakeBalance_8( + this, + Invocation.method( + #getCachedBalance, + [], + ), + ), + ) as _i11.Balance); + @override + _i21.Future updateCachedBalance(_i11.Balance? balance) => + (super.noSuchMethod( + Invocation.method( + #updateCachedBalance, + [balance], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + _i11.Balance getCachedBalanceSecondary() => (super.noSuchMethod( + Invocation.method( + #getCachedBalanceSecondary, + [], + ), + returnValue: _FakeBalance_8( + this, + Invocation.method( + #getCachedBalanceSecondary, + [], + ), + ), + ) as _i11.Balance); + @override + _i21.Future updateCachedBalanceSecondary(_i11.Balance? balance) => + (super.noSuchMethod( + Invocation.method( + #updateCachedBalanceSecondary, + [balance], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + List getWalletTokenContractAddresses() => (super.noSuchMethod( + Invocation.method( + #getWalletTokenContractAddresses, + [], + ), + returnValue: [], + ) as List); + @override + _i21.Future updateWalletTokenContractAddresses( + List? contractAddresses) => + (super.noSuchMethod( + Invocation.method( + #updateWalletTokenContractAddresses, + [contractAddresses], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + void initWalletDB({_i12.MainDB? mockableOverride}) => super.noSuchMethod( + Invocation.method( + #initWalletDB, + [], + {#mockableOverride: mockableOverride}, + ), + returnValueForMissingStub: null, + ); + @override + _i21.Future<_i15.Tuple2<_i17.Transaction, _i17.Address>> parseTransaction( + Map? txData, + dynamic electrumxClient, + List<_i17.Address>? myAddresses, + _i20.Coin? coin, + int? minConfirms, + String? walletId, + ) => + (super.noSuchMethod( + Invocation.method( + #parseTransaction, + [ + txData, + electrumxClient, + myAddresses, + coin, + minConfirms, + walletId, + ], + ), + returnValue: + _i21.Future<_i15.Tuple2<_i17.Transaction, _i17.Address>>.value( + _FakeTuple2_13<_i17.Transaction, _i17.Address>( + this, + Invocation.method( + #parseTransaction, + [ + txData, + electrumxClient, + myAddresses, + coin, + minConfirms, + walletId, + ], + ), + )), + ) as _i21.Future<_i15.Tuple2<_i17.Transaction, _i17.Address>>); + @override + void initPaynymWalletInterface({ + required String? walletId, + required String? walletName, + required _i13.NetworkType? network, + required _i20.Coin? coin, + required _i12.MainDB? db, + required _i9.ElectrumX? electrumXClient, + required _i27.SecureStorageInterface? secureStorage, + required int? dustLimit, + required int? dustLimitP2PKH, + required int? minConfirms, + required _i21.Future Function()? getMnemonicString, + required _i21.Future Function()? getMnemonicPassphrase, + required _i21.Future Function()? getChainHeight, + required _i21.Future Function()? getCurrentChangeAddress, + required int Function({ + required int feeRatePerKB, + required int vSize, + })? + estimateTxFee, + required _i21.Future> Function({ + required String address, + required _i14.Amount amount, + Map? args, + })? + prepareSend, + required _i21.Future Function({required String address})? getTxCount, + required _i21.Future> Function(List<_i17.UTXO>)? + fetchBuildTxData, + required _i21.Future Function()? refresh, + required _i21.Future Function()? checkChangeAddressForTransactions, + }) => + super.noSuchMethod( + Invocation.method( + #initPaynymWalletInterface, + [], + { + #walletId: walletId, + #walletName: walletName, + #network: network, + #coin: coin, + #db: db, + #electrumXClient: electrumXClient, + #secureStorage: secureStorage, + #dustLimit: dustLimit, + #dustLimitP2PKH: dustLimitP2PKH, + #minConfirms: minConfirms, + #getMnemonicString: getMnemonicString, + #getMnemonicPassphrase: getMnemonicPassphrase, + #getChainHeight: getChainHeight, + #getCurrentChangeAddress: getCurrentChangeAddress, + #estimateTxFee: estimateTxFee, + #prepareSend: prepareSend, + #getTxCount: getTxCount, + #fetchBuildTxData: fetchBuildTxData, + #refresh: refresh, + #checkChangeAddressForTransactions: + checkChangeAddressForTransactions, + }, + ), + returnValueForMissingStub: null, + ); + @override + _i21.Future<_i16.BIP32> getBip47BaseNode() => (super.noSuchMethod( + Invocation.method( + #getBip47BaseNode, + [], + ), + returnValue: _i21.Future<_i16.BIP32>.value(_FakeBIP32_14( + this, + Invocation.method( + #getBip47BaseNode, + [], + ), + )), + ) as _i21.Future<_i16.BIP32>); + @override + _i21.Future<_i28.Uint8List> getPrivateKeyForPaynymReceivingAddress({ + required String? paymentCodeString, + required int? index, + }) => + (super.noSuchMethod( + Invocation.method( + #getPrivateKeyForPaynymReceivingAddress, + [], + { + #paymentCodeString: paymentCodeString, + #index: index, + }, + ), + returnValue: _i21.Future<_i28.Uint8List>.value(_i28.Uint8List(0)), + ) as _i21.Future<_i28.Uint8List>); + @override + _i21.Future<_i17.Address> currentReceivingPaynymAddress({ + required _i18.PaymentCode? sender, + required bool? isSegwit, + }) => + (super.noSuchMethod( + Invocation.method( + #currentReceivingPaynymAddress, + [], + { + #sender: sender, + #isSegwit: isSegwit, + }, + ), + returnValue: _i21.Future<_i17.Address>.value(_FakeAddress_15( + this, + Invocation.method( + #currentReceivingPaynymAddress, + [], + { + #sender: sender, + #isSegwit: isSegwit, + }, + ), + )), + ) as _i21.Future<_i17.Address>); + @override + _i21.Future checkCurrentPaynymReceivingAddressForTransactions({ + required _i18.PaymentCode? sender, + required bool? isSegwit, + }) => + (super.noSuchMethod( + Invocation.method( + #checkCurrentPaynymReceivingAddressForTransactions, + [], + { + #sender: sender, + #isSegwit: isSegwit, + }, + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + _i21.Future checkAllCurrentReceivingPaynymAddressesForTransactions() => + (super.noSuchMethod( + Invocation.method( + #checkAllCurrentReceivingPaynymAddressesForTransactions, + [], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + _i21.Future<_i16.BIP32> deriveNotificationBip32Node() => (super.noSuchMethod( + Invocation.method( + #deriveNotificationBip32Node, + [], + ), + returnValue: _i21.Future<_i16.BIP32>.value(_FakeBIP32_14( + this, + Invocation.method( + #deriveNotificationBip32Node, + [], + ), + )), + ) as _i21.Future<_i16.BIP32>); + @override + _i21.Future<_i18.PaymentCode> getPaymentCode({required bool? isSegwit}) => + (super.noSuchMethod( + Invocation.method( + #getPaymentCode, + [], + {#isSegwit: isSegwit}, + ), + returnValue: _i21.Future<_i18.PaymentCode>.value(_FakePaymentCode_16( + this, + Invocation.method( + #getPaymentCode, + [], + {#isSegwit: isSegwit}, + ), + )), + ) as _i21.Future<_i18.PaymentCode>); + @override + _i21.Future<_i28.Uint8List> signWithNotificationKey(_i28.Uint8List? data) => + (super.noSuchMethod( + Invocation.method( + #signWithNotificationKey, + [data], + ), + returnValue: _i21.Future<_i28.Uint8List>.value(_i28.Uint8List(0)), + ) as _i21.Future<_i28.Uint8List>); + @override + _i21.Future signStringWithNotificationKey(String? data) => + (super.noSuchMethod( + Invocation.method( + #signStringWithNotificationKey, + [data], + ), + returnValue: _i21.Future.value(''), + ) as _i21.Future); + @override + _i21.Future> preparePaymentCodeSend({ + required _i18.PaymentCode? paymentCode, + required bool? isSegwit, + required _i14.Amount? amount, + Map? args, + }) => + (super.noSuchMethod( + Invocation.method( + #preparePaymentCodeSend, + [], + { + #paymentCode: paymentCode, + #isSegwit: isSegwit, + #amount: amount, + #args: args, + }, + ), + returnValue: + _i21.Future>.value({}), + ) as _i21.Future>); + @override + _i21.Future<_i17.Address> nextUnusedSendAddressFrom({ + required _i18.PaymentCode? pCode, + required bool? isSegwit, + required _i16.BIP32? privateKeyNode, + int? startIndex = 0, + }) => + (super.noSuchMethod( + Invocation.method( + #nextUnusedSendAddressFrom, + [], + { + #pCode: pCode, + #isSegwit: isSegwit, + #privateKeyNode: privateKeyNode, + #startIndex: startIndex, + }, + ), + returnValue: _i21.Future<_i17.Address>.value(_FakeAddress_15( + this, + Invocation.method( + #nextUnusedSendAddressFrom, + [], + { + #pCode: pCode, + #isSegwit: isSegwit, + #privateKeyNode: privateKeyNode, + #startIndex: startIndex, + }, + ), + )), + ) as _i21.Future<_i17.Address>); + @override + _i21.Future> prepareNotificationTx({ + required int? selectedTxFeeRate, + required String? targetPaymentCodeString, + int? additionalOutputs = 0, + List<_i17.UTXO>? utxos, + }) => + (super.noSuchMethod( + Invocation.method( + #prepareNotificationTx, + [], + { + #selectedTxFeeRate: selectedTxFeeRate, + #targetPaymentCodeString: targetPaymentCodeString, + #additionalOutputs: additionalOutputs, + #utxos: utxos, + }, + ), + returnValue: + _i21.Future>.value({}), + ) as _i21.Future>); + @override + _i21.Future broadcastNotificationTx( + {required Map? preparedTx}) => + (super.noSuchMethod( + Invocation.method( + #broadcastNotificationTx, + [], + {#preparedTx: preparedTx}, + ), + returnValue: _i21.Future.value(''), + ) as _i21.Future); + @override + _i21.Future hasConnected(String? paymentCodeString) => + (super.noSuchMethod( + Invocation.method( + #hasConnected, + [paymentCodeString], + ), + returnValue: _i21.Future.value(false), + ) as _i21.Future); + @override + _i21.Future<_i18.PaymentCode?> unBlindedPaymentCodeFromTransaction( + {required _i17.Transaction? transaction}) => + (super.noSuchMethod( + Invocation.method( + #unBlindedPaymentCodeFromTransaction, + [], + {#transaction: transaction}, + ), + returnValue: _i21.Future<_i18.PaymentCode?>.value(), + ) as _i21.Future<_i18.PaymentCode?>); + @override + _i21.Future<_i18.PaymentCode?> unBlindedPaymentCodeFromTransactionBad( + {required _i17.Transaction? transaction}) => + (super.noSuchMethod( + Invocation.method( + #unBlindedPaymentCodeFromTransactionBad, + [], + {#transaction: transaction}, + ), + returnValue: _i21.Future<_i18.PaymentCode?>.value(), + ) as _i21.Future<_i18.PaymentCode?>); + @override + _i21.Future> + getAllPaymentCodesFromNotificationTransactions() => (super.noSuchMethod( + Invocation.method( + #getAllPaymentCodesFromNotificationTransactions, + [], + ), + returnValue: + _i21.Future>.value(<_i18.PaymentCode>[]), + ) as _i21.Future>); + @override + _i21.Future checkForNotificationTransactionsTo( + Set? otherCodeStrings) => + (super.noSuchMethod( + Invocation.method( + #checkForNotificationTransactionsTo, + [otherCodeStrings], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + _i21.Future restoreAllHistory({ + required int? maxUnusedAddressGap, + required int? maxNumberOfIndexesToCheck, + required Set? paymentCodeStrings, + }) => + (super.noSuchMethod( + Invocation.method( + #restoreAllHistory, + [], + { + #maxUnusedAddressGap: maxUnusedAddressGap, + #maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, + #paymentCodeStrings: paymentCodeStrings, + }, + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + _i21.Future restoreHistoryWith({ + required _i18.PaymentCode? other, + required bool? checkSegwitAsWell, + required int? maxUnusedAddressGap, + required int? maxNumberOfIndexesToCheck, + }) => + (super.noSuchMethod( + Invocation.method( + #restoreHistoryWith, + [], + { + #other: other, + #checkSegwitAsWell: checkSegwitAsWell, + #maxUnusedAddressGap: maxUnusedAddressGap, + #maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, + }, + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + _i21.Future<_i17.Address> getMyNotificationAddress() => (super.noSuchMethod( + Invocation.method( + #getMyNotificationAddress, + [], + ), + returnValue: _i21.Future<_i17.Address>.value(_FakeAddress_15( + this, + Invocation.method( + #getMyNotificationAddress, + [], + ), + )), + ) as _i21.Future<_i17.Address>); + @override + _i21.Future> lookupKey(String? paymentCodeString) => + (super.noSuchMethod( + Invocation.method( + #lookupKey, + [paymentCodeString], + ), + returnValue: _i21.Future>.value([]), + ) as _i21.Future>); + @override + _i21.Future paymentCodeStringByKey(String? key) => + (super.noSuchMethod( + Invocation.method( + #paymentCodeStringByKey, + [key], + ), + returnValue: _i21.Future.value(), + ) as _i21.Future); + @override + _i21.Future storeCode(String? paymentCodeString) => + (super.noSuchMethod( + Invocation.method( + #storeCode, + [paymentCodeString], + ), + returnValue: _i21.Future.value(''), + ) as _i21.Future); + @override + void initCoinControlInterface({ + required String? walletId, + required String? walletName, + required _i20.Coin? coin, + required _i12.MainDB? db, + required _i21.Future Function()? getChainHeight, + required _i21.Future Function(_i11.Balance)? refreshedBalanceCallback, + }) => + super.noSuchMethod( + Invocation.method( + #initCoinControlInterface, + [], + { + #walletId: walletId, + #walletName: walletName, + #coin: coin, + #db: db, + #getChainHeight: getChainHeight, + #refreshedBalanceCallback: refreshedBalanceCallback, + }, + ), + returnValueForMissingStub: null, + ); + @override + _i21.Future refreshBalance({bool? notify = false}) => + (super.noSuchMethod( + Invocation.method( + #refreshBalance, + [], + {#notify: notify}, + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); +} + +/// A class which mocks [LocaleService]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockLocaleService extends _i1.Mock implements _i29.LocaleService { + MockLocaleService() { + _i1.throwOnMissingStub(this); + } + + @override + String get locale => (super.noSuchMethod( + Invocation.getter(#locale), + returnValue: '', + ) as String); + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); + @override + _i21.Future loadLocale({bool? notify = true}) => (super.noSuchMethod( + Invocation.method( + #loadLocale, + [], + {#notify: notify}, + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + void addListener(_i23.VoidCallback? listener) => super.noSuchMethod( + Invocation.method( + #addListener, + [listener], + ), + returnValueForMissingStub: null, + ); + @override + void removeListener(_i23.VoidCallback? listener) => super.noSuchMethod( + Invocation.method( + #removeListener, + [listener], + ), + returnValueForMissingStub: null, + ); + @override + void dispose() => super.noSuchMethod( + Invocation.method( + #dispose, + [], + ), + returnValueForMissingStub: null, + ); + @override + void notifyListeners() => super.noSuchMethod( + Invocation.method( + #notifyListeners, + [], + ), + returnValueForMissingStub: null, + ); +} + +/// A class which mocks [ThemeService]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockThemeService extends _i1.Mock implements _i30.ThemeService { + MockThemeService() { + _i1.throwOnMissingStub(this); + } + + @override + _i12.MainDB get db => (super.noSuchMethod( + Invocation.getter(#db), + returnValue: _FakeMainDB_9( + this, + Invocation.getter(#db), + ), + ) as _i12.MainDB); + @override + List<_i31.StackTheme> get installedThemes => (super.noSuchMethod( + Invocation.getter(#installedThemes), + returnValue: <_i31.StackTheme>[], + ) as List<_i31.StackTheme>); + @override + void init(_i12.MainDB? db) => super.noSuchMethod( + Invocation.method( + #init, + [db], + ), + returnValueForMissingStub: null, + ); + @override + _i21.Future install({required _i28.Uint8List? themeArchiveData}) => + (super.noSuchMethod( + Invocation.method( + #install, + [], + {#themeArchiveData: themeArchiveData}, + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + _i21.Future remove({required String? themeId}) => (super.noSuchMethod( + Invocation.method( + #remove, + [], + {#themeId: themeId}, + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + _i21.Future checkDefaultThemesOnStartup() => (super.noSuchMethod( + Invocation.method( + #checkDefaultThemesOnStartup, + [], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override + _i21.Future verifyInstalled({required String? themeId}) => + (super.noSuchMethod( + Invocation.method( + #verifyInstalled, + [], + {#themeId: themeId}, + ), + returnValue: _i21.Future.value(false), + ) as _i21.Future); + @override + _i21.Future> fetchThemes() => + (super.noSuchMethod( + Invocation.method( + #fetchThemes, + [], + ), + returnValue: _i21.Future>.value( + <_i30.StackThemeMetaData>[]), + ) as _i21.Future>); + @override + _i21.Future<_i28.Uint8List> fetchTheme( + {required _i30.StackThemeMetaData? themeMetaData}) => + (super.noSuchMethod( + Invocation.method( + #fetchTheme, + [], + {#themeMetaData: themeMetaData}, + ), + returnValue: _i21.Future<_i28.Uint8List>.value(_i28.Uint8List(0)), + ) as _i21.Future<_i28.Uint8List>); + @override + _i31.StackTheme? getTheme({required String? themeId}) => + (super.noSuchMethod(Invocation.method( + #getTheme, + [], + {#themeId: themeId}, + )) as _i31.StackTheme?); +} diff --git a/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.dart b/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.dart index acab25d1d2..fee5ab6d5a 100644 --- a/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.dart +++ b/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.dart @@ -3,20 +3,21 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; -import 'package:stackduo/models/balance.dart'; -import 'package:stackduo/providers/providers.dart'; -import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart'; -import 'package:stackduo/services/coins/coin_service.dart'; -import 'package:stackduo/services/coins/manager.dart'; -import 'package:stackduo/services/node_service.dart'; -import 'package:stackduo/services/wallets.dart'; -import 'package:stackduo/services/wallets_service.dart'; -import 'package:stackduo/utilities/amount/amount.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/wallet_info_row/sub_widgets/wallet_info_row_balance.dart'; +import 'package:stackwallet/models/balance.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/providers/providers.dart'; +import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart'; +import 'package:stackwallet/services/coins/coin_service.dart'; +import 'package:stackwallet/services/coins/manager.dart'; +import 'package:stackwallet/services/node_service.dart'; +import 'package:stackwallet/services/wallets.dart'; +import 'package:stackwallet/services/wallets_service.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/utilities/amount/amount.dart'; +import 'package:stackwallet/utilities/enums/coin_enum.dart'; +import 'package:stackwallet/widgets/wallet_info_row/sub_widgets/wallet_info_row_balance.dart'; +import '../../../sample_data/theme_json.dart'; import 'wallet_info_row_balance_future_test.mocks.dart'; @GenerateMocks([ @@ -39,10 +40,10 @@ void main() { when(wallet.walletId).thenAnswer((_) => "some-wallet-id"); when(wallet.balance).thenAnswer( (_) => Balance( - total: 0.toAmountAsRaw(fractionDigits: 8), - spendable: 0.toAmountAsRaw(fractionDigits: 8), - blockedTotal: 0.toAmountAsRaw(fractionDigits: 8), - pendingSpendable: 0.toAmountAsRaw(fractionDigits: 8), + total: Amount.zero, + spendable: Amount.zero, + blockedTotal: Amount.zero, + pendingSpendable: Amount.zero, ), ); @@ -61,7 +62,9 @@ void main() { theme: ThemeData( extensions: [ StackColors.fromStackColorTheme( - LightColors(), + StackTheme.fromJson( + json: lightThemeJsonMap, + ), ), ], ), diff --git a/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.mocks.dart b/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.mocks.dart index 3278f946ff..79a4cbf64a 100644 --- a/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.mocks.dart +++ b/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.mocks.dart @@ -1,11 +1,10 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i23; -import 'dart:typed_data' as _i29; -import 'dart:ui' as _i25; +import 'dart:typed_data' as _i28; import 'package:bip32/bip32.dart' as _i16; import 'package:bip47/bip47.dart' as _i18; @@ -13,15 +12,15 @@ import 'package:bitcoindart/bitcoindart.dart' as _i13; import 'package:flutter/foundation.dart' as _i4; import 'package:flutter_riverpod/flutter_riverpod.dart' as _i5; import 'package:mockito/mockito.dart' as _i1; -import 'package:stackduo/db/main_db.dart' as _i12; +import 'package:stackduo/db/isar/main_db.dart' as _i12; import 'package:stackduo/electrumx_rpc/cached_electrumx.dart' as _i10; import 'package:stackduo/electrumx_rpc/electrumx.dart' as _i9; import 'package:stackduo/models/balance.dart' as _i11; import 'package:stackduo/models/isar/models/isar_models.dart' as _i17; -import 'package:stackduo/models/node_model.dart' as _i30; +import 'package:stackduo/models/node_model.dart' as _i29; import 'package:stackduo/models/paymint/fee_object_model.dart' as _i8; -import 'package:stackduo/models/signing_data.dart' as _i28; -import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart' as _i26; +import 'package:stackduo/models/signing_data.dart' as _i27; +import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart' as _i25; import 'package:stackduo/services/coins/coin_service.dart' as _i20; import 'package:stackduo/services/coins/manager.dart' as _i6; import 'package:stackduo/services/node_service.dart' as _i3; @@ -30,7 +29,7 @@ import 'package:stackduo/services/wallets.dart' as _i21; import 'package:stackduo/services/wallets_service.dart' as _i2; import 'package:stackduo/utilities/amount/amount.dart' as _i14; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i22; -import 'package:stackduo/utilities/enums/derive_path_type_enum.dart' as _i27; +import 'package:stackduo/utilities/enums/derive_path_type_enum.dart' as _i26; import 'package:stackduo/utilities/flutter_secure_storage_interface.dart' as _i19; import 'package:stackduo/utilities/prefs.dart' as _i24; @@ -427,7 +426,7 @@ class MockWallets extends _i1.Mock implements _i21.Wallets { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -435,7 +434,7 @@ class MockWallets extends _i1.Mock implements _i21.Wallets { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -653,7 +652,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -661,7 +660,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -689,7 +688,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { /// A class which mocks [BitcoinWallet]. /// /// See the documentation for Mockito's code generation for more information. -class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { +class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet { MockBitcoinWallet() { _i1.throwOnMissingStub(this); } @@ -950,15 +949,15 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - _i27.DerivePathType addressType({required String? address}) => + _i26.DerivePathType addressType({required String? address}) => (super.noSuchMethod( Invocation.method( #addressType, [], {#address: address}, ), - returnValue: _i27.DerivePathType.bip44, - ) as _i27.DerivePathType); + returnValue: _i26.DerivePathType.bip44, + ) as _i26.DerivePathType); @override _i23.Future recoverFromMnemonic({ required String? mnemonic, @@ -1194,6 +1193,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { required String? recipientAddress, required bool? coinControl, required bool? isSendAll, + int? satsPerVByte, int? additionalOutputs = 0, List<_i17.UTXO>? utxos, }) => @@ -1206,12 +1206,13 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { #recipientAddress: recipientAddress, #coinControl: coinControl, #isSendAll: isSendAll, + #satsPerVByte: satsPerVByte, #additionalOutputs: additionalOutputs, #utxos: utxos, }, )); @override - _i23.Future> fetchBuildTxData( + _i23.Future> fetchBuildTxData( List<_i17.UTXO>? utxosToUse) => (super.noSuchMethod( Invocation.method( @@ -1219,11 +1220,11 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { [utxosToUse], ), returnValue: - _i23.Future>.value(<_i28.SigningData>[]), - ) as _i23.Future>); + _i23.Future>.value(<_i27.SigningData>[]), + ) as _i23.Future>); @override _i23.Future> buildTransaction({ - required List<_i28.SigningData>? utxoSigningData, + required List<_i27.SigningData>? utxoSigningData, required List? recipients, required List? satoshiAmounts, }) => @@ -1512,7 +1513,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { })? prepareSend, required _i23.Future Function({required String address})? getTxCount, - required _i23.Future> Function(List<_i17.UTXO>)? + required _i23.Future> Function(List<_i17.UTXO>)? fetchBuildTxData, required _i23.Future Function()? refresh, required _i23.Future Function()? checkChangeAddressForTransactions, @@ -1562,7 +1563,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { )), ) as _i23.Future<_i16.BIP32>); @override - _i23.Future<_i29.Uint8List> getPrivateKeyForPaynymReceivingAddress({ + _i23.Future<_i28.Uint8List> getPrivateKeyForPaynymReceivingAddress({ required String? paymentCodeString, required int? index, }) => @@ -1575,8 +1576,8 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { #index: index, }, ), - returnValue: _i23.Future<_i29.Uint8List>.value(_i29.Uint8List(0)), - ) as _i23.Future<_i29.Uint8List>); + returnValue: _i23.Future<_i28.Uint8List>.value(_i28.Uint8List(0)), + ) as _i23.Future<_i28.Uint8List>); @override _i23.Future<_i17.Address> currentReceivingPaynymAddress({ required _i18.PaymentCode? sender, @@ -1662,14 +1663,14 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { )), ) as _i23.Future<_i18.PaymentCode>); @override - _i23.Future<_i29.Uint8List> signWithNotificationKey(_i29.Uint8List? data) => + _i23.Future<_i28.Uint8List> signWithNotificationKey(_i28.Uint8List? data) => (super.noSuchMethod( Invocation.method( #signWithNotificationKey, [data], ), - returnValue: _i23.Future<_i29.Uint8List>.value(_i29.Uint8List(0)), - ) as _i23.Future<_i29.Uint8List>); + returnValue: _i23.Future<_i28.Uint8List>.value(_i28.Uint8List(0)), + ) as _i23.Future<_i28.Uint8List>); @override _i23.Future signStringWithNotificationKey(String? data) => (super.noSuchMethod( @@ -1947,15 +1948,15 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { ), ) as _i19.SecureStorageInterface); @override - List<_i30.NodeModel> get primaryNodes => (super.noSuchMethod( + List<_i29.NodeModel> get primaryNodes => (super.noSuchMethod( Invocation.getter(#primaryNodes), - returnValue: <_i30.NodeModel>[], - ) as List<_i30.NodeModel>); + returnValue: <_i29.NodeModel>[], + ) as List<_i29.NodeModel>); @override - List<_i30.NodeModel> get nodes => (super.noSuchMethod( + List<_i29.NodeModel> get nodes => (super.noSuchMethod( Invocation.getter(#nodes), - returnValue: <_i30.NodeModel>[], - ) as List<_i30.NodeModel>); + returnValue: <_i29.NodeModel>[], + ) as List<_i29.NodeModel>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), @@ -1973,7 +1974,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { @override _i23.Future setPrimaryNodeFor({ required _i22.Coin? coin, - required _i30.NodeModel? node, + required _i29.NodeModel? node, bool? shouldNotifyListeners = false, }) => (super.noSuchMethod( @@ -1990,40 +1991,40 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - _i30.NodeModel? getPrimaryNodeFor({required _i22.Coin? coin}) => + _i29.NodeModel? getPrimaryNodeFor({required _i22.Coin? coin}) => (super.noSuchMethod(Invocation.method( #getPrimaryNodeFor, [], {#coin: coin}, - )) as _i30.NodeModel?); + )) as _i29.NodeModel?); @override - List<_i30.NodeModel> getNodesFor(_i22.Coin? coin) => (super.noSuchMethod( + List<_i29.NodeModel> getNodesFor(_i22.Coin? coin) => (super.noSuchMethod( Invocation.method( #getNodesFor, [coin], ), - returnValue: <_i30.NodeModel>[], - ) as List<_i30.NodeModel>); + returnValue: <_i29.NodeModel>[], + ) as List<_i29.NodeModel>); @override - _i30.NodeModel? getNodeById({required String? id}) => + _i29.NodeModel? getNodeById({required String? id}) => (super.noSuchMethod(Invocation.method( #getNodeById, [], {#id: id}, - )) as _i30.NodeModel?); + )) as _i29.NodeModel?); @override - List<_i30.NodeModel> failoverNodesFor({required _i22.Coin? coin}) => + List<_i29.NodeModel> failoverNodesFor({required _i22.Coin? coin}) => (super.noSuchMethod( Invocation.method( #failoverNodesFor, [], {#coin: coin}, ), - returnValue: <_i30.NodeModel>[], - ) as List<_i30.NodeModel>); + returnValue: <_i29.NodeModel>[], + ) as List<_i29.NodeModel>); @override _i23.Future add( - _i30.NodeModel? node, + _i29.NodeModel? node, String? password, bool? shouldNotifyListeners, ) => @@ -2075,7 +2076,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { ) as _i23.Future); @override _i23.Future edit( - _i30.NodeModel? editedNode, + _i29.NodeModel? editedNode, String? password, bool? shouldNotifyListeners, ) => @@ -2101,7 +2102,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -2109,7 +2110,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -2286,6 +2287,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -2489,7 +2495,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -2497,7 +2503,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/widget_tests/wallet_info_row/wallet_info_row_test.dart b/test/widget_tests/wallet_info_row/wallet_info_row_test.dart index 45a3ec421e..c3fb2eef50 100644 --- a/test/widget_tests/wallet_info_row/wallet_info_row_test.dart +++ b/test/widget_tests/wallet_info_row/wallet_info_row_test.dart @@ -3,26 +3,29 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; -import 'package:stackduo/models/balance.dart'; -import 'package:stackduo/providers/providers.dart'; -import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart'; -import 'package:stackduo/services/coins/coin_service.dart'; -import 'package:stackduo/services/coins/manager.dart'; -import 'package:stackduo/services/node_service.dart'; -import 'package:stackduo/services/wallets.dart'; -import 'package:stackduo/services/wallets_service.dart'; -import 'package:stackduo/utilities/amount/amount.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; -import 'package:stackduo/widgets/wallet_info_row/sub_widgets/wallet_info_row_balance.dart'; -import 'package:stackduo/widgets/wallet_info_row/wallet_info_row.dart'; +import 'package:stackwallet/models/balance.dart'; +import 'package:stackwallet/models/isar/stack_theme.dart'; +import 'package:stackwallet/providers/providers.dart'; +import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart'; +import 'package:stackwallet/services/coins/coin_service.dart'; +import 'package:stackwallet/services/coins/manager.dart'; +import 'package:stackwallet/services/node_service.dart'; +import 'package:stackwallet/services/wallets.dart'; +import 'package:stackwallet/services/wallets_service.dart'; +import 'package:stackwallet/themes/stack_colors.dart'; +import 'package:stackwallet/themes/theme_service.dart'; +import 'package:stackwallet/utilities/amount/amount.dart'; +import 'package:stackwallet/utilities/enums/coin_enum.dart'; +import 'package:stackwallet/widgets/wallet_info_row/sub_widgets/wallet_info_row_balance.dart'; +import 'package:stackwallet/widgets/wallet_info_row/wallet_info_row.dart'; +import '../../sample_data/theme_json.dart'; import 'wallet_info_row_test.mocks.dart'; @GenerateMocks([ Wallets, WalletsService, + ThemeService, BitcoinWallet ], customMocks: [ MockSpec(returnNullOnMissingStub: true), @@ -33,16 +36,22 @@ import 'wallet_info_row_test.mocks.dart'; void main() { testWidgets("Test wallet info row displays correctly", (widgetTester) async { final wallets = MockWallets(); + final mockThemeService = MockThemeService(); final CoinServiceAPI wallet = MockBitcoinWallet(); + when(mockThemeService.getTheme(themeId: "light")).thenAnswer( + (_) => StackTheme.fromJson( + json: lightThemeJsonMap, + ), + ); when(wallet.coin).thenAnswer((_) => Coin.bitcoin); when(wallet.walletName).thenAnswer((_) => "some wallet"); when(wallet.walletId).thenAnswer((_) => "some-wallet-id"); when(wallet.balance).thenAnswer( (_) => Balance( - total: 0.toAmountAsRaw(fractionDigits: 8), - spendable: 0.toAmountAsRaw(fractionDigits: 8), - blockedTotal: 0.toAmountAsRaw(fractionDigits: 8), - pendingSpendable: 0.toAmountAsRaw(fractionDigits: 8), + total: Amount.zero, + spendable: Amount.zero, + blockedTotal: Amount.zero, + pendingSpendable: Amount.zero, ), ); @@ -55,12 +64,15 @@ void main() { ProviderScope( overrides: [ walletsChangeNotifierProvider.overrideWithValue(wallets), + pThemeService.overrideWithValue(mockThemeService), ], child: MaterialApp( theme: ThemeData( extensions: [ StackColors.fromStackColorTheme( - LightColors(), + StackTheme.fromJson( + json: lightThemeJsonMap, + ), ), ], ), diff --git a/test/widget_tests/wallet_info_row/wallet_info_row_test.mocks.dart b/test/widget_tests/wallet_info_row/wallet_info_row_test.mocks.dart index 1cfa90f003..cdc37b7918 100644 --- a/test/widget_tests/wallet_info_row/wallet_info_row_test.mocks.dart +++ b/test/widget_tests/wallet_info_row/wallet_info_row_test.mocks.dart @@ -1,11 +1,10 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/widget_tests/wallet_info_row/wallet_info_row_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i23; -import 'dart:typed_data' as _i29; -import 'dart:ui' as _i25; +import 'dart:typed_data' as _i28; import 'package:bip32/bip32.dart' as _i16; import 'package:bip47/bip47.dart' as _i18; @@ -13,15 +12,15 @@ import 'package:bitcoindart/bitcoindart.dart' as _i13; import 'package:flutter/foundation.dart' as _i4; import 'package:flutter_riverpod/flutter_riverpod.dart' as _i5; import 'package:mockito/mockito.dart' as _i1; -import 'package:stackduo/db/main_db.dart' as _i12; +import 'package:stackduo/db/isar/main_db.dart' as _i12; import 'package:stackduo/electrumx_rpc/cached_electrumx.dart' as _i10; import 'package:stackduo/electrumx_rpc/electrumx.dart' as _i9; import 'package:stackduo/models/balance.dart' as _i11; import 'package:stackduo/models/isar/models/isar_models.dart' as _i17; -import 'package:stackduo/models/node_model.dart' as _i30; +import 'package:stackduo/models/node_model.dart' as _i29; import 'package:stackduo/models/paymint/fee_object_model.dart' as _i8; -import 'package:stackduo/models/signing_data.dart' as _i28; -import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart' as _i26; +import 'package:stackduo/models/signing_data.dart' as _i27; +import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart' as _i25; import 'package:stackduo/services/coins/coin_service.dart' as _i20; import 'package:stackduo/services/coins/manager.dart' as _i6; import 'package:stackduo/services/node_service.dart' as _i3; @@ -30,7 +29,7 @@ import 'package:stackduo/services/wallets.dart' as _i21; import 'package:stackduo/services/wallets_service.dart' as _i2; import 'package:stackduo/utilities/amount/amount.dart' as _i14; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i22; -import 'package:stackduo/utilities/enums/derive_path_type_enum.dart' as _i27; +import 'package:stackduo/utilities/enums/derive_path_type_enum.dart' as _i26; import 'package:stackduo/utilities/flutter_secure_storage_interface.dart' as _i19; import 'package:stackduo/utilities/prefs.dart' as _i24; @@ -427,7 +426,7 @@ class MockWallets extends _i1.Mock implements _i21.Wallets { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -435,7 +434,7 @@ class MockWallets extends _i1.Mock implements _i21.Wallets { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -653,7 +652,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -661,7 +660,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -689,7 +688,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { /// A class which mocks [BitcoinWallet]. /// /// See the documentation for Mockito's code generation for more information. -class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { +class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet { MockBitcoinWallet() { _i1.throwOnMissingStub(this); } @@ -950,15 +949,15 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - _i27.DerivePathType addressType({required String? address}) => + _i26.DerivePathType addressType({required String? address}) => (super.noSuchMethod( Invocation.method( #addressType, [], {#address: address}, ), - returnValue: _i27.DerivePathType.bip44, - ) as _i27.DerivePathType); + returnValue: _i26.DerivePathType.bip44, + ) as _i26.DerivePathType); @override _i23.Future recoverFromMnemonic({ required String? mnemonic, @@ -1194,6 +1193,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { required String? recipientAddress, required bool? coinControl, required bool? isSendAll, + int? satsPerVByte, int? additionalOutputs = 0, List<_i17.UTXO>? utxos, }) => @@ -1206,12 +1206,13 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { #recipientAddress: recipientAddress, #coinControl: coinControl, #isSendAll: isSendAll, + #satsPerVByte: satsPerVByte, #additionalOutputs: additionalOutputs, #utxos: utxos, }, )); @override - _i23.Future> fetchBuildTxData( + _i23.Future> fetchBuildTxData( List<_i17.UTXO>? utxosToUse) => (super.noSuchMethod( Invocation.method( @@ -1219,11 +1220,11 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { [utxosToUse], ), returnValue: - _i23.Future>.value(<_i28.SigningData>[]), - ) as _i23.Future>); + _i23.Future>.value(<_i27.SigningData>[]), + ) as _i23.Future>); @override _i23.Future> buildTransaction({ - required List<_i28.SigningData>? utxoSigningData, + required List<_i27.SigningData>? utxoSigningData, required List? recipients, required List? satoshiAmounts, }) => @@ -1512,7 +1513,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { })? prepareSend, required _i23.Future Function({required String address})? getTxCount, - required _i23.Future> Function(List<_i17.UTXO>)? + required _i23.Future> Function(List<_i17.UTXO>)? fetchBuildTxData, required _i23.Future Function()? refresh, required _i23.Future Function()? checkChangeAddressForTransactions, @@ -1562,7 +1563,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { )), ) as _i23.Future<_i16.BIP32>); @override - _i23.Future<_i29.Uint8List> getPrivateKeyForPaynymReceivingAddress({ + _i23.Future<_i28.Uint8List> getPrivateKeyForPaynymReceivingAddress({ required String? paymentCodeString, required int? index, }) => @@ -1575,8 +1576,8 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { #index: index, }, ), - returnValue: _i23.Future<_i29.Uint8List>.value(_i29.Uint8List(0)), - ) as _i23.Future<_i29.Uint8List>); + returnValue: _i23.Future<_i28.Uint8List>.value(_i28.Uint8List(0)), + ) as _i23.Future<_i28.Uint8List>); @override _i23.Future<_i17.Address> currentReceivingPaynymAddress({ required _i18.PaymentCode? sender, @@ -1662,14 +1663,14 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { )), ) as _i23.Future<_i18.PaymentCode>); @override - _i23.Future<_i29.Uint8List> signWithNotificationKey(_i29.Uint8List? data) => + _i23.Future<_i28.Uint8List> signWithNotificationKey(_i28.Uint8List? data) => (super.noSuchMethod( Invocation.method( #signWithNotificationKey, [data], ), - returnValue: _i23.Future<_i29.Uint8List>.value(_i29.Uint8List(0)), - ) as _i23.Future<_i29.Uint8List>); + returnValue: _i23.Future<_i28.Uint8List>.value(_i28.Uint8List(0)), + ) as _i23.Future<_i28.Uint8List>); @override _i23.Future signStringWithNotificationKey(String? data) => (super.noSuchMethod( @@ -1947,15 +1948,15 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { ), ) as _i19.SecureStorageInterface); @override - List<_i30.NodeModel> get primaryNodes => (super.noSuchMethod( + List<_i29.NodeModel> get primaryNodes => (super.noSuchMethod( Invocation.getter(#primaryNodes), - returnValue: <_i30.NodeModel>[], - ) as List<_i30.NodeModel>); + returnValue: <_i29.NodeModel>[], + ) as List<_i29.NodeModel>); @override - List<_i30.NodeModel> get nodes => (super.noSuchMethod( + List<_i29.NodeModel> get nodes => (super.noSuchMethod( Invocation.getter(#nodes), - returnValue: <_i30.NodeModel>[], - ) as List<_i30.NodeModel>); + returnValue: <_i29.NodeModel>[], + ) as List<_i29.NodeModel>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), @@ -1973,7 +1974,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { @override _i23.Future setPrimaryNodeFor({ required _i22.Coin? coin, - required _i30.NodeModel? node, + required _i29.NodeModel? node, bool? shouldNotifyListeners = false, }) => (super.noSuchMethod( @@ -1990,40 +1991,40 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - _i30.NodeModel? getPrimaryNodeFor({required _i22.Coin? coin}) => + _i29.NodeModel? getPrimaryNodeFor({required _i22.Coin? coin}) => (super.noSuchMethod(Invocation.method( #getPrimaryNodeFor, [], {#coin: coin}, - )) as _i30.NodeModel?); + )) as _i29.NodeModel?); @override - List<_i30.NodeModel> getNodesFor(_i22.Coin? coin) => (super.noSuchMethod( + List<_i29.NodeModel> getNodesFor(_i22.Coin? coin) => (super.noSuchMethod( Invocation.method( #getNodesFor, [coin], ), - returnValue: <_i30.NodeModel>[], - ) as List<_i30.NodeModel>); + returnValue: <_i29.NodeModel>[], + ) as List<_i29.NodeModel>); @override - _i30.NodeModel? getNodeById({required String? id}) => + _i29.NodeModel? getNodeById({required String? id}) => (super.noSuchMethod(Invocation.method( #getNodeById, [], {#id: id}, - )) as _i30.NodeModel?); + )) as _i29.NodeModel?); @override - List<_i30.NodeModel> failoverNodesFor({required _i22.Coin? coin}) => + List<_i29.NodeModel> failoverNodesFor({required _i22.Coin? coin}) => (super.noSuchMethod( Invocation.method( #failoverNodesFor, [], {#coin: coin}, ), - returnValue: <_i30.NodeModel>[], - ) as List<_i30.NodeModel>); + returnValue: <_i29.NodeModel>[], + ) as List<_i29.NodeModel>); @override _i23.Future add( - _i30.NodeModel? node, + _i29.NodeModel? node, String? password, bool? shouldNotifyListeners, ) => @@ -2075,7 +2076,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { ) as _i23.Future); @override _i23.Future edit( - _i30.NodeModel? editedNode, + _i29.NodeModel? editedNode, String? password, bool? shouldNotifyListeners, ) => @@ -2101,7 +2102,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -2109,7 +2110,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -2286,6 +2287,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -2489,7 +2495,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -2497,7 +2503,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 7c293146f8..d81eabadce 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,7 +6,7 @@ #include "generated_plugin_registrant.h" -#include +#include #include #include #include diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 200adfcda5..80b508c45b 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,7 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST - connectivity_plus_windows + connectivity_plus desktop_drop flutter_secure_storage_windows isar_flutter_libs