Manos Chorianopoulos

fix ContextualVC success modal action

...@@ -194,6 +194,47 @@ import SwiftEventBus ...@@ -194,6 +194,47 @@ import SwiftEventBus
194 self.present(alert, animated: true, completion: nil) 194 self.present(alert, animated: true, completion: nil)
195 } 195 }
196 196
197 + func showSuccessDialog(_ alertTitle: String, _ alertSubTitle: String) -> Void {
198 +
199 + let alert = UIAlertController(title: alertTitle, message: alertSubTitle, preferredStyle: .alert)
200 + alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in
201 + switch action.style{
202 + case .default:
203 + self.navigationController?.popViewController(animated: true)
204 +
205 + swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in })
206 +
207 + func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void {
208 + if (couponsData != nil) {
209 + DispatchQueue.main.async {
210 + SwiftEventBus.post("coupons_fetched")
211 + }
212 + } else {
213 + }
214 + }
215 +
216 + swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in })
217 +
218 + func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void {
219 + if (campaignsData != nil) {
220 + DispatchQueue.main.async {
221 + SwiftEventBus.post("campaigns_retrieved")
222 + }
223 + } else {
224 + }
225 + }
226 +
227 + case .cancel:
228 + print("cancel")
229 +
230 + case .destructive:
231 + print("destructive")
232 +
233 + }
234 + }))
235 + self.present(alert, animated: true, completion: nil)
236 + }
237 +
197 238
198 // MARK: - API CALLS 239 // MARK: - API CALLS
199 func getProfileRequest() { 240 func getProfileRequest() {
...@@ -240,7 +281,7 @@ import SwiftEventBus ...@@ -240,7 +281,7 @@ import SwiftEventBus
240 ccmsEnabled._isActivated = true 281 ccmsEnabled._isActivated = true
241 SwiftEventBus.post("ccms_enabled", sender: ccmsEnabled) 282 SwiftEventBus.post("ccms_enabled", sender: ccmsEnabled)
242 283
243 - self.showDialog("Το αίτημά σου ολοκληρώθηκε επιτυχώς!","Θα ενημερωθείς άμεσα για την ενεργοποίηση του πακέτου σου.") 284 + self.showSuccessDialog("Το αίτημά σου ολοκληρώθηκε επιτυχώς!","Θα ενημερωθείς άμεσα για την ενεργοποίηση του πακέτου σου.")
244 // self.postEventRequest() 285 // self.postEventRequest()
245 286
246 } else { 287 } else {
......