|
@ -25,7 +25,11 @@ class HomeViewController: UIViewController, UICollectionViewDelegateFlowLayout { |
|
|
var presenter: HomeModuleInterface? |
|
|
var presenter: HomeModuleInterface? |
|
|
var sections: [Sections] = [.balance, .collection] |
|
|
var sections: [Sections] = [.balance, .collection] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var menuHeight: CGFloat? { |
|
|
|
|
|
didSet { |
|
|
|
|
|
self.tableView.reloadData() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
// MARK: VC's Life cycle |
|
|
// MARK: VC's Life cycle |
|
|
|
|
|
|
|
|
override func viewDidLoad() { |
|
|
override func viewDidLoad() { |
|
@ -50,10 +54,11 @@ class HomeViewController: UIViewController, UICollectionViewDelegateFlowLayout { |
|
|
setupDelegates() |
|
|
setupDelegates() |
|
|
configureViews() |
|
|
configureViews() |
|
|
setupNotifications() |
|
|
setupNotifications() |
|
|
|
|
|
|
|
|
self.setupPicturedNavBar() |
|
|
self.setupPicturedNavBar() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private func setupNotifications() { |
|
|
private func setupNotifications() { |
|
|
let center = NotificationCenter.default |
|
|
let center = NotificationCenter.default |
|
|
center.addObserver(self, selector: #selector(self.showSendMoney), name: self.getSendMoneyNotificationName(), object: nil) |
|
|
center.addObserver(self, selector: #selector(self.showSendMoney), name: self.getSendMoneyNotificationName(), object: nil) |
|
@ -62,6 +67,7 @@ class HomeViewController: UIViewController, UICollectionViewDelegateFlowLayout { |
|
|
center.addObserver(self, selector: #selector(self.showTrackYourTransfer), name: self.getTrackYourTransferNotificationName(), object: nil) |
|
|
center.addObserver(self, selector: #selector(self.showTrackYourTransfer), name: self.getTrackYourTransferNotificationName(), object: nil) |
|
|
center.addObserver(self, selector: #selector(self.showTransactionStatement), name: self.getTransactionStatementNotificationName(), object: nil) |
|
|
center.addObserver(self, selector: #selector(self.showTransactionStatement), name: self.getTransactionStatementNotificationName(), object: nil) |
|
|
center.addObserver(self, selector: #selector(self.showWalletToWallet), name: self.getWalletToWalletNotificationName(), object: nil) |
|
|
center.addObserver(self, selector: #selector(self.showWalletToWallet), name: self.getWalletToWalletNotificationName(), object: nil) |
|
|
|
|
|
center.addObserver(self, selector: #selector(self.setupHeight(sender:)), name: self.getCollectionHeightNotificationName(), object: nil) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private func setupDelegates() { |
|
|
private func setupDelegates() { |
|
@ -82,9 +88,17 @@ class HomeViewController: UIViewController, UICollectionViewDelegateFlowLayout { |
|
|
self.verificationNoticeView.isHidden = true |
|
|
self.verificationNoticeView.isHidden = true |
|
|
self.verificationNoticeView.alpha = 0 |
|
|
self.verificationNoticeView.alpha = 0 |
|
|
showUnverifiedNotice() |
|
|
showUnverifiedNotice() |
|
|
|
|
|
setNavBar() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func setNavBar() { |
|
|
|
|
|
let selector = #selector(self.showSideMenu) |
|
|
|
|
|
self.setupPicturedNavBar(sideMenuAction: selector) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@objc func showSideMenu() { |
|
|
|
|
|
sideMenuController?.showLeftViewAnimated() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private func isUserVerified() -> Bool { |
|
|
private func isUserVerified() -> Bool { |
|
|
return false |
|
|
return false |
|
@ -132,6 +146,12 @@ class HomeViewController: UIViewController, UICollectionViewDelegateFlowLayout { |
|
|
@objc private func showWalletToWallet() { |
|
|
@objc private func showWalletToWallet() { |
|
|
self.alert(message: "This feature is coming soon") |
|
|
self.alert(message: "This feature is coming soon") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@objc private func setupHeight(sender: Notification) { |
|
|
|
|
|
if let height = sender.userInfo?[MenuNotificationName.collectionHeight] as? CGFloat { |
|
|
|
|
|
self.menuHeight = height |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// MARK: HomeViewInterface |
|
|
// MARK: HomeViewInterface |
|
@ -152,7 +172,7 @@ extension HomeViewController: UITableViewDelegate { |
|
|
let totalHeight = view.frame.height |
|
|
let totalHeight = view.frame.height |
|
|
let ramainingBalanceCellHeight: CGFloat = 100 |
|
|
let ramainingBalanceCellHeight: CGFloat = 100 |
|
|
let finalHeight = totalHeight - ramainingBalanceCellHeight |
|
|
let finalHeight = totalHeight - ramainingBalanceCellHeight |
|
|
return finalHeight |
|
|
|
|
|
|
|
|
return self.menuHeight ?? finalHeight |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -215,4 +235,8 @@ extension HomeViewController { |
|
|
func getWalletToWalletNotificationName() -> Notification.Name { |
|
|
func getWalletToWalletNotificationName() -> Notification.Name { |
|
|
return Notification.Name.init(rawValue: MenuNotificationName.walletToWallet) |
|
|
return Notification.Name.init(rawValue: MenuNotificationName.walletToWallet) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func getCollectionHeightNotificationName() -> Notification.Name { |
|
|
|
|
|
return Notification.Name.init(rawValue: MenuNotificationName.collectionHeight) |
|
|
|
|
|
} |
|
|
} |
|
|
} |