Remove build warnings

pull/2195/head
Hwee-Boon Yar 4 years ago
parent 577a3c41d5
commit 28ad948ae4
  1. 4
      AlphaWallet/Activities/Coordinators/ActivitiesCoordinator.swift
  2. 2
      AlphaWallet/Activities/ViewModels/ActivitiesViewModel.swift
  3. 2
      AlphaWallet/Activities/ViewModels/DefaultActivityCellViewModel.swift
  4. 2
      AlphaWallet/Activities/ViewModels/DefaultActivityViewModel.swift
  5. 1
      AlphaWallet/InCoordinator.swift
  6. 2
      AlphaWallet/Settings/Types/Config.swift
  7. 3
      AlphaWallet/Settings/ViewControllers/SettingsViewController.swift
  8. 2
      AlphaWallet/TokenScriptClient/Models/AssetAttribute.swift
  9. 10
      AlphaWallet/TokenScriptClient/Models/TokenScriptFilterParser.swift
  10. 6
      AlphaWallet/TokenScriptClient/Models/XMLHandler.swift
  11. 2
      AlphaWallet/Tokens/Coordinators/GetContractInteractions.swift
  12. 2
      AlphaWallet/Transactions/Coordinators/SingleChainTransactionEtherscanDataCoordinator.swift
  13. 2
      AlphaWallet/Transactions/ViewModels/TransactionsViewModel.swift
  14. 2
      AlphaWallet/UI/ButtonsBar.swift

@ -121,7 +121,7 @@ class ActivitiesCoordinator: Coordinator {
return (contract: eachContract, server: eachServer, xmlHandler: xmlHandler)
}
let contractsAndCardsOptional: [[(tokenContract: AlphaWallet.Address, server: RPCServer, card: TokenScriptCard, interpolatedFilter: String)]] = contractServerXmlHandlers.flatMap { eachContract, eachServer, xmlHandler in
let contractsAndCardsOptional: [[(tokenContract: AlphaWallet.Address, server: RPCServer, card: TokenScriptCard, interpolatedFilter: String)]] = contractServerXmlHandlers.compactMap { eachContract, eachServer, xmlHandler in
var contractAndCard: [(tokenContract: AlphaWallet.Address, server: RPCServer, card: TokenScriptCard, interpolatedFilter: String)] = .init()
for card in xmlHandler.activityCards {
let (filterName, filterValue) = card.eventOrigin.eventFilter
@ -367,7 +367,7 @@ extension ActivitiesCoordinator: TransactionDataCoordinatorDelegate {
case .success(let items):
transactions = items
reloadViewController()
case .failure(let error):
case .failure:
break
}
}

@ -14,7 +14,7 @@ struct ActivitiesViewModel {
var newItems: [String: NSMutableArray] = [:]
for each in activities {
let date = formatter.string(from: each.date)
var currentItems = newItems[date] ?? .init()
let currentItems = newItems[date] ?? .init()
currentItems.add(each)
newItems[date] = currentItems
}

@ -116,7 +116,7 @@ struct DefaultActivityCellViewModel {
case .erc20Sent, .erc20Received, .erc20OwnerApproved, .erc20ApprovalObtained, .nativeCryptoSent, .nativeCryptoReceived:
if let value = cardAttributes["amount"]?.uintValue {
let formatter = EtherNumberFormatter.short
let value = formatter.string(from: BigInt(value) ?? BigInt(), decimals: activity.tokenObject.decimals)
let value = formatter.string(from: BigInt(value))
return "\(sign)\(value) \(activity.tokenObject.symbol)"
} else {
return ""

@ -43,7 +43,7 @@ struct DefaultActivityViewModel {
case .erc20Sent, .erc20Received, .erc20OwnerApproved, .erc20ApprovalObtained, .nativeCryptoSent, .nativeCryptoReceived:
if let value = cardAttributes["amount"]?.uintValue {
let formatter = EtherNumberFormatter.short
let value = formatter.string(from: BigInt(value) ?? BigInt(), decimals: activity.tokenObject.decimals)
let value = formatter.string(from: BigInt(value))
return "\(sign)\(value) \(activity.tokenObject.symbol)"
} else {
return ""

@ -420,7 +420,6 @@ class InCoordinator: NSObject, Coordinator {
}
private func createActivityCoordinator() -> ActivitiesCoordinator {
let realm = self.realm(forAccount: wallet)
let coordinator = ActivitiesCoordinator(
config: config,
sessions: walletSessions,

@ -199,7 +199,7 @@ extension Config {
}
func saveWalletName(_ walletName: String, forAddress address: AlphaWallet.Address) {
var walletName = walletName.trimmed
let walletName = walletName.trimmed
guard !walletName.isEmpty else { return }
var names = walletNames
names[address] = walletName

@ -119,9 +119,6 @@ class SettingsViewController: UIViewController {
icon: row.icon)
)
let serverToResolveEns = RPCServer.main
let address = account.address
firstly {
GetWalletNameCoordinator(config: config).getName(forAddress: account.address)
}.done { [weak self] name in

@ -112,7 +112,7 @@ struct AssetAttribute {
} else {
originFound = nil
}
case .some(.function), .some(.userEntry), .some(.userEntry), .some(.tokenId), .none:
case .some(.function), .some(.userEntry), .some(.tokenId), .none:
originFound = possibleOrigin
}
}

@ -194,19 +194,13 @@ struct TokenScriptFilterParser {
var buffer: [Character] = []
var escapeBuffer: [Character]? = nil
var wasPreviousEscapedCharacter = false
for (i, c) in expression.enumerated() {
let next: String?
if i + 1 < expression.count {
next = expression[i + 1]
} else {
next = nil
}
for (_, c) in expression.enumerated() {
let previous = buffer.last.flatMap { String($0) }
if c == escape && escapeBuffer == nil {
//start new escape
escapeBuffer = .init()
continue
} else if c == escape, var eb = escapeBuffer {
} else if c == escape, let eb = escapeBuffer {
if escapeBuffer.isEmpty {
//Invalid escape sequence with double backward slash (\\)
if !buffer.isEmpty {

@ -309,7 +309,7 @@ private class PrivateXMLHandler {
let (xml, hasValidTokenScriptFile) = PrivateXMLHandler.storeXmlAccordingToTokenScriptStatus(xmlString: xmlString, tokenScriptStatus: tokenScriptStatus)
self.xml = xml
self.hasValidTokenScriptFile = hasValidTokenScriptFile
if isBase ?? false {
if isBase {
self.server = .any
} else {
self.server = PrivateXMLHandler.extractServer(fromXML: xml, xmlContext: xmlContext, matchingContract: contract).flatMap { .server($0) }
@ -680,7 +680,7 @@ public class XMLHandler {
}
var tokenViewIconifiedHtml: (html: String, style: String) {
let (html: html, style: style) = privateXMLHandler.tokenViewIconifiedHtml
let (html: html, style: _) = privateXMLHandler.tokenViewIconifiedHtml
if let baseXMLHandler = baseXMLHandler {
if html.isEmpty {
return baseXMLHandler.tokenViewIconifiedHtml
@ -693,7 +693,7 @@ public class XMLHandler {
}
var tokenViewHtml: (html: String, style: String) {
let (html: html, style: style) = privateXMLHandler.tokenViewHtml
let (html: html, style: _) = privateXMLHandler.tokenViewHtml
if let baseXMLHandler = baseXMLHandler {
if html.isEmpty {
return baseXMLHandler.tokenViewHtml

@ -10,7 +10,7 @@ import SwiftyJSON
class GetContractInteractions {
func getErc20Interactions(contractAddress: AlphaWallet.Address? = nil, address: AlphaWallet.Address, server: RPCServer, startBlock: Int? = nil, completion: @escaping ([Transaction]) -> Void) {
guard var etherscanURL = server.etherscanAPIURLForERC20TxList(for: address, startBlock: startBlock) else { return }
guard let etherscanURL = server.etherscanAPIURLForERC20TxList(for: address, startBlock: startBlock) else { return }
Alamofire.request(etherscanURL).validate().responseJSON { response in
switch response.result {
case .success(let value):

@ -84,7 +84,7 @@ class SingleChainTransactionEtherscanDataCoordinator: SingleChainTransactionData
server: session.server,
startBlock: startBlock
) { result in
if let maxBlockNumber = result.map { $0.blockNumber }.max() {
if let maxBlockNumber = result.map({ $0.blockNumber }).max() {
Config.setLastFetchedErc20InteractionBlockNumber(maxBlockNumber, server: self.session.server, wallet: wallet)
}
self.update(items: result)

@ -14,7 +14,7 @@ struct TransactionsViewModel {
var newItems: [String: NSMutableArray] = [:]
for transaction in transactions {
let date = formatter.string(from: transaction.date)
var currentItems = newItems[date] ?? .init()
let currentItems = newItems[date] ?? .init()
currentItems.add(transaction)
newItems[date] = currentItems
}

@ -142,7 +142,7 @@ class ButtonsBarBackgroundView: UIView {
}
}
@objc class ButtonsBar: UIView {
class ButtonsBar: UIView {
static let buttonsHeight = CGFloat(ScreenChecker().isNarrowScreen ? 38 : 48)
//A gap so it doesn't stick to the bottom of devices without a bottom safe area
static let marginAtBottomScreen = CGFloat(3)

Loading…
Cancel
Save