Skip to content

Commit

Permalink
fix review comment - syncInProgressLabel
Browse files Browse the repository at this point in the history
  • Loading branch information
bgptr committed Feb 13, 2020
1 parent 035be2d commit 5b8f219
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
6 changes: 3 additions & 3 deletions Decred Wallet/Features/Receive/Receive.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@
</constraints>
</view>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Please wait for your wallet to finish synchronizing." textAlignment="center" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hDv-Si-5Gh">
<rect key="frame" x="16" y="441.5" width="382" height="23"/>
<rect key="frame" x="24" y="430.5" width="366" height="45.5"/>
<fontDescription key="fontDescription" name="SourceSansPro-Regular" family="Source Sans Pro" pointSize="18"/>
<color key="textColor" red="0.53725490200000003" green="0.59215686270000001" blue="0.64705882349999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
Expand All @@ -277,9 +277,9 @@
<constraint firstItem="W4w-5c-cuM" firstAttribute="leading" secondItem="Oqc-5O-q6B" secondAttribute="leading" constant="24" id="5qN-Qh-J0F"/>
<constraint firstAttribute="bottom" secondItem="dvn-e5-AOF" secondAttribute="bottom" id="6yj-oX-zHh"/>
<constraint firstItem="fEY-wz-2Xy" firstAttribute="centerY" secondItem="W4w-5c-cuM" secondAttribute="centerY" id="Gyu-fy-gZg"/>
<constraint firstItem="Oqc-5O-q6B" firstAttribute="trailing" secondItem="hDv-Si-5Gh" secondAttribute="trailing" constant="16" id="Hm9-hT-d2i"/>
<constraint firstItem="Oqc-5O-q6B" firstAttribute="trailing" secondItem="hDv-Si-5Gh" secondAttribute="trailing" constant="24" id="Hm9-hT-d2i"/>
<constraint firstItem="ZRf-sN-oTU" firstAttribute="centerY" secondItem="W4w-5c-cuM" secondAttribute="centerY" id="Hor-7X-wCt"/>
<constraint firstItem="hDv-Si-5Gh" firstAttribute="leading" secondItem="Oqc-5O-q6B" secondAttribute="leading" constant="16" id="P6g-LP-Pbi"/>
<constraint firstItem="hDv-Si-5Gh" firstAttribute="leading" secondItem="Oqc-5O-q6B" secondAttribute="leading" constant="24" id="P6g-LP-Pbi"/>
<constraint firstItem="Oqc-5O-q6B" firstAttribute="bottom" secondItem="Ist-fg-aj8" secondAttribute="bottom" constant="16" id="SRZ-Jy-TqA"/>
<constraint firstItem="Oqc-5O-q6B" firstAttribute="trailing" secondItem="fEY-wz-2Xy" secondAttribute="trailing" constant="24" id="VBP-IZ-XzC"/>
<constraint firstItem="Oqc-5O-q6B" firstAttribute="trailing" secondItem="dvn-e5-AOF" secondAttribute="trailing" id="XZe-X5-d1P"/>
Expand Down
21 changes: 10 additions & 11 deletions Decred Wallet/Features/Receive/ReceiveViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,9 @@ class ReceiveViewController: UIViewController, UIDocumentInteractionControllerDe
private func displayAddressForFirstWalletAccount() {
let accountsFilterFn: (DcrlibwalletAccount) -> Bool = { $0.totalBalance > 0 || $0.name != "imported" }
guard let wallet = WalletLoader.shared.wallets.map({ Wallet.init($0, accountsFilterFn: accountsFilterFn) }).first,
let account = wallet.accounts.first else {
self.moreMenuButton.isEnabled = false
self.mainContentViewHolder.isHidden = true
self.syncInProgressLabel.isHidden = false
return
}
let account = wallet.accounts.first else { return }

self.updateSelectedAccount(wallet.id, account)

mainContentViewHolder.isHidden = false
syncInProgressLabel.isHidden = true
self.moreMenuButton.isEnabled = true
}

@objc func copyAddress() {
Expand Down Expand Up @@ -140,10 +131,18 @@ class ReceiveViewController: UIViewController, UIDocumentInteractionControllerDe
}

func updateSelectedAccount(_ selectedWalletId: Int, _ selectedAccount: DcrlibwalletAccount) {
guard let wallet = WalletLoader.shared.multiWallet.wallet(withID: selectedWalletId) else {
guard let wallet = WalletLoader.shared.multiWallet.wallet(withID: selectedWalletId), wallet.isSynced()
else {
self.syncInProgressLabel.isHidden = false
self.moreMenuButton.isEnabled = false
self.mainContentViewHolder.isHidden = true
return
}

self.mainContentViewHolder.isHidden = false
self.moreMenuButton.isEnabled = true
self.syncInProgressLabel.isHidden = true

self.selectedWallet = wallet
self.selectedAccount = selectedAccount

Expand Down

0 comments on commit 5b8f219

Please sign in to comment.