Manos Chorianopoulos

openArticle with matched couponset

...@@ -553,10 +553,21 @@ import UIKit ...@@ -553,10 +553,21 @@ import UIKit
553 return 553 return
554 } 554 }
555 555
556 - // TODO: Implement article navigation 556 + // Try to match article's url_link with a couponset uuid
557 - // This could navigate to a web view with article content, 557 + let urlLink = article._url_link
558 - // or a dedicated article detail screen 558 + if !urlLink.isEmpty,
559 - print("TODO: Navigate to article: \(article._name) - \(article._id)") 559 + let matchedCouponSet = self.couponSets.first(where: { $0._uuid == urlLink }) {
560 + // Bind merchant data if available
561 + if matchedCouponSet._merchant == nil,
562 + let merchant = self.merchants.first(where: { $0._uuid == matchedCouponSet._merchant_uuid }) {
563 + matchedCouponSet._merchant = merchant
564 + }
565 + openCouponsetViewController(with: matchedCouponSet)
566 + return
567 + }
568 +
569 + // No matching couponset found
570 + print("No matching couponset found for article: \(article._name) with url_link: \(article._url_link)")
560 } 571 }
561 572
562 private func openCouponViewController(with offer: OfferModel) { 573 private func openCouponViewController(with offer: OfferModel) {
......