Vasilis
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
15 1E879E27281AC99F0089F489 /* OldCouponsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E879E26281AC99F0089F489 /* OldCouponsViewInterface.swift */; }; 15 1E879E27281AC99F0089F489 /* OldCouponsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E879E26281AC99F0089F489 /* OldCouponsViewInterface.swift */; };
16 1E98EC1428199C4F007524A0 /* AllGiftsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E98EC1328199C4F007524A0 /* AllGiftsView.swift */; }; 16 1E98EC1428199C4F007524A0 /* AllGiftsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E98EC1328199C4F007524A0 /* AllGiftsView.swift */; };
17 1E98EC1628199C86007524A0 /* AllGiftsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E98EC1528199C86007524A0 /* AllGiftsViewInterface.swift */; }; 17 1E98EC1628199C86007524A0 /* AllGiftsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E98EC1528199C86007524A0 /* AllGiftsViewInterface.swift */; };
18 + 1EBB036F281BE3610062F663 /* RSBarcodes_Swift in Frameworks */ = {isa = PBXBuildFile; productRef = 1EBB036E281BE3610062F663 /* RSBarcodes_Swift */; };
18 1EBEB02D280D69D800BF802C /* GiftsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBEB02C280D69D800BF802C /* GiftsView.swift */; }; 19 1EBEB02D280D69D800BF802C /* GiftsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBEB02C280D69D800BF802C /* GiftsView.swift */; };
19 1EBEB02F280D6AA500BF802C /* GiftsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */; }; 20 1EBEB02F280D6AA500BF802C /* GiftsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */; };
20 260C6A1AFF7560C32E212F20 /* Pods_WarplySDKFrameworkIOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1353B8C484CC0649CAC2EB74 /* Pods_WarplySDKFrameworkIOS.framework */; }; 21 260C6A1AFF7560C32E212F20 /* Pods_WarplySDKFrameworkIOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1353B8C484CC0649CAC2EB74 /* Pods_WarplySDKFrameworkIOS.framework */; };
...@@ -292,6 +293,7 @@ ...@@ -292,6 +293,7 @@
292 isa = PBXFrameworksBuildPhase; 293 isa = PBXFrameworksBuildPhase;
293 buildActionMask = 2147483647; 294 buildActionMask = 2147483647;
294 files = ( 295 files = (
296 + 1EBB036F281BE3610062F663 /* RSBarcodes_Swift in Frameworks */,
295 260C6A1AFF7560C32E212F20 /* Pods_WarplySDKFrameworkIOS.framework in Frameworks */, 297 260C6A1AFF7560C32E212F20 /* Pods_WarplySDKFrameworkIOS.framework in Frameworks */,
296 ); 298 );
297 runOnlyForDeploymentPostprocessing = 0; 299 runOnlyForDeploymentPostprocessing = 0;
...@@ -671,6 +673,9 @@ ...@@ -671,6 +673,9 @@
671 dependencies = ( 673 dependencies = (
672 ); 674 );
673 name = WarplySDKFrameworkIOS; 675 name = WarplySDKFrameworkIOS;
676 + packageProductDependencies = (
677 + 1EBB036E281BE3610062F663 /* RSBarcodes_Swift */,
678 + );
674 productName = WarplySDKFrameworkIOS; 679 productName = WarplySDKFrameworkIOS;
675 productReference = E6D8DE6827A942010006A3A9 /* WarplySDKFrameworkIOS.framework */; 680 productReference = E6D8DE6827A942010006A3A9 /* WarplySDKFrameworkIOS.framework */;
676 productType = "com.apple.product-type.framework"; 681 productType = "com.apple.product-type.framework";
...@@ -699,6 +704,9 @@ ...@@ -699,6 +704,9 @@
699 Base, 704 Base,
700 ); 705 );
701 mainGroup = E6D8DE5E27A942000006A3A9; 706 mainGroup = E6D8DE5E27A942000006A3A9;
707 + packageReferences = (
708 + 1EBB036D281BE3610062F663 /* XCRemoteSwiftPackageReference "RSBarcodes_Swift" */,
709 + );
702 productRefGroup = E6D8DE6927A942010006A3A9 /* Products */; 710 productRefGroup = E6D8DE6927A942010006A3A9 /* Products */;
703 projectDirPath = ""; 711 projectDirPath = "";
704 projectRoot = ""; 712 projectRoot = "";
...@@ -1045,6 +1053,25 @@ ...@@ -1045,6 +1053,25 @@
1045 defaultConfigurationName = Release; 1053 defaultConfigurationName = Release;
1046 }; 1054 };
1047 /* End XCConfigurationList section */ 1055 /* End XCConfigurationList section */
1056 +
1057 +/* Begin XCRemoteSwiftPackageReference section */
1058 + 1EBB036D281BE3610062F663 /* XCRemoteSwiftPackageReference "RSBarcodes_Swift" */ = {
1059 + isa = XCRemoteSwiftPackageReference;
1060 + repositoryURL = "https://github.com/yeahdongcn/RSBarcodes_Swift";
1061 + requirement = {
1062 + kind = upToNextMajorVersion;
1063 + minimumVersion = 5.0.0;
1064 + };
1065 + };
1066 +/* End XCRemoteSwiftPackageReference section */
1067 +
1068 +/* Begin XCSwiftPackageProductDependency section */
1069 + 1EBB036E281BE3610062F663 /* RSBarcodes_Swift */ = {
1070 + isa = XCSwiftPackageProductDependency;
1071 + package = 1EBB036D281BE3610062F663 /* XCRemoteSwiftPackageReference "RSBarcodes_Swift" */;
1072 + productName = RSBarcodes_Swift;
1073 + };
1074 +/* End XCSwiftPackageProductDependency section */
1048 }; 1075 };
1049 rootObject = E6D8DE5F27A942010006A3A9 /* Project object */; 1076 rootObject = E6D8DE5F27A942010006A3A9 /* Project object */;
1050 } 1077 }
......
1 +{
2 + "object": {
3 + "pins": [
4 + {
5 + "package": "RSBarcodes_Swift",
6 + "repositoryURL": "https://github.com/yeahdongcn/RSBarcodes_Swift",
7 + "state": {
8 + "branch": null,
9 + "revision": "86d8b1a1439e7edb19793d17732b15fd784a0a15",
10 + "version": "5.1.1"
11 + }
12 + }
13 + ]
14 + },
15 + "version": 1
16 +}
...@@ -10,8 +10,9 @@ import SwiftUI ...@@ -10,8 +10,9 @@ 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 +// TODO: Uncomment for barcode
14 -// import AVFoundation 14 +//import RSBarcodes_Swift
15 +//import AVFoundation
15 16
16 17
17 18
...@@ -95,35 +96,6 @@ extension CouponBarcodeView { ...@@ -95,35 +96,6 @@ extension CouponBarcodeView {
95 } 96 }
96 97
97 98
98 - func generateBarcode(from string: String) -> Image? {
99 -
100 - let data = string.data(using: String.Encoding.ascii)
101 -
102 - if let filter = CIFilter(name: "CICode128BarcodeGenerator") {
103 - filter.setValue(data, forKey: "inputMessage")
104 -// let transform = CGAffineTransform(scaleX: 3, y: 3)
105 -
106 -
107 -// if let output = filter.outputImage?.transformed(by: transform) {
108 - if let output = filter.outputImage {
109 -
110 -// // Change the color using CIFilter
111 -// let colorParameters = [
112 -// "inputColor0": CIColor(color: UIColor.black), // Foreground
113 -// "inputColor1": CIColor(color: UIColor.clear) // Background
114 -// ]
115 -// let colored = output.applyingFilter("CIFalseColor", parameters: colorParameters)
116 - let image = Image(uiImage: UIImage(ciImage: output))
117 -
118 -// return UIImage(ciImage: output)
119 - return image
120 - }
121 - }
122 -
123 - return nil
124 - }
125 -
126 -
127 func constructBarcode() -> String? { 99 func constructBarcode() -> String? {
128 // EAN 13 barcode construction 100 // EAN 13 barcode construction
129 let couponData = coupon["coupon_data"] as? [String: Any] ?? ["":""] 101 let couponData = coupon["coupon_data"] as? [String: Any] ?? ["":""]
...@@ -161,6 +133,7 @@ extension CouponBarcodeView { ...@@ -161,6 +133,7 @@ extension CouponBarcodeView {
161 133
162 var body: some View { 134 var body: some View {
163 let couponData = coupon["coupon_data"] as? [String: Any] ?? ["":""] 135 let couponData = coupon["coupon_data"] as? [String: Any] ?? ["":""]
136 + let barcodeString = constructBarcode() ?? ""
164 137
165 GeometryReader { geometry in 138 GeometryReader { geometry in
166 ScrollView(showsIndicators: false) { 139 ScrollView(showsIndicators: false) {
...@@ -222,45 +195,24 @@ extension CouponBarcodeView { ...@@ -222,45 +195,24 @@ extension CouponBarcodeView {
222 .frame(maxWidth: .infinity) 195 .frame(maxWidth: .infinity)
223 .padding(.top, self.uiscreen.height * 0.015) 196 .padding(.top, self.uiscreen.height * 0.015)
224 197
225 - // TODO: Add the barcode 198 +// let isValid = RSUnifiedCodeValidator.shared.isValid(barcodeString, machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue)
226 -// Image(uiImage: UIImage(ciImage: output))
227 199
228 -// let isValid = RSUnifiedCodeValidator.shared.isValid("1234567891234", machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue) 200 + // TODO: Uncomment for barcode
229 - 201 +// if let barcodeImage = RSUnifiedCodeGenerator.shared.generateCode(barcodeString, machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue, targetSize: CGSize(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.1)) {
230 -// if let barcodeImage = RSUnifiedCodeGenerator.shared.generateCode("1234567891234", machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue, targetSize: CGSize(width: 300, height: 300)) {
231 -
232 -// VStack(alignment: .center) {
233 -// Image(uiImage: image)
234 -// .resizable()
235 -// .aspectRatio(contentMode: .fit)
236 -// .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.05)
237 // 202 //
238 -// } 203 +////
239 -// .frame(maxWidth: .infinity) 204 +// VStack(alignment: .center) {
240 -// .padding(.top, self.uiscreen.height * 0.01)
241 -
242 -// Image(uiImage: UIImage(named: "ic_back")!)
243 -// .renderingMode(.original)
244 -// .resizable()
245 -// .aspectRatio(contentMode: .fit)
246 -// .frame(width: 300, height: 300)
247 -
248 -
249 // Image(uiImage: barcodeImage) 205 // Image(uiImage: barcodeImage)
250 -// .renderingMode(.original)
251 // .resizable() 206 // .resizable()
252 // .aspectRatio(contentMode: .fit) 207 // .aspectRatio(contentMode: .fit)
253 -// .frame(width: 300, height: 300) 208 +// .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.1)
254 -// .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.05)
255 // } 209 // }
210 +// .frame(maxWidth: .infinity)
211 +// .padding(.top, self.uiscreen.height * 0.01)
212 +// }
256 213
257 -// generateBarcode(from: "1234567891234")
258 -// ?
259 -// .resizable()
260 -// .aspectRatio(contentMode: .fit)
261 -// .frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.1)
262 214
263 - Text(constructBarcode() ?? "") 215 + Text(barcodeString)
264 .fontWeight(.regular) 216 .fontWeight(.regular)
265 .font(.system(size: 22)) 217 .font(.system(size: 22))
266 .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) 218 .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
......