Showing
5 changed files
with
37 additions
and
8 deletions
No preview for this file type
... | @@ -7,7 +7,7 @@ | ... | @@ -7,7 +7,7 @@ |
7 | <key>Pods-WarplySDKFrameworkIOS.xcscheme_^#shared#^_</key> | 7 | <key>Pods-WarplySDKFrameworkIOS.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>WarplySDKFrameworkIOS.xcscheme_^#shared#^_</key> | 7 | <key>WarplySDKFrameworkIOS.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
... | @@ -32,7 +32,9 @@ class DataModel { | ... | @@ -32,7 +32,9 @@ class DataModel { |
32 | // var temp = NSMutableDictionary(dictionary: s); | 32 | // var temp = NSMutableDictionary(dictionary: s); |
33 | if c["couponset_uuid"] as! String == s["uuid"] as! String { | 33 | if c["couponset_uuid"] as! String == s["uuid"] as! String { |
34 | var temp = NSMutableDictionary(dictionary: s); | 34 | var temp = NSMutableDictionary(dictionary: s); |
35 | - temp.addEntries(from: c as! [AnyHashable : Any]) | 35 | +// temp.addEntries(from: c as! [AnyHashable : Any]) |
36 | + | ||
37 | + temp.setValue(c as! [AnyHashable : Any],forKey: "coupon_data") | ||
36 | 38 | ||
37 | self.data.append(temp as NSDictionary) | 39 | self.data.append(temp as NSDictionary) |
38 | } | 40 | } |
... | @@ -48,7 +50,10 @@ class DataModel { | ... | @@ -48,7 +50,10 @@ class DataModel { |
48 | 50 | ||
49 | var getData: Array<NSDictionary> { | 51 | var getData: Array<NSDictionary> { |
50 | get { // getter | 52 | get { // getter |
51 | - return data.filter({ $0["status"] as! Int == 1 }) | 53 | + return data.filter({ |
54 | + let couponData = $0["coupon_data"] as? [String: Any] ?? ["":""] | ||
55 | + return couponData["status"] as? Int == 1 | ||
56 | + }) | ||
52 | } | 57 | } |
53 | } | 58 | } |
54 | } | 59 | } |
... | @@ -118,6 +123,8 @@ extension CouponsView { | ... | @@ -118,6 +123,8 @@ extension CouponsView { |
118 | } | 123 | } |
119 | } | 124 | } |
120 | Text("Όλα τα κουπόνια μου") | 125 | Text("Όλα τα κουπόνια μου") |
126 | + .fontWeight(.medium) | ||
127 | + .foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196)) | ||
121 | .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.025, alignment: .center) | 128 | .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.025, alignment: .center) |
122 | .offset( y: self.uiscreen.height * 0.02) | 129 | .offset( y: self.uiscreen.height * 0.02) |
123 | .font(.system(size: 15)) | 130 | .font(.system(size: 15)) |
... | @@ -129,6 +136,7 @@ extension CouponsView { | ... | @@ -129,6 +136,7 @@ extension CouponsView { |
129 | struct couponView: View { | 136 | struct couponView: View { |
130 | var result: NSDictionary | 137 | var result: NSDictionary |
131 | var index: Int | 138 | var index: Int |
139 | + var parentView: UIView | ||
132 | 140 | ||
133 | var uiscreen = UIScreen.main.bounds | 141 | var uiscreen = UIScreen.main.bounds |
134 | 142 | ||
... | @@ -149,9 +157,20 @@ extension CouponsView { | ... | @@ -149,9 +157,20 @@ extension CouponsView { |
149 | } | 157 | } |
150 | 158 | ||
151 | var body: some View { | 159 | var body: some View { |
160 | + let couponData = result["coupon_data"] as? [String: Any] ?? ["":""] | ||
152 | 161 | ||
153 | 162 | ||
154 | VStack(alignment: .leading) { | 163 | VStack(alignment: .leading) { |
164 | + Button { | ||
165 | + // GiftItem Action | ||
166 | + let instanceOfMyApi = MyApi() | ||
167 | + let couponBarcodeViewController = instanceOfMyApi.openCouponBarcode(parentView, coupon: result as! [String : Any])! | ||
168 | + couponBarcodeViewController.view.tag = 7 | ||
169 | + // addChild(couponsViewController) | ||
170 | + couponBarcodeViewController.view.frame = parentView.frame | ||
171 | + parentView.addSubview(couponBarcodeViewController.view) | ||
172 | + couponBarcodeViewController.didMove(toParent: UIHostingController(rootView: self)) | ||
173 | + } label: { | ||
155 | HStack(alignment: .center) { | 174 | HStack(alignment: .center) { |
156 | ImageView(withURL: result["img_preview"] as! String) | 175 | ImageView(withURL: result["img_preview"] as! String) |
157 | .frame(maxWidth: self.uiscreen.width * 0.15) | 176 | .frame(maxWidth: self.uiscreen.width * 0.15) |
... | @@ -165,13 +184,19 @@ extension CouponsView { | ... | @@ -165,13 +184,19 @@ extension CouponsView { |
165 | .padding(.bottom, self.uiscreen.height * 0.0075) | 184 | .padding(.bottom, self.uiscreen.height * 0.0075) |
166 | Spacer() | 185 | Spacer() |
167 | VStack { | 186 | VStack { |
168 | - Text(CouponsView.couponView.localizedWithParameter(parameter: result["admin_name"] as? String ?? "")) | 187 | + Text(CouponsView.couponView.localizedWithParameter(parameter: result["name"] as? String ?? "")) |
188 | + .fontWeight(.medium) | ||
189 | + .foregroundColor(Color(red: 0.22745098039215686, green: 0.3215686274509804, blue: 0.4)) | ||
169 | .frame(maxWidth: self.uiscreen.width * 0.35, maxHeight: .infinity, alignment: .leading) | 190 | .frame(maxWidth: self.uiscreen.width * 0.35, maxHeight: .infinity, alignment: .leading) |
170 | .font(.system(size: 15)) | 191 | .font(.system(size: 15)) |
171 | - Text(CouponsView.couponView.localizedWithParameter(parameter: result["discount"] as? String ?? "")) | 192 | + Text(CouponsView.couponView.localizedWithParameter(parameter: couponData["discount"] as? String ?? "")) |
193 | + .fontWeight(.bold) | ||
194 | + .foregroundColor(Color(red: 0.22745098039215686, green: 0.3215686274509804, blue: 0.4)) | ||
172 | .frame(maxWidth: self.uiscreen.width * 0.35, maxHeight: self.uiscreen.height * 0.05, alignment: .leading) | 195 | .frame(maxWidth: self.uiscreen.width * 0.35, maxHeight: self.uiscreen.height * 0.05, alignment: .leading) |
173 | .font(.system(size: 47)) | 196 | .font(.system(size: 47)) |
174 | - Text(CouponsView.couponView.localizedWithParameter(parameter: "Ισχύει εώς " + CouponsView.couponView.convertDateFormat(inputDate: result["expiration"] as? String ?? ""))) | 197 | + Text(CouponsView.couponView.localizedWithParameter(parameter: "Ισχύει εώς " + CouponsView.couponView.convertDateFormat(inputDate: couponData["expiration"] as? String ?? ""))) |
198 | + .fontWeight(.medium) | ||
199 | + .foregroundColor(Color(red: 0.3803921568627451, green: 0.44313725490196076, blue: 0.5058823529411764)) | ||
175 | .frame(maxWidth: self.uiscreen.width * 0.35, maxHeight: .infinity, alignment: .leading) | 200 | .frame(maxWidth: self.uiscreen.width * 0.35, maxHeight: .infinity, alignment: .leading) |
176 | .font(.system(size: 10)) | 201 | .font(.system(size: 10)) |
177 | } | 202 | } |
... | @@ -180,6 +205,8 @@ extension CouponsView { | ... | @@ -180,6 +205,8 @@ extension CouponsView { |
180 | .padding(.bottom, self.uiscreen.height * 0.03) | 205 | .padding(.bottom, self.uiscreen.height * 0.03) |
181 | VStack { | 206 | VStack { |
182 | Text(CouponsView.couponView.localizedWithParameter(parameter: result["short_description"] as! String)) | 207 | Text(CouponsView.couponView.localizedWithParameter(parameter: result["short_description"] as! String)) |
208 | + .fontWeight(.medium) | ||
209 | + .foregroundColor(Color(red: 0.3803921568627451, green: 0.44313725490196076, blue: 0.5058823529411764)) | ||
183 | .frame(maxWidth: self.uiscreen.width * 0.22, maxHeight: self.uiscreen.height * 0.10) | 210 | .frame(maxWidth: self.uiscreen.width * 0.22, maxHeight: self.uiscreen.height * 0.10) |
184 | .font(.system(size: 10)) | 211 | .font(.system(size: 10)) |
185 | } | 212 | } |
... | @@ -187,6 +214,7 @@ extension CouponsView { | ... | @@ -187,6 +214,7 @@ extension CouponsView { |
187 | Spacer() | 214 | Spacer() |
188 | } | 215 | } |
189 | } | 216 | } |
217 | + } | ||
190 | .frame(width: self.uiscreen.width * 0.95, height: self.uiscreen.height * 0.13) | 218 | .frame(width: self.uiscreen.width * 0.95, height: self.uiscreen.height * 0.13) |
191 | .background( | 219 | .background( |
192 | Image("coupons_container", bundle: Bundle(for: MyEmptyClass.self)) | 220 | Image("coupons_container", bundle: Bundle(for: MyEmptyClass.self)) |
... | @@ -223,7 +251,8 @@ struct CouponsView: View { | ... | @@ -223,7 +251,8 @@ struct CouponsView: View { |
223 | VStack { | 251 | VStack { |
224 | if (data.count) > 0 { | 252 | if (data.count) > 0 { |
225 | ForEach(Array(zip(data.indices, data)), id: \.0) { index, result in | 253 | ForEach(Array(zip(data.indices, data)), id: \.0) { index, result in |
226 | - couponView(result: result, index: index) } | 254 | + couponView(result: result, index: index, parentView: parentView) |
255 | + } | ||
227 | } | 256 | } |
228 | } | 257 | } |
229 | .padding(.top, self.uiscreen.height * 0.05) | 258 | .padding(.top, self.uiscreen.height * 0.05) | ... | ... |
-
Please register or login to post a comment