Showing
5 changed files
with
32 additions
and
6 deletions
... | @@ -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>0</integer> | 10 | + <integer>1</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>1</integer> | 10 | + <integer>0</integer> |
11 | </dict> | 11 | </dict> |
12 | </dict> | 12 | </dict> |
13 | </dict> | 13 | </dict> | ... | ... |
No preview for this file type
... | @@ -8,7 +8,7 @@ | ... | @@ -8,7 +8,7 @@ |
8 | import UIKit | 8 | import UIKit |
9 | import SwiftEventBus | 9 | import SwiftEventBus |
10 | 10 | ||
11 | -@objc public class CouponViewController: UIViewController { | 11 | +@objc public class CouponViewController: UIViewController, UITextViewDelegate { |
12 | @IBOutlet weak var mainView: UIView! | 12 | @IBOutlet weak var mainView: UIView! |
13 | @IBOutlet weak var backgroundImage: UIImageView! | 13 | @IBOutlet weak var backgroundImage: UIImageView! |
14 | @IBOutlet weak var scrollView: UIScrollView! | 14 | @IBOutlet weak var scrollView: UIScrollView! |
... | @@ -16,10 +16,11 @@ import SwiftEventBus | ... | @@ -16,10 +16,11 @@ import SwiftEventBus |
16 | @IBOutlet weak var couponImage: UIImageView! | 16 | @IBOutlet weak var couponImage: UIImageView! |
17 | @IBOutlet weak var couponImageHeight: NSLayoutConstraint! | 17 | @IBOutlet weak var couponImageHeight: NSLayoutConstraint! |
18 | @IBOutlet weak var nameLabel: UILabel! | 18 | @IBOutlet weak var nameLabel: UILabel! |
19 | - @IBOutlet weak var descriptionLabel: UILabel! | 19 | + @IBOutlet weak var descriptionTextView: UnselectableTappableTextView! |
20 | + @IBOutlet weak var descriptionTextViewHeight: NSLayoutConstraint! | ||
20 | @IBOutlet weak var redeemButton: UIButton! | 21 | @IBOutlet weak var redeemButton: UIButton! |
21 | @IBOutlet weak var termsButton: UIButton! | 22 | @IBOutlet weak var termsButton: UIButton! |
22 | - @IBOutlet weak var termsTextView: UITextView! | 23 | + @IBOutlet weak var termsTextView: UnselectableTappableTextView! |
23 | @IBOutlet weak var termsTextViewHeight: NSLayoutConstraint! | 24 | @IBOutlet weak var termsTextViewHeight: NSLayoutConstraint! |
24 | @IBOutlet weak var topBorderLine: UIImageView! | 25 | @IBOutlet weak var topBorderLine: UIImageView! |
25 | 26 | ||
... | @@ -39,6 +40,8 @@ import SwiftEventBus | ... | @@ -39,6 +40,8 @@ import SwiftEventBus |
39 | super.viewDidLoad() | 40 | super.viewDidLoad() |
40 | 41 | ||
41 | self.hidesBottomBarWhenPushed = true | 42 | self.hidesBottomBarWhenPushed = true |
43 | + descriptionTextView.delegate = self | ||
44 | + termsTextView.delegate = self | ||
42 | 45 | ||
43 | // Do any additional setup after loading the view. | 46 | // Do any additional setup after loading the view. |
44 | setBackButton() | 47 | setBackButton() |
... | @@ -78,7 +81,19 @@ import SwiftEventBus | ... | @@ -78,7 +81,19 @@ import SwiftEventBus |
78 | 81 | ||
79 | nameLabel.text = couponset?.name ?? "" | 82 | nameLabel.text = couponset?.name ?? "" |
80 | let htmlDescrText = couponset?.description ?? "" | 83 | let htmlDescrText = couponset?.description ?? "" |
81 | - descriptionLabel.text = htmlDescrText.htmlToString | 84 | + |
85 | + descriptionTextView.attributedText = htmlDescrText.htmlToAttributedString | ||
86 | + descriptionTextView.font = UIFont(name: "PFSquareSansPro-Regular", size: 17) | ||
87 | + descriptionTextView.textColor = UIColor(red: 0.25, green: 0.33, blue: 0.39, alpha: 1.00) | ||
88 | + descriptionTextView.textAlignment = .center | ||
89 | + descriptionTextView.isScrollEnabled = false | ||
90 | + descriptionTextView.isUserInteractionEnabled = true | ||
91 | + descriptionTextView.isEditable = false | ||
92 | + descriptionTextView.isSelectable = true | ||
93 | + descriptionTextView.dataDetectorTypes = [.link] | ||
94 | + | ||
95 | + let targetSize = CGSize(width: descriptionTextView.frame.width, height: CGFloat(MAXFLOAT)) | ||
96 | + descriptionTextViewHeight.constant = descriptionTextView.sizeThatFits(targetSize).height | ||
82 | 97 | ||
83 | redeemButton.setTitle("Απόκτησέ το", for: .normal) | 98 | redeemButton.setTitle("Απόκτησέ το", for: .normal) |
84 | redeemButton.setTitleColor(.white, for: .normal) | 99 | redeemButton.setTitleColor(.white, for: .normal) |
... | @@ -114,6 +129,10 @@ import SwiftEventBus | ... | @@ -114,6 +129,10 @@ import SwiftEventBus |
114 | termsTextView.textColor = UIColor(red: 0.25, green: 0.33, blue: 0.39, alpha: 1.00) | 129 | termsTextView.textColor = UIColor(red: 0.25, green: 0.33, blue: 0.39, alpha: 1.00) |
115 | termsTextView.textAlignment = .center | 130 | termsTextView.textAlignment = .center |
116 | termsTextView.isScrollEnabled = false | 131 | termsTextView.isScrollEnabled = false |
132 | + termsTextView.isUserInteractionEnabled = true | ||
133 | + termsTextView.isEditable = false | ||
134 | + termsTextView.isSelectable = true | ||
135 | + termsTextView.dataDetectorTypes = [.link] | ||
117 | 136 | ||
118 | toggleTerms() | 137 | toggleTerms() |
119 | 138 | ||
... | @@ -126,6 +145,13 @@ import SwiftEventBus | ... | @@ -126,6 +145,13 @@ import SwiftEventBus |
126 | 145 | ||
127 | } | 146 | } |
128 | 147 | ||
148 | + public func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool { | ||
149 | + UIApplication.shared.open(URL) | ||
150 | + | ||
151 | + // Disable `.preview` by 3D Touch and other interactions | ||
152 | + return false | ||
153 | + } | ||
154 | + | ||
129 | // MARK: - Functions | 155 | // MARK: - Functions |
130 | func nonTelcoDialog(_ alertTitle: String, _ alertSubTitle: String) -> Void { | 156 | func nonTelcoDialog(_ alertTitle: String, _ alertSubTitle: String) -> Void { |
131 | 157 | ... | ... |
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment