An advanced Ethereum/EVM mobile wallet
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
alpha-wallet-ios/Trust/Deposit/Coordinators/DepositCoordinator.swift

69 lines
2.4 KiB

// Copyright SIX DAY LLC. All rights reserved.
import Foundation
import UIKit
class DepositCoordinator: Coordinator {
let navigationController: UINavigationController
let account: Account
var coordinators: [Coordinator] = []
init(
navigationController: UINavigationController,
account: Account
) {
self.navigationController = navigationController
self.account = account
}
func start() {
showAlertSheet()
}
func showAlertSheet() {
let alertController = UIAlertController(
title: nil,
message: NSLocalizedString("deposit.alertSheetMessage", value: "How would you like to buy?", comment: ""),
preferredStyle: .actionSheet
)
alertController.popoverPresentationController?.sourceView = self.navigationController.view
let coinbaseAction = UIAlertAction(title: NSLocalizedString("deposit.viaCoinbase", value: "via Coinbase", comment: ""), style: .default) { _ in
self.showCoinbase()
}
let shapeShiftAction = UIAlertAction(title: NSLocalizedString("deposit.viaShapeShift", value: "via ShapeShift (Crypto only)", comment: ""), style: .default) { _ in
self.showShapeShift()
}
let changellyAction = UIAlertAction(title: NSLocalizedString("deposit.viaChangelly", value: "via Changelly", comment: ""), style: .default) { _ in
self.showChangelly()
}
let cancelAction = UIAlertAction(title: NSLocalizedString("generic.cancel", value: "Cancel", comment: ""), style: .cancel) { _ in }
alertController.addAction(coinbaseAction)
alertController.addAction(shapeShiftAction)
alertController.addAction(changellyAction)
alertController.addAction(cancelAction)
navigationController.present(alertController, animated: true, completion: nil)
}
func showCoinbase() {
let widget = CoinbaseBuyWidget(
address: account.address.address
)
navigationController.openURL(widget.url)
}
func showShapeShift() {
let widget = ShapeShiftBuyWidget(
address: account.address.address
)
navigationController.openURL(widget.url)
}
func showChangelly() {
let widget = ChangellyBuyWidget(
address: account.address.address
)
navigationController.openURL(widget.url)
}
}