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
Dimitris Togias
2022-09-21 10:05:04 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
63c37bb93d202e37bd5388168048902f6dad515c
63c37bb9
1 parent
c9c94c6b
fix table view cell items
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
23 deletions
SwiftWarplyFramework/SwiftWarplyFramework/MFYViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/MFYViewController.swift
View file @
63c37bb
...
...
@@ -123,7 +123,7 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
let
view
=
UIView
(
frame
:
CGRect
(
x
:
0
,
y
:
0
,
width
:
tableView
.
frame
.
width
,
height
:
60
))
view
.
backgroundColor
=
.
clear
let
titleLabel
=
UILabel
(
frame
:
CGRect
(
x
:
1
5
,
y
:
20
,
width
:
view
.
frame
.
width
-
15
,
height
:
40
))
let
titleLabel
=
UILabel
(
frame
:
CGRect
(
x
:
1
8
,
y
:
20
,
width
:
view
.
frame
.
width
-
18
,
height
:
40
))
titleLabel
.
font
=
UIFont
(
name
:
"PFSquareSansPro-Bold"
,
size
:
21
)
titleLabel
.
textColor
=
.
white
titleLabel
.
text
=
categories
[
section
]
.
name
...
...
@@ -156,30 +156,33 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
}
public
func
tableView
(
_
tableView
:
UITableView
,
didSelectRowAt
indexPath
:
IndexPath
)
{
if
(
campaigns
[
indexPath
.
row
]
.
_ccms
!=
nil
)
{
let
campaign
=
categories
[
indexPath
.
section
]
.
items
[
indexPath
.
row
]
if
(
campaign
.
_ccms
!=
nil
)
{
let
storyboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
let
vc
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"ContextualViewController"
)
as!
SwiftWarplyFramework
.
ContextualViewController
vc
.
ccms
=
campaign
s
[
indexPath
.
row
]
.
_ccms
vc
.
ccms
=
campaign
.
_ccms
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
else
if
(
campaign
s
[
indexPath
.
row
]
.
_type
!=
nil
&&
campaigns
[
indexPath
.
row
]
.
_type
==
"telco"
)
{
}
else
if
(
campaign
.
_type
!=
nil
&&
campaign
.
_type
==
"telco"
)
{
let
ccmsCampaigns
=
swiftApi
()
.
getCCMSLoyaltyCampaigns
()
let
loyaltyCampaignIdExists
=
ccmsCampaigns
.
contains
{
$0
.
_loyaltyCampaignId
==
campaign
s
[
indexPath
.
row
]
.
session_uuid
}
let
loyaltyCampaignIdExists
=
ccmsCampaigns
.
contains
{
$0
.
_loyaltyCampaignId
==
campaign
.
session_uuid
}
if
(
loyaltyCampaignIdExists
==
true
)
{
for
item
in
ccmsCampaigns
{
if
(
item
.
_loyaltyCampaignId
==
campaign
s
[
indexPath
.
row
]
.
session_uuid
)
{
if
(
item
.
_loyaltyCampaignId
==
campaign
.
session_uuid
)
{
let
storyboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
let
vc
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"TelcoViewController"
)
as!
SwiftWarplyFramework
.
TelcoViewController
vc
.
ccms
=
item
vc
.
campaign
=
campaign
s
[
indexPath
.
row
]
vc
.
campaign
=
campaign
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
}
}
else
if
(
campaign
s
[
indexPath
.
row
]
.
_campaign_type
==
"coupon"
)
{
let
couponsetUuid
=
campaign
s
[
indexPath
.
row
]
.
_couponset
}
else
if
(
campaign
.
_campaign_type
==
"coupon"
)
{
let
couponsetUuid
=
campaign
.
_couponset
if
(
couponsetUuid
!=
""
)
{
let
couponsetsList
=
swiftApi
()
.
getCouponSetList
()
...
...
@@ -189,14 +192,14 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
let
storyboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
let
vc
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"CouponViewController"
)
as!
SwiftWarplyFramework
.
CouponViewController
vc
.
couponset
=
item
vc
.
campaign
=
campaign
s
[
indexPath
.
row
]
vc
.
campaign
=
campaign
let
ccmsCampaigns
=
swiftApi
()
.
getCCMSLoyaltyCampaigns
()
let
loyaltyCampaignIdExists
=
ccmsCampaigns
.
contains
{
$0
.
_loyaltyCampaignId
==
campaign
s
[
indexPath
.
row
]
.
session_uuid
}
let
loyaltyCampaignIdExists
=
ccmsCampaigns
.
contains
{
$0
.
_loyaltyCampaignId
==
campaign
.
session_uuid
}
if
(
loyaltyCampaignIdExists
==
true
)
{
for
item
in
ccmsCampaigns
{
if
(
item
.
_loyaltyCampaignId
==
campaign
s
[
indexPath
.
row
]
.
session_uuid
)
{
if
(
item
.
_loyaltyCampaignId
==
campaign
.
session_uuid
)
{
vc
.
ccms
=
item
break
;
}
...
...
@@ -222,42 +225,42 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
let
vc
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"CampaignViewController"
)
as!
SwiftWarplyFramework
.
CampaignViewController
var
url
=
""
var
params
=
""
let
isCcmsOffer
=
(
campaign
s
[
indexPath
.
row
]
.
ccms_offer
!=
nil
)
&&
(
campaigns
[
indexPath
.
row
]
.
ccms_offer
!=
""
)
&&
(
campaigns
[
indexPath
.
row
]
.
ccms_offer
==
"true"
)
let
isCcmsOffer
=
(
campaign
.
ccms_offer
!=
nil
)
&&
(
campaign
.
ccms_offer
!=
""
)
&&
(
campaign
.
ccms_offer
==
"true"
)
if
(
isCcmsOffer
)
{
let
ccmsCampaigns
=
swiftApi
()
.
getCCMSLoyaltyCampaigns
()
let
loyaltyCampaignIdExists
=
ccmsCampaigns
.
contains
{
$0
.
_loyaltyCampaignId
==
campaign
s
[
indexPath
.
row
]
.
session_uuid
}
let
loyaltyCampaignIdExists
=
ccmsCampaigns
.
contains
{
$0
.
_loyaltyCampaignId
==
campaign
.
session_uuid
}
if
(
loyaltyCampaignIdExists
==
true
)
{
var
ccmsCampaignFound
:
swiftApi
.
LoyaltyContextualOfferModel
=
swiftApi
.
LoyaltyContextualOfferModel
()
for
item
in
ccmsCampaigns
{
if
(
item
.
_loyaltyCampaignId
==
campaign
s
[
indexPath
.
row
]
.
session_uuid
)
{
if
(
item
.
_loyaltyCampaignId
==
campaign
.
session_uuid
)
{
ccmsCampaignFound
=
item
}
}
url
=
swiftApi
()
.
constructCcmsUrl
(
campaign
s
[
indexPath
.
row
]
,
ccmsCampaignFound
)
params
=
swiftApi
()
.
constructCcmsParams
(
campaign
s
[
indexPath
.
row
]
,
ccmsCampaignFound
)
url
=
swiftApi
()
.
constructCcmsUrl
(
campaign
,
ccmsCampaignFound
)
params
=
swiftApi
()
.
constructCcmsParams
(
campaign
,
ccmsCampaignFound
)
}
else
{
url
=
swiftApi
()
.
constructCampaignUrl
(
campaign
s
[
indexPath
.
row
]
)
params
=
swiftApi
()
.
constructCampaignParams
(
campaign
s
[
indexPath
.
row
]
)
url
=
swiftApi
()
.
constructCampaignUrl
(
campaign
)
params
=
swiftApi
()
.
constructCampaignParams
(
campaign
)
}
let
encoder
=
JSONEncoder
()
encoder
.
outputFormatting
=
.
prettyPrinted
let
data
=
try!
encoder
.
encode
(
campaign
s
[
indexPath
.
row
]
)
let
data
=
try!
encoder
.
encode
(
campaign
)
print
(
"CCMS_CLICK "
+
String
(
data
:
data
,
encoding
:
.
utf8
)
!
)
}
else
{
url
=
swiftApi
()
.
constructCampaignUrl
(
campaign
s
[
indexPath
.
row
]
)
params
=
swiftApi
()
.
constructCampaignParams
(
campaign
s
[
indexPath
.
row
]
)
url
=
swiftApi
()
.
constructCampaignUrl
(
campaign
)
params
=
swiftApi
()
.
constructCampaignParams
(
campaign
)
let
encoder
=
JSONEncoder
()
encoder
.
outputFormatting
=
.
prettyPrinted
let
data
=
try!
encoder
.
encode
(
campaign
s
[
indexPath
.
row
]
)
let
data
=
try!
encoder
.
encode
(
campaign
)
print
(
"GFY_CLICK "
+
String
(
data
:
data
,
encoding
:
.
utf8
)
!
)
}
...
...
Please
register
or
login
to post a comment