Manos Chorianopoulos

PopupMerchantCategoriesViewController fixes

......@@ -6595,19 +6595,19 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="JzI-pZ-MNc">
<rect key="frame" x="0.0" y="672" width="414" height="224"/>
<rect key="frame" x="0.0" y="662" width="414" height="234"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jEM-IU-eiM" userLabel="Header View">
<rect key="frame" x="20" y="15" width="374" height="20"/>
<rect key="frame" x="20" y="15" width="374" height="30"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Βρες το προϊον στα supermarket" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ybq-Lc-ajo">
<rect key="frame" x="0.0" y="0.0" width="324" height="20"/>
<rect key="frame" x="0.0" y="5" width="324" height="20"/>
<fontDescription key="fontDescription" name="BTCosmo-Bold" family="BTCosmo" pointSize="17"/>
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="xAb-b2-o7k">
<rect key="frame" x="344" y="-5" width="30" height="30"/>
<rect key="frame" x="344" y="0.0" width="30" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="l9h-yH-nF9"/>
<constraint firstAttribute="height" constant="30" id="pBV-Cd-ego"/>
......@@ -6622,16 +6622,16 @@
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="xAb-b2-o7k" secondAttribute="bottom" id="0GW-CL-k5M"/>
<constraint firstItem="Ybq-Lc-ajo" firstAttribute="leading" secondItem="jEM-IU-eiM" secondAttribute="leading" id="46I-7U-Ulb"/>
<constraint firstItem="xAb-b2-o7k" firstAttribute="centerY" secondItem="jEM-IU-eiM" secondAttribute="centerY" id="GcV-M2-J4V"/>
<constraint firstAttribute="bottom" secondItem="Ybq-Lc-ajo" secondAttribute="bottom" id="WOw-4M-kDQ"/>
<constraint firstItem="xAb-b2-o7k" firstAttribute="leading" secondItem="Ybq-Lc-ajo" secondAttribute="trailing" constant="20" id="ZeO-pQ-Lew"/>
<constraint firstItem="xAb-b2-o7k" firstAttribute="top" secondItem="jEM-IU-eiM" secondAttribute="top" id="beT-Hv-kyp"/>
<constraint firstAttribute="trailing" secondItem="xAb-b2-o7k" secondAttribute="trailing" id="dUI-5D-lZg"/>
<constraint firstItem="Ybq-Lc-ajo" firstAttribute="top" secondItem="jEM-IU-eiM" secondAttribute="top" id="rY9-wm-h5A"/>
<constraint firstItem="Ybq-Lc-ajo" firstAttribute="centerY" secondItem="jEM-IU-eiM" secondAttribute="centerY" id="hcl-mU-jW4"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jn0-7E-Vpz">
<rect key="frame" x="51" y="50" width="312" height="55"/>
<rect key="frame" x="51" y="60" width="312" height="55"/>
<constraints>
<constraint firstAttribute="height" constant="55" id="8hL-nI-pET"/>
<constraint firstAttribute="width" constant="312" id="HyB-dA-8lF"/>
......@@ -6643,11 +6643,10 @@
</state>
<connections>
<action selector="mapButtonAction:" destination="ecE-vH-QNF" eventType="touchUpInside" id="ouv-Tg-8VM"/>
<action selector="redeemButtomAction:" destination="CDt-eI-msA" eventType="touchUpInside" id="rJb-HZ-0dN"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="wXX-H2-cJy">
<rect key="frame" x="51" y="127" width="312" height="55"/>
<rect key="frame" x="51" y="137" width="312" height="55"/>
<constraints>
<constraint firstAttribute="width" constant="312" id="IrT-Tj-Tg4"/>
<constraint firstAttribute="height" constant="55" id="cag-PL-ges"/>
......@@ -6659,7 +6658,6 @@
</state>
<connections>
<action selector="eshopsButtonAction:" destination="ecE-vH-QNF" eventType="touchUpInside" id="vea-u7-83s"/>
<action selector="mapButtonAction:" destination="CDt-eI-msA" eventType="touchUpInside" id="rjN-wt-ZaQ"/>
</connections>
</button>
</subviews>
......@@ -6699,7 +6697,7 @@
<outlet property="eshopsButton" destination="wXX-H2-cJy" id="Rge-nz-CFC"/>
<outlet property="headerLabel" destination="Ybq-Lc-ajo" id="LDn-ay-yzp"/>
<outlet property="mapButton" destination="jn0-7E-Vpz" id="HR8-gv-jkU"/>
<outlet property="popupView" destination="z3G-LR-Caw" id="iPa-kN-AmH"/>
<outlet property="popupView" destination="JzI-pZ-MNc" id="0g5-f3-d22"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="OwD-fu-wY3" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
......
......@@ -7,6 +7,12 @@
import UIKit
// Define a protocol
protocol PopupMerchantCategoriesViewControllerDelegate: AnyObject {
func didTapMapButton()
func didTapEshopsButton()
}
class PopupMerchantCategoriesViewController: UIViewController {
@IBOutlet weak var popupView: UIView!
@IBOutlet weak var headerLabel: UILabel!
......@@ -16,6 +22,9 @@ class PopupMerchantCategoriesViewController: UIViewController {
public var headerText: String? = ""
// Delegate variable
weak var delegate: PopupMerchantCategoriesViewControllerDelegate?
override func viewDidLoad() {
super.viewDidLoad()
......@@ -32,14 +41,14 @@ class PopupMerchantCategoriesViewController: UIViewController {
headerLabel.isHidden = true
mapButton.titleLabel?.font = UIFont(name: "PeridotPE-SBold", size: 17)
mapButton.setTitle("Βρες το στα supermarket", for: .normal)
mapButton.setTitle("Δες τα καταστήματα στο χάρτη", for: .normal)
mapButton.setTitleColor(.white, for: .normal)
mapButton.backgroundColor = UIColor(red: 0.05, green: 0.65, blue: 0.00, alpha: 1.00)
mapButton.layer.cornerRadius = 16.0
mapButton.frame = CGRect(x: 0.0, y: 0.0, width: 312, height: 55)
eshopsButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 17)
eshopsButton.setTitle(ώρισέ το", for: .normal)
eshopsButton.setTitle(ες τα eshop", for: .normal)
eshopsButton.setTitleColor(UIColor(red: 0.05, green: 0.65, blue: 0.00, alpha: 1.00), for: .normal)
eshopsButton.layer.cornerRadius = 15.0
eshopsButton.frame = CGRect(x: 0.0, y: 0.0, width: 312, height: 55)
......@@ -48,34 +57,28 @@ class PopupMerchantCategoriesViewController: UIViewController {
eshopsButton.layer.borderColor = UIColor(red: 0.05, green: 0.65, blue: 0.00, alpha: 1.00).cgColor
}
@objc private func mapButtonTapped() {
// Notify the delegate when map button is tapped
delegate?.didTapMapButton()
}
@objc private func eshopsButtonTapped() {
// Notify the delegate when eshops button is tapped
delegate?.didTapEshopsButton()
}
// MARK: - UIButton Actions
@IBAction func closeButtonAction(_ sender: Any) {
self.dismiss(animated: true, completion: {})
}
@IBAction func mapButtonAction(_ sender: Any) {
swiftApi().logTrackersEvent("click", "SeeShops")
let vc = SwiftWarplyFramework.MapsViewController(nibName: "MapsViewController", bundle: Bundle(for: MyEmptyClass.self))
// vc.couponSet = coupon?.couponset_data
vc.isMarket = true
self.navigationController?.pushViewController(vc, animated: true)
self.dismiss(animated: true, completion: {})
mapButtonTapped()
}
@IBAction func eshopsButtonAction(_ sender: Any) {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
if let popupVC = storyboard.instantiateViewController(withIdentifier: "PopupMerchantsViewController") as? SwiftWarplyFramework.PopupMerchantsViewController {
popupVC.modalPresentationStyle = .overCurrentContext
popupVC.modalTransitionStyle = .crossDissolve
// popupVC.coupon = coupon
popupVC.headerText = "Δες τα eshop"
popupVC.buttonTitle = "Δες το eshop"
// popupVC.buttonIcon = "shopping_cart"
popupVC.footerText = "Η διαθεσιμότητα ενδέχεται να διαφέρει ανάλογα με την τοποθεσία."
self.present(popupVC, animated: true, completion: nil)
}
self.dismiss(animated: true, completion: {})
eshopsButtonTapped()
}
}
......
......@@ -165,6 +165,7 @@ import SwiftEventBus
popupVC.modalPresentationStyle = .overCurrentContext
popupVC.modalTransitionStyle = .crossDissolve
// popupVC.coupon = coupon
popupVC.delegate = self
self.present(popupVC, animated: true, completion: nil)
}
......@@ -369,3 +370,32 @@ extension UnifiedCouponBarcodeViewController: UITableViewDelegate, UITableViewDa
}
}
// MARK: - MerchantTableViewCellDelegate
extension UnifiedCouponBarcodeViewController: PopupMerchantCategoriesViewControllerDelegate {
func didTapMapButton() {
swiftApi().logTrackersEvent("click", "SeeShops")
let vc = SwiftWarplyFramework.MapsViewController(nibName: "MapsViewController", bundle: Bundle(for: MyEmptyClass.self))
// vc.couponSet = coupon?.couponset_data
vc.isMarket = true
self.navigationController?.pushViewController(vc, animated: true)
}
func didTapEshopsButton() {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
if let popupVC = storyboard.instantiateViewController(withIdentifier: "PopupMerchantsViewController") as? SwiftWarplyFramework.PopupMerchantsViewController {
popupVC.modalPresentationStyle = .overCurrentContext
popupVC.modalTransitionStyle = .crossDissolve
// popupVC.coupon = coupon
popupVC.headerText = "Δες τα eshop"
popupVC.buttonTitle = "Δες το eshop"
// popupVC.buttonIcon = "shopping_cart"
popupVC.footerText = "Η διαθεσιμότητα ενδέχεται να διαφέρει ανάλογα με την τοποθεσία."
self.present(popupVC, animated: true, completion: nil)
}
}
}
......