Manos Chorianopoulos

fix new badge functionality v2

......@@ -26,35 +26,35 @@ import SwiftEventBus
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
tempCampaigns.append(newCampaign)
}
}
// 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
// tempCampaigns.append(newCampaign)
// }
// }
if (ccmsList.count > 0) {
for ccmsItem in ccmsList {
if (((ccmsItem._loyaltyCampaignId == "") || (ccmsItem._loyaltyCampaignId == "NA")) && (ccmsItem._zone == "COSMOTE_APP_GIFTS4U")) {
let newCampaign = swiftApi.CampaignItemModel()
newCampaign._title = ccmsItem._title
newCampaign._logo_url = ccmsItem._imageUrl
newCampaign._ccms = ccmsItem
tempCampaigns.append(newCampaign)
}
}
}
// if (ccmsList.count > 0) {
// for ccmsItem in ccmsList {
// if (((ccmsItem._loyaltyCampaignId == "") || (ccmsItem._loyaltyCampaignId == "NA")) && (ccmsItem._zone == "COSMOTE_APP_GIFTS4U")) {
// let newCampaign = swiftApi.CampaignItemModel()
// newCampaign._title = ccmsItem._title
// newCampaign._logo_url = ccmsItem._imageUrl
// newCampaign._ccms = ccmsItem
// tempCampaigns.append(newCampaign)
// }
// }
// }
if (loyaltyList.count > 0) {
tempCampaigns = tempCampaigns + loyaltyList
}
// if (loyaltyList.count > 0) {
// tempCampaigns = tempCampaigns + loyaltyList
// }
campaigns = tempCampaigns
// campaigns = tempCampaigns
setBackButton()
setNavigationTitle("GIFTS for YOU", "bold")
......@@ -96,13 +96,13 @@ import SwiftEventBus
}
// public override func viewWillAppear(_ animated: Bool) {
// super.viewWillAppear(animated)
public override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// print("=== viewWillAppear invoked ===")
print("=== gifts viewWillAppear invoked ===")
// self.refreshData()
// }
self.refreshData()
}
// MARK: - Functions
func refreshData() -> Void {
......
......@@ -25,23 +25,23 @@ import SwiftEventBus
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")) {
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)
}
}
}
campaigns = tempCampaigns
// 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")) {
// 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)
// }
// }
// }
// campaigns = tempCampaigns
setBackButton()
setNavigationTitle("MORE for YOU", "bold")
......@@ -72,6 +72,14 @@ import SwiftEventBus
}
public override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
print("=== mfy viewWillAppear invoked ===")
self.refreshData()
}
// MARK: - Functions
func refreshData() -> Void {
self.loyaltyList = swiftApi().mergeMFYCCMSLoyaltyCampaigns(campaigns: swiftApi().getCCMSLoyaltyCampaigns())
......