Manos Chorianopoulos

fix new badge functionality v2

...@@ -26,35 +26,35 @@ import SwiftEventBus ...@@ -26,35 +26,35 @@ import SwiftEventBus
26 26
27 self.hidesBottomBarWhenPushed = true 27 self.hidesBottomBarWhenPushed = true
28 28
29 - var tempCampaigns:Array<swiftApi.CampaignItemModel> = [] 29 + // var tempCampaigns:Array<swiftApi.CampaignItemModel> = []
30 - 30 +
31 - if (seasonalList.count > 0) { 31 + // if (seasonalList.count > 0) {
32 - for seasonalItem in seasonalList { 32 + // for seasonalItem in seasonalList {
33 - let newCampaign = swiftApi.CampaignItemModel() 33 + // let newCampaign = swiftApi.CampaignItemModel()
34 - newCampaign._title = seasonalItem._title 34 + // newCampaign._title = seasonalItem._title
35 - newCampaign._logo_url = seasonalItem._imageUrl 35 + // newCampaign._logo_url = seasonalItem._imageUrl
36 - newCampaign._loyaltyPackageId = seasonalItem._loyaltyPackageId 36 + // newCampaign._loyaltyPackageId = seasonalItem._loyaltyPackageId
37 - tempCampaigns.append(newCampaign) 37 + // tempCampaigns.append(newCampaign)
38 - } 38 + // }
39 - } 39 + // }
40 - 40 +
41 - if (ccmsList.count > 0) { 41 + // if (ccmsList.count > 0) {
42 - for ccmsItem in ccmsList { 42 + // for ccmsItem in ccmsList {
43 - if (((ccmsItem._loyaltyCampaignId == "") || (ccmsItem._loyaltyCampaignId == "NA")) && (ccmsItem._zone == "COSMOTE_APP_GIFTS4U")) { 43 + // if (((ccmsItem._loyaltyCampaignId == "") || (ccmsItem._loyaltyCampaignId == "NA")) && (ccmsItem._zone == "COSMOTE_APP_GIFTS4U")) {
44 - let newCampaign = swiftApi.CampaignItemModel() 44 + // let newCampaign = swiftApi.CampaignItemModel()
45 - newCampaign._title = ccmsItem._title 45 + // newCampaign._title = ccmsItem._title
46 - newCampaign._logo_url = ccmsItem._imageUrl 46 + // newCampaign._logo_url = ccmsItem._imageUrl
47 - newCampaign._ccms = ccmsItem 47 + // newCampaign._ccms = ccmsItem
48 - tempCampaigns.append(newCampaign) 48 + // tempCampaigns.append(newCampaign)
49 - } 49 + // }
50 - } 50 + // }
51 - } 51 + // }
52 - 52 +
53 - if (loyaltyList.count > 0) { 53 + // if (loyaltyList.count > 0) {
54 - tempCampaigns = tempCampaigns + loyaltyList 54 + // tempCampaigns = tempCampaigns + loyaltyList
55 - } 55 + // }
56 - 56 +
57 - campaigns = tempCampaigns 57 + // campaigns = tempCampaigns
58 58
59 setBackButton() 59 setBackButton()
60 setNavigationTitle("GIFTS for YOU", "bold") 60 setNavigationTitle("GIFTS for YOU", "bold")
...@@ -96,13 +96,13 @@ import SwiftEventBus ...@@ -96,13 +96,13 @@ import SwiftEventBus
96 96
97 } 97 }
98 98
99 - // public override func viewWillAppear(_ animated: Bool) { 99 + public override func viewWillAppear(_ animated: Bool) {
100 - // super.viewWillAppear(animated) 100 + super.viewWillAppear(animated)
101 101
102 - // print("=== viewWillAppear invoked ===") 102 + print("=== gifts viewWillAppear invoked ===")
103 103
104 - // self.refreshData() 104 + self.refreshData()
105 - // } 105 + }
106 106
107 // MARK: - Functions 107 // MARK: - Functions
108 func refreshData() -> Void { 108 func refreshData() -> Void {
......
...@@ -25,23 +25,23 @@ import SwiftEventBus ...@@ -25,23 +25,23 @@ import SwiftEventBus
25 25
26 self.hidesBottomBarWhenPushed = true 26 self.hidesBottomBarWhenPushed = true
27 27
28 - var tempCampaigns:Array<swiftApi.CampaignItemModel> = loyaltyList 28 + // var tempCampaigns:Array<swiftApi.CampaignItemModel> = loyaltyList
29 - 29 +
30 - if (ccmsList.count > 0) { 30 + // if (ccmsList.count > 0) {
31 - for ccmsItem in ccmsList { 31 + // for ccmsItem in ccmsList {
32 - if (((ccmsItem._loyaltyCampaignId == "") || (ccmsItem._loyaltyCampaignId == "NA")) && (ccmsItem._zone == "COSMOTE_APP_MORE4U")) { 32 + // if (((ccmsItem._loyaltyCampaignId == "") || (ccmsItem._loyaltyCampaignId == "NA")) && (ccmsItem._zone == "COSMOTE_APP_MORE4U")) {
33 - let newCampaign = swiftApi.CampaignItemModel() 33 + // let newCampaign = swiftApi.CampaignItemModel()
34 - newCampaign._title = ccmsItem._title 34 + // newCampaign._title = ccmsItem._title
35 - newCampaign._logo_url = ccmsItem._imageUrl 35 + // newCampaign._logo_url = ccmsItem._imageUrl
36 - newCampaign._subtitle = ccmsItem._subtitle 36 + // newCampaign._subtitle = ccmsItem._subtitle
37 - newCampaign._message = ccmsItem._message 37 + // newCampaign._message = ccmsItem._message
38 - newCampaign._ccms = ccmsItem 38 + // newCampaign._ccms = ccmsItem
39 - tempCampaigns.append(newCampaign) 39 + // tempCampaigns.append(newCampaign)
40 - } 40 + // }
41 - } 41 + // }
42 - } 42 + // }
43 - 43 +
44 - campaigns = tempCampaigns 44 + // campaigns = tempCampaigns
45 45
46 setBackButton() 46 setBackButton()
47 setNavigationTitle("MORE for YOU", "bold") 47 setNavigationTitle("MORE for YOU", "bold")
...@@ -72,6 +72,14 @@ import SwiftEventBus ...@@ -72,6 +72,14 @@ import SwiftEventBus
72 72
73 } 73 }
74 74
75 + public override func viewWillAppear(_ animated: Bool) {
76 + super.viewWillAppear(animated)
77 +
78 + print("=== mfy viewWillAppear invoked ===")
79 +
80 + self.refreshData()
81 + }
82 +
75 // MARK: - Functions 83 // MARK: - Functions
76 func refreshData() -> Void { 84 func refreshData() -> Void {
77 self.loyaltyList = swiftApi().mergeMFYCCMSLoyaltyCampaigns(campaigns: swiftApi().getCCMSLoyaltyCampaigns()) 85 self.loyaltyList = swiftApi().mergeMFYCCMSLoyaltyCampaigns(campaigns: swiftApi().getCCMSLoyaltyCampaigns())
......