Manos Chorianopoulos

MarketPassViewController changes

......@@ -258,7 +258,7 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="852"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fHd-ff-Sbn">
<rect key="frame" x="17" y="23" width="380" height="513.5"/>
<rect key="frame" x="17" y="23" width="380" height="499.5"/>
<subviews>
<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">
<rect key="frame" x="26" y="26" width="328" height="27"/>
......@@ -273,16 +273,16 @@
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="74w-a6-uZN">
<rect key="frame" x="26" y="154" width="328" height="157.5"/>
<rect key="frame" x="18" y="73" width="344" height="157.5"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="cBT-1y-9Lf">
<rect key="frame" x="24" y="5" width="280" height="110"/>
<rect key="frame" x="24" y="5" width="296" height="110"/>
<constraints>
<constraint firstAttribute="height" constant="110" id="wRW-6H-VVs"/>
</constraints>
</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="t9R-7Y-Vtc" customClass="CopyableLabel" customModule="SwiftWarplyFramework" customModuleProvider="target">
<rect key="frame" x="24" y="120" width="280" height="23.5"/>
<rect key="frame" x="24" y="120" width="296" height="23.5"/>
<fontDescription key="fontDescription" name="PeridotPE-Regular" family="Peridot PE" pointSize="19"/>
<color key="textColor" red="0.12941176470588234" green="0.12941176470588234" blue="0.12941176470588234" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
......@@ -300,25 +300,41 @@
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HCl-ht-lub" userLabel="CouponsValueView">
<rect key="frame" x="0.0" y="348.5" width="380" height="53"/>
<rect key="frame" x="0.0" y="250.5" width="380" height="137"/>
<subviews>
<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">
<rect key="frame" x="26" y="16" width="328" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Zk5-FL-kMS">
<rect key="frame" x="26" y="16" width="328" height="105"/>
<string key="text">Χρησιμοποίησε τη SUPERMARKET DEALS CARD σου για να κερδίσεις έκπτωση σε επιλεγμένα προϊόντα. Ανακάλυψε τα διαθέσιμα εκπτωτικά κουπόνια στο For You.</string>
<fontDescription key="fontDescription" name="PeridotPE-Regular" family="Peridot PE" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Bvm-XO-0F3">
<rect key="frame" x="0.0" y="0.0" width="380" height="137"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="Button">
<color key="baseForegroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</buttonConfiguration>
<connections>
<action selector="supermakrtPassButtonAction:" destination="Bfc-KW-c8g" eventType="touchUpInside" id="NZG-CU-3wg"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="0.0" green="0.42745098039215684" blue="0.14901960784313725" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="Bvm-XO-0F3" firstAttribute="top" secondItem="HCl-ht-lub" secondAttribute="top" id="5PC-jg-uWq"/>
<constraint firstAttribute="trailing" secondItem="Zk5-FL-kMS" secondAttribute="trailing" constant="26" id="8gj-ca-QKO"/>
<constraint firstAttribute="bottom" secondItem="Zk5-FL-kMS" secondAttribute="bottom" constant="16" id="OLu-Uk-BON"/>
<constraint firstAttribute="bottom" secondItem="Bvm-XO-0F3" secondAttribute="bottom" id="T19-eg-TDE"/>
<constraint firstItem="Zk5-FL-kMS" firstAttribute="leading" secondItem="HCl-ht-lub" secondAttribute="leading" constant="26" id="Z7D-V4-kqB"/>
<constraint firstAttribute="trailing" secondItem="Bvm-XO-0F3" secondAttribute="trailing" id="u13-rS-jsa"/>
<constraint firstItem="Zk5-FL-kMS" firstAttribute="top" secondItem="HCl-ht-lub" secondAttribute="top" constant="16" id="v5u-PM-u2n"/>
<constraint firstItem="Bvm-XO-0F3" firstAttribute="leading" secondItem="HCl-ht-lub" secondAttribute="leading" id="z9b-HX-CzR"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="O1Z-nB-jp1">
<rect key="frame" x="0.0" y="401.5" width="380" height="112"/>
<rect key="frame" x="0.0" y="387.5" width="380" height="112"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="e1L-dV-0yr">
<rect key="frame" x="220" y="32" width="148" height="48"/>
......@@ -346,23 +362,28 @@
</subviews>
<color key="backgroundColor" red="0.21176470588235294" green="0.70196078431372544" blue="0.16862745098039217" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="74w-a6-uZN" secondAttribute="trailing" constant="26" id="Gda-fs-RTg"/>
<constraint firstAttribute="trailing" secondItem="74w-a6-uZN" secondAttribute="trailing" constant="18" id="Gda-fs-RTg"/>
<constraint firstAttribute="trailing" secondItem="HCl-ht-lub" secondAttribute="trailing" id="J53-eS-6Fr"/>
<constraint firstItem="HCl-ht-lub" firstAttribute="leading" secondItem="fHd-ff-Sbn" secondAttribute="leading" id="V74-1z-3qe"/>
<constraint firstAttribute="bottom" secondItem="O1Z-nB-jp1" secondAttribute="bottom" id="VQE-kR-d20"/>
<constraint firstItem="74w-a6-uZN" firstAttribute="top" secondItem="FCo-jy-FmB" secondAttribute="bottom" constant="43" id="Y4U-h7-vhS"/>
<constraint firstItem="74w-a6-uZN" firstAttribute="top" secondItem="ffU-yH-vAL" secondAttribute="bottom" constant="20" id="Y4U-h7-vhS"/>
<constraint firstAttribute="trailing" secondItem="O1Z-nB-jp1" secondAttribute="trailing" id="a7K-Cs-70c"/>
<constraint firstAttribute="trailing" secondItem="FCo-jy-FmB" secondAttribute="trailing" constant="26" id="cmO-N9-ava"/>
<constraint firstItem="74w-a6-uZN" firstAttribute="leading" secondItem="fHd-ff-Sbn" secondAttribute="leading" constant="26" id="dgM-id-huG"/>
<constraint firstItem="74w-a6-uZN" firstAttribute="leading" secondItem="fHd-ff-Sbn" secondAttribute="leading" constant="18" id="dgM-id-huG"/>
<constraint firstItem="FCo-jy-FmB" firstAttribute="leading" secondItem="fHd-ff-Sbn" secondAttribute="leading" constant="26" id="dtM-80-fIm"/>
<constraint firstItem="ffU-yH-vAL" firstAttribute="top" secondItem="fHd-ff-Sbn" secondAttribute="top" constant="26" id="h8l-cx-6Dh"/>
<constraint firstItem="ffU-yH-vAL" firstAttribute="leading" secondItem="fHd-ff-Sbn" secondAttribute="leading" constant="26" id="m6I-Tr-IxO"/>
<constraint firstItem="O1Z-nB-jp1" firstAttribute="top" secondItem="HCl-ht-lub" secondAttribute="bottom" id="mSE-RN-mKo"/>
<constraint firstItem="HCl-ht-lub" firstAttribute="top" secondItem="74w-a6-uZN" secondAttribute="bottom" constant="37" id="nH4-Uc-bF8"/>
<constraint firstItem="HCl-ht-lub" firstAttribute="top" secondItem="74w-a6-uZN" secondAttribute="bottom" constant="20" id="nH4-Uc-bF8"/>
<constraint firstAttribute="trailing" secondItem="ffU-yH-vAL" secondAttribute="trailing" constant="26" id="o7F-J6-nRj"/>
<constraint firstItem="FCo-jy-FmB" firstAttribute="top" secondItem="ffU-yH-vAL" secondAttribute="bottom" constant="16" id="r7m-We-OPk"/>
<constraint firstItem="O1Z-nB-jp1" firstAttribute="leading" secondItem="fHd-ff-Sbn" secondAttribute="leading" id="rr3-UJ-IZH"/>
</constraints>
<variation key="default">
<mask key="subviews">
<exclude reference="FCo-jy-FmB"/>
</mask>
</variation>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
......
......@@ -96,7 +96,7 @@ import SwiftEventBus
let barcodeString = ""
barcodeLabel.text = barcodeString
barcodeLabel.font = UIFont(name: "PeridotPE-Regular", size: 19.0)
barcodeLabel.font = UIFont(name: "PeridotPE-SBold", size: 19.0)
barcodeLabel.textColor = UIColor(rgb: 0x212121)
// 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)) {
......@@ -110,18 +110,23 @@ import SwiftEventBus
// barcodeImageHeight.constant = 0
// }
let couponsValueString = "0.00"
let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Regular", size: 17) ?? UIFont.systemFont(ofSize: 16), NSAttributedString.Key.foregroundColor: UIColor.white]
let attrBold = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Bold", size: 17) ?? UIFont.boldSystemFont(ofSize: 16), NSAttributedString.Key.foregroundColor: UIColor.white]
let couponsValueNormalText1 = "Με τα διαθέσιμα κουπόνια μπορείς να εξοικονομήσεις έως και "
let couponsValueBoldText = couponsValueString + "€."
let couponsValueAttributedString = NSMutableAttributedString(string:couponsValueNormalText1, attributes:attrRegular)
let couponsValueBoldString = NSMutableAttributedString(string: couponsValueBoldText, attributes:attrBold)
// let couponsValueString = "0.00"
// let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Regular", size: 17) ?? UIFont.systemFont(ofSize: 16), NSAttributedString.Key.foregroundColor: UIColor.white]
// let attrBold = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Bold", size: 17) ?? UIFont.boldSystemFont(ofSize: 16), NSAttributedString.Key.foregroundColor: UIColor.white]
//
// let couponsValueNormalText1 = "Με τα διαθέσιμα κουπόνια μπορείς να εξοικονομήσεις έως και "
// let couponsValueBoldText = couponsValueString + "€."
//
// let couponsValueAttributedString = NSMutableAttributedString(string:couponsValueNormalText1, attributes:attrRegular)
// let couponsValueBoldString = NSMutableAttributedString(string: couponsValueBoldText, attributes:attrBold)
//
// couponsValueAttributedString.append(couponsValueBoldString)
// couponsValueLabel.attributedText = couponsValueAttributedString
couponsValueAttributedString.append(couponsValueBoldString)
couponsValueLabel.attributedText = couponsValueAttributedString
couponsValueLabel.text = "Χρησιμοποίησε τη SUPERMARKET DEALS CARD σου για να κερδίσεις έκπτωση σε επιλεγμένα προϊόντα. Ανακάλυψε τα διαθέσιμα εκπτωτικά κουπόνια στο For You."
couponsValueLabel.textAlignment = .left
couponsValueLabel.font = UIFont(name: "PeridotPE-Regular", size: 13.0)
couponsValueLabel.textColor = .white
mapButton.titleLabel?.font = UIFont(name: "PeridotPE-SBold", size: 16)
mapButton.setTitle("Δες στο χάρτη", for: .normal)
......@@ -194,21 +199,25 @@ import SwiftEventBus
barcodeImageHeight.constant = 0
}
let couponsValueFloat = marketPassDetails?._total_available_discount ?? 0.0
let couponsValueString = String(format: "%.2f", couponsValueFloat)
// let couponsValueString = String(marketPassDetails?._total_available_discount ?? 0.0)
let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Regular", size: 17) ?? UIFont.systemFont(ofSize: 16), NSAttributedString.Key.foregroundColor: UIColor.white]
let attrBold = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Bold", size: 17) ?? UIFont.boldSystemFont(ofSize: 16), NSAttributedString.Key.foregroundColor: UIColor.white]
let couponsValueNormalText1 = "Με τα διαθέσιμα κουπόνια μπορείς να εξοικονομήσεις έως και "
let couponsValueBoldText = couponsValueString + "€."
let couponsValueAttributedString = NSMutableAttributedString(string:couponsValueNormalText1, attributes:attrRegular)
let couponsValueBoldString = NSMutableAttributedString(string: couponsValueBoldText, attributes:attrBold)
// let couponsValueFloat = marketPassDetails?._total_available_discount ?? 0.0
// let couponsValueString = String(format: "%.2f", couponsValueFloat)
// // let couponsValueString = String(marketPassDetails?._total_available_discount ?? 0.0)
// let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Regular", size: 17) ?? UIFont.systemFont(ofSize: 16), NSAttributedString.Key.foregroundColor: UIColor.white]
// let attrBold = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Bold", size: 17) ?? UIFont.boldSystemFont(ofSize: 16), NSAttributedString.Key.foregroundColor: UIColor.white]
//
// let couponsValueNormalText1 = "Με τα διαθέσιμα κουπόνια μπορείς να εξοικονομήσεις έως και "
// let couponsValueBoldText = couponsValueString + "€."
//
// let couponsValueAttributedString = NSMutableAttributedString(string:couponsValueNormalText1, attributes:attrRegular)
// let couponsValueBoldString = NSMutableAttributedString(string: couponsValueBoldText, attributes:attrBold)
//
// couponsValueAttributedString.append(couponsValueBoldString)
// couponsValueLabel.attributedText = couponsValueAttributedString
couponsValueAttributedString.append(couponsValueBoldString)
couponsValueLabel.attributedText = couponsValueAttributedString
couponsValueLabel.text = "Χρησιμοποίησε τη SUPERMARKET DEALS CARD σου για να κερδίσεις έκπτωση σε επιλεγμένα προϊόντα. Ανακάλυψε τα διαθέσιμα εκπτωτικά κουπόνια στο For You."
couponsValueLabel.textAlignment = .left
couponsValueLabel.font = UIFont(name: "PeridotPE-Regular", size: 13.0)
couponsValueLabel.textColor = .white
let supermarkets: Array<swiftApi.SupermarketModel> = marketPassDetails?._supermarkets ?? []
......@@ -348,6 +357,10 @@ import SwiftEventBus
// }
// MARK: - Actions
@IBAction func supermakrtPassButtonAction(_ sender: Any) {
swiftApi().openSupermarketPass(self)
}
@IBAction func mapButtonAction(_ sender: Any) {
swiftApi().openSupermarketMap(self)
}
......
......@@ -9405,6 +9405,33 @@ public class swiftApi {
}
}
public func getMarketPassUrl() -> String {
let appUuid = swiftApi().getAppUuid()
if (appUuid == "f83dfde1145e4c2da69793abb2f579af") {
return "https://dev.supermarketdeals.eu"
} else {
return "https://supermarketdeals.eu"
}
}
public func openSupermarketPass(_ controller: UIViewController) -> Void {
let status = swiftApi().getNetworkStatus()
if (status == -1 || status == 0) {
swiftApi().showDialog(controller, "Δεν υπάρχει σύνδεση","Αυτή τη στιγμή βρίσκεσαι εκτός σύνδεσης. Παρακαλούμε βεβαιώσου ότι είσαι συνδεδεμένος στο διαδίκτυο και προσπάθησε ξανά.")
} else {
let tempCampaign = CampaignItemModel()
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController
let url = swiftApi().getMarketPassUrl()
let params = swiftApi().constructCampaignParams(tempCampaign)
vc.campaignUrl = url
vc.params = params
vc.showHeader = false
controller.navigationController?.pushViewController(vc, animated: true)
}
}
/*
{
......