forked from trustwallet/trust-wallet-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Michael Scoff
committed
Oct 28, 2017
1 parent
1de81f9
commit f86a730
Showing
12 changed files
with
165 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright SIX DAY LLC. All rights reserved. | ||
|
||
import Foundation | ||
import UIKit | ||
|
||
protocol TokensCoordinatorDelegate: class { | ||
func didCancel(in coordinator: TokensCoordinator) | ||
} | ||
|
||
class TokensCoordinator: Coordinator { | ||
|
||
let navigationController: UINavigationController | ||
let account: Account | ||
var coordinators: [Coordinator] = [] | ||
weak var delegate: TokensCoordinatorDelegate? | ||
|
||
init( | ||
navigationController: UINavigationController, | ||
account: Account | ||
) { | ||
self.navigationController = navigationController | ||
self.account = account | ||
} | ||
|
||
func start() { | ||
showTokens() | ||
} | ||
|
||
func showTokens() { | ||
let controller = TokensViewController(account: account) | ||
controller.delegate = self | ||
if UIDevice.current.userInterfaceIdiom == .pad { | ||
let nav = UINavigationController(rootViewController: controller) | ||
nav.modalPresentationStyle = .formSheet | ||
controller.navigationItem.leftBarButtonItem = UIBarButtonItem( | ||
barButtonSystemItem: .cancel, | ||
target: self, | ||
action: #selector(dismiss) | ||
) | ||
navigationController.present(nav, animated: true, completion: nil) | ||
} else { | ||
navigationController.pushViewController(controller, animated: true) | ||
} | ||
} | ||
|
||
@objc func dismiss() { | ||
navigationController.dismiss(animated: true, completion: nil) | ||
delegate?.didCancel(in: self) | ||
} | ||
} | ||
|
||
extension TokensCoordinator: TokensViewControllerDelegate { | ||
func didSelect(token: Token, in viewController: UIViewController) { | ||
// | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.