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
2022-07-13 14:20:12 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9bf07cc23d3598065d0175042a376c6eb6920c78
9bf07cc2
1 parent
cd1f994c
add native couponset flow at gfyVC, mfyVC
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
44 deletions
SwiftWarplyFramework/SwiftWarplyFramework/GiftsViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/MFYViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/GiftsViewController.swift
View file @
9bf07cc
...
...
@@ -84,58 +84,78 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
}
public
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
if
(
campaigns
[
indexPath
.
row
]
.
session_uuid
!=
nil
&&
campaigns
[
indexPath
.
row
]
.
session_uuid
!=
""
)
{
let
storyboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
let
vc
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"CampaignViewController"
)
as!
SwiftWarplyFramework
.
CampaignViewController
var
url
=
""
let
isCcmsOffer
=
(
campaigns
[
indexPath
.
row
]
.
ccms_offer
!=
nil
)
&&
(
campaigns
[
indexPath
.
row
]
.
ccms_offer
!=
""
)
&&
(
campaigns
[
indexPath
.
row
]
.
ccms_offer
==
"true"
)
if
(
campaigns
[
indexPath
.
row
]
.
_campaign_type
==
"coupon"
)
{
let
couponsetUuid
=
campaigns
[
indexPath
.
row
]
.
_couponset
// TODO: DELETE
print
(
"isCcmsOffer: "
+
(
isCcmsOffer
?
"true"
:
"false"
))
if
(
isCcmsOffer
)
{
let
ccmsCampaigns
=
swiftApi
()
.
getCCMSLoyaltyCampaigns
()
if
(
couponsetUuid
!=
""
)
{
let
couponsetsList
=
swiftApi
()
.
getCouponSetList
()
for
item
in
couponsetsList
{
if
(
item
.
uuid
==
couponsetUuid
)
{
let
storyboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
let
vc
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"CouponViewController"
)
as!
SwiftWarplyFramework
.
CouponViewController
vc
.
couponset
=
item
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
break
;
}
}
}
}
else
{
if
(
campaigns
[
indexPath
.
row
]
.
session_uuid
!=
nil
&&
campaigns
[
indexPath
.
row
]
.
session_uuid
!=
""
)
{
let
storyboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
let
vc
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"CampaignViewController"
)
as!
SwiftWarplyFramework
.
CampaignViewController
var
url
=
""
let
isCcmsOffer
=
(
campaigns
[
indexPath
.
row
]
.
ccms_offer
!=
nil
)
&&
(
campaigns
[
indexPath
.
row
]
.
ccms_offer
!=
""
)
&&
(
campaigns
[
indexPath
.
row
]
.
ccms_offer
==
"true"
)
// TODO: DELETE
print
(
"
ccmsCampaigns count: "
+
String
(
ccmsCampaigns
.
count
))
print
(
"
isCcmsOffer: "
+
(
isCcmsOffer
?
"true"
:
"false"
))
let
loyaltyCampaignIdExists
=
ccmsCampaigns
.
contains
{
$0
.
_loyaltyCampaignId
==
campaigns
[
indexPath
.
row
]
.
session_uuid
}
if
(
isCcmsOffer
)
{
let
ccmsCampaigns
=
swiftApi
()
.
getCCMSLoyaltyCampaigns
()
// TODO: DELETE
print
(
"loyaltyCampaignIdExists: "
+
(
loyaltyCampaignIdExists
?
"true"
:
"false"
))
// TODO: DELETE
print
(
"ccmsCampaigns count: "
+
String
(
ccmsCampaigns
.
count
))
if
(
loyaltyCampaignIdExists
==
true
)
{
var
ccmsCampaignFound
:
swiftApi
.
LoyaltyContextualOfferModel
=
swiftApi
.
LoyaltyContextualOfferModel
()
for
item
in
ccmsCampaigns
{
if
(
item
.
_loyaltyCampaignId
==
campaigns
[
indexPath
.
row
]
.
session_uuid
)
{
ccmsCampaignFound
=
item
}
}
url
=
swiftApi
()
.
constructCcmsUrl
(
campaigns
[
indexPath
.
row
],
ccmsCampaignFound
)
let
loyaltyCampaignIdExists
=
ccmsCampaigns
.
contains
{
$0
.
_loyaltyCampaignId
==
campaigns
[
indexPath
.
row
]
.
session_uuid
}
// TODO: DELETE
print
(
"ccmsCampaignFound: "
+
ccmsCampaignFound
.
_loyaltyCampaignId
)
print
(
"loyaltyCampaignIdExists: "
+
(
loyaltyCampaignIdExists
?
"true"
:
"false"
))
if
(
loyaltyCampaignIdExists
==
true
)
{
var
ccmsCampaignFound
:
swiftApi
.
LoyaltyContextualOfferModel
=
swiftApi
.
LoyaltyContextualOfferModel
()
for
item
in
ccmsCampaigns
{
if
(
item
.
_loyaltyCampaignId
==
campaigns
[
indexPath
.
row
]
.
session_uuid
)
{
ccmsCampaignFound
=
item
}
}
url
=
swiftApi
()
.
constructCcmsUrl
(
campaigns
[
indexPath
.
row
],
ccmsCampaignFound
)
// TODO: DELETE
print
(
"ccmsCampaignFound: "
+
ccmsCampaignFound
.
_loyaltyCampaignId
)
}
else
{
url
=
swiftApi
()
.
constructCampaignUrl
(
campaigns
[
indexPath
.
row
])
// TODO: DELETE
print
(
"loyaltyCampaignId DOESNT Exist"
)
}
}
else
{
url
=
swiftApi
()
.
constructCampaignUrl
(
campaigns
[
indexPath
.
row
])
// TODO: DELETE
print
(
"loyaltyCampaignId DOESNT Exist"
)
}
print
(
"CampaignUrl url onclick: "
+
url
)
vc
.
campaignUrl
=
url
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
else
{
url
=
swiftApi
()
.
constructCampaignUrl
(
campaigns
[
indexPath
.
row
])
let
seasonalEvent
=
swiftApi
.
LoyaltyGiftsForYouOfferClickEvent
()
seasonalEvent
.
_title
=
campaigns
[
indexPath
.
row
]
.
_title
??
""
seasonalEvent
.
_imageUrl
=
campaigns
[
indexPath
.
row
]
.
_logo_url
??
""
seasonalEvent
.
_loyaltyPackageId
=
campaigns
[
indexPath
.
row
]
.
_loyaltyPackageId
??
""
SwiftEventBus
.
post
(
"seasonal"
,
sender
:
seasonalEvent
)
}
print
(
"CampaignUrl url onclick: "
+
url
)
vc
.
campaignUrl
=
url
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
else
{
let
seasonalEvent
=
swiftApi
.
LoyaltyGiftsForYouOfferClickEvent
()
seasonalEvent
.
_title
=
campaigns
[
indexPath
.
row
]
.
_title
??
""
seasonalEvent
.
_imageUrl
=
campaigns
[
indexPath
.
row
]
.
_logo_url
??
""
seasonalEvent
.
_loyaltyPackageId
=
campaigns
[
indexPath
.
row
]
.
_loyaltyPackageId
??
""
SwiftEventBus
.
post
(
"seasonal"
,
sender
:
seasonalEvent
)
}
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/MFYViewController.swift
View file @
9bf07cc
...
...
@@ -73,13 +73,32 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
}
public
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
let
storyboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
let
vc
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"CampaignViewController"
)
as!
SwiftWarplyFramework
.
CampaignViewController
let
url
=
swiftApi
()
.
constructCampaignUrl
(
campaigns
[
indexPath
.
row
])
print
(
"CampaignUrl url onclick: "
+
url
)
vc
.
campaignUrl
=
url
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
if
(
campaigns
[
indexPath
.
row
]
.
_campaign_type
==
"coupon"
)
{
let
couponsetUuid
=
campaigns
[
indexPath
.
row
]
.
_couponset
if
(
couponsetUuid
!=
""
)
{
let
couponsetsList
=
swiftApi
()
.
getCouponSetList
()
for
item
in
couponsetsList
{
if
(
item
.
uuid
==
couponsetUuid
)
{
let
storyboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
let
vc
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"CouponViewController"
)
as!
SwiftWarplyFramework
.
CouponViewController
vc
.
couponset
=
item
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
break
;
}
}
}
}
else
{
let
storyboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
let
vc
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"CampaignViewController"
)
as!
SwiftWarplyFramework
.
CampaignViewController
let
url
=
swiftApi
()
.
constructCampaignUrl
(
campaigns
[
indexPath
.
row
])
print
(
"CampaignUrl url onclick: "
+
url
)
vc
.
campaignUrl
=
url
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
}
...
...
Please
register
or
login
to post a comment