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.
97 lines
3.9 KiB
97 lines
3.9 KiB
|
|
import UIKit
|
|
import Localize_Swift
|
|
|
|
class ProfileViewController: UIViewController {
|
|
|
|
struct StringConstants {
|
|
let changePasswordText = "change_password_text".localized()
|
|
let gmeWalletNotText = "gme_wallet_no_text".localized()
|
|
let yourAvailableBalanceText = "available_balance_text".localized()
|
|
let profileText = "profile_text".localized()
|
|
let withdrawButtonText = "withdraw_text".localized()
|
|
}
|
|
|
|
@IBOutlet weak var labelUserProfileName: UILabel!
|
|
@IBOutlet weak var imageViewUserProfile: UIImageView!
|
|
@IBOutlet weak var gmeWalletNumber: UILabel!
|
|
@IBOutlet weak var buttonEdit: UIButton!
|
|
@IBOutlet weak var labelUserName: UILabel?
|
|
@IBOutlet weak var labelEmail: UILabel!
|
|
@IBOutlet weak var labelMobileNumber: UILabel!
|
|
@IBOutlet weak var labelBalance: UILabel!
|
|
@IBOutlet weak var withdrawButton: UIButton!
|
|
|
|
@IBOutlet weak var changePasswordButton: UIButton!
|
|
|
|
// titles
|
|
@IBOutlet weak var availableBalancetTitleLabel: UILabel!
|
|
@IBOutlet weak var gmeWalletNoTitle: UILabel!
|
|
|
|
|
|
var profileImage: UIImage!
|
|
|
|
public static var profileConnectionTimeOutCheck = 0
|
|
|
|
override func viewWillAppear(_ animated: Bool) {
|
|
super.viewWillDisappear(animated)
|
|
self.configureLanguage()
|
|
self.setupNormalNavigation()
|
|
self.navigationItem.title = StringConstants().profileText
|
|
self.withdrawButton.isHidden = !Utility.pennyTestVerified()
|
|
show()
|
|
}
|
|
|
|
override func viewWillDisappear(_ animated: Bool) {
|
|
super.viewWillDisappear(animated)
|
|
self.navigationItem.title = ""
|
|
}
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
NotificationCenter.default.addObserver(self, selector: #selector(setupTabItem), name: NSNotification.Name(LCLLanguageChangeNotification), object: nil)
|
|
}
|
|
|
|
func configureLanguage() {
|
|
self.availableBalancetTitleLabel.text = StringConstants().yourAvailableBalanceText
|
|
self.gmeWalletNumber.text = StringConstants().gmeWalletNotText
|
|
self.withdrawButton.setTitle(StringConstants().withdrawButtonText, for: UIControlState.normal)
|
|
self.changePasswordButton.setTitle(StringConstants().changePasswordText, for: UIControlState.normal)
|
|
}
|
|
|
|
override func setupTabItem() {
|
|
let image = UIImage.init(named: "ic-profile")
|
|
self.tabBarItem = UITabBarItem(title: "profile_text".localized(), image: image, selectedImage: nil)
|
|
self.tabBarItem.titlePositionAdjustment = UIOffset(horizontal: 0, vertical: UI_USER_INTERFACE_IDIOM() == .pad ? 2 : -6)
|
|
}
|
|
|
|
|
|
|
|
@IBAction func withdraw(_ sender: UIButton) {
|
|
let vc = UIStoryboard.init(name: "autoRefund", bundle: nil).instantiateViewController(withIdentifier: "AutoRefundsViewController") as! AutoRefundsViewController
|
|
self.navigationController?.pushViewController(vc, animated: true)
|
|
}
|
|
|
|
|
|
func getWithdrawNotificationName() -> Notification.Name {
|
|
return Notification.Name.init(SideMenuNavigationNotifications.withdraw)
|
|
}
|
|
|
|
func show() {
|
|
let store = UserDefaults.standard
|
|
let name = store.string(forKey: UserKeys.firstName)
|
|
self.labelUserName?.text = name?.capitalized
|
|
self.labelMobileNumber.text = store.string(forKey: UserKeys.mobileNumber)
|
|
self.labelEmail.text = store.string(forKey: UserKeys.email)
|
|
self.labelBalance.text = store.string(forKey: UserKeys.availableBalance)
|
|
let walletNum = store.string(forKey: UserKeys.walletNumber)
|
|
let bankName = store.string(forKey: UserKeys.primaryBankName)
|
|
gmeWalletNumber.text = walletNum
|
|
labelUserProfileName.layer.backgroundColor = UIColor(hex: 0x2e3192).cgColor
|
|
labelUserProfileName.layer.cornerRadius = labelUserProfileName.frame.height / 2
|
|
labelUserProfileName.text = labelUserName?.text?.prefix(1).uppercased()
|
|
}
|
|
|
|
// ccR
|
|
}
|
|
|