Showing
2 changed files
with
79 additions
and
48 deletions
No preview for this file type
... | @@ -93,6 +93,9 @@ extension WalletView { | ... | @@ -93,6 +93,9 @@ extension WalletView { |
93 | 93 | ||
94 | struct myCoupons: View { | 94 | struct myCoupons: View { |
95 | var uiscreen = UIScreen.main.bounds | 95 | var uiscreen = UIScreen.main.bounds |
96 | + | ||
97 | + @State var parentView:UIView | ||
98 | + | ||
96 | var instanceOfMySwiftApi = swiftApi() | 99 | var instanceOfMySwiftApi = swiftApi() |
97 | // var couponsLength = instanceOfMySwiftApi.getCoupons().filter({ $0.status! == 1 }).count | 100 | // var couponsLength = instanceOfMySwiftApi.getCoupons().filter({ $0.status! == 1 }).count |
98 | var body: some View { | 101 | var body: some View { |
... | @@ -103,10 +106,18 @@ extension WalletView { | ... | @@ -103,10 +106,18 @@ extension WalletView { |
103 | .foregroundColor(Color.white) | 106 | .foregroundColor(Color.white) |
104 | .fontWeight(.medium) | 107 | .fontWeight(.medium) |
105 | Spacer() | 108 | Spacer() |
106 | - Text("Παλαιότερα κουπόνια ->") | 109 | + Button { |
107 | - .font(.system(size: 14)) | 110 | + let instanceOfMyApi = MyApi() |
108 | - .foregroundColor(Color.white) | 111 | + let oldCouponsView = instanceOfMyApi.openOldCoupons(parentView)! |
109 | - .fontWeight(.medium) | 112 | + oldCouponsView.view.tag = 9 |
113 | + oldCouponsView.view.frame = parentView.frame | ||
114 | + parentView.addSubview(oldCouponsView.view) | ||
115 | + } label: { | ||
116 | + Text("Παλαιότερα κουπόνια ->") | ||
117 | + .font(.system(size: 14)) | ||
118 | + .foregroundColor(Color.white) | ||
119 | + .fontWeight(.medium) | ||
120 | + } | ||
110 | } | 121 | } |
111 | .padding(.leading, self.uiscreen.width * 0.05) | 122 | .padding(.leading, self.uiscreen.width * 0.05) |
112 | .padding(.trailing, self.uiscreen.width * 0.05) | 123 | .padding(.trailing, self.uiscreen.width * 0.05) |
... | @@ -117,10 +128,18 @@ extension WalletView { | ... | @@ -117,10 +128,18 @@ extension WalletView { |
117 | .frame(width: self.uiscreen.width * 0.35, alignment: .leading) | 128 | .frame(width: self.uiscreen.width * 0.35, alignment: .leading) |
118 | .font(.system(size: 17)) | 129 | .font(.system(size: 17)) |
119 | Spacer() | 130 | Spacer() |
120 | - Text("Δες τα όλα ->") | 131 | + Button { |
121 | - .font(.system(size: 12)) | 132 | + let instanceOfMyApi = MyApi() |
122 | - .fontWeight(.medium) | 133 | + let couponsView = instanceOfMyApi.openCoupons(parentView)! |
123 | - .frame(width: self.uiscreen.width * 0.35, alignment: .leading) | 134 | + couponsView.view.tag = 1 |
135 | + couponsView.view.frame = parentView.frame | ||
136 | + parentView.addSubview(couponsView.view) | ||
137 | + } label: { | ||
138 | + Text("Δες τα όλα ->") | ||
139 | + .font(.system(size: 12)) | ||
140 | + .fontWeight(.medium) | ||
141 | + .frame(width: self.uiscreen.width * 0.35, alignment: .leading) | ||
142 | + } | ||
124 | Spacer() | 143 | Spacer() |
125 | } | 144 | } |
126 | .padding(.leading, self.uiscreen.width * 0.1) | 145 | .padding(.leading, self.uiscreen.width * 0.1) |
... | @@ -150,53 +169,63 @@ extension WalletView { | ... | @@ -150,53 +169,63 @@ extension WalletView { |
150 | struct myRewards: View { | 169 | struct myRewards: View { |
151 | var uiscreen = UIScreen.main.bounds | 170 | var uiscreen = UIScreen.main.bounds |
152 | 171 | ||
172 | + @State var parentView:UIView | ||
173 | + | ||
153 | var instanceOfMySwiftApi = swiftApi() | 174 | var instanceOfMySwiftApi = swiftApi() |
154 | 175 | ||
155 | var body: some View { | 176 | var body: some View { |
156 | - VStack { | 177 | + Button { |
157 | - HStack { | 178 | + let instanceOfMyApi = MyApi() |
158 | - Text("My rewards") | 179 | + let allGiftsViewController = instanceOfMyApi.openAllGifts(parentView)! |
159 | - .font(.system(size: 18)) | 180 | + allGiftsViewController.view.tag = 8 |
160 | - .foregroundColor(Color.white) | 181 | + allGiftsViewController.view.frame = parentView.frame |
161 | - .fontWeight(.medium) | 182 | + parentView.addSubview(allGiftsViewController.view) |
162 | - Spacer() | 183 | + } label: { |
163 | - Text("Παλαιότερα δώρα ->") | 184 | + VStack { |
164 | - .font(.system(size: 14)) | 185 | + HStack { |
165 | - .foregroundColor(Color.white) | 186 | + Text("My rewards") |
166 | - .fontWeight(.medium) | 187 | + .font(.system(size: 18)) |
167 | - } | 188 | + .foregroundColor(Color.white) |
168 | - .padding(.leading, self.uiscreen.width * 0.05) | 189 | + .fontWeight(.medium) |
169 | - .padding(.trailing, self.uiscreen.width * 0.05) | ||
170 | - HStack { | ||
171 | - VStack { | ||
172 | - Spacer() | ||
173 | - Text(.init("Έχεις **" + String(instanceOfMySwiftApi.getCoupons().filter({ $0.status! == 1 }).count) + "** ενεργά δώρα")) | ||
174 | - .frame(width: self.uiscreen.width * 0.35, alignment: .leading) | ||
175 | - .font(.system(size: 17)) | ||
176 | Spacer() | 190 | Spacer() |
177 | - Text("Δες τα όλα ->") | 191 | + Text("Παλαιότερα δώρα ->") |
178 | - .font(.system(size: 12)) | 192 | + .font(.system(size: 14)) |
193 | + .foregroundColor(Color.white) | ||
179 | .fontWeight(.medium) | 194 | .fontWeight(.medium) |
180 | - .frame(width: self.uiscreen.width * 0.35, alignment: .leading) | 195 | + } |
196 | + .padding(.leading, self.uiscreen.width * 0.05) | ||
197 | + .padding(.trailing, self.uiscreen.width * 0.05) | ||
198 | + HStack { | ||
199 | + VStack { | ||
200 | + Spacer() | ||
201 | + Text(.init("Έχεις **" + String(instanceOfMySwiftApi.getCoupons().filter({ $0.status! == 1 }).count) + "** ενεργά δώρα")) | ||
202 | + .frame(width: self.uiscreen.width * 0.35, alignment: .leading) | ||
203 | + .font(.system(size: 17)) | ||
204 | + Spacer() | ||
205 | + Text("Δες τα όλα ->") | ||
206 | + .font(.system(size: 12)) | ||
207 | + .fontWeight(.medium) | ||
208 | + .frame(width: self.uiscreen.width * 0.35, alignment: .leading) | ||
209 | + Spacer() | ||
210 | + } | ||
211 | + .padding(.leading, self.uiscreen.width * 0.1) | ||
181 | Spacer() | 212 | Spacer() |
213 | + Image("ic_loyalty_rewards", bundle: Bundle(for: MyEmptyClass.self)) | ||
214 | + .resizable() | ||
215 | + .frame(width: self.uiscreen.height * 0.08, height: self.uiscreen.height * 0.08) | ||
216 | + .padding(.trailing, self.uiscreen.width * 0.08) | ||
182 | } | 217 | } |
183 | - .padding(.leading, self.uiscreen.width * 0.1) | 218 | + .padding(.top, self.uiscreen.height * 0.02) |
184 | - Spacer() | 219 | + .padding(.bottom, self.uiscreen.height * 0.02) |
185 | - Image("ic_loyalty_rewards", bundle: Bundle(for: MyEmptyClass.self)) | 220 | + .frame(width: self.uiscreen.width * 0.975) |
186 | - .resizable() | 221 | + .background(Color.white) |
187 | - .frame(width: self.uiscreen.height * 0.08, height: self.uiscreen.height * 0.08) | ||
188 | - .padding(.trailing, self.uiscreen.width * 0.08) | ||
189 | } | 222 | } |
223 | + .padding(.top, self.uiscreen.height * 0.025) | ||
224 | + .padding(.bottom, self.uiscreen.height * 0.025) | ||
225 | + .frame(width: self.uiscreen.width) | ||
226 | + .background(Color(hex: 0xFFFFFF).opacity(0.13)) | ||
190 | .padding(.top, self.uiscreen.height * 0.02) | 227 | .padding(.top, self.uiscreen.height * 0.02) |
191 | - .padding(.bottom, self.uiscreen.height * 0.02) | ||
192 | - .frame(width: self.uiscreen.width * 0.975) | ||
193 | - .background(Color.white) | ||
194 | } | 228 | } |
195 | - .padding(.top, self.uiscreen.height * 0.025) | ||
196 | - .padding(.bottom, self.uiscreen.height * 0.025) | ||
197 | - .frame(width: self.uiscreen.width) | ||
198 | - .background(Color(hex: 0xFFFFFF).opacity(0.13)) | ||
199 | - .padding(.top, self.uiscreen.height * 0.02) | ||
200 | } | 229 | } |
201 | } | 230 | } |
202 | 231 | ||
... | @@ -205,6 +234,8 @@ extension WalletView { | ... | @@ -205,6 +234,8 @@ extension WalletView { |
205 | 234 | ||
206 | var uiscreen = UIScreen.main.bounds | 235 | var uiscreen = UIScreen.main.bounds |
207 | 236 | ||
237 | + @State var parentView:UIView | ||
238 | + | ||
208 | var body: some View { | 239 | var body: some View { |
209 | VStack{ | 240 | VStack{ |
210 | HStack { | 241 | HStack { |
... | @@ -236,8 +267,8 @@ extension WalletView { | ... | @@ -236,8 +267,8 @@ extension WalletView { |
236 | .cornerRadius(3) | 267 | .cornerRadius(3) |
237 | .padding(.top, self.uiscreen.height * 0.04) | 268 | .padding(.top, self.uiscreen.height * 0.04) |
238 | .padding(.bottom, self.uiscreen.height * 0.04) | 269 | .padding(.bottom, self.uiscreen.height * 0.04) |
239 | - myCoupons() | 270 | + myCoupons(parentView: parentView) |
240 | - myRewards() | 271 | + myRewards(parentView: parentView) |
241 | HStack { | 272 | HStack { |
242 | Text("Ανάλυση") | 273 | Text("Ανάλυση") |
243 | .font(.system(size: 14)) | 274 | .font(.system(size: 14)) |
... | @@ -335,7 +366,7 @@ struct WalletView: View { | ... | @@ -335,7 +366,7 @@ struct WalletView: View { |
335 | .padding(.top, self.uiscreen.height * 0.04) | 366 | .padding(.top, self.uiscreen.height * 0.04) |
336 | .padding(.bottom, self.uiscreen.height * 0.02) | 367 | .padding(.bottom, self.uiscreen.height * 0.02) |
337 | ScrollView(showsIndicators: false) { | 368 | ScrollView(showsIndicators: false) { |
338 | - linearView(data: data) | 369 | + linearView(data: data, parentView: parentView) |
339 | } | 370 | } |
340 | .frame(maxWidth: .infinity, maxHeight: .infinity) | 371 | .frame(maxWidth: .infinity, maxHeight: .infinity) |
341 | .edgesIgnoringSafeArea([.bottom]) | 372 | .edgesIgnoringSafeArea([.bottom]) | ... | ... |
-
Please register or login to post a comment