Manos Chorianopoulos

fix questionnaire shown when answered

......@@ -19,6 +19,7 @@ public struct GlobalVariables {
static var couponSetList: Array<swiftApi.CouponSetItemModel> = []
static var loyaltyBadge: swiftApi.LoyaltyBadgeModel = swiftApi.LoyaltyBadgeModel()
static var consumer: swiftApi.ProfileModel?
static var consumerInternal: swiftApi.ProfileModel?
static var ccmsCampaigns: Array<swiftApi.LoyaltyContextualOfferModel> = []
static var dealsSum: Float = 0.0
static var seasonalList: Array<swiftApi.LoyaltyGiftsForYouPackage> = []
......@@ -1135,7 +1136,7 @@ public class swiftApi {
return (!(isCcmsOffer || isTelco))
}
if (swiftApi().getConsumer()?._answered == true) {
if (swiftApi().getConsumerInternal()?._answered == true) {
filteredCampaigns = filteredCampaigns.filter { $0.offer_category != "questionnaire" }
}
......@@ -2201,6 +2202,7 @@ public class swiftApi {
let tempProfile = ProfileModel(dictionary: profileDataResult)
swiftApi().setConsumer(tempProfile ?? swiftApi.ProfileModel())
swiftApi().setConsumerInternal(tempProfile ?? swiftApi.ProfileModel())
swiftApi().setUserTag(tempProfile._badge ?? "")
swiftApi().setUserNonTelco(tempProfile._nonTelco ?? false)
......@@ -2288,6 +2290,7 @@ public class swiftApi {
if (profileData != nil) {
DispatchQueue.main.async {
swiftApi().setConsumer(profileData ?? swiftApi.ProfileModel())
swiftApi().setConsumerInternal(profileData ?? swiftApi.ProfileModel())
swiftApi().setUserTag(profileData?._badge ?? "")
}
} else {
......@@ -3761,7 +3764,7 @@ public class swiftApi {
return (!(isCcmsOffer || isTelco))
}
if (swiftApi().getConsumer()?._answered == true) {
if (swiftApi().getConsumerInternal()?._answered == true) {
filteredCampaigns = filteredCampaigns.filter { $0.offer_category != "questionnaire" }
}
......@@ -3975,6 +3978,16 @@ public class swiftApi {
}
public func setConsumerInternal(_ profile: ProfileModel) {
GlobalVariables.consumerInternal = profile
}
public func getConsumerInternal() -> ProfileModel? {
return GlobalVariables.consumerInternal
}
public func setDealsCouponsSum(_ sum: Float) {
GlobalVariables.dealsSum = sum
}
......