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-19 12:46:08 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2ea615056eb9b1a0f380b39a2d647da759b5d87a
2ea61505
1 parent
72261d64
Add setVouchersFetched, vouchers_banner event
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
0 deletions
SwiftWarplyFramework/SwiftWarplyFramework/WalletViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/WalletViewController.swift
View file @
2ea6150
...
...
@@ -77,6 +77,10 @@ import SwiftEventBus
var
forYouExpanded
:
Bool
=
false
;
// TODO: Add SwiftEventBus.post("vouchers_banner_pressed") on Voucher Banner press
public
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
...
...
@@ -103,6 +107,22 @@ import SwiftEventBus
}
}
SwiftEventBus
.
onBackgroundThread
(
self
,
name
:
"vouchers_fetched"
)
{
result
in
DispatchQueue
.
main
.
async
{
print
(
"=== vouchers_fetched event ==="
)
// TODO: hide Spinner
if
(
swiftApi
()
.
getShowVouchersBanner
()
==
"true"
)
{
// TODO: show Vouchers Banner
}
else
{
// TODO: hide Vouchers Banner
}
}
}
// TODO: DELETE ===>
// let coupon = swiftApi.ActiveDFYCouponModel()
// coupon._value = "12"
...
...
@@ -462,6 +482,16 @@ import SwiftEventBus
// TODO: DELETE if emptyView is needed again
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
}
}
public
override
func
viewWillAppear
(
_
animated
:
Bool
)
{
...
...
@@ -530,6 +560,11 @@ import SwiftEventBus
self
.
stopTimer
()
self
.
navigationController
?
.
navigationBar
.
layer
.
shadowOpacity
=
0.0
if
self
.
isMovingFromParent
{
// Clear ShowVouchersBanner state
swiftApi
()
.
clearShowVouchersBanner
();
}
}
public
override
func
viewDidLayoutSubviews
()
{
...
...
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
2ea6150
...
...
@@ -35,6 +35,7 @@ public struct GlobalVariables {
static
var
merchantList
:
Array
<
swiftApi
.
MerchantModel
>
=
[]
static
var
trackingStepsEnabled
:
Bool
=
false
static
var
carouselList
:
Array
<
swiftApi
.
CampaignItemModel
>
=
[]
static
var
showVouchersBanner
:
String
=
""
// We use String in order to have 3 different states: "", "true", "false"
}
var
timer
:
DispatchSourceTimer
?
...
...
@@ -167,6 +168,32 @@ public class swiftApi {
}
public
func
setShowVouchersBanner
(
_
newValue
:
String
)
{
GlobalVariables
.
showVouchersBanner
=
newValue
}
public
func
getShowVouchersBanner
()
->
String
{
return
GlobalVariables
.
showVouchersBanner
}
public
func
clearShowVouchersBanner
()
->
Void
{
GlobalVariables
.
showVouchersBanner
=
""
}
public
func
setVouchersFetched
(
_
success
:
Bool
)
->
Void
{
if
(
success
==
true
)
{
setShowVouchersBanner
(
"true"
)
}
else
{
setShowVouchersBanner
(
"false"
)
}
SwiftEventBus
.
post
(
"vouchers_fetched"
)
}
public
func
startTrackingSteps
(
_
getStepsCallback
:
@escaping
(
_
steps
:
Int
)
->
Void
)
->
Void
{
if
(
GlobalVariables
.
trackingStepsEnabled
==
false
)
{
...
...
Please
register
or
login
to post a comment