Dibya Malla
2 years ago
8 changed files with 495 additions and 8 deletions
-
BIN.DS_Store
-
22GME Remit.xcodeproj/project.pbxproj
-
112GME Remit/Extensions/UIView+Ext.swift
-
167GME Remit/Modules/Home/User Interface/View/Custom/HomeAccountDetailView.swift
-
193GME Remit/Modules/Home/User Interface/View/HomeViewControllerNew.swift
-
2GME Remit/Modules/Home/User Interface/Wireframe/HomeWireframe.swift
-
6GME Remit/Modules/Main/User Interface/View/MainViewController.swift
-
1GME Remit/Utilities/TabBar Helper/CustomTabBar.swift
@ -0,0 +1,167 @@ |
|||
// |
|||
|
|||
import UIKit |
|||
|
|||
class HomeAccountDetailView: UIView { |
|||
|
|||
private let accountDetailView: UIView = { |
|||
let view = UIView(frame: .zero) |
|||
view.backgroundColor = .themeWhite |
|||
view.translatesAutoresizingMaskIntoConstraints = false |
|||
return view |
|||
}() |
|||
|
|||
private let accountNumberTitleLabel: UILabel = { |
|||
let label = UILabel() |
|||
label.translatesAutoresizingMaskIntoConstraints = false |
|||
return label |
|||
}() |
|||
|
|||
private let accountNumberValueLabel: UILabel = { |
|||
let label = UILabel() |
|||
label.translatesAutoresizingMaskIntoConstraints = false |
|||
return label |
|||
}() |
|||
|
|||
private let balanceTitleLabel: UILabel = { |
|||
let label = UILabel() |
|||
label.translatesAutoresizingMaskIntoConstraints = false |
|||
return label |
|||
}() |
|||
|
|||
private let balanceValueLabel: UILabel = { |
|||
let label = UILabel() |
|||
label.translatesAutoresizingMaskIntoConstraints = false |
|||
return label |
|||
}() |
|||
|
|||
private let copyButton: UIButton = { |
|||
let button = UIButton() |
|||
button.translatesAutoresizingMaskIntoConstraints = false |
|||
return button |
|||
}() |
|||
|
|||
private let uploadSlipButton: UIButton = { |
|||
let button = UIButton() |
|||
button.translatesAutoresizingMaskIntoConstraints = false |
|||
return button |
|||
}() |
|||
|
|||
private let exchangeRateView: UIView = { |
|||
let view = UIView() |
|||
view.translatesAutoresizingMaskIntoConstraints = false |
|||
return view |
|||
}() |
|||
|
|||
|
|||
override init(frame: CGRect) { |
|||
super.init(frame: .zero) |
|||
setup() |
|||
} |
|||
|
|||
required init?(coder: NSCoder) { |
|||
fatalError("init(coder:) has not been implemented") |
|||
} |
|||
|
|||
func setup() { |
|||
uiSetup() |
|||
uiPropertiesSetup() |
|||
} |
|||
|
|||
private func uiSetup() { |
|||
|
|||
self.addSubview(accountDetailView) |
|||
accountDetailView.anchor(top: self.topAnchor, |
|||
paddingTop: 0, |
|||
bottom: self.bottomAnchor, |
|||
paddingBottom: 0, |
|||
left: self.leadingAnchor, |
|||
paddingLeft: 0, |
|||
right: self.trailingAnchor, |
|||
paddingRight: 0, |
|||
width: 0, |
|||
height: 0) |
|||
|
|||
accountDetailView.addSubviews(accountNumberTitleLabel, |
|||
accountNumberValueLabel, |
|||
balanceTitleLabel, |
|||
balanceValueLabel, |
|||
copyButton, |
|||
uploadSlipButton) |
|||
accountDetailView.addShadow() |
|||
|
|||
accountNumberTitleLabel.anchor(top: accountDetailView.topAnchor, |
|||
paddingTop: 16, |
|||
bottom: nil, |
|||
paddingBottom: 0, |
|||
left: accountDetailView.leadingAnchor, paddingLeft: 16, |
|||
right: accountDetailView.trailingAnchor, paddingRight: -16) |
|||
|
|||
accountNumberValueLabel.anchor(top: accountNumberTitleLabel.bottomAnchor, |
|||
paddingTop: 4, |
|||
bottom: nil, |
|||
paddingBottom: 0, |
|||
left: accountDetailView.leadingAnchor, |
|||
paddingLeft: 16 |
|||
) |
|||
|
|||
copyButton.anchor(top: nil, |
|||
bottom: nil, |
|||
left: accountNumberValueLabel.trailingAnchor, |
|||
paddingLeft: 4, |
|||
width: 80, |
|||
height: 80 |
|||
) |
|||
|
|||
copyButton.center(centerX: nil, |
|||
paddingX: 0, |
|||
centerY: accountNumberValueLabel.centerYAnchor, |
|||
paddingY: 0) |
|||
|
|||
copyButton.anchorLessThanEqualTo(right: accountDetailView.trailingAnchor, |
|||
paddingRight: -16) |
|||
|
|||
balanceTitleLabel.anchor(top: accountNumberValueLabel.bottomAnchor, |
|||
paddingTop: 16, |
|||
left: accountDetailView.leadingAnchor, |
|||
paddingLeft: 16) |
|||
|
|||
balanceValueLabel.anchor(top: balanceTitleLabel.bottomAnchor, |
|||
paddingTop: 4, |
|||
bottom: accountDetailView.bottomAnchor, |
|||
paddingBottom: -16, |
|||
left: accountDetailView.leadingAnchor, |
|||
paddingLeft: 16) |
|||
|
|||
uploadSlipButton.anchor(top: balanceTitleLabel.topAnchor, |
|||
bottom: balanceValueLabel.bottomAnchor, |
|||
right: accountDetailView.trailingAnchor, |
|||
paddingRight: -16 |
|||
) |
|||
|
|||
} |
|||
|
|||
func uiPropertiesSetup() { |
|||
|
|||
accountDetailView.setupCornerRadius(20,maskedCorners: [.layerMinXMaxYCorner, .layerMaxXMaxYCorner]) |
|||
|
|||
accountNumberTitleLabel.text = "Account" |
|||
accountNumberValueLabel.text = "MGSGHAA" |
|||
copyButton.setTitle("Copy", for: .normal) |
|||
copyButton.setTitleColor(.red, for: .normal) |
|||
|
|||
balanceTitleLabel.text = "Balance" |
|||
balanceValueLabel.text = "6482682342" |
|||
|
|||
uploadSlipButton.backgroundColor = .red |
|||
uploadSlipButton.set(cornerRadius: 5) |
|||
uploadSlipButton.setImage(UIImage(named: "chat"), for: .normal) |
|||
uploadSlipButton.setTitle("Upload", for: .normal) |
|||
uploadSlipButton.setTitleColor(.green, for: .normal) |
|||
uploadSlipButton.contentEdgeInsets = UIEdgeInsets(top: 10, |
|||
left: 10, |
|||
bottom: 10, |
|||
right: 20) |
|||
|
|||
} |
|||
} |
@ -0,0 +1,193 @@ |
|||
// |
|||
|
|||
import UIKit |
|||
import Localize_Swift |
|||
import LGSideMenuController |
|||
|
|||
class HomeViewControllerNew: UIViewController { |
|||
|
|||
var user: User? |
|||
var presenter: HomeModuleInterface? |
|||
|
|||
// MARK: UIView |
|||
|
|||
private let scrollView: UIScrollView = { |
|||
let view = UIScrollView(frame: .zero) |
|||
view.translatesAutoresizingMaskIntoConstraints = false |
|||
view.backgroundColor = .themeWhite |
|||
return view |
|||
}() |
|||
|
|||
private let mainContainerView: UIView = { |
|||
let view = UIView(frame: .zero) |
|||
view.backgroundColor = .themeWhite |
|||
view.translatesAutoresizingMaskIntoConstraints = false |
|||
return view |
|||
}() |
|||
|
|||
private let accountDetailView: HomeAccountDetailView = { |
|||
let view = HomeAccountDetailView() |
|||
view.backgroundColor = .themeWhite |
|||
view.translatesAutoresizingMaskIntoConstraints = false |
|||
return view |
|||
}() |
|||
|
|||
private let accountNumberTitleLabel: UILabel = { |
|||
let label = UILabel() |
|||
label.translatesAutoresizingMaskIntoConstraints = false |
|||
return label |
|||
}() |
|||
|
|||
private let accountNumberValueLabel: UILabel = { |
|||
let label = UILabel() |
|||
label.translatesAutoresizingMaskIntoConstraints = false |
|||
return label |
|||
}() |
|||
|
|||
private let balanceTitleLabel: UILabel = { |
|||
let label = UILabel() |
|||
label.translatesAutoresizingMaskIntoConstraints = false |
|||
return label |
|||
}() |
|||
|
|||
private let balanceValueLabel: UILabel = { |
|||
let label = UILabel() |
|||
label.translatesAutoresizingMaskIntoConstraints = false |
|||
return label |
|||
}() |
|||
|
|||
private let copyButton: UIButton = { |
|||
let button = UIButton() |
|||
button.translatesAutoresizingMaskIntoConstraints = false |
|||
return button |
|||
}() |
|||
|
|||
private let uploadSlipButton: UIButton = { |
|||
let button = UIButton() |
|||
button.translatesAutoresizingMaskIntoConstraints = false |
|||
return button |
|||
}() |
|||
|
|||
private let exchangeRateView: UIView = { |
|||
let view = UIView() |
|||
view.translatesAutoresizingMaskIntoConstraints = false |
|||
return view |
|||
}() |
|||
|
|||
|
|||
init(){ |
|||
super.init(nibName: nil, bundle: nil) |
|||
} |
|||
|
|||
required init?(coder: NSCoder) { |
|||
fatalError("init(coder:) has not been implemented") |
|||
} |
|||
|
|||
override func viewDidLoad() { |
|||
super.viewDidLoad() |
|||
self.setup() |
|||
} |
|||
|
|||
override func viewWillAppear(_ animated: Bool) { |
|||
super.viewWillAppear(animated) |
|||
navigationController?.isNavigationBarHidden = true |
|||
self.navigationController?.setNavigationBarHidden(true, animated: animated) |
|||
} |
|||
|
|||
private func setup() { |
|||
uiSetup() |
|||
uiPropertiesSetup() |
|||
} |
|||
|
|||
private func uiSetup() { |
|||
|
|||
view.addSubview(scrollView) |
|||
scrollView.anchor(top: view.topAnchor, |
|||
paddingTop: 0, |
|||
bottom: view.bottomAnchor, |
|||
paddingBottom: 0, |
|||
left: view.leadingAnchor, |
|||
paddingLeft: 0, |
|||
right: view.trailingAnchor, |
|||
paddingRight: 0 |
|||
) |
|||
|
|||
scrollView.addSubview(mainContainerView) |
|||
|
|||
mainContainerView.anchor(top: scrollView.topAnchor, |
|||
paddingTop: 0, |
|||
bottom: scrollView.bottomAnchor, |
|||
paddingBottom: 0, |
|||
left: scrollView.leadingAnchor, |
|||
paddingLeft: 0, |
|||
right: scrollView.trailingAnchor, |
|||
paddingRight: 0 |
|||
) |
|||
|
|||
mainContainerView.widthAnchor.constraint(equalTo: scrollView.widthAnchor).isActive = true |
|||
|
|||
|
|||
mainContainerView.addSubviews(accountDetailView) |
|||
accountDetailView.anchor(top: mainContainerView.topAnchor, |
|||
paddingTop: 0, |
|||
bottom: mainContainerView.bottomAnchor, |
|||
paddingBottom: 0, |
|||
left: mainContainerView.leadingAnchor, |
|||
paddingLeft: 0, |
|||
right: mainContainerView.trailingAnchor, |
|||
paddingRight: 0, |
|||
width: 0, |
|||
height: 0) |
|||
|
|||
|
|||
} |
|||
|
|||
func uiPropertiesSetup() { |
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
extension HomeViewControllerNew: HomeViewInterface { |
|||
func showOtpView() { |
|||
guard let viewController = UIStoryboard(name: "OtpVerification", bundle: nil) |
|||
.instantiateViewController(withIdentifier: "OtpVerificationViewController") as? OtpVerificationViewController else { |
|||
return |
|||
} |
|||
|
|||
//viewController.delegate = self |
|||
self.present(viewController, animated: true, completion: nil) |
|||
} |
|||
|
|||
func checkOtpError(error: String) { |
|||
self.alert(type: .error, message: error) |
|||
} |
|||
|
|||
func success() { |
|||
self.alertWithOk(type: .success, message: "OTP Verification completed", title: "success_text".localized(), okTitle: "ok_text".localized()) { |
|||
//self.presenter?.viewIsReady() |
|||
} |
|||
} |
|||
|
|||
func show(model: User) { |
|||
self.user = model |
|||
} |
|||
|
|||
func show(error: String) { |
|||
self.alert(type: .error, message: error) |
|||
} |
|||
|
|||
func show(panicError: String) { |
|||
self.alert(type: .error, message: panicError, title: "Warning") { |
|||
//self.presenter?.logout() |
|||
} |
|||
} |
|||
|
|||
func showLoading() { |
|||
self.showProgressHud() |
|||
} |
|||
|
|||
func hideLoading() { |
|||
self.hideProgressHud() |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue