|
@ -35,16 +35,35 @@ class HomeViewController: UIViewController, UICollectionViewDelegateFlowLayout { |
|
|
|
|
|
|
|
|
// MARK: IBActions |
|
|
// MARK: IBActions |
|
|
|
|
|
|
|
|
|
|
|
@IBAction func closeVerificationNotice(_ sender: UIButton) { |
|
|
|
|
|
UIView.animate(withDuration: 0.33) { |
|
|
|
|
|
self.verificationNoticeView.alpha = 0 |
|
|
|
|
|
} |
|
|
|
|
|
self.verificationNoticeView.isHidden = true |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// MARK: Other Functions |
|
|
// MARK: Other Functions |
|
|
|
|
|
|
|
|
private func setup() { |
|
|
private func setup() { |
|
|
// all setup should be done here |
|
|
// all setup should be done here |
|
|
setupDelegates() |
|
|
setupDelegates() |
|
|
configureViews() |
|
|
configureViews() |
|
|
|
|
|
setupNotifications() |
|
|
|
|
|
|
|
|
self.setupPicturedNavBar() |
|
|
self.setupPicturedNavBar() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private func setupNotifications() { |
|
|
|
|
|
let center = NotificationCenter.default |
|
|
|
|
|
center.addObserver(self, selector: #selector(self.showSendMoney), name: self.getSendMoneyNotificationName(), object: nil) |
|
|
|
|
|
center.addObserver(self, selector: #selector(self.showMobileRecharge), name: self.getMobileRechargeNotificationName(), object: nil) |
|
|
|
|
|
center.addObserver(self, selector: #selector(self.showTodaysRate), name: self.getTodaysRateNotificationName(), 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.showWalletToWallet), name: self.getWalletToWalletNotificationName(), object: nil) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private func setupDelegates() { |
|
|
private func setupDelegates() { |
|
|
self.tableView.delegate = self |
|
|
self.tableView.delegate = self |
|
|
self.tableView.dataSource = self |
|
|
self.tableView.dataSource = self |
|
@ -65,19 +84,54 @@ class HomeViewController: UIViewController, UICollectionViewDelegateFlowLayout { |
|
|
showUnverifiedNotice() |
|
|
showUnverifiedNotice() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@IBAction func closeVerificationNotice(_ sender: UIButton) { |
|
|
|
|
|
UIView.animate(withDuration: 0.33) { |
|
|
|
|
|
self.verificationNoticeView.alpha = 0 |
|
|
|
|
|
} |
|
|
|
|
|
self.verificationNoticeView.isHidden = true |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private func isUserVerified() -> Bool { |
|
|
private func isUserVerified() -> Bool { |
|
|
return false |
|
|
return false |
|
|
let val = (UserDefaults.standard.object(forKey: UserKeys.verified) as? Bool ) ?? false |
|
|
let val = (UserDefaults.standard.object(forKey: UserKeys.verified) as? Bool ) ?? false |
|
|
print(val) |
|
|
print(val) |
|
|
return val |
|
|
return val |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@objc private func showSendMoney() { |
|
|
|
|
|
if !isVerifiedUser() { |
|
|
|
|
|
let viewcontroller = UIStoryboard.init(name: |
|
|
|
|
|
"RecipientListViewController", bundle: nil).instantiateViewController(withIdentifier: "RecipientListViewController") as! RecipientListViewController |
|
|
|
|
|
self.navigationController?.pushViewController(viewcontroller, animated: true) |
|
|
|
|
|
} else { |
|
|
|
|
|
self.popUpMessage(value: 13) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@objc private func showMobileRecharge() { |
|
|
|
|
|
self.alert(message: "This feature is coming soon") |
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
if isUserVerified() { |
|
|
|
|
|
self.performSegue(withIdentifier: "mobileRecharge", sender: nil) |
|
|
|
|
|
}else { |
|
|
|
|
|
self.popUpMessage(value: 13) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@objc private func showTodaysRate() { |
|
|
|
|
|
let exchangeRateWireFrame = ExchangeRatesWireframe() |
|
|
|
|
|
if let navigation = self.navigationController { |
|
|
|
|
|
exchangeRateWireFrame.pushMainView(in: navigation) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@objc private func showTrackYourTransfer() { |
|
|
|
|
|
self.performSegue(withIdentifier: "trackTransfer", sender: nil) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@objc private func showTransactionStatement() { |
|
|
|
|
|
self.performSegue(withIdentifier: "transactionStatement", sender: nil) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@objc private func showWalletToWallet() { |
|
|
|
|
|
self.alert(message: "This feature is coming soon") |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// MARK: HomeViewInterface |
|
|
// MARK: HomeViewInterface |
|
@ -137,3 +191,28 @@ extension HomeViewController: UITableViewDataSource { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// notification Name |
|
|
|
|
|
extension HomeViewController { |
|
|
|
|
|
func getSendMoneyNotificationName() -> Notification.Name { |
|
|
|
|
|
return Notification.Name.init(rawValue: MenuNotificationName.sendMoney) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func getMobileRechargeNotificationName() -> Notification.Name { |
|
|
|
|
|
return Notification.Name.init(rawValue: MenuNotificationName.mobileRecharge) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func getTodaysRateNotificationName() -> Notification.Name { |
|
|
|
|
|
return Notification.Name.init(rawValue: MenuNotificationName.todaysRate) |
|
|
|
|
|
} |
|
|
|
|
|
func getTrackYourTransferNotificationName() -> Notification.Name { |
|
|
|
|
|
return Notification.Name.init(rawValue: MenuNotificationName.trackYourTransfer) |
|
|
|
|
|
} |
|
|
|
|
|
func getTransactionStatementNotificationName() -> Notification.Name { |
|
|
|
|
|
return Notification.Name.init(rawValue: MenuNotificationName.transactionStatement) |
|
|
|
|
|
} |
|
|
|
|
|
func getWalletToWalletNotificationName() -> Notification.Name { |
|
|
|
|
|
return Notification.Name.init(rawValue: MenuNotificationName.walletToWallet) |
|
|
|
|
|
} |
|
|
|
|
|
} |