diff --git a/FullyNoded.xcodeproj/project.pbxproj b/FullyNoded.xcodeproj/project.pbxproj index 86f938e1..1c041b3a 100644 --- a/FullyNoded.xcodeproj/project.pbxproj +++ b/FullyNoded.xcodeproj/project.pbxproj @@ -164,7 +164,6 @@ D0C4EE6F24F0EC9B003C929A /* BitSense.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = D0C4EE6D24F0EC9B003C929A /* BitSense.xcdatamodeld */; }; D0CC0E2024F0F35A001BF905 /* Peers.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0CC0E1F24F0F35A001BF905 /* Peers.swift */; }; D0CC0E2224F0FA98001BF905 /* PeerDetailsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0CC0E2124F0FA98001BF905 /* PeerDetailsViewController.swift */; }; - D0CC0E2424F2069D001BF905 /* NoiseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0CC0E2324F2069D001BF905 /* NoiseViewController.swift */; }; D0D4B9A624DA616300572811 /* Lightning.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0D4B9A524DA616300572811 /* Lightning.swift */; }; D0D71DA32351F835005CCDB9 /* UtilitieMenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0D71DA22351F835005CCDB9 /* UtilitieMenuViewController.swift */; }; D0DBC7062501CEFE00F6787C /* VerifyTransactionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0DBC7052501CEFE00F6787C /* VerifyTransactionViewController.swift */; }; @@ -373,7 +372,6 @@ D0CB48902435B32E0072D1F5 /* Commands.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Commands.swift; sourceTree = ""; }; D0CC0E1F24F0F35A001BF905 /* Peers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Peers.swift; sourceTree = ""; }; D0CC0E2124F0FA98001BF905 /* PeerDetailsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PeerDetailsViewController.swift; sourceTree = ""; }; - D0CC0E2324F2069D001BF905 /* NoiseViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoiseViewController.swift; sourceTree = ""; }; D0D4B9A524DA616300572811 /* Lightning.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Lightning.swift; sourceTree = ""; }; D0D507E6256FA0E30048AB2F /* FullyNodedRelease.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = FullyNodedRelease.entitlements; sourceTree = ""; }; D0D71DA22351F835005CCDB9 /* UtilitieMenuViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UtilitieMenuViewController.swift; sourceTree = ""; }; @@ -453,7 +451,6 @@ D011702724EBA3CE00ACC44B /* ChannelDetailViewController.swift */, D03F65F024EFB25100901D06 /* KeySendViewController.swift */, D0CC0E2124F0FA98001BF905 /* PeerDetailsViewController.swift */, - D0CC0E2324F2069D001BF905 /* NoiseViewController.swift */, ); path = Lightning; sourceTree = ""; @@ -1178,7 +1175,6 @@ D037C876231CAFD9006C357D /* AddLabelViewController.swift in Sources */, D09A330D24A9B10E009FA0B2 /* BIP39WordList.swift in Sources */, D093E2A725A59B9C0038B59A /* TransactionStruct.swift in Sources */, - D0CC0E2424F2069D001BF905 /* NoiseViewController.swift in Sources */, D0233F282361EA5F0041FFBA /* shim.swift in Sources */, D0F3919424C0147400EA8A2A /* QRScannerViewController.swift in Sources */, D05692E321434452006DF0F4 /* MainMenuViewController.swift in Sources */, @@ -1468,7 +1464,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 328; + CURRENT_PROJECT_VERSION = 329; DEVELOPMENT_TEAM = 8JHDU5M9KD; "ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -1479,7 +1475,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.408; + MARKETING_VERSION = 1.409; PRODUCT_BUNDLE_IDENTIFIER = com.fontaine.FullyNoded; "PRODUCT_BUNDLE_IDENTIFIER[sdk=macosx*]" = com.fontaine.fullynodedmacos; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -1504,7 +1500,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 328; + CURRENT_PROJECT_VERSION = 329; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = 8JHDU5M9KD; "ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES; @@ -1517,7 +1513,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.408; + MARKETING_VERSION = 1.409; PRODUCT_BUNDLE_IDENTIFIER = com.fontaine.FullyNoded; "PRODUCT_BUNDLE_IDENTIFIER[sdk=macosx*]" = com.fontaine.fullynodedmacos; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/FullyNoded/Base.lproj/Main.storyboard b/FullyNoded/Base.lproj/Main.storyboard index caaff110..17ed9ce6 100644 --- a/FullyNoded/Base.lproj/Main.storyboard +++ b/FullyNoded/Base.lproj/Main.storyboard @@ -4252,6 +4252,16 @@ xxxxx + + + + + + + + + + @@ -4260,7 +4270,9 @@ xxxxx + + @@ -4273,6 +4285,7 @@ xxxxx + @@ -4866,7 +4879,7 @@ You can upload the wallets.fullynoded file that was created when you made the ba - + @@ -5013,7 +5026,7 @@ You can upload the wallets.fullynoded file that was created when you made the ba - + @@ -6745,7 +6758,7 @@ COLD means no keys will be generated and no private keys can be imported. - + - @@ -6821,7 +6822,6 @@ COLD means no keys will be generated and no private keys can be imported. - @@ -7042,109 +7042,6 @@ COLD means no keys will be generated and no private keys can be imported. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -7593,7 +7490,7 @@ COLD means no keys will be generated and no private keys can be imported. - + @@ -7620,7 +7517,6 @@ COLD means no keys will be generated and no private keys can be imported. - diff --git a/FullyNoded/FullyNoded.entitlements b/FullyNoded/FullyNoded.entitlements index 7cd9f9e9..a74a3e30 100644 --- a/FullyNoded/FullyNoded.entitlements +++ b/FullyNoded/FullyNoded.entitlements @@ -4,10 +4,6 @@ aps-environment development - com.apple.developer.applesignin - - Default - com.apple.developer.icloud-container-identifiers iCloud.com.fullynoded.backup diff --git a/FullyNoded/FullyNodedRelease.entitlements b/FullyNoded/FullyNodedRelease.entitlements index ed92ef2a..d741096f 100644 --- a/FullyNoded/FullyNodedRelease.entitlements +++ b/FullyNoded/FullyNodedRelease.entitlements @@ -4,10 +4,6 @@ aps-environment development - com.apple.developer.applesignin - - Default - com.apple.developer.icloud-container-identifiers iCloud.com.fullynoded.backup diff --git a/FullyNoded/Miscellaneous/Utilities.swift b/FullyNoded/Miscellaneous/Utilities.swift index 03b3a522..0d2c2e3a 100644 --- a/FullyNoded/Miscellaneous/Utilities.swift +++ b/FullyNoded/Miscellaneous/Utilities.swift @@ -184,6 +184,10 @@ public func hexStringToUIColor(hex:String) -> UIColor { ) } +public func currentDate() -> String { + return "NZdDCNBFTDqKPrUG9V80g0iVemSXLL0CuaWj12xqD00=" +} + public func isWalletRPC(command: BTC_CLI_COMMAND) -> Bool { var boolToReturn = Bool() diff --git a/FullyNoded/View Controllers/Home/Incoming/Invoice/InvoiceViewController.swift b/FullyNoded/View Controllers/Home/Incoming/Invoice/InvoiceViewController.swift index 37163832..67e0d021 100644 --- a/FullyNoded/View Controllers/Home/Incoming/Invoice/InvoiceViewController.swift +++ b/FullyNoded/View Controllers/Home/Incoming/Invoice/InvoiceViewController.swift @@ -26,6 +26,7 @@ class InvoiceViewController: UIViewController, UITextFieldDelegate { var isSats = false var isFiat = false + @IBOutlet weak var denominationControl: UISegmentedControl! @IBOutlet weak var addressImageView: UIImageView! @IBOutlet var amountField: UITextField! @IBOutlet var labelField: UITextField! @@ -54,11 +55,34 @@ class InvoiceViewController: UIViewController, UITextFieldDelegate { qrView.image = generateQrCode(key: "bitcoin:") generateOnchainInvoice() - if isFiat { + if isFiat || isBtc { isBtc = true + denominationControl.selectedSegmentIndex = 0 + } else if isSats { + denominationControl.selectedSegmentIndex = 1 } } + @IBAction func switchDenominationsAction(_ sender: UISegmentedControl) { + switch sender.selectedSegmentIndex { + case 0: + self.isBtc = true + self.isSats = false + self.isFiat = false + default: + self.isBtc = false + self.isSats = true + self.isFiat = false + } + + if self.invoiceText.text.hasPrefix("l") { + createLightningInvoice() + } else { + updateQRImage() + } + } + + private func setDelegates() { messageField.delegate = self amountField.delegate = self @@ -127,6 +151,10 @@ class InvoiceViewController: UIViewController, UITextFieldDelegate { } @IBAction func generateLightningAction(_ sender: Any) { + createLightningInvoice() + } + + private func createLightningInvoice() { spinner.addConnectingView(vc: self, description: "creating lightning invoice...") isLndNode { [weak self] isLnd in @@ -389,8 +417,8 @@ class InvoiceViewController: UIViewController, UITextFieldDelegate { if isSats { if amount != "" { - if let int = Int(amount) { - amount = (Double(int) / 100000000.0).avoidNotation + if let dbl = Double(amount) { + amount = (dbl / 100000000.0).avoidNotation } } } diff --git a/FullyNoded/View Controllers/Home/Outgoing/Raw Tx/CreateRawTxViewController.swift b/FullyNoded/View Controllers/Home/Outgoing/Raw Tx/CreateRawTxViewController.swift index cd1c4085..b25b9f54 100644 --- a/FullyNoded/View Controllers/Home/Outgoing/Raw Tx/CreateRawTxViewController.swift +++ b/FullyNoded/View Controllers/Home/Outgoing/Raw Tx/CreateRawTxViewController.swift @@ -1509,9 +1509,9 @@ class CreateRawTxViewController: UIViewController, UITextFieldDelegate, UITableV vc.doneBlock = { [weak self] confirmed in guard let self = self else { return } - self.spinner.addConnectingView(vc: self, description: "paying lightning invoice...") - if confirmed { + self.spinner.addConnectingView(vc: self, description: "paying lightning invoice...") + if let userSpecifiedAmount = self.invoice!["userSpecifiedAmount"] as? String { self.payLightningNow(invoice: self.invoiceString, msat: Int(userSpecifiedAmount)!, dict: self.invoice!) } else { diff --git a/FullyNoded/View Controllers/Settings/Node Manager/Lightning/NoiseViewController.swift b/FullyNoded/View Controllers/Settings/Node Manager/Lightning/NoiseViewController.swift deleted file mode 100644 index 41a24072..00000000 --- a/FullyNoded/View Controllers/Settings/Node Manager/Lightning/NoiseViewController.swift +++ /dev/null @@ -1,122 +0,0 @@ -// -// NoiseViewController.swift -// FullyNoded -// -// Created by Peter on 23/08/20. -// Copyright © 2020 Fontaine. All rights reserved. -// - -import UIKit - -class NoiseViewController: UIViewController { - - @IBOutlet weak var textView: UITextView! - var id = "" - let spinner = ConnectingView() - - override func viewDidLoad() { - super.viewDidLoad() - textView.layer.cornerRadius = 8 - textView.layer.borderWidth = 0.5 - textView.layer.borderColor = UIColor.lightGray.cgColor - addTapGesture() - } - - @IBAction func listenAction(_ sender: Any) { - listen() - } - - @IBAction func sendAction(_ sender: Any) { - send() - } - - private func listen() { - DispatchQueue.main.async { [weak self] in - self?.textView.text = "listening.... as soon as you receive a message it will show here, the timeout is set for 3 minutes" - } - let commandId = UUID() - LightningRPC.command(id: commandId, method: .recvmsg, param: "") { [weak self] (uuid, response, errorDesc) in - if commandId == uuid { - if let dict = response as? NSDictionary { - let body = dict["body"] as? String ?? "(error: body missing)" - let sender = dict["sender"] as? String ?? "(error: sender id missing)" - self?.fetchLocalPeers(id: sender) { (name) in - DispatchQueue.main.async { [weak self] in - let impact = UIImpactFeedbackGenerator() - impact.impactOccurred() - displayAlert(viewController: self, isError: false, message: "noise received ⚡️") - self?.textView.text = name + ":" + "\n\n" + body - } - } - } - } - } - } - - private func send() { - spinner.addConnectingView(vc: self, description: "sending noise...") - let commandId = UUID() - LightningRPC.command(id: commandId, method: .sendmsg, param: "\"\(id)\", \"\(textView.text ?? "I have nothing to say apparently...")\"") { (uuid, response, errorDesc) in - if commandId == uuid { - if let dict = response as? NSDictionary { - if let _ = dict["payment_hash"] as? String { - self.spinner.removeConnectingView() - showAlert(vc: self, title: "Noise sent!", message: "If you are expecting a reply back tap \"listen\"") - } else { - self.spinner.removeConnectingView() - showAlert(vc: self, title: "Hmmm something not quite right", message: "\(dict)") - } - } else { - self.spinner.removeConnectingView() - showAlert(vc: self, title: "Error", message: errorDesc ?? "unknown error sending message") - } - } - } - } - - private func fetchLocalPeers(id: String, completion: @escaping ((String)) -> Void) { - CoreDataService.retrieveEntity(entityName: .peers) { (peers) in - if peers != nil { - if peers!.count > 0 { - for peer in peers! { - let peerStruct = PeersStruct(dictionary: peer) - if id == peerStruct.pubkey { - if peerStruct.label != "" { - completion(peerStruct.label) - } else if peerStruct.alias != "" { - completion(peerStruct.alias) - } else { - completion(id) - } - } - } - } else { - completion(id) - } - } else { - completion(id) - } - } - } - - func addTapGesture() { - let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.dismissKeyboard (_:))) - tapGesture.numberOfTapsRequired = 1 - self.view.addGestureRecognizer(tapGesture) - } - - @objc func dismissKeyboard(_ sender: UITapGestureRecognizer) { - textView.resignFirstResponder() - } - - /* - // MARK: - Navigation - - // In a storyboard-based application, you will often want to do a little preparation before navigation - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { - // Get the new view controller using segue.destination. - // Pass the selected object to the new view controller. - } - */ - -} diff --git a/FullyNoded/View Controllers/Settings/Node Manager/Lightning/PeerDetailsViewController.swift b/FullyNoded/View Controllers/Settings/Node Manager/Lightning/PeerDetailsViewController.swift index 7e04ebc7..32013daa 100644 --- a/FullyNoded/View Controllers/Settings/Node Manager/Lightning/PeerDetailsViewController.swift +++ b/FullyNoded/View Controllers/Settings/Node Manager/Lightning/PeerDetailsViewController.swift @@ -278,12 +278,6 @@ class PeerDetailsViewController: UIViewController, UITextFieldDelegate { vc.peer = peer } } - - if segue.identifier == "segueToNoise" { - if let vc = segue.destination as? NoiseViewController { - vc.id = id - } - } } } diff --git a/FullyNoded/View Controllers/Settings/Security Center/SecurityCenterViewController.swift b/FullyNoded/View Controllers/Settings/Security Center/SecurityCenterViewController.swift index b472e888..c8f5d118 100644 --- a/FullyNoded/View Controllers/Settings/Security Center/SecurityCenterViewController.swift +++ b/FullyNoded/View Controllers/Settings/Security Center/SecurityCenterViewController.swift @@ -161,12 +161,12 @@ class SecurityCenterViewController: UIViewController, UITableViewDelegate, UITab } case 1: - if KeyChain.getData("userIdentifier") == nil { - add2fa() - } else { - promptToDisable2fa() - } - //showAlert(vc: self, title: "", message: "This feature is not available for the dmg.") +// if KeyChain.getData("userIdentifier") == nil { +// add2fa() +// } else { +// promptToDisable2fa() +// } + showAlert(vc: self, title: "", message: "This feature is not available for the dmg.") case 2: DispatchQueue.main.async { [unowned vc = self] in vc.performSegue(withIdentifier: "addPasswordSegue", sender: vc)