Merge branch 'master' into fix-redemption-privacy-policy-not-update-zh-and-es

pull/387/head
James Sangalli 7 years ago committed by GitHub
commit 2557db5229
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      Trust/Accounts/Coordinators/AccountsCoordinator.swift
  2. 2
      Trust/AppDelegate.swift
  3. 4
      Trust/InCoordinator.swift
  4. 2
      Trust/Localization/en.lproj/redeemInfo.html
  5. 9
      Trust/Localization/zh-Hans.lproj/redeemInfo.html
  6. 26
      Trust/Market/Coordinators/UniversalLinkCoordinator.swift
  7. 18
      Trust/Market/ViewModels/ImportTicketViewControllerViewModel.swift
  8. 1
      Trust/Redeem/ViewControllers/RedeemTicketsViewController.swift
  9. 1
      Trust/Redeem/ViewControllers/TicketRedemptionViewController.swift
  10. 1
      Trust/Sell/ViewControllers/SellTicketsViewController.swift
  11. 2
      Trust/Sell/Views/AmountTextField.swift
  12. 2
      Trust/Settings/Types/Config.swift
  13. 2
      Trust/Settings/ViewControllers/SettingsViewController.swift
  14. 6
      Trust/Style/AppStyle.swift
  15. 2
      Trust/Tokens/Helpers/TicketAdaptor.swift
  16. 1
      Trust/Tokens/ViewControllers/TicketsViewController.swift
  17. 2
      Trust/Transactions/Coordinators/TicketsCoordinator.swift
  18. 6
      Trust/Transactions/Coordinators/TransactionDataCoordinator.swift
  19. 1
      Trust/Transactions/ViewControllers/TransactionsViewController.swift
  20. 4
      Trust/Transactions/ViewModels/TransactionViewModel.swift
  21. 4
      Trust/Transfer/Coordinators/TransferTicketsCoordinator.swift
  22. 2
      Trust/Transfer/ViewControllers/SendViewController.swift
  23. 1
      Trust/Transfer/ViewControllers/TransferTicketsViewController.swift
  24. 4
      Trust/Transfer/ViewModels/ConfirmPaymentDetailsViewModel.swift
  25. 4
      Trust/Wallet/Coordinators/InitialWalletCreationCoordinator.swift
  26. 6
      Trust/Wallet/ViewControllers/ImportWalletViewController.swift

@ -69,7 +69,7 @@ class AccountsCoordinator: Coordinator {
func importOrCreateWallet(entryPoint: WalletEntryPoint) {
let coordinator = WalletCoordinator(keystore: keystore)
if case let .createInstantWallet = entryPoint {
if case .createInstantWallet = entryPoint {
coordinator.navigationController = navigationController
}
coordinator.delegate = self
@ -144,7 +144,7 @@ extension AccountsCoordinator: WalletCoordinatorDelegate {
delegate?.didAddAccount(account: account, in: self)
if let delegate = delegate {
self.removeCoordinator(coordinator)
self.delegate?.didSelectAccount(account: account, in: self)
delegate.didSelectAccount(account: account, in: self)
} else {
accountsViewController.fetch()
coordinator.navigationController.dismiss(animated: true, completion: nil)

@ -53,7 +53,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
}
// Respond to URI scheme links
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
return true
}

@ -103,8 +103,7 @@ class InCoordinator: Coordinator {
guard let tokens = tokensModel, let eth = tokens.first(where: { $0 == etherToken }) else {
return
}
var ticker = tokensStorage.coinTicker(for: eth)
if let ticker = ticker {
if let ticker = tokensStorage.coinTicker(for: eth) {
self?.ethPrice.value = Double(ticker.price)
} else {
tokensStorage.updatePricesAfterComingOnline()
@ -324,7 +323,6 @@ class InCoordinator: Coordinator {
}
//TODO do we need to pass these (especially tokenStorage) to showTransferViewController(for:ticketHolders:) to make sure storage is synchronized?
let session = transactionCoordinator.session
let tokenStorage = transactionCoordinator.tokensStorage
switch (paymentFlow, session.account.type) {
case (.send, .real), (.request, _):

@ -59,7 +59,7 @@ a:link, a:active, a:visited {
<body>
<h1>Redemption Location</h1>
<p class="centered">Smolenskaya Square 3, Floor 10, Moscow, Russia, 121099</p>
<p class="centered">12 June - 14 July, 9:00 am - 5:00 pm on non-match days and 9.00am - 11.00am on match days</p>
<p class="centered">12 June - 14 July, 9:00 am - 5:00 pm on non-match days and 9.00 am - 11.00 am on match days</p>
<p class="centered">Please note that the office is closed on the 14th of June</p>
<p class="centered">Telephone: (00) 7 (495) 771-71-58</p>
<br>

@ -57,11 +57,12 @@ a:link, a:active, a:visited {
</style>
</head>
<body>
<h1>Redemption Location</h1>
<h1>门票兑换处地址</h1>
<p class="centered">Smolenskaya Square 3, Floor 10, Moscow, Russia, 121099</p>
<p class="centered">12 June - 14 July, 9:00 am - 5:00 pm on non-match days and 9.00am - 11.00am on match days</p>
<p class="centered">Please note that the office is closed on the 14th of June</p>
<p class="centered">Telephone: (00) 7 (495) 771-71-58</p>
<p class="centered">开放时间:6月12日 - 7月14号</p>
<p class="centered">非比赛日9:00 am - 5:00 pm,比赛日 9.00 am - 11.00 am</p>
<p class="centered">注意:6月4号兑换处不开放</p>
<p class="centered">联系电话: (00) 7 (495) 771-71-58</p>
<br>
<p class="centered"><img src="non_asset_catalog_redemption_location.png"></p>
<br>

@ -53,7 +53,8 @@ class UniversalLinkCoordinator: Coordinator {
func handlePaidUniversalLink(signedOrder: SignedOrder, ticketHolder: TicketHolder) -> Bool {
//TODO localize
if let viewController = delegate?.viewControllerForPresenting(in: self) {
//TODO improve. Not an obvious link between the variables used in the if-statement and the body
if delegate?.viewControllerForPresenting(in: self) != nil {
if let vc = importTicketViewController {
vc.signedOrder = signedOrder
vc.tokenObject = TokenObject(contract: signedOrder.order.contractAddress,
@ -96,7 +97,8 @@ class UniversalLinkCoordinator: Coordinator {
func usePaymentServerForFreeTransferLinks(signedOrder: SignedOrder, ticketHolder: TicketHolder) -> Bool {
let parameters = createHTTPParametersForPaymentServer(signedOrder: signedOrder, isForTransfer: true)
let query = Constants.paymentServer
if let viewController = delegate?.viewControllerForPresenting(in: self) {
//TODO improve. Not an obvious link between the variables used in the if-statement and the body
if delegate?.viewControllerForPresenting(in: self) != nil {
if let vc = importTicketViewController {
vc.query = query
vc.parameters = parameters
@ -125,7 +127,7 @@ class UniversalLinkCoordinator: Coordinator {
if let balance = self.ethBalance {
balance.subscribeOnce { value in
if value > signedOrder.order.price {
let success = self.handlePaidUniversalLink(signedOrder: signedOrder, ticketHolder: goodResult)
let _ = self.handlePaidUniversalLink(signedOrder: signedOrder, ticketHolder: goodResult)
} else {
if let price = self.ethPrice {
if price.value == nil {
@ -145,7 +147,7 @@ class UniversalLinkCoordinator: Coordinator {
}
}
} else {
let success = self.usePaymentServerForFreeTransferLinks(
let _ = self.usePaymentServerForFreeTransferLinks(
signedOrder: signedOrder,
ticketHolder: goodResult
)
@ -292,16 +294,15 @@ class UniversalLinkCoordinator: Coordinator {
}
}
if let vc = self.importTicketViewController {
//TODO improve. Not an obvious link between the variables used in the if-statement and the body
if let vc = self.importTicketViewController, vc.viewModel != nil {
// TODO handle http response
print(result)
if let vc = self.importTicketViewController, var viewModel = vc.viewModel {
if successful {
self.showImportSuccessful()
} else {
//TODO Pass in error message
self.showImportError(errorMessage: R.string.localizable.aClaimTicketFailedTitle())
}
if successful {
self.showImportSuccessful()
} else {
//TODO Pass in error message
self.showImportError(errorMessage: R.string.localizable.aClaimTicketFailedTitle())
}
}
}
@ -314,6 +315,7 @@ class UniversalLinkCoordinator: Coordinator {
}
private func convert(ethCost: BigUInt) -> Decimal {
//TODO extract constant. Used elsewhere too
let divideAmount = Decimal(string: "1000000000000000000")!
let etherCostDecimal = Decimal(string: ethCost.description)! / divideAmount
return etherCostDecimal

@ -59,7 +59,7 @@ struct ImportTicketViewControllerViewModel {
var ticketCount: String {
guard let ticketHolder = ticketHolder else { return "" }
if case let .validating = state {
if case .validating = state {
return ""
} else {
return "x\(ticketHolder.tickets.count)"
@ -68,7 +68,7 @@ struct ImportTicketViewControllerViewModel {
var city: String {
guard let ticketHolder = ticketHolder else { return "" }
if case let .validating = state {
if case .validating = state {
return ""
} else {
return ticketHolder.city
@ -77,7 +77,7 @@ struct ImportTicketViewControllerViewModel {
var category: String {
guard let ticketHolder = ticketHolder else { return "" }
if case let .validating = state {
if case .validating = state {
return ""
} else {
return String(ticketHolder.category)
@ -86,7 +86,7 @@ struct ImportTicketViewControllerViewModel {
var time: String {
guard let ticketHolder = ticketHolder else { return "" }
if case let .validating = state {
if case .validating = state {
return ""
} else {
return ticketHolder.date.format("hh:mm", overrideWithTimezoneIdentifier: ticketHolder.timeZoneIdentifier)
@ -95,7 +95,7 @@ struct ImportTicketViewControllerViewModel {
var teams: String {
guard let ticketHolder = ticketHolder else { return "" }
if case let .validating = state {
if case .validating = state {
return ""
} else {
return R.string.localizable.aWalletTicketTokenMatchVs(ticketHolder.countryA, ticketHolder.countryB)
@ -109,7 +109,7 @@ struct ImportTicketViewControllerViewModel {
var venue: String {
guard let ticketHolder = ticketHolder else { return "" }
if case let .validating = state {
if case .validating = state {
return ""
} else {
return ticketHolder.venue
@ -118,7 +118,7 @@ struct ImportTicketViewControllerViewModel {
var date: String {
guard let ticketHolder = ticketHolder else { return "" }
if case let .validating = state {
if case .validating = state {
return ""
} else {
return ticketHolder.date.format("dd MMM yyyy", overrideWithTimezoneIdentifier: ticketHolder.timeZoneIdentifier)
@ -126,7 +126,7 @@ struct ImportTicketViewControllerViewModel {
}
var showTicketRowIcons: Bool {
if case let .validating = state {
if case .validating = state {
return false
} else {
return true
@ -149,7 +149,7 @@ struct ImportTicketViewControllerViewModel {
}
var statusColor: UIColor {
if case let .failed = state {
if case .failed = state {
return Colors.appRed
} else {
return UIColor(red: 20, green: 20, blue: 20)

@ -139,7 +139,6 @@ extension RedeemTicketsViewController: UITableViewDelegate, UITableViewDataSourc
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let ticketHolder = viewModel.item(for: indexPath)
let changedIndexPaths = viewModel.toggleSelection(for: indexPath)
animateRowHeightChanges(for: changedIndexPaths, in: tableView)
}

@ -47,7 +47,6 @@ class TicketRedemptionViewController: UIViewController {
stackView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(stackView)
let xMargin = CGFloat(16)
NSLayoutConstraint.activate([
titleLabel.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 30),
titleLabel.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -30),

@ -135,7 +135,6 @@ extension SellTicketsViewController: UITableViewDelegate, UITableViewDataSource
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let ticketHolder = viewModel.item(for: indexPath)
let changedIndexPaths = viewModel.toggleSelection(for: indexPath)
animateRowHeightChanges(for: changedIndexPaths, in: tableView)
}

@ -18,7 +18,7 @@ class AmountTextField: UIControl {
}
var ethToDollarRate: Double? = nil {
didSet {
if let ethToDollarRate = ethToDollarRate {
if let _ = ethToDollarRate {
updateAlternatePricingDisplay()
}
}

@ -111,7 +111,7 @@ struct Config {
case .rinkeby: return "https://rinkeby.trustwalletapp.com"
case .poa: return "https://poa.trustwalletapp.com"
case .sokol: return "https://trust-sokol.herokuapp.com"
case .custom(let custom):
case .custom:
return "" // Enable? make optional
}
}()

@ -29,8 +29,6 @@ class SettingsViewController: FormViewController {
override func viewDidLoad() {
super.viewDidLoad()
let account = session.account
view.backgroundColor = Colors.appBackground
tableView.separatorStyle = .none
tableView.backgroundColor = Colors.appBackground

@ -7,9 +7,7 @@ import Eureka
func applyStyle() {
if #available(iOS 11, *) {
if #available(iOS 11, *) {
UIBarButtonItem.appearance(whenContainedInInstancesOf: [UIDocumentBrowserViewController.self]).tintColor = Colors.appBackground
}
UIBarButtonItem.appearance(whenContainedInInstancesOf: [UIDocumentBrowserViewController.self]).tintColor = Colors.appBackground
} else {
UINavigationBar.appearance().isTranslucent = false
}
@ -21,7 +19,7 @@ func applyStyle() {
UINavigationBar.appearance().backIndicatorTransitionMaskImage = R.image.backWhite()
UINavigationBar.appearance().titleTextAttributes = [
.foregroundColor: Colors.appWhite,
.font: Fonts.light(size: 25)
.font: Fonts.light(size: 25) as Any
]
//We could have set the backBarButtonItem with an empty title for every view controller, but we don't have a place to do it for Eureka view controllers. Using appearance here, while a hack is still more convenient though, since we don't have to do it for every view controller instance

@ -58,7 +58,7 @@ class TicketAdaptor {
var results = results
if var previousRange = results.last, let previousTicket = previousRange.last, previousTicket.seatId + 1 == ticket.seatId {
previousRange.append(ticket)
results.popLast()
let _ = results.popLast()
results.append(previousRange)
return results
} else {

@ -203,7 +203,6 @@ extension TicketsViewController: UITableViewDelegate, UITableViewDataSource {
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let ticketHolder = viewModel.item(for: indexPath)
let changedIndexPaths = viewModel.toggleDetailsVisible(for: indexPath)
animateRowHeightChanges(for: changedIndexPaths, in: tableView)
}

@ -512,7 +512,7 @@ extension TicketsCoordinator: TransferTicketsViaWalletAddressViewControllerDeleg
}
//Defensive. Should already be checked before this
guard let address = Address(string: walletAddress) else {
guard let _ = Address(string: walletAddress) else {
return self.navigationController.displayError(error: Errors.invalidAddress)
}

@ -143,8 +143,8 @@ class TransactionDataCoordinator {
Session.send(EtherServiceRequest(batch: BatchFactory().create(request))) { [weak self] result in
guard let `self` = self else { return }
switch result {
case .success(let parsedTransaction):
// NSLog("parsedTransaction \(parsedTransaction)")
case .success:
// NSLog("parsedTransaction \(_parsedTransaction)")
if transaction.date > Date().addingTimeInterval(Config.deleyedTransactionInternalSeconds) {
self.update(state: .completed, for: transaction)
self.update(items: [transaction])
@ -156,7 +156,7 @@ class TransactionDataCoordinator {
// TODO: Think about the logic to handle pending transactions.
guard let error = error as? JSONRPCError else { return }
switch error {
case .responseError(let code, let message, _):
case .responseError:
// NSLog("code \(code), error: \(message)")
self.delete(transactions: [transaction])
case .resultObjectParseError:

@ -84,7 +84,6 @@ class TransactionsViewController: UIViewController {
reflectActionButtonsVisibility()
let separatorThickness = CGFloat(1)
NSLayoutConstraint.activate([
tableView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
tableView.leadingAnchor.constraint(equalTo: view.leadingAnchor),

@ -64,7 +64,7 @@ struct TransactionViewModel {
let amount = NSAttributedString(
string: amountWithSign(for: value.amount),
attributes: [
.font: Fonts.regular(size: 24),
.font: Fonts.regular(size: 24) as Any,
.foregroundColor: amountTextColor,
]
)
@ -72,7 +72,7 @@ struct TransactionViewModel {
let currency = NSAttributedString(
string: " " + value.symbol,
attributes: [
.font: Fonts.regular(size: 16)
.font: Fonts.regular(size: 16) as Any
]
)

@ -91,6 +91,7 @@ class TransferTicketsCoordinator: Coordinator {
case .success:
self.sendTransaction(with: configurator)
case .failure(let error):
//TODO use the error object or remove it from the case-statement
self.processFailed()
}
}
@ -106,9 +107,10 @@ class TransferTicketsCoordinator: Coordinator {
sendTransactionCoordinator.send(transaction: unsignedTransaction) { [weak self] result in
if let celf = self {
switch result {
case .success(let type):
case .success:
celf.processSuccessful()
case .failure(let error):
//TODO use the error object or remove it from the case-statement
celf.processFailed()
}
}

@ -465,7 +465,7 @@ class SendViewController: UIViewController {
self.headerViewModel.currencyAmount = self.session.balanceCoordinator.viewModel.currencyAmount
self.headerViewModel.currencyAmountWithoutSymbol = self.session.balanceCoordinator.viewModel.currencyAmountWithoutSymbol
if let viewModel = self.viewModel {
configure(viewModel: self.viewModel)
configure(viewModel: viewModel)
}
default:
break

@ -135,7 +135,6 @@ extension TransferTicketsViewController: UITableViewDelegate, UITableViewDataSou
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let ticketHolder = viewModel.item(for: indexPath)
let changedIndexPaths = viewModel.toggleSelection(for: indexPath)
animateRowHeightChanges(for: changedIndexPaths, in: tableView)
}

@ -122,7 +122,7 @@ struct ConfirmPaymentDetailsViewModel {
let amount = NSAttributedString(
string: amountWithSign(for: string),
attributes: [
.font: Fonts.regular(size: 28),
.font: Fonts.regular(size: 28) as Any,
.foregroundColor: amountTextColor,
]
)
@ -130,7 +130,7 @@ struct ConfirmPaymentDetailsViewModel {
let currency = NSAttributedString(
string: " \(transaction.transferType.symbol(server: config.server))",
attributes: [
.font: Fonts.regular(size: 20),
.font: Fonts.regular(size: 20) as Any,
]
)
return amount + currency

@ -41,14 +41,14 @@ class InitialWalletCreationCoordinator: Coordinator {
func showCreateWallet() {
let coordinator = WalletCoordinator(navigationController: self.navigationController, keystore: keystore)
coordinator.delegate = self
coordinator.start(entryPoint)
let _ = coordinator.start(entryPoint)
addCoordinator(coordinator)
}
func presentImportWallet() {
let coordinator = WalletCoordinator(keystore: keystore)
coordinator.delegate = self
coordinator.start(entryPoint)
let _ = coordinator.start(entryPoint)
navigationController.present(coordinator.navigationController, animated: true, completion: nil)
addCoordinator(coordinator)
}

@ -211,8 +211,6 @@ class ImportWalletViewController: UIViewController {
return validatePrivateKey()
case .watch:
return validateWatch()
default:
return true
}
}
@ -325,8 +323,6 @@ class ImportWalletViewController: UIViewController {
privateKeyTextView.value = string
case .watch:
watchAddressTextField.value = string
default:
return
}
}
@ -450,8 +446,6 @@ extension ImportWalletViewController: ImportWalletTabBarDelegate {
showPrivateKeyControlsOnly()
case .watch:
showWatchControlsOnly()
default:
break
}
}
}

Loading…
Cancel
Save