Showing
3 changed files
with
7 additions
and
6 deletions
No preview for this file type
... | @@ -124,8 +124,8 @@ extension CouponBarcodeView { | ... | @@ -124,8 +124,8 @@ extension CouponBarcodeView { |
124 | 124 | ||
125 | func constructBarcode() -> String? { | 125 | func constructBarcode() -> String? { |
126 | // EAN 13 barcode construction | 126 | // EAN 13 barcode construction |
127 | - // let couponData = coupon["coupon_data"] as? [String: Any] ?? ["":""] | 127 | + let couponData = coupon["coupon_data"] as? [String: Any] ?? ["":""] |
128 | - let couponString = coupon["coupon"] as? String ?? "" | 128 | + let couponString = couponData["coupon"] as? String ?? "" |
129 | 129 | ||
130 | if (!couponString.isEmpty) { | 130 | if (!couponString.isEmpty) { |
131 | var checkDigit = 0; | 131 | var checkDigit = 0; |
... | @@ -158,6 +158,7 @@ extension CouponBarcodeView { | ... | @@ -158,6 +158,7 @@ extension CouponBarcodeView { |
158 | 158 | ||
159 | 159 | ||
160 | var body: some View { | 160 | var body: some View { |
161 | + let couponData = coupon["coupon_data"] as? [String: Any] ?? ["":""] | ||
161 | let barcodeString = constructBarcode() ?? "" | 162 | let barcodeString = constructBarcode() ?? "" |
162 | 163 | ||
163 | GeometryReader { geometry in | 164 | GeometryReader { geometry in |
... | @@ -194,7 +195,7 @@ extension CouponBarcodeView { | ... | @@ -194,7 +195,7 @@ extension CouponBarcodeView { |
194 | 195 | ||
195 | VStack(alignment: .center) { | 196 | VStack(alignment: .center) { |
196 | VStack { | 197 | VStack { |
197 | - Text(coupon["coupon"] as? String ?? "") | 198 | + Text(couponData["coupon"] as? String ?? "") |
198 | .fontWeight(.bold) | 199 | .fontWeight(.bold) |
199 | .font(.system(size: 27)) | 200 | .font(.system(size: 27)) |
200 | .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | 201 | .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) |
... | @@ -209,7 +210,7 @@ extension CouponBarcodeView { | ... | @@ -209,7 +210,7 @@ extension CouponBarcodeView { |
209 | } | 210 | } |
210 | .frame(maxWidth: .infinity) | 211 | .frame(maxWidth: .infinity) |
211 | 212 | ||
212 | - if (CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: coupon["coupon"] as? String ?? ""))) { | 213 | + if (CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: couponData["coupon"] as? String ?? ""))) { |
213 | VStack(alignment: .center) { | 214 | VStack(alignment: .center) { |
214 | VStack {} | 215 | VStack {} |
215 | .frame(height: 1) | 216 | .frame(height: 1) |
... | @@ -284,7 +285,7 @@ extension CouponBarcodeView { | ... | @@ -284,7 +285,7 @@ extension CouponBarcodeView { |
284 | 285 | ||
285 | 286 | ||
286 | 287 | ||
287 | - Text("Το κουπόνι ισχύει έως " + CouponBarcodeView.couponContainer.convertDateFormat(inputDate: coupon["expiration"] as? String ?? "")) | 288 | + Text("Το κουπόνι ισχύει έως " + CouponBarcodeView.couponContainer.convertDateFormat(inputDate: couponData["expiration"] as? String ?? "")) |
288 | .fontWeight(.medium) | 289 | .fontWeight(.medium) |
289 | .font(.system(size: 14)) | 290 | .font(.system(size: 14)) |
290 | .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | 291 | .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) |
... | @@ -378,7 +379,7 @@ extension CouponBarcodeView { | ... | @@ -378,7 +379,7 @@ extension CouponBarcodeView { |
378 | // couponset = CouponSetItemModel(dictionary: coupon) | 379 | // couponset = CouponSetItemModel(dictionary: coupon) |
379 | 380 | ||
380 | print("==================") | 381 | print("==================") |
381 | - print(coupon["coupon"] as? String ?? "") | 382 | + print(couponData["coupon"] as? String ?? "") |
382 | print("==================") | 383 | print("==================") |
383 | 384 | ||
384 | print("========constructBarcode()==========") | 385 | print("========constructBarcode()==========") | ... | ... |
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment