Manos Chorianopoulos

CouponBarcodeView fixes

...@@ -56,7 +56,7 @@ extension CouponBarcodeView { ...@@ -56,7 +56,7 @@ extension CouponBarcodeView {
56 56
57 static func convertDateFormat(inputDate: String) -> String { 57 static func convertDateFormat(inputDate: String) -> String {
58 let dateFormatter = DateFormatter() 58 let dateFormatter = DateFormatter()
59 - dateFormatter.dateFormat = "yyyy-MM-dd hh:mm" 59 + dateFormatter.dateFormat = "yyyy-MM-dd hh:mm:ss"
60 if let date = dateFormatter.date(from: inputDate) { 60 if let date = dateFormatter.date(from: inputDate) {
61 dateFormatter.dateFormat = "dd/MM/yyyy" 61 dateFormatter.dateFormat = "dd/MM/yyyy"
62 let resultString = dateFormatter.string(from: date) 62 let resultString = dateFormatter.string(from: date)
...@@ -97,6 +97,8 @@ extension CouponBarcodeView { ...@@ -97,6 +97,8 @@ extension CouponBarcodeView {
97 97
98 98
99 var body: some View { 99 var body: some View {
100 + let couponData = coupon["coupon_data"] as? [String: Any] ?? ["":""]
101 +
100 GeometryReader { geometry in 102 GeometryReader { geometry in
101 ScrollView(showsIndicators: false) { 103 ScrollView(showsIndicators: false) {
102 VStack(alignment: .leading) { 104 VStack(alignment: .leading) {
...@@ -111,6 +113,7 @@ extension CouponBarcodeView { ...@@ -111,6 +113,7 @@ extension CouponBarcodeView {
111 .multilineTextAlignment(.leading) 113 .multilineTextAlignment(.leading)
112 .padding(.horizontal) 114 .padding(.horizontal)
113 .padding(.top, self.uiscreen.height * 0.04) 115 .padding(.top, self.uiscreen.height * 0.04)
116 + .frame(maxHeight: .infinity)
114 117
115 Text(coupon["short_description"] as? String ?? "") 118 Text(coupon["short_description"] as? String ?? "")
116 .fontWeight(.regular) 119 .fontWeight(.regular)
...@@ -131,7 +134,7 @@ extension CouponBarcodeView { ...@@ -131,7 +134,7 @@ extension CouponBarcodeView {
131 134
132 VStack(alignment: .center) { 135 VStack(alignment: .center) {
133 VStack { 136 VStack {
134 - Text(coupon["coupon"] as? String ?? "") 137 + Text(couponData["coupon"] as? String ?? "")
135 .fontWeight(.bold) 138 .fontWeight(.bold)
136 .font(.system(size: 27)) 139 .font(.system(size: 27))
137 .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) 140 .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
...@@ -146,7 +149,7 @@ extension CouponBarcodeView { ...@@ -146,7 +149,7 @@ extension CouponBarcodeView {
146 } 149 }
147 .frame(maxWidth: .infinity) 150 .frame(maxWidth: .infinity)
148 151
149 - if (CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: coupon["coupon"] as? String ?? ""))) { 152 + if (CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: couponData["coupon"] as? String ?? ""))) {
150 VStack(alignment: .center) { 153 VStack(alignment: .center) {
151 VStack {} 154 VStack {}
152 .frame(height: 1) 155 .frame(height: 1)
...@@ -194,7 +197,7 @@ extension CouponBarcodeView { ...@@ -194,7 +197,7 @@ extension CouponBarcodeView {
194 // .aspectRatio(contentMode: .fit) 197 // .aspectRatio(contentMode: .fit)
195 // .frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.1) 198 // .frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.1)
196 199
197 - Text(coupon["coupon"] as? String ?? "") 200 + Text(couponData["coupon"] as? String ?? "")
198 .fontWeight(.regular) 201 .fontWeight(.regular)
199 .font(.system(size: 22)) 202 .font(.system(size: 22))
200 .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) 203 .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
...@@ -215,7 +218,7 @@ extension CouponBarcodeView { ...@@ -215,7 +218,7 @@ extension CouponBarcodeView {
215 218
216 219
217 220
218 - Text("Το κουπόνι ισχύει έως " + CouponBarcodeView.couponContainer.convertDateFormat(inputDate: coupon["expiration"] as? String ?? "")) 221 + Text("Το κουπόνι ισχύει έως " + CouponBarcodeView.couponContainer.convertDateFormat(inputDate: couponData["expiration"] as? String ?? ""))
219 .fontWeight(.medium) 222 .fontWeight(.medium)
220 .font(.system(size: 14)) 223 .font(.system(size: 14))
221 .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) 224 .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
...@@ -296,7 +299,7 @@ extension CouponBarcodeView { ...@@ -296,7 +299,7 @@ extension CouponBarcodeView {
296 299
297 } 300 }
298 .frame(width:self.uiscreen.width) 301 .frame(width:self.uiscreen.width)
299 - .frame(minHeight: geometry.size.height) 302 +// .frame(minHeight: geometry.size.height)
300 .padding(.bottom, self.uiscreen.height * 0.03) 303 .padding(.bottom, self.uiscreen.height * 0.03)
301 } 304 }
302 .frame(width:self.uiscreen.width) 305 .frame(width:self.uiscreen.width)
......