Manos Chorianopoulos

add share coupon ui and functionality

......@@ -11,6 +11,9 @@
1E74838D28378AF40042A589 /* CouponBarcodeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E74838C28378AF40042A589 /* CouponBarcodeViewController.swift */; };
1EA1AF0A2835346A008998AA /* CouponsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EA1AF092835346A008998AA /* CouponsTableViewCell.swift */; };
1EA2BB792865BFE8003F2AB0 /* InboxTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EA2BB782865BFE8003F2AB0 /* InboxTableViewCell.swift */; };
1EB236AB28816B680063777A /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB236AA28816B680063777A /* ShareViewController.swift */; };
1EB236AD28816C560063777A /* NumberPopupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB236AC28816C560063777A /* NumberPopupViewController.swift */; };
1EB236AF28816CAC0063777A /* NumbersTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB236AE28816CAB0063777A /* NumbersTableViewCell.swift */; };
1EB5F4C828536FD60016F36E /* StepsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB5F4C728536FD60016F36E /* StepsViewController.swift */; };
1EB5F4CA285370C90016F36E /* LoyaltyAnalysisViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB5F4C9285370C90016F36E /* LoyaltyAnalysisViewController.swift */; };
1EBE97212865EE460080EFF7 /* MFYInboxTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBE97202865EE460080EFF7 /* MFYInboxTableViewCell.swift */; };
......@@ -148,6 +151,9 @@
1E74838C28378AF40042A589 /* CouponBarcodeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponBarcodeViewController.swift; sourceTree = "<group>"; };
1EA1AF092835346A008998AA /* CouponsTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponsTableViewCell.swift; sourceTree = "<group>"; };
1EA2BB782865BFE8003F2AB0 /* InboxTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InboxTableViewCell.swift; sourceTree = "<group>"; };
1EB236AA28816B680063777A /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = "<group>"; };
1EB236AC28816C560063777A /* NumberPopupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumberPopupViewController.swift; sourceTree = "<group>"; };
1EB236AE28816CAB0063777A /* NumbersTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumbersTableViewCell.swift; sourceTree = "<group>"; };
1EB5F4C728536FD60016F36E /* StepsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StepsViewController.swift; sourceTree = "<group>"; };
1EB5F4C9285370C90016F36E /* LoyaltyAnalysisViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoyaltyAnalysisViewController.swift; sourceTree = "<group>"; };
1EBE97202865EE460080EFF7 /* MFYInboxTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MFYInboxTableViewCell.swift; sourceTree = "<group>"; };
......@@ -350,6 +356,9 @@
E6A77A35282BB4CB0045BBA8 /* MakeItAPresentViewController.swift */,
E6A7785A282933E40045BBA8 /* Helpers */,
E6A77861282933E50045BBA8 /* Main.storyboard */,
1EB236AA28816B680063777A /* ShareViewController.swift */,
1EB236AC28816C560063777A /* NumberPopupViewController.swift */,
1EB236AE28816CAB0063777A /* NumbersTableViewCell.swift */,
1EB5F4C9285370C90016F36E /* LoyaltyAnalysisViewController.swift */,
1EB5F4C728536FD60016F36E /* StepsViewController.swift */,
E6A77860282933E40045BBA8 /* MyApi.h */,
......@@ -803,6 +812,7 @@
E6A77A36282BB4CB0045BBA8 /* MakeItAPresentViewController.swift in Sources */,
E6A77947282933E70045BBA8 /* FMDatabaseQueue.m in Sources */,
E6A77922282933E60045BBA8 /* NSData+SSToolkitAdditions.m in Sources */,
1EB236AB28816B680063777A /* ShareViewController.swift in Sources */,
E6A778E7282933E60045BBA8 /* DetailsViewController.swift in Sources */,
1EB5F4CA285370C90016F36E /* LoyaltyAnalysisViewController.swift in Sources */,
E6A7794A282933E70045BBA8 /* FMDatabaseAdditions.m in Sources */,
......@@ -816,7 +826,9 @@
E6A77924282933E70045BBA8 /* NSString+SSToolkitAdditions.m in Sources */,
E6A7792A282933E70045BBA8 /* AFNetworkActivityIndicatorManager.m in Sources */,
E6A77914282933E60045BBA8 /* WLUserManager.m in Sources */,
1EB236AF28816CAC0063777A /* NumbersTableViewCell.swift in Sources */,
E6A7794F282933E70045BBA8 /* FMDatabasePool.m in Sources */,
1EB236AD28816C560063777A /* NumberPopupViewController.swift in Sources */,
E6A778E3282933E60045BBA8 /* WalletViewController.swift in Sources */,
E6A7790C282933E60045BBA8 /* WLBeaconManager.m in Sources */,
E6A77940282933E70045BBA8 /* AFURLSessionManager.m in Sources */,
......
......@@ -164,25 +164,10 @@ import AVFoundation
// MARK: - Actions
@IBAction func redeemButtomAction(_ sender: Any) {
// TODO: Add redeem action
// SwiftEventBus.post("couponBarcodeRedeem", sender: coupon)
let alert = UIAlertController(title: "Το κουπόνι σου ενεργοποιήθηκε", message: "Μπορείς να το βρεις στην αρχική οθόνη της εφαρμογής και στην ενότητα ενεργά δώρα!", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in
switch action.style{
case .default:
print("default")
case .cancel:
print("cancel")
case .destructive:
print("destructive")
}
}))
self.present(alert, animated: true, completion: nil)
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "ShareViewController") as! SwiftWarplyFramework.ShareViewController
vc.coupon = self.coupon
self.navigationController?.pushViewController(vc, animated: true)
}
@IBAction func termsButtonAction(_ sender: Any) {
......
......@@ -1190,6 +1190,361 @@
</objects>
<point key="canvasLocation" x="2341" y="-555"/>
</scene>
<!--Share View Controller-->
<scene sceneID="9Hy-jH-czs">
<objects>
<viewController storyboardIdentifier="ShareViewController" id="hwy-nc-4N0" customClass="ShareViewController" customModule="SwiftWarplyFramework" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Nlq-Bo-JaK">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="y5q-8M-0jB">
<rect key="frame" x="0.0" y="44" width="414" height="852"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="coupons_scrollview_white" translatesAutoresizingMaskIntoConstraints="NO" id="QF0-ih-7ii">
<rect key="frame" x="0.0" y="0.0" width="414" height="852"/>
</imageView>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qjm-11-Clh">
<rect key="frame" x="0.0" y="5" width="414" height="847"/>
<subviews>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9kx-ct-jms">
<rect key="frame" x="0.0" y="0.0" width="414" height="852"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="p6Q-Rn-C6F">
<rect key="frame" x="0.0" y="0.0" width="414" height="200"/>
<constraints>
<constraint firstAttribute="height" constant="200" id="P2E-Lo-wU3"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Πάρε δωρεάν μηνιαία πακέτα με πάνες στα supermarket Σκλαβενίτης!" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="a9N-Ea-LNm">
<rect key="frame" x="20" y="230" width="374" height="38.5"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="16"/>
<color key="textColor" red="0.25490196079999999" green="0.33333333329999998" blue="0.3921568627" alpha="0.84705882349999995" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Χρησιμοποίησε τον παρακάτω κωδικό και πάρε δωρεάν πακέτο πάνες Pampers αποκλειστικά στα Supermarket Σκλαβενίτης" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EV0-Fh-Tdo">
<rect key="frame" x="20" y="293.5" width="374" height="57.5"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.25490196079999999" green="0.33333333329999998" blue="0.3921568627" alpha="0.84705882349999995" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="flv-Ik-YC2" userLabel="Sender View">
<rect key="frame" x="20" y="401" width="374" height="48"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Αποστολέας" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GX7-IF-Gdd">
<rect key="frame" x="10" y="15" width="334" height="18"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="15"/>
<color key="textColor" red="0.25490196078431371" green="0.33333333333333331" blue="0.39215686274509803" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_down_dark" translatesAutoresizingMaskIntoConstraints="NO" id="Ul8-d9-FfM">
<rect key="frame" x="354" y="16.5" width="15" height="15"/>
<constraints>
<constraint firstAttribute="height" constant="15" id="7Cv-XL-7ld"/>
<constraint firstAttribute="width" constant="15" id="bga-Xk-Jqu"/>
</constraints>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="uwc-Al-475" userLabel="Border View">
<rect key="frame" x="0.0" y="47" width="374" height="1"/>
<color key="backgroundColor" red="0.75294117647058822" green="0.7803921568627451" blue="0.80392156862745101" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="AIa-Cf-WAf"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="YD8-9K-Fp9">
<rect key="frame" x="0.0" y="0.0" width="374" height="48"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
</button>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="YD8-9K-Fp9" firstAttribute="leading" secondItem="flv-Ik-YC2" secondAttribute="leading" id="9Gw-eu-4zG"/>
<constraint firstAttribute="bottom" secondItem="GX7-IF-Gdd" secondAttribute="bottom" constant="15" id="BeI-uZ-EP2"/>
<constraint firstItem="uwc-Al-475" firstAttribute="leading" secondItem="flv-Ik-YC2" secondAttribute="leading" id="E1X-0a-tHn"/>
<constraint firstItem="Ul8-d9-FfM" firstAttribute="leading" secondItem="GX7-IF-Gdd" secondAttribute="trailing" constant="10" id="EPW-w2-cMy"/>
<constraint firstAttribute="trailing" secondItem="uwc-Al-475" secondAttribute="trailing" id="FU0-fB-g1t"/>
<constraint firstAttribute="trailing" secondItem="YD8-9K-Fp9" secondAttribute="trailing" id="GqN-Rs-XwE"/>
<constraint firstAttribute="bottom" secondItem="YD8-9K-Fp9" secondAttribute="bottom" id="Ht0-rk-2dq"/>
<constraint firstAttribute="bottom" secondItem="uwc-Al-475" secondAttribute="bottom" id="PxP-0D-7Pa"/>
<constraint firstItem="GX7-IF-Gdd" firstAttribute="top" secondItem="flv-Ik-YC2" secondAttribute="top" constant="15" id="RNt-06-HCU"/>
<constraint firstItem="YD8-9K-Fp9" firstAttribute="top" secondItem="flv-Ik-YC2" secondAttribute="top" id="bMV-su-udf"/>
<constraint firstItem="GX7-IF-Gdd" firstAttribute="leading" secondItem="flv-Ik-YC2" secondAttribute="leading" constant="10" id="evt-G0-LtE"/>
<constraint firstAttribute="trailing" secondItem="Ul8-d9-FfM" secondAttribute="trailing" constant="5" id="lhW-A0-smM"/>
<constraint firstItem="Ul8-d9-FfM" firstAttribute="centerY" secondItem="GX7-IF-Gdd" secondAttribute="centerY" id="nAb-6R-0u4"/>
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Bsb-ps-GWu">
<rect key="frame" x="83" y="609.5" width="248" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="ge6-VF-hRu"/>
</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" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<connections>
<action selector="redeemButtomAction:" destination="hwy-nc-4N0" eventType="touchUpInside" id="fWY-nZ-K6c"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="uf8-tj-KCP" userLabel="Number Input View">
<rect key="frame" x="20" y="489" width="374" height="50.5"/>
<subviews>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Καταχώρηση τηλεφώνου" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="MYX-E6-emS">
<rect key="frame" x="10" y="15" width="354" height="19.5"/>
<color key="textColor" red="0.25490196078431371" green="0.33333333333333331" blue="0.39215686274509803" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="15"/>
<textInputTraits key="textInputTraits"/>
</textField>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ZfV-Yt-Nsb" userLabel="Border View">
<rect key="frame" x="0.0" y="49.5" width="374" height="1"/>
<color key="backgroundColor" red="0.75294117650000003" green="0.78039215689999997" blue="0.80392156859999997" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="XVw-LC-VSt"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="ZfV-Yt-Nsb" secondAttribute="trailing" id="45X-a2-POt"/>
<constraint firstItem="ZfV-Yt-Nsb" firstAttribute="leading" secondItem="uf8-tj-KCP" secondAttribute="leading" id="6Wq-tB-09n"/>
<constraint firstItem="MYX-E6-emS" firstAttribute="top" secondItem="uf8-tj-KCP" secondAttribute="top" constant="15" id="AaT-uD-wrU"/>
<constraint firstAttribute="trailing" secondItem="MYX-E6-emS" secondAttribute="trailing" constant="10" id="QeR-XF-HLV"/>
<constraint firstAttribute="bottom" secondItem="ZfV-Yt-Nsb" secondAttribute="bottom" id="XAl-Pb-x0E"/>
<constraint firstItem="ZfV-Yt-Nsb" firstAttribute="top" secondItem="MYX-E6-emS" secondAttribute="bottom" constant="15" id="fL9-Zw-IfQ"/>
<constraint firstItem="MYX-E6-emS" firstAttribute="leading" secondItem="uf8-tj-KCP" secondAttribute="leading" constant="10" id="ovh-ao-Rrn"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="uf8-tj-KCP" firstAttribute="top" secondItem="flv-Ik-YC2" secondAttribute="bottom" constant="40" id="0ie-rj-RuH"/>
<constraint firstItem="a9N-Ea-LNm" firstAttribute="leading" secondItem="9kx-ct-jms" secondAttribute="leading" constant="20" id="Azr-VI-Q1m"/>
<constraint firstItem="EV0-Fh-Tdo" firstAttribute="leading" secondItem="9kx-ct-jms" secondAttribute="leading" constant="20" id="CAj-eC-Z9x"/>
<constraint firstItem="Bsb-ps-GWu" firstAttribute="top" secondItem="uf8-tj-KCP" secondAttribute="bottom" constant="70" id="Cbu-wk-sAY"/>
<constraint firstItem="p6Q-Rn-C6F" firstAttribute="leading" secondItem="9kx-ct-jms" secondAttribute="leading" id="H67-hs-Ijs"/>
<constraint firstItem="a9N-Ea-LNm" firstAttribute="top" secondItem="p6Q-Rn-C6F" secondAttribute="bottom" constant="30" id="HsR-wW-gb9"/>
<constraint firstItem="Bsb-ps-GWu" firstAttribute="centerX" secondItem="9kx-ct-jms" secondAttribute="centerX" id="IMc-7K-7K5"/>
<constraint firstItem="EV0-Fh-Tdo" firstAttribute="top" secondItem="a9N-Ea-LNm" secondAttribute="bottom" constant="25" id="LuN-SP-Ty3"/>
<constraint firstItem="uf8-tj-KCP" firstAttribute="leading" secondItem="9kx-ct-jms" secondAttribute="leading" constant="20" id="RnR-gU-5ge"/>
<constraint firstItem="flv-Ik-YC2" firstAttribute="leading" secondItem="9kx-ct-jms" secondAttribute="leading" constant="20" id="ahh-fc-oVh"/>
<constraint firstItem="flv-Ik-YC2" firstAttribute="top" secondItem="EV0-Fh-Tdo" secondAttribute="bottom" constant="50" id="bzc-9W-WMj"/>
<constraint firstItem="Bsb-ps-GWu" firstAttribute="width" secondItem="9kx-ct-jms" secondAttribute="width" multiplier="0.6" id="dVr-48-Bua"/>
<constraint firstAttribute="trailing" secondItem="flv-Ik-YC2" secondAttribute="trailing" constant="20" id="lPH-Bs-rcr"/>
<constraint firstAttribute="trailing" secondItem="uf8-tj-KCP" secondAttribute="trailing" constant="20" id="ldF-78-GiQ"/>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="Bsb-ps-GWu" secondAttribute="bottom" constant="30" id="rIj-jg-3HJ"/>
<constraint firstAttribute="trailing" secondItem="EV0-Fh-Tdo" secondAttribute="trailing" constant="20" id="vgr-hi-yXG"/>
<constraint firstAttribute="trailing" secondItem="a9N-Ea-LNm" secondAttribute="trailing" constant="20" id="w5F-Go-Ngy"/>
<constraint firstItem="p6Q-Rn-C6F" firstAttribute="top" secondItem="9kx-ct-jms" secondAttribute="top" id="wKc-Xn-Rpd"/>
<constraint firstAttribute="trailing" secondItem="p6Q-Rn-C6F" secondAttribute="trailing" id="x5P-bs-wTV"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstItem="9kx-ct-jms" firstAttribute="trailing" secondItem="fXc-vI-HgW" secondAttribute="trailing" id="8Bd-Z6-1uf"/>
<constraint firstItem="9kx-ct-jms" firstAttribute="top" secondItem="fXc-vI-HgW" secondAttribute="top" id="8Y9-mr-Nfn"/>
<constraint firstItem="9kx-ct-jms" firstAttribute="bottom" secondItem="fXc-vI-HgW" secondAttribute="bottom" id="CXg-rp-uGE"/>
<constraint firstItem="9kx-ct-jms" firstAttribute="leading" secondItem="fXc-vI-HgW" secondAttribute="leading" id="ROI-RH-O62"/>
<constraint firstItem="9kx-ct-jms" firstAttribute="width" secondItem="wi0-bn-nU4" secondAttribute="width" id="Rkv-dA-vkc"/>
</constraints>
<viewLayoutGuide key="contentLayoutGuide" id="fXc-vI-HgW"/>
<viewLayoutGuide key="frameLayoutGuide" id="wi0-bn-nU4"/>
</scrollView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="QF0-ih-7ii" secondAttribute="trailing" id="1Dp-wN-6ea"/>
<constraint firstItem="qjm-11-Clh" firstAttribute="top" secondItem="y5q-8M-0jB" secondAttribute="top" constant="5" id="KFV-m0-qD9"/>
<constraint firstAttribute="trailing" secondItem="qjm-11-Clh" secondAttribute="trailing" id="SLZ-0e-4Gf"/>
<constraint firstItem="9kx-ct-jms" firstAttribute="height" relation="greaterThanOrEqual" secondItem="y5q-8M-0jB" secondAttribute="height" id="X7v-Nl-Qah"/>
<constraint firstItem="QF0-ih-7ii" firstAttribute="leading" secondItem="y5q-8M-0jB" secondAttribute="leading" id="ioY-Nv-rN8"/>
<constraint firstItem="qjm-11-Clh" firstAttribute="leading" secondItem="y5q-8M-0jB" secondAttribute="leading" id="oVa-yv-1v2"/>
<constraint firstItem="QF0-ih-7ii" firstAttribute="top" secondItem="y5q-8M-0jB" secondAttribute="top" id="pO7-RQ-VKz"/>
<constraint firstAttribute="bottom" secondItem="qjm-11-Clh" secondAttribute="bottom" id="rtH-Ju-JYH"/>
<constraint firstAttribute="bottom" secondItem="QF0-ih-7ii" secondAttribute="bottom" id="ry3-Ls-aHe"/>
</constraints>
</view>
</subviews>
<viewLayoutGuide key="safeArea" id="ca4-2z-k86"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="y5q-8M-0jB" firstAttribute="top" secondItem="ca4-2z-k86" secondAttribute="top" id="3Ep-he-I1K"/>
<constraint firstAttribute="trailing" secondItem="y5q-8M-0jB" secondAttribute="trailing" id="9SI-Tg-N40"/>
<constraint firstAttribute="bottom" secondItem="y5q-8M-0jB" secondAttribute="bottom" id="F8E-Vg-RBL"/>
<constraint firstItem="y5q-8M-0jB" firstAttribute="leading" secondItem="Nlq-Bo-JaK" secondAttribute="leading" id="hAz-9x-GrN"/>
</constraints>
</view>
<connections>
<outlet property="backgroundImage" destination="QF0-ih-7ii" id="TU0-eR-kCH"/>
<outlet property="couponImage" destination="p6Q-Rn-C6F" id="ssz-3x-G4v"/>
<outlet property="couponImageHeight" destination="P2E-Lo-wU3" id="3dt-QC-L8I"/>
<outlet property="descriptionLabel" destination="EV0-Fh-Tdo" id="ytE-oL-jzY"/>
<outlet property="mainView" destination="y5q-8M-0jB" id="bXx-6t-fFP"/>
<outlet property="mainViewBottom" destination="F8E-Vg-RBL" id="MB6-6B-ej7"/>
<outlet property="nameLabel" destination="a9N-Ea-LNm" id="Jcn-tN-yv3"/>
<outlet property="numberTextField" destination="MYX-E6-emS" id="rdP-lB-gCF"/>
<outlet property="redeemButton" destination="Bsb-ps-GWu" id="PcK-Uo-DfZ"/>
<outlet property="scrollContentView" destination="9kx-ct-jms" id="R7e-8z-b7h"/>
<outlet property="scrollView" destination="qjm-11-Clh" id="FNR-5H-KeK"/>
<outlet property="senderArrowImage" destination="Ul8-d9-FfM" id="dol-tk-Wt3"/>
<outlet property="senderButton" destination="YD8-9K-Fp9" id="ZxN-6t-1SJ"/>
<outlet property="senderLabel" destination="GX7-IF-Gdd" id="U5C-LC-trH"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="0nA-Nd-CMT" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3125" y="-555"/>
</scene>
<!--Number Popup View Controller-->
<scene sceneID="4f3-Qv-N77">
<objects>
<viewController storyboardIdentifier="NumberPopupViewController" id="86r-jf-E5J" customClass="NumberPopupViewController" customModule="SwiftWarplyFramework" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="HDn-3J-ASt">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="8Jx-NE-Gpc" userLabel="Main View">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<subviews>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="F4m-zQ-Zh6">
<rect key="frame" x="0.0" y="255.5" width="414" height="596.5"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0xG-Ve-mIx" userLabel="Header View">
<rect key="frame" x="20" y="15" width="374" height="19.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Αποστολέας" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pFK-Hg-dL8">
<rect key="frame" x="0.0" y="0.0" width="324" height="19.5"/>
<fontDescription key="fontDescription" type="system" weight="heavy" pointSize="16"/>
<color key="textColor" red="0.25490196078431371" green="0.33333333333333331" blue="0.39215686274509803" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="KPV-ZJ-Q2P">
<rect key="frame" x="344" y="-5" width="30" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="D8t-oA-ydZ"/>
<constraint firstAttribute="height" constant="30" id="j96-P9-Bf4"/>
</constraints>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="ic_close"/>
<connections>
<action selector="closeButtonAction:" destination="86r-jf-E5J" eventType="touchUpInside" id="sBr-NV-x53"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="KPV-ZJ-Q2P" firstAttribute="centerY" secondItem="0xG-Ve-mIx" secondAttribute="centerY" id="P6g-E9-rFy"/>
<constraint firstItem="KPV-ZJ-Q2P" firstAttribute="leading" secondItem="pFK-Hg-dL8" secondAttribute="trailing" constant="20" id="bH7-Ku-0JS"/>
<constraint firstItem="pFK-Hg-dL8" firstAttribute="top" secondItem="0xG-Ve-mIx" secondAttribute="top" id="cLK-rf-2qg"/>
<constraint firstAttribute="bottom" secondItem="pFK-Hg-dL8" secondAttribute="bottom" id="jRq-Hu-0xA"/>
<constraint firstItem="pFK-Hg-dL8" firstAttribute="leading" secondItem="0xG-Ve-mIx" secondAttribute="leading" id="kS0-D2-zX2"/>
<constraint firstAttribute="trailing" secondItem="KPV-ZJ-Q2P" secondAttribute="trailing" id="tTg-mE-ule"/>
</constraints>
</view>
<tableView clipsSubviews="YES" contentMode="scaleToFill" ambiguous="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="wWu-nN-lGB" customClass="DynamicSizeTableView" customModule="SwiftWarplyFramework" customModuleProvider="target">
<rect key="frame" x="0.0" y="49.5" width="414" height="547"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="separatorColor" red="0.68235294117647061" green="0.68235294117647061" blue="0.68235294117647061" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
<inset key="separatorInset" minX="10" minY="0.0" maxX="10" maxY="0.0"/>
<color key="sectionIndexBackgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="NumbersTableViewCellId" id="bGq-NG-TaP" customClass="NumbersTableViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
<rect key="frame" x="0.0" y="44.5" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="bGq-NG-TaP" id="08f-2t-mOi">
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6Z8-zA-Ilx">
<rect key="frame" x="10" y="0.0" width="394" height="44"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eHE-4G-yAU">
<rect key="frame" x="10" y="13" width="374" height="18"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="15"/>
<color key="textColor" red="0.25490196078431371" green="0.33333333333333331" blue="0.39215686274509803" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="IlA-Ak-aqA" userLabel="Border View">
<rect key="frame" x="0.0" y="43" width="394" height="1"/>
<color key="backgroundColor" red="0.68235294117647061" green="0.68235294117647061" blue="0.68235294117647061" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="rSl-h2-6op"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="eHE-4G-yAU" firstAttribute="leading" secondItem="6Z8-zA-Ilx" secondAttribute="leading" constant="10" id="05O-Qy-VKw"/>
<constraint firstAttribute="trailing" secondItem="eHE-4G-yAU" secondAttribute="trailing" constant="10" id="0bT-Be-Abd"/>
<constraint firstItem="IlA-Ak-aqA" firstAttribute="leading" secondItem="6Z8-zA-Ilx" secondAttribute="leading" id="5iQ-M7-Pmi"/>
<constraint firstItem="eHE-4G-yAU" firstAttribute="centerY" secondItem="6Z8-zA-Ilx" secondAttribute="centerY" id="7n2-QE-6LB"/>
<constraint firstAttribute="trailing" secondItem="IlA-Ak-aqA" secondAttribute="trailing" id="QAJ-2x-FK5"/>
<constraint firstAttribute="bottom" secondItem="IlA-Ak-aqA" secondAttribute="bottom" id="tyv-10-bOi"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="6Z8-zA-Ilx" firstAttribute="top" secondItem="08f-2t-mOi" secondAttribute="top" id="5hE-1W-gRl"/>
<constraint firstAttribute="bottom" secondItem="6Z8-zA-Ilx" secondAttribute="bottom" id="KMc-ya-Gaq"/>
<constraint firstItem="6Z8-zA-Ilx" firstAttribute="leading" secondItem="08f-2t-mOi" secondAttribute="leading" constant="10" id="SQ8-Ec-lat"/>
<constraint firstAttribute="trailing" secondItem="6Z8-zA-Ilx" secondAttribute="trailing" constant="10" id="zFo-Fy-vhe"/>
</constraints>
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<outlet property="borderView" destination="IlA-Ak-aqA" id="KBo-Aw-eL0"/>
<outlet property="numberLabel" destination="eHE-4G-yAU" id="NgW-rh-H4I"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="86r-jf-E5J" id="Fen-0z-hr8"/>
<outlet property="delegate" destination="86r-jf-E5J" id="Vl4-vH-1TN"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="wWu-nN-lGB" secondAttribute="bottom" constant="30" id="HQU-rY-rMH"/>
<constraint firstItem="wWu-nN-lGB" firstAttribute="leading" secondItem="F4m-zQ-Zh6" secondAttribute="leading" id="LbR-zf-qNh"/>
<constraint firstAttribute="trailing" secondItem="0xG-Ve-mIx" secondAttribute="trailing" constant="20" id="RDX-Zk-Nof"/>
<constraint firstAttribute="trailing" secondItem="wWu-nN-lGB" secondAttribute="trailing" id="Sts-YR-8kY"/>
<constraint firstItem="0xG-Ve-mIx" firstAttribute="leading" secondItem="F4m-zQ-Zh6" secondAttribute="leading" constant="20" id="T22-wc-vEO"/>
<constraint firstItem="0xG-Ve-mIx" firstAttribute="top" secondItem="F4m-zQ-Zh6" secondAttribute="top" constant="15" id="dDT-Qg-4jf"/>
<constraint firstItem="wWu-nN-lGB" firstAttribute="top" secondItem="0xG-Ve-mIx" secondAttribute="bottom" constant="15" id="hJm-Bn-Mtw"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.2196078431372549" green="0.32156862745098036" blue="0.40392156862745099" alpha="0.57999999999999996" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="F4m-zQ-Zh6" secondAttribute="bottom" id="0IG-5A-Zmi"/>
<constraint firstAttribute="trailing" secondItem="F4m-zQ-Zh6" secondAttribute="trailing" id="eer-CU-UZe"/>
<constraint firstItem="F4m-zQ-Zh6" firstAttribute="leading" secondItem="8Jx-NE-Gpc" secondAttribute="leading" id="kqx-eL-5ee"/>
<constraint firstItem="F4m-zQ-Zh6" firstAttribute="height" relation="lessThanOrEqual" secondItem="8Jx-NE-Gpc" secondAttribute="height" multiplier="0.7" id="u1s-Fn-9ey"/>
</constraints>
</view>
</subviews>
<viewLayoutGuide key="safeArea" id="EYC-Ne-yWd"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="8Jx-NE-Gpc" firstAttribute="top" secondItem="HDn-3J-ASt" secondAttribute="top" id="WQC-0P-Ddg"/>
<constraint firstAttribute="bottom" secondItem="8Jx-NE-Gpc" secondAttribute="bottom" id="Ypa-HF-Q4d"/>
<constraint firstAttribute="trailing" secondItem="8Jx-NE-Gpc" secondAttribute="trailing" id="ca9-Ne-RbJ"/>
<constraint firstItem="8Jx-NE-Gpc" firstAttribute="leading" secondItem="HDn-3J-ASt" secondAttribute="leading" id="j92-Cc-5Ey"/>
</constraints>
</view>
<connections>
<outlet property="closeButton" destination="KPV-ZJ-Q2P" id="oTp-fO-9bh"/>
<outlet property="headerLabel" destination="pFK-Hg-dL8" id="D2P-aU-UBx"/>
<outlet property="popupView" destination="F4m-zQ-Zh6" id="nu6-T7-eEv"/>
<outlet property="tableView" destination="wWu-nN-lGB" id="Q2o-6b-qzD"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="KVs-gk-qeE" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3903" y="-555"/>
</scene>
<!--Coupon View Controller-->
<scene sceneID="yGm-Im-aAN">
<objects>
......@@ -1399,6 +1754,7 @@
<image name="curved_bg_white" width="159.5" height="118.5"/>
<image name="dfy_logo_white" width="1611" height="395"/>
<image name="ic_background_circle" width="214" height="134"/>
<image name="ic_close" width="17" height="17.5"/>
<image name="ic_down_dark" width="22" height="11.5"/>
<image name="new_icon" width="37" height="17"/>
<image name="wallet_coupons" width="63" height="73"/>
......
{
"images" : [
{
"filename" : "ic_close.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_close-1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_close-2.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -87,6 +87,7 @@
- (void)cosmoteSharingAsync:(NSString*)sharingId :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)cosmoteRetrieveSharingAsync:(NSString*)sharingId :(NSNumber*)accept :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)getCosmoteUserAsync:(NSString*)guid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)cosmoteCouponSharingAsync:(NSString*) coupon :(NSString*)sender :(NSString*)receiver :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
@end
#endif /* MyApi_h */
......
......@@ -1431,4 +1431,17 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify";
}];
}
- (void)cosmoteCouponSharingAsync:(NSString*) coupon :(NSString*)sender :(NSString*)receiver :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure
{
[[Warply sharedService] cosmoteCouponSharingWithSuccessBlock:coupon :sender :receiver :^(NSDictionary *response) {
if (success) {
success(response);
}
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
}
@end
......
//
// NumberPopupViewController.swift
// SwiftWarplyFramework
//
// Created by Manos Chorianopoulos on 15/7/22.
//
import UIKit
protocol NumbersPopupDelegate {
func numbersPopupTapped(_ sender: Any)
func presentedPopup()
func dismissedPopup()
func optionSelected(_ option: String)
}
@objc public class NumberPopupViewController: UIViewController, UIPopoverPresentationControllerDelegate {
@IBOutlet weak var popupView: UIView!
@IBOutlet weak var headerLabel: UILabel!
@IBOutlet weak var closeButton: UIButton!
@IBOutlet weak var tableView: UITableView!
let uiscreen: CGRect = UIScreen.main.bounds
var delegateBallon: NumbersPopupDelegate?
var numbersList: Array<String> = []
var widthPopup: Int = 0
var heightPopup: Int = 0
func InitWithController(controller: UIViewController, numbersList: Array<String>, sender: Any, delegate: NumbersPopupDelegate){
//print("Ok InitWithController sender ")
delegateBallon = delegate
// set the presentation style
self.modalPresentationStyle = UIModalPresentationStyle.popover
// set up the popover presentation controller
// self.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection.up
self.popoverPresentationController?.delegate = self
self.popoverPresentationController?.sourceView = (sender as! UIView ) // button
//--- Better center of the arrow
// let rect: CGRect = (sender as AnyObject).bounds
// let rectFixed: CGRect = CGRect(x: rect.origin.x, y: rect.origin.y, width: rect.size.width-10, height: rect.size.height)
// self.popoverPresentationController?.sourceRect = rectFixed
self.popoverPresentationController?.backgroundColor = UIColor.clear
// self.popoverPresentationController?.backgroundColor = UIColor(red: 0.22, green: 0.32, blue: 0.40, alpha: 0.58)
DispatchQueue.main.async {
// present the popover
controller.present(self, animated: true, completion: nil)
}
self.numbersList = numbersList
}
public override func viewWillAppear(_ animated: Bool) {
// self.SetInfoText(t: infoText ?? "")
}
public override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
// setupScreens()
tableView.delegate = self
tableView.dataSource = self
popupView.clipsToBounds = true
popupView.layer.cornerRadius = 12
popupView.layer.maskedCorners = [ .layerMinXMinYCorner, .layerMaxXMinYCorner] // Top left, right corner radius
self.preferredContentSize = CGSize(width: widthPopup, height: heightPopup)
closeButton.setImage(UIImage(named: "ic_close.png", in: Bundle(for: MyEmptyClass.self), compatibleWith: nil), for: .normal)
closeButton.imageView?.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5)
// self.tableView.reloadData()
self.tableView.invalidateIntrinsicContentSize()
}
func setupScreens() {
// if UIDevice.current.userInterfaceIdiom == .pad {
// // Do what you want
// widthPopup = 450
// heightPopup = 550
// textView.font = UIFont(name: Fonts.ProximaNova.semibold, size: 20)
// } else if UIDevice.current.userInterfaceIdiom == .phone {
// // Do what you want
// widthPopup = 250
// heightPopup = 360
// textView.font = UIFont(name: Fonts.ProximaNova.semibold, size: 14)
// }
}
public override func viewDidAppear(_ animated: Bool) {
delegateBallon?.presentedPopup()
}
public override func viewDidDisappear(_ animated: Bool) {
delegateBallon?.dismissedPopup()
}
// func SetInfoText(t: String){
// infoTextView.text = t
// infoTextView.scrollRangeToVisible(NSRange(location:0, length:0))
// }
public override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
public override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
//print("In prepare")
}
public func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle {
return UIModalPresentationStyle.fullScreen
}
public func adaptivePresentationStyle(for controller: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle {
return UIModalPresentationStyle.fullScreen
// return UIModalPresentationStyle.none
}
// MARK: - UIButton Action
@IBAction func closeButtonAction(_ sender: Any) {
self.dismiss(animated: true, completion: {
})
}
}
// MARK: - TableView
extension NumberPopupViewController: UITableViewDelegate, UITableViewDataSource{
public func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.numbersList.count
}
public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 50 //+ 30.0
// return UITableViewAutomaticDimension
}
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "NumbersTableViewCellId", for: indexPath) as! NumbersTableViewCell
let isLast = indexPath.row == (self.numbersList.count - 1)
cell.configureCell(number: numbersList[indexPath.row], isLast: isLast)
return cell
}
public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
delegateBallon?.optionSelected(self.numbersList[indexPath.row])
self.dismiss(animated: true, completion: {})
// Logs
// let couponSetData: swiftApi.CouponSetItemModel? = coupons[indexPath.row].couponset_data
// print("Coupon clicked: " + (coupons[indexPath.row].coupon ?? ""))
// print("Coupon Name clicked: " + (couponSetData?.name ?? ""))
// print("Coupon Description clicked: " + (couponSetData?.short_description ?? ""))
// print("Coupon Expiration clicked: " + (coupons[indexPath.row].expiration ?? ""))
//
// let storyboard = UIStoryboard(name: "Main", bundle: nil)
// let vc = storyboard.instantiateViewController(withIdentifier: "CouponBarcodeViewController") as! CouponBarcodeViewController
// vc.coupon = coupons[indexPath.row]
// self.navigationController?.pushViewController(vc, animated: true)
}
}
// Class for dynamic height table view
@objc public class DynamicSizeTableView: UITableView
{
override public func layoutSubviews() {
super.layoutSubviews()
if bounds.size != intrinsicContentSize {
invalidateIntrinsicContentSize()
}
}
override public var intrinsicContentSize: CGSize {
return contentSize
}
}
//
// NumbersTableViewCell.swift
// SwiftWarplyFramework
//
// Created by Manos Chorianopoulos on 15/7/22.
//
import UIKit
@objc public class NumbersTableViewCell: UITableViewCell {
@IBOutlet weak var numberLabel: UILabel!
@IBOutlet weak var borderView: UIView!
public override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
public override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
// override func layoutSubviews() {
// super.layoutSubviews()
//
// //set the values for top,left,bottom,right margins
// let margins = UIEdgeInsets(top: 0, left: 0, bottom: 30, right: 0)
// contentView.frame = contentView.frame.inset(by: margins)
// }
func configureCell(number: String, isLast: Bool) {
numberLabel.text = number
if (isLast) {
borderView.isHidden = true
} else {
borderView.isHidden = false
}
}
}
//
// ShareViewController.swift
// SwiftWarplyFramework
//
// Created by Manos Chorianopoulos on 15/7/22.
//
import UIKit
@objc public class ShareViewController: UIViewController, UITextFieldDelegate, UIPopoverControllerDelegate {
@IBOutlet weak var mainView: UIView!
@IBOutlet weak var mainViewBottom: NSLayoutConstraint!
@IBOutlet weak var backgroundImage: UIImageView!
@IBOutlet weak var scrollView: UIScrollView!
@IBOutlet weak var scrollContentView: UIView!
@IBOutlet weak var couponImage: UIImageView!
@IBOutlet weak var couponImageHeight: NSLayoutConstraint!
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var descriptionLabel: UILabel!
@IBOutlet weak var senderLabel: UILabel!
@IBOutlet weak var senderArrowImage: UIImageView!
@IBOutlet weak var senderButton: UIButton!
@IBOutlet weak var numberTextField: UITextField!
@IBOutlet weak var redeemButton: UIButton!
let uiscreen: CGRect = UIScreen.main.bounds
public var coupon: swiftApi.CouponItemModel?
var selectedNumber: String = ""
var numbersList: Array<String> = []
public override func viewDidLoad() {
super.viewDidLoad()
self.hidesBottomBarWhenPushed = true
NotificationCenter.default.addObserver(self,
selector: #selector(self.keyboardNotification(notification:)),
name: UIResponder.keyboardWillChangeFrameNotification,
object: nil)
self.setupToHideKeyboardOnTapOnView()
numberTextField.delegate = self
getProfileRequest()
// Do any additional setup after loading the view.
setBackButton()
setNavigationTitle("Κάντο δώρο!")
backgroundImage.image = UIImage(named: "coupons_scrollview_white", in: Bundle(for: MyEmptyClass.self), compatibleWith: nil)
scrollView.clipsToBounds = true
scrollView.layer.cornerRadius = 30
scrollView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius
// COUPONSET: desc, img_preview, name, terms
// COUPON: coupon, expiration, discount, status
let couponSetData: swiftApi.CouponSetItemModel? = coupon?.couponset_data
couponImage.load(link: couponSetData?.img_preview ?? "", placeholder: UIImage(), cache: URLCache())
couponImage.contentMode = .scaleAspectFill
couponImageHeight.constant = self.uiscreen.height * 0.25
nameLabel.text = couponSetData?.name ?? ""
descriptionLabel.text = couponSetData?.short_description ?? ""
senderLabel.text = "Αποστολέας"
senderArrowImage.image = UIImage(named: "ic_down_dark", in: Bundle(for: MyEmptyClass.self), compatibleWith: nil)
senderButton.addTarget(self, action: #selector(self.numbersPopupTapped(_:)), for: .touchUpInside)
numberTextField.font = UIFont.systemFont(ofSize: 15, weight: UIFont.Weight.medium)
numberTextField.textColor = UIColor(red: 0.25, green: 0.33, blue: 0.39, alpha: 1.00)
numberTextField.attributedPlaceholder = NSAttributedString(string: "Καταχώρηση τηλεφώνου", attributes: [NSAttributedString.Key.foregroundColor: UIColor(red: 0.68, green: 0.68, blue: 0.68, alpha: 1.00)])
numberTextField.keyboardType = .asciiCapableNumberPad
redeemButton.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .semibold)
redeemButton.setTitle("Αποστολή με SMS", for: .normal)
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
}
deinit {
NotificationCenter.default.removeObserver(self)
}
@objc func keyboardNotification(notification: NSNotification) {
guard let userInfo = notification.userInfo else { return }
let endFrame = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue
let endFrameY = endFrame?.origin.y ?? 0
let duration:TimeInterval = (userInfo[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber)?.doubleValue ?? 0
let animationCurveRawNSN = userInfo[UIResponder.keyboardAnimationCurveUserInfoKey] as? NSNumber
let animationCurveRaw = animationCurveRawNSN?.uintValue ?? UIView.AnimationOptions.curveEaseInOut.rawValue
let animationCurve:UIView.AnimationOptions = UIView.AnimationOptions(rawValue: animationCurveRaw)
if endFrameY >= UIScreen.main.bounds.size.height {
self.mainViewBottom?.constant = 0.0
} else {
self.mainViewBottom?.constant = endFrame?.size.height ?? 0.0
}
UIView.animate(
withDuration: duration,
delay: TimeInterval(0),
options: animationCurve,
animations: { self.view.layoutIfNeeded() },
completion: nil)
}
// MARK: - Functions
func showSendDialog() -> Void {
let alert = UIAlertController(title: "Στείλε δώρο", message: "Είσαι σίγουρος ότι θέλεις να κάνεις δώρο το κουπόνι σου;", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Αποστολή", style: .default, handler: { action in
switch action.style{
case .default:
self.cosmoteCouponSharingRequest()
case .cancel:
print("cancel")
case .destructive:
print("destructive")
}
}))
alert.addAction(UIAlertAction(title: "Άκυρο", style: .default, handler: { action in
switch action.style{
case .default:
print("default")
case .cancel:
print("cancel")
case .destructive:
print("destructive")
}
}))
self.present(alert, animated: true, completion: nil)
}
func showDialog(_ alertTitle: String, _ alertSubTitle: String) -> Void {
let alert = UIAlertController(title: alertTitle, message: alertSubTitle, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in
switch action.style{
case .default:
print("default")
case .cancel:
print("cancel")
case .destructive:
print("destructive")
}
}))
self.present(alert, animated: true, completion: nil)
}
// MARK: - API Calls
func getProfileRequest() {
swiftApi().getProfileAsync(getProfileCallback)
}
func getProfileCallback (_ profileData: swiftApi.ProfileModel?) -> Void {
if (profileData != nil) {
DispatchQueue.main.async {
self.numbersList = profileData?.msisdnList ?? []
print("========= getProfileRequest SUCCESSSS =========")
}
} else {
print("========= getProfileRequest ERROR =========")
}
}
func cosmoteCouponSharingRequest() {
swiftApi().cosmoteCouponSharingAsync(coupon: coupon?.coupon ?? "", sender: selectedNumber, receiver: numberTextField.text ?? "", couponSharingCallback)
}
func couponSharingCallback (_ response: swiftApi.GenericResponseModel?) -> Void {
if (response != nil) {
DispatchQueue.main.async {
if (response?.getStatus == 1) {
self.showDialog("Συγχαρητήρια!","Μόλις έκανες δώρο ένα κουπόνι!")
// swiftApi().getCouponsAsync(getCouponsCallback)
//
// func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void {
// if (couponsData != nil) {
//
// DispatchQueue.main.async {
// print("========= getCouponsRequest SUCCESSSS CouponViewController =========")
// }
// } else {
// print("========= getCouponsRequest ERROR CouponViewController =========")
// }
// }
} else {
self.showDialog("Αποτυχία","Κάτι πήγε στραβά")
}
}
} else {
self.showDialog("Αποτυχία","Κάτι πήγε στραβά")
}
}
// MARK: - Actions
@IBAction func redeemButtomAction(_ sender: Any) {
if (selectedNumber == "" || numberTextField.text == "") {
self.showDialog("Αποτυχία","Τα πεδία δεν είναι σωστά")
} else {
self.showSendDialog()
}
}
}
// MARK: NumbersPopup
extension ShareViewController: NumbersPopupDelegate {
@objc func numbersPopupTapped(_ sender: Any) {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
// self.storyboard?
let pp = storyboard.instantiateViewController(withIdentifier: "NumberPopupViewController") as! SwiftWarplyFramework.NumberPopupViewController
pp.InitWithController(controller: self,
numbersList: self.numbersList,
sender: sender,
delegate: self)
}
func presentedPopup() {
// Code for when popup is presented
}
func dismissedPopup() {
// Code for when popup is dismissed
}
func optionSelected(_ option: String) {
// Code for when option is selected
selectedNumber = option
senderLabel.text = option
}
}
......@@ -378,6 +378,8 @@ WL_VERSION_INTERFACE()
- (void) redeemCouponSetsWithSuccessBlock:(NSString*) uuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void) cosmoteCouponSharingWithSuccessBlock:(NSString*) coupon :(NSString*)sender :(NSString*)receiver :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void) cosmoteSharingWithSuccessBlock:(NSString*) sharingId :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void) cosmoteRetrieveSharingWithSuccessBlock:(NSString*) sharingId :(NSNumber*)accept :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
......
......@@ -1949,7 +1949,48 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
NSLog(@"Error at token %@", error );
}];
}
NSLog(@"Error at get coupon sets %@", error );
NSLog(@"Error at redeem coupon sets %@", error );
}
}];
}
- (void) cosmoteCouponSharingWithSuccessBlock:(NSString*) coupon :(NSString*)sender :(NSString*)receiver :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure
{
NSDictionary *postDictionary = @{@"coupon": @{@"action": @"share", @"coupon": coupon, @"sender_msisdn": sender, @"receiver_msisdn": receiver}};
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:postDictionary options:0 error:NULL];
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
NSLog(@"**************** WARPLY Response *****************" );
NSLog(@"%@", contextResponse );
} failureBlock:^(NSError *error) {
if (failure) {
NSDictionary* dict = [NSDictionary alloc];
dict = [error userInfo];
NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"];
if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) {
[self refreshToken:^(NSDictionary *response) {
[self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) {
if (success) {
success(contextResponse);
}
NSLog(@"**************** WARPLY Response *****************" );
NSLog(@"%@", contextResponse );
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
} failureBlock:^(NSError *error) {
if (failure) {
[_db executeUpdate:@"DROP TABLE requestVariables"];
failure(error);
}
NSLog(@"Error at token %@", error );
}];
}
NSLog(@"Error at cosmote Coupon Sharing %@", error );
}
}];
}
......
......@@ -1216,6 +1216,9 @@ public class swiftApi {
let tempProfile = ProfileModel(dictionary: profileDataResult)
swiftApi().setConsumer(tempProfile ?? swiftApi.ProfileModel())
swiftApi().setUserTag(tempProfile.badge ?? "")
getProfileCallback(tempProfile);
} else {
......@@ -3034,4 +3037,32 @@ public class swiftApi {
}
}
public func cosmoteCouponSharingAsync(coupon: String, sender: String, receiver: String, _ couponSharingCallback: @escaping (_ responseData: GenericResponseModel?) -> Void) -> Void {
let instanceOfMyApi = MyApi()
instanceOfMyApi.cosmoteCouponSharingAsync(coupon, sender, receiver, requestCallback, failureBlock: requestFailureCallback)
func requestCallback(_ responseData: [AnyHashable: Any]?) -> Void {
if let responseDataDictionary = responseData as? [String: Any] {
let tempResponse = GenericResponseModel(dictionary: responseDataDictionary)
couponSharingCallback(tempResponse);
} else {
couponSharingCallback(nil)
}
}
func requestFailureCallback(_ error: Error?) -> Void {
print("cosmoteCouponSharing error: ")
print(error)
print("====================")
couponSharingCallback(nil)
}
}
}
......