Showing
1 changed file
with
43 additions
and
16 deletions
| ... | @@ -209,26 +209,53 @@ import MapKit | ... | @@ -209,26 +209,53 @@ 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 | - let eshopWebsite = item._website | 214 | + for item in swiftApi().getMerchantList() { |
| 215 | - if (eshopWebsite != "") { | 215 | + if (item._uuid == merchantUuid) { |
| 216 | - guard let websiteUrl = URL(string: eshopWebsite) else { | 216 | + |
| 217 | - print("Error creating URL") | 217 | + let eshopWebsite = item._website |
| 218 | - return | 218 | + |
| 219 | + if (eshopWebsite != "") { | ||
| 220 | + guard let websiteUrl = URL(string: eshopWebsite) else { | ||
| 221 | + print("Error creating URL") | ||
| 222 | + return | ||
| 223 | + } | ||
| 224 | + | ||
| 225 | + // check if link can be opened. | ||
| 226 | + guard UIApplication.shared.canOpenURL(websiteUrl) else { | ||
| 227 | + return | ||
| 228 | + } | ||
| 229 | + | ||
| 230 | + swiftApi().logTrackersEvent("click", "SeeShopWebsite") | ||
| 231 | + UIApplication.shared.open(websiteUrl, options: [:], completionHandler: nil) | ||
| 232 | + break; | ||
| 233 | + } | ||
| 219 | } | 234 | } |
| 220 | - | ||
| 221 | - // check if link can be opened. | ||
| 222 | - guard UIApplication.shared.canOpenURL(websiteUrl) else { | ||
| 223 | - return | ||
| 224 | - } | ||
| 225 | - | ||
| 226 | - swiftApi().logTrackersEvent("click", "SeeShopWebsite") | ||
| 227 | - UIApplication.shared.open(websiteUrl, options: [:], completionHandler: nil) | ||
| 228 | - break; | ||
| 229 | } | 235 | } |
| 230 | } | 236 | } |
| 231 | } | 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") | ... | ... |
-
Please register or login to post a comment