Manos Chorianopoulos

add ProfileVC

Showing 38 changed files with 632 additions and 69 deletions
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
7 <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key> 7 <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key>
8 <dict> 8 <dict>
9 <key>orderHint</key> 9 <key>orderHint</key>
10 - <integer>0</integer> 10 + <integer>1</integer>
11 </dict> 11 </dict>
12 </dict> 12 </dict>
13 </dict> 13 </dict>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
7 <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key> 7 <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
8 <dict> 8 <dict>
9 <key>orderHint</key> 9 <key>orderHint</key>
10 - <integer>1</integer> 10 + <integer>0</integer>
11 </dict> 11 </dict>
12 </dict> 12 </dict>
13 </dict> 13 </dict>
......
1 { 1 {
2 "images" : [ 2 "images" : [
3 { 3 {
4 - "filename" : "contest_banner_5.png", 4 + "filename" : "questionnaire_banner.png",
5 "idiom" : "universal", 5 "idiom" : "universal",
6 "scale" : "1x" 6 "scale" : "1x"
7 }, 7 },
8 { 8 {
9 - "filename" : "contest_banner_5 1.png", 9 + "filename" : "questionnaire_banner 1.png",
10 "idiom" : "universal", 10 "idiom" : "universal",
11 "scale" : "2x" 11 "scale" : "2x"
12 }, 12 },
13 { 13 {
14 - "filename" : "contest_banner_5 2.png", 14 + "filename" : "questionnaire_banner 2.png",
15 "idiom" : "universal", 15 "idiom" : "universal",
16 "scale" : "3x" 16 "scale" : "3x"
17 } 17 }
......
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
8 import UIKit 8 import UIKit
9 9
10 protocol MyRewardsBannerOffersScrollTableViewCellDelegate: AnyObject { 10 protocol MyRewardsBannerOffersScrollTableViewCellDelegate: AnyObject {
11 - func didSelectBannerOffer(_ offer: OfferModel) 11 + func didSelectBannerOffer(_ index: Int)
12 + func didTapProfileButton()
12 } 13 }
13 14
14 @objc public class MyRewardsBannerOffersScrollTableViewCell: UITableViewCell { 15 @objc public class MyRewardsBannerOffersScrollTableViewCell: UITableViewCell {
...@@ -17,6 +18,7 @@ protocol MyRewardsBannerOffersScrollTableViewCellDelegate: AnyObject { ...@@ -17,6 +18,7 @@ protocol MyRewardsBannerOffersScrollTableViewCellDelegate: AnyObject {
17 @IBOutlet weak var tagView2: UIView! 18 @IBOutlet weak var tagView2: UIView!
18 @IBOutlet weak var tagLabel2: UILabel! 19 @IBOutlet weak var tagLabel2: UILabel!
19 @IBOutlet weak var profileImage: UIImageView! 20 @IBOutlet weak var profileImage: UIImageView!
21 + @IBOutlet weak var profileButton: UIButton!
20 @IBOutlet weak var collectionView: UICollectionView! 22 @IBOutlet weak var collectionView: UICollectionView!
21 @IBOutlet weak var pageControl: UIPageControl! 23 @IBOutlet weak var pageControl: UIPageControl!
22 24
...@@ -29,6 +31,8 @@ protocol MyRewardsBannerOffersScrollTableViewCellDelegate: AnyObject { ...@@ -29,6 +31,8 @@ protocol MyRewardsBannerOffersScrollTableViewCellDelegate: AnyObject {
29 31
30 profileImage.image = UIImage(named: "profile_pic_default", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) 32 profileImage.image = UIImage(named: "profile_pic_default", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
31 33
34 + profileButton.addTarget(self, action: #selector(profileButtonTapped), for: .touchUpInside)
35 +
32 tagView1.backgroundColor = UIColor(rgb: 0x09914E) 36 tagView1.backgroundColor = UIColor(rgb: 0x09914E)
33 tagView1.layer.cornerRadius = 4.0 37 tagView1.layer.cornerRadius = 4.0
34 tagLabel1.font = UIFont(name: "PingLCG-Regular", size: 17) 38 tagLabel1.font = UIFont(name: "PingLCG-Regular", size: 17)
...@@ -95,6 +99,10 @@ protocol MyRewardsBannerOffersScrollTableViewCellDelegate: AnyObject { ...@@ -95,6 +99,10 @@ protocol MyRewardsBannerOffersScrollTableViewCellDelegate: AnyObject {
95 99
96 self.collectionView.reloadData(); 100 self.collectionView.reloadData();
97 } 101 }
102 +
103 + @objc private func profileButtonTapped() {
104 + delegate?.didTapProfileButton()
105 + }
98 } 106 }
99 107
100 extension MyRewardsBannerOffersScrollTableViewCell: UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, UIScrollViewDelegate { 108 extension MyRewardsBannerOffersScrollTableViewCell: UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, UIScrollViewDelegate {
...@@ -121,7 +129,7 @@ extension MyRewardsBannerOffersScrollTableViewCell: UICollectionViewDataSource, ...@@ -121,7 +129,7 @@ extension MyRewardsBannerOffersScrollTableViewCell: UICollectionViewDataSource,
121 // Get the selected offer 129 // Get the selected offer
122 if let offer = self.data?.offers[indexPath.row] { 130 if let offer = self.data?.offers[indexPath.row] {
123 // Call the delegate method to notify the parent 131 // Call the delegate method to notify the parent
124 - delegate?.didSelectBannerOffer(offer) 132 + delegate?.didSelectBannerOffer(indexPath.row)
125 } 133 }
126 } 134 }
127 135
......
1 +//
2 +// ProfileCouponFiltersTableViewCell.swift
3 +// SwiftWarplyFramework
4 +//
5 +// Created by Manos Chorianopoulos on 29/5/25.
6 +//
7 +
8 +import UIKit
9 +
10 +protocol ProfileCouponFiltersTableViewCellDelegate: AnyObject {
11 + func didSelectFilter(_ filter: CouponFilterModel)
12 +}
13 +
14 +@objc public class ProfileCouponFiltersTableViewCell: UITableViewCell {
15 + @IBOutlet weak var titleLabel: UILabel!
16 + @IBOutlet weak var collectionView: UICollectionView!
17 +
18 + weak var delegate: ProfileCouponFiltersTableViewCellDelegate?
19 + var data: [CouponFilterModel]?
20 +
21 + public override func awakeFromNib() {
22 + super.awakeFromNib()
23 +
24 + titleLabel.font = UIFont(name: "PingLCG-Bold", size: 18)
25 + titleLabel.textColor = UIColor(rgb: 0x000F1E)
26 +
27 + // Register XIBs for collection view cells
28 + collectionView.register(UINib(nibName: "ProfileFilterCollectionViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellWithReuseIdentifier: "ProfileFilterCollectionViewCell")
29 +
30 + // Fix background colors
31 +// collectionView.backgroundColor = UIColor.clear
32 +// self.backgroundColor = UIColor.clear
33 +// self.contentView.backgroundColor = UIColor.clear
34 +
35 + // Remove content insets and gaps
36 + collectionView.contentInset = UIEdgeInsets.zero
37 + collectionView.scrollIndicatorInsets = UIEdgeInsets.zero
38 +
39 + if #available(iOS 11.0, *) {
40 + collectionView.contentInsetAdjustmentBehavior = .never
41 + }
42 +
43 + // Configure collection view layout
44 + if let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout {
45 + layout.scrollDirection = .horizontal
46 + layout.minimumLineSpacing = 15
47 + layout.minimumInteritemSpacing = 0
48 + layout.sectionInset = UIEdgeInsets(top: 0, left: 24, bottom: 0, right: 24)
49 + }
50 +
51 + // Enable paging for smooth banner scrolling
52 + // collectionView.isPagingEnabled = true
53 + collectionView.showsHorizontalScrollIndicator = false
54 +
55 + // Set delegates
56 + collectionView.delegate = self
57 + collectionView.dataSource = self
58 +
59 + }
60 +
61 + public override func setSelected(_ selected: Bool, animated: Bool) {
62 + super.setSelected(selected, animated: animated)
63 +
64 + // Configure the view for the selected state
65 + }
66 +
67 + func configureCell(data: [CouponFilterModel]?) {
68 + self.data = data
69 +
70 + self.collectionView.reloadData();
71 + }
72 +}
73 +
74 +extension ProfileCouponFiltersTableViewCell: UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {
75 +
76 +
77 + public func numberOfSections(in collectionView: UICollectionView) -> Int {
78 + return 1
79 + }
80 +
81 + public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
82 + return self.data?.count ?? 0
83 + }
84 +
85 + public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
86 + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ProfileFilterCollectionViewCell", for: indexPath) as! ProfileFilterCollectionViewCell
87 + if let filter = self.data?[indexPath.row] {
88 + // TODO: Fix dynamic
89 + let isSelected = self.data?[indexPath.row].title == "Ενεργά"
90 + cell.configureCell(data: filter, isSelected: isSelected)
91 + }
92 + return cell;
93 + }
94 +
95 + public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
96 + if let filter = self.data?[indexPath.row] {
97 + delegate?.didSelectFilter(filter)
98 + }
99 + }
100 +
101 + // MARK: - UICollectionViewDelegateFlowLayout
102 +// public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
103 +// if self.data?.title == "Αγαπημένα" {
104 +// return CGSize(width: 275, height: 350)
105 +// } else {
106 +// return CGSize(width: 257, height: 232)
107 +// }
108 +// }
109 +
110 + // Distance Between Item Cells
111 + public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
112 + return 15
113 + }
114 +
115 + public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
116 + return 0
117 + }
118 +
119 + // Cell Margin
120 + public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
121 + return UIEdgeInsets(top: 0, left: 24, bottom: 0, right: 24)
122 + }
123 +}
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3 + <device id="retina6_12" orientation="portrait" appearance="light"/>
4 + <dependencies>
5 + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/>
6 + <capability name="Safe area layout guides" minToolsVersion="9.0"/>
7 + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
8 + </dependencies>
9 + <objects>
10 + <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
11 + <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
12 + <tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="ProfileCouponFiltersTableViewCell" rowHeight="161" id="KGk-i7-Jjw" customClass="ProfileCouponFiltersTableViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
13 + <rect key="frame" x="0.0" y="0.0" width="320" height="161"/>
14 + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
15 + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
16 + <rect key="frame" x="0.0" y="0.0" width="320" height="161"/>
17 + <autoresizingMask key="autoresizingMask"/>
18 + <subviews>
19 + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1kR-zd-duR" userLabel="ParentView">
20 + <rect key="frame" x="0.0" y="0.0" width="320" height="161"/>
21 + <subviews>
22 + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mga-ND-qoh">
23 + <rect key="frame" x="24" y="26" width="272" height="49"/>
24 + <fontDescription key="fontDescription" type="system" pointSize="17"/>
25 + <nil key="textColor"/>
26 + <nil key="highlightedColor"/>
27 + </label>
28 + <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="Ddn-dN-xH1">
29 + <rect key="frame" x="0.0" y="118" width="320" height="43"/>
30 + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
31 + <constraints>
32 + <constraint firstAttribute="height" constant="43" id="5nG-1p-kic"/>
33 + </constraints>
34 + <collectionViewFlowLayout key="collectionViewLayout" scrollDirection="horizontal" automaticEstimatedItemSize="YES" minimumLineSpacing="5" minimumInteritemSpacing="5" id="tAC-pV-kZ6">
35 + <size key="itemSize" width="128" height="120"/>
36 + <size key="headerReferenceSize" width="0.0" height="0.0"/>
37 + <size key="footerReferenceSize" width="0.0" height="0.0"/>
38 + <inset key="sectionInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
39 + </collectionViewFlowLayout>
40 + <cells/>
41 + <connections>
42 + <outlet property="dataSource" destination="KGk-i7-Jjw" id="J6c-fu-dH8"/>
43 + <outlet property="delegate" destination="KGk-i7-Jjw" id="D3M-nO-3sC"/>
44 + </connections>
45 + </collectionView>
46 + </subviews>
47 + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
48 + <constraints>
49 + <constraint firstItem="Ddn-dN-xH1" firstAttribute="top" secondItem="mga-ND-qoh" secondAttribute="bottom" constant="43" id="1gh-45-u6h"/>
50 + <constraint firstItem="Ddn-dN-xH1" firstAttribute="leading" secondItem="1kR-zd-duR" secondAttribute="leading" id="3IU-v8-7cI"/>
51 + <constraint firstItem="mga-ND-qoh" firstAttribute="top" secondItem="1kR-zd-duR" secondAttribute="top" constant="26" id="J0I-v0-uwq"/>
52 + <constraint firstAttribute="trailing" secondItem="mga-ND-qoh" secondAttribute="trailing" constant="24" id="Ss1-zq-znd"/>
53 + <constraint firstAttribute="bottom" secondItem="Ddn-dN-xH1" secondAttribute="bottom" id="VdN-By-srg"/>
54 + <constraint firstAttribute="trailing" secondItem="Ddn-dN-xH1" secondAttribute="trailing" id="W06-Yi-lzm"/>
55 + <constraint firstItem="mga-ND-qoh" firstAttribute="leading" secondItem="1kR-zd-duR" secondAttribute="leading" constant="24" id="sEy-GV-Pjr"/>
56 + </constraints>
57 + </view>
58 + </subviews>
59 + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
60 + <constraints>
61 + <constraint firstItem="1kR-zd-duR" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="BHT-r3-dcg"/>
62 + <constraint firstAttribute="trailing" secondItem="1kR-zd-duR" secondAttribute="trailing" id="eLa-yc-CeZ"/>
63 + <constraint firstAttribute="bottom" secondItem="1kR-zd-duR" secondAttribute="bottom" id="rie-jS-xMj"/>
64 + <constraint firstItem="1kR-zd-duR" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="vgK-SU-fRu"/>
65 + </constraints>
66 + </tableViewCellContentView>
67 + <viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
68 + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
69 + <connections>
70 + <outlet property="collectionView" destination="Ddn-dN-xH1" id="RzU-o5-6Dw"/>
71 + <outlet property="titleLabel" destination="mga-ND-qoh" id="TxL-cQ-O1P"/>
72 + </connections>
73 + <point key="canvasLocation" x="68.702290076335871" y="29.929577464788736"/>
74 + </tableViewCell>
75 + </objects>
76 +</document>
1 +//
2 +// ProfileCouponTableViewCell.swift
3 +// SwiftWarplyFramework
4 +//
5 +// Created by Manos Chorianopoulos on 29/5/25.
6 +//
7 +
8 +import UIKit
9 +
10 +@objc public class ProfileCouponTableViewCell: UITableViewCell {
11 + @IBOutlet weak var parentView: UIView!
12 + @IBOutlet weak var bannerImage: UIImageView!
13 + @IBOutlet weak var favoriteImage: UIImageView!
14 + @IBOutlet weak var discountView: UIView!
15 + @IBOutlet weak var discountLabel: UILabel!
16 + @IBOutlet weak var titleLabel: UILabel!
17 + @IBOutlet weak var subtitleLabel: UILabel!
18 + @IBOutlet weak var expirationLabel: UILabel!
19 + @IBOutlet weak var logoImage: UIImageView!
20 +
21 + public override func awakeFromNib() {
22 + super.awakeFromNib()
23 + // Initialization code
24 +
25 + parentView.layer.borderWidth = 1.0
26 + parentView.layer.borderColor = UIColor(rgb: 0xCCCCCC).cgColor
27 + parentView.layer.cornerRadius = 8.0
28 + parentView.clipsToBounds = true
29 +
30 + discountView.layer.cornerRadius = 34.0
31 +
32 + }
33 +
34 + func configureCell(data: OfferModel) {
35 + bannerImage.image = UIImage(named: data.bannerImage, in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
36 + favoriteImage.image = UIImage(named: data.isFavorite ? "favorite_filled" : "favorite_empty", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
37 +
38 + let discountSymbol =
39 + data.discountType == "percentage" ? "%"
40 + : data.discountType == "price" ? "€"
41 + : data.discountType == "buyOneGetOne" ? "1+1"
42 + : data.discountType == "free" ? "Δωρεάν"
43 + : ""
44 +
45 +// discountLabel.text = "\(data.discount)\(discountSymbol)"
46 + discountLabel.text = data.discount
47 + discountLabel.font = UIFont(name: "PingLCG-Bold", size: 25)
48 + discountLabel.textColor = UIColor(rgb: 0xF2F2F2)
49 +
50 + discountView.backgroundColor = UIColor(rgb: data.color)
51 +
52 + titleLabel.text = data.title
53 + titleLabel.font = UIFont(name: "PingLCG-Bold", size: 22)
54 + titleLabel.textColor = UIColor(rgb: 0x000F1E)
55 +
56 + subtitleLabel.text = data.description
57 + subtitleLabel.font = UIFont(name: "PingLCG-Regular", size: 16)
58 + subtitleLabel.textColor = UIColor(rgb: 0x00111B)
59 +
60 + expirationLabel.text = data.expirationDate
61 + expirationLabel.font = UIFont(name: "PingLCG-Regular", size: 13)
62 + expirationLabel.textColor = UIColor(rgb: 0x00111B)
63 +
64 + logoImage.image = UIImage(named: data.merchantLogo, in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
65 + }
66 +
67 + public override func setSelected(_ selected: Bool, animated: Bool) {
68 + super.setSelected(selected, animated: animated)
69 +
70 + // Configure the view for the selected state
71 + }
72 +
73 +}
1 +//
2 +// ProfileFilterCollectionViewCell.swift
3 +// SwiftWarplyFramework
4 +//
5 +// Created by Manos Chorianopoulos on 29/5/25.
6 +//
7 +
8 +import UIKit
9 +
10 +@objc public class ProfileFilterCollectionViewCell: UICollectionViewCell {
11 + @IBOutlet weak var parentView: UIView!
12 + @IBOutlet weak var titleLabel: UILabel!
13 +
14 + public override func awakeFromNib() {
15 + super.awakeFromNib()
16 + // Initialization code
17 + }
18 +
19 + func configureCell(data: CouponFilterModel, isSelected: Bool) {
20 + if (isSelected) {
21 + parentView.backgroundColor = UIColor(rgb: 0x000F1E)
22 + parentView.layer.cornerRadius = 4.0
23 +
24 + titleLabel.font = UIFont(name: "PingLCG-Bold", size: 16)
25 + titleLabel.textColor = UIColor(rgb: 0xFFFFFF)
26 +
27 + } else {
28 + parentView.backgroundColor = .clear
29 + parentView.layer.borderWidth = 2
30 + parentView.layer.borderColor = UIColor(rgb: 0x56586A).cgColor
31 + parentView.layer.cornerRadius = 4.0
32 +
33 + titleLabel.font = UIFont(name: "PingLCG-Bold", size: 16)
34 + titleLabel.textColor = UIColor(rgb: 0xFFFFFF)
35 + }
36 + titleLabel.text = data.title
37 + }
38 +}
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3 + <device id="retina6_12" orientation="portrait" appearance="light"/>
4 + <dependencies>
5 + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/>
6 + <capability name="Safe area layout guides" minToolsVersion="9.0"/>
7 + <capability name="System colors in document resources" minToolsVersion="11.0"/>
8 + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
9 + </dependencies>
10 + <objects>
11 + <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
12 + <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
13 + <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="ProfileFilterCollectionViewCell" id="gTV-IL-0wX" customClass="ProfileFilterCollectionViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
14 + <rect key="frame" x="0.0" y="0.0" width="145" height="66"/>
15 + <autoresizingMask key="autoresizingMask"/>
16 + <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
17 + <rect key="frame" x="0.0" y="0.0" width="145" height="66"/>
18 + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
19 + <subviews>
20 + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="NgU-Qp-M8l" userLabel="ParentView">
21 + <rect key="frame" x="0.0" y="0.0" width="145" height="66"/>
22 + <subviews>
23 + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Xq0-AN-QT6">
24 + <rect key="frame" x="17" y="12" width="111" height="42"/>
25 + <fontDescription key="fontDescription" type="system" pointSize="17"/>
26 + <nil key="textColor"/>
27 + <nil key="highlightedColor"/>
28 + </label>
29 + </subviews>
30 + <color key="backgroundColor" systemColor="systemBackgroundColor"/>
31 + <constraints>
32 + <constraint firstItem="Xq0-AN-QT6" firstAttribute="top" secondItem="NgU-Qp-M8l" secondAttribute="top" constant="12" id="Nro-8v-U0C"/>
33 + <constraint firstAttribute="trailing" secondItem="Xq0-AN-QT6" secondAttribute="trailing" constant="17" id="hKh-jv-VQR"/>
34 + <constraint firstItem="Xq0-AN-QT6" firstAttribute="leading" secondItem="NgU-Qp-M8l" secondAttribute="leading" constant="17" id="na6-tV-KQZ"/>
35 + <constraint firstAttribute="bottom" secondItem="Xq0-AN-QT6" secondAttribute="bottom" constant="12" id="pJO-74-XZO"/>
36 + </constraints>
37 + </view>
38 + </subviews>
39 + </view>
40 + <viewLayoutGuide key="safeArea" id="ZTg-uK-7eu"/>
41 + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
42 + <constraints>
43 + <constraint firstItem="NgU-Qp-M8l" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="RYQ-Qn-MSN"/>
44 + <constraint firstAttribute="trailing" secondItem="NgU-Qp-M8l" secondAttribute="trailing" id="efv-x1-lhD"/>
45 + <constraint firstItem="NgU-Qp-M8l" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="l7p-or-kC2"/>
46 + <constraint firstAttribute="bottom" secondItem="NgU-Qp-M8l" secondAttribute="bottom" id="te6-Qr-T6c"/>
47 + </constraints>
48 + <size key="customSize" width="145" height="66"/>
49 + <connections>
50 + <outlet property="parentView" destination="NgU-Qp-M8l" id="qhP-z2-cWY"/>
51 + <outlet property="titleLabel" destination="Xq0-AN-QT6" id="Hft-IP-ITh"/>
52 + </connections>
53 + <point key="canvasLocation" x="109.16030534351144" y="-5.6338028169014089"/>
54 + </collectionViewCell>
55 + </objects>
56 + <resources>
57 + <systemColor name="systemBackgroundColor">
58 + <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
59 + </systemColor>
60 + </resources>
61 +</document>
1 +//
2 +// ProfileHeaderTableViewCell.swift
3 +// SwiftWarplyFramework
4 +//
5 +// Created by Manos Chorianopoulos on 29/5/25.
6 +//
7 +
8 +import UIKit
9 +
10 +@objc public class ProfileHeaderTableViewCell: UITableViewCell {
11 + @IBOutlet weak var tagView1: UIView!
12 + @IBOutlet weak var tagLabel1: UILabel!
13 + @IBOutlet weak var tagView2: UIView!
14 + @IBOutlet weak var tagLabel2: UILabel!
15 + @IBOutlet weak var profileImage: UIImageView!
16 +
17 + public override func awakeFromNib() {
18 + super.awakeFromNib()
19 +
20 + profileImage.image = UIImage(named: "profile_pic_default", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
21 +
22 + tagView1.backgroundColor = UIColor(rgb: 0x09914E)
23 + tagView1.layer.cornerRadius = 4.0
24 + tagLabel1.font = UIFont(name: "PingLCG-Regular", size: 17)
25 + tagLabel1.textColor = UIColor(rgb: 0xFFFFFF)
26 +
27 + tagView2.backgroundColor = UIColor(rgb: 0xFC9F25)
28 + tagView2.layer.cornerRadius = 4.0
29 + tagLabel2.font = UIFont(name: "PingLCG-Regular", size: 17)
30 + tagLabel2.textColor = UIColor(rgb: 0xFFFFFF)
31 + }
32 +
33 + public override func setSelected(_ selected: Bool, animated: Bool) {
34 + super.setSelected(selected, animated: animated)
35 +
36 + // Configure the view for the selected state
37 + }
38 +
39 +}
1 +//
2 +// ProfileQuestionnaireTableViewCell.swift
3 +// SwiftWarplyFramework
4 +//
5 +// Created by Manos Chorianopoulos on 29/5/25.
6 +//
7 +
8 +import UIKit
9 +
10 +@objc public class ProfileQuestionnaireTableViewCell: UITableViewCell {
11 + @IBOutlet weak var questionnaireBannerImage: UIImageView!
12 +
13 + public override func awakeFromNib() {
14 + super.awakeFromNib()
15 +
16 + questionnaireBannerImage.image = UIImage(named: "questionnaire_banner", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
17 +
18 + }
19 +
20 + public override func setSelected(_ selected: Bool, animated: Bool) {
21 + super.setSelected(selected, animated: animated)
22 +
23 + // Configure the view for the selected state
24 + }
25 +
26 +}
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3 + <device id="retina6_12" orientation="portrait" appearance="light"/>
4 + <dependencies>
5 + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/>
6 + <capability name="Safe area layout guides" minToolsVersion="9.0"/>
7 + <capability name="System colors in document resources" minToolsVersion="11.0"/>
8 + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
9 + </dependencies>
10 + <objects>
11 + <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
12 + <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
13 + <tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="ProfileQuestionnaireTableViewCell" rowHeight="211" id="KGk-i7-Jjw" customClass="ProfileQuestionnaireTableViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
14 + <rect key="frame" x="0.0" y="0.0" width="320" height="211"/>
15 + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
16 + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" ambiguous="YES" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
17 + <rect key="frame" x="0.0" y="0.0" width="320" height="211"/>
18 + <autoresizingMask key="autoresizingMask"/>
19 + <subviews>
20 + <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="YrO-k4-v2O" userLabel="ParentView">
21 + <rect key="frame" x="24" y="35" width="272" height="9"/>
22 + <subviews>
23 + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="N8L-PD-UP8">
24 + <rect key="frame" x="0.0" y="0.0" width="272" height="159"/>
25 + <color key="backgroundColor" systemColor="systemRedColor"/>
26 + <constraints>
27 + <constraint firstAttribute="height" constant="159" id="r1F-lV-yNf"/>
28 + </constraints>
29 + </imageView>
30 + </subviews>
31 + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
32 + <constraints>
33 + <constraint firstItem="N8L-PD-UP8" firstAttribute="leading" secondItem="YrO-k4-v2O" secondAttribute="leading" id="Ay6-kG-U8L"/>
34 + <constraint firstAttribute="bottom" secondItem="N8L-PD-UP8" secondAttribute="bottom" id="S87-T5-YdQ"/>
35 + <constraint firstAttribute="trailing" secondItem="N8L-PD-UP8" secondAttribute="trailing" id="WGt-wu-sFI"/>
36 + <constraint firstItem="N8L-PD-UP8" firstAttribute="top" secondItem="YrO-k4-v2O" secondAttribute="top" id="ZxG-A7-Zci"/>
37 + </constraints>
38 + </view>
39 + </subviews>
40 + <color key="backgroundColor" red="0.94901960784313721" green="0.94901960784313721" blue="0.94901960784313721" alpha="1" colorSpace="calibratedRGB"/>
41 + <constraints>
42 + <constraint firstAttribute="bottom" secondItem="YrO-k4-v2O" secondAttribute="bottom" id="6we-5l-yeL"/>
43 + <constraint firstAttribute="trailing" secondItem="YrO-k4-v2O" secondAttribute="trailing" constant="24" id="7CD-5N-Kwy"/>
44 + <constraint firstItem="YrO-k4-v2O" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="24" id="ExZ-x2-yiF"/>
45 + <constraint firstItem="YrO-k4-v2O" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="35" id="iID-80-Men"/>
46 + </constraints>
47 + </tableViewCellContentView>
48 + <viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
49 + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
50 + <connections>
51 + <outlet property="questionnaireBannerImage" destination="N8L-PD-UP8" id="BMn-6A-UVw"/>
52 + </connections>
53 + <point key="canvasLocation" x="68.702290076335871" y="47.535211267605639"/>
54 + </tableViewCell>
55 + </objects>
56 + <resources>
57 + <systemColor name="systemRedColor">
58 + <color red="1" green="0.23137254900000001" blue="0.18823529410000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
59 + </systemColor>
60 + </resources>
61 +</document>
1 +//
2 +// Models.swift
3 +// SwiftWarplyFramework
4 +//
5 +// Created by Manos Chorianopoulos on 29/5/25.
6 +//
7 +
8 +
9 +struct SectionModel {
10 + let title: String
11 + let count: Int
12 + let offers: [OfferModel]
13 +}
14 +
15 +struct OfferModel {
16 + let category: String
17 + let title: String
18 + let description: String
19 + let discount: String
20 + let discountType: String // e.g., "price", "percentage", "free", "buyOneGetOne", etc.
21 + let bannerImage: String
22 + let merchantLogo: String
23 + let expirationDate: String
24 + let color: UInt
25 + var isFavorite: Bool
26 + var active: Bool?
27 + var redeemed: Bool?
28 +}
29 +
30 +struct CouponFilterModel {
31 + let title: String
32 +}
...@@ -7,24 +7,6 @@ ...@@ -7,24 +7,6 @@
7 7
8 import UIKit 8 import UIKit
9 9
10 -struct SectionModel {
11 - let title: String
12 - let count: Int
13 - let offers: [OfferModel]
14 -}
15 -
16 -struct OfferModel {
17 - let category: String
18 - let title: String
19 - let description: String
20 - let discount: String
21 - let discountType: String // e.g., "price", "percentage", "free", "buyOneGetOne", etc.
22 - let bannerImage: String
23 - let merchantLogo: String
24 - let expirationDate: String
25 - let color: UInt
26 - var isFavorite: Bool
27 -}
28 10
29 @objc public class MyRewardsViewController: UIViewController { 11 @objc public class MyRewardsViewController: UIViewController {
30 @IBOutlet weak var tableView: UITableView! 12 @IBOutlet weak var tableView: UITableView!
...@@ -80,18 +62,6 @@ struct OfferModel { ...@@ -80,18 +62,6 @@ struct OfferModel {
80 color: 0x8A2BE2, 62 color: 0x8A2BE2,
81 isFavorite: false 63 isFavorite: false
82 ), 64 ),
83 - OfferModel(
84 - category: "Διαγωνισμός",
85 - title: "Διαγωνισμός Κού-πονς!",
86 - description: "13 Απίθανα ΔΩΡΑ σε περιμένουν!",
87 - discount: "",
88 - discountType: "contest",
89 - bannerImage: "contest_banner_5",
90 - merchantLogo: "contest_logo",
91 - expirationDate: "30/06/2025",
92 - color: 0x8A2BE2,
93 - isFavorite: false
94 - ),
95 // Top offers 65 // Top offers
96 OfferModel( 66 OfferModel(
97 category: "Top offers", 67 category: "Top offers",
...@@ -301,6 +271,13 @@ struct OfferModel { ...@@ -301,6 +271,13 @@ struct OfferModel {
301 ) 271 )
302 ] 272 ]
303 273
274 + let contestUrls: [String] = [
275 + "https://warply.s3.amazonaws.com/dei/campaigns/tesla_dev/index.html",
276 + "https://warply.s3.amazonaws.com/dei/campaigns/EnergySaverContest_dev/index.html",
277 + "https://warply.s3.amazonaws.com/dei/campaigns/match_dev/index.html",
278 + "https://warply.s3.amazonaws.com/dei/campaigns/questionnaire_dev"
279 + ]
280 +
304 var bannerOffersSection: SectionModel? 281 var bannerOffersSection: SectionModel?
305 var topOffersSection: SectionModel? 282 var topOffersSection: SectionModel?
306 var favoriteOffersSection: SectionModel? 283 var favoriteOffersSection: SectionModel?
...@@ -423,23 +400,30 @@ struct OfferModel { ...@@ -423,23 +400,30 @@ struct OfferModel {
423 self.tableView.reloadData() 400 self.tableView.reloadData()
424 } 401 }
425 402
426 - private func openCampaignViewController(with offer: OfferModel) { 403 + private func openCampaignViewController(with index: Int) {
427 404
428 let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) 405 let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
429 if let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as? SwiftWarplyFramework.CampaignViewController { 406 if let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as? SwiftWarplyFramework.CampaignViewController {
430 - vc.campaignUrl = "https://warply.s3.amazonaws.com/dei/campaigns/DehEasterContest_stage/index.html" 407 +// vc.campaignUrl = "https://warply.s3.amazonaws.com/dei/campaigns/DehEasterContest_stage/index.html"
408 + vc.campaignUrl = contestUrls[index]
431 vc.showHeader = true 409 vc.showHeader = true
432 self.navigationController?.pushViewController(vc, animated: true) 410 self.navigationController?.pushViewController(vc, animated: true)
433 // self.present(vc, animated: true) 411 // self.present(vc, animated: true)
434 } 412 }
435 } 413 }
436 - 414 +
437 private func openCouponViewController(with offer: OfferModel) { 415 private func openCouponViewController(with offer: OfferModel) {
438 let vc = SwiftWarplyFramework.CouponViewController(nibName: "CouponViewController", bundle: Bundle(for: MyEmptyClass.self)) 416 let vc = SwiftWarplyFramework.CouponViewController(nibName: "CouponViewController", bundle: Bundle(for: MyEmptyClass.self))
439 vc.coupon = offer 417 vc.coupon = offer
440 418
441 self.navigationController?.pushViewController(vc, animated: true) 419 self.navigationController?.pushViewController(vc, animated: true)
442 } 420 }
421 +
422 + private func openProfileViewController() {
423 + let vc = SwiftWarplyFramework.ProfileViewController(nibName: "ProfileViewController", bundle: Bundle(for: MyEmptyClass.self))
424 +
425 + self.navigationController?.pushViewController(vc, animated: true)
426 + }
443 } 427 }
444 428
445 // MARK: - TableView 429 // MARK: - TableView
...@@ -536,9 +520,14 @@ extension MyRewardsViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -536,9 +520,14 @@ extension MyRewardsViewController: UITableViewDelegate, UITableViewDataSource{
536 520
537 // Add delegate conformance 521 // Add delegate conformance
538 extension MyRewardsViewController: MyRewardsBannerOffersScrollTableViewCellDelegate { 522 extension MyRewardsViewController: MyRewardsBannerOffersScrollTableViewCellDelegate {
539 - func didSelectBannerOffer(_ offer: OfferModel) { 523 + func didSelectBannerOffer(_ index: Int) {
540 // Navigate to CampaignViewController 524 // Navigate to CampaignViewController
541 - openCampaignViewController(with: offer) 525 + openCampaignViewController(with: index)
526 + }
527 +
528 + func didTapProfileButton() {
529 + // Navigate to ProfileViewController
530 + openProfileViewController()
542 } 531 }
543 } 532 }
544 533
......
...@@ -171,6 +171,14 @@ import UIKit ...@@ -171,6 +171,14 @@ import UIKit
171 redeemed: true 171 redeemed: true
172 ) 172 )
173 ] 173 ]
174 +
175 + let couponFilters: [CouponFilterModel] = [
176 + CouponFilterModel(title: "Ενεργά"),
177 + CouponFilterModel(title: "Αγαπημένα"),
178 + CouponFilterModel(title: "Εξαργυρωμένα")
179 + ]
180 +
181 + var couponFilterSelected: CouponFilterModel = CouponFilterModel(title: "Ενεργά")
174 182
175 var forYouOffersSection: SectionModel? 183 var forYouOffersSection: SectionModel?
176 var activeOffersSection: SectionModel? 184 var activeOffersSection: SectionModel?
...@@ -187,8 +195,11 @@ import UIKit ...@@ -187,8 +195,11 @@ import UIKit
187 setNavigationTitle("Το προφίλ μου") 195 setNavigationTitle("Το προφίλ μου")
188 196
189 // Register XIBs for table view cells 197 // Register XIBs for table view cells
190 - // tableView.register(UINib(nibName: "MyRewardsBannerOffersScrollTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "MyRewardsBannerOffersScrollTableViewCell") 198 + tableView.register(UINib(nibName: "ProfileHeaderTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "ProfileHeaderTableViewCell")
191 - // tableView.register(UINib(nibName: "MyRewardsOffersScrollTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "MyRewardsOffersScrollTableViewCell") 199 + tableView.register(UINib(nibName: "ProfileQuestionnaireTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "ProfileQuestionnaireTableViewCell")
200 + tableView.register(UINib(nibName: "MyRewardsOffersScrollTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "MyRewardsOffersScrollTableViewCell")
201 + tableView.register(UINib(nibName: "ProfileCouponFiltersTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "ProfileCouponFiltersTableViewCell")
202 + tableView.register(UINib(nibName: "ProfileCouponTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "ProfileCouponTableViewCell")
192 203
193 // Set up table view 204 // Set up table view
194 tableView.delegate = self 205 tableView.delegate = self
...@@ -211,12 +222,14 @@ import UIKit ...@@ -211,12 +222,14 @@ import UIKit
211 ) 222 )
212 223
213 // Favorite Offers 224 // Favorite Offers
214 - let activeOffers = allOffers.filter { $0.active } 225 + let activeOffers = allOffers.filter { $0.active ?? false }
215 activeOffersSection = SectionModel( 226 activeOffersSection = SectionModel(
216 title: "Ενεργά", 227 title: "Ενεργά",
217 count: activeOffers.count, 228 count: activeOffers.count,
218 offers: activeOffers 229 offers: activeOffers
219 ) 230 )
231 +
232 + filteredOffersSection = activeOffersSection
220 233
221 // Favorite Offers 234 // Favorite Offers
222 let favoriteOffers = allOffers.filter { $0.isFavorite } 235 let favoriteOffers = allOffers.filter { $0.isFavorite }
...@@ -227,7 +240,7 @@ import UIKit ...@@ -227,7 +240,7 @@ import UIKit
227 ) 240 )
228 241
229 // Favorite Offers 242 // Favorite Offers
230 - let redeemedOffers = allOffers.filter { $0.redeemed } 243 + let redeemedOffers = allOffers.filter { $0.redeemed ?? false }
231 redeemedOffersSection = SectionModel( 244 redeemedOffersSection = SectionModel(
232 title: "Αγαπημένα", 245 title: "Αγαπημένα",
233 count: redeemedOffers.count, 246 count: redeemedOffers.count,
...@@ -236,13 +249,20 @@ import UIKit ...@@ -236,13 +249,20 @@ import UIKit
236 249
237 self.tableView.reloadData() 250 self.tableView.reloadData()
238 } 251 }
252 +
253 + private func openCouponViewController(with offer: OfferModel) {
254 + let vc = SwiftWarplyFramework.CouponViewController(nibName: "CouponViewController", bundle: Bundle(for: MyEmptyClass.self))
255 + vc.coupon = offer
256 +
257 + self.navigationController?.pushViewController(vc, animated: true)
258 + }
239 } 259 }
240 260
241 // MARK: - TableView 261 // MARK: - TableView
242 -extension MyRewardsViewController: UITableViewDelegate, UITableViewDataSource{ 262 +extension ProfileViewController: UITableViewDelegate, UITableViewDataSource {
243 263
244 public func numberOfSections(in tableView: UITableView) -> Int { 264 public func numberOfSections(in tableView: UITableView) -> Int {
245 - return 4 + filteredOffersSection.offers.count 265 + return 4 + (filteredOffersSection?.offers.count ?? 0)
246 } 266 }
247 267
248 public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 268 public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
...@@ -272,35 +292,37 @@ extension MyRewardsViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -272,35 +292,37 @@ extension MyRewardsViewController: UITableViewDelegate, UITableViewDataSource{
272 292
273 public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 293 public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
274 if (indexPath.section == 0) { 294 if (indexPath.section == 0) {
275 - let cell = tableView.dequeueReusableCell(withIdentifier: "MyRewardsBannerOffersScrollTableViewCell", for: indexPath) as! MyRewardsBannerOffersScrollTableViewCell 295 + let cell = tableView.dequeueReusableCell(withIdentifier: "ProfileHeaderTableViewCell", for: indexPath) as! ProfileHeaderTableViewCell
276 - cell.delegate = self // Set the banner offers delegate 296 +// cell.delegate = self // Set the banner offers delegate
277 - cell.configureCell(data: self.bannerOffersSection) 297 +// cell.configureCell(data: self.bannerOffersSection)
278 // cell.parent = self 298 // cell.parent = self
279 return cell 299 return cell
280 300
281 - } else { 301 + } else if (indexPath.section == 1) {
302 + let cell = tableView.dequeueReusableCell(withIdentifier: "ProfileQuestionnaireTableViewCell", for: indexPath) as! ProfileQuestionnaireTableViewCell
303 + return cell
304 +
305 + } else if (indexPath.section == 2) {
282 let cell = tableView.dequeueReusableCell(withIdentifier: "MyRewardsOffersScrollTableViewCell", for: indexPath) as! MyRewardsOffersScrollTableViewCell 306 let cell = tableView.dequeueReusableCell(withIdentifier: "MyRewardsOffersScrollTableViewCell", for: indexPath) as! MyRewardsOffersScrollTableViewCell
283 307
284 cell.delegate = self // Set the offers delegate 308 cell.delegate = self // Set the offers delegate
309 + cell.configureCell(data: self.forYouOffersSection)
285 310
286 - if (indexPath.section == 1) { 311 + return cell
287 - cell.configureCell(data: self.topOffersSection)
288 - } else if (indexPath.section == 2) {
289 - cell.configureCell(data: self.favoriteOffersSection)
290 - } else if (indexPath.section == 3) {
291 - cell.configureCell(data: self.sustainableOffersSection)
292 - } else if (indexPath.section == 4) {
293 - cell.configureCell(data: self.familyOffersSection)
294 - } else if (indexPath.section == 5) {
295 - cell.configureCell(data: self.foodOffersSection)
296 - } else if (indexPath.section == 6) {
297 - cell.configureCell(data: self.escapeOffersSection)
298 - } else if (indexPath.section == 7) {
299 - cell.configureCell(data: self.childOffersSection)
300 - } else {
301 - cell.configureCell(data: self.shoppingOffersSection)
302 - }
303 312
313 + } else if (indexPath.section == 3) {
314 + let cell = tableView.dequeueReusableCell(withIdentifier: "ProfileCouponFiltersTableViewCell", for: indexPath) as! ProfileCouponFiltersTableViewCell
315 +
316 + cell.delegate = self // Set the offers delegate
317 + cell.configureCell(data: self.couponFilters)
318 +
319 + return cell
320 +
321 + } else {
322 + let cell = tableView.dequeueReusableCell(withIdentifier: "ProfileCouponTableViewCell", for: indexPath) as! ProfileCouponTableViewCell
323 + if let offer = self.filteredOffersSection?.offers[indexPath.row] {
324 + cell.configureCell(data: offer)
325 + }
304 return cell 326 return cell
305 } 327 }
306 328
...@@ -330,3 +352,18 @@ extension MyRewardsViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -330,3 +352,18 @@ extension MyRewardsViewController: UITableViewDelegate, UITableViewDataSource{
330 } 352 }
331 } 353 }
332 354
355 +// Add delegate conformance
356 +extension ProfileViewController: MyRewardsOffersScrollTableViewCellDelegate {
357 + func didSelectOffer(_ offer: OfferModel) {
358 + // Navigate to CouponViewController
359 + openCouponViewController(with: offer)
360 + }
361 +}
362 +
363 +// Add delegate conformance
364 +extension ProfileViewController: ProfileCouponFiltersTableViewCellDelegate {
365 + func didSelectFilter(_ filter: CouponFilterModel) {
366 + self.couponFilterSelected = filter
367 + self.tableView.reloadData()
368 + }
369 +}
......