Professional Documents
Culture Documents
// MenuTableVC.swift
// matrimonyy
//
// Created by iOS Developer on 07/04/21.
// Copyright © 2021 iOS Developer. All rights reserved.
//
import UIKit
func cellIntialisation(){
menuTableView.register(UINib(nibName: CellIdentifier.HelpMenuTableViewCell,
bundle: nil), forCellReuseIdentifier: CellIdentifier.HelpMenuTableViewCell)
menuTableView.register(UINib(nibName:
CellIdentifier.MenuHeaderTableViewCell, bundle: nil), forCellReuseIdentifier:
CellIdentifier.MenuHeaderTableViewCell)
menuTableView.register(UINib(nibName:
CellIdentifier.MenuOptionTableViewCell, bundle: nil), forCellReuseIdentifier:
CellIdentifier.MenuOptionTableViewCell)
menuTableView.register(UINib(nibName:
CellIdentifier.MyAccountMenuTableViewCell, bundle: nil), forCellReuseIdentifier:
CellIdentifier.MyAccountMenuTableViewCell)
}
extension MenuTableVC{
case 1:
let cell = tableView.dequeueReusableCell(withIdentifier:
CellIdentifier.MyAccountMenuTableViewCell, for: indexPath) as!
MyAccountMenuTableViewCell
cell.bcgButton.addTarget(self,action:#selector(didTapMyAccountButton), for:
.touchUpInside)
cell.photoButton.addTarget(self,action:#selector(didTapMyAccountButton), for:
.touchUpInside)
cell.profileButton.addTarget(self,action:#selector(didTapMyAccountButton), for:
.touchUpInside)
cell.accountButton.addTarget(self,action:#selector(didTapMyAccountButton), for:
.touchUpInside)
cell.privecyButton.addTarget(self,action:#selector(didTapMyAccountButton), for:
.touchUpInside)
cell.membershipButton.addTarget(self,action:#selector(didTapMyAccountButton),
for: .touchUpInside)
cell.shareProfileButton.addTarget(self,action:#selector(didTapMyAccountButton),
for: .touchUpInside)
cell.partnerPreferenceButton.addTarget(self,action:#selector(didTapMyAccountButton)
, for: .touchUpInside)
cell.updateUI(isMyAccountOpen)
return cell
// case 2:
// let cell = tableView.dequeueReusableCell(withIdentifier:
CellIdentifier.MenuOptionTableViewCell, for: indexPath) as! MenuOptionTableViewCell
// cell.titleLabel.text = "Refer & Earn"
// cell.iconImage.image = #imageLiteral(resourceName: "referral")
// return cell
case 2:
let cell = tableView.dequeueReusableCell(withIdentifier:
CellIdentifier.HelpMenuTableViewCell, for: indexPath) as! HelpMenuTableViewCell
cell.updateUI(isHelpOpen, isSupportOpen: isSupportOpen)
cell.faqButton.addTarget(self,action:#selector(didTapHelpRowButton), for:
.touchUpInside)
cell.helpButton.addTarget(self,action:#selector(didTapHelpRowButton), for:
.touchUpInside)
cell.supportButton.addTarget(self,action:#selector(didTapHelpRowButton), for:
.touchUpInside)
cell.aboutUsButton.addTarget(self,action:#selector(didTapHelpRowButton), for:
.touchUpInside)
cell.termsOfUseButton.addTarget(self,action:#selector(didTapHelpRowButton), for:
.touchUpInside)
cell.privecyPolicyButton.addTarget(self,action:#selector(didTapHelpRowButton), for:
.touchUpInside)
cell.repoartAnIssueButton.addTarget(self,action:#selector(didTapHelpRowButton),
for: .touchUpInside)
cell.viewReportedIssueButton.addTarget(self,action:#selector(didTapHelpRowButton),
for: .touchUpInside)
cell.ApplicationVersionButton.addTarget(self,action:#selector(didTapHelpRowButton),
for: .touchUpInside)
return cell
case 3:
let cell = tableView.dequeueReusableCell(withIdentifier:
CellIdentifier.MenuOptionTableViewCell, for: indexPath) as! MenuOptionTableViewCell
cell.titleLabel.text = "Suggestions"
cell.iconImage.image = #imageLiteral(resourceName: "good")
return cell
// case 4:
// let cell = tableView.dequeueReusableCell(withIdentifier:
CellIdentifier.MenuOptionTableViewCell, for: indexPath) as! MenuOptionTableViewCell
// cell.titleLabel.text = "Rate Us On App Store"
// cell.iconImage.image = #imageLiteral(resourceName: "account")
// return cell
default:
return UITableViewCell()
}
}else{
switch indexPath.row {
case 0:
let cell = tableView.dequeueReusableCell(withIdentifier:
CellIdentifier.MenuHeaderTableViewCell, for: indexPath) as! MenuHeaderTableViewCell
return cell
case 1:
let cell = tableView.dequeueReusableCell(withIdentifier:
CellIdentifier.HelpMenuTableViewCell, for: indexPath) as! HelpMenuTableViewCell
cell.updateUI(isHelpOpen, isSupportOpen: isSupportOpen)
cell.faqButton.addTarget(self,action:#selector(didTapHelpRowButton), for:
.touchUpInside)
cell.helpButton.addTarget(self,action:#selector(didTapHelpRowButton), for:
.touchUpInside)
cell.supportButton.addTarget(self,action:#selector(didTapHelpRowButton), for:
.touchUpInside)
cell.aboutUsButton.addTarget(self,action:#selector(didTapHelpRowButton), for:
.touchUpInside)
cell.termsOfUseButton.addTarget(self,action:#selector(didTapHelpRowButton), for:
.touchUpInside)
cell.privecyPolicyButton.addTarget(self,action:#selector(didTapHelpRowButton), for:
.touchUpInside)
cell.repoartAnIssueButton.addTarget(self,action:#selector(didTapHelpRowButton),
for: .touchUpInside)
cell.viewReportedIssueButton.addTarget(self,action:#selector(didTapHelpRowButton),
for: .touchUpInside)
cell.ApplicationVersionButton.addTarget(self,action:#selector(didTapHelpRowButton),
for: .touchUpInside)
return cell
// case 2:
// let cell = tableView.dequeueReusableCell(withIdentifier:
CellIdentifier.MenuOptionTableViewCell, for: indexPath) as! MenuOptionTableViewCell
// cell.titleLabel.text = "Rate Us On App Store"
// cell.iconImage.image = #imageLiteral(resourceName: "account")
// return cell
default:
return UITableViewCell()
}
}
}
// case 2:
// let vc = UIStoryboard.init(name: "Main", bundle:
Bundle.main).instantiateViewController(withIdentifier:
StoryboardIdentifier.ReferEarnVC) as? ReferEarnVC
// self.navigationController?.pushViewController(vc!, animated:
true)
// break
case 3:
let vc = UIStoryboard.init(name: "Main", bundle:
Bundle.main).instantiateViewController(withIdentifier:
StoryboardIdentifier.SuggestionListVC) as? SuggestionListVC
self.navigationController?.pushViewController(vc!, animated: true)
break
// case 4:
// openAppStrore()
// break
default:
break
}
}else{
if indexPath.row == 2{ openAppStrore() }
}
}
func openAppStrore() {
if let url = URL(string: "itms-apps://apple.com/app/id839686104"),
UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler:nil)
} else {
print("Error in opening dial pad")
}
}
case 1:
let vc = UIStoryboard.init(name: "Main", bundle:
Bundle.main).instantiateViewController(withIdentifier:
StoryboardIdentifier.PhotosVC) as? PhotosVC
self.navigationController?.pushViewController(vc!, animated: true)
break
case 2:
let vc = UIStoryboard.init(name: "Main", bundle:
Bundle.main).instantiateViewController(withIdentifier:
StoryboardIdentifier.ProfileMainVc) as? ProfileMainVc
self.navigationController?.pushViewController(vc!, animated: true)
break
case 3:
let vc = UIStoryboard.init(name: "Main", bundle:
Bundle.main).instantiateViewController(withIdentifier:
StoryboardIdentifier.PrivacySettingVC) as? PrivacySettingVC
vc?.isFromMenu = true
self.navigationController?.pushViewController(vc!, animated: true)
break
case 4:
let vc = UIStoryboard.init(name: "Main", bundle:
Bundle.main).instantiateViewController(withIdentifier:
StoryboardIdentifier.PartnerPreferenceDetailVC) as? PartnerPreferenceDetailVC
vc?.isFromMenu = true
self.navigationController?.pushViewController(vc!, animated: true)
break
case 5:
let vc = UIStoryboard.init(name: "Main", bundle:
Bundle.main).instantiateViewController(withIdentifier:
StoryboardIdentifier.MembershipListVC) as? MembershipListVC
navigationController?.pushViewController(vc!, animated: true)
break
case 6:
let vc = UIStoryboard.init(name: "BCG", bundle:
Bundle.main).instantiateViewController(withIdentifier:
StoryboardIdentifier.BCGMainListVC) as? BCGMainListVC
vc?.memberID = Util.userDefault.integer(forKey:
UserDefaultIdentifier.memberid)
vc?.isFromMenu = true
navigationController?.pushViewController(vc!, animated: true)
break
case 7:
let FirstName:String =
DatabaseManager.getDBInstance().getUserDetail("c_FirstName")
let memberID = Util.userDefault.integer(forKey:
UserDefaultIdentifier.memberid)
shareProfile(FirstName, memberID: memberID, toMemberID: memberID)
break
default:
break
}
}
switch sender.tag {
case 0:
isHelpOpen = !isHelpOpen
reloadRow(indexPath)
break
case 1:
let vc = UIStoryboard.init(name: "Main", bundle:
Bundle.main).instantiateViewController(withIdentifier:
StoryboardIdentifier.FaqListVC) as? FaqListVC
self.navigationController?.pushViewController(vc!, animated: true)
break
case 2:
isSupportOpen = !isSupportOpen
reloadRow(indexPath)
break
case 3:
let vc = UIStoryboard.init(name: "Main", bundle:
Bundle.main).instantiateViewController(withIdentifier:
StoryboardIdentifier.ReportAnIssueVC) as? ReportAnIssueVC
self.navigationController?.pushViewController(vc!, animated: true)
break
case 4:
let vc = UIStoryboard.init(name: "Main", bundle:
Bundle.main).instantiateViewController(withIdentifier:
StoryboardIdentifier.ReportedIssueListVC) as? ReportedIssueListVC
self.navigationController?.pushViewController(vc!, animated: true)
break
case 5:
let vc = UIStoryboard.init(name: "Main", bundle:
Bundle.main).instantiateViewController(withIdentifier:
StoryboardIdentifier.TermsAndPrivecyVC) as? TermsAndPrivecyVC
vc?.url = "https://matrimonyy.com/Terms-of-Use.html"
self.navigationController?.pushViewController(vc!, animated: true)
break
case 6:
let vc = UIStoryboard.init(name: "Main", bundle:
Bundle.main).instantiateViewController(withIdentifier:
StoryboardIdentifier.TermsAndPrivecyVC) as? TermsAndPrivecyVC
vc?.url = "https://matrimonyy.com/Privacy-Policy.html"
self.navigationController?.pushViewController(vc!, animated: true)
break
case 7:
let vc = UIStoryboard.init(name: "Main", bundle:
Bundle.main).instantiateViewController(withIdentifier:
StoryboardIdentifier.AboutUsVC) as? AboutUsVC
self.navigationController?.pushViewController(vc!, animated: true)
break
case 8:
let vc = UIStoryboard.init(name: "Main", bundle:
Bundle.main).instantiateViewController(withIdentifier:
StoryboardIdentifier.ApplicationVersionVC) as? ApplicationVersionVC
self.navigationController?.pushViewController(vc!, animated: true)
break
default:
break
}
}