Fix SwiftLint warnings

pull/2477/head
Hwee-Boon Yar 4 years ago
parent 33188b7e39
commit 570f8e7e06
  1. 3
      AlphaWallet/Browser/Coordinators/QRCodeResolutionCoordinator.swift
  2. 4
      AlphaWallet/Extensions/Session+PromiseKit.swift
  3. 3
      AlphaWallet/Market/Coordinators/UniversalLinkCoordinator.swift
  4. 4
      AlphaWallet/Tokens/Coordinators/GetContractInteractions.swift
  5. 2
      AlphaWallet/Transfer/ViewControllers/ConfigureTransactionViewController.swift
  6. 2
      AlphaWallet/Transfer/ViewModels/ConfirmSignMessageViewControllerViewModel.swift
  7. 1
      AlphaWallet/WalletConnect/ViewModel/WalletConnectSessionDetailsViewModel.swift

@ -130,7 +130,7 @@ extension QRCodeResolutionCoordinator: ScanQRCodeCoordinatorDelegate {
private func availableActions(forContract contract: AlphaWallet.Address) -> [ScanQRCodeAction] { private func availableActions(forContract contract: AlphaWallet.Address) -> [ScanQRCodeAction] {
switch usage { switch usage {
case .all(let tokensDataStores, _): case .all(let tokensDataStores, _):
let isTokenFound = tokensDataStores.contains { $0.token(forContract: contract) != nil } ?? false let isTokenFound = tokensDataStores.contains { $0.token(forContract: contract) != nil }
if isTokenFound { if isTokenFound {
return [.sendToAddress, .watchWallet, .openInEtherscan] return [.sendToAddress, .watchWallet, .openInEtherscan]
} else { } else {
@ -279,7 +279,6 @@ extension QRCodeResolutionCoordinator: ScanQRCodeCoordinatorDelegate {
} }
private func serverFromEip681LinkOrDefault(_ serverInLink: RPCServer?) -> RPCServer? { private func serverFromEip681LinkOrDefault(_ serverInLink: RPCServer?) -> RPCServer? {
let server: RPCServer
if let serverInLink = serverInLink { if let serverInLink = serverInLink {
return serverInLink return serverInLink
} }

@ -19,8 +19,8 @@ extension Session {
case .success(let result): case .success(let result):
seal.fulfill(result) seal.fulfill(result)
case .failure(let error): case .failure(let error):
if case let .responseError(JSONRPCError.responseError(e)) = error { if case let .responseError(JSONRPCError.responseError(_, message: message, _)) = error {
if e.message.hasPrefix("Insufficient funds") { if message.hasPrefix("Insufficient funds") {
seal.reject(InsufficientFundsError()) seal.reject(InsufficientFundsError())
return return
} else { } else {

@ -331,7 +331,6 @@ class UniversalLinkCoordinator: Coordinator {
return true return true
} }
private func handleMagicLink() -> Bool { private func handleMagicLink() -> Bool {
preparingToImportUniversalLink() preparingToImportUniversalLink()
let isLegacyLink = url.description.hasPrefix(Constants.legacyMagicLinkPrefix) let isLegacyLink = url.description.hasPrefix(Constants.legacyMagicLinkPrefix)
@ -368,7 +367,7 @@ class UniversalLinkCoordinator: Coordinator {
contractAsAddress: signedOrder.order.contractAddress contractAsAddress: signedOrder.order.contractAddress
) )
} }
case .failure(let error): case .failure:
showImportError(errorMessage: R.string.localizable.aClaimTokenInvalidLinkTryAgain()) showImportError(errorMessage: R.string.localizable.aClaimTokenInvalidLinkTryAgain())
return false return false
} }

@ -63,7 +63,7 @@ class GetContractInteractions {
completion(transactions) completion(transactions)
} }
} }
case .failure(let error): case .failure:
completion([]) completion([])
} }
} }
@ -113,7 +113,7 @@ class GetContractInteractions {
completion(uniqueNonEmptyContracts, maxBlockNumber) completion(uniqueNonEmptyContracts, maxBlockNumber)
} }
} }
case .failure(let error): case .failure:
completion([], nil) completion([], nil)
} }
} }

@ -244,7 +244,7 @@ class ConfigureTransactionViewController: UIViewController {
private func recalculateTotalFeeForCustomGas() { private func recalculateTotalFeeForCustomGas() {
cells.totalFee.value = viewModel.gasViewModel.feeText cells.totalFee.value = viewModel.gasViewModel.feeText
let configurationTypes = viewModel.configurationTypes let configurationTypes = viewModel.configurationTypes
if let indexPath = configurationTypes.index(of: .custom).flatMap { IndexPath(row: $0, section: ConfigureTransactionViewModel.Section.configurationTypes.rawValue) }, let cell = tableView.cellForRow(at: indexPath) as? GasSpeedTableViewCell { if let indexPath = configurationTypes.index(of: .custom).flatMap({ IndexPath(row: $0, section: ConfigureTransactionViewModel.Section.configurationTypes.rawValue) }), let cell = tableView.cellForRow(at: indexPath) as? GasSpeedTableViewCell {
cell.configure(viewModel: viewModel.gasSpeedViewModel(indexPath: indexPath)) cell.configure(viewModel: viewModel.gasSpeedViewModel(indexPath: indexPath))
} }
showGasPriceWarning() showGasPriceWarning()

@ -169,7 +169,7 @@ extension EIP712TypedData.JSON {
//TODO Better to follow the order define in the type //TODO Better to follow the order define in the type
func formattedString(indentationLevel: Int = 0) -> NSAttributedString { func formattedString(indentationLevel: Int = 0) -> NSAttributedString {
let nameAttributes: [NSAttributedString.Key: Any] = [.foregroundColor: Colors.gray, .font: Fonts.light(size: 15)] let nameAttributes: [NSAttributedString.Key: Any] = [.foregroundColor: Colors.gray, .font: Fonts.light(size: 15)]
let valueAttributes: [NSAttributedString.Key : Any] = [.foregroundColor: R.color.dove(), .font: Fonts.regular(size: 15)] let valueAttributes: [NSAttributedString.Key: Any] = [.foregroundColor: R.color.dove()!, .font: Fonts.regular(size: 15)]
switch self { switch self {
case .object(let dictionary): case .object(let dictionary):

@ -55,7 +55,6 @@ struct WalletConnectSessionDetailsViewModel {
} }
} }
var dissconnectButtonText: String { var dissconnectButtonText: String {
return R.string.localizable.walletConnectSessionDisconnect() return R.string.localizable.walletConnectSessionDisconnect()
} }

Loading…
Cancel
Save