Manos Chorianopoulos

MyCouponsViewController

......@@ -50,7 +50,7 @@ import UIKit
// Show navigation bar for this screen (with back button)
self.navigationController?.setNavigationBarHidden(false, animated: false)
setBackButton()
setNavigationTitle("Το προφίλ μου")
// setNavigationTitle("Το προφίλ μου")
// UPDATED: Safe XIB registration with error handling
registerTableViewCells()
......@@ -73,8 +73,6 @@ import UIKit
private func registerTableViewCells() {
let cellConfigs = [
("MyCouponsHeaderTableViewCell", "MyCouponsHeaderTableViewCell"),
("ProfileQuestionnaireTableViewCell", "ProfileQuestionnaireTableViewCell"),
("MyRewardsOffersScrollTableViewCell", "MyRewardsOffersScrollTableViewCell"),
("ProfileCouponFiltersTableViewCell", "ProfileCouponFiltersTableViewCell"),
("ProfileCouponTableViewCell", "ProfileCouponTableViewCell")
]
......@@ -273,7 +271,7 @@ extension MyCouponsViewController: UITableViewDelegate, UITableViewDataSource {
public func numberOfSections(in tableView: UITableView) -> Int {
// return 4 + (filteredOffersSection?.offers.count ?? 0)
return 5
return 3
}
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
......@@ -320,18 +318,6 @@ extension MyCouponsViewController: UITableViewDelegate, UITableViewDataSource {
return cell
} else if (indexPath.section == 1) {
let cell = tableView.dequeueReusableCell(withIdentifier: "ProfileQuestionnaireTableViewCell", for: indexPath) as! ProfileQuestionnaireTableViewCell
return cell
} else if (indexPath.section == 2) {
let cell = tableView.dequeueReusableCell(withIdentifier: "MyRewardsOffersScrollTableViewCell", for: indexPath) as! MyRewardsOffersScrollTableViewCell
cell.delegate = self // Set the offers delegate
cell.configureCell(data: self.forYouOffersSection, isInProfile: true)
return cell
} else if (indexPath.section == 3) {
let cell = tableView.dequeueReusableCell(withIdentifier: "ProfileCouponFiltersTableViewCell", for: indexPath) as! ProfileCouponFiltersTableViewCell
cell.delegate = self // Set the offers delegate
......@@ -371,19 +357,6 @@ extension MyCouponsViewController: UITableViewDelegate, UITableViewDataSource {
}
// Add delegate conformance
extension MyCouponsViewController: MyRewardsOffersScrollTableViewCellDelegate {
func didSelectOffer(_ offer: OfferModel) {
// Legacy OfferModel handling — no longer used but kept for protocol conformance
print("⚠️ [MyCouponsVC] didSelectOffer called with legacy OfferModel — should not happen")
}
func didSelectCouponSet(_ couponSet: CouponSetItemModel) {
// MyCouponsViewController doesn't handle coupon sets, so just log
print("CouponSet selected in MyCouponsViewController: \(couponSet._name)")
}
}
// Add delegate conformance
extension MyCouponsViewController: ProfileCouponFiltersTableViewCellDelegate {
func didSelectFilter(_ filter: CouponFilterModel) {
self.couponFilterSelected = filter
......
......@@ -122,7 +122,9 @@ import UIKit
}
@objc private func myCouponsButtonTapped() {
// TODO: open CouponsVC
let vc = SwiftWarplyFramework.MyCouponsViewController(nibName: "MyCouponsViewController", bundle: Bundle.frameworkBundle)
self.navigationController?.pushViewController(vc, animated: true)
}
// NEW: Safe XIB registration method
......