func handlePopupCampaign(campaign: EVGCampaign) {
let popup = CustomPopupController(
webViewFile: "popup",
titleText: (campaign.data["titleText"] as! String),
titleColor: campaign.data["titleColor"] as? String,
titleFontSize: campaign.data["titleFontSize"] as? String,
subtitleText: campaign.data["subtitleText"] as! String,
bannerUrl: campaign.data["bannerUrl"] as! String,
buttonUrl: campaign.data["linkButtonUrl"] as? String,
buttonText: campaign.data["linkButtonText"] as? String,
closeButtonText: campaign.data["closeButtonText"] as? String,
buttonColorTheme: campaign.data["buttonColorTheme"] as? String
)
let cancelAction = CustomPopupAction(handler: {_ in })
popup.addAction(cancelAction)
popup.modalPresentationStyle = .overFullScreen
popup.modalTransitionStyle = .crossDissolve
present(popup, animated: true)
evergageScreen?.trackImpression(campaign)
if (!campaign.isControlGroup) {
NSLog("New active campaign name %@ for target %@ with data %@",
campaign.campaignName, campaign.target, campaign.data)
}
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
let handlerPopup = { [weak self] (campaign: EVGCampaign) -> Void in
self?.handlePopupCampaign(campaign: campaign)
}
evergageScreen?.trackAction("App Foreground")
evergageScreen?.setCampaignHandler(handlerPopup, forTarget: "Targetで指定したキャンペーン名")
refreshScreen()
}