Fix: SwiftLint warnings

pull/4442/head
Hwee-Boon Yar 3 years ago
parent 10f1369099
commit d92872abe1
  1. 2
      AlphaWallet/Browser/Coordinators/DappBrowserCoordinator.swift
  2. 14
      AlphaWallet/KeyManagement/DefaultsWalletAddressesStore.swift
  3. 2
      AlphaWallet/Settings/Views/SaveCustomRpcManualEntryView.swift

@ -9,7 +9,9 @@ import PromiseKit
import RealmSwift import RealmSwift
import Result import Result
// swiftlint:disable class_delegate_protocol
protocol DappBrowserCoordinatorDelegate: CanOpenURL, RequestAddCustomChainProvider, RequestSwitchChainProvider { protocol DappBrowserCoordinatorDelegate: CanOpenURL, RequestAddCustomChainProvider, RequestSwitchChainProvider {
// swiftlint:enable class_delegate_protocol
func didSentTransaction(transaction: SentTransaction, inCoordinator coordinator: DappBrowserCoordinator) func didSentTransaction(transaction: SentTransaction, inCoordinator coordinator: DappBrowserCoordinator)
func handleUniversalLink(_ url: URL, forCoordinator coordinator: DappBrowserCoordinator) func handleUniversalLink(_ url: URL, forCoordinator coordinator: DappBrowserCoordinator)
func openFiatOnRamp(wallet: Wallet, server: RPCServer, inCoordinator coordinator: DappBrowserCoordinator, viewController: UIViewController, source: Analytics.FiatOnRampSource) func openFiatOnRamp(wallet: Wallet, server: RPCServer, inCoordinator coordinator: DappBrowserCoordinator, viewController: UIViewController, source: Analytics.FiatOnRampSource)

@ -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 } ?? []

@ -210,7 +210,9 @@ extension SaveCustomRpcManualEntryView: KeyboardNavigationDelegateProtocol {
} }
func addHttpsText() { func addHttpsText() {
// swiftlint:disable empty_enum_arguments
guard let currentTextField = currentTextField(), let inputString = currentTextField.textField.text, !inputString.lowercased().starts(with: "https://") else { return } guard let currentTextField = currentTextField(), let inputString = currentTextField.textField.text, !inputString.lowercased().starts(with: "https://") else { return }
// swiftlint:enable empty_enum_arguments
currentTextField.textField.text = "https://" + inputString currentTextField.textField.text = "https://" + inputString
} }

Loading…
Cancel
Save