Browse Source

avaliable balance added

pull/1/head
gme_2 6 years ago
parent
commit
3ea78a1eee
  1. 7
      GMERemittance/Module/Home/User Interface/View/HomeViewController.swift
  2. 45
      GMERemittance/SideMenu/SideMenuViewController.swift

7
GMERemittance/Module/Home/User Interface/View/HomeViewController.swift

@ -37,6 +37,9 @@ class HomeViewController: UIViewController, UICollectionViewDelegateFlowLayout {
self.save(user: user)
self.showUnverifiedNotice()
self.tableView.reloadData()
let balance = user?.availableBalance ?? ""
let userInfo = [SideMenuNavigationNotifications.availableBalance : balance]
NotificationCenter.default.post(name: self.getAvailableBalanceNotificationName(), object: nil, userInfo: userInfo)
}
}
var sections: [Sections] = [.balance, .collection]
@ -466,6 +469,10 @@ extension HomeViewController {
func getCollectionHeightNotificationName() -> Notification.Name {
return Notification.Name.init(rawValue: MenuNotificationName.collectionHeight)
}
func getAvailableBalanceNotificationName() -> Notification.Name {
return Notification.Name.init(rawValue: SideMenuNavigationNotifications.availableBalance)
}
}

45
GMERemittance/SideMenu/SideMenuViewController.swift

@ -14,8 +14,10 @@ struct SideMenuNavigationNotifications {
static let aboutGme = "aboutGme"
static let support = "support"
static let setting = "setting"
static let availableBalance = "Available_Balance"
}
class SideMenuViewController: UIViewController {
@IBOutlet weak var imageViewProfileSetting: UIImageView!
@ -53,6 +55,13 @@ class SideMenuViewController: UIViewController {
private func setup() {
self.view.backgroundColor = AppConstants.themeRedColor
self.roundedBgView.layer.cornerRadius = 20
NotificationCenter.default.addObserver(self, selector: #selector(self.updateBalance(sender:)), name: self.getAvailableBalanceNotificationName(), object: nil)
}
@objc private func updateBalance(sender: Notification) {
let balance = sender.userInfo?[SideMenuNavigationNotifications.availableBalance] as? String
self.labelBalance.text = balance
}
private func setupBlueBackGroundTheme() {
@ -86,20 +95,6 @@ class SideMenuViewController: UIViewController {
NotificationCenter.default.post(name: self.getSettingNotificationName(), object: nil, userInfo: nil)
}
// Notification Names
func getAboutGmeNotificationName() -> Notification.Name {
return Notification.Name.init(SideMenuNavigationNotifications.aboutGme)
}
func getSupportNotificationName() -> Notification.Name {
return Notification.Name.init(SideMenuNavigationNotifications.support)
}
func getSettingNotificationName() -> Notification.Name {
return Notification.Name.init(SideMenuNavigationNotifications.setting)
}
@IBAction func withDraw(_ sender: Any) {
let storyboard = UIStoryboard.init(name: "Profile", bundle: Bundle.main)
if let withDrawViewController = storyboard.instantiateViewController(withIdentifier: "withdraw") as? WithdrawViewController {
@ -184,5 +179,27 @@ class SideMenuViewController: UIViewController {
imageViewProfileSetting.layer.cornerRadius = imageViewProfileSetting.frame.height / 2
}
// Notification Names
func getAboutGmeNotificationName() -> Notification.Name {
return Notification.Name.init(SideMenuNavigationNotifications.aboutGme)
}
func getSupportNotificationName() -> Notification.Name {
return Notification.Name.init(SideMenuNavigationNotifications.support)
}
func getSettingNotificationName() -> Notification.Name {
return Notification.Name.init(SideMenuNavigationNotifications.setting)
}
func getAvailableBalanceNotificationName() -> Notification.Name {
return Notification.Name.init(SideMenuNavigationNotifications.availableBalance)
}
}
Loading…
Cancel
Save