Vasilis

revert of mistake at warply.m

This diff could not be displayed because it is too large.
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
9 import SwiftUI 9 import SwiftUI
10 import Combine 10 import Combine
11 import Foundation 11 import Foundation
12 - 12 +import UIKit
13 13
14 class DataModel { 14 class DataModel {
15 var data: Array<NSDictionary> = [] 15 var data: Array<NSDictionary> = []
...@@ -95,15 +95,22 @@ struct ImageView: View { ...@@ -95,15 +95,22 @@ struct ImageView: View {
95 95
96 extension CouponsView { 96 extension CouponsView {
97 struct headerView: View { 97 struct headerView: View {
98 - 98 + var goBack: () -> ()
99 var uiscreen = UIScreen.main.bounds 99 var uiscreen = UIScreen.main.bounds
100 100
101 +
101 var body: some View { 102 var body: some View {
102 HStack { 103 HStack {
104 + Button(action: goBack) {
105 + HStack {
103 Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) 106 Image("ic_back", bundle: Bundle(for: MyEmptyClass.self))
104 .resizable() 107 .resizable()
105 .frame(width: self.uiscreen.width * 0.025, height: self.uiscreen.height * 0.02) 108 .frame(width: self.uiscreen.width * 0.025, height: self.uiscreen.height * 0.02)
106 - .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.05, y: self.uiscreen.height * 0.04) 109 +// .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.05, y: self.uiscreen.height * 0.04)
110 + }
111 + }
112 +// .frame(width: self.uiscreen.width * 0.025, height: self.uiscreen.height * 0.02)
113 +// .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.05, y: self.uiscreen.height * 0.04)
107 Text("Όλα τα κουπόνια μου") 114 Text("Όλα τα κουπόνια μου")
108 .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.025, alignment: .center) 115 .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.025, alignment: .center)
109 .offset( y: self.uiscreen.height * 0.04) 116 .offset( y: self.uiscreen.height * 0.04)
...@@ -127,22 +134,28 @@ extension CouponsView { ...@@ -127,22 +134,28 @@ extension CouponsView {
127 HStack(alignment: .center) { 134 HStack(alignment: .center) {
128 HStack(alignment: .center) { 135 HStack(alignment: .center) {
129 ImageView(withURL: result["img_preview"] as! String) 136 ImageView(withURL: result["img_preview"] as! String)
130 - .frame(width: self.uiscreen.width * 0.2, height: self.uiscreen.height * 0.05) 137 + .frame(maxWidth: self.uiscreen.width * 0.2)
131 // .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.2, y: -self.uiscreen.height * 0.05 * 0.96) 138 // .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.2, y: -self.uiscreen.height * 0.05 * 0.96)
132 // .padding(.leading, self.uiscreen.width * 0.05) 139 // .padding(.leading, self.uiscreen.width * 0.05)
133 Rectangle() 140 Rectangle()
134 .frame(width: 1, height: self.uiscreen.height * 0.1 * 0.93) 141 .frame(width: 1, height: self.uiscreen.height * 0.1 * 0.93)
135 // .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.205, y: -self.uiscreen.height * 0.05 * 0.93) 142 // .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.205, y: -self.uiscreen.height * 0.05 * 0.93)
136 VStack { 143 VStack {
137 - Text(CouponsView.couponView.localizedWithParameter(parameter: result["admin_name"] as! String)) 144 + Text(CouponsView.couponView.localizedWithParameter(parameter: result["admin_name"] as? String ?? ""))
138 - Text(CouponsView.couponView.localizedWithParameter(parameter: result["discount"] as! String)) 145 + .frame(maxWidth: self.uiscreen.width * 0.27, maxHeight: .infinity, alignment: .leading)
139 - Text(CouponsView.couponView.localizedWithParameter(parameter: "Ισχύει εώς " + (result["expiration"] as! String).components(separatedBy: [" "]).filter({!$0.isEmpty})[0])) 146 + Text(CouponsView.couponView.localizedWithParameter(parameter: result["discount"] as? String ?? ""))
147 + .frame(maxWidth: self.uiscreen.width * 0.27, maxHeight: .infinity, alignment: .leading)
148 + Text(CouponsView.couponView.localizedWithParameter(parameter: "Ισχύει εώς " + (result["expiration"] as? String ?? "").components(separatedBy: [" "]).filter({!$0.isEmpty})[0]))
149 + .frame(maxWidth: self.uiscreen.width * 0.27, maxHeight: .infinity, alignment: .leading)
140 } 150 }
141 .frame(maxHeight: .infinity) 151 .frame(maxHeight: .infinity)
152 + .padding(.top, self.uiscreen.height * 0.03)
153 + .padding(.bottom, self.uiscreen.height * 0.03)
142 VStack { 154 VStack {
143 Text(CouponsView.couponView.localizedWithParameter(parameter: result["short_description"] as! String)) 155 Text(CouponsView.couponView.localizedWithParameter(parameter: result["short_description"] as! String))
144 - }
145 .frame(maxWidth: self.uiscreen.width * 0.15, maxHeight: .infinity) 156 .frame(maxWidth: self.uiscreen.width * 0.15, maxHeight: .infinity)
157 + }
158 + .frame(maxWidth: self.uiscreen.width * 0.25, maxHeight: .infinity)
146 159
147 } 160 }
148 .frame(maxWidth: .infinity, maxHeight: .infinity) 161 .frame(maxWidth: .infinity, maxHeight: .infinity)
...@@ -152,7 +165,7 @@ extension CouponsView { ...@@ -152,7 +165,7 @@ extension CouponsView {
152 Image("coupons_container", bundle: Bundle(for: MyEmptyClass.self)) 165 Image("coupons_container", bundle: Bundle(for: MyEmptyClass.self))
153 ) 166 )
154 // .padding(.top, self.uiscreen.height * 0.05) 167 // .padding(.top, self.uiscreen.height * 0.05)
155 - .frame(width: self.uiscreen.width * 0.9, height: self.uiscreen.height * 0.1) 168 + .frame(width: self.uiscreen.width * 0.9, height: self.uiscreen.height * 0.13)
156 .background(Color.purple) 169 .background(Color.purple)
157 } 170 }
158 } 171 }
...@@ -163,12 +176,22 @@ extension CouponsView { ...@@ -163,12 +176,22 @@ extension CouponsView {
163 struct CouponsView: View { 176 struct CouponsView: View {
164 177
165 var data:Array<NSDictionary> = DataModel().getData 178 var data:Array<NSDictionary> = DataModel().getData
179 + var tag: String = "coupons"
180 + var parentView: UIView
166 181
167 var uiscreen = UIScreen.main.bounds 182 var uiscreen = UIScreen.main.bounds
168 183
184 + func goBack(){
185 + for subview in parentView.subviews {
186 + if(subview.tag == 1) {
187 + subview.removeFromSuperview()
188 + }
189 + }
190 + }
191 +
169 var body: some View { 192 var body: some View {
170 VStack { 193 VStack {
171 - headerView() 194 + headerView(goBack: goBack)
172 ScrollView { 195 ScrollView {
173 VStack { 196 VStack {
174 if (data.count) > 0 { 197 if (data.count) > 0 {
......