Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jun 28, 2022
1 parent 5e958eb commit eefe1b0
Show file tree
Hide file tree
Showing 11 changed files with 411 additions and 103 deletions.
12 changes: 12 additions & 0 deletions eDoctorIOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
EE022E2E27D5DA3C00190596 /* ApiManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE022E2D27D5DA3C00190596 /* ApiManager.swift */; };
EE022E3027D5DAA100190596 /* ApiResponseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE022E2F27D5DAA100190596 /* ApiResponseModel.swift */; };
EE022E3227D5DB7000190596 /* RequestHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE022E3127D5DB7000190596 /* RequestHandler.swift */; };
EE34BDD527E0867300E8A13C /* ProfileDetailVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE34BDD427E0867300E8A13C /* ProfileDetailVC.swift */; };
EE42C4CB27E18D75008658AF /* MTextFieldView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE42C4CA27E18D75008658AF /* MTextFieldView.swift */; };
EE42C4CD27E18D8C008658AF /* MTextFieldView.xib in Resources */ = {isa = PBXBuildFile; fileRef = EE42C4CC27E18D8C008658AF /* MTextFieldView.xib */; };
EE854CFC27D6E4E700030EE0 /* VerifyOtpVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE854CFB27D6E4E700030EE0 /* VerifyOtpVC.swift */; };
EE854CFF27D6F42A00030EE0 /* KeyChainHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE854CFE27D6F42A00030EE0 /* KeyChainHelper.swift */; };
EE8BD55627D886A300C9546E /* Keys.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE8BD55527D886A300C9546E /* Keys.swift */; };
Expand Down Expand Up @@ -40,6 +43,9 @@
EE022E2D27D5DA3C00190596 /* ApiManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApiManager.swift; sourceTree = "<group>"; };
EE022E2F27D5DAA100190596 /* ApiResponseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApiResponseModel.swift; sourceTree = "<group>"; };
EE022E3127D5DB7000190596 /* RequestHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestHandler.swift; sourceTree = "<group>"; };
EE34BDD427E0867300E8A13C /* ProfileDetailVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileDetailVC.swift; sourceTree = "<group>"; };
EE42C4CA27E18D75008658AF /* MTextFieldView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MTextFieldView.swift; sourceTree = "<group>"; };
EE42C4CC27E18D8C008658AF /* MTextFieldView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MTextFieldView.xib; sourceTree = "<group>"; };
EE854CFB27D6E4E700030EE0 /* VerifyOtpVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VerifyOtpVC.swift; sourceTree = "<group>"; };
EE854CFE27D6F42A00030EE0 /* KeyChainHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyChainHelper.swift; sourceTree = "<group>"; };
EE8BD55527D886A300C9546E /* Keys.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Keys.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -105,6 +111,7 @@
EE96955227D846AC003A0D41 /* LabelText.swift */,
EE96955827D854D5003A0D41 /* CircleUIImageView.swift */,
EE8BD55927D88C2E00C9546E /* BasicProfile.swift */,
EE42C4CA27E18D75008658AF /* MTextFieldView.swift */,
);
path = Components;
sourceTree = "<group>";
Expand Down Expand Up @@ -148,6 +155,7 @@
children = (
EED20B0D27D1F8D700F6F496 /* Main.storyboard */,
EE8BD55727D88B7F00C9546E /* BasicProfile.xib */,
EE42C4CC27E18D8C008658AF /* MTextFieldView.xib */,
EED20B1527D1F8D800F6F496 /* LaunchScreen.storyboard */,
);
path = View;
Expand All @@ -161,6 +169,7 @@
EED20B2327D1FB7000F6F496 /* ProfileTabVC.swift */,
EE022E2427D5A8CF00190596 /* LoginVC.swift */,
EE854CFB27D6E4E700030EE0 /* VerifyOtpVC.swift */,
EE34BDD427E0867300E8A13C /* ProfileDetailVC.swift */,
);
path = Controller;
sourceTree = "<group>";
Expand Down Expand Up @@ -238,6 +247,7 @@
EE8BD55827D88B7F00C9546E /* BasicProfile.xib in Resources */,
EED20B1727D1F8D800F6F496 /* LaunchScreen.storyboard in Resources */,
EED20B1427D1F8D800F6F496 /* Assets.xcassets in Resources */,
EE42C4CD27E18D8C008658AF /* MTextFieldView.xib in Resources */,
EED20B0F27D1F8D700F6F496 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -249,11 +259,13 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
EE34BDD527E0867300E8A13C /* ProfileDetailVC.swift in Sources */,
EED20B0C27D1F8D700F6F496 /* TabController.swift in Sources */,
EE8BD55627D886A300C9546E /* Keys.swift in Sources */,
EED20B0827D1F8D700F6F496 /* AppDelegate.swift in Sources */,
EE022E3227D5DB7000190596 /* RequestHandler.swift in Sources */,
EE022E3027D5DAA100190596 /* ApiResponseModel.swift in Sources */,
EE42C4CB27E18D75008658AF /* MTextFieldView.swift in Sources */,
EE8BD55F27D89CDC00C9546E /* ConsumerModel.swift in Sources */,
EE96955327D846AD003A0D41 /* LabelText.swift in Sources */,
EE022E2627D5A8CF00190596 /* LoginVC.swift in Sources */,
Expand Down
46 changes: 31 additions & 15 deletions eDoctorIOS/Components/BasicProfile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,34 @@

import UIKit

class BasicProfile: UIView {
protocol BasicProfileDelegate {
func performSegueFromBasicProfile()
}

class BasicProfile: UIView, UIGestureRecognizerDelegate {
@IBOutlet var avatarImageView: CircleUIImageView!
@IBOutlet var userNameLabel: cTitleLabel!
@IBOutlet var birthDayLabel: cLargeLabel!
@IBOutlet var genderLabel: cNormalLabel!
@IBOutlet var phoneNumberLabel: cSmallLabel!

var delegate: BasicProfileDelegate?

required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
commonInit()
self.isHidden = true
isHidden = true

let tapGesture = UITapGestureRecognizer(target: self, action: #selector(clickView))
tapGesture.delegate = self
gestureRecognizers = [tapGesture]
getConsumerData()
layer.borderWidth = 1
}

@objc func clickView() {
print("click profile")
delegate?.performSegueFromBasicProfile()
}

override init(frame: CGRect) {
Expand All @@ -27,6 +43,19 @@ class BasicProfile: UIView {
initAvatar()
}

let nibName = "BasicProfile"

func commonInit() {
guard let view = loadViewFromNib() else { return }
view.frame = bounds
addSubview(view)
}

func loadViewFromNib() -> UIView? {
let nib = UINib(nibName: nibName, bundle: nil)
return nib.instantiate(withOwner: self, options: nil).first as? UIView
}

func initAvatar() {
avatarImageView.layer.borderWidth = 1
avatarImageView.layer.borderColor = UIColor.systemGray6.cgColor
Expand Down Expand Up @@ -60,17 +89,4 @@ class BasicProfile: UIView {
print("BasicProfile Get data failed.", error)
}
}

let nibName = "BasicProfile"

func commonInit() {
guard let view = loadViewFromNib() else { return }
view.frame = bounds
addSubview(view)
}

func loadViewFromNib() -> UIView? {
let nib = UINib(nibName: nibName, bundle: nil)
return nib.instantiate(withOwner: self, options: nil).first as? UIView
}
}
33 changes: 33 additions & 0 deletions eDoctorIOS/Components/MTextFieldView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// MTextFieldView.swift
// eDoctorIOS
//
// Created by MeoMeo on 16/03/2022.
//

import UIKit

class MTextFieldView: UIView {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)

commonInit()
}

override init(frame: CGRect) {
super.init(frame: frame)
}

let nibName = "MTextFieldView"

func commonInit() {
guard let view = loadViewFromNib() else { return }
view.frame = bounds
addSubview(view)
}

func loadViewFromNib() -> UIView? {
let nib = UINib(nibName: nibName, bundle: nil)
return nib.instantiate(withOwner: self, options: nil).first as? UIView
}
}
20 changes: 20 additions & 0 deletions eDoctorIOS/Components/MyTextField.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// MyTextField.swift
// eDoctorIOS
//
// Created by MeoMeo on 16/03/2022.
//

import UIKit

class MyTextField: UIView {

/*
// Only override draw() if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func draw(_ rect: CGRect) {
// Drawing code
}
*/

}
1 change: 1 addition & 0 deletions eDoctorIOS/Constants/SegueConst.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ struct SegueConst {
static let ProfileToLogin = "profileToLogin"
static let RootToLogin = "rootToLogin"
static let GoToVerifyOtp = "goToVerifyOtp"
static let GoToProfileDetail = "goToProfileDetail"
}

enum KeyChainConst {
Expand Down
30 changes: 30 additions & 0 deletions eDoctorIOS/Controller/ProfileDetailVC.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// ProfileDetailVCViewController.swift
// eDoctorIOS
//
// Created by MeoMeo on 15/03/2022.
//

import UIKit

class ProfileDetailVC: UIViewController {
var performIdentify: String?

override func viewDidLoad() {
super.viewDidLoad()

navigationItem.title = "Cá nhân"
navigationController?.navigationBar.topItem?.title = ""
navigationController?.navigationBar.prefersLargeTitles = true
}

/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
19 changes: 16 additions & 3 deletions eDoctorIOS/Controller/ProfileTabVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,33 @@

import UIKit

class ProfileTabVC: UIViewController, UIScrollViewDelegate {
extension ProfileTabVC: BasicProfileDelegate {
func performSegueFromBasicProfile() {
performSegue(withIdentifier: SegueConst.GoToProfileDetail, sender: self)
}
}

class ProfileTabVC: UIViewController {
var requestData = ApiManager()

@IBOutlet var basicProfile: BasicProfile!

override func viewDidLoad() {
super.viewDidLoad()
basicProfile.delegate = self
}

@IBAction func loginPressed(_ sender: UIButton) {
performSegue(withIdentifier: SegueConst.ProfileToLogin, sender: self)
}

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let destinationVC = segue.destination as! LoginVC
destinationVC.performIdentify = "ProfileVC"
if let destinationVC = segue.destination as? LoginVC {
destinationVC.performIdentify = "ProfileVC"
}
if let destinationVC = segue.destination as? ProfileDetailVC {
destinationVC.performIdentify = "ProfileDetailVC"
}
}

@IBAction func setNotLogin(_ sender: UIButton) {
Expand Down
1 change: 1 addition & 0 deletions eDoctorIOS/Controller/TabController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import UIKit

class TabController: UITabBarController {
let requestData = ApiManager()

Expand Down
Loading

0 comments on commit eefe1b0

Please sign in to comment.