Skip to content

Commit

Permalink
fix: remove superfluous error when xpub input text changed for multis…
Browse files Browse the repository at this point in the history
…ig creator

feat: add ability to alternate the address explorer between receive and address keys
  • Loading branch information
Fonta1n3 committed Nov 14, 2020
1 parent cf78e58 commit ee81ca1
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 32 deletions.
8 changes: 4 additions & 4 deletions FullyNoded.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 272;
CURRENT_PROJECT_VERSION = 273;
DEVELOPMENT_TEAM = 8JHDU5M9KD;
"ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
Expand All @@ -1429,7 +1429,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.352;
MARKETING_VERSION = 1.353;
PRODUCT_BUNDLE_IDENTIFIER = com.fontaine.FullyNoded;
"PRODUCT_BUNDLE_IDENTIFIER[sdk=macosx*]" = com.fontaine.fullynodedmacos;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -1454,7 +1454,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 272;
CURRENT_PROJECT_VERSION = 273;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 8JHDU5M9KD;
"ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES;
Expand All @@ -1467,7 +1467,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.352;
MARKETING_VERSION = 1.353;
PRODUCT_BUNDLE_IDENTIFIER = com.fontaine.FullyNoded;
"PRODUCT_BUNDLE_IDENTIFIER[sdk=macosx*]" = com.fontaine.fullynodedmacos;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
23 changes: 15 additions & 8 deletions FullyNoded/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -3206,11 +3206,8 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" tag="1" contentMode="scaleToFill" editable="NO" text="addresses list" translatesAutoresizingMaskIntoConstraints="NO" id="f5e-Sk-Vgh">
<rect key="frame" x="8" y="18" width="287" height="156"/>
<rect key="frame" x="8" y="47" width="287" height="137"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="156" id="RMS-dK-GRm"/>
</constraints>
<color key="textColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
Expand All @@ -3223,13 +3220,23 @@
<color key="tintColor" systemColor="systemTealColor" red="0.35294117650000001" green="0.7843137255" blue="0.98039215690000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<state key="normal" image="square.and.arrow.up" catalog="system"/>
</button>
<segmentedControl opaque="NO" tag="3" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="hhK-2T-DGa">
<rect key="frame" x="16" y="8" width="129" height="32"/>
<segments>
<segment title="receive"/>
<segment title="change"/>
</segments>
</segmentedControl>
</subviews>
<constraints>
<constraint firstItem="rVY-pv-74N" firstAttribute="leading" secondItem="f5e-Sk-Vgh" secondAttribute="trailing" constant="8" id="3fu-uc-2Ze"/>
<constraint firstItem="f5e-Sk-Vgh" firstAttribute="leading" secondItem="gjG-jc-dnU" secondAttribute="leading" constant="8" id="7pN-kF-S5T"/>
<constraint firstItem="f5e-Sk-Vgh" firstAttribute="centerY" secondItem="gjG-jc-dnU" secondAttribute="centerY" id="OA2-5h-xuk"/>
<constraint firstItem="hhK-2T-DGa" firstAttribute="top" secondItem="gjG-jc-dnU" secondAttribute="top" constant="8" id="EBt-tC-T3v"/>
<constraint firstItem="rVY-pv-74N" firstAttribute="top" secondItem="gjG-jc-dnU" secondAttribute="topMargin" id="cYi-5E-TLq"/>
<constraint firstItem="rVY-pv-74N" firstAttribute="trailing" secondItem="gjG-jc-dnU" secondAttribute="trailingMargin" id="gfX-19-KZY"/>
<constraint firstAttribute="bottom" secondItem="f5e-Sk-Vgh" secondAttribute="bottom" constant="8" id="pRE-oo-LPn"/>
<constraint firstItem="hhK-2T-DGa" firstAttribute="leading" secondItem="gjG-jc-dnU" secondAttribute="leading" constant="16" id="vA1-L5-cSb"/>
<constraint firstItem="f5e-Sk-Vgh" firstAttribute="top" secondItem="hhK-2T-DGa" secondAttribute="bottom" constant="8" id="zzw-0E-F24"/>
</constraints>
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
Expand Down Expand Up @@ -3314,7 +3321,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="y6X-dL-UYm" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-8106" y="2552"/>
<point key="canvasLocation" x="-8106.3999999999996" y="2551.5742128935535"/>
</scene>
<!--Create Fully Noded Wallet View Controller-->
<scene sceneID="92q-bk-EIf">
Expand Down Expand Up @@ -4924,7 +4931,7 @@ If you add a fingerprint your extended key will derive addresses as if it is an
</objects>
<point key="canvasLocation" x="-2791.1999999999998" y="375.56221889055473"/>
</scene>
<!--v0.2.1-->
<!--v0.2.2-->
<scene sceneID="Ajv-p7-tUm">
<objects>
<viewController extendedLayoutIncludesOpaqueBars="YES" id="AS8-ke-Yxh" customClass="SettingsViewController" customModule="FullyNoded" customModuleProvider="target" sceneMemberID="viewController">
Expand Down Expand Up @@ -5024,7 +5031,7 @@ If you add a fingerprint your extended key will derive addresses as if it is an
<viewLayoutGuide key="safeArea" id="Cze-jj-bFe"/>
</view>
<tabBarItem key="tabBarItem" title="" image="Settings" id="n34-O3-Fyo"/>
<navigationItem key="navigationItem" title="v0.2.1" id="YNb-Gd-Hqq"/>
<navigationItem key="navigationItem" title="v0.2.2" id="YNb-Gd-Hqq"/>
<connections>
<outlet property="settingsTable" destination="hcp-eG-lok" id="xPg-8r-KBs"/>
<segue destination="bKH-sI-MiM" kind="show" identifier="goLogIn" id="qed-hl-jG5"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -882,14 +882,14 @@ extension MainMenuViewController: OnionManagerDelegate {
self?.blurView.isHidden = true
}

// if KeyChain.getData("hasPaid") == nil {
// guard let data = KeyChain.getData("paymentAddress") else {
// goToPaywall()
// return
// }
//
// checkIfPaymentReceived(data.utf8)
// }
if KeyChain.getData("hasPaid") == nil {
guard let data = KeyChain.getData("paymentAddress") else {
goToPaywall()
return
}

checkIfPaymentReceived(data.utf8)
}
}

func torConnDifficulties() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class CreateMultisigViewController: UIViewController, UITextViewDelegate, UIText
@IBOutlet weak var createOutlet: UIButton!
@IBOutlet weak var addOutlet: UIButton!


override func viewDidLoad() {
super.viewDidLoad()

Expand Down Expand Up @@ -398,17 +397,11 @@ class CreateMultisigViewController: UIViewController, UITextViewDelegate, UIText
if extendedKey.hasPrefix("xpub") || extendedKey.hasPrefix("tpub") {
if let _ = XpubConverter.zpub(xpub: extendedKey) {
showAddButton()
} else {
//updateXpubField("")
//showAlert(vc: self, title: "Error", message: "Invalid xpub")
}
} else if extendedKey.hasPrefix("Zpub") || extendedKey.hasPrefix("Vpub") {
if let xpub = XpubConverter.convert(extendedKey: extendedKey) {
updateXpubField(xpub)
showAddButton()
} else {
//updateXpubField("")
//showAlert(vc: self, title: "Error", message: "Invalid extended key. It must be either an xpub, tpub, Zpub or Vpub")
}
} else if extendedKey.hasPrefix("[") {
let p = DescriptorParser()
Expand All @@ -417,10 +410,7 @@ class CreateMultisigViewController: UIViewController, UITextViewDelegate, UIText
let key = descriptor.accountXpub
let fingerprint = descriptor.fingerprint

guard key != "", fingerprint != "" else {
//showAlert(vc: self, title: "Invalid format", message: "Sorry we do not recognize that format yet, please reach out on Twitter, Telegram or GitHub and let us know.")
return
}
guard key != "", fingerprint != "" else { return }

DispatchQueue.main.async { [weak self] in
guard let self = self else { return }
Expand All @@ -432,7 +422,6 @@ class CreateMultisigViewController: UIViewController, UITextViewDelegate, UIText
let xfp = json["xfp"] as? String,
let xpub = json["xpub"] as? String,
let path = json["path"] as? String else {
//showAlert(vc: self, title: "Not a recognized keystore...", message: "Please reach out so we can fix this.")
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class WalletDetailViewController: UIViewController, UITextFieldDelegate, UITable
var backupText = ""
var textToShow = ""
var json = ""
var showReceive = 0
var alertStyle = UIAlertController.Style.actionSheet
private var labelField: UITextField!
private var labelButton: UIButton!
Expand Down Expand Up @@ -145,10 +146,14 @@ class WalletDetailViewController: UIViewController, UITextFieldDelegate, UITable
self.addresses += "#\(i): \(address)\n\n"
if i + 1 == addr.count {
DispatchQueue.main.async { [weak self] in
self?.spinner.removeConnectingView()
self?.detailTable.reloadSections(IndexSet(arrayLiteral: Section.addressExplorer.rawValue), with: .none)
}
}
}
} else {
self?.spinner.removeConnectingView()
showAlert(vc: self, title: "We were unable to derive your addresses", message: "")
}
}
}
Expand Down Expand Up @@ -673,6 +678,10 @@ class WalletDetailViewController: UIViewController, UITextFieldDelegate, UITable
let exportButton = cell.viewWithTag(2) as! UIButton
configureExportButton(exportButton, indexPath: indexPath)

let segmentedControl = cell.viewWithTag(3) as! UISegmentedControl
segmentedControl.selectedSegmentIndex = showReceive
segmentedControl.addTarget(self, action: #selector(updateAddressExplorer(_:)), for: .valueChanged)

return cell
}

Expand Down Expand Up @@ -848,6 +857,19 @@ class WalletDetailViewController: UIViewController, UITextFieldDelegate, UITable
return 60
}

@objc func updateAddressExplorer(_ sender: UISegmentedControl) {
showReceive = sender.selectedSegmentIndex
addresses = ""

if showReceive == 0 {
spinner.addConnectingView(vc: self, description: "deriving receive addresses...")
deriveAddresses(wallet.receiveDescriptor)
} else {
spinner.addConnectingView(vc: self, description: "deriving change addresses...")
deriveAddresses(wallet.changeDescriptor)
}
}

@objc func increaseGapLimit() {
var max = Int(wallet.maxIndex) + 2500
if max > 99999 {
Expand Down

0 comments on commit ee81ca1

Please sign in to comment.