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. 6
      AlphaWallet/Transfer/ViewControllers/ConfigureTransactionViewController.swift
  6. 4
      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] {
switch usage {
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 {
return [.sendToAddress, .watchWallet, .openInEtherscan]
} else {
@ -279,7 +279,6 @@ extension QRCodeResolutionCoordinator: ScanQRCodeCoordinatorDelegate {
}
private func serverFromEip681LinkOrDefault(_ serverInLink: RPCServer?) -> RPCServer? {
let server: RPCServer
if let serverInLink = serverInLink {
return serverInLink
}

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

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

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

@ -244,7 +244,7 @@ class ConfigureTransactionViewController: UIViewController {
private func recalculateTotalFeeForCustomGas() {
cells.totalFee.value = viewModel.gasViewModel.feeText
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))
}
showGasPriceWarning()
@ -530,7 +530,7 @@ extension UIBarButtonItem {
static func saveBarButton(_ target: AnyObject, selector: Selector) -> UIBarButtonItem {
.init(title: R.string.localizable.save(), style: .plain, target: target, action: selector)
}
}
static func backBarButton(selectionClosure: @escaping () -> Void) -> UIBarButtonItem {
let barButton = UIBarButtonItem(image: R.image.backWhite(), style: .plain, target: nil, action: nil)
@ -556,5 +556,5 @@ extension UIBarButtonItem {
@objc func didTapButton(_ sender: Any) {
selectionClosure?()
}
}
}

@ -168,8 +168,8 @@ extension EIP712TypedData {
extension EIP712TypedData.JSON {
//TODO Better to follow the order define in the type
func formattedString(indentationLevel: Int = 0) -> NSAttributedString {
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 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)]
switch self {
case .object(let dictionary):

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

Loading…
Cancel
Save