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-10-25 13:51:43 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0dafc70ee8709ab13b64aadcf237e2886d6f05b2
0dafc70e
1 parent
2b4b85c5
add spinner at WalletVC
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
103 additions
and
25 deletions
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
SwiftWarplyFramework/SwiftWarplyFramework/Main.storyboard
SwiftWarplyFramework/SwiftWarplyFramework/WalletSpinnerTableViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework/WalletViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/WalletVouchersBannerTableViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
0dafc70
No preview for this file type
SwiftWarplyFramework/SwiftWarplyFramework/Main.storyboard
View file @
0dafc70
This diff is collapsed. Click to expand it.
SwiftWarplyFramework/SwiftWarplyFramework/WalletSpinnerTableViewCell.swift
View file @
0dafc70
...
...
@@ -8,10 +8,16 @@
import
UIKit
@objc
public
class
WalletSpinnerTableViewCell
:
UITableViewCell
{
@IBOutlet
weak
var
spinner
:
UIActivityIndicatorView
!
public
override
func
awakeFromNib
()
{
super
.
awakeFromNib
()
// Initialization code
spinner
.
color
=
UIColor
(
red
:
0.05
,
green
:
0.65
,
blue
:
0.00
,
alpha
:
1.00
)
spinner
.
translatesAutoresizingMaskIntoConstraints
=
false
spinner
.
startAnimating
()
}
public
override
func
setSelected
(
_
selected
:
Bool
,
animated
:
Bool
)
{
...
...
@@ -20,4 +26,11 @@ import UIKit
// Configure the view for the selected state
}
// This is a fix for spinner stopping its animation when reusing cells
public
override
func
prepareForReuse
()
{
super
.
prepareForReuse
()
if
let
spinner
=
self
.
spinner
{
spinner
.
startAnimating
()
}
}
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/WalletViewController.swift
View file @
0dafc70
...
...
@@ -78,6 +78,8 @@ import SwiftEventBus
var
unifiedCouponsDiscount
:
Float
=
0.0
var
forYouExpanded
:
Bool
=
false
;
var
showSpinner
:
Bool
=
false
;
var
showActiveCouponsBanners
:
Bool
=
false
;
public
override
func
viewDidLoad
()
{
...
...
@@ -100,8 +102,10 @@ import SwiftEventBus
DispatchQueue
.
main
.
async
{
self
.
unifiedCoupons
=
swiftApi
()
.
getUnifiedCouponList
()
// TODO: Maybe add this
self
.
matchOldSMCoupons
()
self
.
updateMarketBadge
()
// TODO: Uncomment if discounts are shown again in wallet
// self.matchOldSMCoupons()
// self.updateMarketBadge()
self
.
handleSpinnerAndEmptyView
()
self
.
tableView
.
reloadData
()
}
}
...
...
@@ -111,13 +115,9 @@ import SwiftEventBus
DispatchQueue
.
main
.
async
{
print
(
"=== vouchers_fetched event ==="
)
// TODO: hide Spinner
if
(
swiftApi
()
.
getShowVouchersBanner
()
==
"true"
)
{
// TODO: show Vouchers Banner
}
else
{
// TODO: hide Vouchers Banner
}
self
.
handleSpinnerAndEmptyView
()
// self.showSpinner = false
self
.
tableView
.
reloadData
()
}
}
...
...
@@ -481,21 +481,15 @@ import SwiftEventBus
emptyImage
.
image
=
UIImage
(
named
:
"ic_empty_wallet_2"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
emptyLabel
.
text
=
"Δεν έχεις κάποιον ενεργό κωδικό ή κουπόνι! Μπες τώρα στην ενότητα COSMOTE For You και βρες αποκλειστικές προσφορές!"
matchOldSMCoupons
()
updateMarketBadge
()
// TODO: Uncomment if discounts are shown again in wallet
// matchOldSMCoupons()
// updateMarketBadge()
// TODO: DELETE if emptyView is needed again
emptyView
.
isHidden
=
true
emptyViewHeight
.
constant
=
0
//
emptyView.isHidden = true
//
emptyViewHeight.constant = 0
if
(
swiftApi
()
.
getShowVouchersBanner
()
==
""
)
{
// TODO: show Spinner
// TODO: hide Vouchers Banner
}
else
if
(
swiftApi
()
.
getShowVouchersBanner
()
==
"true"
)
{
// TODO: show Vouchers Banner
}
else
{
// TODO: hide Vouchers Banner
}
self
.
handleSpinnerAndEmptyView
()
}
...
...
@@ -554,7 +548,9 @@ import SwiftEventBus
// TODO: Maybe add this
// self.matchOldSMCoupons()
// <===
self
.
updateMarketBadge
()
// TODO: Uncomment if discounts are shown again in wallet
// self.updateMarketBadge()
self
.
handleSpinnerAndEmptyView
()
self
.
tableView
.
reloadData
()
self
.
startTimer
()
...
...
@@ -705,6 +701,40 @@ import SwiftEventBus
}
func
handleSpinnerAndEmptyView
()
{
if
(
swiftApi
()
.
getShowVouchersBanner
()
==
""
)
{
self
.
showSpinner
=
true
if
(
self
.
dfyCoupons
.
count
==
0
&&
self
.
unifiedCoupons
.
count
==
0
&&
self
.
coupons
.
count
==
0
)
{
self
.
showSpinner
=
false
self
.
showActiveCouponsBanners
=
false
self
.
emptyView
.
isHidden
=
false
self
.
emptyViewHeight
.
constant
=
self
.
emptyView
.
intrinsicContentSize
.
height
}
else
{
self
.
emptyView
.
isHidden
=
true
self
.
emptyViewHeight
.
constant
=
0
self
.
showActiveCouponsBanners
=
true
}
}
else
{
self
.
emptyView
.
isHidden
=
true
self
.
emptyViewHeight
.
constant
=
0
self
.
showSpinner
=
false
if
(
self
.
dfyCoupons
.
count
==
0
&&
self
.
unifiedCoupons
.
count
==
0
&&
self
.
coupons
.
count
==
0
)
{
self
.
showActiveCouponsBanners
=
false
}
else
{
self
.
showActiveCouponsBanners
=
true
}
}
}
// MARK: - API Functions
func
getCouponsSetsDealsRequest
()
{
swiftApi
()
.
getCouponSetsDealsAsync
(
getCouponsSetsDealsCallback
,
failureCallback
:
{
errorCode
in
...
...
@@ -734,6 +764,7 @@ import SwiftEventBus
DispatchQueue
.
main
.
async
{
self
.
matchOldSMCoupons
()
self
.
updateMarketBadge
()
self
.
handleSpinnerAndEmptyView
()
self
.
tableView
.
reloadData
()
}
}
else
{
...
...
@@ -957,7 +988,7 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
public
func
numberOfSections
(
in
tableView
:
UITableView
)
->
Int
{
// return 4
return
2
return
3
}
public
func
tableView
(
_
tableView
:
UITableView
,
numberOfRowsInSection
section
:
Int
)
->
Int
{
...
...
@@ -994,6 +1025,12 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
}
else
{
return
0
}
}
else
if
(
section
==
2
)
{
if
(
self
.
showSpinner
==
true
)
{
return
1
}
else
{
return
0
}
}
else
{
return
0
}
...
...
@@ -1042,6 +1079,12 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
}
else
{
return
0.0
}
}
else
if
(
indexPath
.
section
==
2
)
{
if
(
self
.
showSpinner
==
true
)
{
return
UITableView
.
automaticDimension
}
else
{
return
0.0
}
}
else
{
return
0.0
}
...
...
@@ -1141,6 +1184,8 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
// } else {
return
nil
// }
}
else
if
(
section
==
2
)
{
return
nil
}
else
{
return
nil
}
...
...
@@ -1187,6 +1232,8 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
// } else {
return
0.0
// }
}
else
if
(
section
==
2
)
{
return
0.0
}
else
{
return
0.0
}
...
...
@@ -1232,9 +1279,12 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
cell
.
configureCell
(
dfyCount
:
self
.
dfyCoupons
.
count
,
smCount
:
self
.
unifiedCoupons
.
count
,
gfyCount
:
self
.
coupons
.
count
)
return
cell
}
else
{
}
else
if
(
indexPath
.
section
==
1
)
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"WalletVouchersBannerTableViewCellId"
,
for
:
indexPath
)
as!
WalletVouchersBannerTableViewCell
// cell.configureCell(totalCouponValue: self.totalCouponValue, totalCouponDiscount: self.totalCouponDiscount, unifiedCouponsDiscount: self.unifiedCouponsDiscount, forYouExpanded: self.forYouExpanded)
cell
.
configureCell
(
showSeparator
:
self
.
showActiveCouponsBanners
)
return
cell
}
else
{
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"WalletSpinnerTableViewCellId"
,
for
:
indexPath
)
as!
WalletSpinnerTableViewCell
return
cell
}
...
...
@@ -1292,6 +1342,8 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
SwiftEventBus
.
post
(
"vouchers_banner_pressed"
)
}
else
if
(
indexPath
.
section
==
2
)
{
// Do nothing
}
else
{
// Do nothing
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/WalletVouchersBannerTableViewCell.swift
View file @
0dafc70
...
...
@@ -8,6 +8,8 @@
import
UIKit
@objc
public
class
WalletVouchersBannerTableViewCell
:
UITableViewCell
{
@IBOutlet
weak
var
separatorView
:
UIView
!
@IBOutlet
weak
var
separatorTopSpace
:
NSLayoutConstraint
!
@IBOutlet
weak
var
sectionTitleLabel
:
UILabel
!
@IBOutlet
weak
var
voucherBannerView
:
UIView
!
@IBOutlet
weak
var
voucherBannerIconImage
:
UIImageView
!
...
...
@@ -42,4 +44,15 @@ import UIKit
// Configure the view for the selected state
}
func
configureCell
(
showSeparator
:
Bool
)
{
if
(
showSeparator
==
true
)
{
separatorView
.
isHidden
=
false
separatorTopSpace
.
constant
=
25
}
else
{
separatorView
.
isHidden
=
true
separatorTopSpace
.
constant
=
0
}
}
}
...
...
Please
register
or
login
to post a comment