Manos Chorianopoulos

add MarketAnalysisItemViewCell

......@@ -7,7 +7,7 @@
<key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>
......
......@@ -31,6 +31,7 @@
1E64E8FD2B8DE457001BA46E /* WalletQuestionnaireBannerTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E64E8FC2B8DE457001BA46E /* WalletQuestionnaireBannerTableViewCell.swift */; };
1E64E8FF2B8DE487001BA46E /* WalletHistoryBannerTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E64E8FE2B8DE487001BA46E /* WalletHistoryBannerTableViewCell.swift */; };
1E64E9012B8DE4AC001BA46E /* WalletEmptyViewTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E64E9002B8DE4AC001BA46E /* WalletEmptyViewTableViewCell.swift */; };
1E6515D52D36A4C300AD80C6 /* MarketAnalysisItemViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E6515D42D36A4C300AD80C6 /* MarketAnalysisItemViewCell.swift */; };
1E74838D28378AF40042A589 /* CouponBarcodeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E74838C28378AF40042A589 /* CouponBarcodeViewController.swift */; };
1E7B9A5829F6ACF400B37E13 /* WalletBannersTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7B9A5729F6ACF400B37E13 /* WalletBannersTableViewCell.swift */; };
1E87A9EF28C2021200C79F90 /* ContextualViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E87A9EE28C2021200C79F90 /* ContextualViewController.swift */; };
......@@ -229,6 +230,7 @@
1E64E8FC2B8DE457001BA46E /* WalletQuestionnaireBannerTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletQuestionnaireBannerTableViewCell.swift; sourceTree = "<group>"; };
1E64E8FE2B8DE487001BA46E /* WalletHistoryBannerTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletHistoryBannerTableViewCell.swift; sourceTree = "<group>"; };
1E64E9002B8DE4AC001BA46E /* WalletEmptyViewTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletEmptyViewTableViewCell.swift; sourceTree = "<group>"; };
1E6515D42D36A4C300AD80C6 /* MarketAnalysisItemViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarketAnalysisItemViewCell.swift; sourceTree = "<group>"; };
1E74838C28378AF40042A589 /* CouponBarcodeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponBarcodeViewController.swift; sourceTree = "<group>"; };
1E7B9A5729F6ACF400B37E13 /* WalletBannersTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletBannersTableViewCell.swift; sourceTree = "<group>"; };
1E87A9EE28C2021200C79F90 /* ContextualViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContextualViewController.swift; sourceTree = "<group>"; };
......@@ -527,6 +529,7 @@
1E029A4029E002CF00CC7447 /* UnifiedCouponBCHeaderTableViewCell.swift */,
1E029A4229E0031600CC7447 /* UnifiedCouponBCFooterTableViewCell.swift */,
1E15B9A329DDD211000A408D /* MarketHistoryViewController.swift */,
1E6515D42D36A4C300AD80C6 /* MarketAnalysisItemViewCell.swift */,
1EBC75422922829D004FBE75 /* SpinnerViewController.swift */,
1ECA079028D9E3BA00D2BDE0 /* CSMButton.swift */,
1E108A9728A3FA9B0008B8E7 /* Info.plist */,
......@@ -1009,6 +1012,7 @@
1E479FB329DD948B00C38193 /* WalletBadgesTableViewCell.swift in Sources */,
1E151F1829DAE48500951FA0 /* UnifiedCouponsTableViewCell.swift in Sources */,
E6A778F0282933E60045BBA8 /* WLNativeAdsCollectionMode.m in Sources */,
1E6515D52D36A4C300AD80C6 /* MarketAnalysisItemViewCell.swift in Sources */,
E6A7791C282933E60045BBA8 /* WLSMSActionHandlerDeprecated.m in Sources */,
E6A77934282933E70045BBA8 /* UIActivityIndicatorView+AFNetworking.m in Sources */,
E6A77A34282BB3BB0045BBA8 /* ActiveGiftsViewController.swift in Sources */,
......
......@@ -7,7 +7,7 @@
<key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
</dict>
</dict>
......
//
// MarketAnalysisItemViewCell.swift
// SwiftWarplyFramework
//
// Created by Manos Chorianopoulos on 14/1/25.
//
import UIKit
class MarketAnalysisItemViewCell: UITableViewCell {
@IBOutlet weak var dateLabel: UILabel!
@IBOutlet weak var itemImage: UIImageView!
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var priceLabel: UILabel!
@IBOutlet weak var subtitleLabel: UILabel!
var postImageURL: String? {
didSet {
if let url = postImageURL {
self.itemImage.image = UIImage() // UIImage(named: "loading")
UIImage.loadImageUsingCacheWithUrlString(url) { image in
// set the image only when we are still displaying the content for the image we finished downloading
if url == self.postImageURL {
self.itemImage.image = image
}
}
}
else {
self.itemImage.image = nil
}
}
}
// lifecycle
override func awakeFromNib() {
super.awakeFromNib()
// date
dateLabel.textColor = UIColor(rgb: 0x212121)
dateLabel.font = UIFont(name: "PeridotPE-Bold", size: 12.0)
// title
titleLabel.textColor = UIColor(rgb: 0x212121)
titleLabel.font = UIFont(name: "PeridotPE-Regular", size: 17.0)
// price
priceLabel.textColor = UIColor(rgb: 0x212121)
priceLabel.font = UIFont(name: "PeridotPE-Bold", size: 17.0)
// subtitle
// subtitleLabel.textColor = UIColor(rgb: 0x9D9D9C)
subtitleLabel.textColor = UIColor(rgb: 0x212121)
subtitleLabel.font = UIFont(name: "PeridotPE-Regular", size: 14.0)
}
}
extension AnalysisItemViewCell {
func configureCell(item: swiftApi.SharingCouponModel) {
let merchantList:Array<swiftApi.MerchantModel> = swiftApi().getMerchantList()
titleLabel.text = ""
for merchant in merchantList {
if (merchant._uuid == item._merchant_uuid) {
// itemImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache())
self.postImageURL = merchant._img_preview
titleLabel.text = merchant._admin_name
break;
}
}
dateLabel.text = item._date
// titleLabel.text = item._name
let priceFloat = Float(round(100 * (Float(item._final_price) )) / 100)
var priceString = "0"
priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil)
priceLabel.text = priceString + "€"
if ("sent" == item._sharing_type) {
subtitleLabel.text = String(format: "Εκπτωτικό κουπόνι προς " + item._receiver_msisdn)
} else if ("received" == item._sharing_type) {
subtitleLabel.text = String(format: "Εκπτωτικό κουπόνι από " + item._sender_msisdn)
}
}
func configureCell(item: swiftApi.SharingCouponModel, isMarket: Bool) {
let merchantList:Array<swiftApi.MerchantModel> = swiftApi().getMerchantList()
let couponSetData: swiftApi.CouponSetItemModel? = item._sm_couponset_data
titleLabel.text = ""
for merchant in merchantList {
if (merchant._uuid == item._merchant_uuid) {
// itemImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache())
self.postImageURL = merchant._img_preview
titleLabel.text = merchant._admin_name
break;
}
}
dateLabel.text = item._date
// titleLabel.text = item._name
// titleLabel.text = couponSetData?.name ?? ""
// let priceFloat = Float(round(100 * (Float(item._final_price) )) / 100)
let priceFloat = Float(round(100 * (Float(couponSetData?.final_price ?? 0.0) )) / 100)
var priceString = "0"
priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil)
priceLabel.text = priceString + "€"
if ("sent" == item._sharing_type) {
subtitleLabel.text = String(format: "Εκπτωτικό κουπόνι προς " + item._receiver_msisdn)
} else if ("received" == item._sharing_type) {
subtitleLabel.text = String(format: "Εκπτωτικό κουπόνι από " + item._sender_msisdn)
}
}
func configureCell(item: swiftApi.CouponItemModel) {
// COUPONSET: desc, img_preview, name, terms, merchant_uuid
// COUPON: coupon, expiration, discount, status
// MERCHANT: _img_preview,_admin_name
let merchantList:Array<swiftApi.MerchantModel> = swiftApi().getMerchantList()
let couponSetData: swiftApi.CouponSetItemModel? = item.couponset_data
titleLabel.text = ""
// for merchant in merchantList {
// // if (merchant._uuid == couponSetData?.merchant_uuid) {
// if (merchant._uuid == item.merchant_uuid) {
// // itemImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache())
// self.postImageURL = merchant._img_preview
// titleLabel.text = merchant._admin_name
// break;
// }
// }
let merchantDetails: swiftApi.MerchantModel? = item.merchant_details
self.postImageURL = merchantDetails?._img_preview
titleLabel.text = merchantDetails?._admin_name
dateLabel.text = item.redeemed ?? "" // expiration
// itemImage.load(link: couponSetData?.img_preview ?? "", placeholder: UIImage(), cache: URLCache())
// titleLabel.text = couponSetData?.name ?? ""
let priceFloat = Float(round(100 * (Float(couponSetData?.final_price ?? 0.0) )) / 100)
var priceString = "0"
priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil)
priceLabel.text = priceString + "€"
subtitleLabel.text = "Έκπτωτικό κουπόνι"
// subtitleLabel.text = couponSetData?.short_description ?? ""
// OR
// let htmlText = couponSetData?.inner_text ?? ""
// subtitleLabel.text = htmlText.htmlToString
}
func configureCell(item: swiftApi.CouponItemModel, isMarket: Bool) {
// COUPONSET: desc, img_preview, name, terms, merchant_uuid
// COUPON: coupon, expiration, discount, status
// MERCHANT: _img_preview,_admin_name
let merchantList:Array<swiftApi.MerchantModel> = swiftApi().getMerchantList()
// let couponSetData: swiftApi.CouponSetItemModel? = item.couponset_data
titleLabel.text = ""
// for merchant in merchantList {
// if (merchant._uuid == item.merchant_uuid) {
// // itemImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache())
// self.postImageURL = merchant._img_preview
// titleLabel.text = merchant._admin_name
// break;
// }
// }
let merchantDetails: swiftApi.MerchantModel? = item.merchant_details
self.postImageURL = merchantDetails?._img_preview
titleLabel.text = merchantDetails?._admin_name
// titleLabel.text = item.name
// self.postImageURL = item.image
dateLabel.text = item.redeemed ?? ""
let priceFloat = Float(round(100 * (Float(item.discount ?? "0.0") ?? 0.0 )) / 100)
var priceString = "0"
priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil)
priceLabel.text = priceString + "€"
subtitleLabel.text = "Έκπτωτικό κουπόνι"
// subtitleLabel.text = couponSetData?.short_description ?? ""
// OR
// let htmlText = couponSetData?.inner_text ?? ""
// subtitleLabel.text = htmlText.htmlToString
}
}