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-09-29 11:45:06 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
27d41fe97d755b69d852240e8ba9a41de71398b6
27d41fe9
1 parent
a5957ff8
fix new badge functionality
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
49 deletions
SwiftWarplyFramework/SwiftWarplyFramework/GiftsViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/MFYViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/GiftsViewController.swift
View file @
27d41fe
...
...
@@ -21,16 +21,20 @@ import SwiftEventBus
public
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
print
(
"=== gifts viewDidLoad invoked ==="
)
self
.
hidesBottomBarWhenPushed
=
true
var
tempCampaigns
:
Array
<
swiftApi
.
CampaignItemModel
>
=
[]
if
(
seasonalList
.
count
>
0
)
{
for
seasonalItem
in
seasonalList
{
let
newCampaign
=
swiftApi
.
CampaignItemModel
()
newCampaign
.
_title
=
seasonalItem
.
_title
newCampaign
.
_logo_url
=
seasonalItem
.
_imageUrl
newCampaign
.
_loyaltyPackageId
=
seasonalItem
.
_loyaltyPackageId
c
ampaigns
.
append
(
newCampaign
)
tempC
ampaigns
.
append
(
newCampaign
)
}
}
...
...
@@ -41,14 +45,16 @@ import SwiftEventBus
newCampaign
.
_title
=
ccmsItem
.
_title
newCampaign
.
_logo_url
=
ccmsItem
.
_imageUrl
newCampaign
.
_ccms
=
ccmsItem
c
ampaigns
.
append
(
newCampaign
)
tempC
ampaigns
.
append
(
newCampaign
)
}
}
}
if
(
loyaltyList
.
count
>
0
)
{
campaigns
=
c
ampaigns
+
loyaltyList
tempCampaigns
=
tempC
ampaigns
+
loyaltyList
}
campaigns
=
tempCampaigns
setBackButton
()
setNavigationTitle
(
"GIFTS for YOU"
,
"bold"
)
...
...
@@ -89,12 +95,22 @@ import SwiftEventBus
mainView
.
backgroundColor
=
UIColor
(
red
:
0.22
,
green
:
0.32
,
blue
:
0.40
,
alpha
:
1.00
)
}
// public override func viewWillAppear(_ animated: Bool) {
// super.viewWillAppear(animated)
// print("=== viewWillAppear invoked ===")
// self.refreshData()
// }
// MARK: - Functions
func
refreshData
()
->
Void
{
self
.
campaigns
=
swiftApi
()
.
mergeGFYCCMSLoyaltyCampaigns
(
campaigns
:
swiftApi
()
.
getCCMSLoyaltyCampaigns
())
var
tempCampaigns
:
Array
<
swiftApi
.
CampaignItemModel
>
=
[]
self
.
campaigns
=
[]
self
.
seasonalList
=
swiftApi
()
.
getSeasonalList
()
self
.
ccmsList
=
swiftApi
()
.
getCCMSLoyaltyCampaigns
()
self
.
loyaltyList
=
swiftApi
()
.
mergeGFYCCMSLoyaltyCampaigns
(
campaigns
:
swiftApi
()
.
getCCMSLoyaltyCampaigns
())
if
(
self
.
seasonalList
.
count
>
0
)
{
for
seasonalItem
in
self
.
seasonalList
{
...
...
@@ -102,7 +118,7 @@ import SwiftEventBus
newCampaign
.
_title
=
seasonalItem
.
_title
newCampaign
.
_logo_url
=
seasonalItem
.
_imageUrl
newCampaign
.
_loyaltyPackageId
=
seasonalItem
.
_loyaltyPackageId
self
.
c
ampaigns
.
append
(
newCampaign
)
tempC
ampaigns
.
append
(
newCampaign
)
}
}
...
...
@@ -113,15 +129,16 @@ import SwiftEventBus
newCampaign
.
_title
=
ccmsItem
.
_title
newCampaign
.
_logo_url
=
ccmsItem
.
_imageUrl
newCampaign
.
_ccms
=
ccmsItem
self
.
c
ampaigns
.
append
(
newCampaign
)
tempC
ampaigns
.
append
(
newCampaign
)
}
}
}
if
(
self
.
loyaltyList
.
count
>
0
)
{
self
.
campaigns
=
self
.
c
ampaigns
+
self
.
loyaltyList
tempCampaigns
=
tempC
ampaigns
+
self
.
loyaltyList
}
self
.
campaigns
=
tempCampaigns
self
.
tableView
.
reloadData
()
}
...
...
@@ -173,9 +190,9 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
vc
.
ccms
=
campaigns
[
indexPath
.
row
]
.
_ccms
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
//
if let sessionUuid = campaigns[indexPath.row].session_uuid {
//
getSingleCampaignAsyncRequest(sessionUuid: sessionUuid)
//
}
if
let
sessionUuid
=
campaigns
[
indexPath
.
row
]
.
session_uuid
{
getSingleCampaignAsyncRequest
(
sessionUuid
:
sessionUuid
)
}
}
else
if
(
campaigns
[
indexPath
.
row
]
.
_type
!=
nil
&&
campaigns
[
indexPath
.
row
]
.
_type
==
"telco"
)
{
let
ccmsCampaigns
=
swiftApi
()
.
getCCMSLoyaltyCampaigns
()
...
...
@@ -190,9 +207,9 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
vc
.
campaign
=
campaigns
[
indexPath
.
row
]
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
//
if let sessionUuid = campaigns[indexPath.row].session_uuid {
//
getSingleCampaignAsyncRequest(sessionUuid: sessionUuid)
//
}
if
let
sessionUuid
=
campaigns
[
indexPath
.
row
]
.
session_uuid
{
getSingleCampaignAsyncRequest
(
sessionUuid
:
sessionUuid
)
}
break
;
}
}
...
...
@@ -225,9 +242,9 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
//
if let sessionUuid = campaigns[indexPath.row].session_uuid {
//
getSingleCampaignAsyncRequest(sessionUuid: sessionUuid)
//
}
if
let
sessionUuid
=
campaigns
[
indexPath
.
row
]
.
session_uuid
{
getSingleCampaignAsyncRequest
(
sessionUuid
:
sessionUuid
)
}
break
;
}
...
...
@@ -284,9 +301,9 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
vc
.
params
=
params
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
//
if let sessionUuid = campaigns[indexPath.row].session_uuid {
//
getSingleCampaignAsyncRequest(sessionUuid: sessionUuid)
//
}
if
let
sessionUuid
=
campaigns
[
indexPath
.
row
]
.
session_uuid
{
getSingleCampaignAsyncRequest
(
sessionUuid
:
sessionUuid
)
}
}
else
{
let
seasonalEvent
=
swiftApi
.
LoyaltyGiftsForYouOfferClickEvent
()
...
...
SwiftWarplyFramework/SwiftWarplyFramework/MFYViewController.swift
View file @
27d41fe
...
...
@@ -13,15 +13,20 @@ import SwiftEventBus
@IBOutlet
weak
var
mainView
:
UIView
!
@IBOutlet
weak
var
tableView
:
UITableView
!
public
var
campaigns
:
Array
<
swiftApi
.
CampaignItemModel
>
=
swiftApi
()
.
mergeMFYCCMSLoyaltyCampaigns
(
campaigns
:
swiftApi
()
.
getCCMSLoyaltyCampaigns
())
public
var
campaigns
:
Array
<
swiftApi
.
CampaignItemModel
>
=
[]
public
var
loyaltyList
:
Array
<
swiftApi
.
CampaignItemModel
>
=
swiftApi
()
.
mergeMFYCCMSLoyaltyCampaigns
(
campaigns
:
swiftApi
()
.
getCCMSLoyaltyCampaigns
())
public
var
ccmsList
:
Array
<
swiftApi
.
LoyaltyContextualOfferModel
>
=
swiftApi
()
.
getCCMSLoyaltyCampaigns
()
public
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
print
(
"=== mfy viewDidLoad invoked ==="
)
self
.
hidesBottomBarWhenPushed
=
true
var
tempCampaigns
:
Array
<
swiftApi
.
CampaignItemModel
>
=
loyaltyList
if
(
ccmsList
.
count
>
0
)
{
for
ccmsItem
in
ccmsList
{
if
(((
ccmsItem
.
_loyaltyCampaignId
==
""
)
||
(
ccmsItem
.
_loyaltyCampaignId
==
"NA"
))
&&
(
ccmsItem
.
_zone
==
"COSMOTE_APP_MORE4U"
))
{
...
...
@@ -31,10 +36,12 @@ import SwiftEventBus
newCampaign
.
_subtitle
=
ccmsItem
.
_subtitle
newCampaign
.
_message
=
ccmsItem
.
_message
newCampaign
.
_ccms
=
ccmsItem
c
ampaigns
.
append
(
newCampaign
)
tempC
ampaigns
.
append
(
newCampaign
)
}
}
}
campaigns
=
tempCampaigns
setBackButton
()
setNavigationTitle
(
"MORE for YOU"
,
"bold"
)
...
...
@@ -44,14 +51,12 @@ import SwiftEventBus
SwiftEventBus
.
onMainThread
(
self
,
name
:
"ccms_retrieved"
)
{
result
in
print
(
"===== SwiftEventBus ccms_retrieved ====="
)
self
.
campaigns
=
swiftApi
()
.
mergeMFYCCMSLoyaltyCampaigns
(
campaigns
:
swiftApi
()
.
getCCMSLoyaltyCampaigns
())
self
.
tableView
.
reloadData
()
self
.
refreshData
()
}
SwiftEventBus
.
onMainThread
(
self
,
name
:
"campaigns_retrieved"
)
{
result
in
print
(
"===== SwiftEventBus campaigns_retrieved ====="
)
self
.
campaigns
=
swiftApi
()
.
mergeMFYCCMSLoyaltyCampaigns
(
campaigns
:
swiftApi
()
.
getCCMSLoyaltyCampaigns
())
self
.
tableView
.
reloadData
()
self
.
refreshData
()
}
tableView
.
clipsToBounds
=
true
...
...
@@ -66,6 +71,30 @@ import SwiftEventBus
mainView
.
backgroundColor
=
UIColor
(
red
:
0.22
,
green
:
0.32
,
blue
:
0.40
,
alpha
:
1.00
)
}
// MARK: - Functions
func
refreshData
()
->
Void
{
self
.
loyaltyList
=
swiftApi
()
.
mergeMFYCCMSLoyaltyCampaigns
(
campaigns
:
swiftApi
()
.
getCCMSLoyaltyCampaigns
())
self
.
ccmsList
=
swiftApi
()
.
getCCMSLoyaltyCampaigns
()
var
tempCampaigns
:
Array
<
swiftApi
.
CampaignItemModel
>
=
loyaltyList
if
(
self
.
ccmsList
.
count
>
0
)
{
for
ccmsItem
in
self
.
ccmsList
{
if
(((
ccmsItem
.
_loyaltyCampaignId
==
""
)
||
(
ccmsItem
.
_loyaltyCampaignId
==
"NA"
))
&&
(
ccmsItem
.
_zone
==
"COSMOTE_APP_MORE4U"
))
{
let
newCampaign
=
swiftApi
.
CampaignItemModel
()
newCampaign
.
_title
=
ccmsItem
.
_title
newCampaign
.
_logo_url
=
ccmsItem
.
_imageUrl
newCampaign
.
_subtitle
=
ccmsItem
.
_subtitle
newCampaign
.
_message
=
ccmsItem
.
_message
newCampaign
.
_ccms
=
ccmsItem
tempCampaigns
.
append
(
newCampaign
)
}
}
}
self
.
campaigns
=
tempCampaigns
self
.
tableView
.
reloadData
()
}
}
...
...
@@ -115,9 +144,9 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
vc
.
ccms
=
campaigns
[
indexPath
.
row
]
.
_ccms
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
//
if let sessionUuid = campaigns[indexPath.row].session_uuid {
//
getSingleCampaignAsyncRequest(sessionUuid: sessionUuid)
//
}
if
let
sessionUuid
=
campaigns
[
indexPath
.
row
]
.
session_uuid
{
getSingleCampaignAsyncRequest
(
sessionUuid
:
sessionUuid
)
}
}
else
if
(
campaigns
[
indexPath
.
row
]
.
_type
!=
nil
&&
campaigns
[
indexPath
.
row
]
.
_type
==
"telco"
)
{
let
ccmsCampaigns
=
swiftApi
()
.
getCCMSLoyaltyCampaigns
()
...
...
@@ -132,9 +161,9 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
vc
.
campaign
=
campaigns
[
indexPath
.
row
]
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
//
if let sessionUuid = campaigns[indexPath.row].session_uuid {
//
getSingleCampaignAsyncRequest(sessionUuid: sessionUuid)
//
}
if
let
sessionUuid
=
campaigns
[
indexPath
.
row
]
.
session_uuid
{
getSingleCampaignAsyncRequest
(
sessionUuid
:
sessionUuid
)
}
}
}
}
...
...
@@ -166,9 +195,9 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
//
if let sessionUuid = campaigns[indexPath.row].session_uuid {
//
getSingleCampaignAsyncRequest(sessionUuid: sessionUuid)
//
}
if
let
sessionUuid
=
campaigns
[
indexPath
.
row
]
.
session_uuid
{
getSingleCampaignAsyncRequest
(
sessionUuid
:
sessionUuid
)
}
break
;
}
...
...
@@ -231,9 +260,9 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
vc
.
params
=
params
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
//
if let sessionUuid = campaigns[indexPath.row].session_uuid {
//
getSingleCampaignAsyncRequest(sessionUuid: sessionUuid)
//
}
if
let
sessionUuid
=
campaigns
[
indexPath
.
row
]
.
session_uuid
{
getSingleCampaignAsyncRequest
(
sessionUuid
:
sessionUuid
)
}
}
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
27d41fe
...
...
@@ -4941,9 +4941,9 @@ public class swiftApi {
vc
.
campaign
=
campaign
controller
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
//
if let sessionUuid = campaign.session_uuid {
//
getSingleCampaignAsyncRequest(sessionUuid: sessionUuid)
//
}
if
let
sessionUuid
=
campaign
.
session_uuid
{
getSingleCampaignAsyncRequest
(
sessionUuid
:
sessionUuid
)
}
break
;
}
...
...
@@ -4958,9 +4958,9 @@ public class swiftApi {
vc
.
params
=
swiftApi
()
.
constructCampaignParams
(
campaign
)
controller
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
//
if let sessionUuid = campaign.session_uuid {
//
getSingleCampaignAsyncRequest(sessionUuid: sessionUuid)
//
}
if
let
sessionUuid
=
campaign
.
session_uuid
{
getSingleCampaignAsyncRequest
(
sessionUuid
:
sessionUuid
)
}
}
func
getSingleCampaignAsyncRequest
(
sessionUuid
:
String
)
{
...
...
@@ -5003,9 +5003,9 @@ public class swiftApi {
vc
.
params
=
swiftApi
()
.
constructCcmsParams
(
loyaltyCampaign
,
ccms
)
controller
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
//
if let sessionUuid = loyaltyCampaign.session_uuid {
//
getSingleCampaignAsyncRequest(sessionUuid: sessionUuid)
//
}
if
let
sessionUuid
=
loyaltyCampaign
.
session_uuid
{
getSingleCampaignAsyncRequest
(
sessionUuid
:
sessionUuid
)
}
break
;
}
else
if
(
isTelco
&&
(
loyaltyCampaign
.
session_uuid
==
ccms
.
_loyaltyCampaignId
))
{
...
...
@@ -5016,9 +5016,9 @@ public class swiftApi {
vc
.
campaign
=
loyaltyCampaign
controller
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
//
if let sessionUuid = loyaltyCampaign.session_uuid {
//
getSingleCampaignAsyncRequest(sessionUuid: sessionUuid)
//
}
if
let
sessionUuid
=
loyaltyCampaign
.
session_uuid
{
getSingleCampaignAsyncRequest
(
sessionUuid
:
sessionUuid
)
}
break
;
}
...
...
Please
register
or
login
to post a comment