Manos Chorianopoulos

UnifiedCouponBarcodeVC coupons fixes, Markets Map

......@@ -7,7 +7,7 @@
<key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>
......
......@@ -7,7 +7,7 @@
<key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
</dict>
</dict>
......
......@@ -16,7 +16,10 @@ import UIKit
@IBOutlet weak var dicountLabel: UILabel!
@IBOutlet weak var discriptionLabel: UILabel!
@IBOutlet weak var expirationLabel: UILabel!
@IBOutlet weak var expirationRedView: UIView!
@IBOutlet weak var expirationRedImage: UIImageView!
@IBOutlet weak var expirationRedLabel: UILabel!
var postImageURL: String? {
didSet {
if let url = postImageURL {
......@@ -96,6 +99,77 @@ import UIKit
// COUPONSET: desc, img_preview, name, terms, merchant_uuid
// COUPON: coupon, expiration, discount, status
// MERCHANT: _img_preview,_admin_name
if (coupon.status == 1) {
// Add shadow
self.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.16).cgColor
self.layer.shadowOffset = CGSize(width: 0.0, height: 0.0)
self.layer.shadowOpacity = 1.0
self.layer.shadowRadius = 6.0
couponBgImage.image = UIImage(named: "coupon_bg", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
expirationLabel.isHidden = false
expirationRedView.isHidden = true
expirationLabel.text = "Ισχύει έως "+(coupon.expiration ?? "")
let formatter = DateFormatter()
formatter.dateFormat = "dd/MM/yyyy"
let today = Date()
// let firstDate = formatter.date(from: "01/08/2017")
// let secondDate = formatter.date(from: "22/04/2023")
if let couponExpiration = coupon.expiration, let secondDate = formatter.date(from: couponExpiration) {
let calendar = NSCalendar.current
let date1 = calendar.startOfDay(for: today)
let date2 = calendar.startOfDay(for: secondDate)
let differenceComponents = calendar.dateComponents([.day], from: date1, to: date2)
if let daysDifference = differenceComponents.day {
if ((daysDifference >= 0) && (daysDifference <= 15)) {
expirationLabel.isHidden = true
expirationRedView.isHidden = false
expirationRedView.layer.cornerRadius = 10.0
expirationRedView.backgroundColor = UIColor(red: 0.94, green: 0.90, blue: 0.90, alpha: 1.00)
expirationRedImage.image = UIImage(named: "ic_time_forward", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
let normalText1 = "Ισχύει έως "
let redText = (coupon.expiration ?? "")
let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PFSquareSansPro-Medium", size: 12) ?? UIFont.systemFont(ofSize: 11), NSAttributedString.Key.foregroundColor: UIColor(red: 0.38, green: 0.44, blue: 0.51, alpha: 1.00)]
let attrRed = [NSAttributedString.Key.font : UIFont(name: "PFSquareSansPro-Medium", size: 12) ?? UIFont.systemFont(ofSize: 11), NSAttributedString.Key.foregroundColor: UIColor(red: 1.00, green: 0.42, blue: 0.42, alpha: 1.00)]
let attributedString = NSMutableAttributedString(string:normalText1, attributes:attrRegular)
let RedString = NSMutableAttributedString(string: redText, attributes:attrRed)
attributedString.append(RedString)
expirationRedLabel.attributedText = attributedString
} else {
expirationLabel.isHidden = false
expirationRedView.isHidden = true
expirationLabel.text = "Ισχύει έως "+(coupon.expiration ?? "")
}
}
}
} else if (coupon.status == 0) {
couponBgImage.image = UIImage(named: "coupon_bg_grey", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
expirationLabel.isHidden = false
expirationRedView.isHidden = true
expirationLabel.text = "Το κουπόνι έληξε"
couponImage.layer.opacity = 0.23
borderView.layer.opacity = 0.15
nameLabel.layer.opacity = 0.15
dicountLabel.layer.opacity = 0.15
discriptionLabel.layer.opacity = 0.15
}
let merchantList:Array<swiftApi.MerchantModel> = swiftApi().getMerchantList()
......@@ -120,7 +194,6 @@ import UIKit
let htmlText = coupon.inner_text ?? ""
discriptionLabel.text = htmlText.htmlToString
// discriptionLabel.text = coupon.inner_text ?? ""
expirationLabel.text = "Ισχύει έως "+(coupon.expiration ?? "")
}
......
......@@ -123,6 +123,12 @@ import MapKit
swiftApi().getMultilingualMerchantsAsync([], false, 0.0, [], "", 0, [merchantUuid], getMerchantsCallback)
showContent()
}
} else {
let appUuid = swiftApi().getAppUuid()
let categoryUuids = appUuid == "0086a2088301440792091b9f814c2267" ? [""] : ["adcace6cab6049c7b7271bc85bc2b26d"]
swiftApi().getMultilingualMerchantsAsync(categoryUuids, false, 0.0, [], "", 0, [], getMerchantsCallback)
showContent()
}
}
......
......@@ -496,11 +496,11 @@ extension UITableView {
}
@IBAction func mapButtonAction(_ sender: Any) {
// swiftApi().logTrackersEvent("click", "SeeShops")
swiftApi().logTrackersEvent("click", "SeeShops")
//
// let vc = SwiftWarplyFramework.MapsViewController(nibName: "MapsViewController", bundle: Bundle(for: MyEmptyClass.self))
let vc = SwiftWarplyFramework.MapsViewController(nibName: "MapsViewController", bundle: Bundle(for: MyEmptyClass.self))
// vc.couponSet = coupon?.couponset_data
// self.navigationController?.pushViewController(vc, animated: true)
self.navigationController?.pushViewController(vc, animated: true)
// if (mapBtnVisible == true) {
// swiftApi().logTrackersEvent("click", "SeeShops")
......@@ -583,13 +583,6 @@ extension UnifiedCouponBarcodeViewController: UITableViewDelegate, UITableViewDa
cell.configureCell(coupon: (self.coupon?._coupons[indexPath.row])!, isMarket: true)
// cell.couponBgImage.image = UIImage(named: "coupon_bg_shadow", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
cell.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.16).cgColor
cell.layer.shadowOffset = CGSize(width: 0.0, height: 0.0)
cell.layer.shadowOpacity = 1.0
cell.layer.shadowRadius = 6.0
return cell
} else {
......