Showing
5 changed files
with
66 additions
and
37 deletions
No preview for this file type
| ... | @@ -7,7 +7,7 @@ | ... | @@ -7,7 +7,7 @@ |
| 7 | <key>Pods-WarplySDKFrameworkIOS.xcscheme_^#shared#^_</key> | 7 | <key>Pods-WarplySDKFrameworkIOS.xcscheme_^#shared#^_</key> |
| 8 | <dict> | 8 | <dict> |
| 9 | <key>orderHint</key> | 9 | <key>orderHint</key> |
| 10 | - <integer>0</integer> | 10 | + <integer>1</integer> |
| 11 | </dict> | 11 | </dict> |
| 12 | </dict> | 12 | </dict> |
| 13 | </dict> | 13 | </dict> | ... | ... |
| ... | @@ -7,7 +7,7 @@ | ... | @@ -7,7 +7,7 @@ |
| 7 | <key>WarplySDKFrameworkIOS.xcscheme_^#shared#^_</key> | 7 | <key>WarplySDKFrameworkIOS.xcscheme_^#shared#^_</key> |
| 8 | <dict> | 8 | <dict> |
| 9 | <key>orderHint</key> | 9 | <key>orderHint</key> |
| 10 | - <integer>1</integer> | 10 | + <integer>0</integer> |
| 11 | </dict> | 11 | </dict> |
| 12 | </dict> | 12 | </dict> |
| 13 | </dict> | 13 | </dict> | ... | ... |
No preview for this file type
| ... | @@ -32,7 +32,9 @@ class DataModel { | ... | @@ -32,7 +32,9 @@ class DataModel { |
| 32 | // var temp = NSMutableDictionary(dictionary: s); | 32 | // var temp = NSMutableDictionary(dictionary: s); |
| 33 | if c["couponset_uuid"] as! String == s["uuid"] as! String { | 33 | if c["couponset_uuid"] as! String == s["uuid"] as! String { |
| 34 | var temp = NSMutableDictionary(dictionary: s); | 34 | var temp = NSMutableDictionary(dictionary: s); |
| 35 | - temp.addEntries(from: c as! [AnyHashable : Any]) | 35 | +// temp.addEntries(from: c as! [AnyHashable : Any]) |
| 36 | + | ||
| 37 | + temp.setValue(c as! [AnyHashable : Any],forKey: "coupon_data") | ||
| 36 | 38 | ||
| 37 | self.data.append(temp as NSDictionary) | 39 | self.data.append(temp as NSDictionary) |
| 38 | } | 40 | } |
| ... | @@ -48,7 +50,10 @@ class DataModel { | ... | @@ -48,7 +50,10 @@ class DataModel { |
| 48 | 50 | ||
| 49 | var getData: Array<NSDictionary> { | 51 | var getData: Array<NSDictionary> { |
| 50 | get { // getter | 52 | get { // getter |
| 51 | - return data.filter({ $0["status"] as! Int == 1 }) | 53 | + return data.filter({ |
| 54 | + let couponData = $0["coupon_data"] as? [String: Any] ?? ["":""] | ||
| 55 | + return couponData["status"] as? Int == 1 | ||
| 56 | + }) | ||
| 52 | } | 57 | } |
| 53 | } | 58 | } |
| 54 | } | 59 | } |
| ... | @@ -118,6 +123,8 @@ extension CouponsView { | ... | @@ -118,6 +123,8 @@ extension CouponsView { |
| 118 | } | 123 | } |
| 119 | } | 124 | } |
| 120 | Text("Όλα τα κουπόνια μου") | 125 | Text("Όλα τα κουπόνια μου") |
| 126 | + .fontWeight(.medium) | ||
| 127 | + .foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196)) | ||
| 121 | .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.025, alignment: .center) | 128 | .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.025, alignment: .center) |
| 122 | .offset( y: self.uiscreen.height * 0.02) | 129 | .offset( y: self.uiscreen.height * 0.02) |
| 123 | .font(.system(size: 15)) | 130 | .font(.system(size: 15)) |
| ... | @@ -129,6 +136,7 @@ extension CouponsView { | ... | @@ -129,6 +136,7 @@ extension CouponsView { |
| 129 | struct couponView: View { | 136 | struct couponView: View { |
| 130 | var result: NSDictionary | 137 | var result: NSDictionary |
| 131 | var index: Int | 138 | var index: Int |
| 139 | + var parentView: UIView | ||
| 132 | 140 | ||
| 133 | var uiscreen = UIScreen.main.bounds | 141 | var uiscreen = UIScreen.main.bounds |
| 134 | 142 | ||
| ... | @@ -149,42 +157,62 @@ extension CouponsView { | ... | @@ -149,42 +157,62 @@ extension CouponsView { |
| 149 | } | 157 | } |
| 150 | 158 | ||
| 151 | var body: some View { | 159 | var body: some View { |
| 160 | + let couponData = result["coupon_data"] as? [String: Any] ?? ["":""] | ||
| 152 | 161 | ||
| 153 | 162 | ||
| 154 | VStack(alignment: .leading) { | 163 | VStack(alignment: .leading) { |
| 155 | - HStack(alignment: .center) { | 164 | + Button { |
| 156 | - ImageView(withURL: result["img_preview"] as! String) | 165 | + // GiftItem Action |
| 157 | - .frame(maxWidth: self.uiscreen.width * 0.15) | 166 | + let instanceOfMyApi = MyApi() |
| 158 | - .padding(.leading , self.uiscreen.width * 0.055) | 167 | + let couponBarcodeViewController = instanceOfMyApi.openCouponBarcode(parentView, coupon: result as! [String : Any])! |
| 159 | - VLine() | 168 | + couponBarcodeViewController.view.tag = 7 |
| 160 | - .stroke(style: StrokeStyle(lineWidth: 1, dash: [5])) | 169 | + // addChild(couponsViewController) |
| 161 | - .foregroundColor(Color(red: 0.4392156862745098, green: 0.4392156862745098, blue: 0.4392156862745098)) | 170 | + couponBarcodeViewController.view.frame = parentView.frame |
| 162 | - .frame(width: 1) | 171 | + parentView.addSubview(couponBarcodeViewController.view) |
| 163 | - .padding(.leading, self.uiscreen.width * 0.01) | 172 | + couponBarcodeViewController.didMove(toParent: UIHostingController(rootView: self)) |
| 164 | - .padding(.top, self.uiscreen.height * 0.01) | 173 | + } label: { |
| 165 | - .padding(.bottom, self.uiscreen.height * 0.0075) | 174 | + HStack(alignment: .center) { |
| 166 | - Spacer() | 175 | + ImageView(withURL: result["img_preview"] as! String) |
| 167 | - VStack { | 176 | + .frame(maxWidth: self.uiscreen.width * 0.15) |
| 168 | - Text(CouponsView.couponView.localizedWithParameter(parameter: result["admin_name"] as? String ?? "")) | 177 | + .padding(.leading , self.uiscreen.width * 0.055) |
| 169 | - .frame(maxWidth: self.uiscreen.width * 0.35, maxHeight: .infinity, alignment: .leading) | 178 | + VLine() |
| 170 | - .font(.system(size: 15)) | 179 | + .stroke(style: StrokeStyle(lineWidth: 1, dash: [5])) |
| 171 | - Text(CouponsView.couponView.localizedWithParameter(parameter: result["discount"] as? String ?? "")) | 180 | + .foregroundColor(Color(red: 0.4392156862745098, green: 0.4392156862745098, blue: 0.4392156862745098)) |
| 172 | - .frame(maxWidth: self.uiscreen.width * 0.35, maxHeight: self.uiscreen.height * 0.05, alignment: .leading) | 181 | + .frame(width: 1) |
| 173 | - .font(.system(size: 47)) | 182 | + .padding(.leading, self.uiscreen.width * 0.01) |
| 174 | - Text(CouponsView.couponView.localizedWithParameter(parameter: "Ισχύει εώς " + CouponsView.couponView.convertDateFormat(inputDate: result["expiration"] as? String ?? ""))) | 183 | + .padding(.top, self.uiscreen.height * 0.01) |
| 175 | - .frame(maxWidth: self.uiscreen.width * 0.35, maxHeight: .infinity, alignment: .leading) | 184 | + .padding(.bottom, self.uiscreen.height * 0.0075) |
| 176 | - .font(.system(size: 10)) | 185 | + Spacer() |
| 177 | - } | 186 | + VStack { |
| 178 | - .frame(maxHeight: .infinity) | 187 | + Text(CouponsView.couponView.localizedWithParameter(parameter: result["name"] as? String ?? "")) |
| 179 | - .padding(.top, self.uiscreen.height * 0.03) | 188 | + .fontWeight(.medium) |
| 180 | - .padding(.bottom, self.uiscreen.height * 0.03) | 189 | + .foregroundColor(Color(red: 0.22745098039215686, green: 0.3215686274509804, blue: 0.4)) |
| 181 | - VStack { | 190 | + .frame(maxWidth: self.uiscreen.width * 0.35, maxHeight: .infinity, alignment: .leading) |
| 182 | - Text(CouponsView.couponView.localizedWithParameter(parameter: result["short_description"] as! String)) | 191 | + .font(.system(size: 15)) |
| 183 | - .frame(maxWidth: self.uiscreen.width * 0.22, maxHeight: self.uiscreen.height * 0.10) | 192 | + Text(CouponsView.couponView.localizedWithParameter(parameter: couponData["discount"] as? String ?? "")) |
| 184 | - .font(.system(size: 10)) | 193 | + .fontWeight(.bold) |
| 194 | + .foregroundColor(Color(red: 0.22745098039215686, green: 0.3215686274509804, blue: 0.4)) | ||
| 195 | + .frame(maxWidth: self.uiscreen.width * 0.35, maxHeight: self.uiscreen.height * 0.05, alignment: .leading) | ||
| 196 | + .font(.system(size: 47)) | ||
| 197 | + Text(CouponsView.couponView.localizedWithParameter(parameter: "Ισχύει εώς " + CouponsView.couponView.convertDateFormat(inputDate: couponData["expiration"] as? String ?? ""))) | ||
| 198 | + .fontWeight(.medium) | ||
| 199 | + .foregroundColor(Color(red: 0.3803921568627451, green: 0.44313725490196076, blue: 0.5058823529411764)) | ||
| 200 | + .frame(maxWidth: self.uiscreen.width * 0.35, maxHeight: .infinity, alignment: .leading) | ||
| 201 | + .font(.system(size: 10)) | ||
| 202 | + } | ||
| 203 | + .frame(maxHeight: .infinity) | ||
| 204 | + .padding(.top, self.uiscreen.height * 0.03) | ||
| 205 | + .padding(.bottom, self.uiscreen.height * 0.03) | ||
| 206 | + VStack { | ||
| 207 | + Text(CouponsView.couponView.localizedWithParameter(parameter: result["short_description"] as! String)) | ||
| 208 | + .fontWeight(.medium) | ||
| 209 | + .foregroundColor(Color(red: 0.3803921568627451, green: 0.44313725490196076, blue: 0.5058823529411764)) | ||
| 210 | + .frame(maxWidth: self.uiscreen.width * 0.22, maxHeight: self.uiscreen.height * 0.10) | ||
| 211 | + .font(.system(size: 10)) | ||
| 212 | + } | ||
| 213 | + .frame(maxWidth: self.uiscreen.width * 0.25, maxHeight: .infinity) | ||
| 214 | + Spacer() | ||
| 185 | } | 215 | } |
| 186 | - .frame(maxWidth: self.uiscreen.width * 0.25, maxHeight: .infinity) | ||
| 187 | - Spacer() | ||
| 188 | } | 216 | } |
| 189 | } | 217 | } |
| 190 | .frame(width: self.uiscreen.width * 0.95, height: self.uiscreen.height * 0.13) | 218 | .frame(width: self.uiscreen.width * 0.95, height: self.uiscreen.height * 0.13) |
| ... | @@ -223,7 +251,8 @@ struct CouponsView: View { | ... | @@ -223,7 +251,8 @@ struct CouponsView: View { |
| 223 | VStack { | 251 | VStack { |
| 224 | if (data.count) > 0 { | 252 | if (data.count) > 0 { |
| 225 | ForEach(Array(zip(data.indices, data)), id: \.0) { index, result in | 253 | ForEach(Array(zip(data.indices, data)), id: \.0) { index, result in |
| 226 | - couponView(result: result, index: index) } | 254 | + couponView(result: result, index: index, parentView: parentView) |
| 255 | + } | ||
| 227 | } | 256 | } |
| 228 | } | 257 | } |
| 229 | .padding(.top, self.uiscreen.height * 0.05) | 258 | .padding(.top, self.uiscreen.height * 0.05) | ... | ... |
-
Please register or login to post a comment