Vasilis
......@@ -10,8 +10,8 @@ import SwiftUI
import Combine
import Foundation
import UIKit
//import RSBarcodes_Swift
//import AVFoundation
// import RSBarcodes_Swift
// import AVFoundation
extension CouponBarcodeView {
......@@ -146,7 +146,7 @@ extension CouponBarcodeView {
}
.frame(maxWidth: .infinity)
if (CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: "123456789101112"))) {
if (CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: coupon["coupon"] as? String ?? ""))) {
VStack(alignment: .center) {
VStack {}
.frame(height: 1)
......@@ -157,13 +157,44 @@ extension CouponBarcodeView {
.padding(.top, self.uiscreen.height * 0.015)
// TODO: Add the barcode
// Image(uiImage: UIImage(ciImage: output))
// let isValid = RSUnifiedCodeValidator.shared.isValid("1234567891234", machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue)
// if let barcodeImage = RSUnifiedCodeGenerator.shared.generateCode("1234567891234", machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue, targetSize: CGSize(width: 300, height: 300)) {
// VStack(alignment: .center) {
// Image(uiImage: image)
// .resizable()
// .aspectRatio(contentMode: .fit)
// .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.05)
//
// }
// .frame(maxWidth: .infinity)
// .padding(.top, self.uiscreen.height * 0.01)
// Image(uiImage: UIImage(named: "ic_back")!)
// .renderingMode(.original)
// .resizable()
// .aspectRatio(contentMode: .fit)
// .frame(width: 300, height: 300)
// Image(uiImage: barcodeImage)
// .renderingMode(.original)
// .resizable()
// .aspectRatio(contentMode: .fit)
// .frame(width: 300, height: 300)
// .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.05)
// }
// generateBarcode(from: "1234567891234")
// ?
// .resizable()
// .aspectRatio(contentMode: .fit)
// .frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.1)
Text("123456789101112")
Text(coupon["coupon"] as? String ?? "")
.fontWeight(.regular)
.font(.system(size: 22))
.foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
......