From 1fe81fa140095dc62f3445f0cb67a51dcd127dea Mon Sep 17 00:00:00 2001 From: Andrei Ashikhmin Date: Thu, 23 May 2024 15:01:32 +0700 Subject: [PATCH] fix: rate and home vc crash --- DashWallet.xcodeproj/project.pbxproj | 24 +++++++++---------- .../Data Provider/RatesProvider.swift | 9 +++---- .../Sources/UI/Home/HomeViewController.swift | 2 +- .../UI/Main/MainTabbarController.swift | 2 +- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/DashWallet.xcodeproj/project.pbxproj b/DashWallet.xcodeproj/project.pbxproj index 97d9883a9..30b1d679b 100644 --- a/DashWallet.xcodeproj/project.pbxproj +++ b/DashWallet.xcodeproj/project.pbxproj @@ -10171,7 +10171,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = dashwallet/dashwallet.entitlements; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 11; DEVELOPMENT_TEAM = 44RJ69WHFF; EXCLUDED_ARCHS = ""; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = ""; @@ -10301,7 +10301,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = dashwallet/dashwallet.entitlements; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 11; DEVELOPMENT_TEAM = 44RJ69WHFF; EXCLUDED_ARCHS = ""; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -10507,7 +10507,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 11; DEVELOPMENT_TEAM = 44RJ69WHFF; EXCLUDED_ARCHS = ""; IBSC_MODULE = WatchApp_Extension; @@ -10529,7 +10529,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 11; DEVELOPMENT_TEAM = 44RJ69WHFF; EXCLUDED_ARCHS = ""; IBSC_MODULE = WatchApp_Extension; @@ -10549,7 +10549,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = C98AA93FF5283EC6405BCE4B /* Pods-WatchApp Extension.debug.xcconfig */; buildSettings = { - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 11; DEVELOPMENT_TEAM = 44RJ69WHFF; ENABLE_BITCODE = NO; EXCLUDED_ARCHS = ""; @@ -10576,7 +10576,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = CE02413EF0C60B1D1EDE6457 /* Pods-WatchApp Extension.release.xcconfig */; buildSettings = { - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 11; DEVELOPMENT_TEAM = 44RJ69WHFF; ENABLE_BITCODE = NO; EXCLUDED_ARCHS = ""; @@ -11288,7 +11288,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = dashwallet/dashwallet.entitlements; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 11; DEVELOPMENT_TEAM = 44RJ69WHFF; EXCLUDED_ARCHS = ""; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -11489,7 +11489,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 11; DEVELOPMENT_TEAM = 44RJ69WHFF; EXCLUDED_ARCHS = ""; IBSC_MODULE = WatchApp_Extension; @@ -11509,7 +11509,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 556B5EBEBAEA571D74FF69A3 /* Pods-WatchApp Extension.testflight.xcconfig */; buildSettings = { - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 11; DEVELOPMENT_TEAM = 44RJ69WHFF; ENABLE_BITCODE = NO; EXCLUDED_ARCHS = ""; @@ -11608,7 +11608,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = dashwallet/dashwallet.entitlements; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 11; DEVELOPMENT_TEAM = 44RJ69WHFF; EXCLUDED_ARCHS = ""; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -11797,7 +11797,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 11; DEVELOPMENT_TEAM = 44RJ69WHFF; EXCLUDED_ARCHS = ""; IBSC_MODULE = WatchApp_Extension; @@ -11817,7 +11817,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 29B232FD70BA2EDF87F86A56 /* Pods-WatchApp Extension.testnet.xcconfig */; buildSettings = { - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 11; DEVELOPMENT_TEAM = 44RJ69WHFF; ENABLE_BITCODE = NO; EXCLUDED_ARCHS = ""; diff --git a/DashWallet/Sources/Infrastructure/Currency Exchanger/Data Provider/RatesProvider.swift b/DashWallet/Sources/Infrastructure/Currency Exchanger/Data Provider/RatesProvider.swift index c972cece2..ec5d024cf 100644 --- a/DashWallet/Sources/Infrastructure/Currency Exchanger/Data Provider/RatesProvider.swift +++ b/DashWallet/Sources/Infrastructure/Currency Exchanger/Data Provider/RatesProvider.swift @@ -110,11 +110,12 @@ final class BaseRatesProvider: NSObject, RatesProvider { } private func emitRates() { - let plainPricesByCode = UserDefaults.standard.object(forKey: PRICESBYCODE_KEY) as! [String : NSNumber] - let rates = plainPricesByCode.map { code, rate in - RateObject(code: code, name: currencyName(fromCode: code), price: rate.decimalValue) + if let plainPricesByCode = UserDefaults.standard.object(forKey: PRICESBYCODE_KEY) as? [String : NSNumber] { + let rates = plainPricesByCode.map { code, rate in + RateObject(code: code, name: currencyName(fromCode: code), price: rate.decimalValue) + } + updateHandler?(rates) } - updateHandler?(rates) } func currencyName(fromCode code: String) -> String { diff --git a/DashWallet/Sources/UI/Home/HomeViewController.swift b/DashWallet/Sources/UI/Home/HomeViewController.swift index 92fa2589c..80a221566 100644 --- a/DashWallet/Sources/UI/Home/HomeViewController.swift +++ b/DashWallet/Sources/UI/Home/HomeViewController.swift @@ -18,7 +18,7 @@ import UIKit class HomeViewController: DWBasePayViewController { - var model: DWHomeModel! + var model: DWHomeProtocol! private var homeView: HomeView! weak var delegate: (DWHomeViewControllerDelegate & DWWipeDelegate)? diff --git a/DashWallet/Sources/UI/Main/MainTabbarController.swift b/DashWallet/Sources/UI/Main/MainTabbarController.swift index 9d514b657..7849e549a 100644 --- a/DashWallet/Sources/UI/Main/MainTabbarController.swift +++ b/DashWallet/Sources/UI/Main/MainTabbarController.swift @@ -160,7 +160,7 @@ extension MainTabbarController { let homeVC = HomeViewController() homeVC.delegate = self - homeVC.model = homeModel as? DWHomeModel + homeVC.model = homeModel homeController = homeVC var nvc = BaseNavigationController(rootViewController: homeVC)