Showing
20 changed files
with
154 additions
and
12 deletions
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
3 | +<plist version="1.0"> | ||
4 | +<dict> | ||
5 | + <key>SchemeUserState</key> | ||
6 | + <dict> | ||
7 | + <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key> | ||
8 | + <dict> | ||
9 | + <key>orderHint</key> | ||
10 | + <integer>0</integer> | ||
11 | + </dict> | ||
12 | + </dict> | ||
13 | +</dict> | ||
14 | +</plist> |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
3 | +<plist version="1.0"> | ||
4 | +<dict> | ||
5 | + <key>SchemeUserState</key> | ||
6 | + <dict> | ||
7 | + <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key> | ||
8 | + <dict> | ||
9 | + <key>orderHint</key> | ||
10 | + <integer>1</integer> | ||
11 | + </dict> | ||
12 | + </dict> | ||
13 | +</dict> | ||
14 | +</plist> |
No preview for this file type
No preview for this file type
... | @@ -9,12 +9,17 @@ import UIKit | ... | @@ -9,12 +9,17 @@ import UIKit |
9 | 9 | ||
10 | class CouponViewController: UIViewController { | 10 | class CouponViewController: UIViewController { |
11 | @IBOutlet weak var mainView: UIView! | 11 | @IBOutlet weak var mainView: UIView! |
12 | + @IBOutlet weak var scrollView: UIScrollView! | ||
12 | @IBOutlet weak var scrollContentView: UIView! | 13 | @IBOutlet weak var scrollContentView: UIView! |
13 | @IBOutlet weak var couponImageHeight: NSLayoutConstraint! | 14 | @IBOutlet weak var couponImageHeight: NSLayoutConstraint! |
14 | @IBOutlet weak var redeemButton: UIButton! | 15 | @IBOutlet weak var redeemButton: UIButton! |
15 | - @IBOutlet weak var termsLabel: UILabel! | 16 | + @IBOutlet weak var termsButton: UIButton! |
17 | + @IBOutlet weak var termsTextView: UITextView! | ||
18 | + @IBOutlet weak var termsTextViewHeight: NSLayoutConstraint! | ||
16 | 19 | ||
17 | let uiscreen: CGRect = UIScreen.main.bounds | 20 | let uiscreen: CGRect = UIScreen.main.bounds |
21 | + | ||
22 | + var termsVisible: Bool = false; | ||
18 | 23 | ||
19 | override func viewDidLoad() { | 24 | override func viewDidLoad() { |
20 | super.viewDidLoad() | 25 | super.viewDidLoad() |
... | @@ -23,31 +28,55 @@ class CouponViewController: UIViewController { | ... | @@ -23,31 +28,55 @@ class CouponViewController: UIViewController { |
23 | setBackButton() | 28 | setBackButton() |
24 | setNavigationTitle("Εκπτωτικό κουπόνι") | 29 | setNavigationTitle("Εκπτωτικό κουπόνι") |
25 | 30 | ||
26 | - mainView.clipsToBounds = true | 31 | + scrollView.clipsToBounds = true |
27 | - mainView.layer.cornerRadius = 30 | 32 | + scrollView.layer.cornerRadius = 30 |
28 | - mainView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius | 33 | + scrollView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius |
29 | 34 | ||
30 | couponImageHeight.constant = self.uiscreen.height * 0.25 | 35 | couponImageHeight.constant = self.uiscreen.height * 0.25 |
31 | 36 | ||
32 | redeemButton.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .medium) | 37 | redeemButton.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .medium) |
33 | 38 | ||
34 | - termsLabel.font = UIFont.systemFont(ofSize: 14, weight: UIFont.Weight.medium) | 39 | + termsButton.titleLabel?.font = .systemFont(ofSize: 15.0, weight: .semibold) |
35 | - let tap = UITapGestureRecognizer(target: self, action: #selector(CouponViewController.termsTapFunction)) | 40 | +// termsButton.imageView?.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5) |
36 | - termsLabel.isUserInteractionEnabled = true | 41 | + |
37 | - termsLabel.addGestureRecognizer(tap) | 42 | + let htmlText = "<p>Το κουπόνι ισχύει έως 05/12/2022</p>\n" |
43 | + termsTextView.attributedText = htmlText.htmlToAttributedString | ||
44 | + termsTextView.font = UIFont.systemFont(ofSize: 14, weight: UIFont.Weight.regular) | ||
45 | + termsTextView.textColor = UIColor(red: 0.25, green: 0.33, blue: 0.39, alpha: 1.00) | ||
46 | + termsTextView.textAlignment = .center | ||
47 | + termsTextView.isScrollEnabled = false | ||
48 | + | ||
49 | + toggleTerms() | ||
50 | + | ||
38 | } | 51 | } |
39 | 52 | ||
53 | + // MARK: - Functions | ||
54 | + func toggleTerms() { | ||
55 | + if (termsVisible) { | ||
56 | + termsTextView.isHidden = false | ||
57 | + let targetSize = CGSize(width: termsTextView.frame.width, height: CGFloat(MAXFLOAT)) | ||
58 | + termsTextViewHeight.constant = termsTextView.sizeThatFits(targetSize).height | ||
59 | + | ||
60 | + termsButton.setImage(UIImage(named: "ic_up_dark.png"), for: .normal) | ||
61 | + } else { | ||
62 | + termsTextView.isHidden = true | ||
63 | + termsTextViewHeight.constant = CGFloat(0) | ||
64 | + | ||
65 | + termsButton.setImage(UIImage(named: "ic_down_dark.png"), for: .normal) | ||
66 | + } | ||
67 | + } | ||
40 | 68 | ||
41 | // MARK: - Actions | 69 | // MARK: - Actions |
42 | 70 | ||
43 | - @objc func termsTapFunction(sender:UITapGestureRecognizer) { | ||
44 | - print("Terms tapped!") | ||
45 | - } | ||
46 | - | ||
47 | @IBAction func redeemButtomAction(_ sender: Any) { | 71 | @IBAction func redeemButtomAction(_ sender: Any) { |
48 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | 72 | let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) |
49 | let vc = storyboard.instantiateViewController(withIdentifier: "MakeItAPresentViewController") as UIViewController | 73 | let vc = storyboard.instantiateViewController(withIdentifier: "MakeItAPresentViewController") as UIViewController |
50 | self.navigationController?.pushViewController(vc, animated: true) | 74 | self.navigationController?.pushViewController(vc, animated: true) |
51 | } | 75 | } |
76 | + | ||
77 | + @IBAction func termsButtonAction(_ sender: Any) { | ||
78 | + termsVisible = !termsVisible | ||
79 | + toggleTerms() | ||
80 | + } | ||
52 | } | 81 | } |
53 | 82 | ... | ... |
This diff is collapsed. Click to expand it.
1 | +{ | ||
2 | + "images" : [ | ||
3 | + { | ||
4 | + "filename" : "coupons_scrollview_white.png", | ||
5 | + "idiom" : "universal", | ||
6 | + "scale" : "1x" | ||
7 | + }, | ||
8 | + { | ||
9 | + "filename" : "coupons_scrollview_white-1.png", | ||
10 | + "idiom" : "universal", | ||
11 | + "scale" : "2x" | ||
12 | + }, | ||
13 | + { | ||
14 | + "filename" : "coupons_scrollview_white-2.png", | ||
15 | + "idiom" : "universal", | ||
16 | + "scale" : "3x" | ||
17 | + } | ||
18 | + ], | ||
19 | + "info" : { | ||
20 | + "author" : "xcode", | ||
21 | + "version" : 1 | ||
22 | + } | ||
23 | +} |
10.8 KB
10.8 KB
10.8 KB
SwiftWarplyFramework/SwiftWarplyFramework/Media.xcassets/ic_down_dark.imageset/Contents.json
0 → 100644
1 | +{ | ||
2 | + "images" : [ | ||
3 | + { | ||
4 | + "filename" : "ic_down_dark.png", | ||
5 | + "idiom" : "universal", | ||
6 | + "scale" : "1x" | ||
7 | + }, | ||
8 | + { | ||
9 | + "filename" : "ic_down_dark-1.png", | ||
10 | + "idiom" : "universal", | ||
11 | + "scale" : "2x" | ||
12 | + }, | ||
13 | + { | ||
14 | + "filename" : "ic_down_dark-2.png", | ||
15 | + "idiom" : "universal", | ||
16 | + "scale" : "3x" | ||
17 | + } | ||
18 | + ], | ||
19 | + "info" : { | ||
20 | + "author" : "xcode", | ||
21 | + "version" : 1 | ||
22 | + } | ||
23 | +} |
SwiftWarplyFramework/SwiftWarplyFramework/Media.xcassets/ic_down_dark.imageset/ic_down_dark-1.png
0 → 100644
451 Bytes
SwiftWarplyFramework/SwiftWarplyFramework/Media.xcassets/ic_down_dark.imageset/ic_down_dark-2.png
0 → 100644
451 Bytes
SwiftWarplyFramework/SwiftWarplyFramework/Media.xcassets/ic_down_dark.imageset/ic_down_dark.png
0 → 100644
451 Bytes
SwiftWarplyFramework/SwiftWarplyFramework/Media.xcassets/ic_up_dark.imageset/Contents.json
0 → 100644
1 | +{ | ||
2 | + "images" : [ | ||
3 | + { | ||
4 | + "filename" : "ic_up_dark.png", | ||
5 | + "idiom" : "universal", | ||
6 | + "scale" : "1x" | ||
7 | + }, | ||
8 | + { | ||
9 | + "filename" : "ic_up_dark-1.png", | ||
10 | + "idiom" : "universal", | ||
11 | + "scale" : "2x" | ||
12 | + }, | ||
13 | + { | ||
14 | + "filename" : "ic_up_dark-2.png", | ||
15 | + "idiom" : "universal", | ||
16 | + "scale" : "3x" | ||
17 | + } | ||
18 | + ], | ||
19 | + "info" : { | ||
20 | + "author" : "xcode", | ||
21 | + "version" : 1 | ||
22 | + } | ||
23 | +} |
SwiftWarplyFramework/SwiftWarplyFramework/Media.xcassets/ic_up_dark.imageset/ic_up_dark-1.png
0 → 100644
433 Bytes
SwiftWarplyFramework/SwiftWarplyFramework/Media.xcassets/ic_up_dark.imageset/ic_up_dark-2.png
0 → 100644
433 Bytes
SwiftWarplyFramework/SwiftWarplyFramework/Media.xcassets/ic_up_dark.imageset/ic_up_dark.png
0 → 100644
433 Bytes
... | @@ -49,3 +49,17 @@ extension UIViewController { | ... | @@ -49,3 +49,17 @@ extension UIViewController { |
49 | 49 | ||
50 | } | 50 | } |
51 | } | 51 | } |
52 | + | ||
53 | +extension String { | ||
54 | + var htmlToAttributedString: NSAttributedString? { | ||
55 | + guard let data = data(using: .utf8) else { return nil } | ||
56 | + do { | ||
57 | + return try NSAttributedString(data: data, options: [.documentType: NSAttributedString.DocumentType.html, .characterEncoding:String.Encoding.utf8.rawValue], documentAttributes: nil) | ||
58 | + } catch { | ||
59 | + return nil | ||
60 | + } | ||
61 | + } | ||
62 | + var htmlToString: String { | ||
63 | + return htmlToAttributedString?.string ?? "" | ||
64 | + } | ||
65 | +} | ... | ... |
... | @@ -75,6 +75,7 @@ public class swiftApi { | ... | @@ -75,6 +75,7 @@ public class swiftApi { |
75 | public let inner_text: String? | 75 | public let inner_text: String? |
76 | public let buyable: Bool? | 76 | public let buyable: Bool? |
77 | public let visible: Bool? | 77 | public let visible: Bool? |
78 | + public let terms: String? | ||
78 | 79 | ||
79 | public init(dictionary: [String: Any]) { | 80 | public init(dictionary: [String: Any]) { |
80 | self.uuid = dictionary["uuid"] as? String? ?? "" | 81 | self.uuid = dictionary["uuid"] as? String? ?? "" |
... | @@ -88,6 +89,7 @@ public class swiftApi { | ... | @@ -88,6 +89,7 @@ public class swiftApi { |
88 | self.inner_text = dictionary["inner_text"] as? String? ?? "" | 89 | self.inner_text = dictionary["inner_text"] as? String? ?? "" |
89 | self.buyable = dictionary["buyable"] as? Bool? ?? false | 90 | self.buyable = dictionary["buyable"] as? Bool? ?? false |
90 | self.visible = dictionary["visible"] as? Bool? ?? false | 91 | self.visible = dictionary["visible"] as? Bool? ?? false |
92 | + self.terms = dictionary["terms"] as? String? ?? "" | ||
91 | 93 | ||
92 | let expirationObject = dictionary["expiration"] as? [String: Any]? ?? ["":""] | 94 | let expirationObject = dictionary["expiration"] as? [String: Any]? ?? ["":""] |
93 | let expirationString = expirationObject?["value"] as? String? ?? "" | 95 | let expirationString = expirationObject?["value"] as? String? ?? "" | ... | ... |
-
Please register or login to post a comment