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-02-28 12:23:00 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
34c6528990569a87e2db7ce05ec11ffd1bf84ea9
34c65289
1 parent
91c94f3b
redesign WalletVC, LoyaltyHistoryVC
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
222 additions
and
58 deletions
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
SwiftWarplyFramework/SwiftWarplyFramework/CampaignViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/CouponsViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/LoyaltyHistoryViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/Main.storyboard
SwiftWarplyFramework/SwiftWarplyFramework/WalletActiveCouponsTableViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework/WalletEmptyViewTableViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework/WalletHistoryBannerTableViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework/WalletQuestionnaireBannerTableViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework/WalletSpinnerTableViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework/WalletViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
34c6528
No preview for this file type
SwiftWarplyFramework/SwiftWarplyFramework/CampaignViewController.swift
View file @
34c6528
...
...
@@ -695,10 +695,11 @@ var timer2: DispatchSourceTimer?
}
else
if
(
eventArray
[
1
]
==
"loyaltyWallet"
)
{
// event:loyaltyWallet
SwiftEventBus
.
post
(
"refresh_vouchers"
)
SwiftEventBus
.
post
(
"open_my_rewards"
)
let
storyboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
let
vc
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"WalletViewController"
)
as!
SwiftWarplyFramework
.
WalletViewController
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
//
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
//
let vc = storyboard.instantiateViewController(withIdentifier: "WalletViewController") as! SwiftWarplyFramework.WalletViewController
//
self.navigationController?.pushViewController(vc, animated: true)
}
else
if
(
eventArray
[
1
]
==
"cancel_unified_success"
)
{
// event:cancel_unified_success
...
...
SwiftWarplyFramework/SwiftWarplyFramework/CouponsViewController.swift
View file @
34c6528
...
...
@@ -26,7 +26,8 @@ import SwiftEventBus
getCouponsRequest
()
setBackButton
()
setNavigationTitle
(
"GIFTS FOR YOU"
)
// setNavigationTitle("GIFTS FOR YOU")
setNavigationTitle
(
"FREE COUPONS"
)
// backgroundImage.image = UIImage(named: "coupons_scrollview_dark", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
...
...
SwiftWarplyFramework/SwiftWarplyFramework/LoyaltyHistoryViewController.swift
View file @
34c6528
...
...
@@ -74,7 +74,8 @@ import SwiftEventBus
}
}
setBackButton
()
// setBackButton()
setBackButton
(
"ic_close_3"
)
setNavigationTitle
(
"Ιστορικό"
)
// === images === //
...
...
@@ -95,7 +96,7 @@ import SwiftEventBus
historySectionView
.
layer
.
shadowColor
=
UIColor
(
red
:
0.00
,
green
:
0.00
,
blue
:
0.00
,
alpha
:
0.2
)
.
cgColor
historySectionView
.
layer
.
shadowOffset
=
CGSize
(
width
:
0.0
,
height
:
1.0
)
historySectionView
.
layer
.
shadowOpacity
=
1.0
historySectionView
.
layer
.
shadowRadius
=
1
.0
historySectionView
.
layer
.
shadowRadius
=
2
.0
}
...
...
@@ -205,7 +206,8 @@ import SwiftEventBus
dfyBannerParentView
.
backgroundColor
=
.
clear
dfyBannerInnerParentView
.
backgroundColor
=
.
white
dfyBannerInnerView
.
backgroundColor
=
UIColor
(
red
:
0.46
,
green
:
0.75
,
blue
:
0.45
,
alpha
:
0.05
)
// dfyBannerInnerView.backgroundColor = UIColor(red: 0.46, green: 0.75, blue: 0.45, alpha: 0.05)
dfyBannerInnerView
.
backgroundColor
=
.
white
dfyBannerInnerParentView
.
layer
.
cornerRadius
=
16.0
dfyBannerInnerView
.
layer
.
cornerRadius
=
16.0
// dfyBannerInnerView.layer.borderWidth = 1
...
...
@@ -214,7 +216,7 @@ import SwiftEventBus
dfyBannerParentView
.
layer
.
shadowColor
=
UIColor
(
red
:
0.00
,
green
:
0.00
,
blue
:
0.00
,
alpha
:
0.2
)
.
cgColor
dfyBannerParentView
.
layer
.
shadowOffset
=
CGSize
(
width
:
0.0
,
height
:
1.0
)
dfyBannerParentView
.
layer
.
shadowOpacity
=
1.0
dfyBannerParentView
.
layer
.
shadowRadius
=
1
.0
dfyBannerParentView
.
layer
.
shadowRadius
=
2
.0
let
totalCouponValueFixed
=
Float
(
round
(
100
*
totalCouponValue
)
/
100
)
var
totalCouponValueString
=
"0"
...
...
@@ -236,7 +238,8 @@ import SwiftEventBus
// === MARKET banner === //
marketBannerParentView
.
backgroundColor
=
.
clear
marketBannerInnerView
.
backgroundColor
=
UIColor
(
red
:
1.00
,
green
:
0.99
,
blue
:
0.97
,
alpha
:
1.00
)
// marketBannerInnerView.backgroundColor = UIColor(red: 1.00, green: 0.99, blue: 0.97, alpha: 1.00)
marketBannerInnerView
.
backgroundColor
=
.
white
marketBannerInnerView
.
layer
.
cornerRadius
=
16.0
// marketBannerInnerView.layer.borderWidth = 1
// marketBannerInnerView.layer.borderColor = UIColor(red: 0.90, green: 0.90, blue: 0.90, alpha: 1.00).cgColor
...
...
@@ -244,7 +247,7 @@ import SwiftEventBus
marketBannerParentView
.
layer
.
shadowColor
=
UIColor
(
red
:
0.00
,
green
:
0.00
,
blue
:
0.00
,
alpha
:
0.2
)
.
cgColor
marketBannerParentView
.
layer
.
shadowOffset
=
CGSize
(
width
:
0.0
,
height
:
1.0
)
marketBannerParentView
.
layer
.
shadowOpacity
=
1.0
marketBannerParentView
.
layer
.
shadowRadius
=
1
.0
marketBannerParentView
.
layer
.
shadowRadius
=
2
.0
let
marketDiscount
=
Float
(
round
(
100
*
unifiedCouponsDiscount
)
/
100
)
var
marketDiscountString
=
"0"
...
...
@@ -267,7 +270,8 @@ import SwiftEventBus
// === GFY banner === //
gfyBannerParentView
.
backgroundColor
=
.
clear
gfyBannerInnerView
.
backgroundColor
=
UIColor
(
red
:
0.96
,
green
:
0.97
,
blue
:
0.98
,
alpha
:
1.00
)
// gfyBannerInnerView.backgroundColor = UIColor(red: 0.96, green: 0.97, blue: 0.98, alpha: 1.00)
gfyBannerInnerView
.
backgroundColor
=
.
white
gfyBannerInnerView
.
layer
.
cornerRadius
=
16.0
// gfyBannerInnerView.layer.borderWidth = 1
// gfyBannerInnerView.layer.borderColor = UIColor(red: 0.90, green: 0.90, blue: 0.90, alpha: 1.00).cgColor
...
...
@@ -275,7 +279,7 @@ import SwiftEventBus
gfyBannerParentView
.
layer
.
shadowColor
=
UIColor
(
red
:
0.00
,
green
:
0.00
,
blue
:
0.00
,
alpha
:
0.2
)
.
cgColor
gfyBannerParentView
.
layer
.
shadowOffset
=
CGSize
(
width
:
0.0
,
height
:
1.0
)
gfyBannerParentView
.
layer
.
shadowOpacity
=
1.0
gfyBannerParentView
.
layer
.
shadowRadius
=
1
.0
gfyBannerParentView
.
layer
.
shadowRadius
=
2
.0
var
totalCouponDiscountString
=
"0"
totalCouponDiscountString
=
String
(
format
:
"%.2f"
,
totalCouponDiscount
)
.
replacingOccurrences
(
of
:
"."
,
with
:
","
,
options
:
.
literal
,
range
:
nil
)
...
...
@@ -283,7 +287,8 @@ import SwiftEventBus
let
gfyNormalText1
=
"Μέχρι τώρα έχεις όφελος "
let
gfyBoldText
=
totalCouponDiscountString
+
"€"
let
gfyNormalText2
=
" από τα GIFTS FOR YOU"
let
gfyNormalText2
=
" από τα FREE COUPONS"
// let gfyNormalText2 = " από τα GIFTS FOR YOU"
let
gfyAttributedString
=
NSMutableAttributedString
(
string
:
gfyNormalText1
,
attributes
:
attrRegular
)
let
gfyBoldString
=
NSMutableAttributedString
(
string
:
gfyBoldText
,
attributes
:
attrBold
)
...
...
SwiftWarplyFramework/SwiftWarplyFramework/Main.storyboard
View file @
34c6528
This diff could not be displayed because it is too large.
SwiftWarplyFramework/SwiftWarplyFramework/WalletActiveCouponsTableViewCell.swift
View file @
34c6528
...
...
@@ -33,14 +33,16 @@ import UIKit
// Initialization code
// DFY Banner
dfyViewParent
.
backgroundColor
=
UIColor
(
red
:
0.95
,
green
:
0.95
,
blue
:
0.95
,
alpha
:
1.00
)
// dfyViewParent.backgroundColor = UIColor(red: 0.95, green: 0.95, blue: 0.95, alpha: 1.00)
dfyViewParent
.
backgroundColor
=
.
white
dfyViewParent
.
layer
.
cornerRadius
=
16.0
dfyViewParent
.
layer
.
shadowColor
=
UIColor
(
red
:
0.00
,
green
:
0.00
,
blue
:
0.00
,
alpha
:
0.2
)
.
cgColor
dfyViewParent
.
layer
.
shadowOffset
=
CGSize
(
width
:
0.0
,
height
:
1.0
)
dfyViewParent
.
layer
.
shadowOpacity
=
1.0
dfyViewParent
.
layer
.
shadowRadius
=
1
.0
dfyViewParent
.
layer
.
shadowRadius
=
2
.0
dfyView
.
backgroundColor
=
UIColor
(
red
:
0.46
,
green
:
0.75
,
blue
:
0.45
,
alpha
:
0.05
)
// dfyView.backgroundColor = UIColor(red: 0.46, green: 0.75, blue: 0.45, alpha: 0.05)
dfyView
.
backgroundColor
=
.
white
dfyView
.
layer
.
cornerRadius
=
16.0
dfyImage
.
image
=
UIImage
(
named
:
"wallet_banner_dfy"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
...
...
@@ -51,12 +53,13 @@ import UIKit
dfyCountView
.
backgroundColor
=
UIColor
(
red
:
0.92
,
green
:
0.75
,
blue
:
0.41
,
alpha
:
1.00
)
// SM Banner
smView
.
backgroundColor
=
UIColor
(
red
:
1.00
,
green
:
0.99
,
blue
:
0.97
,
alpha
:
1.00
)
// smView.backgroundColor = UIColor(red: 1.00, green: 0.99, blue: 0.97, alpha: 1.00)
smView
.
backgroundColor
=
.
white
smView
.
layer
.
cornerRadius
=
16.0
smView
.
layer
.
shadowColor
=
UIColor
(
red
:
0.00
,
green
:
0.00
,
blue
:
0.00
,
alpha
:
0.2
)
.
cgColor
smView
.
layer
.
shadowOffset
=
CGSize
(
width
:
0.0
,
height
:
1.0
)
smView
.
layer
.
shadowOpacity
=
1.0
smView
.
layer
.
shadowRadius
=
1
.0
smView
.
layer
.
shadowRadius
=
2
.0
smImage
.
image
=
UIImage
(
named
:
"wallet_banner_sm"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
...
...
@@ -66,16 +69,19 @@ import UIKit
smCountView
.
backgroundColor
=
UIColor
(
red
:
0.92
,
green
:
0.75
,
blue
:
0.41
,
alpha
:
1.00
)
// GFY Banner
gfyView
.
backgroundColor
=
UIColor
(
red
:
0.96
,
green
:
0.97
,
blue
:
0.98
,
alpha
:
1.00
)
// gfyView.backgroundColor = UIColor(red: 0.96, green: 0.97, blue: 0.98, alpha: 1.00)
gfyView
.
backgroundColor
=
.
white
gfyView
.
layer
.
cornerRadius
=
16.0
gfyView
.
layer
.
shadowColor
=
UIColor
(
red
:
0.00
,
green
:
0.00
,
blue
:
0.00
,
alpha
:
0.2
)
.
cgColor
gfyView
.
layer
.
shadowOffset
=
CGSize
(
width
:
0.0
,
height
:
1.0
)
gfyView
.
layer
.
shadowOpacity
=
1.0
gfyView
.
layer
.
shadowRadius
=
1
.0
gfyView
.
layer
.
shadowRadius
=
2
.0
gfyImage
.
image
=
UIImage
(
named
:
"wallet_banner_gfy"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
gfyLabel
.
text
=
"GIFTS FOR YOU"
// gfyLabel.text = "GIFTS FOR YOU"
// gfyLabel.text = "Free coupons"
gfyLabel
.
text
=
"FREE COUPONS"
gfyCountView
.
layer
.
cornerRadius
=
4.0
gfyCountView
.
backgroundColor
=
UIColor
(
red
:
0.92
,
green
:
0.75
,
blue
:
0.41
,
alpha
:
1.00
)
...
...
SwiftWarplyFramework/SwiftWarplyFramework/WalletEmptyViewTableViewCell.swift
View file @
34c6528
...
...
@@ -8,10 +8,17 @@
import
UIKit
@objc
public
class
WalletEmptyViewTableViewCell
:
UITableViewCell
{
@IBOutlet
weak
var
emptyImage
:
UIImageView
!
@IBOutlet
weak
var
emptyLabel
:
UILabel
!
public
override
func
awakeFromNib
()
{
super
.
awakeFromNib
()
// Initialization code
emptyImage
.
image
=
UIImage
(
named
:
"ic_empty_wallet_3"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
// emptyLabel.text = "Δεν έχεις κάποιον ενεργό κωδικό ή κουπόνι! Μπες τώρα στην ενότητα COSMOTE For You και βρες αποκλειστικές προσφορές!"
emptyLabel
.
text
=
"Δεν έχεις ενεργό κωδικό ή κουπόνι!
\n
Μπες τώρα στην ενότητα COSMOTE For You και βρες αποκλειστικές προσφορές"
}
public
override
func
setSelected
(
_
selected
:
Bool
,
animated
:
Bool
)
{
...
...
SwiftWarplyFramework/SwiftWarplyFramework/WalletHistoryBannerTableViewCell.swift
View file @
34c6528
...
...
@@ -8,10 +8,31 @@
import
UIKit
@objc
public
class
WalletHistoryBannerTableViewCell
:
UITableViewCell
{
@IBOutlet
weak
var
bannerView
:
UIView
!
@IBOutlet
weak
var
bannerIconImage
:
UIImageView
!
@IBOutlet
weak
var
bannerLabel
:
UILabel
!
@IBOutlet
weak
var
bannerArrowImage
:
UIImageView
!
let
language
=
swiftApi
()
.
getLanguage
()
public
override
func
awakeFromNib
()
{
super
.
awakeFromNib
()
// Initialization code
bannerView
.
layer
.
cornerRadius
=
16.0
bannerView
.
layer
.
borderWidth
=
1
bannerView
.
layer
.
borderColor
=
UIColor
(
red
:
0.90
,
green
:
0.90
,
blue
:
0.90
,
alpha
:
1.00
)
.
cgColor
// Add shadow
bannerView
.
layer
.
shadowColor
=
UIColor
(
red
:
0.00
,
green
:
0.00
,
blue
:
0.00
,
alpha
:
0.2
)
.
cgColor
bannerView
.
layer
.
shadowOffset
=
CGSize
(
width
:
0.0
,
height
:
1.0
)
bannerView
.
layer
.
shadowOpacity
=
1.0
bannerView
.
layer
.
shadowRadius
=
1.0
bannerIconImage
.
image
=
UIImage
(
named
:
"wallet_history_blue"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
bannerArrowImage
.
image
=
UIImage
(
named
:
"arrow_right_black"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
bannerLabel
.
text
=
"Δες το ιστορικό σου"
}
public
override
func
setSelected
(
_
selected
:
Bool
,
animated
:
Bool
)
{
...
...
@@ -19,5 +40,5 @@ import UIKit
// Configure the view for the selected state
}
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/WalletQuestionnaireBannerTableViewCell.swift
View file @
34c6528
...
...
@@ -8,10 +8,29 @@
import
UIKit
@objc
public
class
WalletQuestionnaireBannerTableViewCell
:
UITableViewCell
{
@IBOutlet
weak
var
bannerView
:
UIView
!
@IBOutlet
weak
var
bannerIconImage
:
UIImageView
!
@IBOutlet
weak
var
bannerIconImageWidth
:
NSLayoutConstraint
!
@IBOutlet
weak
var
bannerLabel
:
UILabel
!
@IBOutlet
weak
var
bannerLabelLeftSpace
:
NSLayoutConstraint
!
@IBOutlet
weak
var
bannerArrowImage
:
UIImageView
!
public
override
func
awakeFromNib
()
{
super
.
awakeFromNib
()
// Initialization code
bannerView
.
layer
.
cornerRadius
=
16.0
bannerView
.
layer
.
borderWidth
=
1
bannerView
.
layer
.
borderColor
=
UIColor
(
red
:
0.90
,
green
:
0.90
,
blue
:
0.90
,
alpha
:
1.00
)
.
cgColor
// Add shadow
bannerView
.
layer
.
shadowColor
=
UIColor
(
red
:
0.00
,
green
:
0.00
,
blue
:
0.00
,
alpha
:
0.2
)
.
cgColor
bannerView
.
layer
.
shadowOffset
=
CGSize
(
width
:
0.0
,
height
:
1.0
)
bannerView
.
layer
.
shadowOpacity
=
1.0
bannerView
.
layer
.
shadowRadius
=
1.0
bannerIconImage
.
image
=
UIImage
(
named
:
"wallet_plus_blue"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
bannerArrowImage
.
image
=
UIImage
(
named
:
"arrow_right_black"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
}
public
override
func
setSelected
(
_
selected
:
Bool
,
animated
:
Bool
)
{
...
...
@@ -19,5 +38,24 @@ import UIKit
// Configure the view for the selected state
}
func
configureCell
()
{
let
userTag
=
swiftApi
()
.
getUserTag
()
// print("User tag: " + userTag)
if
(
userTag
!=
""
&&
userTag
!=
"undefined"
)
{
bannerLabel
.
text
=
userTag
bannerLabel
.
frame
.
size
.
width
=
bannerLabel
.
intrinsicContentSize
.
width
bannerIconImage
.
isHidden
=
true
bannerIconImageWidth
.
constant
=
CGFloat
(
0.0
)
bannerLabelLeftSpace
.
constant
=
CGFloat
(
0.0
)
}
else
{
bannerLabel
.
text
=
"Πρόσθεσε τις προτιμήσεις σου"
bannerLabel
.
frame
.
size
.
width
=
bannerLabel
.
intrinsicContentSize
.
width
bannerIconImage
.
isHidden
=
false
bannerIconImageWidth
.
constant
=
CGFloat
(
22.0
)
bannerLabelLeftSpace
.
constant
=
CGFloat
(
10.0
)
}
}
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/WalletSpinnerTableViewCell.swift
View file @
34c6528
...
...
@@ -14,7 +14,8 @@ import UIKit
super
.
awakeFromNib
()
// Initialization code
spinner
.
color
=
UIColor
(
red
:
0.05
,
green
:
0.65
,
blue
:
0.00
,
alpha
:
1.00
)
// spinner.color = UIColor(red: 0.05, green: 0.65, blue: 0.00, alpha: 1.00)
spinner
.
color
=
UIColor
(
red
:
0.00
,
green
:
0.65
,
blue
:
0.89
,
alpha
:
1.00
)
spinner
.
translatesAutoresizingMaskIntoConstraints
=
false
spinner
.
startAnimating
()
...
...
SwiftWarplyFramework/SwiftWarplyFramework/WalletViewController.swift
View file @
34c6528
...
...
@@ -80,6 +80,7 @@ import SwiftEventBus
var
forYouExpanded
:
Bool
=
false
;
var
showSpinner
:
Bool
=
false
;
var
showActiveCouponsBanners
:
Bool
=
false
;
var
showEmptyView
:
Bool
=
false
;
public
override
func
viewDidLoad
()
{
...
...
@@ -105,8 +106,8 @@ import SwiftEventBus
self
.
unifiedCoupons
=
swiftApi
()
.
getUnifiedCouponList
()
// TODO: Maybe add this
// TODO: Uncomment if discounts are shown again in wallet
//
self.matchOldSMCoupons()
//
self.updateMarketBadge()
self
.
matchOldSMCoupons
()
self
.
updateMarketBadge
()
self
.
handleSpinnerAndEmptyView
()
self
.
tableView
.
reloadData
()
}
...
...
@@ -161,8 +162,8 @@ import SwiftEventBus
// TODO: Uncomment when UnifiedCoupons will be shown again
// getCouponsSetsDealsRequest()
setBackButton
(
"ic_close_3"
)
setNavigationTitle
(
"My Rewards"
)
//
setBackButton("ic_close_3")
//
setNavigationTitle("My Rewards")
tableView
.
delegate
=
self
tableView
.
dataSource
=
self
...
...
@@ -494,8 +495,8 @@ import SwiftEventBus
emptyLabel
.
text
=
"Δεν έχεις κάποιον ενεργό κωδικό ή κουπόνι! Μπες τώρα στην ενότητα COSMOTE For You και βρες αποκλειστικές προσφορές!"
// TODO: Uncomment if discounts are shown again in wallet
//
matchOldSMCoupons()
//
updateMarketBadge()
matchOldSMCoupons
()
updateMarketBadge
()
// TODO: DELETE if emptyView is needed again
// emptyView.isHidden = true
...
...
@@ -558,10 +559,10 @@ import SwiftEventBus
// TODO: Uncomment when UnifiedCoupons will be shown again
self
.
unifiedCoupons
=
swiftApi
()
.
getUnifiedCouponList
()
// TODO: Maybe add this
//
self.matchOldSMCoupons()
self
.
matchOldSMCoupons
()
// <===
// TODO: Uncomment if discounts are shown again in wallet
//
self.updateMarketBadge()
self
.
updateMarketBadge
()
self
.
handleSpinnerAndEmptyView
()
self
.
tableView
.
reloadData
()
...
...
@@ -582,19 +583,25 @@ import SwiftEventBus
public
override
func
viewDidLayoutSubviews
()
{
super
.
viewDidLayoutSubviews
()
if
let
headerView
=
tableView
.
tableHeaderView
{
let
height
=
headerView
.
systemLayoutSizeFitting
(
UIView
.
layoutFittingCompressedSize
)
.
height
var
headerFrame
=
headerView
.
frame
//Comparison necessary to avoid infinite loop
if
height
!=
headerFrame
.
size
.
height
{
headerFrame
.
size
.
height
=
height
headerView
.
frame
=
headerFrame
tableView
.
tableHeaderView
=
headerView
}
}
// TODO: Uncomment if header is needed again
// if let headerView = tableView.tableHeaderView {
//
// let height = headerView.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).height
// var headerFrame = headerView.frame
//// let height = 0.0
//// var headerFrame = CGRect(x: 0,y: 0,width: 0,height: 0)
//
// //Comparison necessary to avoid infinite loop
// if height != headerFrame.size.height {
// headerFrame.size.height = height
// headerView.frame = headerFrame
// tableView.tableHeaderView = headerView
// }
// }
// TODO: DELETE if header is needed again
self
.
tableView
.
tableHeaderView
=
UIView
(
frame
:
CGRect
(
x
:
0.0
,
y
:
0.0
,
width
:
self
.
tableView
.
bounds
.
size
.
width
,
height
:
0.01
))
}
// MARK: - Functions
...
...
@@ -739,6 +746,7 @@ import SwiftEventBus
if
(
swiftApi
()
.
getShowVouchersBanner
()
==
""
)
{
self
.
emptyView
.
isHidden
=
true
self
.
emptyViewHeight
.
constant
=
0
self
.
showEmptyView
=
false
self
.
showSpinner
=
true
...
...
@@ -756,17 +764,21 @@ import SwiftEventBus
self
.
showActiveCouponsBanners
=
false
if
(
swiftApi
()
.
getShowVouchersBanner
()
==
"null"
)
{
self
.
emptyView
.
isHidden
=
false
self
.
emptyViewHeight
.
constant
=
self
.
emptyView
.
intrinsicContentSize
.
height
// TODO: UNCOMMENT if emptyView is needed again
// self.emptyView.isHidden = false
// self.emptyViewHeight.constant = self.emptyView.intrinsicContentSize.height
self
.
showEmptyView
=
true
}
else
{
self
.
emptyView
.
isHidden
=
true
self
.
emptyViewHeight
.
constant
=
0
self
.
showEmptyView
=
false
}
}
else
{
self
.
emptyView
.
isHidden
=
true
self
.
emptyViewHeight
.
constant
=
0
self
.
showEmptyView
=
false
self
.
showActiveCouponsBanners
=
true
}
...
...
@@ -1028,7 +1040,7 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
public
func
numberOfSections
(
in
tableView
:
UITableView
)
->
Int
{
// return 4
return
3
return
6
}
public
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
...
...
@@ -1060,12 +1072,27 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
return
0
}
}
else
if
(
section
==
1
)
{
return
1
}
else
if
(
section
==
2
)
{
let
sumRedeemed
=
totalCouponValue
+
totalCouponDiscount
+
unifiedCouponsDiscount
if
(
sumRedeemed
>
0.0
)
{
return
1
}
else
{
return
0
}
}
else
if
(
section
==
3
)
{
if
(
swiftApi
()
.
getShowVouchersBanner
()
==
"true"
||
swiftApi
()
.
getShowVouchersBanner
()
==
"false"
)
{
return
1
}
else
{
return
0
}
}
else
if
(
section
==
2
)
{
}
else
if
(
section
==
4
)
{
if
(
self
.
showEmptyView
==
true
)
{
return
1
}
else
{
return
0
}
}
else
if
(
section
==
5
)
{
if
(
self
.
showSpinner
==
true
)
{
return
1
}
else
{
...
...
@@ -1114,12 +1141,27 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
return
0.0
}
}
else
if
(
indexPath
.
section
==
1
)
{
return
UITableView
.
automaticDimension
}
else
if
(
indexPath
.
section
==
2
)
{
let
sumRedeemed
=
totalCouponValue
+
totalCouponDiscount
+
unifiedCouponsDiscount
if
(
sumRedeemed
>
0.0
)
{
return
UITableView
.
automaticDimension
}
else
{
return
0.0
}
}
else
if
(
indexPath
.
section
==
3
)
{
if
(
swiftApi
()
.
getShowVouchersBanner
()
==
"true"
||
swiftApi
()
.
getShowVouchersBanner
()
==
"false"
)
{
return
UITableView
.
automaticDimension
}
else
{
return
0.0
}
}
else
if
(
indexPath
.
section
==
2
)
{
}
else
if
(
indexPath
.
section
==
4
)
{
if
(
self
.
showEmptyView
==
true
)
{
return
UITableView
.
automaticDimension
}
else
{
return
0.0
}
}
else
if
(
indexPath
.
section
==
5
)
{
if
(
self
.
showSpinner
==
true
)
{
return
UITableView
.
automaticDimension
}
else
{
...
...
@@ -1200,9 +1242,10 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
view
.
backgroundColor
=
.
clear
let
titleLabel
=
UILabel
(
frame
:
CGRect
(
x
:
20
,
y
:
20
,
width
:
view
.
frame
.
width
-
40
,
height
:
25
))
titleLabel
.
font
=
UIFont
(
name
:
"PeridotPE-SBold"
,
size
:
21
)
// titleLabel.font = UIFont(name: "PeridotPE-SBold", size: 21)
titleLabel
.
font
=
UIFont
(
name
:
"BTCosmo-Bold"
,
size
:
19
)
titleLabel
.
textColor
=
UIColor
(
red
:
0.13
,
green
:
0.13
,
blue
:
0.13
,
alpha
:
1.00
)
titleLabel
.
text
=
"
Ενεργά κ
ουπόνια"
titleLabel
.
text
=
"
Κ
ουπόνια"
view
.
addSubview
(
titleLabel
)
return
view
...
...
@@ -1210,6 +1253,10 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
return
nil
}
}
else
if
(
section
==
1
)
{
return
nil
}
else
if
(
section
==
2
)
{
return
nil
}
else
if
(
section
==
3
)
{
// if (swiftApi().getShowVouchersBanner() == "true" || swiftApi().getShowVouchersBanner() == "false") {
// let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 70))
// view.backgroundColor = .clear
...
...
@@ -1227,7 +1274,9 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
// } else {
return
nil
// }
}
else
if
(
section
==
2
)
{
}
else
if
(
section
==
4
)
{
return
nil
}
else
if
(
section
==
5
)
{
return
nil
}
else
{
return
nil
...
...
@@ -1270,12 +1319,18 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
return
0.0
}
}
else
if
(
section
==
1
)
{
return
0.0
}
else
if
(
section
==
2
)
{
return
0.0
}
else
if
(
section
==
3
)
{
// if (swiftApi().getShowVouchersBanner() == "true" || swiftApi().getShowVouchersBanner() == "false") {
// return 70.0
// } else {
return
0.0
// }
}
else
if
(
section
==
2
)
{
}
else
if
(
section
==
4
)
{
return
0.0
}
else
if
(
section
==
5
)
{
return
0.0
}
else
{
return
0.0
...
...
@@ -1323,9 +1378,19 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
return
cell
}
else
if
(
indexPath
.
section
==
1
)
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"WalletQuestionnaireBannerTableViewCellId"
,
for
:
indexPath
)
as!
WalletQuestionnaireBannerTableViewCell
cell
.
configureCell
()
return
cell
}
else
if
(
indexPath
.
section
==
2
)
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"WalletHistoryBannerTableViewCellId"
,
for
:
indexPath
)
as!
WalletHistoryBannerTableViewCell
return
cell
}
else
if
(
indexPath
.
section
==
3
)
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"WalletVouchersBannerTableViewCellId"
,
for
:
indexPath
)
as!
WalletVouchersBannerTableViewCell
cell
.
configureCell
(
showSeparator
:
self
.
showActiveCouponsBanners
,
active
:
swiftApi
()
.
getShowVouchersBanner
()
==
"true"
)
return
cell
}
else
if
(
indexPath
.
section
==
4
)
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"WalletEmptyViewTableViewCellId"
,
for
:
indexPath
)
as!
WalletEmptyViewTableViewCell
return
cell
}
else
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"WalletSpinnerTableViewCellId"
,
for
:
indexPath
)
as!
WalletSpinnerTableViewCell
return
cell
...
...
@@ -1376,6 +1441,23 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
// Do nothing - Each button is handled differently
}
else
if
(
indexPath
.
section
==
1
)
{
swiftApi
()
.
logTrackersEvent
(
"click"
,
(
"LoyaltyWalletScreen:"
+
"Questionnaire"
))
swiftApi
()
.
openQuestionnaire
(
self
);
}
else
if
(
indexPath
.
section
==
2
)
{
let
firebaseEvent
=
swiftApi
.
LoyaltySDKFirebaseEventModel
()
firebaseEvent
.
_eventName
=
"did_tap_history_badge"
firebaseEvent
.
setParameter
=
(
"screen"
,
"Loyalty Wallet"
)
SwiftEventBus
.
post
(
"firebase"
,
sender
:
firebaseEvent
)
swiftApi
()
.
logTrackersEvent
(
"click"
,
(
"LoyaltyWalletScreen:"
+
"LoyaltyHistoryBadge"
))
let
storyboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
let
vc
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"LoyaltyHistoryViewController"
)
as!
SwiftWarplyFramework
.
LoyaltyHistoryViewController
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
else
if
(
indexPath
.
section
==
3
)
{
let
firebaseEvent
=
swiftApi
.
LoyaltySDKFirebaseEventModel
()
firebaseEvent
.
_eventName
=
"did_tap_vouchers_badge"
firebaseEvent
.
setParameter
=
(
"screen"
,
"Loyalty Wallet"
)
...
...
@@ -1385,7 +1467,9 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
SwiftEventBus
.
post
(
"vouchers_banner_pressed"
)
}
else
if
(
indexPath
.
section
==
2
)
{
}
else
if
(
indexPath
.
section
==
4
)
{
// Do nothing
}
else
if
(
indexPath
.
section
==
5
)
{
// Do nothing
}
else
{
// Do nothing
...
...
Please
register
or
login
to post a comment