Skip to content

Commit

Permalink
chore: Merge pull request #582 from dashpay/release/7.0.3
Browse files Browse the repository at this point in the history
chore: Release 7.0.3
  • Loading branch information
tikhop authored Aug 3, 2023
2 parents 54d66c0 + 7b10b5e commit 041c682
Show file tree
Hide file tree
Showing 19 changed files with 128 additions and 68 deletions.
32 changes: 16 additions & 16 deletions DashWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7444,7 +7444,7 @@
INFOPLIST_KEY_CFBundleDisplayName = Dash;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 7.0.2;
MARKETING_VERSION = 7.0.3;
PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
Expand Down Expand Up @@ -7502,7 +7502,7 @@
INFOPLIST_KEY_CFBundleDisplayName = Dash;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 7.0.2;
MARKETING_VERSION = 7.0.3;
PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "DashWallet/dashwallet-Bridging-Header.h";
Expand Down Expand Up @@ -7587,7 +7587,7 @@
EXCLUDED_ARCHS = "";
IBSC_MODULE = WatchApp_Extension;
INFOPLIST_FILE = WatchApp/Info.plist;
MARKETING_VERSION = 7.0.2;
MARKETING_VERSION = 7.0.3;
PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.watchkitapp;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = watchos;
Expand All @@ -7609,7 +7609,7 @@
EXCLUDED_ARCHS = "";
IBSC_MODULE = WatchApp_Extension;
INFOPLIST_FILE = WatchApp/Info.plist;
MARKETING_VERSION = 7.0.2;
MARKETING_VERSION = 7.0.3;
PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.watchkitapp;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = watchos;
Expand All @@ -7630,7 +7630,7 @@
EXCLUDED_ARCHS = "";
INFOPLIST_FILE = "WatchApp Extension/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 7.0.2;
MARKETING_VERSION = 7.0.3;
PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.watchkitapp.watchkitextension;
PRODUCT_NAME = "${TARGET_NAME}";
SDKROOT = watchos;
Expand All @@ -7653,7 +7653,7 @@
EXCLUDED_ARCHS = "";
INFOPLIST_FILE = "WatchApp Extension/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 7.0.2;
MARKETING_VERSION = 7.0.3;
PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.watchkitapp.watchkitextension;
PRODUCT_NAME = "${TARGET_NAME}";
SDKROOT = watchos;
Expand Down Expand Up @@ -7681,7 +7681,7 @@
INFOPLIST_FILE = TodayExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 7.0.2;
MARKETING_VERSION = 7.0.3;
PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.TodayExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand All @@ -7706,7 +7706,7 @@
INFOPLIST_FILE = TodayExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 7.0.2;
MARKETING_VERSION = 7.0.3;
PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.TodayExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -7823,7 +7823,7 @@
INFOPLIST_KEY_CFBundleDisplayName = Dash;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 7.0.2;
MARKETING_VERSION = 7.0.3;
PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "DashWallet/dashwallet-Bridging-Header.h";
Expand Down Expand Up @@ -7851,7 +7851,7 @@
INFOPLIST_FILE = TodayExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 7.0.2;
MARKETING_VERSION = 7.0.3;
PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.TodayExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -7903,7 +7903,7 @@
EXCLUDED_ARCHS = "";
IBSC_MODULE = WatchApp_Extension;
INFOPLIST_FILE = WatchApp/Info.plist;
MARKETING_VERSION = 7.0.2;
MARKETING_VERSION = 7.0.3;
PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.watchkitapp;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = watchos;
Expand All @@ -7924,7 +7924,7 @@
EXCLUDED_ARCHS = "";
INFOPLIST_FILE = "WatchApp Extension/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 7.0.2;
MARKETING_VERSION = 7.0.3;
PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.watchkitapp.watchkitextension;
PRODUCT_NAME = "${TARGET_NAME}";
SDKROOT = watchos;
Expand Down Expand Up @@ -8040,7 +8040,7 @@
INFOPLIST_KEY_CFBundleDisplayName = Dash;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 7.0.2;
MARKETING_VERSION = 7.0.3;
PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "DashWallet/dashwallet-Bridging-Header.h";
Expand All @@ -8067,7 +8067,7 @@
INFOPLIST_FILE = TodayExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 7.0.2;
MARKETING_VERSION = 7.0.3;
PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.TodayExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -8118,7 +8118,7 @@
EXCLUDED_ARCHS = "";
IBSC_MODULE = WatchApp_Extension;
INFOPLIST_FILE = WatchApp/Info.plist;
MARKETING_VERSION = 7.0.2;
MARKETING_VERSION = 7.0.3;
PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.watchkitapp;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = watchos;
Expand All @@ -8139,7 +8139,7 @@
EXCLUDED_ARCHS = "";
INFOPLIST_FILE = "WatchApp Extension/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 7.0.2;
MARKETING_VERSION = 7.0.3;
PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.watchkitapp.watchkitextension;
PRODUCT_NAME = "${TARGET_NAME}";
SDKROOT = watchos;
Expand Down
8 changes: 7 additions & 1 deletion DashWallet/Sources/Models/CrowdNode/CrowdNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -471,14 +471,20 @@ extension CrowdNode {
}

func hasAnyDeposits() -> Bool {
DSLogger.log("CrowdNodeDeposit: hasAnyDeposits")
guard !accountAddress.isEmpty else { return false }

DSLogger.log("CrowdNodeDeposit: get currentWallet")
let wallet = DWEnvironment.sharedInstance().currentWallet
DSLogger.log("CrowdNodeDeposit: create CrowdNodeDepositTx")
let filter = CrowdNodeDepositTx(accountAddress: accountAddress)

return wallet.allTransactions.contains {
DSLogger.log("CrowdNodeDeposit: enumerate allTransactions")
let result = wallet.allTransactions.contains {
tx in filter.matches(tx: tx)
}
DSLogger.log("CrowdNodeDeposit: hasAnyDeposits: return \(result)")
return result
}

private func checkWithdrawalLimits(_ amount: UInt64) throws {
Expand Down
3 changes: 2 additions & 1 deletion DashWallet/Sources/UI/CrowdNode/CrowdNodeModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ final class CrowdNodeModel {
var needsBackup: Bool { DWGlobalOptions.sharedInstance().walletNeedsBackup }
var canSignUp: Bool { !needsBackup && hasEnoughWalletBalance }
var shouldShowFirstDepositBanner: Bool {
!crowdNode.hasAnyDeposits() && crowdNodeBalance < CrowdNode.minimumDeposit
DSLogger.log("CrowdNodeDeposit: get shouldShowFirstDepositBanner. Balance: \(crowdNodeBalance)")
return !crowdNode.hasAnyDeposits() && crowdNodeBalance < CrowdNode.minimumDeposit
}

var canWithdraw: Bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ extension CrowdNodePortalController : UITableViewDelegate, UITableViewDataSource

switch item {
case .deposit:
DSLogger.log("CrowdNodeDeposit: navigate to transfer with deposit mode")
navigationController?.pushViewController(CrowdNodeTransferController.controller(mode: TransferDirection.deposit), animated: true)
case .withdraw:
if viewModel.canWithdraw {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,45 +43,57 @@ final class CrowdNodeTransferController: SendAmountViewController, NetworkReacha
override var amountInputStyle: AmountInputControl.Style { .oppositeAmount }

static func controller(mode: TransferDirection) -> CrowdNodeTransferController {
DSLogger.log("CrowdNodeDeposit: create transfer model for \(mode)")
let model = CrowdNodeTransferModel()
model.direction = mode

DSLogger.log("CrowdNodeDeposit: create viewController")
let vc = CrowdNodeTransferController(model: model)
return vc
}

override func viewDidLoad() {
DSLogger.log("CrowdNodeDeposit: super.viewDidLoad")
super.viewDidLoad()

DSLogger.log("CrowdNodeDeposit: viewDidLoad")
view.backgroundColor = .dw_secondaryBackground()

navigationItem.backButtonDisplayMode = .minimal
navigationItem.largeTitleDisplayMode = .never

networkStatusDidChange = { [weak self] _ in
DSLogger.log("CrowdNodeDeposit: networkStatusDidChange")
self?.reloadView()
}
startNetworkMonitoring()
configureObservers()
DSLogger.log("CrowdNodeDeposit: viewDidLoad end")
}

override func viewDidAppear(_ animated: Bool) {
DSLogger.log("CrowdNodeDeposit: super.viewDidAppear")
super.viewDidAppear(animated)
DSLogger.log("CrowdNodeDeposit: viewDidAppear")
viewModel.showNotificationOnResult = false

if mode == .deposit && viewModel.shouldShowWithdrawalLimitsDialog {
showWithdrawalLimitsInfo()
viewModel.shouldShowWithdrawalLimitsDialog = false
}

DSLogger.log("CrowdNodeDeposit: viewDidAppear end")
}

override func viewDidDisappear(_ animated: Bool) {
DSLogger.log("CrowdNodeDeposit: super.viewDidDisappear")
super.viewDidDisappear(animated)
viewModel.showNotificationOnResult = true
}

override var actionButtonTitle: String? {
mode.title
DSLogger.log("CrowdNodeDeposit: get actionButtonTitle")
return mode.title
}

override func actionButtonAction(sender: UIView) {
Expand All @@ -101,8 +113,10 @@ final class CrowdNodeTransferController: SendAmountViewController, NetworkReacha
}

override func configureModel() {
DSLogger.log("CrowdNodeDeposit: super.configureModel")
super.configureModel()

DSLogger.log("CrowdNodeDeposit: configureModel")
model.inputsSwappedHandler = { [weak self] _ in
self?.updateBalanceLabel()
}
Expand Down Expand Up @@ -158,22 +172,28 @@ final class CrowdNodeTransferController: SendAmountViewController, NetworkReacha

extension CrowdNodeTransferController {
override func configureHierarchy() {
DSLogger.log("CrowdNodeDeposit: super.configureHierarchy")
super.configureHierarchy()

DSLogger.log("CrowdNodeDeposit: configureTitleBar")
configureTitleBar()

DSLogger.log("CrowdNodeDeposit: set fromLabel")
fromLabel = FromLabel(icon: mode.imageName, text: mode.direction)
contentView.addSubview(fromLabel)

DSLogger.log("CrowdNodeDeposit: set KeyboardHeader")
let keyboardHeader = KeyboardHeader(icon: mode.keyboardHeaderIcon, text: mode.keyboardHeader)
keyboardHeader.translatesAutoresizingMaskIntoConstraints = false
topKeyboardView = keyboardHeader

DSLogger.log("CrowdNodeDeposit: set NetworkUnavailableView")
networkUnavailableView = NetworkUnavailableView(frame: .zero)
networkUnavailableView.translatesAutoresizingMaskIntoConstraints = false
networkUnavailableView.isHidden = true
contentView.addSubview(networkUnavailableView)

DSLogger.log("CrowdNodeDeposit: activate transfer screen constraints")
NSLayoutConstraint.activate([
fromLabel.centerXAnchor.constraint(equalTo: contentView.centerXAnchor),
NSLayoutConstraint(item: fromLabel!, attribute: .centerY, relatedBy: .equal, toItem: view, attribute: .centerY, multiplier: 0.38, constant: 0),
Expand All @@ -187,36 +207,42 @@ extension CrowdNodeTransferController {
])

if mode == .deposit && viewModel.shouldShowFirstDepositBanner {
DSLogger.log("CrowdNodeDeposit: set MinimumDepositBanner")
let minimumDepositBanner = MinimumDepositBanner(frame: .zero)
contentView.addSubview(minimumDepositBanner)

DSLogger.log("CrowdNodeDeposit: activate MinimumDepositBanner constraints")
NSLayoutConstraint.activate([
minimumDepositBanner.heightAnchor.constraint(equalToConstant: 32),
minimumDepositBanner.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
minimumDepositBanner.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: 0),
minimumDepositBanner.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 0),
])

DSLogger.log("CrowdNodeDeposit: set UITapGestureRecognizer")
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(minimumDepositBannerTapAction))
minimumDepositBanner.addGestureRecognizer(tapGestureRecognizer)
self.minimumDepositBanner = minimumDepositBanner
}
}

private func configureTitleBar() {
DSLogger.log("CrowdNodeDeposit: configureTitleBar")
let titleViewStackView = UIStackView()
titleViewStackView.alignment = .center
titleViewStackView.translatesAutoresizingMaskIntoConstraints = false
titleViewStackView.axis = .vertical
titleViewStackView.spacing = 1
navigationItem.titleView = titleViewStackView

DSLogger.log("CrowdNodeDeposit: titleLabel")
let titleLabel = UILabel()
titleLabel.font = .dw_mediumFont(ofSize: 16)
titleLabel.minimumScaleFactor = 0.5
titleLabel.text = mode.title
titleViewStackView.addArrangedSubview(titleLabel)

DSLogger.log("CrowdNodeDeposit: set dashPriceLabel")
dashPriceLabel = UILabel()
dashPriceLabel.font = .dw_font(forTextStyle: .footnote)
dashPriceLabel.textColor = .dw_secondaryText()
Expand All @@ -235,6 +261,7 @@ extension CrowdNodeTransferController {
extension CrowdNodeTransferController {
private func reloadView() {
let isOnline = networkStatus == .online
DSLogger.log("CrowdNodeDeposit: reloadView, isOnline: \(isOnline)")
networkUnavailableView.isHidden = isOnline
keyboardContainer.isHidden = !isOnline
if let btn = actionButton as? UIButton { btn.superview?.isHidden = !isOnline }
Expand Down Expand Up @@ -300,15 +327,20 @@ extension CrowdNodeTransferController {
}

private func showWithdrawalLimitsInfo() {
DSLogger.log("CrowdNodeDeposit: showWithdrawalLimitsInfo")
let vc = WithdrawalLimitsController()
DSLogger.log("CrowdNodeDeposit: assign WithdrawalLimitDialogModel")
vc.model = WithdrawalLimitDialogModel(icon: "image.crowdnode.info", buttonText: nil, limits: viewModel.withdrawalLimits, highlightedLimit: -1)
DSLogger.log("CrowdNodeDeposit: create BaseNavigationController")
let nvc = BaseNavigationController(rootViewController: vc)
DSLogger.log("CrowdNodeDeposit: present BaseNavigationController")
present(nvc, animated: true)
}
}

extension CrowdNodeTransferController {
func configureObservers() {
DSLogger.log("CrowdNodeDeposit: configureObservers")
viewModel.$crowdNodeBalance
.receive(on: DispatchQueue.main)
.removeDuplicates()
Expand All @@ -334,10 +366,13 @@ extension CrowdNodeTransferController {
}

private func updateBalanceLabel() {
DSLogger.log("CrowdNodeDeposit: updateBalanceLabel")
let amount = mode == .deposit ? viewModel.walletBalance : viewModel.crowdNodeBalance
DSLogger.log("CrowdNodeDeposit: formatted balance: \(amount)")
let formatted = model.activeAmountType == .main
? amount.formattedDashAmount
: CurrencyExchanger.shared.fiatAmountString(in: model.localCurrencyCode, for: amount.dashAmount)
DSLogger.log("CrowdNodeDeposit: set balance label: \(formatted)")
fromLabel.balanceText = NSLocalizedString("Balance: ", comment: "CrowdNode") + formatted
}
}
Expand Down
Loading

0 comments on commit 041c682

Please sign in to comment.