Manos Chorianopoulos

contest press handling

...@@ -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>
......
...@@ -48,7 +48,7 @@ extension UIViewController { ...@@ -48,7 +48,7 @@ extension UIViewController {
48 48
49 //your custom view for back image with custom size 49 //your custom view for back image with custom size
50 let view = UIView(frame: CGRect(x: 0, y: 0, width: 40, height: 40)) 50 let view = UIView(frame: CGRect(x: 0, y: 0, width: 40, height: 40))
51 - let imageView = UIImageView(frame: CGRect(x: 10, y: 10, width: 18, height: 18)) 51 + let imageView = UIImageView(frame: CGRect(x: 10, y: 12, width: 15, height: 15))
52 52
53 if let imgBackArrow = UIImage(named: icon, in: MyEmptyClass.resourceBundle(), compatibleWith: nil) { 53 if let imgBackArrow = UIImage(named: icon, in: MyEmptyClass.resourceBundle(), compatibleWith: nil) {
54 imageView.image = imgBackArrow 54 imageView.image = imgBackArrow
...@@ -149,31 +149,31 @@ extension UIViewController { ...@@ -149,31 +149,31 @@ extension UIViewController {
149 self.navigationController?.navigationBar.layer.shadowRadius = 2 149 self.navigationController?.navigationBar.layer.shadowRadius = 2
150 } 150 }
151 151
152 - func setNavigationTitle(_ title: String, _ fontWeight: String? = "medium") { 152 + func setNavigationTitle(_ title: String, _ fontWeight: String? = "bold") {
153 let uiscreen: CGRect = UIScreen.main.bounds 153 let uiscreen: CGRect = UIScreen.main.bounds
154 154
155 let titleLabel = UILabel(frame: CGRect(x: 0, y: 0, width: uiscreen.width * 0.7, height: uiscreen.height * 0.03)) 155 let titleLabel = UILabel(frame: CGRect(x: 0, y: 0, width: uiscreen.width * 0.7, height: uiscreen.height * 0.03))
156 titleLabel.text = title 156 titleLabel.text = title
157 - titleLabel.textColor = UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00) 157 + titleLabel.textColor = UIColor(rgb: 0x0D1B29)
158 158
159 // Fix width for ipad 159 // Fix width for ipad
160 if UIDevice.current.userInterfaceIdiom == .pad { 160 if UIDevice.current.userInterfaceIdiom == .pad {
161 // iPad 161 // iPad
162 if (fontWeight == "bold") { 162 if (fontWeight == "bold") {
163 - titleLabel.font = UIFont(name: "PingLCG-Bold", size: 21) 163 + titleLabel.font = UIFont(name: "PingLCG-Bold", size: 20)
164 } else { 164 } else {
165 - titleLabel.font = UIFont(name: "PingLCG-Bold", size: 21) 165 + titleLabel.font = UIFont(name: "PingLCG-Bold", size: 20)
166 } 166 }
167 } else { 167 } else {
168 // not iPad (iPhone, mac, tv, carPlay, unspecified) 168 // not iPad (iPhone, mac, tv, carPlay, unspecified)
169 if (fontWeight == "bold") { 169 if (fontWeight == "bold") {
170 - titleLabel.font = UIFont(name: "PingLCG-Bold", size: 19) 170 + titleLabel.font = UIFont(name: "PingLCG-Bold", size: 18)
171 } else { 171 } else {
172 - titleLabel.font = UIFont(name: "PingLCG-Bold", size: 19) 172 + titleLabel.font = UIFont(name: "PingLCG-Bold", size: 18)
173 } 173 }
174 } 174 }
175 titleLabel.adjustsFontSizeToFitWidth = true 175 titleLabel.adjustsFontSizeToFitWidth = true
176 - titleLabel.textAlignment = .center 176 + titleLabel.textAlignment = .left
177 self.navigationItem.titleView = titleLabel 177 self.navigationItem.titleView = titleLabel
178 178
179 } 179 }
......
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
7 7
8 import UIKit 8 import UIKit
9 9
10 +protocol MyRewardsBannerOffersScrollTableViewCellDelegate: AnyObject {
11 + func didSelectBannerOffer(_ offer: OfferModel)
12 +}
13 +
10 @objc public class MyRewardsBannerOffersScrollTableViewCell: UITableViewCell { 14 @objc public class MyRewardsBannerOffersScrollTableViewCell: UITableViewCell {
11 @IBOutlet weak var tagView1: UIView! 15 @IBOutlet weak var tagView1: UIView!
12 @IBOutlet weak var tagLabel1: UILabel! 16 @IBOutlet weak var tagLabel1: UILabel!
...@@ -15,9 +19,10 @@ import UIKit ...@@ -15,9 +19,10 @@ import UIKit
15 @IBOutlet weak var profileImage: UIImageView! 19 @IBOutlet weak var profileImage: UIImageView!
16 @IBOutlet weak var collectionView: UICollectionView! 20 @IBOutlet weak var collectionView: UICollectionView!
17 @IBOutlet weak var pageControl: UIPageControl! 21 @IBOutlet weak var pageControl: UIPageControl!
18 -
19 - var data: SectionModel?
20 22
23 + weak var delegate: MyRewardsBannerOffersScrollTableViewCellDelegate?
24 + var data: SectionModel?
25 +
21 public override func awakeFromNib() { 26 public override func awakeFromNib() {
22 super.awakeFromNib() 27 super.awakeFromNib()
23 // Initialization code 28 // Initialization code
...@@ -92,7 +97,7 @@ import UIKit ...@@ -92,7 +97,7 @@ import UIKit
92 } 97 }
93 } 98 }
94 99
95 -extension MyRewardsBannerOffersScrollTableViewCell: UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout { 100 +extension MyRewardsBannerOffersScrollTableViewCell: UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, UIScrollViewDelegate {
96 101
97 102
98 public func numberOfSections(in collectionView: UICollectionView) -> Int { 103 public func numberOfSections(in collectionView: UICollectionView) -> Int {
...@@ -113,7 +118,11 @@ extension MyRewardsBannerOffersScrollTableViewCell: UICollectionViewDataSource, ...@@ -113,7 +118,11 @@ extension MyRewardsBannerOffersScrollTableViewCell: UICollectionViewDataSource,
113 } 118 }
114 119
115 public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { 120 public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
116 -// TODO: open offer 121 + // Get the selected offer
122 + if let offer = self.data?.offers[indexPath.row] {
123 + // Call the delegate method to notify the parent
124 + delegate?.didSelectBannerOffer(offer)
125 + }
117 } 126 }
118 127
119 // MARK: - UICollectionViewDelegateFlowLayout 128 // MARK: - UICollectionViewDelegateFlowLayout
......
...@@ -77,6 +77,7 @@ var timer2: DispatchSourceTimer? ...@@ -77,6 +77,7 @@ var timer2: DispatchSourceTimer?
77 77
78 if (showHeader) { 78 if (showHeader) {
79 setBackButton() 79 setBackButton()
80 + setNavigationTitle("Προσφορά")
80 } 81 }
81 82
82 // Add observers for application state changes 83 // Add observers for application state changes
......
...@@ -101,7 +101,7 @@ struct OfferModel { ...@@ -101,7 +101,7 @@ struct OfferModel {
101 discountType: "price", 101 discountType: "price",
102 bannerImage: "dominos_banner", 102 bannerImage: "dominos_banner",
103 merchantLogo: "dominos_logo", 103 merchantLogo: "dominos_logo",
104 - expirationDate: "έως 30-09", 104 + expirationDate: "έως 30/09",
105 color: 0xEE417D, 105 color: 0xEE417D,
106 isFavorite: true 106 isFavorite: true
107 ), 107 ),
...@@ -113,7 +113,7 @@ struct OfferModel { ...@@ -113,7 +113,7 @@ struct OfferModel {
113 discountType: "percentage", 113 discountType: "percentage",
114 bannerImage: "dominos_banner", 114 bannerImage: "dominos_banner",
115 merchantLogo: "dominos_logo", 115 merchantLogo: "dominos_logo",
116 - expirationDate: "έως 30-09", 116 + expirationDate: "έως 30/09",
117 color: 0xEE417D, 117 color: 0xEE417D,
118 isFavorite: false 118 isFavorite: false
119 ), 119 ),
...@@ -127,7 +127,7 @@ struct OfferModel { ...@@ -127,7 +127,7 @@ struct OfferModel {
127 // discountType: "percentage", 127 // discountType: "percentage",
128 // bannerImage: "car_rental_banner", 128 // bannerImage: "car_rental_banner",
129 // merchantLogo: "avis_logo", 129 // merchantLogo: "avis_logo",
130 - // expirationDate: "έως 30-09", 130 + // expirationDate: "έως 30/09",
131 // color: 0xEE417D, 131 // color: 0xEE417D,
132 // isFavorite: true 132 // isFavorite: true
133 // ), 133 // ),
...@@ -139,7 +139,7 @@ struct OfferModel { ...@@ -139,7 +139,7 @@ struct OfferModel {
139 // discountType: "amount", 139 // discountType: "amount",
140 // bannerImage: "hotel_banner", 140 // bannerImage: "hotel_banner",
141 // merchantLogo: "booking_logo", 141 // merchantLogo: "booking_logo",
142 - // expirationDate: "έως 30-09", 142 + // expirationDate: "έως 30/09",
143 // color: 0xEE417D, 143 // color: 0xEE417D,
144 // isFavorite: true 144 // isFavorite: true
145 // ), 145 // ),
...@@ -153,7 +153,7 @@ struct OfferModel { ...@@ -153,7 +153,7 @@ struct OfferModel {
153 discountType: "percentage", 153 discountType: "percentage",
154 bannerImage: "musa_banner", 154 bannerImage: "musa_banner",
155 merchantLogo: "musa_logo", 155 merchantLogo: "musa_logo",
156 - expirationDate: "έως 30-09", 156 + expirationDate: "έως 30/09",
157 color: 0x09914E, 157 color: 0x09914E,
158 isFavorite: false 158 isFavorite: false
159 ), 159 ),
...@@ -165,7 +165,7 @@ struct OfferModel { ...@@ -165,7 +165,7 @@ struct OfferModel {
165 discountType: "percentage", 165 discountType: "percentage",
166 bannerImage: "musa_banner", 166 bannerImage: "musa_banner",
167 merchantLogo: "musa_logo", 167 merchantLogo: "musa_logo",
168 - expirationDate: "έως 30-09", 168 + expirationDate: "έως 30/09",
169 color: 0x09914E, 169 color: 0x09914E,
170 isFavorite: true 170 isFavorite: true
171 ), 171 ),
...@@ -179,7 +179,7 @@ struct OfferModel { ...@@ -179,7 +179,7 @@ struct OfferModel {
179 discountType: "percentage", 179 discountType: "percentage",
180 bannerImage: "ranch_banner", 180 bannerImage: "ranch_banner",
181 merchantLogo: "ranch_logo", 181 merchantLogo: "ranch_logo",
182 - expirationDate: "έως 30-09", 182 + expirationDate: "έως 30/09",
183 color: 0xFC9F25, 183 color: 0xFC9F25,
184 isFavorite: false 184 isFavorite: false
185 ), 185 ),
...@@ -191,7 +191,7 @@ struct OfferModel { ...@@ -191,7 +191,7 @@ struct OfferModel {
191 discountType: "buyOneGetOne", 191 discountType: "buyOneGetOne",
192 bannerImage: "ranch_banner", 192 bannerImage: "ranch_banner",
193 merchantLogo: "ranch_logo", 193 merchantLogo: "ranch_logo",
194 - expirationDate: "έως 30-09", 194 + expirationDate: "έως 30/09",
195 color: 0xFC9F25, 195 color: 0xFC9F25,
196 isFavorite: false 196 isFavorite: false
197 ), 197 ),
...@@ -205,7 +205,7 @@ struct OfferModel { ...@@ -205,7 +205,7 @@ struct OfferModel {
205 discountType: "amount", 205 discountType: "amount",
206 bannerImage: "coffeeisland_banner", 206 bannerImage: "coffeeisland_banner",
207 merchantLogo: "coffeeisland_logo", 207 merchantLogo: "coffeeisland_logo",
208 - expirationDate: "έως 30-09", 208 + expirationDate: "έως 30/09",
209 color: 0xEE417D, 209 color: 0xEE417D,
210 isFavorite: false 210 isFavorite: false
211 ), 211 ),
...@@ -217,7 +217,7 @@ struct OfferModel { ...@@ -217,7 +217,7 @@ struct OfferModel {
217 discountType: "percentage", 217 discountType: "percentage",
218 bannerImage: "coffeeisland_banner", 218 bannerImage: "coffeeisland_banner",
219 merchantLogo: "coffeeisland_logo", 219 merchantLogo: "coffeeisland_logo",
220 - expirationDate: "έως 30-09", 220 + expirationDate: "έως 30/09",
221 color: 0xEE417D, 221 color: 0xEE417D,
222 isFavorite: false 222 isFavorite: false
223 ), 223 ),
...@@ -231,7 +231,7 @@ struct OfferModel { ...@@ -231,7 +231,7 @@ struct OfferModel {
231 discountType: "percentage", 231 discountType: "percentage",
232 bannerImage: "ninemia_banner", 232 bannerImage: "ninemia_banner",
233 merchantLogo: "ninemia_logo", 233 merchantLogo: "ninemia_logo",
234 - expirationDate: "έως 30-09", 234 + expirationDate: "έως 30/09",
235 color: 0xEE417D, 235 color: 0xEE417D,
236 isFavorite: true 236 isFavorite: true
237 ), 237 ),
...@@ -243,7 +243,7 @@ struct OfferModel { ...@@ -243,7 +243,7 @@ struct OfferModel {
243 discountType: "percentage", 243 discountType: "percentage",
244 bannerImage: "ninemia_banner", 244 bannerImage: "ninemia_banner",
245 merchantLogo: "ninemia_logo", 245 merchantLogo: "ninemia_logo",
246 - expirationDate: "έως 30-09", 246 + expirationDate: "έως 30/09",
247 color: 0xEE417D, 247 color: 0xEE417D,
248 isFavorite: false 248 isFavorite: false
249 ), 249 ),
...@@ -257,7 +257,7 @@ struct OfferModel { ...@@ -257,7 +257,7 @@ struct OfferModel {
257 discountType: "percentage", 257 discountType: "percentage",
258 bannerImage: "moustakas_banner", 258 bannerImage: "moustakas_banner",
259 merchantLogo: "moustakas_logo", 259 merchantLogo: "moustakas_logo",
260 - expirationDate: "έως 30-09", 260 + expirationDate: "έως 30/09",
261 color: 0xEE417D, 261 color: 0xEE417D,
262 isFavorite: false 262 isFavorite: false
263 ), 263 ),
...@@ -269,7 +269,7 @@ struct OfferModel { ...@@ -269,7 +269,7 @@ struct OfferModel {
269 discountType: "buyOneGetOne", 269 discountType: "buyOneGetOne",
270 bannerImage: "moustakas_banner", 270 bannerImage: "moustakas_banner",
271 merchantLogo: "moustakas_logo", 271 merchantLogo: "moustakas_logo",
272 - expirationDate: "έως 30-09", 272 + expirationDate: "έως 30/09",
273 color: 0xEE417D, 273 color: 0xEE417D,
274 isFavorite: false 274 isFavorite: false
275 ), 275 ),
...@@ -283,7 +283,7 @@ struct OfferModel { ...@@ -283,7 +283,7 @@ struct OfferModel {
283 discountType: "amount", 283 discountType: "amount",
284 bannerImage: "migato_banner", 284 bannerImage: "migato_banner",
285 merchantLogo: "migato_logo", 285 merchantLogo: "migato_logo",
286 - expirationDate: "έως 30-09", 286 + expirationDate: "έως 30/09",
287 color: 0xEE417D, 287 color: 0xEE417D,
288 isFavorite: false 288 isFavorite: false
289 ), 289 ),
...@@ -295,7 +295,7 @@ struct OfferModel { ...@@ -295,7 +295,7 @@ struct OfferModel {
295 discountType: "percentage", 295 discountType: "percentage",
296 bannerImage: "migato_banner", 296 bannerImage: "migato_banner",
297 merchantLogo: "migato_logo", 297 merchantLogo: "migato_logo",
298 - expirationDate: "έως 30-09", 298 + expirationDate: "έως 30/09",
299 color: 0xEE417D, 299 color: 0xEE417D,
300 isFavorite: false 300 isFavorite: false
301 ) 301 )
...@@ -314,6 +314,9 @@ struct OfferModel { ...@@ -314,6 +314,9 @@ struct OfferModel {
314 public override func viewDidLoad() { 314 public override func viewDidLoad() {
315 super.viewDidLoad() 315 super.viewDidLoad()
316 316
317 + // Hide the navigation bar
318 + // self.navigationController?.setNavigationBarHidden(true, animated: false)
319 +
317 // Register XIBs for table view cells 320 // Register XIBs for table view cells
318 tableView.register(UINib(nibName: "MyRewardsBannerOffersScrollTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "MyRewardsBannerOffersScrollTableViewCell") 321 tableView.register(UINib(nibName: "MyRewardsBannerOffersScrollTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "MyRewardsBannerOffersScrollTableViewCell")
319 tableView.register(UINib(nibName: "MyRewardsOffersScrollTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "MyRewardsOffersScrollTableViewCell") 322 tableView.register(UINib(nibName: "MyRewardsOffersScrollTableViewCell", bundle: Bundle(for: MyEmptyClass.self)), forCellReuseIdentifier: "MyRewardsOffersScrollTableViewCell")
...@@ -327,6 +330,21 @@ struct OfferModel { ...@@ -327,6 +330,21 @@ struct OfferModel {
327 330
328 initializeSections() 331 initializeSections()
329 } 332 }
333 +
334 + public override func viewWillAppear(_ animated: Bool) {
335 + super.viewWillAppear(animated)
336 +
337 + // Hide navigation bar when this view appears
338 + self.navigationController?.setNavigationBarHidden(true, animated: animated)
339 + }
340 +
341 + public override func viewWillDisappear(_ animated: Bool) {
342 + super.viewWillDisappear(animated)
343 +
344 + // Show navigation bar when leaving this view (for other screens)
345 + self.navigationController?.setNavigationBarHidden(false, animated: animated)
346 + }
347 +
330 348
331 // MARK: Function 349 // MARK: Function
332 func initializeSections() { 350 func initializeSections() {
...@@ -404,7 +422,18 @@ struct OfferModel { ...@@ -404,7 +422,18 @@ struct OfferModel {
404 422
405 self.tableView.reloadData() 423 self.tableView.reloadData()
406 } 424 }
407 - 425 +
426 + // Add navigation method
427 + private func openCampaignViewController(with offer: OfferModel) {
428 +
429 + let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
430 + if let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as? SwiftWarplyFramework.CampaignViewController {
431 + vc.campaignUrl = "https://warply.s3.amazonaws.com/dei/campaigns/DehEasterContest_stage/index.html"
432 + vc.showHeader = true
433 + self.navigationController?.pushViewController(vc, animated: true)
434 +// self.present(vc, animated: true)
435 + }
436 + }
408 } 437 }
409 438
410 // MARK: - TableView 439 // MARK: - TableView
...@@ -442,6 +471,7 @@ extension MyRewardsViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -442,6 +471,7 @@ extension MyRewardsViewController: UITableViewDelegate, UITableViewDataSource{
442 public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 471 public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
443 if (indexPath.section == 0) { 472 if (indexPath.section == 0) {
444 let cell = tableView.dequeueReusableCell(withIdentifier: "MyRewardsBannerOffersScrollTableViewCell", for: indexPath) as! MyRewardsBannerOffersScrollTableViewCell 473 let cell = tableView.dequeueReusableCell(withIdentifier: "MyRewardsBannerOffersScrollTableViewCell", for: indexPath) as! MyRewardsBannerOffersScrollTableViewCell
474 + cell.delegate = self
445 cell.configureCell(data: self.bannerOffersSection) 475 cell.configureCell(data: self.bannerOffersSection)
446 // cell.parent = self 476 // cell.parent = self
447 return cell 477 return cell
...@@ -495,3 +525,11 @@ extension MyRewardsViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -495,3 +525,11 @@ extension MyRewardsViewController: UITableViewDelegate, UITableViewDataSource{
495 } 525 }
496 } 526 }
497 } 527 }
528 +
529 +// Add delegate conformance
530 +extension MyRewardsViewController: MyRewardsBannerOffersScrollTableViewCellDelegate {
531 + func didSelectBannerOffer(_ offer: OfferModel) {
532 + // Navigate to CampaignViewController
533 + openCampaignViewController(with: offer)
534 + }
535 +}
......