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
2023-04-04 12:05:01 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2f6119d06d16e41d6974700dd2456e35ae5f49c4
2f6119d0
1 parent
e1c4add1
refactor WalletVC v1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
414 additions
and
7 deletions
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
SwiftWarplyFramework/SwiftWarplyFramework/ActiveCodeTableViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework/Main.storyboard
SwiftWarplyFramework/SwiftWarplyFramework/UnifiedCouponsTableViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework/WalletViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
2f6119d
No preview for this file type
SwiftWarplyFramework/SwiftWarplyFramework/ActiveCodeTableViewCell.swift
View file @
2f6119d
...
...
@@ -8,10 +8,172 @@
import
UIKit
class
ActiveCodeTableViewCell
:
UITableViewCell
{
@IBOutlet
weak
var
activeCodeView
:
UIView
!
@IBOutlet
weak
var
activeCodeViewHeight
:
NSLayoutConstraint
!
@IBOutlet
weak
var
activeCodesCountLabel
:
UILabel
!
@IBOutlet
weak
var
activeCodeLabel
:
UILabel
!
@IBOutlet
weak
var
activeCodeExpirationLabel
:
UILabel
!
@IBOutlet
weak
var
activeCodeImage
:
UIImageView
!
@IBOutlet
weak
var
activeCodeScrollView
:
UIScrollView
!
@IBOutlet
weak
var
activeCodeScrollViewHeight
:
NSLayoutConstraint
!
@IBOutlet
weak
var
activeCodeContentView
:
UIView
!
@IBOutlet
weak
var
activeCodeContentViewHeight
:
NSLayoutConstraint
!
public
var
dfyCoupons
:
Array
<
swiftApi
.
ActiveDFYCouponModel
>
=
swiftApi
()
.
getActiveDFYCoupons
()
override
func
awakeFromNib
()
{
super
.
awakeFromNib
()
// Initialization code
// TODO: DELETE ===>
// let coupon = swiftApi.ActiveDFYCouponModel()
// coupon._value = "12"
// // coupon._date = "2022-12-05 01:55:01"
// coupon._date = "2022-10-26 23:59:01"
// coupon._code = "123456789"
// let coupon2 = swiftApi.ActiveDFYCouponModel()
// coupon2._value = "23"
// coupon2._date = "2022-11-05 01:55"
// coupon2._code = "234567891"
// let coupon3 = swiftApi.ActiveDFYCouponModel()
// coupon3._value = "34"
// coupon3._date = "2022-07-01 01:55"
// coupon3._code = "345678912"
// let couponsArray: Array<swiftApi.ActiveDFYCouponModel> = [coupon, coupon2, coupon3, coupon3, coupon3]
// swiftApi().setActiveDFYCoupons(dfyCoupons: couponsArray)
// dfyCoupons = swiftApi().getActiveDFYCoupons()
// TODO: DELETE <===
activeCodeView
.
layer
.
cornerRadius
=
5.0
activeCodeView
.
layer
.
shadowColor
=
UIColor
(
red
:
0.00
,
green
:
0.00
,
blue
:
0.00
,
alpha
:
0.16
)
.
cgColor
activeCodeView
.
layer
.
shadowOffset
=
CGSize
(
width
:
0.0
,
height
:
0.0
)
activeCodeView
.
layer
.
shadowOpacity
=
1.0
activeCodeView
.
layer
.
shadowRadius
=
6.0
activeCodeImage
.
image
=
UIImage
(
named
:
"active_code_logo"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
if
(
dfyCoupons
.
count
>
0
)
{
if
(
dfyCoupons
.
count
==
1
)
{
let
dateFormatter
=
DateFormatter
()
dateFormatter
.
dateFormat
=
"yyyy-MM-dd HH:mm:ss"
// dateFormatter.dateFormat = "yyyy-MM-dd HH:mm"
// sort dfyCoupons by date
dfyCoupons
.
sort
(
by
:
{
let
date1
=
dateFormatter
.
date
(
from
:
$0
.
_date
)
let
date2
=
dateFormatter
.
date
(
from
:
$1
.
_date
)
if
((
date1
!=
nil
)
&&
(
date2
!=
nil
))
{
return
date1
!.
compare
(
date2
!
)
==
.
orderedAscending
}
else
{
return
false
}
})
// Get days from now of the most recet coupon
var
daysFromNow
=
""
let
calendar
=
Calendar
.
current
// Replace the hour (time) of both dates with 00:00
let
date1
=
calendar
.
startOfDay
(
for
:
Date
())
if
let
date2
=
dateFormatter
.
date
(
from
:
dfyCoupons
[
0
]
.
_date
)
{
let
components
=
calendar
.
dateComponents
([
.
day
],
from
:
date1
,
to
:
date2
)
daysFromNow
=
(
components
.
day
)
!=
nil
?
String
((
components
.
day
??
0
)
+
1
)
:
""
}
activeCodesCountLabel
.
text
=
"Ενεργός κωδικός:"
// activeCodeLabel.text = dfyCoupons[0]._code
let
newLabel
=
CopyableLabel
()
newLabel
.
text
=
String
(
dfyCoupons
[
0
]
.
_code
)
newLabel
.
font
=
UIFont
(
name
:
"PFSquareSansPro-Bold"
,
size
:
19
)
newLabel
.
textColor
=
UIColor
(
rgb
:
0x3C5365
)
newLabel
.
frame
.
size
.
width
=
newLabel
.
intrinsicContentSize
.
width
newLabel
.
frame
.
size
.
height
=
newLabel
.
intrinsicContentSize
.
height
// tagHeight
activeCodeContentView
.
addSubview
(
newLabel
)
// set the btn frame origin
newLabel
.
frame
.
origin
.
x
=
0
newLabel
.
frame
.
origin
.
y
=
0
let
scrollHeight
=
newLabel
.
intrinsicContentSize
.
height
activeCodeContentViewHeight
.
constant
=
scrollHeight
activeCodeScrollViewHeight
.
constant
=
scrollHeight
activeCodeExpirationLabel
.
isHidden
=
false
if
(
daysFromNow
==
"1"
)
{
activeCodeExpirationLabel
.
text
=
"Λήγει σε "
+
daysFromNow
+
" ημέρα"
}
else
{
activeCodeExpirationLabel
.
text
=
"Λήγει σε "
+
daysFromNow
+
" ημέρες"
}
}
else
{
var
tagHeight
:
CGFloat
=
30
let
tagPadding
:
CGFloat
=
0
let
tagSpacingX
:
CGFloat
=
0
let
tagSpacingY
:
CGFloat
=
2
let
containerWidth
=
activeCodeContentView
.
frame
.
size
.
width
var
currentOriginX
:
CGFloat
=
0
var
currentOriginY
:
CGFloat
=
0
// var couponCodesString = ""
for
(
index
,
item
)
in
dfyCoupons
.
enumerated
()
{
let
newLabel
=
CopyableLabel
()
newLabel
.
font
=
UIFont
(
name
:
"PFSquareSansPro-Bold"
,
size
:
19
)
newLabel
.
textColor
=
UIColor
(
rgb
:
0x3C5365
)
if
(
index
==
(
dfyCoupons
.
endIndex
-
1
))
{
// couponCodesString += String(item._code)
newLabel
.
text
=
String
(
item
.
_code
)
}
else
{
// couponCodesString += String(item._code) + ", "
newLabel
.
text
=
String
(
item
.
_code
)
+
", "
}
newLabel
.
frame
.
size
.
width
=
newLabel
.
intrinsicContentSize
.
width
+
tagPadding
newLabel
.
frame
.
size
.
height
=
newLabel
.
intrinsicContentSize
.
height
// tagHeight
tagHeight
=
newLabel
.
intrinsicContentSize
.
height
activeCodeContentView
.
addSubview
(
newLabel
)
// if current X + label width will be greater than container view width
// "move to next row"
if
currentOriginX
+
newLabel
.
frame
.
width
>
containerWidth
{
currentOriginX
=
0
currentOriginY
+=
tagHeight
+
tagSpacingY
}
// set the btn frame origin
newLabel
.
frame
.
origin
.
x
=
currentOriginX
newLabel
.
frame
.
origin
.
y
=
currentOriginY
// increment current X by btn width + spacing
currentOriginX
+=
newLabel
.
frame
.
width
+
tagSpacingX
}
activeCodesCountLabel
.
text
=
String
(
dfyCoupons
.
count
)
+
" Ενεργοί κωδικοί:"
// activeCodeLabel.text = couponCodesString
activeCodeExpirationLabel
.
isHidden
=
true
// update container view height
activeCodeContentViewHeight
.
constant
=
currentOriginY
+
tagHeight
if
((
currentOriginY
+
tagHeight
)
<=
(
2
*
tagHeight
+
tagSpacingY
))
{
activeCodeScrollViewHeight
.
constant
=
currentOriginY
+
tagHeight
}
else
{
activeCodeScrollViewHeight
.
constant
=
2
*
tagHeight
+
tagSpacingY
}
}
}
else
{
activeCodeLabel
.
text
=
"-"
activeCodeExpirationLabel
.
text
=
""
activeCodeView
.
isHidden
=
true
activeCodeViewHeight
.
constant
=
0
}
}
override
func
setSelected
(
_
selected
:
Bool
,
animated
:
Bool
)
{
...
...
SwiftWarplyFramework/SwiftWarplyFramework/Main.storyboard
View file @
2f6119d
This diff is collapsed. Click to expand it.
SwiftWarplyFramework/SwiftWarplyFramework/UnifiedCouponsTableViewCell.swift
View file @
2f6119d
...
...
@@ -5,19 +5,91 @@
// Created by Manos Chorianopoulos on 3/4/23.
//
import
Foundation
import
UIKit
class
UnifiedCouponsTableViewCell
:
UITableViewCell
{
@IBOutlet
weak
var
couponBgImage
:
UIImageView
!
@IBOutlet
weak
var
couponImage
:
UIImageView
!
@IBOutlet
weak
var
borderView
:
UIView
!
@IBOutlet
weak
var
nameLabel
:
UILabel
!
@IBOutlet
weak
var
dicountLabel
:
UILabel
!
@IBOutlet
weak
var
discriptionLabel
:
UILabel
!
@IBOutlet
weak
var
expirationLabel
:
UILabel
!
override
func
awakeFromNib
()
{
var
postImageURL
:
String
?
{
didSet
{
if
let
url
=
postImageURL
{
self
.
couponImage
.
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
.
couponImage
.
image
=
image
}
}
}
else
{
self
.
couponImage
.
image
=
nil
}
}
}
public
override
func
awakeFromNib
()
{
super
.
awakeFromNib
()
// Initialization code
couponBgImage
.
image
=
UIImage
(
named
:
"coupon_bg"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
borderView
.
addDashedBorderVertical
(
color
:
UIColor
(
red
:
0.44
,
green
:
0.44
,
blue
:
0.44
,
alpha
:
1.00
),
width
:
1.0
,
height
:
110.0
)
}
override
func
setSelected
(
_
selected
:
Bool
,
animated
:
Bool
)
{
public
override
func
setSelected
(
_
selected
:
Bool
,
animated
:
Bool
)
{
super
.
setSelected
(
selected
,
animated
:
animated
)
// Configure the view for the selected state
}
public
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
//set the values for top,left,bottom,right margins
let
margins
=
UIEdgeInsets
(
top
:
0
,
left
:
0
,
bottom
:
8
,
right
:
0
)
contentView
.
frame
=
contentView
.
frame
.
inset
(
by
:
margins
)
}
func
configureCell
(
coupon
:
swiftApi
.
CouponItemModel
)
{
// COUPONSET: desc, img_preview, name, terms, merchant_uuid, discount_type, final_price
// COUPON: coupon, expiration, discount, status
// MERCHANT: _img_preview,_admin_name
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
)
{
// couponImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache())
self
.
postImageURL
=
merchant
.
_img_preview
nameLabel
.
text
=
merchant
.
_admin_name
break
;
}
}
// 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
??
""
)
}
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/WalletViewController.swift
View file @
2f6119d
...
...
@@ -44,11 +44,23 @@ import SwiftEventBus
@IBOutlet
weak
var
activeCodeScrollViewHeight
:
NSLayoutConstraint
!
@IBOutlet
weak
var
activeCodeContentView
:
UIView
!
@IBOutlet
weak
var
activeCodeContentViewHeight
:
NSLayoutConstraint
!
@IBOutlet
weak
var
rewardsView
:
UIView
!
@IBOutlet
weak
var
rewardsLabel
:
UILabel
!
@IBOutlet
weak
var
sumBadgeImage
:
UIImageView
!
@IBOutlet
weak
var
sumBadgeLabel
:
UILabel
!
@IBOutlet
weak
var
dfyBadgeImage
:
UIImageView
!
@IBOutlet
weak
var
dfyBadgeLabel
:
UILabel
!
@IBOutlet
weak
var
couponBadgeImage
:
UIImageView
!
@IBOutlet
weak
var
couponBadgeLabel
:
UILabel
!
@IBOutlet
weak
var
marketBadgeImage
:
UIImageView
!
@IBOutlet
weak
var
marketBadgeLabel
:
UILabel
!
public
var
coupons
:
Array
<
swiftApi
.
CouponItemModel
>
=
swiftApi
()
.
getCouponList
()
public
var
dfyCoupons
:
Array
<
swiftApi
.
ActiveDFYCouponModel
>
=
swiftApi
()
.
getActiveDFYCoupons
()
public
var
loyaltyBadge
:
swiftApi
.
LoyaltyBadgeModel
=
swiftApi
()
.
getLoyaltyBadge
()
public
var
profile
:
swiftApi
.
ProfileModel
?
=
swiftApi
()
.
getConsumer
()
// TODO: Add correct unifiedCoupons
public
var
unifiedCoupons
:
Array
<
swiftApi
.
CouponItemModel
>
=
swiftApi
()
.
getCouponList
()
var
timerWallet
:
DispatchSourceTimer
?
var
seconds
:
Int
=
0
...
...
@@ -58,6 +70,30 @@ import SwiftEventBus
self
.
hidesBottomBarWhenPushed
=
true
// TODO: DELETE ===>
// let coupon = swiftApi.ActiveDFYCouponModel()
// coupon._value = "12"
// // coupon._date = "2022-12-05 01:55:01"
// coupon._date = "2022-10-26 23:59:01"
// coupon._code = "123456789"
// let coupon2 = swiftApi.ActiveDFYCouponModel()
// coupon2._value = "23"
// coupon2._date = "2022-11-05 01:55"
// coupon2._code = "234567891"
// let coupon3 = swiftApi.ActiveDFYCouponModel()
// coupon3._value = "34"
// coupon3._date = "2022-07-01 01:55"
// coupon3._code = "345678912"
// let couponsArray: Array<swiftApi.ActiveDFYCouponModel> = [coupon, coupon2, coupon3, coupon3, coupon3]
// swiftApi().setActiveDFYCoupons(dfyCoupons: couponsArray)
// dfyCoupons = swiftApi().getActiveDFYCoupons()
// TODO: DELETE <===
setBackButton
()
setNavigationTitle
(
"My Rewards"
)
...
...
@@ -341,7 +377,9 @@ import SwiftEventBus
emptyImage
.
image
=
UIImage
(
named
:
"ic_empty_wallet"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
emptyLabel
.
text
=
"Δεν έχεις κάποιον ενεργό κωδικό ή κουπόνι! Μπες τώρα στην ενότητα COSMOTE For You και βρες αποκλειστικές προσφορές!"
if
(
totalCouponValue
==
0.0
&&
loyaltyBadge
.
_couponCount
==
0
&&
dfyCoupons
.
count
==
0
&&
coupons
.
count
==
0
)
{
// TODO: FIX emptyView check
// if (totalCouponValue == 0.0 && loyaltyBadge._couponCount == 0 && dfyCoupons.count == 0 && coupons.count == 0) {
if
(
totalCouponValue
==
0.0
&&
loyaltyBadge
.
_couponCount
==
0
&&
dfyCoupons
.
count
==
0
&&
coupons
.
count
==
0
&&
unifiedCoupons
.
count
==
0
)
{
emptyView
.
isHidden
=
false
}
else
{
emptyView
.
isHidden
=
true
...
...
@@ -523,28 +561,162 @@ import SwiftEventBus
extension
WalletViewController
:
UITableViewDelegate
,
UITableViewDataSource
{
public
func
numberOfSections
(
in
tableView
:
UITableView
)
->
Int
{
return
1
return
3
}
public
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
if
(
section
==
0
)
{
// TODO: Dynamic
return
3
// return self.unifiedCoupons.count
}
else
if
(
section
==
1
)
{
return
1
}
return
self
.
coupons
.
count
}
public
func
tableView
(
_
tableView
:
UITableView
,
heightForRowAt
indexPath
:
IndexPath
)
->
CGFloat
{
if
(
indexPath
.
section
==
0
)
{
if
(
self
.
unifiedCoupons
.
count
>
0
)
{
return
120.0
+
8.0
// return UITableViewAutomaticDimension
}
else
{
return
0.0
}
}
else
if
(
indexPath
.
section
==
1
)
{
// TODO: Uncomment
if
(
self
.
dfyCoupons
.
count
>
0
)
{
return
UITableView
.
automaticDimension
}
else
{
return
0.0
}
}
else
{
if
(
self
.
coupons
.
count
>
0
)
{
return
120.0
+
8.0
}
else
{
return
0.0
}
}
}
public
func
tableView
(
_
tableView
:
UITableView
,
viewForHeaderInSection
section
:
Int
)
->
UIView
?
{
if
(
section
==
0
)
{
let
view
=
UIView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
tableView
.
frame
.
width
,
height
:
75
))
view
.
backgroundColor
=
.
clear
let
titleLabel
=
UILabel
(
frame
:
CGRect
(
x
:
20
,
y
:
40
,
width
:
view
.
frame
.
width
-
40
,
height
:
21
))
titleLabel
.
font
=
UIFont
(
name
:
"PFSquareSansPro-Medium"
,
size
:
21
)
titleLabel
.
textColor
=
UIColor
(
rgb
:
0xFFFFFF
)
titleLabel
.
text
=
"COSMOTE SuperMarket Deals"
view
.
addSubview
(
titleLabel
)
return
view
}
else
if
(
section
==
1
)
{
let
view
=
UIView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
tableView
.
frame
.
width
,
height
:
68
))
view
.
backgroundColor
=
.
clear
let
imageView
=
UIImageView
(
frame
:
CGRect
(
x
:
20
,
y
:
20
,
width
:
view
.
frame
.
width
/
3.5
,
height
:
38
))
imageView
.
contentMode
=
.
scaleAspectFit
if
let
dfyHeaderImage
=
UIImage
(
named
:
"dfy_logo_white"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
{
imageView
.
image
=
dfyHeaderImage
}
view
.
addSubview
(
imageView
)
return
view
}
else
{
// let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 71))
let
view
=
UIView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
tableView
.
frame
.
width
,
height
:
65
))
view
.
backgroundColor
=
.
clear
// let titleLabel = UILabel(frame: CGRect(x: 20, y: 40, width: view.frame.width - 40, height: 21))
let
titleLabel
=
UILabel
(
frame
:
CGRect
(
x
:
20
,
y
:
30
,
width
:
view
.
frame
.
width
-
40
,
height
:
21
))
titleLabel
.
font
=
UIFont
(
name
:
"PFSquareSansPro-Medium"
,
size
:
21
)
titleLabel
.
textColor
=
UIColor
(
rgb
:
0xFFFFFF
)
titleLabel
.
text
=
"Τα δώρα μου"
view
.
addSubview
(
titleLabel
)
return
view
}
}
public
func
tableView
(
_
tableView
:
UITableView
,
heightForHeaderInSection
section
:
Int
)
->
CGFloat
{
if
(
section
==
0
)
{
if
(
self
.
unifiedCoupons
.
count
>
0
)
{
return
75.0
}
else
{
return
0.0
}
}
else
if
(
section
==
1
)
{
if
(
self
.
dfyCoupons
.
count
>
0
)
{
return
68.0
}
else
{
return
0.0
}
}
else
{
if
(
self
.
coupons
.
count
>
0
)
{
return
65.0
}
else
{
return
0.0
}
}
}
public
func
tableView
(
_
tableView
:
UITableView
,
heightForFooterInSection
section
:
Int
)
->
CGFloat
{
// return CGFloat.leastNormalMagnitude
return
0.0
}
public
func
tableView
(
_
tableView
:
UITableView
,
viewForFooterInSection
section
:
Int
)
->
UIView
?
{
return
nil
}
public
func
tableView
(
_
tableView
:
UITableView
,
cellForRowAt
indexPath
:
IndexPath
)
->
UITableViewCell
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"CouponsTableViewCellId"
,
for
:
indexPath
)
as!
CouponsTableViewCell
if
(
indexPath
.
section
==
0
)
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"UnifiedCouponsTableViewCellId"
,
for
:
indexPath
)
as!
UnifiedCouponsTableViewCell
cell
.
configureCell
(
coupon
:
coupons
[
indexPath
.
row
])
return
cell
}
else
if
(
indexPath
.
section
==
1
)
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"ActiveCodeTableViewCellId"
,
for
:
indexPath
)
as!
ActiveCodeTableViewCell
// cell.configureCell(coupon: coupons[indexPath.row])
return
cell
}
else
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"CouponsTableViewCellId"
,
for
:
indexPath
)
as!
CouponsTableViewCell
cell
.
configureCell
(
coupon
:
coupons
[
indexPath
.
row
])
return
cell
}
}
public
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
if
(
indexPath
.
section
==
0
)
{
// TODO: open unified CouponBarcodeViewController
// let couponSetData: swiftApi.CouponSetItemModel? = coupons[indexPath.row].couponset_data
// let couponName = couponSetData?.name ?? ""
// swiftApi().logTrackersEvent("click", ("Coupon:" + couponName))
//
// let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
// let vc = storyboard.instantiateViewController(withIdentifier: "CouponBarcodeViewController") as! SwiftWarplyFramework.CouponBarcodeViewController
// vc.coupon = coupons[indexPath.row]
// vc.isFromWallet = true
// self.navigationController?.pushViewController(vc, animated: true)
}
else
if
(
indexPath
.
section
==
1
)
{
print
(
"Active DFY coupon banner Tapped!"
)
swiftApi
()
.
logTrackersEvent
(
"click"
,
(
"LoyaltyWalletScreen:"
+
"ActiveDealsBanner"
))
let
couponDetails
=
swiftApi
.
ActiveDFYCouponEventModel
()
couponDetails
.
_isPressed
=
true
SwiftEventBus
.
post
(
"dfy_coupon_details"
,
sender
:
couponDetails
)
}
else
{
let
couponSetData
:
swiftApi
.
CouponSetItemModel
?
=
coupons
[
indexPath
.
row
]
.
couponset_data
let
couponName
=
couponSetData
?
.
name
??
""
swiftApi
()
.
logTrackersEvent
(
"click"
,
(
"Coupon:"
+
couponName
))
...
...
@@ -554,6 +726,7 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
vc
.
coupon
=
coupons
[
indexPath
.
row
]
vc
.
isFromWallet
=
true
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
}
...
...
Please
register
or
login
to post a comment