Manos Chorianopoulos

add toggleBarcode btn at CouponBarcodeVC

......@@ -7,7 +7,7 @@
<key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
</dict>
</dict>
......
......@@ -7,7 +7,7 @@
<key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>
......
......@@ -23,15 +23,25 @@ import AVFoundation
@IBOutlet weak var barcodeImage: UIImageView!
@IBOutlet weak var barcodeImageHeight: NSLayoutConstraint!
@IBOutlet weak var barcodeLabel: UILabel!
@IBOutlet weak var barcodeLabelHeight: NSLayoutConstraint!
@IBOutlet weak var showBarcodeButton: UIButton!
@IBOutlet weak var expirationLabel: UILabel!
@IBOutlet weak var redeemButton: UIButton!
@IBOutlet weak var termsButton: UIButton!
@IBOutlet weak var termsTextView: UITextView!
@IBOutlet weak var termsTextViewHeight: NSLayoutConstraint!
@IBOutlet weak var borderViewHeight: NSLayoutConstraint!
@IBOutlet weak var borderView2Height: NSLayoutConstraint!
@IBOutlet weak var border1TopSpace: NSLayoutConstraint!
@IBOutlet weak var barcodeImageTopSpace: NSLayoutConstraint!
@IBOutlet weak var barcodeLabelTopSpace: NSLayoutConstraint!
@IBOutlet weak var border2TopSpace: NSLayoutConstraint!
@IBOutlet weak var mapButton: UIButton!
let uiscreen: CGRect = UIScreen.main.bounds
var termsVisible: Bool = false;
var barcodeVisible: Bool = false;
public var coupon: swiftApi.CouponItemModel?
......@@ -83,6 +93,12 @@ import AVFoundation
redeemButton.setTitleColor(.white, for: .normal)
redeemButton.backgroundColor = UIColor(red: 0.47, green: 0.75, blue: 0.08, alpha: 1.00)
redeemButton.layer.cornerRadius = 12.0
mapButton.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .semibold)
mapButton.setTitle("Δες τα καταστήματα", for: .normal)
mapButton.setTitleColor(UIColor(red: 0.31, green: 0.62, blue: 0.18, alpha: 1.00), for: .normal)
mapButton.backgroundColor = UIColor(red: 0.90, green: 0.90, blue: 0.90, alpha: 1.00)
mapButton.layer.cornerRadius = 12.0
termsButton.titleLabel?.font = .systemFont(ofSize: 15.0, weight: .medium)
// termsButton.imageView?.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5)
......@@ -102,6 +118,7 @@ import AVFoundation
termsTextView.isScrollEnabled = false
toggleTerms()
toggleBarcode()
// Logs
print("Coupon: " + (coupon?.coupon ?? ""))
......@@ -126,6 +143,48 @@ import AVFoundation
termsButton.setImage(UIImage(named: "ic_down_dark.png", in: Bundle(for: MyEmptyClass.self), compatibleWith: nil), for: .normal)
}
}
func toggleBarcode() {
if (barcodeVisible) {
barcodeImage.isHidden = false
if (barcodeImage.image == nil) {
barcodeImageHeight.constant = CGFloat(0)
} else {
barcodeImageHeight.constant = self.uiscreen.height * 0.1
}
barcodeLabel.isHidden = false
let targetSize = CGSize(width: barcodeLabel.frame.width, height: CGFloat(MAXFLOAT))
barcodeLabelHeight.constant = barcodeLabel.sizeThatFits(targetSize).height
borderViewHeight.constant = CGFloat(1)
borderView2Height.constant = CGFloat(1)
border1TopSpace.constant = CGFloat(20) // 20
barcodeImageTopSpace.constant = CGFloat(10) // 10
barcodeLabelTopSpace.constant = CGFloat(10) // 10
border2TopSpace.constant = CGFloat(15) // 15
showBarcodeButton.setTitle("Απόκρυψη barcode", for: .normal)
showBarcodeButton.setImage(UIImage(named: "ic_up_dark.png", in: Bundle(for: MyEmptyClass.self), compatibleWith: nil), for: .normal)
} else {
barcodeImage.isHidden = true
barcodeImageHeight.constant = CGFloat(0)
barcodeLabel.isHidden = true
barcodeLabelHeight.constant = CGFloat(0)
borderViewHeight.constant = CGFloat(0)
borderView2Height.constant = CGFloat(0)
border1TopSpace.constant = CGFloat(0) // 20
barcodeImageTopSpace.constant = CGFloat(0) // 10
barcodeLabelTopSpace.constant = CGFloat(0) // 10
border2TopSpace.constant = CGFloat(0) // 15
showBarcodeButton.setTitle("Εμφάνιση barcode", for: .normal)
showBarcodeButton.setImage(UIImage(named: "ic_down_dark.png", in: Bundle(for: MyEmptyClass.self), compatibleWith: nil), for: .normal)
}
}
func constructBarcode() -> String? {
// EAN 13 barcode construction
......@@ -169,9 +228,18 @@ import AVFoundation
vc.coupon = self.coupon
self.navigationController?.pushViewController(vc, animated: true)
}
@IBAction func showBarcodeAction(_ sender: Any) {
barcodeVisible = !barcodeVisible
toggleBarcode()
}
@IBAction func termsButtonAction(_ sender: Any) {
termsVisible = !termsVisible
toggleTerms()
}
@IBAction func mapButtonAction(_ sender: Any) {
// TODO: open MapVC
}
}
......
......@@ -1317,6 +1317,9 @@
</imageView>
<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="EKv-Mx-6Yv">
<rect key="frame" x="20" y="621.5" width="374" height="26.5"/>
<constraints>
<constraint firstAttribute="height" constant="26.5" id="LfJ-bC-nLk"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="22"/>
<color key="textColor" red="0.25490196079999999" green="0.33333333329999998" blue="0.3921568627" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
......@@ -1328,14 +1331,29 @@
<constraint firstAttribute="height" constant="1" id="DVl-3B-zqo"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Zw5-Wj-WD5">
<rect key="frame" x="103.5" y="674" width="207" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="ZSP-NX-0a7"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="15"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="5" maxY="0.0"/>
<state key="normal" title="Εμφάνιση barcode" image="ic_down_dark">
<color key="titleColor" red="0.25490196079999999" green="0.33333333329999998" blue="0.3921568627" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
<preferredSymbolConfiguration key="preferredSymbolConfiguration"/>
</state>
<connections>
<action selector="showBarcodeAction:" destination="CDt-eI-msA" eventType="touchUpInside" id="j4o-tX-kDb"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Το κουπόνι ισχύει έως 05/12/2022" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UhC-Lj-tfN">
<rect key="frame" x="20" y="699" width="374" height="17"/>
<rect key="frame" x="20" y="759" width="374" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.25490196079999999" green="0.33333333329999998" blue="0.3921568627" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8cR-Rc-YMJ">
<rect key="frame" x="83" y="751" width="248" height="40"/>
<rect key="frame" x="83" y="811" width="248" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="ccg-NP-FIH"/>
</constraints>
......@@ -1348,8 +1366,22 @@
<action selector="redeemButtomAction:" destination="CDt-eI-msA" eventType="touchUpInside" id="0pY-lD-17H"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="W5f-1T-iW6">
<rect key="frame" x="83" y="871" width="248" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="3pq-y5-f66"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="15"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="Δες τα καταστήματα">
<color key="titleColor" red="0.31372549019607843" green="0.61960784313725492" blue="0.18431372549019609" alpha="1" colorSpace="calibratedRGB"/>
</state>
<connections>
<action selector="mapButtonAction:" destination="CDt-eI-msA" eventType="touchUpInside" id="1Th-sc-HY1"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8UD-WL-JB7">
<rect key="frame" x="103.5" y="801" width="207" height="50"/>
<rect key="frame" x="103.5" y="921" width="207" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="xdq-YS-AL4"/>
</constraints>
......@@ -1364,7 +1396,7 @@
</connections>
</button>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" textAlignment="center" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xjX-HZ-MpD">
<rect key="frame" x="20" y="861" width="374" height="0.0"/>
<rect key="frame" x="20" y="981" width="374" height="0.0"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="height" id="3GU-tg-S3t"/>
......@@ -1378,22 +1410,28 @@
<constraints>
<constraint firstItem="jrM-7n-fSw" firstAttribute="leading" secondItem="1ec-eH-fkX" secondAttribute="leading" constant="20" id="0Dc-gr-Zfa"/>
<constraint firstItem="huh-zh-82C" firstAttribute="leading" secondItem="1ec-eH-fkX" secondAttribute="leading" constant="30" id="1bc-Mr-krB"/>
<constraint firstItem="8UD-WL-JB7" firstAttribute="top" secondItem="W5f-1T-iW6" secondAttribute="bottom" constant="10" id="2qi-nv-Q66"/>
<constraint firstAttribute="trailing" secondItem="Xz4-EE-EzJ" secondAttribute="trailing" constant="20" id="5Sx-lW-x5H"/>
<constraint firstItem="Zw5-Wj-WD5" firstAttribute="width" secondItem="1ec-eH-fkX" secondAttribute="width" multiplier="0.5" id="5nW-K9-uVa"/>
<constraint firstItem="Zw5-Wj-WD5" firstAttribute="top" secondItem="6rV-2m-QMZ" secondAttribute="bottom" constant="10" id="7VE-aB-ZD3"/>
<constraint firstItem="8cR-Rc-YMJ" firstAttribute="centerX" secondItem="1ec-eH-fkX" secondAttribute="centerX" id="8hP-dm-rWP"/>
<constraint firstItem="8cR-Rc-YMJ" firstAttribute="width" secondItem="1ec-eH-fkX" secondAttribute="width" multiplier="0.6" id="8kM-Og-K54"/>
<constraint firstItem="8UD-WL-JB7" firstAttribute="width" secondItem="1ec-eH-fkX" secondAttribute="width" multiplier="0.5" id="9Gy-bi-NXO"/>
<constraint firstItem="mri-Wl-spg" firstAttribute="top" secondItem="Xz4-EE-EzJ" secondAttribute="bottom" constant="25" id="9W8-fX-IzR"/>
<constraint firstItem="xjX-HZ-MpD" firstAttribute="leading" secondItem="1ec-eH-fkX" secondAttribute="leading" constant="20" id="AIW-Kf-tkQ"/>
<constraint firstItem="Zw5-Wj-WD5" firstAttribute="centerX" secondItem="1ec-eH-fkX" secondAttribute="centerX" id="BgT-3L-aZo"/>
<constraint firstItem="jrM-7n-fSw" firstAttribute="top" secondItem="Zdf-1r-FdJ" secondAttribute="bottom" constant="20" id="G5W-a3-pag"/>
<constraint firstItem="huh-zh-82C" firstAttribute="top" secondItem="jrM-7n-fSw" secondAttribute="bottom" constant="10" id="GQF-H5-SZp"/>
<constraint firstItem="iiM-5P-m5s" firstAttribute="top" secondItem="1ec-eH-fkX" secondAttribute="top" id="H9I-TB-xig"/>
<constraint firstItem="8cR-Rc-YMJ" firstAttribute="top" secondItem="UhC-Lj-tfN" secondAttribute="bottom" constant="35" id="I87-km-KEb"/>
<constraint firstItem="Zdf-1r-FdJ" firstAttribute="top" secondItem="Sg1-QU-FY1" secondAttribute="bottom" constant="10" id="KZi-Jl-Yyz"/>
<constraint firstItem="W5f-1T-iW6" firstAttribute="width" secondItem="1ec-eH-fkX" secondAttribute="width" multiplier="0.6" id="LFp-LS-XsA"/>
<constraint firstItem="UhC-Lj-tfN" firstAttribute="leading" secondItem="1ec-eH-fkX" secondAttribute="leading" constant="20" id="MSg-iF-tt9"/>
<constraint firstAttribute="trailing" secondItem="6rV-2m-QMZ" secondAttribute="trailing" constant="20" id="NGe-PV-pQl"/>
<constraint firstAttribute="trailing" secondItem="mri-Wl-spg" secondAttribute="trailing" constant="20" id="NmE-Pu-v1S"/>
<constraint firstAttribute="trailing" secondItem="EKv-Mx-6Yv" secondAttribute="trailing" constant="20" id="OeB-T7-87x"/>
<constraint firstItem="8UD-WL-JB7" firstAttribute="top" secondItem="8cR-Rc-YMJ" secondAttribute="bottom" constant="10" id="Rbe-XQ-CIj"/>
<constraint firstItem="W5f-1T-iW6" firstAttribute="centerX" secondItem="1ec-eH-fkX" secondAttribute="centerX" id="Pug-Ej-C69"/>
<constraint firstItem="W5f-1T-iW6" firstAttribute="top" secondItem="8cR-Rc-YMJ" secondAttribute="bottom" constant="20" id="Rbe-XQ-CIj"/>
<constraint firstAttribute="trailing" secondItem="jrM-7n-fSw" secondAttribute="trailing" constant="20" id="ReY-xR-F8V"/>
<constraint firstItem="Xz4-EE-EzJ" firstAttribute="top" secondItem="iiM-5P-m5s" secondAttribute="bottom" constant="30" id="Ryr-v8-THU"/>
<constraint firstItem="xjX-HZ-MpD" firstAttribute="top" secondItem="8UD-WL-JB7" secondAttribute="bottom" constant="10" id="XFI-ij-KkC"/>
......@@ -1413,7 +1451,7 @@
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="xjX-HZ-MpD" secondAttribute="bottom" constant="30" id="kLr-ZV-vCo"/>
<constraint firstAttribute="trailing" secondItem="UhC-Lj-tfN" secondAttribute="trailing" constant="20" id="lM1-ep-Zec"/>
<constraint firstItem="Xz4-EE-EzJ" firstAttribute="leading" secondItem="1ec-eH-fkX" secondAttribute="leading" constant="20" id="lMf-pF-Bp6"/>
<constraint firstItem="UhC-Lj-tfN" firstAttribute="top" secondItem="6rV-2m-QMZ" secondAttribute="bottom" constant="35" id="ora-fw-TKe"/>
<constraint firstItem="UhC-Lj-tfN" firstAttribute="top" secondItem="Zw5-Wj-WD5" secondAttribute="bottom" constant="35" id="ora-fw-TKe"/>
<constraint firstAttribute="trailing" secondItem="iiM-5P-m5s" secondAttribute="trailing" id="qWA-17-dEY"/>
<constraint firstAttribute="trailing" secondItem="xjX-HZ-MpD" secondAttribute="trailing" constant="20" id="rIc-bw-vfp"/>
<constraint firstAttribute="trailing" secondItem="huh-zh-82C" secondAttribute="trailing" constant="30" id="ySg-6E-isO"/>
......@@ -1458,17 +1496,26 @@
<outlet property="backgroundImage" destination="B6L-Zs-Vnz" id="0fs-sM-Khn"/>
<outlet property="barcodeImage" destination="huh-zh-82C" id="ZLK-Dj-ltk"/>
<outlet property="barcodeImageHeight" destination="LJq-uV-eb8" id="YSo-v7-Gtq"/>
<outlet property="barcodeImageTopSpace" destination="GQF-H5-SZp" id="pLk-Jw-P29"/>
<outlet property="barcodeLabel" destination="EKv-Mx-6Yv" id="myd-id-Q29"/>
<outlet property="barcodeLabelHeight" destination="LfJ-bC-nLk" id="cPV-72-LRC"/>
<outlet property="barcodeLabelTopSpace" destination="hZO-Qg-tda" id="X5g-M7-vwh"/>
<outlet property="border1TopSpace" destination="G5W-a3-pag" id="bKg-mJ-AWF"/>
<outlet property="border2TopSpace" destination="hL4-rX-9aa" id="87h-tF-CnT"/>
<outlet property="borderView2Height" destination="DVl-3B-zqo" id="USP-Iq-ZAd"/>
<outlet property="borderViewHeight" destination="eF3-7T-hMu" id="Wt2-MV-eTg"/>
<outlet property="couponImage" destination="iiM-5P-m5s" id="oKZ-Up-sI3"/>
<outlet property="couponImageHeight" destination="kL0-u7-VI9" id="QJ9-gs-XUh"/>
<outlet property="couponNumberLabel" destination="BJS-kk-CBZ" id="Sdz-3a-Jvq"/>
<outlet property="couponView" destination="Zdf-1r-FdJ" id="OA8-73-e0p"/>
<outlet property="discriptionLabel" destination="mri-Wl-spg" id="iuf-XL-NWH"/>
<outlet property="expirationLabel" destination="UhC-Lj-tfN" id="9Hj-I1-nJa"/>
<outlet property="mapButton" destination="W5f-1T-iW6" id="2IL-QE-TdM"/>
<outlet property="nameLabel" destination="Xz4-EE-EzJ" id="zTY-n5-36h"/>
<outlet property="redeemButton" destination="8cR-Rc-YMJ" id="atB-0m-8ff"/>
<outlet property="scrollContentView" destination="1ec-eH-fkX" id="IZE-ie-TUA"/>
<outlet property="scrollView" destination="D1m-2B-ehg" id="dwz-JJ-dht"/>
<outlet property="showBarcodeButton" destination="Zw5-Wj-WD5" id="WP9-RY-QDg"/>
<outlet property="termsButton" destination="8UD-WL-JB7" id="azl-dZ-6ey"/>
<outlet property="termsTextView" destination="xjX-HZ-MpD" id="8ZQ-e0-1Ib"/>
<outlet property="termsTextViewHeight" destination="3GU-tg-S3t" id="H3e-IQ-FGo"/>
......