Showing
5 changed files
with
304 additions
and
5 deletions
No preview for this file type
... | @@ -254,9 +254,123 @@ | ... | @@ -254,9 +254,123 @@ |
254 | <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oun-2v-J2R"> | 254 | <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oun-2v-J2R"> |
255 | <rect key="frame" x="0.0" y="5" width="414" height="847"/> | 255 | <rect key="frame" x="0.0" y="5" width="414" height="847"/> |
256 | <subviews> | 256 | <subviews> |
257 | - <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="KGv-uL-Ge0"> | 257 | + <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="KGv-uL-Ge0" userLabel="ScrollContentView"> |
258 | <rect key="frame" x="0.0" y="0.0" width="414" height="852"/> | 258 | <rect key="frame" x="0.0" y="0.0" width="414" height="852"/> |
259 | - <color key="backgroundColor" systemColor="systemBackgroundColor"/> | 259 | + <subviews> |
260 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fHd-ff-Sbn"> | ||
261 | + <rect key="frame" x="17" y="23" width="380" height="513.5"/> | ||
262 | + <subviews> | ||
263 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="SUPERMARKET DEALS CARD" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ffU-yH-vAL"> | ||
264 | + <rect key="frame" x="26" y="26" width="328" height="27"/> | ||
265 | + <fontDescription key="fontDescription" name="BTCosmo-Bold" family="BTCosmo" pointSize="23"/> | ||
266 | + <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
267 | + <nil key="highlightedColor"/> | ||
268 | + </label> | ||
269 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Χρησιμοποίησε τον κωδικό σου και κέρδισε έκπτωση στις αγορές σου!" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FCo-jy-FmB"> | ||
270 | + <rect key="frame" x="26" y="69" width="328" height="42"/> | ||
271 | + <fontDescription key="fontDescription" name="PeridotPE-Regular" family="Peridot PE" pointSize="17"/> | ||
272 | + <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
273 | + <nil key="highlightedColor"/> | ||
274 | + </label> | ||
275 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="74w-a6-uZN"> | ||
276 | + <rect key="frame" x="26" y="154" width="328" height="157.5"/> | ||
277 | + <subviews> | ||
278 | + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="cBT-1y-9Lf"> | ||
279 | + <rect key="frame" x="24" y="5" width="280" height="110"/> | ||
280 | + <constraints> | ||
281 | + <constraint firstAttribute="height" constant="110" id="wRW-6H-VVs"/> | ||
282 | + </constraints> | ||
283 | + </imageView> | ||
284 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="123456789101112" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="t9R-7Y-Vtc"> | ||
285 | + <rect key="frame" x="24" y="120" width="280" height="23.5"/> | ||
286 | + <fontDescription key="fontDescription" name="PeridotPE-Regular" family="Peridot PE" pointSize="19"/> | ||
287 | + <color key="textColor" red="0.12941176470588234" green="0.12941176470588234" blue="0.12941176470588234" alpha="1" colorSpace="calibratedRGB"/> | ||
288 | + <nil key="highlightedColor"/> | ||
289 | + </label> | ||
290 | + </subviews> | ||
291 | + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
292 | + <constraints> | ||
293 | + <constraint firstAttribute="bottom" secondItem="t9R-7Y-Vtc" secondAttribute="bottom" constant="14" id="7Gs-Xt-tEk"/> | ||
294 | + <constraint firstItem="t9R-7Y-Vtc" firstAttribute="leading" secondItem="74w-a6-uZN" secondAttribute="leading" constant="24" id="EMV-Jb-qHB"/> | ||
295 | + <constraint firstItem="cBT-1y-9Lf" firstAttribute="leading" secondItem="74w-a6-uZN" secondAttribute="leading" constant="24" id="H1v-Jp-swv"/> | ||
296 | + <constraint firstItem="cBT-1y-9Lf" firstAttribute="top" secondItem="74w-a6-uZN" secondAttribute="top" constant="5" id="HNu-o6-iVE"/> | ||
297 | + <constraint firstAttribute="trailing" secondItem="t9R-7Y-Vtc" secondAttribute="trailing" constant="24" id="Xaf-UD-VtU"/> | ||
298 | + <constraint firstAttribute="trailing" secondItem="cBT-1y-9Lf" secondAttribute="trailing" constant="24" id="Y9j-dK-7vP"/> | ||
299 | + <constraint firstItem="t9R-7Y-Vtc" firstAttribute="top" secondItem="cBT-1y-9Lf" secondAttribute="bottom" constant="5" id="ikJ-FV-oka"/> | ||
300 | + </constraints> | ||
301 | + </view> | ||
302 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HCl-ht-lub" userLabel="CouponsValueView"> | ||
303 | + <rect key="frame" x="0.0" y="348.5" width="380" height="53"/> | ||
304 | + <subviews> | ||
305 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Έχεις κουπόνια συνολικής αξίας 30€" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Zk5-FL-kMS"> | ||
306 | + <rect key="frame" x="26" y="16" width="328" height="21"/> | ||
307 | + <fontDescription key="fontDescription" name="PeridotPE-Regular" family="Peridot PE" pointSize="17"/> | ||
308 | + <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
309 | + <nil key="highlightedColor"/> | ||
310 | + </label> | ||
311 | + </subviews> | ||
312 | + <color key="backgroundColor" red="0.0" green="0.42745098039215684" blue="0.14901960784313725" alpha="1" colorSpace="calibratedRGB"/> | ||
313 | + <constraints> | ||
314 | + <constraint firstAttribute="trailing" secondItem="Zk5-FL-kMS" secondAttribute="trailing" constant="26" id="8gj-ca-QKO"/> | ||
315 | + <constraint firstAttribute="bottom" secondItem="Zk5-FL-kMS" secondAttribute="bottom" constant="16" id="OLu-Uk-BON"/> | ||
316 | + <constraint firstItem="Zk5-FL-kMS" firstAttribute="leading" secondItem="HCl-ht-lub" secondAttribute="leading" constant="26" id="Z7D-V4-kqB"/> | ||
317 | + <constraint firstItem="Zk5-FL-kMS" firstAttribute="top" secondItem="HCl-ht-lub" secondAttribute="top" constant="16" id="v5u-PM-u2n"/> | ||
318 | + </constraints> | ||
319 | + </view> | ||
320 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="O1Z-nB-jp1"> | ||
321 | + <rect key="frame" x="0.0" y="401.5" width="380" height="112"/> | ||
322 | + <subviews> | ||
323 | + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="e1L-dV-0yr"> | ||
324 | + <rect key="frame" x="220" y="32" width="148" height="48"/> | ||
325 | + <constraints> | ||
326 | + <constraint firstAttribute="width" constant="148" id="NeR-8S-lKC"/> | ||
327 | + <constraint firstAttribute="height" constant="48" id="gGB-C6-ohH"/> | ||
328 | + </constraints> | ||
329 | + <fontDescription key="fontDescription" name="PeridotPE-SBold" family="Peridot PE" pointSize="16"/> | ||
330 | + <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> | ||
331 | + <state key="normal" title="Δες στο χάρτη"> | ||
332 | + <color key="titleColor" red="0.0" green="0.42745098039215684" blue="0.14901960784313725" alpha="1" colorSpace="calibratedRGB"/> | ||
333 | + </state> | ||
334 | + <connections> | ||
335 | + <action selector="mapButtonAction:" destination="Bfc-KW-c8g" eventType="touchUpInside" id="LTM-Hq-t5C"/> | ||
336 | + </connections> | ||
337 | + </button> | ||
338 | + </subviews> | ||
339 | + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
340 | + <constraints> | ||
341 | + <constraint firstAttribute="height" constant="112" id="IBa-kj-ffe"/> | ||
342 | + <constraint firstAttribute="trailing" secondItem="e1L-dV-0yr" secondAttribute="trailing" constant="12" id="P7n-g7-oYc"/> | ||
343 | + <constraint firstItem="e1L-dV-0yr" firstAttribute="centerY" secondItem="O1Z-nB-jp1" secondAttribute="centerY" id="nw3-AE-gGT"/> | ||
344 | + </constraints> | ||
345 | + </view> | ||
346 | + </subviews> | ||
347 | + <color key="backgroundColor" red="0.21176470588235294" green="0.70196078431372544" blue="0.16862745098039217" alpha="1" colorSpace="calibratedRGB"/> | ||
348 | + <constraints> | ||
349 | + <constraint firstAttribute="trailing" secondItem="74w-a6-uZN" secondAttribute="trailing" constant="26" id="Gda-fs-RTg"/> | ||
350 | + <constraint firstAttribute="trailing" secondItem="HCl-ht-lub" secondAttribute="trailing" id="J53-eS-6Fr"/> | ||
351 | + <constraint firstItem="HCl-ht-lub" firstAttribute="leading" secondItem="fHd-ff-Sbn" secondAttribute="leading" id="V74-1z-3qe"/> | ||
352 | + <constraint firstAttribute="bottom" secondItem="O1Z-nB-jp1" secondAttribute="bottom" id="VQE-kR-d20"/> | ||
353 | + <constraint firstItem="74w-a6-uZN" firstAttribute="top" secondItem="FCo-jy-FmB" secondAttribute="bottom" constant="43" id="Y4U-h7-vhS"/> | ||
354 | + <constraint firstAttribute="trailing" secondItem="O1Z-nB-jp1" secondAttribute="trailing" id="a7K-Cs-70c"/> | ||
355 | + <constraint firstAttribute="trailing" secondItem="FCo-jy-FmB" secondAttribute="trailing" constant="26" id="cmO-N9-ava"/> | ||
356 | + <constraint firstItem="74w-a6-uZN" firstAttribute="leading" secondItem="fHd-ff-Sbn" secondAttribute="leading" constant="26" id="dgM-id-huG"/> | ||
357 | + <constraint firstItem="FCo-jy-FmB" firstAttribute="leading" secondItem="fHd-ff-Sbn" secondAttribute="leading" constant="26" id="dtM-80-fIm"/> | ||
358 | + <constraint firstItem="ffU-yH-vAL" firstAttribute="top" secondItem="fHd-ff-Sbn" secondAttribute="top" constant="26" id="h8l-cx-6Dh"/> | ||
359 | + <constraint firstItem="ffU-yH-vAL" firstAttribute="leading" secondItem="fHd-ff-Sbn" secondAttribute="leading" constant="26" id="m6I-Tr-IxO"/> | ||
360 | + <constraint firstItem="O1Z-nB-jp1" firstAttribute="top" secondItem="HCl-ht-lub" secondAttribute="bottom" id="mSE-RN-mKo"/> | ||
361 | + <constraint firstItem="HCl-ht-lub" firstAttribute="top" secondItem="74w-a6-uZN" secondAttribute="bottom" constant="37" id="nH4-Uc-bF8"/> | ||
362 | + <constraint firstAttribute="trailing" secondItem="ffU-yH-vAL" secondAttribute="trailing" constant="26" id="o7F-J6-nRj"/> | ||
363 | + <constraint firstItem="FCo-jy-FmB" firstAttribute="top" secondItem="ffU-yH-vAL" secondAttribute="bottom" constant="16" id="r7m-We-OPk"/> | ||
364 | + <constraint firstItem="O1Z-nB-jp1" firstAttribute="leading" secondItem="fHd-ff-Sbn" secondAttribute="leading" id="rr3-UJ-IZH"/> | ||
365 | + </constraints> | ||
366 | + </view> | ||
367 | + </subviews> | ||
368 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
369 | + <constraints> | ||
370 | + <constraint firstItem="fHd-ff-Sbn" firstAttribute="top" secondItem="KGv-uL-Ge0" secondAttribute="top" constant="23" id="fmk-oC-KTp"/> | ||
371 | + <constraint firstItem="fHd-ff-Sbn" firstAttribute="leading" secondItem="KGv-uL-Ge0" secondAttribute="leading" constant="17" id="q32-2Z-teN"/> | ||
372 | + <constraint firstAttribute="trailing" secondItem="fHd-ff-Sbn" secondAttribute="trailing" constant="17" id="twj-up-7fO"/> | ||
373 | + </constraints> | ||
260 | </view> | 374 | </view> |
261 | </subviews> | 375 | </subviews> |
262 | <constraints> | 376 | <constraints> |
... | @@ -270,7 +384,7 @@ | ... | @@ -270,7 +384,7 @@ |
270 | <viewLayoutGuide key="frameLayoutGuide" id="Kjy-EG-FD1"/> | 384 | <viewLayoutGuide key="frameLayoutGuide" id="Kjy-EG-FD1"/> |
271 | </scrollView> | 385 | </scrollView> |
272 | </subviews> | 386 | </subviews> |
273 | - <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | 387 | + <color key="backgroundColor" red="0.94901960784313721" green="0.94901960784313721" blue="0.95294117647058818" alpha="1" colorSpace="calibratedRGB"/> |
274 | <constraints> | 388 | <constraints> |
275 | <constraint firstAttribute="trailing" secondItem="oun-2v-J2R" secondAttribute="trailing" id="DQh-TZ-hwy"/> | 389 | <constraint firstAttribute="trailing" secondItem="oun-2v-J2R" secondAttribute="trailing" id="DQh-TZ-hwy"/> |
276 | <constraint firstAttribute="bottom" secondItem="oun-2v-J2R" secondAttribute="bottom" id="PDI-hS-9rn"/> | 390 | <constraint firstAttribute="bottom" secondItem="oun-2v-J2R" secondAttribute="bottom" id="PDI-hS-9rn"/> |
... | @@ -289,6 +403,18 @@ | ... | @@ -289,6 +403,18 @@ |
289 | <constraint firstItem="ksI-Hs-G6N" firstAttribute="top" secondItem="KM1-nK-03C" secondAttribute="top" id="lkT-fB-i8c"/> | 403 | <constraint firstItem="ksI-Hs-G6N" firstAttribute="top" secondItem="KM1-nK-03C" secondAttribute="top" id="lkT-fB-i8c"/> |
290 | </constraints> | 404 | </constraints> |
291 | </view> | 405 | </view> |
406 | + <connections> | ||
407 | + <outlet property="barcodeImage" destination="cBT-1y-9Lf" id="J4q-vw-mVA"/> | ||
408 | + <outlet property="barcodeImageHeight" destination="wRW-6H-VVs" id="i8x-Zn-qwi"/> | ||
409 | + <outlet property="barcodeLabel" destination="t9R-7Y-Vtc" id="B7d-uM-D7O"/> | ||
410 | + <outlet property="barcodeView" destination="74w-a6-uZN" id="O6D-r9-BQX"/> | ||
411 | + <outlet property="couponsValueLabel" destination="Zk5-FL-kMS" id="Xbr-Ue-SGh"/> | ||
412 | + <outlet property="mapButton" destination="e1L-dV-0yr" id="JuF-oZ-Ikm"/> | ||
413 | + <outlet property="passContainerView" destination="fHd-ff-Sbn" id="bDj-nf-kx4"/> | ||
414 | + <outlet property="passSubtitleLabel" destination="FCo-jy-FmB" id="r0N-jp-bz0"/> | ||
415 | + <outlet property="passTitleLabel" destination="ffU-yH-vAL" id="ScX-Ws-3dT"/> | ||
416 | + <outlet property="smLogosView" destination="O1Z-nB-jp1" id="2Kx-7S-VYb"/> | ||
417 | + </connections> | ||
292 | </viewController> | 418 | </viewController> |
293 | <placeholder placeholderIdentifier="IBFirstResponder" id="L3t-gP-tua" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/> | 419 | <placeholder placeholderIdentifier="IBFirstResponder" id="L3t-gP-tua" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/> |
294 | </objects> | 420 | </objects> | ... | ... |
... | @@ -10,6 +10,18 @@ import RSBarcodes_Swift | ... | @@ -10,6 +10,18 @@ import RSBarcodes_Swift |
10 | import AVFoundation | 10 | import AVFoundation |
11 | 11 | ||
12 | @objc public class MarketPassViewController: UIViewController { | 12 | @objc public class MarketPassViewController: UIViewController { |
13 | + @IBOutlet weak var passContainerView: UIView! | ||
14 | + @IBOutlet weak var passTitleLabel: UILabel! | ||
15 | + @IBOutlet weak var passSubtitleLabel: UILabel! | ||
16 | + @IBOutlet weak var barcodeView: UIView! | ||
17 | + @IBOutlet weak var barcodeImage: UIImageView! | ||
18 | + @IBOutlet weak var barcodeImageHeight: NSLayoutConstraint! | ||
19 | + @IBOutlet weak var barcodeLabel: UILabel! | ||
20 | + @IBOutlet weak var couponsValueLabel: UILabel! | ||
21 | + @IBOutlet weak var smLogosView: UIView! | ||
22 | + @IBOutlet weak var mapButton: UIButton! | ||
23 | + | ||
24 | + let uiscreen: CGRect = UIScreen.main.bounds | ||
13 | 25 | ||
14 | public override func viewDidLoad() { | 26 | public override func viewDidLoad() { |
15 | super.viewDidLoad() | 27 | super.viewDidLoad() |
... | @@ -21,8 +33,13 @@ import AVFoundation | ... | @@ -21,8 +33,13 @@ import AVFoundation |
21 | // Setup the info button with an action | 33 | // Setup the info button with an action |
22 | setNavBarRightInfoButton() { | 34 | setNavBarRightInfoButton() { |
23 | // This closure is the action that will be executed when the info button is tapped | 35 | // This closure is the action that will be executed when the info button is tapped |
24 | -// self.presentInfoPopup() | 36 | + |
37 | + let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | ||
38 | + let vc = storyboard.instantiateViewController(withIdentifier: "MarketPassInfoViewController") as! SwiftWarplyFramework.MarketPassInfoViewController | ||
39 | + self.navigationController?.pushViewController(vc, animated: true) | ||
25 | } | 40 | } |
41 | + | ||
42 | + setupUI() | ||
26 | } | 43 | } |
27 | 44 | ||
28 | public override func viewWillAppear(_ animated: Bool) { | 45 | public override func viewWillAppear(_ animated: Bool) { |
... | @@ -33,4 +50,151 @@ import AVFoundation | ... | @@ -33,4 +50,151 @@ import AVFoundation |
33 | self.navigationController?.hideHairline() | 50 | self.navigationController?.hideHairline() |
34 | } | 51 | } |
35 | 52 | ||
53 | + // MARK: - Functions | ||
54 | + func setupUI() { | ||
55 | + passContainerView.backgroundColor = UIColor(rgb: 0x36B32B) | ||
56 | + passContainerView.layer.cornerRadius = 16.0 | ||
57 | + // Add shadow | ||
58 | + passContainerView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.31).cgColor | ||
59 | + passContainerView.layer.shadowOffset = CGSize(width: 0.0, height: 1.0) | ||
60 | + passContainerView.layer.shadowOpacity = 1.0 | ||
61 | + passContainerView.layer.shadowRadius = 3.0 | ||
62 | + | ||
63 | + passTitleLabel.text = "SUPERMARKET DEALS CARD" | ||
64 | +// passTitleLabel.font = UIFont(name: "BTCosmo-Bold", size: 23) | ||
65 | + passTitleLabel.font = UIFont(name: "BTCosmo-Bold", size: 22) | ||
66 | + passTitleLabel.textColor = .white | ||
67 | + | ||
68 | + passSubtitleLabel.text = "Χρησιμοποίησε τον κωδικό σου και κέρδισε έκπτωση στις αγορές σου!" | ||
69 | + passSubtitleLabel.font = UIFont(name: "PeridotPE-Regular", size: 17.0) | ||
70 | + passSubtitleLabel.textColor = .white | ||
71 | + | ||
72 | + barcodeView.backgroundColor = .white | ||
73 | + barcodeView.layer.cornerRadius = 16.0 | ||
74 | + barcodeView.layer.borderWidth = 2 | ||
75 | + barcodeView.layer.borderColor = UIColor(rgb: 0xDADDE4).cgColor | ||
76 | + | ||
77 | + //TODO: FIX | ||
78 | +// let barcodeString = constructBarcode(coupon: coupon) ?? "" | ||
79 | +// let barcodeString = coupon?._barcode ?? "" | ||
80 | + let barcodeString = "4006381333931" | ||
81 | + barcodeLabel.text = barcodeString | ||
82 | + barcodeLabel.font = UIFont(name: "PeridotPE-Regular", size: 19.0) | ||
83 | + barcodeLabel.textColor = UIColor(rgb: 0x212121) | ||
84 | + | ||
85 | + if let barcodeUIImage = RSUnifiedCodeGenerator.shared.generateCode(barcodeString, machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue, targetSize: CGSize(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.12)) { | ||
86 | +// if let barcodeUIImage = RSUnifiedCodeGenerator.shared.generateCode(barcodeString, machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue, targetSize: CGSize(width: 110, height: 83)) { | ||
87 | + barcodeImage.image = barcodeUIImage | ||
88 | + | ||
89 | + barcodeImageHeight.constant = self.uiscreen.height * 0.12 | ||
90 | +// barcodeImageHeight.constant = 83 | ||
91 | + | ||
92 | + } else { | ||
93 | + barcodeImageHeight.constant = 0 | ||
94 | + } | ||
95 | + | ||
96 | + // TODO: FIX | ||
97 | + let couponsValueString = "30" | ||
98 | + let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Regular", size: 17) ?? UIFont.systemFont(ofSize: 16), NSAttributedString.Key.foregroundColor: UIColor.white] | ||
99 | + let attrBold = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Bold", size: 17) ?? UIFont.boldSystemFont(ofSize: 16), NSAttributedString.Key.foregroundColor: UIColor.white] | ||
100 | + | ||
101 | + let couponsValueNormalText1 = "Έχεις κουπόνια συνολικής αξίας " | ||
102 | + let couponsValueBoldText = couponsValueString + "€" | ||
103 | + | ||
104 | + let couponsValueAttributedString = NSMutableAttributedString(string:couponsValueNormalText1, attributes:attrRegular) | ||
105 | + let couponsValueBoldString = NSMutableAttributedString(string: couponsValueBoldText, attributes:attrBold) | ||
106 | + | ||
107 | + couponsValueAttributedString.append(couponsValueBoldString) | ||
108 | + couponsValueLabel.attributedText = couponsValueAttributedString | ||
109 | + | ||
110 | + mapButton.titleLabel?.font = UIFont(name: "PeridotPE-SBold", size: 16) | ||
111 | + mapButton.setTitle("Δες στο χάρτη", for: .normal) | ||
112 | + mapButton.setTitleColor(UIColor(rgb: 0x006D26), for: .normal) | ||
113 | + mapButton.layer.cornerRadius = 10.0 | ||
114 | + mapButton.frame = CGRect(x: 0.0, y: 0.0, width: 148, height: 48) | ||
115 | +// mapButton.frame = CGRect(x: 0.0, y: 0.0, width: mapButton.intrinsicContentSize.width, height: 55) | ||
116 | +// mapButton.contentEdgeInsets = UIEdgeInsets(top: 0, left: 25, bottom: 0, right: 25) | ||
117 | + mapButton.backgroundColor = .clear | ||
118 | + mapButton.layer.borderWidth = 2 | ||
119 | + mapButton.layer.borderColor = UIColor(rgb: 0x006D26).cgColor | ||
120 | + | ||
121 | + smLogosView.layer.cornerRadius = 16.0 | ||
122 | + smLogosView.layer.maskedCorners = [ .layerMinXMaxYCorner, .layerMaxXMaxYCorner] // Bottom left, right corner radius | ||
123 | + | ||
124 | + // TODO: FIX - Replace with dynamic images | ||
125 | + let imageNames = ["active_code_logo_2", "active_code_logo_2", "active_code_logo_2"] | ||
126 | +// let images = imageNames.compactMap { UIImage(named: $0) } | ||
127 | + let images = imageNames.compactMap { UIImage(named: $0, in: MyEmptyClass.resourceBundle(), compatibleWith: nil) } | ||
128 | + | ||
129 | + // Create a horizontal stack view | ||
130 | + let stackView = UIStackView() | ||
131 | + stackView.axis = .horizontal | ||
132 | + stackView.spacing = 15 // Spacing between images | ||
133 | + stackView.alignment = .center | ||
134 | + stackView.distribution = .equalSpacing | ||
135 | + | ||
136 | + // Add UIImageViews to the stack view | ||
137 | + for image in images { | ||
138 | + let imageView = UIImageView(image: image) | ||
139 | + imageView.contentMode = .scaleAspectFit | ||
140 | + imageView.widthAnchor.constraint(equalToConstant: 40).isActive = true // Set a width | ||
141 | + imageView.heightAnchor.constraint(equalToConstant: 40).isActive = true // Set a height | ||
142 | + stackView.addArrangedSubview(imageView) | ||
143 | + } | ||
144 | + | ||
145 | + // Add the stack view to your main view | ||
146 | + smLogosView.addSubview(stackView) | ||
147 | + | ||
148 | + // Set up constraints for the stack view | ||
149 | + stackView.translatesAutoresizingMaskIntoConstraints = false | ||
150 | + NSLayoutConstraint.activate([ | ||
151 | + stackView.leadingAnchor.constraint(equalTo: smLogosView.leadingAnchor, constant: 25), | ||
152 | + stackView.centerYAnchor.constraint(equalTo: smLogosView.centerYAnchor), | ||
153 | + ]) | ||
154 | + } | ||
155 | + | ||
156 | + func constructBarcode() -> String? { | ||
157 | + // EAN 13 barcode construction | ||
158 | + //TODO: FIX | ||
159 | +// let couponString = coupon?._barcode ?? "" | ||
160 | + let couponString = "123456789101112" | ||
161 | + | ||
162 | + if (!couponString.isEmpty) { | ||
163 | + var checkDigit = 0; | ||
164 | + var result = 0; | ||
165 | + | ||
166 | + var fixedCouponCode = couponString; | ||
167 | + if (fixedCouponCode.count < 12) { | ||
168 | + let loops = 12 - fixedCouponCode.count; | ||
169 | + var zerosStr = ""; | ||
170 | + for i in 0 ..< loops { | ||
171 | + zerosStr += "0" | ||
172 | + } | ||
173 | + // fixedCouponCode = zerosStr + fixedCouponCode; | ||
174 | + fixedCouponCode = fixedCouponCode + zerosStr; | ||
175 | + } | ||
176 | + | ||
177 | + var multiplier = 3; | ||
178 | + for idx in (0 ... (fixedCouponCode.count - 1)).reversed() { | ||
179 | + let curChar = fixedCouponCode[idx]; | ||
180 | + result += (Int(curChar) ?? 0) * multiplier; | ||
181 | + multiplier = multiplier == 3 ? 1 : 3; | ||
182 | + } | ||
183 | + checkDigit = 10 - (result % 10); | ||
184 | + | ||
185 | + let barcodeStr = fixedCouponCode + String(checkDigit); | ||
186 | + return barcodeStr; | ||
187 | + } | ||
188 | + | ||
189 | + return "" | ||
190 | + } | ||
191 | + | ||
192 | + // MARK: - Actions | ||
193 | + @IBAction func mapButtonAction(_ sender: Any) { | ||
194 | + let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | ||
195 | + let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController | ||
196 | + vc.campaignUrl = swiftApi().getMarketPassMapUrl() | ||
197 | + self.navigationController?.pushViewController(vc, animated: true) | ||
198 | + } | ||
199 | + | ||
36 | } | 200 | } | ... | ... |
... | @@ -170,7 +170,8 @@ extension WalletActiveCouponsScrollTableViewCell: UICollectionViewDataSource,UIC | ... | @@ -170,7 +170,8 @@ extension WalletActiveCouponsScrollTableViewCell: UICollectionViewDataSource,UIC |
170 | swiftApi().logTrackersEvent("click", ("LoyaltyWalletScreen:" + "ActiveMarketBanner")) | 170 | swiftApi().logTrackersEvent("click", ("LoyaltyWalletScreen:" + "ActiveMarketBanner")) |
171 | 171 | ||
172 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | 172 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) |
173 | - let vc = storyboard.instantiateViewController(withIdentifier: "UnifiedCouponsViewController") as! SwiftWarplyFramework.UnifiedCouponsViewController | 173 | + // let vc = storyboard.instantiateViewController(withIdentifier: "UnifiedCouponsViewController") as! SwiftWarplyFramework.UnifiedCouponsViewController |
174 | + let vc = storyboard.instantiateViewController(withIdentifier: "MarketPassViewController") as! SwiftWarplyFramework.MarketPassViewController | ||
174 | parent?.navigationController?.pushViewController(vc, animated: true) | 175 | parent?.navigationController?.pushViewController(vc, animated: true) |
175 | 176 | ||
176 | } else if (badgeId == "gfy") { | 177 | } else if (badgeId == "gfy") { | ... | ... |
... | @@ -9357,5 +9357,13 @@ public class swiftApi { | ... | @@ -9357,5 +9357,13 @@ public class swiftApi { |
9357 | } | 9357 | } |
9358 | } | 9358 | } |
9359 | 9359 | ||
9360 | + public func getMarketPassMapUrl() -> String { | ||
9361 | + let appUuid = swiftApi().getAppUuid() | ||
9362 | + if (appUuid == "f83dfde1145e4c2da69793abb2f579af") { | ||
9363 | + return "https://dev.supermarketdeals.eu/map" | ||
9364 | + } else { | ||
9365 | + return "https://supermarketdeals.eu/map" | ||
9366 | + } | ||
9367 | + } | ||
9360 | 9368 | ||
9361 | } | 9369 | } | ... | ... |
-
Please register or login to post a comment