Vasilis

fix of uibuttons

...@@ -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,11 +106,19 @@ extension WalletView { ...@@ -103,11 +106,19 @@ extension WalletView {
103 .foregroundColor(Color.white) 106 .foregroundColor(Color.white)
104 .fontWeight(.medium) 107 .fontWeight(.medium)
105 Spacer() 108 Spacer()
109 + Button {
110 + let instanceOfMyApi = MyApi()
111 + let oldCouponsView = instanceOfMyApi.openOldCoupons(parentView)!
112 + oldCouponsView.view.tag = 9
113 + oldCouponsView.view.frame = parentView.frame
114 + parentView.addSubview(oldCouponsView.view)
115 + } label: {
106 Text("Παλαιότερα κουπόνια ->") 116 Text("Παλαιότερα κουπόνια ->")
107 .font(.system(size: 14)) 117 .font(.system(size: 14))
108 .foregroundColor(Color.white) 118 .foregroundColor(Color.white)
109 .fontWeight(.medium) 119 .fontWeight(.medium)
110 } 120 }
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)
113 HStack { 124 HStack {
...@@ -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()
131 + Button {
132 + let instanceOfMyApi = MyApi()
133 + let couponsView = instanceOfMyApi.openCoupons(parentView)!
134 + couponsView.view.tag = 1
135 + couponsView.view.frame = parentView.frame
136 + parentView.addSubview(couponsView.view)
137 + } label: {
120 Text("Δες τα όλα ->") 138 Text("Δες τα όλα ->")
121 .font(.system(size: 12)) 139 .font(.system(size: 12))
122 .fontWeight(.medium) 140 .fontWeight(.medium)
123 .frame(width: self.uiscreen.width * 0.35, alignment: .leading) 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,9 +169,18 @@ extension WalletView { ...@@ -150,9 +169,18 @@ 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 {
177 + Button {
178 + let instanceOfMyApi = MyApi()
179 + let allGiftsViewController = instanceOfMyApi.openAllGifts(parentView)!
180 + allGiftsViewController.view.tag = 8
181 + allGiftsViewController.view.frame = parentView.frame
182 + parentView.addSubview(allGiftsViewController.view)
183 + } label: {
156 VStack { 184 VStack {
157 HStack { 185 HStack {
158 Text("My rewards") 186 Text("My rewards")
...@@ -199,12 +227,15 @@ extension WalletView { ...@@ -199,12 +227,15 @@ extension WalletView {
199 .padding(.top, self.uiscreen.height * 0.02) 227 .padding(.top, self.uiscreen.height * 0.02)
200 } 228 }
201 } 229 }
230 + }
202 231
203 struct linearView: View { 232 struct linearView: View {
204 var data: NSDictionary 233 var data: NSDictionary
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])
......