diff --git a/Cartfile b/Cartfile index 58c489dc..f449d01d 100644 --- a/Cartfile +++ b/Cartfile @@ -10,5 +10,5 @@ github "xmartlabs/Eureka" ~> 4.3 github "krzyzanowskim/CryptoSwift" github "vergecurrency/BitcoinKit" ~> 1.2.0 github "Swinject/Swinject" ~> 2.6.0 -github "Swinject/SwinjectStoryboard" +github "Swinject/SwinjectStoryboard" "master" github "google/promises" diff --git a/Cartfile.resolved b/Cartfile.resolved index a7663d92..c454b664 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,14 +1,14 @@ binary "https://icepa.github.io/Tor.framework/Tor.json" "305.8.1" github "HamzaGhazouani/HGPlaceholders" "0.4.0" -github "JohnEstropia/CoreStore" "6.3.2" +github "JohnEstropia/CoreStore" "7.0.1" github "SwiftyJSON/SwiftyJSON" "5.0.0" github "Swinject/Swinject" "2.7.1" -github "Swinject/SwinjectStoryboard" "2.2.0" -github "danielgindi/Charts" "v3.3.0" +github "Swinject/SwinjectStoryboard" "0ca45c83a8aa398c153d8a036c95abb4343cfa0c" +github "danielgindi/Charts" "v3.4.0" github "evgenyneu/keychain-swift" "11.0.0" github "gmotzespina/QRCode" "c07e17120ffb34fdfa7ec1f3a85bc1afd39cfdc2" github "google/promises" "1.2.8" github "hackiftekhar/IQKeyboardManager" "v6.1.1" -github "krzyzanowskim/CryptoSwift" "1.0.0" +github "krzyzanowskim/CryptoSwift" "1.1.3" github "vergecurrency/BitcoinKit" "v1.2.1" github "xmartlabs/Eureka" "4.3.1" diff --git a/VergeiOS.xcodeproj/project.pbxproj b/VergeiOS.xcodeproj/project.pbxproj index 0697daaf..51144852 100644 --- a/VergeiOS.xcodeproj/project.pbxproj +++ b/VergeiOS.xcodeproj/project.pbxproj @@ -2470,8 +2470,8 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CF_BUNDLE_BUILD_VERSION_STRING = 201909300001; - CF_BUNDLE_SHORT_VERSION_STRING = 1.2.1; + CF_BUNDLE_BUILD_VERSION_STRING = 201911060001; + CF_BUNDLE_SHORT_VERSION_STRING = 1.2.2; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; @@ -2534,8 +2534,8 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - CF_BUNDLE_BUILD_VERSION_STRING = 201909300001; - CF_BUNDLE_SHORT_VERSION_STRING = 1.2.1; + CF_BUNDLE_BUILD_VERSION_STRING = 201911060001; + CF_BUNDLE_SHORT_VERSION_STRING = 1.2.2; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; diff --git a/VergeiOS/Extensions/Notification+Names.swift b/VergeiOS/Extensions/Notification+Names.swift index 42921f8f..eec983cd 100644 --- a/VergeiOS/Extensions/Notification+Names.swift +++ b/VergeiOS/Extensions/Notification+Names.swift @@ -19,6 +19,7 @@ extension Notification.Name { static let didChangeWalletAmount = Notification.Name("didChangeWalletAmount") static let didChangeReceiveAddress = Notification.Name("didChangeReceiveAddress") + static let didFinishTorStart = Notification.Name("didFinishTorStart") static let didStartTorThread = Notification.Name("didStartTorThread") static let didConnectTorController = Notification.Name("didConnectTorController") static let didEstablishTorConnection = Notification.Name("didEstablishTorConnection") diff --git a/VergeiOS/Http/TorClient.swift b/VergeiOS/Http/TorClient.swift index 17309d50..52a379ce 100644 --- a/VergeiOS/Http/TorClient.swift +++ b/VergeiOS/Http/TorClient.swift @@ -59,6 +59,8 @@ class TorClient { func start(completion: @escaping () -> Void) { // If already operational don't start a new client. if isOperational || turnedOff() { + NotificationCenter.default.post(name: .didFinishTorStart, object: self) +print("hierroeroero") return completion() } @@ -79,7 +81,11 @@ class TorClient { DispatchQueue.main.asyncAfter(deadline: .now() + 2) { // Connect Tor controller. - self.connectController(completion: completion) + self.connectController { + NotificationCenter.default.post(name: .didFinishTorStart, object: self) + + completion() + } } } diff --git a/VergeiOS/Providers/CoreStoreServiceProvider.swift b/VergeiOS/Providers/CoreStoreServiceProvider.swift index 0dbb61e9..0dfc1795 100644 --- a/VergeiOS/Providers/CoreStoreServiceProvider.swift +++ b/VergeiOS/Providers/CoreStoreServiceProvider.swift @@ -10,7 +10,7 @@ class CoreStoreServiceProvider: ServiceProvider { override func boot() { do { - CoreStore.defaultStack = DataStack( + CoreStoreDefaults.dataStack = DataStack( xcodeModelName: "CoreData", bundle: Bundle.main, migrationChain: [ diff --git a/VergeiOS/Providers/WalletServiceProvider.swift b/VergeiOS/Providers/WalletServiceProvider.swift index 90aa0bd5..10bcf899 100644 --- a/VergeiOS/Providers/WalletServiceProvider.swift +++ b/VergeiOS/Providers/WalletServiceProvider.swift @@ -23,13 +23,11 @@ class WalletServiceProvider: ServiceProvider { self.registerAddressBookRepository() self.registerSweeperHelper() self.registerWalletManager() - } - override func boot() { NotificationCenter.default.addObserver( self, selector: #selector(bootServerMigration(notification:)), - name: .didEstablishTorConnection, + name: .didFinishTorStart, object: nil ) } @@ -141,7 +139,7 @@ class WalletServiceProvider: ServiceProvider { let applicationRepository = self.container.resolve(ApplicationRepository.self)! // Check if the deprecated VWS endpoints are in the users memory. - if !Constants.deprecatedBwsEndpoints.contains(applicationRepository.walletServiceUrl) { + if applicationRepository.isWalletServiceUrlSet && !Constants.deprecatedBwsEndpoints.contains(applicationRepository.walletServiceUrl) { return print("No deprecated VWS endpoints found.") } diff --git a/VergeiOS/Repositories/ApplicationRepository.swift b/VergeiOS/Repositories/ApplicationRepository.swift index 72b0bc5e..a481c350 100644 --- a/VergeiOS/Repositories/ApplicationRepository.swift +++ b/VergeiOS/Repositories/ApplicationRepository.swift @@ -16,7 +16,7 @@ class ApplicationRepository { // Is the wallet already setup? var setup: Bool { - return self.mnemonic?.count == 12 && (self.passphrase?.count ?? 0) > 7 + return self.mnemonic?.count == 12 && (self.passphrase?.count ?? 0) > 7 && self.pin != "" } // Store the wallet pin in the app key chain. @@ -31,6 +31,10 @@ class ApplicationRepository { var pinCount: Int { get { + if self.pin.count > 0 { + self.pinCount = self.pin.count + } + userDefaults.register(defaults: ["wallet.pinCount": 6]) return userDefaults.integer(forKey: "wallet.pinCount") } @@ -143,6 +147,10 @@ class ApplicationRepository { } } + var isWalletServiceUrlSet: Bool { + return !(keychain.get("wallet.service.url")?.isEmpty ?? true) + } + var walletId: String? { get { return keychain.get("wallet.id") diff --git a/VergeiOS/Wallet/WalletClient.swift b/VergeiOS/Wallet/WalletClient.swift index 977bacf1..7c6397cc 100644 --- a/VergeiOS/Wallet/WalletClient.swift +++ b/VergeiOS/Wallet/WalletClient.swift @@ -251,6 +251,10 @@ extension WalletClient { } print(jsonResponse) + + if jsonResponse["code"].stringValue == "WALLET_NOT_FOUND" { + return completion(NSError(domain: "Wallet not found", code: 404, userInfo: nil)) + } if jsonResponse["code"].stringValue == "COPAYER_REGISTERED" { self.openWallet { error in