Showing
7 changed files
with
237 additions
and
1 deletions
... | @@ -11,6 +11,8 @@ | ... | @@ -11,6 +11,8 @@ |
11 | 1E7086672811A96E00704CA8 /* CouponBarcodeViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7086662811A96E00704CA8 /* CouponBarcodeViewInterface.swift */; }; | 11 | 1E7086672811A96E00704CA8 /* CouponBarcodeViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7086662811A96E00704CA8 /* CouponBarcodeViewInterface.swift */; }; |
12 | 1E735FF2281067320050A298 /* CampaignWebview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E735FF1281067320050A298 /* CampaignWebview.swift */; }; | 12 | 1E735FF2281067320050A298 /* CampaignWebview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E735FF1281067320050A298 /* CampaignWebview.swift */; }; |
13 | 1E735FF42810681E0050A298 /* CampaignWebviewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E735FF32810681E0050A298 /* CampaignWebviewInterface.swift */; }; | 13 | 1E735FF42810681E0050A298 /* CampaignWebviewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E735FF32810681E0050A298 /* CampaignWebviewInterface.swift */; }; |
14 | + 1E98EC1428199C4F007524A0 /* AllGiftsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E98EC1328199C4F007524A0 /* AllGiftsView.swift */; }; | ||
15 | + 1E98EC1628199C86007524A0 /* AllGiftsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E98EC1528199C86007524A0 /* AllGiftsViewInterface.swift */; }; | ||
14 | 1EBEB02D280D69D800BF802C /* GiftsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBEB02C280D69D800BF802C /* GiftsView.swift */; }; | 16 | 1EBEB02D280D69D800BF802C /* GiftsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBEB02C280D69D800BF802C /* GiftsView.swift */; }; |
15 | 1EBEB02F280D6AA500BF802C /* GiftsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */; }; | 17 | 1EBEB02F280D6AA500BF802C /* GiftsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */; }; |
16 | 260C6A1AFF7560C32E212F20 /* Pods_WarplySDKFrameworkIOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1353B8C484CC0649CAC2EB74 /* Pods_WarplySDKFrameworkIOS.framework */; }; | 18 | 260C6A1AFF7560C32E212F20 /* Pods_WarplySDKFrameworkIOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1353B8C484CC0649CAC2EB74 /* Pods_WarplySDKFrameworkIOS.framework */; }; |
... | @@ -147,6 +149,8 @@ | ... | @@ -147,6 +149,8 @@ |
147 | 1E7086662811A96E00704CA8 /* CouponBarcodeViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponBarcodeViewInterface.swift; sourceTree = "<group>"; }; | 149 | 1E7086662811A96E00704CA8 /* CouponBarcodeViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponBarcodeViewInterface.swift; sourceTree = "<group>"; }; |
148 | 1E735FF1281067320050A298 /* CampaignWebview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CampaignWebview.swift; sourceTree = "<group>"; }; | 150 | 1E735FF1281067320050A298 /* CampaignWebview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CampaignWebview.swift; sourceTree = "<group>"; }; |
149 | 1E735FF32810681E0050A298 /* CampaignWebviewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CampaignWebviewInterface.swift; sourceTree = "<group>"; }; | 151 | 1E735FF32810681E0050A298 /* CampaignWebviewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CampaignWebviewInterface.swift; sourceTree = "<group>"; }; |
152 | + 1E98EC1328199C4F007524A0 /* AllGiftsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllGiftsView.swift; sourceTree = "<group>"; }; | ||
153 | + 1E98EC1528199C86007524A0 /* AllGiftsViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllGiftsViewInterface.swift; sourceTree = "<group>"; }; | ||
150 | 1EBEB02C280D69D800BF802C /* GiftsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GiftsView.swift; sourceTree = "<group>"; }; | 154 | 1EBEB02C280D69D800BF802C /* GiftsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GiftsView.swift; sourceTree = "<group>"; }; |
151 | 1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GiftsViewInterface.swift; sourceTree = "<group>"; }; | 155 | 1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GiftsViewInterface.swift; sourceTree = "<group>"; }; |
152 | B9413513157AD76ECE896B81 /* Pods-WarplySDKFrameworkIOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WarplySDKFrameworkIOS.release.xcconfig"; path = "Target Support Files/Pods-WarplySDKFrameworkIOS/Pods-WarplySDKFrameworkIOS.release.xcconfig"; sourceTree = "<group>"; }; | 156 | B9413513157AD76ECE896B81 /* Pods-WarplySDKFrameworkIOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WarplySDKFrameworkIOS.release.xcconfig"; path = "Target Support Files/Pods-WarplySDKFrameworkIOS/Pods-WarplySDKFrameworkIOS.release.xcconfig"; sourceTree = "<group>"; }; |
... | @@ -341,6 +345,8 @@ | ... | @@ -341,6 +345,8 @@ |
341 | E639EFA0280810E300B9DD94 /* CouponsView.swift */, | 345 | E639EFA0280810E300B9DD94 /* CouponsView.swift */, |
342 | E639EFA1280810E300B9DD94 /* CouponsViewInterface.swift */, | 346 | E639EFA1280810E300B9DD94 /* CouponsViewInterface.swift */, |
343 | 1EBEB02C280D69D800BF802C /* GiftsView.swift */, | 347 | 1EBEB02C280D69D800BF802C /* GiftsView.swift */, |
348 | + 1E98EC1328199C4F007524A0 /* AllGiftsView.swift */, | ||
349 | + 1E98EC1528199C86007524A0 /* AllGiftsViewInterface.swift */, | ||
344 | 1E735FF1281067320050A298 /* CampaignWebview.swift */, | 350 | 1E735FF1281067320050A298 /* CampaignWebview.swift */, |
345 | 1E735FF32810681E0050A298 /* CampaignWebviewInterface.swift */, | 351 | 1E735FF32810681E0050A298 /* CampaignWebviewInterface.swift */, |
346 | 1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */, | 352 | 1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */, |
... | @@ -753,6 +759,7 @@ | ... | @@ -753,6 +759,7 @@ |
753 | E6D8DF4827A942920006A3A9 /* AFURLRequestSerialization.m in Sources */, | 759 | E6D8DF4827A942920006A3A9 /* AFURLRequestSerialization.m in Sources */, |
754 | E67D1EC228113EED00940F01 /* CouponView.swift in Sources */, | 760 | E67D1EC228113EED00940F01 /* CouponView.swift in Sources */, |
755 | 1E7086672811A96E00704CA8 /* CouponBarcodeViewInterface.swift in Sources */, | 761 | 1E7086672811A96E00704CA8 /* CouponBarcodeViewInterface.swift in Sources */, |
762 | + 1E98EC1428199C4F007524A0 /* AllGiftsView.swift in Sources */, | ||
756 | E6D8DEF327A942920006A3A9 /* WLNativeVideoTableViewCell.m in Sources */, | 763 | E6D8DEF327A942920006A3A9 /* WLNativeVideoTableViewCell.m in Sources */, |
757 | E6D8DF2527A942920006A3A9 /* WLSMSActionHanlder.m in Sources */, | 764 | E6D8DF2527A942920006A3A9 /* WLSMSActionHanlder.m in Sources */, |
758 | E67D1EBE2810573900940F01 /* WalletView.swift in Sources */, | 765 | E67D1EBE2810573900940F01 /* WalletView.swift in Sources */, |
... | @@ -786,6 +793,7 @@ | ... | @@ -786,6 +793,7 @@ |
786 | E6D8DF2C27A942920006A3A9 /* UIProgressView+AFNetworking.m in Sources */, | 793 | E6D8DF2C27A942920006A3A9 /* UIProgressView+AFNetworking.m in Sources */, |
787 | E6D8DF3C27A942920006A3A9 /* UIWebView+AFNetworking.m in Sources */, | 794 | E6D8DF3C27A942920006A3A9 /* UIWebView+AFNetworking.m in Sources */, |
788 | E639EFA2280810E300B9DD94 /* CouponsView.swift in Sources */, | 795 | E639EFA2280810E300B9DD94 /* CouponsView.swift in Sources */, |
796 | + 1E98EC1628199C86007524A0 /* AllGiftsViewInterface.swift in Sources */, | ||
789 | E6D8DF1427A942920006A3A9 /* WLLocationManager.m in Sources */, | 797 | E6D8DF1427A942920006A3A9 /* WLLocationManager.m in Sources */, |
790 | E6D8DF6027A9429E0006A3A9 /* MyApi.m in Sources */, | 798 | E6D8DF6027A9429E0006A3A9 /* MyApi.m in Sources */, |
791 | E6D8DF3F27A942920006A3A9 /* AFImageDownloader.m in Sources */, | 799 | E6D8DF3F27A942920006A3A9 /* AFImageDownloader.m in Sources */, | ... | ... |
No preview for this file type
1 | +// | ||
2 | +// AllGiftsView.swift | ||
3 | +// WarplySDKFrameworkIOS | ||
4 | +// | ||
5 | +// Created by Manos Chorianopoulos on 27/4/22. | ||
6 | +// | ||
7 | + | ||
8 | + | ||
9 | +#if canImport(SwiftUI) | ||
10 | +import SwiftUI | ||
11 | +import Combine | ||
12 | +import Foundation | ||
13 | +import UIKit | ||
14 | + | ||
15 | + | ||
16 | +extension AllGiftsView { | ||
17 | + struct headerView: View { | ||
18 | + var goBack: () -> () | ||
19 | + | ||
20 | + var uiscreen = UIScreen.main.bounds | ||
21 | + | ||
22 | + var body: some View { | ||
23 | + HStack(alignment: .center) { | ||
24 | + Button { | ||
25 | + // Button Action | ||
26 | + print("Back Button tapped!") | ||
27 | + goBack() | ||
28 | + } label: { | ||
29 | + Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | ||
30 | + .resizable() | ||
31 | + .aspectRatio(contentMode: .fit) | ||
32 | + .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | ||
33 | + } | ||
34 | + | ||
35 | + Text("Όλα τα δώρα μου") | ||
36 | + .fontWeight(.medium) | ||
37 | + .font(.system(size: 16)) | ||
38 | + .foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196)) | ||
39 | + .multilineTextAlignment(.center) | ||
40 | + .frame(maxWidth: .infinity) | ||
41 | + .padding(.horizontal) | ||
42 | + } | ||
43 | + .frame(maxWidth: .infinity) | ||
44 | + .padding(.horizontal) | ||
45 | + .padding(.vertical, 10) | ||
46 | + } | ||
47 | + } | ||
48 | + | ||
49 | + struct ImageView: View { | ||
50 | + @ObservedObject var imageLoader:UrlImageModel | ||
51 | + @State var width:CGFloat | ||
52 | + @State var isFill:Bool | ||
53 | + | ||
54 | + var uiscreen = UIScreen.main.bounds | ||
55 | + | ||
56 | + init(withURL url:String , width:CGFloat, isFill:Bool) { | ||
57 | + imageLoader = UrlImageModel(urlString:url) | ||
58 | + self.width = width | ||
59 | + self.isFill = isFill | ||
60 | + } | ||
61 | + | ||
62 | + var body: some View { | ||
63 | + | ||
64 | + Image(uiImage: imageLoader.image ?? UIImage()) | ||
65 | + .resizable() | ||
66 | + .aspectRatio(contentMode: isFill ? .fill : .fit) | ||
67 | + .frame(width: self.width) | ||
68 | + .frame(maxHeight: .infinity) | ||
69 | + } | ||
70 | + } | ||
71 | + | ||
72 | + | ||
73 | + struct giftItemView: View { | ||
74 | + var item: NSDictionary | ||
75 | + var parentView: UIView | ||
76 | + | ||
77 | + var uiscreen = UIScreen.main.bounds | ||
78 | + | ||
79 | + var body: some View { | ||
80 | + Button { | ||
81 | + // GiftItem Action | ||
82 | + let instanceOfMyApi = MyApi() | ||
83 | + let couponBarcodeViewController = instanceOfMyApi.openCouponBarcode(parentView, coupon: item as! [String : Any])! | ||
84 | + couponBarcodeViewController.view.tag = 7 | ||
85 | +// addChild(couponsViewController) | ||
86 | + couponBarcodeViewController.view.frame = parentView.frame | ||
87 | + parentView.addSubview(couponBarcodeViewController.view) | ||
88 | + couponBarcodeViewController.didMove(toParent: UIHostingController(rootView: self)) | ||
89 | + } label: { | ||
90 | + HStack(alignment: .center, spacing: 0.0) { | ||
91 | + | ||
92 | + ImageView(withURL: item["img_preview"] as? String ?? "", width: self.uiscreen.width * 0.5, isFill: true) | ||
93 | + | ||
94 | + VStack(alignment: .leading, spacing: 5.0) { | ||
95 | + // TODO: Change to name | ||
96 | + Text(item["name"] as? String ?? "") | ||
97 | + .fontWeight(.bold) | ||
98 | + .font(.system(size: 16)) | ||
99 | + .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | ||
100 | + .multilineTextAlignment(.leading) | ||
101 | + .padding([.top,.horizontal], 15) | ||
102 | + .background(Color.white) | ||
103 | + | ||
104 | + Text(item["short_description"] as? String ?? "") | ||
105 | + .fontWeight(.regular) | ||
106 | + .font(.system(size: 16)) | ||
107 | + .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | ||
108 | + .multilineTextAlignment(.leading) | ||
109 | + .padding([.bottom,.horizontal], 15) | ||
110 | + .background(Color.white) | ||
111 | + .frame(maxWidth: .infinity, maxHeight: .infinity) | ||
112 | + } | ||
113 | + .background(Color.white) | ||
114 | + .frame(maxWidth: .infinity, maxHeight: .infinity) | ||
115 | + } | ||
116 | + .background(Color.white) | ||
117 | + .frame(maxWidth: .infinity, maxHeight: .infinity) | ||
118 | + } | ||
119 | + .frame(width: self.uiscreen.width * 0.95, height: self.uiscreen.height * 0.17) | ||
120 | + .background(Color.white) | ||
121 | + .cornerRadius(5) | ||
122 | + .shadow(color: Color(red: 0, green: 0, blue: 0, opacity: 0.16), radius: 6, x: 0, y: 3) | ||
123 | + } | ||
124 | + } | ||
125 | + | ||
126 | + struct couponsContainer: View { | ||
127 | + @State var coupons:Array<NSDictionary> = [] | ||
128 | + @State var parentView:UIView | ||
129 | + | ||
130 | + var uiscreen = UIScreen.main.bounds | ||
131 | + | ||
132 | + var body: some View { | ||
133 | + VStack(alignment: .center, spacing: self.uiscreen.height * 0.03) { | ||
134 | + | ||
135 | + ForEach(Array(coupons.enumerated()), id: \.offset) { index, item in | ||
136 | + | ||
137 | + giftItemView(item: item, parentView: parentView) | ||
138 | + } | ||
139 | + } | ||
140 | + .frame(maxWidth: .infinity) | ||
141 | + .padding(.top, self.uiscreen.height * 0.05) | ||
142 | + .padding(.bottom, self.uiscreen.height * 0.1) | ||
143 | + } | ||
144 | + } | ||
145 | + | ||
146 | +} | ||
147 | + | ||
148 | +@available(iOS 13.0.0, *) | ||
149 | +struct AllGiftsView: View { | ||
150 | + var parentView: UIView | ||
151 | + | ||
152 | + var coupons:Array<NSDictionary> = DataModel().getData | ||
153 | + | ||
154 | + var uiscreen = UIScreen.main.bounds | ||
155 | + | ||
156 | + func goBack(){ | ||
157 | + for subview in parentView.subviews { | ||
158 | + if(subview.tag == 8) { | ||
159 | + subview.removeFromSuperview() | ||
160 | + } | ||
161 | + } | ||
162 | + } | ||
163 | + | ||
164 | + var body: some View { | ||
165 | + VStack { | ||
166 | + headerView(goBack: goBack) | ||
167 | + | ||
168 | + VStack { | ||
169 | + ScrollView(showsIndicators: false) { | ||
170 | + VStack { | ||
171 | + | ||
172 | + if (coupons.count) > 0 { | ||
173 | + couponsContainer(coupons: coupons, parentView: parentView ) | ||
174 | + } | ||
175 | + | ||
176 | + } | ||
177 | + .frame(width:self.uiscreen.width) | ||
178 | + } | ||
179 | + .cornerRadius(30, corners: [.topLeft]) | ||
180 | + .frame(width:self.uiscreen.width) | ||
181 | + .frame(maxHeight: .infinity) | ||
182 | + } | ||
183 | + .frame(width:self.uiscreen.width) | ||
184 | + .frame(maxHeight: .infinity) | ||
185 | + .padding(.top, 5) | ||
186 | + .background( | ||
187 | + Image("coupons_scrollview", bundle: Bundle(for: MyEmptyClass.self)) | ||
188 | + .resizable() | ||
189 | + ) | ||
190 | + | ||
191 | + } | ||
192 | + .edgesIgnoringSafeArea([.bottom]) | ||
193 | + .frame(width:self.uiscreen.width) | ||
194 | + .frame(maxHeight: .infinity) | ||
195 | + } | ||
196 | +} | ||
197 | +#endif | ||
198 | + | ||
199 | +//struct AllGiftsView_Previews: PreviewProvider { | ||
200 | +// static var previews: some View { | ||
201 | +// AllGiftsView() | ||
202 | +// } | ||
203 | +//} |
1 | +// | ||
2 | +// AllGiftsViewInterface.swift | ||
3 | +// WarplySDKFrameworkIOS | ||
4 | +// | ||
5 | +// Created by Manos Chorianopoulos on 27/4/22. | ||
6 | +// | ||
7 | + | ||
8 | +import Foundation | ||
9 | +import SwiftUI | ||
10 | + | ||
11 | +@available(iOS 13.0.0, *) | ||
12 | +@objc public class AllGiftsViewInterface : NSObject { | ||
13 | + | ||
14 | + @objc(allGiftsViewController:) static public func allGiftsViewController(parentView: UIView?) -> UIViewController { | ||
15 | + return UIHostingController(rootView: AllGiftsView(parentView: parentView!)) | ||
16 | + } | ||
17 | + | ||
18 | +} |
... | @@ -48,7 +48,7 @@ class DataModel { | ... | @@ -48,7 +48,7 @@ class DataModel { |
48 | 48 | ||
49 | var getData: Array<NSDictionary> { | 49 | var getData: Array<NSDictionary> { |
50 | get { // getter | 50 | get { // getter |
51 | - return data.filter({ $0["status"] as! String == "1" }) | 51 | + return data.filter({ $0["status"] as! Int == 1 }) |
52 | } | 52 | } |
53 | } | 53 | } |
54 | } | 54 | } | ... | ... |
... | @@ -21,6 +21,7 @@ | ... | @@ -21,6 +21,7 @@ |
21 | - (UIViewController *) openCoupon:(UIView*) parentView coupon:(NSDictionary*) coupon; | 21 | - (UIViewController *) openCoupon:(UIView*) parentView coupon:(NSDictionary*) coupon; |
22 | - (UIViewController *) openCouponBarcode:(UIView*) parentView coupon:(NSDictionary*) coupon; | 22 | - (UIViewController *) openCouponBarcode:(UIView*) parentView coupon:(NSDictionary*) coupon; |
23 | - (UIViewController *) openGifts:(UIView*) parentView; | 23 | - (UIViewController *) openGifts:(UIView*) parentView; |
24 | +- (UIViewController *) openAllGifts:(UIView*) parentView; | ||
24 | - (UIViewController *) openWallet:(UIView*) parentView; | 25 | - (UIViewController *) openWallet:(UIView*) parentView; |
25 | - (UIViewController *) openMoreForYou:(UIView*) parentView; | 26 | - (UIViewController *) openMoreForYou:(UIView*) parentView; |
26 | - (UIViewController *) openCampaign:(UIView*) parentView campaign:(NSString*) campaign; | 27 | - (UIViewController *) openCampaign:(UIView*) parentView campaign:(NSString*) campaign; | ... | ... |
... | @@ -71,6 +71,12 @@ NSString *LANG; | ... | @@ -71,6 +71,12 @@ NSString *LANG; |
71 | return giftsViewController; | 71 | return giftsViewController; |
72 | } | 72 | } |
73 | 73 | ||
74 | +- (UIViewController *) openAllGifts:(UIView*) parentView{ | ||
75 | + | ||
76 | + UIViewController *allGiftsViewController = [AllGiftsViewInterface allGiftsViewController:parentView]; | ||
77 | + return allGiftsViewController; | ||
78 | +} | ||
79 | + | ||
74 | - (UIViewController *) openWallet:(UIView*) parentView{ | 80 | - (UIViewController *) openWallet:(UIView*) parentView{ |
75 | 81 | ||
76 | UIViewController *wallletViewController = [WalletViewInterface walletViewController:parentView]; | 82 | UIViewController *wallletViewController = [WalletViewInterface walletViewController:parentView]; | ... | ... |
-
Please register or login to post a comment