Merge branch 'master' into read-xml-from-repo

pull/508/head
James Sangalli 6 years ago committed by GitHub
commit d8d501f567
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      AlphaWallet/Accounts/ViewModels/AccountsViewController.swift
  2. 2
      AlphaWallet/AppCoordinator.swift
  3. 2
      AlphaWallet/EtherClient/EtherKeystore.swift
  4. 2
      AlphaWallet/EtherClient/Requests/GetTransactionCountRequest.swift
  5. 2
      AlphaWallet/Foundation/CryptoAddressValidator.swift
  6. 4
      AlphaWallet/InCoordinator.swift
  7. 6
      AlphaWallet/Localization/en.lproj/Localizable.strings
  8. 2
      AlphaWallet/Market/OrderHandler.swift
  9. 4
      AlphaWallet/Transactions/Coordinators/TransactionDataCoordinator.swift
  10. 2
      AlphaWallet/Transactions/Storage/TransactionsStorage.swift
  11. 2
      AlphaWallet/Transactions/Types/LocalizedOperationObject.swift

@ -114,7 +114,7 @@ class AccountsViewController: UIViewController {
}
}
private func refreshWalletBalances() {
let addresses = wallets.flatMap { $0.address }
let addresses = wallets.compactMap { $0.address }
var counter = 0
for address in addresses {
balanceCoordinator.getEthBalance(for: address, completion: { [weak self] (result) in

@ -85,7 +85,7 @@ class AppCoordinator: NSObject, Coordinator {
}
func inializers() {
var paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .allDomainsMask, true).flatMap { URL(fileURLWithPath: $0) }
var paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .allDomainsMask, true).compactMap { URL(fileURLWithPath: $0) }
paths.append(keystore.keystoreDirectory)
let initializers: [Initializer] = [

@ -204,7 +204,7 @@ open class EtherKeystore: Keystore {
}
var wallets: [Wallet] {
let addresses = watchAddresses.flatMap { Address(string: $0) }
let addresses = watchAddresses.compactMap { Address(string: $0) }
return [
keyStore.accounts.map { Wallet(type: .real($0)) },
addresses.map { Wallet(type: .watch($0)) },

@ -23,7 +23,7 @@ struct GetTransactionCountRequest: JSONRPCKit.Request {
func response(from resultObject: Any) throws -> Response {
if let response = resultObject as? String {
return BigInt(response.drop0x, radix: 16).flatMap({ numericCast($0) }) ?? 0
return BigInt(response.drop0x, radix: 16).map({ numericCast($0) }) ?? 0
} else {
throw CastError(actualValue: resultObject, expectedType: Response.self)
}

@ -14,7 +14,7 @@ enum AddressValidatorType {
struct CryptoAddressValidator {
static func isValidAddress(_ value: String?, type: AddressValidatorType = .ethereum) -> Bool {
guard value?.count == 42 else {
guard value?.count == type.addressLength else {
return false
}
return true

@ -45,13 +45,13 @@ class InCoordinator: Coordinator {
var ethBalance = Subscribable<BigInt>(nil)
weak var delegate: InCoordinatorDelegate?
var transactionCoordinator: TransactionCoordinator? {
return self.coordinators.flatMap {
return self.coordinators.compactMap {
$0 as? TransactionCoordinator
}.first
}
var ticketsCoordinator: TicketsCoordinator? {
return self.coordinators.flatMap {
return self.coordinators.compactMap {
$0 as? TicketsCoordinator
}.first
}

@ -67,7 +67,7 @@
"wallet.create.button.title" = "Create Wallet";
"wallet.create.inProgress" = "Creating wallet...";
"wallet.import.button.title" = "Import Wallet";
"wallets.backup.alertSheet.title" = "Backup Keystore";
"wallets.backup.alertSheet.title" = "Backup Encrypted Wallet";
"transactions.tabbar.item.title" = "My Transactions";
"transaction.navigation.title" = "Transaction";
"import.navigation.title" = "Import Wallet";
@ -83,9 +83,9 @@
"importWallet.import.button.title" = "Import";
"importWallet.import.invalidAddress" = "Invalid Ethereum Address";
"importWallet.import.invalidPrivateKey" = "Private Key has to be 64 characters long";
"Keystore JSON" = "Keystore JSON";
"Keystore JSON" = "Encrypted Wallet";
"More Details" = "More Details";
"Keystore" = "Keystore";
"Keystore" = "From Backup";
"Private Key" = "Private Key";
"settings.currency.button.title" = "Currency";
"settings.network.test.label.title" = "Test";

@ -20,7 +20,7 @@ public struct SignedOrder {
extension String {
var hexa2Bytes: [UInt8] {
let hexa = Array(characters)
return stride(from: 0, to: count, by: 2).flatMap {
return stride(from: 0, to: count, by: 2).compactMap {
UInt8(String(hexa[$0..<$0.advanced(by: 2)]), radix: 16)
}
}

@ -119,7 +119,7 @@ class TransactionDataCoordinator {
case .success(let response):
do {
let rawTransactions = try response.map(ArrayResponse<RawTransaction>.self).docs
let transactions: [Transaction] = rawTransactions.flatMap { .from(transaction: $0) }
let transactions: [Transaction] = rawTransactions.compactMap { .from(transaction: $0) }
completion(.success(transactions))
} catch {
completion(.failure(AnyError(error)))
@ -131,7 +131,7 @@ class TransactionDataCoordinator {
}
func update(items: [PendingTransaction]) {
let transactionItems: [Transaction] = items.flatMap { .from(transaction: $0) }
let transactionItems: [Transaction] = items.compactMap { .from(transaction: $0) }
update(items: transactionItems)
}

@ -51,7 +51,7 @@ class TransactionsStorage {
}
private func tokens(from transactions: [Transaction]) -> [Token] {
let tokens: [Token] = transactions.flatMap { transaction in
let tokens: [Token] = transactions.compactMap { transaction in
guard
let operation = transaction.localizedOperations.first,
let contract = Address(string: operation.contract ?? ""),

@ -43,7 +43,7 @@ class LocalizedOperationObject: Object {
extension LocalizedOperationObject {
static func from(operations: [LocalizedOperation]?) -> [LocalizedOperationObject] {
guard let operations = operations else { return [] }
return operations.flatMap { operation in
return operations.compactMap { operation in
guard
let from = Address(string: operation.from),
let to = Address(string: operation.to) else {

Loading…
Cancel
Save