Update UserDefaultsGroup.swift

This commit is contained in:
marcosrdz 2020-11-07 21:54:32 -05:00
parent e16de64c1a
commit 03a3bae033

View File

@ -32,13 +32,16 @@ class UserDefaultsGroup {
static private let suite = UserDefaults(suiteName: UserDefaultsGroupKey.GroupName.rawValue)
static func getElectrumSettings() -> UserDefaultsElectrumSettings {
guard let electrumSettingsHost = suite?.string(forKey: UserDefaultsGroupKey.ElectrumSettingsHost.rawValue), let electrumSettingsTCPPort = suite?.string(forKey: UserDefaultsGroupKey.ElectrumSettingsTCPPort.rawValue), let electrumSettingsSSLPort = suite?.string(forKey: UserDefaultsGroupKey.ElectrumSettingsSSLPort.rawValue) else {
guard let electrumSettingsHost = suite?.string(forKey: UserDefaultsGroupKey.ElectrumSettingsHost.rawValue) else {
return UserDefaultsElectrumSettings(host: "electrum1.bluewallet.io", port: 50001, sslPort: 443)
}
let electrumSettingsTCPPort = suite?.string(forKey: UserDefaultsGroupKey.ElectrumSettingsTCPPort.rawValue) ?? "50001"
let electrumSettingsSSLPort = suite?.string(forKey: UserDefaultsGroupKey.ElectrumSettingsSSLPort.rawValue) ?? "443"
let host = electrumSettingsHost
let sslPort = Int32(electrumSettingsSSLPort) ?? 443
let port = Int32(electrumSettingsTCPPort) ?? 50001
let sslPort = Int32(electrumSettingsSSLPort)
let port = Int32(electrumSettingsTCPPort)
return UserDefaultsElectrumSettings(host: host, port: port, sslPort: sslPort)
}