|
|
@ -14,7 +14,7 @@ struct DefaultsWalletAddressesStore: WalletAddressesStore { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private var walletsSubject: CurrentValueSubject<Set<Wallet>, Never> = .init([]) |
|
|
|
private var walletsSubject: CurrentValueSubject<Set<Wallet>, Never> = .init([]) |
|
|
|
|
|
|
|
|
|
|
|
private struct Keys { |
|
|
|
private struct Keys { |
|
|
|
static let watchAddresses = "watchAddresses" |
|
|
|
static let watchAddresses = "watchAddresses" |
|
|
|
static let ethereumAddressesWithPrivateKeys = "ethereumAddressesWithPrivateKeys" |
|
|
|
static let ethereumAddressesWithPrivateKeys = "ethereumAddressesWithPrivateKeys" |
|
|
@ -34,14 +34,8 @@ struct DefaultsWalletAddressesStore: WalletAddressesStore { |
|
|
|
self.userDefaults = userDefaults |
|
|
|
self.userDefaults = userDefaults |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var recentlyUsedWallet: Wallet? { |
|
|
|
//This might not work correctly (since it doesn't read or store the wallet) if we switch back to this class (but we shouldn't because we use it for migrating away from the old wallet storage) |
|
|
|
get { |
|
|
|
var recentlyUsedWallet: Wallet? |
|
|
|
return nil |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
set { |
|
|
|
|
|
|
|
//no-op |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var wallets: [Wallet] { |
|
|
|
var wallets: [Wallet] { |
|
|
|
let watchAddresses = self.watchAddresses.compactMap { AlphaWallet.Address(string: $0) }.map { Wallet(type: .watch($0)) } |
|
|
|
let watchAddresses = self.watchAddresses.compactMap { AlphaWallet.Address(string: $0) }.map { Wallet(type: .watch($0)) } |
|
|
@ -51,7 +45,7 @@ struct DefaultsWalletAddressesStore: WalletAddressesStore { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var watchAddresses: [String] { |
|
|
|
var watchAddresses: [String] { |
|
|
|
get { |
|
|
|
get { |
|
|
|
return userDefaults.data(forKey: Keys.watchAddresses) |
|
|
|
return userDefaults.data(forKey: Keys.watchAddresses) |
|
|
|
.flatMap { try? NSKeyedUnarchiver.unarchiveTopLevelObjectWithData($0) as? [String] } |
|
|
|
.flatMap { try? NSKeyedUnarchiver.unarchiveTopLevelObjectWithData($0) as? [String] } |
|
|
|
.flatMap { $0 } ?? [] |
|
|
|
.flatMap { $0 } ?? [] |
|
|
|