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.
56 lines
1.7 KiB
56 lines
1.7 KiB
//
|
|
// HomeRemainingLimitTableViewCell.swift
|
|
// GMERemittance
|
|
//
|
|
// Created by gme_2 on 21/09/2018.
|
|
// Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class HomeRemainingLimitTableViewCell: UITableViewCell {
|
|
|
|
struct StringConstant {
|
|
let yearlyLimit = "remaining_limit_text".localized()
|
|
}
|
|
|
|
@IBOutlet weak var pointBackgroundView: UIView!
|
|
@IBOutlet weak var amountLabel: UILabel!
|
|
@IBOutlet weak var rewardPointAmountLabel: UILabel!
|
|
@IBOutlet weak var userNameLabel: UILabel!
|
|
@IBOutlet weak var remainingYearlyLabel: UILabel!
|
|
|
|
var user: User?
|
|
|
|
override func awakeFromNib() {
|
|
super.awakeFromNib()
|
|
// Initialization code
|
|
NotificationCenter.default.addObserver(self, selector: #selector(self.getYearlyLimitNotificationName), name: self.getYearlyLimitNotificationName(), object: nil)
|
|
}
|
|
|
|
func setup() {
|
|
let limits = UserDefaults.standard.string(forKey: UserKeys.yearlyLimit)
|
|
self.amountLabel.text = limits
|
|
self.userNameLabel.text = user?.firstName?.capitalized
|
|
configureText()
|
|
}
|
|
|
|
private func configureText() {
|
|
let text = "remaining_limit_text".localized()
|
|
self.remainingYearlyLabel.text = text
|
|
}
|
|
|
|
@objc private func getYearlyLimitNotificationName() -> Notification.Name {
|
|
return Notification.Name.init(AppConstants.yearlyLimitNotification)
|
|
}
|
|
|
|
private func updateYearlyLimit(sender: Notification) {
|
|
if let amount = sender.userInfo?[AppConstants.yearlyLimitNotification] as? String {
|
|
self.amountLabel.text
|
|
= amount
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|