Skip to content

Commit

Permalink
fix: mac app icon
Browse files Browse the repository at this point in the history
refactor: start refactoring
fix: native desc wallets wild card address import was broekn
  • Loading branch information
Fonta1n3 committed Aug 13, 2021
1 parent dfd8180 commit 9d1873d
Show file tree
Hide file tree
Showing 33 changed files with 270 additions and 1,288 deletions.
16 changes: 10 additions & 6 deletions FullyNoded.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
0A1F110926A2783000BE2707 /* Asset.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A1F110426A2783000BE2707 /* Asset.swift */; };
0A1F110C26A278C100BE2707 /* ModelObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A1F110B26A278C100BE2707 /* ModelObject.swift */; };
0A1F111026A2791B00BE2707 /* ModelObjectType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A1F110F26A2791B00BE2707 /* ModelObjectType.swift */; };
0A212D8B26C66A9600BF6FD4 /* OnchainUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A212D8A26C66A9600BF6FD4 /* OnchainUtils.swift */; };
0A212D8D26C66B1800BF6FD4 /* DescriptorInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A212D8C26C66B1800BF6FD4 /* DescriptorInfo.swift */; };
0A21442C26B4282300123EAC /* PromptForAuthViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A21442B26B4282300123EAC /* PromptForAuthViewController.swift */; };
0A3013D8266B361E004DA35C /* LndRpc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A3013D7266B361E004DA35C /* LndRpc.swift */; };
0A590357269875CD00510626 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A590356269875CB00510626 /* Extensions.swift */; };
Expand Down Expand Up @@ -137,7 +139,6 @@
D09A330724A982F3009FA0B2 /* FullyNodedWalletsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D09A330624A982F2009FA0B2 /* FullyNodedWalletsViewController.swift */; };
D09A330924A98EE1009FA0B2 /* WalletDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D09A330824A98EE1009FA0B2 /* WalletDetailViewController.swift */; };
D09A330D24A9B10E009FA0B2 /* BIP39WordList.swift in Sources */ = {isa = PBXBuildFile; fileRef = D09A330C24A9B10E009FA0B2 /* BIP39WordList.swift */; };
D09A330F24A9B853009FA0B2 /* RecoveryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D09A330E24A9B853009FA0B2 /* RecoveryViewController.swift */; };
D09A331124AC4BF6009FA0B2 /* DescriptorParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = D09A331024AC4BF6009FA0B2 /* DescriptorParser.swift */; };
D09A331324AC4C93009FA0B2 /* Descriptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = D09A331224AC4C93009FA0B2 /* Descriptor.swift */; };
D09F9E4C24B0673C006B588C /* SignersViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D09F9E4B24B0673C006B588C /* SignersViewController.swift */; };
Expand Down Expand Up @@ -227,6 +228,8 @@
0A1F110426A2783000BE2707 /* Asset.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Asset.swift; sourceTree = "<group>"; };
0A1F110B26A278C100BE2707 /* ModelObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModelObject.swift; sourceTree = "<group>"; };
0A1F110F26A2791B00BE2707 /* ModelObjectType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModelObjectType.swift; sourceTree = "<group>"; };
0A212D8A26C66A9600BF6FD4 /* OnchainUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnchainUtils.swift; sourceTree = "<group>"; };
0A212D8C26C66B1800BF6FD4 /* DescriptorInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DescriptorInfo.swift; sourceTree = "<group>"; };
0A21442B26B4282300123EAC /* PromptForAuthViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromptForAuthViewController.swift; sourceTree = "<group>"; };
0A3013D7266B361E004DA35C /* LndRpc.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LndRpc.swift; sourceTree = "<group>"; };
0A590356269875CB00510626 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -342,7 +345,6 @@
D09A330624A982F2009FA0B2 /* FullyNodedWalletsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FullyNodedWalletsViewController.swift; sourceTree = "<group>"; };
D09A330824A98EE1009FA0B2 /* WalletDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletDetailViewController.swift; sourceTree = "<group>"; };
D09A330C24A9B10E009FA0B2 /* BIP39WordList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BIP39WordList.swift; sourceTree = "<group>"; };
D09A330E24A9B853009FA0B2 /* RecoveryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecoveryViewController.swift; sourceTree = "<group>"; };
D09A331024AC4BF6009FA0B2 /* DescriptorParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DescriptorParser.swift; sourceTree = "<group>"; };
D09A331224AC4C93009FA0B2 /* Descriptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Descriptor.swift; sourceTree = "<group>"; };
D09F9E4B24B0673C006B588C /* SignersViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignersViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -642,6 +644,7 @@
0A3013D7266B361E004DA35C /* LndRpc.swift */,
0A9834BE26BBC93F00BAB74E /* CoreDataiCloud.swift */,
0A9834C326BBCCB300BAB74E /* Backup.swift */,
0A212D8A26C66A9600BF6FD4 /* OnchainUtils.swift */,
);
path = Helpers;
sourceTree = "<group>";
Expand Down Expand Up @@ -715,6 +718,7 @@
D093E2A625A59B9C0038B59A /* TransactionStruct.swift */,
0A59035C269B0CA700510626 /* InvoiceStruct.swift */,
0A77138526AE5E85005CC23D /* WalletInfo.swift */,
0A212D8C26C66B1800BF6FD4 /* DescriptorInfo.swift */,
);
path = Structs;
sourceTree = "<group>";
Expand Down Expand Up @@ -919,7 +923,6 @@
D09A330024A848DA009FA0B2 /* SeedDisplayerViewController.swift */,
D09A330624A982F2009FA0B2 /* FullyNodedWalletsViewController.swift */,
D09A330824A98EE1009FA0B2 /* WalletDetailViewController.swift */,
D09A330E24A9B853009FA0B2 /* RecoveryViewController.swift */,
D09F9E4B24B0673C006B588C /* SignersViewController.swift */,
D09F9E4F24B1BAC3006B588C /* SignerDetailViewController.swift */,
D09F9E5124B1F8DE006B588C /* AddSignerViewController.swift */,
Expand Down Expand Up @@ -1190,6 +1193,7 @@
D0DBC7062501CEFE00F6787C /* VerifyTransactionViewController.swift in Sources */,
D0855FCA22B0CEA800DBBFC2 /* CreatePSBT.swift in Sources */,
0A1F110726A2783000BE2707 /* KeyType.swift in Sources */,
0A212D8B26C66A9600BF6FD4 /* OnchainUtils.swift in Sources */,
D02094F3225936D2002E8E7A /* ConnectingView.swift in Sources */,
D09F9E5224B1F8DE006B588C /* AddSignerViewController.swift in Sources */,
D0196DDB21B5AC5F0081E0AB /* KeyPad.swift in Sources */,
Expand Down Expand Up @@ -1277,7 +1281,6 @@
D0560EE92277F75900C3E909 /* UTXOViewController.swift in Sources */,
D0257E6524D6C5F5000EB854 /* LightningRPC.swift in Sources */,
D00F851D2494A616008D7CD3 /* TorAuthViewController.swift in Sources */,
D09A330F24A9B853009FA0B2 /* RecoveryViewController.swift in Sources */,
D0C20EDA24A6E46E00C62AA4 /* Uptime.swift in Sources */,
D09A330124A848DA009FA0B2 /* SeedDisplayerViewController.swift in Sources */,
D06D788F25B817E100769157 /* Lifehash.swift in Sources */,
Expand All @@ -1292,6 +1295,7 @@
D0EDDF1124972CEF00657931 /* InvoiceSettingsViewController.swift in Sources */,
D069051F24EA6C1F007F939D /* LightningPeersViewController.swift in Sources */,
0A1F111026A2791B00BE2707 /* ModelObjectType.swift in Sources */,
0A212D8D26C66B1800BF6FD4 /* DescriptorInfo.swift in Sources */,
D084960422EBCD3B003FE8EB /* GetInfoViewController.swift in Sources */,
D073E16E22558CDE0012A28C /* CoreDataService.swift in Sources */,
D0E54DD525207A1C00BD859E /* UTXOs.swift in Sources */,
Expand Down Expand Up @@ -1457,7 +1461,7 @@
D00B9A3A2111427200E8B95A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-4";
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-6";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = FullyNoded/FullyNoded.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
Expand Down Expand Up @@ -1494,7 +1498,7 @@
D00B9A3B2111427200E8B95A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-4";
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-6";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = FullyNoded/FullyNodedRelease.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed FullyNoded/Assets.xcassets/AppIcon-6.appiconset/16.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 10 additions & 10 deletions FullyNoded/Assets.xcassets/AppIcon-6.appiconset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,61 +151,61 @@
"size" : "1024x1024"
},
{
"filename" : "16.png",
"filename" : "16_fully noded logo copy.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"filename" : "32.png",
"filename" : "32_fully noded logo copy.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"filename" : "32-1.png",
"filename" : "32_fully noded logo copy-1.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"filename" : "64.png",
"filename" : "64_fully noded logo.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"filename" : "128.png",
"filename" : "128_fully noded logo.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"filename" : "256-1.png",
"filename" : "256_fully noded logo copy 5.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"filename" : "256.png",
"filename" : "256_fully noded logo copy 5-1.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"filename" : "512-1.png",
"filename" : "512_fully noded logo.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"filename" : "512.png",
"filename" : "512_fully noded logo-1.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"filename" : "1024-1.png",
"filename" : "1024_fully noded logo.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
Expand Down
111 changes: 111 additions & 0 deletions FullyNoded/Helpers/OnchainUtils.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
//
// OnchainUtils.swift
// FullyNoded
//
// Created by Peter Denton on 8/13/21.
// Copyright © 2021 Fontaine. All rights reserved.
//

import Foundation

class OnchainUtils {
static func getDescriptorInfo(_ desc: String, completion: @escaping ((descriptorInfo: DescriptorInfo?, message: String?)) -> Void) {
Reducer.makeCommand(command: .getdescriptorinfo, param: "\"\(desc)\"") { (response, message) in
guard let response = response as? [String:Any] else {
completion((nil, message ?? "Unknown error."))
return
}

completion((DescriptorInfo(response), nil))
}
}

static func importDescriptors(_ param: String, completion: @escaping ((imported: Bool, message: String?)) -> Void) {
Reducer.makeCommand(command: .importdescriptors, param: param) { (response, message) in
guard let responseArray = response as? [[String:Any]] else {
completion((false, "Error importing descriptors: \(message ?? "unknown error")"))
return
}

var warnings:String?

for (i, response) in responseArray.enumerated() {
var errorMessage = ""

guard let success = response["success"] as? Bool, success else {
if let error = response["error"] as? [String:Any], let messageCheck = error["message"] as? String {
errorMessage = "Error importing descriptors: \(messageCheck)"
}

completion((false, errorMessage))
return
}

if let warningsCheck = response["warnings"] as? [String] {
warnings = warningsCheck.description
}

if i + 1 == responseArray.count {
completion((true, warnings))
}
}
}
}

static func importMulti(_ param: String, completion: @escaping ((imported: Bool, message: String?)) -> Void) {
Reducer.makeCommand(command: .importmulti, param: param) { (response, errorDescription) in
guard let result = response as? NSArray, result.count > 0,
let dict = result[0] as? NSDictionary,
let success = dict["success"] as? Bool,
success else {
completion((false, errorDescription ?? "unknown error importing your keys"))
return
}

completion((success, nil))
}
}

static func rescan(completion: @escaping ((started: Bool, message: String?)) -> Void) {
OnchainUtils.getBlockchainInfo { (blockchainInfo, message) in
guard let blockchainInfo = blockchainInfo else {
completion((false, message))
return
}

guard blockchainInfo.pruned else {
OnchainUtils.rescanNow(from: "0") { (started, message) in
completion((started, message))
}

return
}

OnchainUtils.rescanNow(from: "\(blockchainInfo.pruneheight)") { (started, message) in
completion((started, message))
}
}
}

static func getBlockchainInfo(completion: @escaping ((blockchainInfo: BlockchainInfo?, message: String?)) -> Void) {
Reducer.makeCommand(command: .getblockchaininfo, param: "") { (response, errorMessage) in
guard let dict = response as? [String:Any] else {
completion((nil, errorMessage))
return
}

completion((BlockchainInfo(dict), errorMessage))
}
}

static func rescanNow(from: String, completion: @escaping ((started: Bool, message: String?)) -> Void) {
Reducer.makeCommand(command: .rescanblockchain, param: "0") { (_, message) in
if let message = message, message.contains("Wallet is currently rescanning. Abort existing rescan or wait.") {
completion((true, nil))
} else {
completion((true, message))
}
}
}

}
7 changes: 4 additions & 3 deletions FullyNoded/Structs/BlockchainInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@ public struct BlockchainInfo: CustomStringConvertible {
let progress:String
let pruned:Bool
let actualProgress:Double
init(dictionary: [String: Any]) {

let pruneheight:Int

init(_ dictionary: [String: Any]) {
self.network = dictionary["chain"] as? String ?? ""
self.blockheight = dictionary["blocks"] as? Int ?? 0
self.difficulty = dictionary["difficulty"] as? String ?? ""
self.size = dictionary["size"] as? String ?? ""
self.progress = dictionary["progress"] as? String ?? ""
self.pruned = dictionary["pruned"] as? Bool ?? false
self.actualProgress = dictionary["actualProgress"] as? Double ?? 0.0

self.pruneheight = dictionary["pruneheight"] as? Int ?? 0
}

public var description: String {
Expand Down
46 changes: 46 additions & 0 deletions FullyNoded/Structs/DescriptorInfo.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// DescriptorInfo.swift
// FullyNoded
//
// Created by Peter Denton on 8/13/21.
// Copyright © 2021 Fontaine. All rights reserved.
//

import Foundation

public struct DescriptorInfo: CustomStringConvertible {

/*
{ (json object)
"descriptor" : "str", (string) The descriptor in canonical form, without private keys
"checksum" : "str", (string) The checksum for the input descriptor
"isrange" : true|false, (boolean) Whether the descriptor is ranged
"issolvable" : true|false, (boolean) Whether the descriptor is solvable
"hasprivatekeys" : true|false (boolean) Whether the input descriptor contained at least one private key
}
*/

let checksum: String
let hasprivatekeys: Bool
let issolvable: Bool
let isrange: Bool
let descriptor: String

init(_ dictionary: [String: Any]) {
hasprivatekeys = dictionary["hasprivatekeys"] as! Bool
checksum = dictionary["checksum"] as! String

if hasprivatekeys {
descriptor = (dictionary["descriptor"] as! String) + "#" + checksum
} else {
descriptor = (dictionary["descriptor"] as! String)
}

issolvable = dictionary["issolvable"] as! Bool
isrange = dictionary["isrange"] as! Bool
}

public var description: String {
return ""
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ class MainMenuViewController: UIViewController {
DispatchQueue.main.async { [weak self] in
guard let self = self else { return }

self.blockchainInfo = BlockchainInfo(dictionary: response)
self.blockchainInfo = BlockchainInfo(response)
self.mainMenu.reloadSections(IndexSet(arrayLiteral: 0, 3, 5, 7, 8, 9), with: .fade)
self.getPeerInfo()
}
Expand Down
Loading

0 comments on commit 9d1873d

Please sign in to comment.