Manos Chorianopoulos

fix open websiteUrl at MapVC

...@@ -209,9 +209,13 @@ import MapKit ...@@ -209,9 +209,13 @@ import MapKit
209 alert.addAction(UIAlertAction(title: "Δες το eshop", style: .default, handler: { action in 209 alert.addAction(UIAlertAction(title: "Δες το eshop", style: .default, handler: { action in
210 switch action.style{ 210 switch action.style{
211 case .default: 211 case .default:
212 - if (self.merchantsArray.count > 0) { 212 + if (self.couponSet != nil) {
213 - for item in self.merchantsArray { 213 + if let merchantUuid: String = self.couponSet?.merchant_uuid {
214 + for item in swiftApi().getMerchantList() {
215 + if (item._uuid == merchantUuid) {
216 +
214 let eshopWebsite = item._website 217 let eshopWebsite = item._website
218 +
215 if (eshopWebsite != "") { 219 if (eshopWebsite != "") {
216 guard let websiteUrl = URL(string: eshopWebsite) else { 220 guard let websiteUrl = URL(string: eshopWebsite) else {
217 print("Error creating URL") 221 print("Error creating URL")
...@@ -229,6 +233,29 @@ import MapKit ...@@ -229,6 +233,29 @@ import MapKit
229 } 233 }
230 } 234 }
231 } 235 }
236 + }
237 + }
238 +// if (self.merchantsArray.count > 0) {
239 +// for item in self.merchantsArray {
240 +// let eshopWebsite = item._website
241 +//
242 +// if (eshopWebsite != "") {
243 +// guard let websiteUrl = URL(string: eshopWebsite) else {
244 +// print("Error creating URL")
245 +// return
246 +// }
247 +//
248 +// // check if link can be opened.
249 +// guard UIApplication.shared.canOpenURL(websiteUrl) else {
250 +// return
251 +// }
252 +//
253 +// swiftApi().logTrackersEvent("click", "SeeShopWebsite")
254 +// UIApplication.shared.open(websiteUrl, options: [:], completionHandler: nil)
255 +// break;
256 +// }
257 +// }
258 +// }
232 259
233 case .cancel: 260 case .cancel:
234 print("cancel") 261 print("cancel")
......