From b17e7744c6122e2f791692defefedcda69396d8b Mon Sep 17 00:00:00 2001 From: M Date: Fri, 6 Nov 2020 20:54:00 +0200 Subject: [PATCH] Fixes --- cw_monero/lib/wallet.dart | 12 +- ios/Runner.xcodeproj/project.pbxproj | 12 +- lib/core/pending_transaction.dart | 1 + lib/di.dart | 16 +- lib/main.dart | 5 +- lib/monero/monero_transaction_info.dart | 1 + lib/monero/monero_wallet.dart | 15 +- lib/monero/pending_monero_transaction.dart | 3 + lib/router.dart | 30 +- lib/src/screens/send/send_page.dart | 315 +++++++++--------- .../transaction_details_page.dart | 24 +- lib/view_model/send/send_view_model.dart | 36 +- 12 files changed, 273 insertions(+), 197 deletions(-) diff --git a/cw_monero/lib/wallet.dart b/cw_monero/lib/wallet.dart index e3a0eb304..f10c35620 100644 --- a/cw_monero/lib/wallet.dart +++ b/cw_monero/lib/wallet.dart @@ -212,13 +212,14 @@ String getPublicSpendKey() => convertUTF8ToString(pointer: getPublicSpendKeyNative()); class SyncListener { - SyncListener({this.onNewBlock}) { + SyncListener(this.onNewBlock, this.onNewTransaction) { _cachedBlockchainHeight = 0; _lastKnownBlockHeight = 0; _initialSyncHeight = 0; } void Function(int, int, double) onNewBlock; + void Function() onNewTransaction; Timer _updateSyncInfoTimer; int _cachedBlockchainHeight; @@ -239,6 +240,10 @@ class SyncListener { _initialSyncHeight = 0; _updateSyncInfoTimer ??= Timer.periodic(Duration(milliseconds: 1200), (_) async { + if (isNewTransactionExist() ?? false) { + onNewTransaction?.call(); + } + var syncHeight = getSyncingHeight(); if (syncHeight <= 0) { @@ -273,8 +278,9 @@ class SyncListener { void stop() => _updateSyncInfoTimer?.cancel(); } -SyncListener setListeners(void Function(int, int, double) onNewBlock) { - final listener = SyncListener(onNewBlock: onNewBlock); +SyncListener setListeners(void Function(int, int, double) onNewBlock, + void Function() onNewTransaction) { + final listener = SyncListener(onNewBlock, onNewTransaction); setListenerNative(); return listener; } diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 41ccba7a1..e2bd0672c 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -354,7 +354,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 17; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -371,7 +371,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.0.0; + MARKETING_VERSION = 4.0.1; PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -494,7 +494,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 17; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -511,7 +511,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.0.0; + MARKETING_VERSION = 4.0.1; PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -528,7 +528,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 17; + CURRENT_PROJECT_VERSION = 2; DEVELOPMENT_TEAM = 32J6BB6VUS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -545,7 +545,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 4.0.0; + MARKETING_VERSION = 4.0.1; PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; diff --git a/lib/core/pending_transaction.dart b/lib/core/pending_transaction.dart index c7adb4478..c7f9b77d5 100644 --- a/lib/core/pending_transaction.dart +++ b/lib/core/pending_transaction.dart @@ -1,4 +1,5 @@ mixin PendingTransaction { + String get id; String get amountFormatted; String get feeFormatted; diff --git a/lib/di.dart b/lib/di.dart index 137701416..9dad3efb3 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -1,8 +1,9 @@ - import 'package:cake_wallet/bitcoin/bitcoin_wallet_service.dart'; import 'package:cake_wallet/core/wallet_service.dart'; import 'package:cake_wallet/entities/biometric_auth.dart'; import 'package:cake_wallet/entities/contact_record.dart'; +import 'package:cake_wallet/entities/transaction_description.dart'; +import 'package:cake_wallet/entities/transaction_info.dart'; import 'package:cake_wallet/monero/monero_wallet_service.dart'; import 'package:cake_wallet/entities/contact.dart'; import 'package:cake_wallet/entities/node.dart'; @@ -23,6 +24,7 @@ import 'package:cake_wallet/src/screens/send/send_template_page.dart'; import 'package:cake_wallet/src/screens/settings/change_language.dart'; import 'package:cake_wallet/src/screens/settings/settings.dart'; import 'package:cake_wallet/src/screens/setup_pin_code/setup_pin_code.dart'; +import 'package:cake_wallet/src/screens/transaction_details/transaction_details_page.dart'; import 'package:cake_wallet/src/screens/wallet_keys/wallet_keys_page.dart'; import 'package:cake_wallet/src/screens/exchange/exchange_page.dart'; import 'package:cake_wallet/src/screens/exchange/exchange_template_page.dart'; @@ -92,7 +94,8 @@ Future setup( Box contactSource, Box tradesSource, Box