Manos Chorianopoulos

add terms to ContextualViewController

......@@ -7,7 +7,7 @@
<key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>
......
......@@ -7,7 +7,7 @@
<key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
</dict>
</dict>
......
......@@ -19,10 +19,14 @@ import SwiftEventBus
@IBOutlet weak var descriptionLabel: UILabel!
@IBOutlet weak var redeemButton: UIButton!
@IBOutlet weak var topBorderLine: UIImageView!
@IBOutlet weak var termsButton: UIButton!
@IBOutlet weak var termsTextView: UnselectableTappableTextView!
@IBOutlet weak var termsTextViewHeight: NSLayoutConstraint!
public var ccms: swiftApi.LoyaltyContextualOfferModel?
var selectedNumber: String = ""
var termsVisible: Bool = false;
public var numbersList: Array<String> = []
let uiscreen: CGRect = UIScreen.main.bounds
......@@ -87,6 +91,25 @@ import SwiftEventBus
// redeemButton.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 0.6).isActive = true
// }
termsButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 15)
// termsButton.imageView?.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5)
termsButton.setTitle("Όροι χρήσης", for: .normal)
termsButton.setTitleColor(UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00), for: .normal)
termsButton.setImage(UIImage(named: "ic_down_dark_2.png", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal)
termsButton.semanticContentAttribute = .forceRightToLeft
termsButton.tintColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 1.00)
termsButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 0);
termsButton.titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5);
termsButton.imageView?.layer.transform = CATransform3DMakeScale(0.8, 0.8, 0.8)
termsTextView.text = ccms?._termsAndConditions ?? ""
termsTextView.font = UIFont(name: "PeridotPE-Regular", size: 14)
termsTextView.textColor = UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00)
termsTextView.textAlignment = .left
termsTextView.isScrollEnabled = false
toggleTerms()
}
public override func viewWillAppear(_ animated: Bool) {
......@@ -99,6 +122,21 @@ import SwiftEventBus
// MARK: - Functions
func toggleTerms() {
if (termsVisible) {
termsTextView.isHidden = false
let targetSize = CGSize(width: termsTextView.frame.width, height: CGFloat(MAXFLOAT))
termsTextViewHeight.constant = termsTextView.sizeThatFits(targetSize).height
termsButton.setImage(UIImage(named: "ic_up_dark_2.png", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal)
} else {
termsTextView.isHidden = true
termsTextViewHeight.constant = CGFloat(0)
termsButton.setImage(UIImage(named: "ic_down_dark_2.png", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal)
}
}
func showConfirmDialog() -> Void {
let alert = UIAlertController(title: "Ενεργοποίηση υπηρεσίας", message: "Θέλετε να γίνει ενεργοποίηση στο Κινητό μου;", preferredStyle: .alert)
......@@ -233,6 +271,11 @@ import SwiftEventBus
@IBAction func redeemButtomAction(_ sender: Any) {
self.numbersPopupTapped(sender)
}
@IBAction func termsButtonAction(_ sender: Any) {
termsVisible = !termsVisible
toggleTerms()
}
}
......
......@@ -6465,10 +6465,10 @@
<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="fVG-0L-fYi">
<rect key="frame" x="0.0" y="2" width="414" height="850"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="848"/>
<subviews>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="NHe-cF-AMf">
<rect key="frame" x="0.0" y="0.0" width="414" height="852"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="976"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="I4T-wN-u9w">
<rect key="frame" x="0.0" y="0.0" width="414" height="200"/>
......@@ -6502,20 +6502,53 @@
<action selector="redeemButtomAction:" destination="KhM-xm-T4L" eventType="touchUpInside" id="EqO-ze-Bau"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qfh-TT-YEH">
<rect key="frame" x="103.5" y="514" width="207" height="40"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="fLZ-B6-6aQ"/>
</constraints>
<fontDescription key="fontDescription" name="PFSquareSansPro-Medium" family="PF Square Sans Pro" pointSize="16"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="5" maxY="0.0"/>
<state key="normal" title="Όροι χρήσης" image="ic_down_dark">
<color key="titleColor" red="0.25490196079999999" green="0.33333333329999998" blue="0.3921568627" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
<preferredSymbolConfiguration key="preferredSymbolConfiguration"/>
</state>
<connections>
<action selector="termsButtonAction:" destination="KhM-xm-T4L" eventType="touchUpInside" id="WK1-oh-42X"/>
</connections>
</button>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" textAlignment="center" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rj7-WU-hBg" customClass="UnselectableTappableTextView" customModule="SwiftWarplyFramework">
<rect key="frame" x="20" y="554" width="374" height="0.0"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="height" id="uyd-BH-kJs"/>
</constraints>
<color key="textColor" red="0.25490196079999999" green="0.33333333329999998" blue="0.3921568627" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" name="PFSquareSansPro-Regular" family="PF Square Sans Pro" pointSize="15"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="8BE-qj-xn5" firstAttribute="leading" secondItem="NHe-cF-AMf" secondAttribute="leading" constant="20" id="0Go-Zc-Qdz"/>
<constraint firstItem="rj7-WU-hBg" firstAttribute="leading" secondItem="NHe-cF-AMf" secondAttribute="leading" constant="20" id="2hP-tS-iws"/>
<constraint firstAttribute="trailing" secondItem="I4T-wN-u9w" secondAttribute="trailing" id="38i-gl-gom"/>
<constraint firstItem="rj7-WU-hBg" firstAttribute="top" secondItem="qfh-TT-YEH" secondAttribute="bottom" id="Ci9-Mp-llM"/>
<constraint firstItem="I4T-wN-u9w" firstAttribute="leading" secondItem="NHe-cF-AMf" secondAttribute="leading" id="Kwd-Io-bdQ"/>
<constraint firstItem="qfh-TT-YEH" firstAttribute="centerX" secondItem="NHe-cF-AMf" secondAttribute="centerX" id="L51-z9-h6b"/>
<constraint firstItem="mbx-MR-VPL" firstAttribute="top" secondItem="8BE-qj-xn5" secondAttribute="bottom" constant="15" id="MoO-Rt-CES"/>
<constraint firstItem="qnn-bi-fLK" firstAttribute="top" secondItem="mbx-MR-VPL" secondAttribute="bottom" constant="100" id="T9O-Lp-JKw"/>
<constraint firstAttribute="trailing" secondItem="mbx-MR-VPL" secondAttribute="trailing" constant="20" id="Tx9-8c-EZY"/>
<constraint firstItem="mbx-MR-VPL" firstAttribute="leading" secondItem="NHe-cF-AMf" secondAttribute="leading" constant="20" id="aL7-MN-hd4"/>
<constraint firstItem="qfh-TT-YEH" firstAttribute="width" secondItem="NHe-cF-AMf" secondAttribute="width" multiplier="0.5" id="ePB-h0-1Lg"/>
<constraint firstItem="qnn-bi-fLK" firstAttribute="centerX" secondItem="NHe-cF-AMf" secondAttribute="centerX" id="hKA-X6-Nnh"/>
<constraint firstAttribute="trailing" secondItem="8BE-qj-xn5" secondAttribute="trailing" constant="20" id="n53-MH-KG1"/>
<constraint firstItem="I4T-wN-u9w" firstAttribute="top" secondItem="NHe-cF-AMf" secondAttribute="top" id="osK-5K-XQJ"/>
<constraint firstItem="qfh-TT-YEH" firstAttribute="top" secondItem="qnn-bi-fLK" secondAttribute="bottom" constant="20" id="qsg-BC-4yw"/>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="qfh-TT-YEH" secondAttribute="bottom" constant="30" id="qun-VS-Shq"/>
<constraint firstAttribute="trailing" secondItem="rj7-WU-hBg" secondAttribute="trailing" constant="20" id="svN-9k-yIM"/>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="qnn-bi-fLK" secondAttribute="bottom" constant="30" id="uLb-eO-qwF"/>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="rj7-WU-hBg" secondAttribute="bottom" constant="30" id="vX6-k0-blC"/>
<constraint firstItem="8BE-qj-xn5" firstAttribute="top" secondItem="I4T-wN-u9w" secondAttribute="bottom" constant="30" id="wFo-Wh-noH"/>
</constraints>
</view>
......@@ -6576,6 +6609,9 @@
<outlet property="redeemButton" destination="qnn-bi-fLK" id="GzF-I5-zC3"/>
<outlet property="scrollContentView" destination="NHe-cF-AMf" id="Jgu-0v-nhF"/>
<outlet property="scrollView" destination="fVG-0L-fYi" id="Ia7-im-DSP"/>
<outlet property="termsButton" destination="qfh-TT-YEH" id="Bnc-vr-U5R"/>
<outlet property="termsTextView" destination="rj7-WU-hBg" id="sP9-Oy-wP7"/>
<outlet property="termsTextViewHeight" destination="uyd-BH-kJs" id="7jg-eh-0lr"/>
<outlet property="topBorderLine" destination="2cS-C7-kUz" id="wxQ-K4-mao"/>
</connections>
</viewController>
......