Manos Chorianopoulos

update CouponBarcodeView

...@@ -10,8 +10,8 @@ import SwiftUI ...@@ -10,8 +10,8 @@ import SwiftUI
10 import Combine 10 import Combine
11 import Foundation 11 import Foundation
12 import UIKit 12 import UIKit
13 -//import RSBarcodes_Swift 13 +// import RSBarcodes_Swift
14 -//import AVFoundation 14 +// import AVFoundation
15 15
16 16
17 extension CouponBarcodeView { 17 extension CouponBarcodeView {
...@@ -146,7 +146,7 @@ extension CouponBarcodeView { ...@@ -146,7 +146,7 @@ extension CouponBarcodeView {
146 } 146 }
147 .frame(maxWidth: .infinity) 147 .frame(maxWidth: .infinity)
148 148
149 - if (CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: "123456789101112"))) { 149 + if (CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: coupon["coupon"] as? String ?? ""))) {
150 VStack(alignment: .center) { 150 VStack(alignment: .center) {
151 VStack {} 151 VStack {}
152 .frame(height: 1) 152 .frame(height: 1)
...@@ -157,13 +157,44 @@ extension CouponBarcodeView { ...@@ -157,13 +157,44 @@ extension CouponBarcodeView {
157 .padding(.top, self.uiscreen.height * 0.015) 157 .padding(.top, self.uiscreen.height * 0.015)
158 158
159 // TODO: Add the barcode 159 // TODO: Add the barcode
160 +// Image(uiImage: UIImage(ciImage: output))
161 +
162 +// let isValid = RSUnifiedCodeValidator.shared.isValid("1234567891234", machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue)
163 +
164 +// if let barcodeImage = RSUnifiedCodeGenerator.shared.generateCode("1234567891234", machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue, targetSize: CGSize(width: 300, height: 300)) {
165 +
166 +// VStack(alignment: .center) {
167 +// Image(uiImage: image)
168 +// .resizable()
169 +// .aspectRatio(contentMode: .fit)
170 +// .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.05)
171 +//
172 +// }
173 +// .frame(maxWidth: .infinity)
174 +// .padding(.top, self.uiscreen.height * 0.01)
175 +
176 +// Image(uiImage: UIImage(named: "ic_back")!)
177 +// .renderingMode(.original)
178 +// .resizable()
179 +// .aspectRatio(contentMode: .fit)
180 +// .frame(width: 300, height: 300)
181 +
182 +
183 +// Image(uiImage: barcodeImage)
184 +// .renderingMode(.original)
185 +// .resizable()
186 +// .aspectRatio(contentMode: .fit)
187 +// .frame(width: 300, height: 300)
188 +// .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.05)
189 +// }
190 +
160 // generateBarcode(from: "1234567891234") 191 // generateBarcode(from: "1234567891234")
161 // ? 192 // ?
162 // .resizable() 193 // .resizable()
163 // .aspectRatio(contentMode: .fit) 194 // .aspectRatio(contentMode: .fit)
164 // .frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.1) 195 // .frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.1)
165 196
166 - Text("123456789101112") 197 + Text(coupon["coupon"] as? String ?? "")
167 .fontWeight(.regular) 198 .fontWeight(.regular)
168 .font(.system(size: 22)) 199 .font(.system(size: 22))
169 .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) 200 .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
......