Manos Chorianopoulos

add terms to ContextualViewController

...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
7 <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key> 7 <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key>
8 <dict> 8 <dict>
9 <key>orderHint</key> 9 <key>orderHint</key>
10 - <integer>1</integer> 10 + <integer>0</integer>
11 </dict> 11 </dict>
12 </dict> 12 </dict>
13 </dict> 13 </dict>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
7 <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key> 7 <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
8 <dict> 8 <dict>
9 <key>orderHint</key> 9 <key>orderHint</key>
10 - <integer>0</integer> 10 + <integer>1</integer>
11 </dict> 11 </dict>
12 </dict> 12 </dict>
13 </dict> 13 </dict>
......
...@@ -19,10 +19,14 @@ import SwiftEventBus ...@@ -19,10 +19,14 @@ import SwiftEventBus
19 @IBOutlet weak var descriptionLabel: UILabel! 19 @IBOutlet weak var descriptionLabel: UILabel!
20 @IBOutlet weak var redeemButton: UIButton! 20 @IBOutlet weak var redeemButton: UIButton!
21 @IBOutlet weak var topBorderLine: UIImageView! 21 @IBOutlet weak var topBorderLine: UIImageView!
22 + @IBOutlet weak var termsButton: UIButton!
23 + @IBOutlet weak var termsTextView: UnselectableTappableTextView!
24 + @IBOutlet weak var termsTextViewHeight: NSLayoutConstraint!
22 25
23 public var ccms: swiftApi.LoyaltyContextualOfferModel? 26 public var ccms: swiftApi.LoyaltyContextualOfferModel?
24 27
25 var selectedNumber: String = "" 28 var selectedNumber: String = ""
29 + var termsVisible: Bool = false;
26 public var numbersList: Array<String> = [] 30 public var numbersList: Array<String> = []
27 31
28 let uiscreen: CGRect = UIScreen.main.bounds 32 let uiscreen: CGRect = UIScreen.main.bounds
...@@ -87,6 +91,25 @@ import SwiftEventBus ...@@ -87,6 +91,25 @@ import SwiftEventBus
87 // redeemButton.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 0.6).isActive = true 91 // redeemButton.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 0.6).isActive = true
88 // } 92 // }
89 93
94 + termsButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 15)
95 +// termsButton.imageView?.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5)
96 + termsButton.setTitle("Όροι χρήσης", for: .normal)
97 + termsButton.setTitleColor(UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00), for: .normal)
98 + termsButton.setImage(UIImage(named: "ic_down_dark_2.png", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal)
99 + termsButton.semanticContentAttribute = .forceRightToLeft
100 + termsButton.tintColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 1.00)
101 + termsButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 0);
102 + termsButton.titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5);
103 + termsButton.imageView?.layer.transform = CATransform3DMakeScale(0.8, 0.8, 0.8)
104 +
105 + termsTextView.text = ccms?._termsAndConditions ?? ""
106 + termsTextView.font = UIFont(name: "PeridotPE-Regular", size: 14)
107 + termsTextView.textColor = UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00)
108 + termsTextView.textAlignment = .left
109 + termsTextView.isScrollEnabled = false
110 +
111 + toggleTerms()
112 +
90 } 113 }
91 114
92 public override func viewWillAppear(_ animated: Bool) { 115 public override func viewWillAppear(_ animated: Bool) {
...@@ -99,6 +122,21 @@ import SwiftEventBus ...@@ -99,6 +122,21 @@ import SwiftEventBus
99 122
100 123
101 // MARK: - Functions 124 // MARK: - Functions
125 + func toggleTerms() {
126 + if (termsVisible) {
127 + termsTextView.isHidden = false
128 + let targetSize = CGSize(width: termsTextView.frame.width, height: CGFloat(MAXFLOAT))
129 + termsTextViewHeight.constant = termsTextView.sizeThatFits(targetSize).height
130 +
131 + termsButton.setImage(UIImage(named: "ic_up_dark_2.png", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal)
132 + } else {
133 + termsTextView.isHidden = true
134 + termsTextViewHeight.constant = CGFloat(0)
135 +
136 + termsButton.setImage(UIImage(named: "ic_down_dark_2.png", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal)
137 + }
138 + }
139 +
102 func showConfirmDialog() -> Void { 140 func showConfirmDialog() -> Void {
103 141
104 let alert = UIAlertController(title: "Ενεργοποίηση υπηρεσίας", message: "Θέλετε να γίνει ενεργοποίηση στο Κινητό μου;", preferredStyle: .alert) 142 let alert = UIAlertController(title: "Ενεργοποίηση υπηρεσίας", message: "Θέλετε να γίνει ενεργοποίηση στο Κινητό μου;", preferredStyle: .alert)
...@@ -234,6 +272,11 @@ import SwiftEventBus ...@@ -234,6 +272,11 @@ import SwiftEventBus
234 self.numbersPopupTapped(sender) 272 self.numbersPopupTapped(sender)
235 } 273 }
236 274
275 + @IBAction func termsButtonAction(_ sender: Any) {
276 + termsVisible = !termsVisible
277 + toggleTerms()
278 + }
279 +
237 } 280 }
238 281
239 // MARK: NumbersPopup 282 // MARK: NumbersPopup
......
...@@ -6465,10 +6465,10 @@ ...@@ -6465,10 +6465,10 @@
6465 <rect key="frame" x="0.0" y="0.0" width="414" height="852"/> 6465 <rect key="frame" x="0.0" y="0.0" width="414" height="852"/>
6466 </imageView> 6466 </imageView>
6467 <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fVG-0L-fYi"> 6467 <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fVG-0L-fYi">
6468 - <rect key="frame" x="0.0" y="2" width="414" height="850"/> 6468 + <rect key="frame" x="0.0" y="0.0" width="414" height="848"/>
6469 <subviews> 6469 <subviews>
6470 <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="NHe-cF-AMf"> 6470 <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="NHe-cF-AMf">
6471 - <rect key="frame" x="0.0" y="0.0" width="414" height="852"/> 6471 + <rect key="frame" x="0.0" y="0.0" width="414" height="976"/>
6472 <subviews> 6472 <subviews>
6473 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="I4T-wN-u9w"> 6473 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="I4T-wN-u9w">
6474 <rect key="frame" x="0.0" y="0.0" width="414" height="200"/> 6474 <rect key="frame" x="0.0" y="0.0" width="414" height="200"/>
...@@ -6502,20 +6502,53 @@ ...@@ -6502,20 +6502,53 @@
6502 <action selector="redeemButtomAction:" destination="KhM-xm-T4L" eventType="touchUpInside" id="EqO-ze-Bau"/> 6502 <action selector="redeemButtomAction:" destination="KhM-xm-T4L" eventType="touchUpInside" id="EqO-ze-Bau"/>
6503 </connections> 6503 </connections>
6504 </button> 6504 </button>
6505 + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qfh-TT-YEH">
6506 + <rect key="frame" x="103.5" y="514" width="207" height="40"/>
6507 + <constraints>
6508 + <constraint firstAttribute="height" constant="40" id="fLZ-B6-6aQ"/>
6509 + </constraints>
6510 + <fontDescription key="fontDescription" name="PFSquareSansPro-Medium" family="PF Square Sans Pro" pointSize="16"/>
6511 + <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="5" maxY="0.0"/>
6512 + <state key="normal" title="Όροι χρήσης" image="ic_down_dark">
6513 + <color key="titleColor" red="0.25490196079999999" green="0.33333333329999998" blue="0.3921568627" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
6514 + <preferredSymbolConfiguration key="preferredSymbolConfiguration"/>
6515 + </state>
6516 + <connections>
6517 + <action selector="termsButtonAction:" destination="KhM-xm-T4L" eventType="touchUpInside" id="WK1-oh-42X"/>
6518 + </connections>
6519 + </button>
6520 + <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" textAlignment="center" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rj7-WU-hBg" customClass="UnselectableTappableTextView" customModule="SwiftWarplyFramework">
6521 + <rect key="frame" x="20" y="554" width="374" height="0.0"/>
6522 + <color key="backgroundColor" systemColor="systemBackgroundColor"/>
6523 + <constraints>
6524 + <constraint firstAttribute="height" id="uyd-BH-kJs"/>
6525 + </constraints>
6526 + <color key="textColor" red="0.25490196079999999" green="0.33333333329999998" blue="0.3921568627" alpha="1" colorSpace="calibratedRGB"/>
6527 + <fontDescription key="fontDescription" name="PFSquareSansPro-Regular" family="PF Square Sans Pro" pointSize="15"/>
6528 + <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
6529 + </textView>
6505 </subviews> 6530 </subviews>
6506 <color key="backgroundColor" systemColor="systemBackgroundColor"/> 6531 <color key="backgroundColor" systemColor="systemBackgroundColor"/>
6507 <constraints> 6532 <constraints>
6508 <constraint firstItem="8BE-qj-xn5" firstAttribute="leading" secondItem="NHe-cF-AMf" secondAttribute="leading" constant="20" id="0Go-Zc-Qdz"/> 6533 <constraint firstItem="8BE-qj-xn5" firstAttribute="leading" secondItem="NHe-cF-AMf" secondAttribute="leading" constant="20" id="0Go-Zc-Qdz"/>
6534 + <constraint firstItem="rj7-WU-hBg" firstAttribute="leading" secondItem="NHe-cF-AMf" secondAttribute="leading" constant="20" id="2hP-tS-iws"/>
6509 <constraint firstAttribute="trailing" secondItem="I4T-wN-u9w" secondAttribute="trailing" id="38i-gl-gom"/> 6535 <constraint firstAttribute="trailing" secondItem="I4T-wN-u9w" secondAttribute="trailing" id="38i-gl-gom"/>
6536 + <constraint firstItem="rj7-WU-hBg" firstAttribute="top" secondItem="qfh-TT-YEH" secondAttribute="bottom" id="Ci9-Mp-llM"/>
6510 <constraint firstItem="I4T-wN-u9w" firstAttribute="leading" secondItem="NHe-cF-AMf" secondAttribute="leading" id="Kwd-Io-bdQ"/> 6537 <constraint firstItem="I4T-wN-u9w" firstAttribute="leading" secondItem="NHe-cF-AMf" secondAttribute="leading" id="Kwd-Io-bdQ"/>
6538 + <constraint firstItem="qfh-TT-YEH" firstAttribute="centerX" secondItem="NHe-cF-AMf" secondAttribute="centerX" id="L51-z9-h6b"/>
6511 <constraint firstItem="mbx-MR-VPL" firstAttribute="top" secondItem="8BE-qj-xn5" secondAttribute="bottom" constant="15" id="MoO-Rt-CES"/> 6539 <constraint firstItem="mbx-MR-VPL" firstAttribute="top" secondItem="8BE-qj-xn5" secondAttribute="bottom" constant="15" id="MoO-Rt-CES"/>
6512 <constraint firstItem="qnn-bi-fLK" firstAttribute="top" secondItem="mbx-MR-VPL" secondAttribute="bottom" constant="100" id="T9O-Lp-JKw"/> 6540 <constraint firstItem="qnn-bi-fLK" firstAttribute="top" secondItem="mbx-MR-VPL" secondAttribute="bottom" constant="100" id="T9O-Lp-JKw"/>
6513 <constraint firstAttribute="trailing" secondItem="mbx-MR-VPL" secondAttribute="trailing" constant="20" id="Tx9-8c-EZY"/> 6541 <constraint firstAttribute="trailing" secondItem="mbx-MR-VPL" secondAttribute="trailing" constant="20" id="Tx9-8c-EZY"/>
6514 <constraint firstItem="mbx-MR-VPL" firstAttribute="leading" secondItem="NHe-cF-AMf" secondAttribute="leading" constant="20" id="aL7-MN-hd4"/> 6542 <constraint firstItem="mbx-MR-VPL" firstAttribute="leading" secondItem="NHe-cF-AMf" secondAttribute="leading" constant="20" id="aL7-MN-hd4"/>
6543 + <constraint firstItem="qfh-TT-YEH" firstAttribute="width" secondItem="NHe-cF-AMf" secondAttribute="width" multiplier="0.5" id="ePB-h0-1Lg"/>
6515 <constraint firstItem="qnn-bi-fLK" firstAttribute="centerX" secondItem="NHe-cF-AMf" secondAttribute="centerX" id="hKA-X6-Nnh"/> 6544 <constraint firstItem="qnn-bi-fLK" firstAttribute="centerX" secondItem="NHe-cF-AMf" secondAttribute="centerX" id="hKA-X6-Nnh"/>
6516 <constraint firstAttribute="trailing" secondItem="8BE-qj-xn5" secondAttribute="trailing" constant="20" id="n53-MH-KG1"/> 6545 <constraint firstAttribute="trailing" secondItem="8BE-qj-xn5" secondAttribute="trailing" constant="20" id="n53-MH-KG1"/>
6517 <constraint firstItem="I4T-wN-u9w" firstAttribute="top" secondItem="NHe-cF-AMf" secondAttribute="top" id="osK-5K-XQJ"/> 6546 <constraint firstItem="I4T-wN-u9w" firstAttribute="top" secondItem="NHe-cF-AMf" secondAttribute="top" id="osK-5K-XQJ"/>
6547 + <constraint firstItem="qfh-TT-YEH" firstAttribute="top" secondItem="qnn-bi-fLK" secondAttribute="bottom" constant="20" id="qsg-BC-4yw"/>
6548 + <constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="qfh-TT-YEH" secondAttribute="bottom" constant="30" id="qun-VS-Shq"/>
6549 + <constraint firstAttribute="trailing" secondItem="rj7-WU-hBg" secondAttribute="trailing" constant="20" id="svN-9k-yIM"/>
6518 <constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="qnn-bi-fLK" secondAttribute="bottom" constant="30" id="uLb-eO-qwF"/> 6550 <constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="qnn-bi-fLK" secondAttribute="bottom" constant="30" id="uLb-eO-qwF"/>
6551 + <constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="rj7-WU-hBg" secondAttribute="bottom" constant="30" id="vX6-k0-blC"/>
6519 <constraint firstItem="8BE-qj-xn5" firstAttribute="top" secondItem="I4T-wN-u9w" secondAttribute="bottom" constant="30" id="wFo-Wh-noH"/> 6552 <constraint firstItem="8BE-qj-xn5" firstAttribute="top" secondItem="I4T-wN-u9w" secondAttribute="bottom" constant="30" id="wFo-Wh-noH"/>
6520 </constraints> 6553 </constraints>
6521 </view> 6554 </view>
...@@ -6576,6 +6609,9 @@ ...@@ -6576,6 +6609,9 @@
6576 <outlet property="redeemButton" destination="qnn-bi-fLK" id="GzF-I5-zC3"/> 6609 <outlet property="redeemButton" destination="qnn-bi-fLK" id="GzF-I5-zC3"/>
6577 <outlet property="scrollContentView" destination="NHe-cF-AMf" id="Jgu-0v-nhF"/> 6610 <outlet property="scrollContentView" destination="NHe-cF-AMf" id="Jgu-0v-nhF"/>
6578 <outlet property="scrollView" destination="fVG-0L-fYi" id="Ia7-im-DSP"/> 6611 <outlet property="scrollView" destination="fVG-0L-fYi" id="Ia7-im-DSP"/>
6612 + <outlet property="termsButton" destination="qfh-TT-YEH" id="Bnc-vr-U5R"/>
6613 + <outlet property="termsTextView" destination="rj7-WU-hBg" id="sP9-Oy-wP7"/>
6614 + <outlet property="termsTextViewHeight" destination="uyd-BH-kJs" id="7jg-eh-0lr"/>
6579 <outlet property="topBorderLine" destination="2cS-C7-kUz" id="wxQ-K4-mao"/> 6615 <outlet property="topBorderLine" destination="2cS-C7-kUz" id="wxQ-K4-mao"/>
6580 </connections> 6616 </connections>
6581 </viewController> 6617 </viewController>
......