Manos Chorianopoulos

MapViewController part2

...@@ -125,6 +125,7 @@ import UIKit ...@@ -125,6 +125,7 @@ import UIKit
125 mapButton.setTitleColor(UIColor(rgb: 0xFFFFFF), for: .highlighted) 125 mapButton.setTitleColor(UIColor(rgb: 0xFFFFFF), for: .highlighted)
126 mapButton.layer.cornerRadius = mapButton.bounds.height / 2 126 mapButton.layer.cornerRadius = mapButton.bounds.height / 2
127 mapButton.backgroundColor = UIColor(rgb: 0x00A3E0) 127 mapButton.backgroundColor = UIColor(rgb: 0x00A3E0)
128 + mapButton.addTarget(self, action: #selector(mapButtonTapped), for: .touchUpInside)
128 129
129 websiteButton.titleLabel?.font = UIFont(name: "PingLCG-Regular", size: 16) 130 websiteButton.titleLabel?.font = UIFont(name: "PingLCG-Regular", size: 16)
130 // websiteButton.setTitle("Δες το website", for: .normal) 131 // websiteButton.setTitle("Δες το website", for: .normal)
...@@ -133,6 +134,7 @@ import UIKit ...@@ -133,6 +134,7 @@ import UIKit
133 websiteButton.setTitleColor(UIColor(rgb: 0x002430), for: .highlighted) 134 websiteButton.setTitleColor(UIColor(rgb: 0x002430), for: .highlighted)
134 websiteButton.backgroundColor = UIColor(rgb: 0xDDEFFB) 135 websiteButton.backgroundColor = UIColor(rgb: 0xDDEFFB)
135 websiteButton.layer.cornerRadius = websiteButton.bounds.height / 2 136 websiteButton.layer.cornerRadius = websiteButton.bounds.height / 2
137 + websiteButton.addTarget(self, action: #selector(websiteButtonTapped), for: .touchUpInside)
136 138
137 // Configure the view with coupon data 139 // Configure the view with coupon data
138 if let couponData = coupon { 140 if let couponData = coupon {
...@@ -140,6 +142,17 @@ import UIKit ...@@ -140,6 +142,17 @@ import UIKit
140 } 142 }
141 } 143 }
142 144
145 + @objc private func mapButtonTapped() {
146 + let vc = SwiftWarplyFramework.MapViewController(nibName: "MapViewController", bundle: Bundle.frameworkBundle)
147 + vc.coupon = coupon
148 +
149 + self.navigationController?.pushViewController(vc, animated: true)
150 + }
151 +
152 + @objc private func websiteButtonTapped() {
153 + // TODO
154 + }
155 +
143 public override func viewDidLayoutSubviews() { 156 public override func viewDidLayoutSubviews() {
144 super.viewDidLayoutSubviews() 157 super.viewDidLayoutSubviews()
145 mapButton.layer.cornerRadius = mapButton.bounds.height / 2 158 mapButton.layer.cornerRadius = mapButton.bounds.height / 2
......
...@@ -11,21 +11,27 @@ import MapKit ...@@ -11,21 +11,27 @@ import MapKit
11 @objc public class MapViewController: UIViewController, MKMapViewDelegate { 11 @objc public class MapViewController: UIViewController, MKMapViewDelegate {
12 // ui 12 // ui
13 @IBOutlet weak var mainView: UIView! 13 @IBOutlet weak var mainView: UIView!
14 - @IBOutlet weak var backgroundImage: UIImageView!
15 @IBOutlet private var mapView: MKMapView! 14 @IBOutlet private var mapView: MKMapView!
16 15
17 - @IBOutlet weak var closeButton: UIButton! 16 + // HeaderView
18 - @IBOutlet private var titleView: UILabel! 17 + @IBOutlet weak var headerLabel: UILabel!
19 - @IBOutlet private var nameImageView: UIImageView! 18 + @IBOutlet weak var filtersView: UIView!
20 - @IBOutlet private var nameView: UILabel! 19 + @IBOutlet weak var filtersLabel: UILabel!
21 - @IBOutlet private var hoursView: UILabel! 20 + @IBOutlet weak var filtersImage: UIImageView!
22 - @IBOutlet private var phoneView: UILabel! 21 +
23 - @IBOutlet private var addressView: UILabel! 22 + // TODO: UNCOMMENT
24 - @IBOutlet private var directionsButton: UIButton! 23 + // DetailsView
25 - @IBOutlet private var infoTopConstraint: NSLayoutConstraint! 24 + // @IBOutlet weak var closeButton: UIButton!
26 - @IBOutlet weak var topBorderLine: UIImageView! 25 + // @IBOutlet private var titleView: UILabel!
27 - @IBOutlet weak var phoneImageView: UIImageView! 26 + // @IBOutlet private var nameImageView: UIImageView!
28 - @IBOutlet weak var addressImageView: UIImageView! 27 + // @IBOutlet private var nameView: UILabel!
28 + // @IBOutlet private var hoursView: UILabel!
29 + // @IBOutlet private var phoneView: UILabel!
30 + // @IBOutlet private var addressView: UILabel!
31 + // @IBOutlet private var directionsButton: UIButton!
32 + // @IBOutlet private var infoTopConstraint: NSLayoutConstraint!
33 + // @IBOutlet weak var phoneImageView: UIImageView!
34 + // @IBOutlet weak var addressImageView: UIImageView!
29 35
30 // public 36 // public
31 public var coupon: CouponItemModel? 37 public var coupon: CouponItemModel?
...@@ -45,73 +51,72 @@ import MapKit ...@@ -45,73 +51,72 @@ import MapKit
45 51
46 self.hidesBottomBarWhenPushed = true 52 self.hidesBottomBarWhenPushed = true
47 53
48 - self.infoTopConstraint.constant = 0 54 + // TODO: UNCOMMENT
55 +// self.infoTopConstraint.constant = 0
49 56
50 setBackButton() 57 setBackButton()
51 - setNavigationTitle("Καταστήματα") 58 + // setNavigationTitle("Καταστήματα")
52 59
53 - backgroundImage.image = UIImage(named: "coupons_scrollview_white", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) 60 + // TODO: UNCOMMENT
54 - phoneImageView.image = UIImage(named: "ic_phone", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) 61 +// phoneImageView.image = UIImage(named: "ic_phone", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
55 - addressImageView.image = UIImage(named: "ic_address", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) 62 +// addressImageView.image = UIImage(named: "ic_address", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
56 63
57 mapView.delegate = self 64 mapView.delegate = self
58 mapView.centerToLocation(initialLocation, regionRadius: 1000000) 65 mapView.centerToLocation(initialLocation, regionRadius: 1000000)
59 66
60 -// mapView.clipsToBounds = true 67 + // Hader Styles
61 -// mapView.layer.cornerRadius = 30 68 + self.headerLabel.text = "Partner businesses"
62 -// mapView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius 69 + self.headerLabel.font = UIFont(name: "PingLCG-Bold", size: 24)
70 + self.headerLabel.textColor = UIColor(rgb: 0x0D1B29)
71 + self.headerLabel.frame.size.width = self.headerLabel.intrinsicContentSize.width
72 + self.headerLabel.frame.size.height = self.headerLabel.intrinsicContentSize.height
63 73
64 -// let image = UIImage(named: "top_border_line", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)! 74 + self.filtersView.backgroundColor = UIColor(rgb: 0xF1F2F4)
65 -// var aspectR: CGFloat = 0.0 75 + self.filtersView.layer.cornerRadius = self.filtersView.bounds.height / 2
66 -// 76 + self.filtersView.layer.masksToBounds = true
67 -// aspectR = image.size.width/image.size.height
68 77
69 -// topBorderLine.translatesAutoresizingMaskIntoConstraints = false 78 + self.filtersLabel.text = "Αναζήτηση"
70 -// topBorderLine.image = image 79 + self.filtersLabel.font = UIFont(name: "PingLCG-Regular", size: 16)
71 -// topBorderLine.contentMode = .scaleAspectFill 80 + self.filtersLabel.textColor = UIColor(rgb: 0x000F1E)
72 -// 81 + self.filtersLabel.frame.size.width = self.filtersLabel.intrinsicContentSize.width
73 -// NSLayoutConstraint.activate([ 82 + self.filtersLabel.frame.size.height = self.filtersLabel.intrinsicContentSize.height
74 -// topBorderLine.topAnchor.constraint(equalTo: mainView.topAnchor, constant: 0),
75 -// topBorderLine.leadingAnchor.constraint(equalTo: mainView.leadingAnchor, constant: 0),
76 -// topBorderLine.trailingAnchor.constraint(equalTo: mainView.trailingAnchor, constant: 0),
77 -// topBorderLine.widthAnchor.constraint(equalToConstant: UIScreen.main.bounds.width),
78 -// topBorderLine.heightAnchor.constraint(equalTo: topBorderLine.widthAnchor, multiplier: 1/aspectR)
79 -// ])
80 83
84 + self.filtersImage.image = UIImage(named: "filter", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
81 85
82 - closeButton.imageView?.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5) 86 + // TODO: UNCOMMENT
83 - closeButton.setImage(UIImage(named: "ic_close_3", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal) 87 +// closeButton.imageView?.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5)
88 +// closeButton.setImage(UIImage(named: "ic_close_3", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal)
84 89
85 - titleView.font = UIFont(name: "PFSquareSansPro-Bold", size: 19) 90 +// titleView.font = UIFont(name: "PFSquareSansPro-Bold", size: 19)
86 - titleView.textColor = UIColor(rgb: 0x757575) 91 +// titleView.textColor = UIColor(rgb: 0x757575)
87 92
88 - nameView.font = UIFont(name: "PFSquareSansPro-Medium", size: 18) 93 +// nameView.font = UIFont(name: "PFSquareSansPro-Medium", size: 18)
89 - nameView.textColor = UIColor(rgb: 0x415564) 94 +// nameView.textColor = UIColor(rgb: 0x415564)
90 95
91 - hoursView.font = UIFont(name: "PFSquareSansPro-Regular", size: 18) 96 +// hoursView.font = UIFont(name: "PFSquareSansPro-Regular", size: 18)
92 - hoursView.textColor = UIColor(rgb: 0xAEAEAE) 97 +// hoursView.textColor = UIColor(rgb: 0xAEAEAE)
93 98
94 - hoursView.font = UIFont(name: "PFSquareSansPro-Medium", size: 18) 99 +// hoursView.font = UIFont(name: "PFSquareSansPro-Medium", size: 18)
95 - hoursView.textColor = UIColor(rgb: 0x415564) 100 +// hoursView.textColor = UIColor(rgb: 0x415564)
96 101
97 - addressView.font = UIFont(name: "PFSquareSansPro-Medium", size: 18) 102 +// addressView.font = UIFont(name: "PFSquareSansPro-Medium", size: 18)
98 - addressView.textColor = UIColor(rgb: 0x415564) 103 +// addressView.textColor = UIColor(rgb: 0x415564)
99 104
100 - //directionsButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Medium", size: 16) 105 +// //directionsButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Medium", size: 16)
101 - directionsButton.setTitle("Οδηγίες", for: .normal) 106 +// directionsButton.setTitle("Οδηγίες", for: .normal)
102 - directionsButton.setImage(UIImage(named: "ic_directions", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal) 107 +// directionsButton.setImage(UIImage(named: "ic_directions", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal)
103 108
104 -// directionsButton.sizeToFit() 109 +// // directionsButton.sizeToFit()
105 - directionsButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Medium", size: 18) 110 +// directionsButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Medium", size: 18)
106 - directionsButton.setTitleColor(.white, for: .normal) 111 +// directionsButton.setTitleColor(.white, for: .normal)
107 - directionsButton.tintColor = .white 112 +// directionsButton.tintColor = .white
108 - directionsButton.backgroundColor = UIColor(rgb: 0x0E8103) 113 +// directionsButton.backgroundColor = UIColor(rgb: 0x0E8103)
109 - directionsButton.layer.cornerRadius = 16.0 114 +// directionsButton.layer.cornerRadius = 16.0
110 -// directionsButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5); 115 +// // directionsButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5);
111 -// directionsButton.titleEdgeInsets = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 0); 116 +// // directionsButton.titleEdgeInsets = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 0);
112 - directionsButton.frame = CGRect(x: 0.0, y: 0.0, width: directionsButton.intrinsicContentSize.width+10, height: 50) 117 +// directionsButton.frame = CGRect(x: 0.0, y: 0.0, width: directionsButton.intrinsicContentSize.width+10, height: 50)
113 -// directionsButton.contentEdgeInsets = UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 15) 118 +// // directionsButton.contentEdgeInsets = UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 15)
114 - directionsButton.setInsets(forContentPadding: UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 15), imageTitlePadding: 10) 119 +// directionsButton.setInsets(forContentPadding: UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 15), imageTitlePadding: 10)
115 120
116 load() 121 load()
117 } 122 }
...@@ -134,21 +139,34 @@ import MapKit ...@@ -134,21 +139,34 @@ import MapKit
134 139
135 if (coupon != nil) { 140 if (coupon != nil) {
136 if let merchantUuid: String = coupon?.merchant_uuid { 141 if let merchantUuid: String = coupon?.merchant_uuid {
137 - getMultilingualMerchantsAsync([], false, 0.0, [], "", 0, [merchantUuid], getMerchantsCallback) 142 +
143 + WarplySDK.shared.getStores(merchantUuid: merchantUuid) { [weak self] merchants in
144 + guard let self = self, let merchants = merchants else {
145 + return
146 + }
147 +
148 + self.getMerchantsCallback(merchants)
149 + print("✅ [MapViewController] Loaded \(merchants.count) merchants")
150 +
151 + } failureCallback: { [weak self] errorCode in
152 + print("Failed to load merchants: \(errorCode)")
153 + }
154 +
138 showContent() 155 showContent()
139 } 156 }
140 - } else {
141 - let appUuid = getAppUuid()
142 157
143 - // 2a6adade35f1484994a3d4c8f006b909 category is for SM only
144 - var categoryUuids = [""]
145 - if (self.isMarket == true) {
146 - categoryUuids = appUuid == "0086a2088301440792091b9f814c2267" ? ["2a6adade35f1484994a3d4c8f006b909"] : ["adcace6cab6049c7b7271bc85bc2b26d"]
147 } else { 158 } else {
148 - categoryUuids = appUuid == "0086a2088301440792091b9f814c2267" ? [""] : ["adcace6cab6049c7b7271bc85bc2b26d"] 159 + WarplySDK.shared.getStores() { [weak self] merchants in
160 + guard let self = self, let merchants = merchants else {
161 + return
149 } 162 }
150 163
151 - getMultilingualMerchantsAsync(categoryUuids, false, 0.0, [], "", 0, [], getMerchantsCallback) 164 + self.getMerchantsCallback(merchants)
165 + print("✅ [MapViewController] Loaded \(merchants.count) merchants")
166 +
167 + } failureCallback: { [weak self] errorCode in
168 + print("Failed to load merchants: \(errorCode)")
169 + }
152 showContent() 170 showContent()
153 } 171 }
154 172
...@@ -177,7 +195,8 @@ import MapKit ...@@ -177,7 +195,8 @@ import MapKit
177 195
178 // let filteredMerchants = self.merchantsArray.filter({ return (($0._latitude != 0.0) && ($0._longitude != 0.0)) }) 196 // let filteredMerchants = self.merchantsArray.filter({ return (($0._latitude != 0.0) && ($0._longitude != 0.0)) })
179 if (filteredMerchants.count == 0) { 197 if (filteredMerchants.count == 0) {
180 - self.showDialog("Καταστήματα συνεργάτη", "Ο συνεργάτης διαθέτει μόνο ηλεκτρονικό κατάστημα για ηλεκτρονικές παραγγελίες.") 198 + // self.showDialog("Καταστήματα συνεργάτη", "Ο συνεργάτης διαθέτει μόνο ηλεκτρονικό κατάστημα για ηλεκτρονικές παραγγελίες.")
199 + self.showDialog("Καταστήματα συνεργάτη", "Δεν υπάρχουν καταστήματα συνεργάτη.")
181 } 200 }
182 } 201 }
183 202
...@@ -186,106 +205,123 @@ import MapKit ...@@ -186,106 +205,123 @@ import MapKit
186 } 205 }
187 206
188 func showDialog(_ alertTitle: String, _ alertSubTitle: String) -> Void { 207 func showDialog(_ alertTitle: String, _ alertSubTitle: String) -> Void {
189 -
190 let alert = UIAlertController(title: alertTitle, message: alertSubTitle, preferredStyle: .alert) 208 let alert = UIAlertController(title: alertTitle, message: alertSubTitle, preferredStyle: .alert)
191 - 209 + alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in
192 - let cancelButton = UIAlertAction(title: "Άκυρο", style: .default, handler: { action in 210 + switch action.style {
193 - switch action.style{
194 case .default: 211 case .default:
195 - self.navigationController?.popViewController(animated: true) 212 + print("default")
196 - // self.dismiss(animated: true, completion: {})
197 -
198 case .cancel: 213 case .cancel:
199 print("cancel") 214 print("cancel")
200 -
201 case .destructive: 215 case .destructive:
202 print("destructive") 216 print("destructive")
203 - 217 + @unknown default:
218 + break
204 } 219 }
205 - }) 220 + }))
206 - // cancelButton.setValue(UIColor(rgb: 0xFC5757), forKey: "titleTextColor") 221 + self.present(alert, animated: true, completion: nil)
207 - alert.addAction(cancelButton)
208 -
209 - alert.addAction(UIAlertAction(title: "Δες το eshop", style: .default, handler: { action in
210 - switch action.style{
211 - case .default:
212 - if (self.coupon != nil) {
213 - // if let merchantUuid: String = self.coupon?.merchant_uuid {
214 - // for item in swiftApi().getMerchantList() {
215 - // if (item._uuid == merchantUuid) {
216 -
217 - // let eshopWebsite = item._website
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 - // }
234 - // }
235 - // }
236 - // }
237 -
238 - let merchantDetails: MerchantModel? = self.coupon?.merchant_details
239 - let eshopWebsite = merchantDetails?._website ?? ""
240 -
241 - if (eshopWebsite != "") {
242 - guard let websiteUrl = URL(string: eshopWebsite) else {
243 - print("Error creating URL")
244 - return
245 } 222 }
246 223
247 - // check if link can be opened. 224 +// func showDialog(_ alertTitle: String, _ alertSubTitle: String) -> Void {
248 - guard UIApplication.shared.canOpenURL(websiteUrl) else { 225 +
249 - return 226 +// let alert = UIAlertController(title: alertTitle, message: alertSubTitle, preferredStyle: .alert)
250 - } 227 +
228 +// let cancelButton = UIAlertAction(title: "Άκυρο", style: .default, handler: { action in
229 +// switch action.style{
230 +// case .default:
231 +// self.navigationController?.popViewController(animated: true)
232 +// // self.dismiss(animated: true, completion: {})
233 +
234 +// case .cancel:
235 +// print("cancel")
236 +
237 +// case .destructive:
238 +// print("destructive")
239 +
240 +// }
241 +// })
242 +// // cancelButton.setValue(UIColor(rgb: 0xFC5757), forKey: "titleTextColor")
243 +// alert.addAction(cancelButton)
244 +
245 +// alert.addAction(UIAlertAction(title: "Δες το eshop", style: .default, handler: { action in
246 +// switch action.style{
247 +// case .default:
248 +// if (self.coupon != nil) {
249 +// // if let merchantUuid: String = self.coupon?.merchant_uuid {
250 +// // for item in swiftApi().getMerchantList() {
251 +// // if (item._uuid == merchantUuid) {
252 +
253 +// // let eshopWebsite = item._website
254 +
255 +// // if (eshopWebsite != "") {
256 +// // guard let websiteUrl = URL(string: eshopWebsite) else {
257 +// // print("Error creating URL")
258 +// // return
259 +// // }
260 +
261 +// // // check if link can be opened.
262 +// // guard UIApplication.shared.canOpenURL(websiteUrl) else {
263 +// // return
264 +// // }
265 +
266 +// // swiftApi().logTrackersEvent("click", "SeeShopWebsite")
267 +// // UIApplication.shared.open(websiteUrl, options: [:], completionHandler: nil)
268 +// // break;
269 +// // }
270 +// // }
271 +// // }
272 +// // }
273 +
274 +// let merchantDetails: MerchantModel? = self.coupon?.merchant_details
275 +// let eshopWebsite = merchantDetails?._website ?? ""
251 276
252 -// logTrackersEvent("click", "SeeShopWebsite")
253 - UIApplication.shared.open(websiteUrl, options: [:], completionHandler: nil)
254 - break;
255 - }
256 - }
257 -// if (self.merchantsArray.count > 0) {
258 -// for item in self.merchantsArray {
259 -// let eshopWebsite = item._website
260 -//
261 // if (eshopWebsite != "") { 277 // if (eshopWebsite != "") {
262 // guard let websiteUrl = URL(string: eshopWebsite) else { 278 // guard let websiteUrl = URL(string: eshopWebsite) else {
263 // print("Error creating URL") 279 // print("Error creating URL")
264 // return 280 // return
265 // } 281 // }
266 -// 282 +
267 // // check if link can be opened. 283 // // check if link can be opened.
268 // guard UIApplication.shared.canOpenURL(websiteUrl) else { 284 // guard UIApplication.shared.canOpenURL(websiteUrl) else {
269 // return 285 // return
270 // } 286 // }
271 -// 287 +
272 -// swiftApi().logTrackersEvent("click", "SeeShopWebsite") 288 +// // logTrackersEvent("click", "SeeShopWebsite")
273 // UIApplication.shared.open(websiteUrl, options: [:], completionHandler: nil) 289 // UIApplication.shared.open(websiteUrl, options: [:], completionHandler: nil)
274 // break; 290 // break;
275 // } 291 // }
276 // } 292 // }
277 -// } 293 +// // if (self.merchantsArray.count > 0) {
294 +// // for item in self.merchantsArray {
295 +// // let eshopWebsite = item._website
296 +// //
297 +// // if (eshopWebsite != "") {
298 +// // guard let websiteUrl = URL(string: eshopWebsite) else {
299 +// // print("Error creating URL")
300 +// // return
301 +// // }
302 +// //
303 +// // // check if link can be opened.
304 +// // guard UIApplication.shared.canOpenURL(websiteUrl) else {
305 +// // return
306 +// // }
307 +// //
308 +// // swiftApi().logTrackersEvent("click", "SeeShopWebsite")
309 +// // UIApplication.shared.open(websiteUrl, options: [:], completionHandler: nil)
310 +// // break;
311 +// // }
312 +// // }
313 +// // }
314 +
315 +// case .cancel:
316 +// print("cancel")
317 +
318 +// case .destructive:
319 +// print("destructive")
278 320
279 - case .cancel: 321 +// }
280 - print("cancel") 322 +// }))
281 - 323 +// self.present(alert, animated: true, completion: nil)
282 - case .destructive: 324 +// }
283 - print("destructive")
284 -
285 - }
286 - }))
287 - self.present(alert, animated: true, completion: nil)
288 - }
289 325
290 private func showLoading() { 326 private func showLoading() {
291 327
...@@ -303,7 +339,8 @@ import MapKit ...@@ -303,7 +339,8 @@ import MapKit
303 // private 339 // private
304 @IBAction func closeButtonAction(_ sender: Any) { 340 @IBAction func closeButtonAction(_ sender: Any) {
305 print("closeButton Pressed!!!") 341 print("closeButton Pressed!!!")
306 - hidePinDetailsView() 342 + // TODO: UNCOMMENT
343 +// hidePinDetailsView()
307 344
308 let selectedAnnotations = mapView.selectedAnnotations 345 let selectedAnnotations = mapView.selectedAnnotations
309 for annotation in selectedAnnotations { 346 for annotation in selectedAnnotations {
...@@ -374,44 +411,47 @@ import MapKit ...@@ -374,44 +411,47 @@ import MapKit
374 // mapView.showAnnotations(mapView.annotations, animated: true) 411 // mapView.showAnnotations(mapView.annotations, animated: true)
375 } 412 }
376 413
377 - private func loadPinDetailsView(_ annotation: MerchantAnnotation) { 414 + // TODO: UNCOMMENT
378 - self.selectedMerchant = annotation.model 415 +// private func loadPinDetailsView(_ annotation: MerchantAnnotation) {
379 - 416 +// self.selectedMerchant = annotation.model
380 - if let parent = self.parentMerchantsArray.first(where: {($0._uuid == self.selectedMerchant?._parent)}) { 417 +//
381 - self.parentMerchant = parent 418 +// if let parent = self.parentMerchantsArray.first(where: {($0._uuid == self.selectedMerchant?._parent)}) {
382 - } 419 +// self.parentMerchant = parent
383 - 420 +// }
384 -// self.titleView.text = self.selectedMerchant?._admin_name 421 +//
385 - self.titleView.text = self.parentMerchant?._admin_name 422 +//// self.titleView.text = self.selectedMerchant?._admin_name
386 - 423 +// self.titleView.text = self.parentMerchant?._admin_name
387 - if (self.isMarket == true) { 424 +//
388 - self.nameImageView.load(link: self.parentMerchant?._img_preview ?? "", placeholder: UIImage(), cache: URLCache()) 425 +// if (self.isMarket == true) {
389 - } else { 426 +// self.nameImageView.load(link: self.parentMerchant?._img_preview ?? "", placeholder: UIImage(), cache: URLCache())
390 - self.nameImageView.load(link: self.selectedMerchant?._img_preview ?? "", placeholder: UIImage(), cache: URLCache()) 427 +// } else {
391 - } 428 +// self.nameImageView.load(link: self.selectedMerchant?._img_preview ?? "", placeholder: UIImage(), cache: URLCache())
392 - 429 +// }
393 - self.nameView.text = self.selectedMerchant?._name 430 +//
394 - // TODO: Make dynamic 431 +// self.nameView.text = self.selectedMerchant?._name
395 - self.hoursView.text = "" 432 +// // TODO: Make dynamic
396 - self.phoneView.text = self.selectedMerchant?._telephone 433 +// self.hoursView.text = ""
397 - self.addressView.text = self.selectedMerchant?._address 434 +// self.phoneView.text = self.selectedMerchant?._telephone
398 - } 435 +// self.addressView.text = self.selectedMerchant?._address
399 - 436 +// }
400 - private func showPinDetailsView() {
401 - self.infoTopConstraint.constant = -320
402 - UIView.animate(withDuration: 1.0) {
403 - self.view.layoutIfNeeded()
404 - }
405 - }
406 437
407 - private func hidePinDetailsView() { 438 + // TODO: UNCOMMENT
408 - self.selectedMerchant = nil 439 +// private func showPinDetailsView() {
440 +// self.infoTopConstraint.constant = -320
441 +// UIView.animate(withDuration: 1.0) {
442 +// self.view.layoutIfNeeded()
443 +// }
444 +// }
409 445
410 - self.infoTopConstraint.constant = 0 446 + // TODO: UNCOMMENT
411 - UIView.animate(withDuration: 1.0) { 447 +// private func hidePinDetailsView() {
412 - self.view.layoutIfNeeded() 448 +// self.selectedMerchant = nil
413 - } 449 +//
414 - } 450 +// self.infoTopConstraint.constant = 0
451 +// UIView.animate(withDuration: 1.0) {
452 +// self.view.layoutIfNeeded()
453 +// }
454 +// }
415 455
416 // map view delegate 456 // map view delegate
417 // public func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? { 457 // public func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
...@@ -469,6 +509,8 @@ import MapKit ...@@ -469,6 +509,8 @@ import MapKit
469 509
470 let logoImageView = UIImageView(frame: CGRect(x: 5, y: 5, width: 35, height: 35)) 510 let logoImageView = UIImageView(frame: CGRect(x: 5, y: 5, width: 35, height: 35))
471 logoImageView.contentMode = .scaleAspectFit 511 logoImageView.contentMode = .scaleAspectFit
512 + logoImageView.layer.cornerRadius = logoImageView.frame.width / 2 // 17.5 // 35 / 2
513 + logoImageView.clipsToBounds = true
472 514
473 let merchant = annotation as? MerchantAnnotation 515 let merchant = annotation as? MerchantAnnotation
474 if let merchantModel = merchant?.model { 516 if let merchantModel = merchant?.model {
...@@ -508,12 +550,14 @@ import MapKit ...@@ -508,12 +550,14 @@ import MapKit
508 let merchantModel = merchant!.model 550 let merchantModel = merchant!.model
509 // logTrackersEvent("click", ("ShopsScreenMarker:" + (merchantModel._uuid))) 551 // logTrackersEvent("click", ("ShopsScreenMarker:" + (merchantModel._uuid)))
510 552
511 - loadPinDetailsView(merchant!) 553 + // TODO: UNCOMMENT
512 - showPinDetailsView() 554 +// loadPinDetailsView(merchant!)
555 +// showPinDetailsView()
513 } 556 }
514 557
515 public func mapView(_ mapView: MKMapView, didDeselect view: MKAnnotationView) { 558 public func mapView(_ mapView: MKMapView, didDeselect view: MKAnnotationView) {
516 - hidePinDetailsView() 559 + // TODO: UNCOMMENT
560 +// hidePinDetailsView()
517 } 561 }
518 } 562 }
519 563
......
...@@ -10,6 +10,12 @@ ...@@ -10,6 +10,12 @@
10 <objects> 10 <objects>
11 <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MapViewController" customModule="SwiftWarplyFramework" customModuleProvider="target"> 11 <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MapViewController" customModule="SwiftWarplyFramework" customModuleProvider="target">
12 <connections> 12 <connections>
13 + <outlet property="filtersImage" destination="h5m-Ai-mxP" id="PxL-fq-f8P"/>
14 + <outlet property="filtersLabel" destination="fve-ha-nql" id="A0I-n9-Vrm"/>
15 + <outlet property="filtersView" destination="Fhh-Lz-Her" id="7Fz-Bo-jJG"/>
16 + <outlet property="headerLabel" destination="zl6-zo-ETD" id="LQm-EV-BE5"/>
17 + <outlet property="mainView" destination="hCU-aG-ygY" id="jJC-9b-4rL"/>
18 + <outlet property="mapView" destination="YL5-4p-PKK" id="Lk7-cv-ev7"/>
13 <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> 19 <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
14 </connections> 20 </connections>
15 </placeholder> 21 </placeholder>
...@@ -21,38 +27,69 @@ ...@@ -21,38 +27,69 @@
21 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hCU-aG-ygY" userLabel="Main View"> 27 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hCU-aG-ygY" userLabel="Main View">
22 <rect key="frame" x="0.0" y="118" width="393" height="734"/> 28 <rect key="frame" x="0.0" y="118" width="393" height="734"/>
23 <subviews> 29 <subviews>
24 - <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="coupons_scrollview_white" translatesAutoresizingMaskIntoConstraints="NO" id="9Ss-50-8lb"> 30 + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gfZ-ow-vhw" userLabel="HeaderView">
25 - <rect key="frame" x="0.0" y="0.0" width="414" height="852"/> 31 + <rect key="frame" x="0.0" y="0.0" width="393" height="89"/>
32 + <subviews>
33 + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zl6-zo-ETD" userLabel="HeaderLabel">
34 + <rect key="frame" x="18" y="0.0" width="357" height="21"/>
35 + <fontDescription key="fontDescription" type="system" pointSize="17"/>
36 + <nil key="textColor"/>
37 + <nil key="highlightedColor"/>
38 + </label>
39 + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Fhh-Lz-Her" userLabel="FiltersView">
40 + <rect key="frame" x="18" y="33" width="105" height="44"/>
41 + <subviews>
42 + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fve-ha-nql" userLabel="FiltersLabel">
43 + <rect key="frame" x="19" y="11.666666666666657" width="42" height="21"/>
44 + <fontDescription key="fontDescription" type="system" pointSize="17"/>
45 + <nil key="textColor"/>
46 + <nil key="highlightedColor"/>
47 + </label>
48 + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="h5m-Ai-mxP" userLabel="Filters Image View">
49 + <rect key="frame" x="75" y="14" width="16" height="16"/>
50 + <constraints>
51 + <constraint firstAttribute="height" constant="16" id="R9w-eV-kjy"/>
52 + <constraint firstAttribute="width" constant="16" id="cpg-C4-oVL"/>
53 + </constraints>
26 </imageView> 54 </imageView>
55 + </subviews>
56 + <color key="backgroundColor" systemColor="systemBackgroundColor"/>
57 + <constraints>
58 + <constraint firstAttribute="height" constant="44" id="0FE-97-MT3"/>
59 + <constraint firstAttribute="trailing" secondItem="h5m-Ai-mxP" secondAttribute="trailing" constant="14" id="7TZ-U6-Oe6"/>
60 + <constraint firstItem="h5m-Ai-mxP" firstAttribute="leading" secondItem="fve-ha-nql" secondAttribute="trailing" constant="14" id="Ykt-kZ-SCd"/>
61 + <constraint firstItem="h5m-Ai-mxP" firstAttribute="centerY" secondItem="Fhh-Lz-Her" secondAttribute="centerY" id="ffd-ln-2Rn"/>
62 + <constraint firstItem="fve-ha-nql" firstAttribute="leading" secondItem="Fhh-Lz-Her" secondAttribute="leading" constant="19" id="gpM-zt-97Q"/>
63 + <constraint firstItem="fve-ha-nql" firstAttribute="centerY" secondItem="Fhh-Lz-Her" secondAttribute="centerY" id="nKc-Oy-o9r"/>
64 + </constraints>
65 + </view>
66 + </subviews>
67 + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
68 + <constraints>
69 + <constraint firstItem="zl6-zo-ETD" firstAttribute="top" secondItem="gfZ-ow-vhw" secondAttribute="top" id="1LE-ZD-h9c"/>
70 + <constraint firstItem="Fhh-Lz-Her" firstAttribute="leading" secondItem="gfZ-ow-vhw" secondAttribute="leading" constant="18" id="9o1-gX-HVH"/>
71 + <constraint firstAttribute="bottom" secondItem="Fhh-Lz-Her" secondAttribute="bottom" constant="12" id="B0X-8d-LAN"/>
72 + <constraint firstAttribute="trailing" secondItem="zl6-zo-ETD" secondAttribute="trailing" constant="18" id="XHZ-7i-bUV"/>
73 + <constraint firstItem="zl6-zo-ETD" firstAttribute="leading" secondItem="gfZ-ow-vhw" secondAttribute="leading" constant="18" id="ZUp-F3-KR2"/>
74 + <constraint firstItem="Fhh-Lz-Her" firstAttribute="top" secondItem="zl6-zo-ETD" secondAttribute="bottom" constant="12" id="h2l-5a-FZk"/>
75 + </constraints>
76 + </view>
27 <mapView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" mapType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="YL5-4p-PKK"> 77 <mapView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" mapType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="YL5-4p-PKK">
28 - <rect key="frame" x="0.0" y="0.0" width="393" height="734"/> 78 + <rect key="frame" x="0.0" y="89" width="393" height="645"/>
29 </mapView> 79 </mapView>
30 - <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="wO4-b0-Lbj">
31 - <rect key="frame" x="0.0" y="420" width="414" height="11.5"/>
32 - </imageView>
33 </subviews> 80 </subviews>
34 - <color key="backgroundColor" systemColor="systemBackgroundColor"/> 81 + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
35 <constraints> 82 <constraints>
36 - <constraint firstItem="wO4-b0-Lbj" firstAttribute="top" secondItem="hCU-aG-ygY" secondAttribute="top" id="7Sp-xV-6LO"/> 83 + <constraint firstItem="YL5-4p-PKK" firstAttribute="top" secondItem="gfZ-ow-vhw" secondAttribute="bottom" id="4LY-VU-KPk"/>
37 <constraint firstAttribute="bottom" secondItem="YL5-4p-PKK" secondAttribute="bottom" id="AXy-Mh-nYV"/> 84 <constraint firstAttribute="bottom" secondItem="YL5-4p-PKK" secondAttribute="bottom" id="AXy-Mh-nYV"/>
38 - <constraint firstItem="wO4-b0-Lbj" firstAttribute="leading" secondItem="hCU-aG-ygY" secondAttribute="leading" id="Gfx-j2-M85"/> 85 + <constraint firstItem="gfZ-ow-vhw" firstAttribute="leading" secondItem="hCU-aG-ygY" secondAttribute="leading" id="Ffi-wk-Gwj"/>
39 - <constraint firstAttribute="bottom" secondItem="9Ss-50-8lb" secondAttribute="bottom" id="Ou1-x0-kmw"/>
40 - <constraint firstAttribute="trailing" secondItem="9Ss-50-8lb" secondAttribute="trailing" id="WVl-E8-L8A"/>
41 <constraint firstItem="YL5-4p-PKK" firstAttribute="leading" secondItem="hCU-aG-ygY" secondAttribute="leading" id="Zit-4v-Yuu"/> 86 <constraint firstItem="YL5-4p-PKK" firstAttribute="leading" secondItem="hCU-aG-ygY" secondAttribute="leading" id="Zit-4v-Yuu"/>
42 - <constraint firstItem="9Ss-50-8lb" firstAttribute="leading" secondItem="hCU-aG-ygY" secondAttribute="leading" id="miC-Sr-KkR"/>
43 <constraint firstAttribute="trailing" secondItem="YL5-4p-PKK" secondAttribute="trailing" id="nif-Bx-zgh"/> 87 <constraint firstAttribute="trailing" secondItem="YL5-4p-PKK" secondAttribute="trailing" id="nif-Bx-zgh"/>
44 - <constraint firstItem="YL5-4p-PKK" firstAttribute="top" secondItem="hCU-aG-ygY" secondAttribute="top" id="pyA-tM-UhQ"/> 88 + <constraint firstAttribute="trailing" secondItem="gfZ-ow-vhw" secondAttribute="trailing" id="qDt-sW-etJ"/>
45 - <constraint firstItem="9Ss-50-8lb" firstAttribute="top" secondItem="hCU-aG-ygY" secondAttribute="top" id="qVD-4w-XZ6"/> 89 + <constraint firstItem="gfZ-ow-vhw" firstAttribute="top" secondItem="hCU-aG-ygY" secondAttribute="top" id="srO-Ke-wyK"/>
46 - <constraint firstAttribute="trailing" secondItem="wO4-b0-Lbj" secondAttribute="trailing" id="urK-JF-3MF"/>
47 </constraints> 90 </constraints>
48 - <variation key="default">
49 - <mask key="subviews">
50 - <exclude reference="9Ss-50-8lb"/>
51 - <exclude reference="wO4-b0-Lbj"/>
52 - </mask>
53 - </variation>
54 </view> 91 </view>
55 - <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PAK-cJ-dw4"> 92 + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PAK-cJ-dw4" userLabel="DetailsView">
56 <rect key="frame" x="0.0" y="532" width="383" height="320"/> 93 <rect key="frame" x="0.0" y="532" width="383" height="320"/>
57 <subviews> 94 <subviews>
58 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="INTERSPORT" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1JT-2j-Bcy" userLabel="Title"> 95 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="INTERSPORT" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1JT-2j-Bcy" userLabel="Title">
...@@ -204,11 +241,15 @@ ...@@ -204,11 +241,15 @@
204 <constraint firstItem="PAK-cJ-dw4" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="RpT-Pg-Mld"/> 241 <constraint firstItem="PAK-cJ-dw4" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="RpT-Pg-Mld"/>
205 <constraint firstItem="hCU-aG-ygY" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="Tgj-nb-Tww"/> 242 <constraint firstItem="hCU-aG-ygY" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="Tgj-nb-Tww"/>
206 </constraints> 243 </constraints>
244 + <variation key="default">
245 + <mask key="subviews">
246 + <exclude reference="PAK-cJ-dw4"/>
247 + </mask>
248 + </variation>
207 <point key="canvasLocation" x="65" y="154"/> 249 <point key="canvasLocation" x="65" y="154"/>
208 </view> 250 </view>
209 </objects> 251 </objects>
210 <resources> 252 <resources>
211 - <image name="coupons_scrollview_white" width="214" height="462"/>
212 <image name="ic_address" width="12.5" height="17"/> 253 <image name="ic_address" width="12.5" height="17"/>
213 <image name="ic_close_3" width="11.333333015441895" height="11.666666984558105"/> 254 <image name="ic_close_3" width="11.333333015441895" height="11.666666984558105"/>
214 <image name="ic_phone" width="15.5" height="15.5"/> 255 <image name="ic_phone" width="15.5" height="15.5"/>
......