Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_sdk_framework
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Manos Chorianopoulos
2024-10-30 15:45:01 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
87374c2f89efaf8b637d1a36881a933336ed5336
87374c2f
1 parent
0e9efb5e
SM CouponsTableViewCell image fix
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
3 deletions
SwiftWarplyFramework/SwiftWarplyFramework/CouponsTableViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework/UnifiedCouponsViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/CouponsTableViewCell.swift
View file @
87374c2
...
...
@@ -20,6 +20,7 @@ import UIKit
@IBOutlet
weak
var
expirationRedImage
:
UIImageView
!
@IBOutlet
weak
var
expirationRedLabel
:
UILabel
!
let
smCouponsetsList
=
swiftApi
()
.
getCouponSetsDealsList
()
// Variables for the view, image, and button
var
selectView
:
UIView
!
...
...
@@ -199,6 +200,14 @@ import UIKit
// COUPON: coupon, expiration, discount, status
// MERCHANT: _img_preview,_admin_name
var
couponSetData
:
swiftApi
.
CouponSetItemModel
?
for
item
in
smCouponsetsList
{
if
(
item
.
uuid
==
coupon
.
couponset_uuid
)
{
couponSetData
=
item
break
;
}
}
// // Add shadow
contentView
.
layer
.
shadowColor
=
UIColor
(
red
:
0.00
,
green
:
0.00
,
blue
:
0.00
,
alpha
:
0.2
)
.
cgColor
contentView
.
layer
.
shadowOffset
=
CGSize
(
width
:
0.0
,
height
:
1.0
)
...
...
@@ -306,12 +315,14 @@ import UIKit
for
merchant
in
merchantList
{
if
(
merchant
.
_uuid
==
coupon
.
merchant_uuid
)
{
// couponImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache())
self
.
postImageURL
=
merchant
.
_img_preview
//
self.postImageURL = merchant._img_preview
nameLabel
.
text
=
merchant
.
_admin_name
break
;
}
}
self
.
postImageURL
=
couponSetData
?
.
img_preview
// let priceFloat = Float(round(100 * (Float(coupon.discount ?? "0.0") ?? 0.0 )) / 100)
// var priceString = "0"
// priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil)
...
...
@@ -325,6 +336,50 @@ import UIKit
}
func
configureCell
(
coupon
:
swiftApi
.
CouponItemModel
,
isSMCoupon
:
Bool
)
{
// COUPONSET: desc, img_preview, name, terms, merchant_uuid, discount_type, final_price
// COUPON: coupon, expiration, discount, status
// MERCHANT: _img_preview,_admin_name
// Add shadow
self
.
layer
.
shadowColor
=
UIColor
(
red
:
0.00
,
green
:
0.00
,
blue
:
0.00
,
alpha
:
0.2
)
.
cgColor
self
.
layer
.
shadowOffset
=
CGSize
(
width
:
0.0
,
height
:
1.0
)
self
.
layer
.
shadowOpacity
=
1.0
self
.
layer
.
shadowRadius
=
1.0
let
merchantList
:
Array
<
swiftApi
.
MerchantModel
>
=
swiftApi
()
.
getMerchantList
()
let
couponSetData
:
swiftApi
.
CouponSetItemModel
?
=
coupon
.
couponset_data
nameLabel
.
text
=
""
// for merchant in merchantList {
// // if (merchant._uuid == couponSetData?.merchant_uuid) {
// if (merchant._uuid == coupon.merchant_uuid) {
// // couponImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache())
// self.postImageURL = merchant._img_preview
// nameLabel.text = merchant._admin_name
// break;
// }
// }
let
merchantDetails
:
swiftApi
.
MerchantModel
?
=
coupon
.
merchant_details
self
.
postImageURL
=
couponSetData
?
.
img_preview
nameLabel
.
text
=
merchantDetails
?
.
_admin_name
// couponImage.load(link: couponSetData?.img_preview ?? "", placeholder: UIImage(), cache: URLCache())
// nameLabel.text = couponSetData?.name ?? ""
let
discount
=
couponSetData
?
.
discount_type
==
"value"
?
((
coupon
.
discount
??
""
)
+
"€"
)
:
couponSetData
?
.
discount_type
==
"percentage"
?
((
coupon
.
discount
??
""
)
+
"%"
)
:
couponSetData
?
.
discount_type
==
"plus_one"
?
"1+1"
:
((
coupon
.
discount
??
""
)
+
"€"
)
dicountLabel
.
text
=
discount
// let htmlText = couponSetData?.inner_text ?? ""
// discriptionLabel.text = htmlText.htmlToString
discriptionLabel
.
text
=
couponSetData
?
.
inner_text
??
""
expirationLabel
.
text
=
"Ισχύει έως "
+
(
coupon
.
expiration
??
""
)
}
// Configure the cell with visibility of the selectView, a selected state, and select Button Action
func
showSelectButton
(
isSelectViewVisible
:
Bool
,
isSelected
:
Bool
,
buttonAction
:
@escaping
()
->
Void
)
{
self
.
isSelectViewVisible
=
isSelectViewVisible
...
...
SwiftWarplyFramework/SwiftWarplyFramework/UnifiedCouponsViewController.swift
View file @
87374c2
...
...
@@ -37,7 +37,7 @@ import SwiftEventBus
DispatchQueue
.
main
.
async
{
self
.
unifiedCoupons
=
swiftApi
()
.
getUnifiedCouponList
()
//
self.tableView.reloadData()
//
self.tableView.reloadData()
// Reload the Unified Coupons section only
self
.
tableView
.
reloadSections
(
IndexSet
(
integer
:
0
),
with
:
.
automatic
)
...
...
@@ -307,7 +307,7 @@ extension UnifiedCouponsViewController: UITableViewDelegate, UITableViewDataSour
let
isCouponSelected
=
self
.
smCouponsSelected
.
contains
{
$0
.
coupon
==
currentCoupon
.
coupon
}
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"CouponsTableViewCellId"
,
for
:
indexPath
)
as!
CouponsTableViewCell
cell
.
configureCell
(
coupon
:
smCoupons
[
indexPath
.
row
])
cell
.
configureCell
(
coupon
:
smCoupons
[
indexPath
.
row
]
,
isSMCoupon
:
true
)
cell
.
showSelectButton
(
isSelectViewVisible
:
true
,
isSelected
:
isCouponSelected
)
{
self
.
handleSelectCouponAction
(
indexPath
:
indexPath
)
}
...
...
Please
register
or
login
to post a comment