Browse Source

[Added] Account Detail view

v0.17
Dibya Malla 2 years ago
parent
commit
ba6e436fe6
  1. BIN
      .DS_Store
  2. 22
      GME Remit.xcodeproj/project.pbxproj
  3. 112
      GME Remit/Extensions/UIView+Ext.swift
  4. 167
      GME Remit/Modules/Home/User Interface/View/Custom/HomeAccountDetailView.swift
  5. 193
      GME Remit/Modules/Home/User Interface/View/HomeViewControllerNew.swift
  6. 2
      GME Remit/Modules/Home/User Interface/Wireframe/HomeWireframe.swift
  7. 6
      GME Remit/Modules/Main/User Interface/View/MainViewController.swift
  8. 1
      GME Remit/Utilities/TabBar Helper/CustomTabBar.swift

BIN
.DS_Store

22
GME Remit.xcodeproj/project.pbxproj

@ -32,6 +32,8 @@
241796D729B3825E005D8219 /* LoyalityPointsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 241796D629B3825E005D8219 /* LoyalityPointsModel.swift */; };
241796DE29B390DD005D8219 /* CustomTabItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 241796DD29B390DD005D8219 /* CustomTabItem.swift */; };
241796E029B3931C005D8219 /* CustomItemTabView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 241796DF29B3931C005D8219 /* CustomItemTabView.swift */; };
244C69B429B780A000D7B69A /* HomeViewControllerNew.swift in Sources */ = {isa = PBXBuildFile; fileRef = 244C69B329B780A000D7B69A /* HomeViewControllerNew.swift */; };
244C69B729B7A01600D7B69A /* HomeAccountDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 244C69B629B7A01600D7B69A /* HomeAccountDetailView.swift */; };
247A601629B4428500922B7F /* CustomTabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 247A601529B4428500922B7F /* CustomTabBar.swift */; };
281EF60028ACCC4D0092E5E6 /* HowToDepositModuleInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 281EF5ED28ACCC4D0092E5E6 /* HowToDepositModuleInterface.swift */; };
281EF60128ACCC4D0092E5E6 /* HowToDepositService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 281EF5F028ACCC4D0092E5E6 /* HowToDepositService.swift */; };
@ -850,6 +852,8 @@
241796D629B3825E005D8219 /* LoyalityPointsModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoyalityPointsModel.swift; sourceTree = "<group>"; };
241796DD29B390DD005D8219 /* CustomTabItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomTabItem.swift; sourceTree = "<group>"; };
241796DF29B3931C005D8219 /* CustomItemTabView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomItemTabView.swift; sourceTree = "<group>"; };
244C69B329B780A000D7B69A /* HomeViewControllerNew.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewControllerNew.swift; sourceTree = "<group>"; };
244C69B629B7A01600D7B69A /* HomeAccountDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeAccountDetailView.swift; sourceTree = "<group>"; };
247A601529B4428500922B7F /* CustomTabBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomTabBar.swift; sourceTree = "<group>"; };
281EF5ED28ACCC4D0092E5E6 /* HowToDepositModuleInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HowToDepositModuleInterface.swift; sourceTree = "<group>"; };
281EF5F028ACCC4D0092E5E6 /* HowToDepositService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HowToDepositService.swift; sourceTree = "<group>"; };
@ -1810,6 +1814,14 @@
path = "TabBar Helper";
sourceTree = "<group>";
};
244C69B529B79FF500D7B69A /* Custom */ = {
isa = PBXGroup;
children = (
244C69B629B7A01600D7B69A /* HomeAccountDetailView.swift */,
);
path = Custom;
sourceTree = "<group>";
};
281EF5EB28ACCC4D0092E5E6 /* HowToDeposit */ = {
isa = PBXGroup;
children = (
@ -5997,11 +6009,13 @@
D950BECC21549242008367A1 /* View */ = {
isa = PBXGroup;
children = (
244C69B529B79FF500D7B69A /* Custom */,
D950BEDC215496C0008367A1 /* Cell */,
D950BECD21549242008367A1 /* ViewModels */,
D950BECE21549242008367A1 /* Home.storyboard */,
D950BECF21549242008367A1 /* HomeViewController.swift */,
D950BED021549242008367A1 /* HomeViewInterface.swift */,
244C69B329B780A000D7B69A /* HomeViewControllerNew.swift */,
);
path = View;
sourceTree = "<group>";
@ -6920,7 +6934,7 @@
);
mainGroup = 9FD260EB1FD00458007A511D;
packageReferences = (
282F6A5E296483AE00E324FF /* XCRemoteSwiftPackageReference "swift-algorithms.git" */,
282F6A5E296483AE00E324FF /* XCRemoteSwiftPackageReference "swift-algorithms" */,
);
productRefGroup = 9FD260F51FD00458007A511D /* Products */;
projectDirPath = "";
@ -7674,6 +7688,7 @@
40CB8F5824D980D500E1E64E /* NewRegisterRequestModel.swift in Sources */,
73157B9C22DC1EEC009B836F /* PopupNotificationServiceType.swift in Sources */,
7327568323B0456400BF66C5 /* ManageAgreementPresenter.swift in Sources */,
244C69B429B780A000D7B69A /* HomeViewControllerNew.swift in Sources */,
89EA0D8B243EC1C6003ACCC8 /* ChangePersonalInformationViewInterface.swift in Sources */,
89739E3624459A630016251B /* SendMoneyReceiptModuleInterface.swift in Sources */,
405718D124D932AE0022CDDE /* NewUserRegisterViewInterface.swift in Sources */,
@ -7989,6 +8004,7 @@
89739E3124459A630016251B /* SendMoneyParentWireframeInput.swift in Sources */,
405AA0EF2541B32B00508420 /* PropertyUtility.swift in Sources */,
D950BED321549242008367A1 /* HomeService.swift in Sources */,
244C69B729B7A01600D7B69A /* HomeAccountDetailView.swift in Sources */,
7EDBFBDF24B2C5DA00AD5D4D /* RedeemCashPickUpWireframeInput.swift in Sources */,
7327568123B0456400BF66C5 /* ManageAgreementInteractorIO.swift in Sources */,
738714B6237CE86E0038FCB1 /* InboundReceiptInteractorIO.swift in Sources */,
@ -8670,7 +8686,7 @@
/* End XCConfigurationList section */
/* Begin XCRemoteSwiftPackageReference section */
282F6A5E296483AE00E324FF /* XCRemoteSwiftPackageReference "swift-algorithms.git" */ = {
282F6A5E296483AE00E324FF /* XCRemoteSwiftPackageReference "swift-algorithms" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/apple/swift-algorithms.git";
requirement = {
@ -8683,7 +8699,7 @@
/* Begin XCSwiftPackageProductDependency section */
282F6A5F296483AE00E324FF /* Algorithms */ = {
isa = XCSwiftPackageProductDependency;
package = 282F6A5E296483AE00E324FF /* XCRemoteSwiftPackageReference "swift-algorithms.git" */;
package = 282F6A5E296483AE00E324FF /* XCRemoteSwiftPackageReference "swift-algorithms" */;
productName = Algorithms;
};
/* End XCSwiftPackageProductDependency section */

112
GME Remit/Extensions/UIView+Ext.swift

@ -542,6 +542,118 @@ extension UIView {
}
}
extension UIView {
func anchor(top : NSLayoutYAxisAnchor? = nil,
paddingTop : CGFloat = 0 ,
bottom : NSLayoutYAxisAnchor? = nil,
paddingBottom : CGFloat = 0 ,
left: NSLayoutXAxisAnchor? = nil,
paddingLeft: CGFloat = 0,
right: NSLayoutXAxisAnchor? = nil,
paddingRight: CGFloat = 0,
width: CGFloat? = nil,
height: CGFloat? = nil ){
if let top = top {
topAnchor.constraint(equalTo: top, constant: paddingTop).isActive = true
}
if let bottom = bottom {
bottomAnchor.constraint(equalTo: bottom, constant: paddingBottom).isActive = true
}
if let left = left {
leadingAnchor.constraint(equalTo: left, constant: paddingLeft).isActive = true
}
if let right = right {
trailingAnchor.constraint(equalTo: right, constant: paddingRight).isActive = true
}
if let width = width ,width != 0 {
widthAnchor.constraint(equalToConstant: width).isActive = true
}
if let height = height, height != 0 {
heightAnchor.constraint(equalToConstant: height).isActive = true
}
}
func anchorGreaterOreEqualTo(
top : NSLayoutYAxisAnchor? = nil,
paddingTop : CGFloat = 0 ,
bottom : NSLayoutYAxisAnchor? = nil,
paddingBottom : CGFloat = 0 ,
left: NSLayoutXAxisAnchor? = nil,
paddingLeft: CGFloat = 0,
right: NSLayoutXAxisAnchor? = nil,
paddingRight: CGFloat = 0
) {
if let top = top {
topAnchor.constraint(greaterThanOrEqualTo: top, constant: paddingTop).isActive = true
}
if let bottom = bottom {
bottomAnchor.constraint(greaterThanOrEqualTo: bottom, constant: paddingBottom).isActive = true
}
if let left = left {
leadingAnchor.constraint(greaterThanOrEqualTo: left, constant: paddingLeft).isActive = true
}
if let right = right {
trailingAnchor.constraint(greaterThanOrEqualTo: right, constant: paddingRight).isActive = true
}
}
func anchorLessThanEqualTo(
top : NSLayoutYAxisAnchor? = nil,
paddingTop : CGFloat = 0 ,
bottom : NSLayoutYAxisAnchor? = nil,
paddingBottom : CGFloat = 0 ,
left: NSLayoutXAxisAnchor? = nil,
paddingLeft: CGFloat = 0,
right: NSLayoutXAxisAnchor? = nil,
paddingRight: CGFloat = 0
) {
if let top = top {
topAnchor.constraint(lessThanOrEqualTo: top, constant: paddingTop).isActive = true
}
if let bottom = bottom {
bottomAnchor.constraint(lessThanOrEqualTo: bottom, constant: paddingBottom).isActive = true
}
if let left = left {
leadingAnchor.constraint(lessThanOrEqualTo: left, constant: paddingLeft).isActive = true
}
if let right = right {
trailingAnchor.constraint(lessThanOrEqualTo: right, constant: paddingRight).isActive = true
}
}
func center(centerX : NSLayoutXAxisAnchor? , paddingX : CGFloat ,
centerY : NSLayoutYAxisAnchor? , paddingY : CGFloat) {
translatesAutoresizingMaskIntoConstraints = false
if let centerX = centerX {
centerXAnchor.constraint(equalTo: centerX , constant: paddingX).isActive = true
}
if let centerY = centerY {
centerYAnchor.constraint(equalTo: centerY , constant: paddingY).isActive = true
}
}
}
extension UIStackView {
func addArrangedSubviews(_ subviews: [UIView]) {
subviews.forEach { addArrangedSubview($0) }

167
GME Remit/Modules/Home/User Interface/View/Custom/HomeAccountDetailView.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)
}
}

193
GME Remit/Modules/Home/User Interface/View/HomeViewControllerNew.swift

@ -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()
}
}

2
GME Remit/Modules/Home/User Interface/Wireframe/HomeWireframe.swift

@ -27,7 +27,7 @@ extension HomeWireframe: HomeWireframeInput {
let service = HomeService()
let interactor = HomeInteractor(service: service)
let presenter = HomePresenter()
let viewController = viewControllerFromStoryboard(of: HomeViewController.self)
let viewController = HomeViewControllerNew() //viewControllerFromStoryboard(of: HomeViewController.self)
viewController.setupTabItem()
viewController.presenter = presenter

6
GME Remit/Modules/Main/User Interface/View/MainViewController.swift

@ -56,13 +56,13 @@ class MainViewController: UITabBarController {
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.title = ""
self.navigationController?.setNavigationBarHidden(false, animated: animated)
self.title = ""
self.navigationController?.setNavigationBarHidden(false, animated: animated)
}
func setup(viewControllers: [UIViewController]) {
// self.viewControllers = viewControllers
//self.setupTab()
// self.setupTab()
setupTabItem()
}

1
GME Remit/Utilities/TabBar Helper/CustomTabBar.swift

@ -29,7 +29,6 @@ final class CustomTabBar: UIStackView {
setupHierarchy()
setupProperties()
bind()
setNeedsLayout()
layoutIfNeeded()
selectItem(index: 0)

Loading…
Cancel
Save