Merge branch 'master' of https://git.warp.ly/open-source/warply_sdk_framework
Showing
4 changed files
with
171 additions
and
4 deletions
No preview for this file type
| ... | @@ -390,7 +390,7 @@ extension GiftsView { | ... | @@ -390,7 +390,7 @@ extension GiftsView { |
| 390 | // addChild(couponsViewController) | 390 | // addChild(couponsViewController) |
| 391 | campaignViewController.view.frame = parentView.frame | 391 | campaignViewController.view.frame = parentView.frame |
| 392 | parentView.addSubview(campaignViewController.view) | 392 | parentView.addSubview(campaignViewController.view) |
| 393 | - campaignViewController.didMove(toParent: UIHostingController(rootView: self)) | 393 | +// campaignViewController.didMove(toParent: UIHostingController(rootView: self)) |
| 394 | } label: { | 394 | } label: { |
| 395 | HStack(alignment: .center) { | 395 | HStack(alignment: .center) { |
| 396 | 396 | ||
| ... | @@ -506,7 +506,7 @@ extension GiftsView { | ... | @@ -506,7 +506,7 @@ extension GiftsView { |
| 506 | // addChild(couponsViewController) | 506 | // addChild(couponsViewController) |
| 507 | couponViewController.view.frame = parentView.frame | 507 | couponViewController.view.frame = parentView.frame |
| 508 | parentView.addSubview(couponViewController.view) | 508 | parentView.addSubview(couponViewController.view) |
| 509 | - couponViewController.didMove(toParent: UIHostingController(rootView: self)) | 509 | +// couponViewController.didMove(toParent: UIHostingController(rootView: self)) |
| 510 | } label: { | 510 | } label: { |
| 511 | 511 | ||
| 512 | HStack(alignment: .center) { | 512 | HStack(alignment: .center) { | ... | ... |
| ... | @@ -92,11 +92,17 @@ extension MoreForYouView { | ... | @@ -92,11 +92,17 @@ extension MoreForYouView { |
| 92 | HStack { | 92 | HStack { |
| 93 | VStack(alignment: .leading) { | 93 | VStack(alignment: .leading) { |
| 94 | Text(MoreForYouView.inboxView.localizedWithParameter(parameter: result["title"] as? String ?? "")) | 94 | Text(MoreForYouView.inboxView.localizedWithParameter(parameter: result["title"] as? String ?? "")) |
| 95 | + .font(.system(size: 17).italic()) | ||
| 96 | + .fontWeight(.bold) | ||
| 97 | + .foregroundColor(Color(hex: 0x3A5266)) | ||
| 95 | .frame(maxWidth: self.uiscreen.width * 0.65, alignment: .topLeading) | 98 | .frame(maxWidth: self.uiscreen.width * 0.65, alignment: .topLeading) |
| 96 | .padding(.top, self.uiscreen.height * 0.01) | 99 | .padding(.top, self.uiscreen.height * 0.01) |
| 97 | .padding(.leading, self.uiscreen.width * 0.03) | 100 | .padding(.leading, self.uiscreen.width * 0.03) |
| 98 | Spacer() | 101 | Spacer() |
| 99 | Text(MoreForYouView.inboxView.localizedWithParameter(parameter: result["subtitle"] as? String ?? "")) | 102 | Text(MoreForYouView.inboxView.localizedWithParameter(parameter: result["subtitle"] as? String ?? "")) |
| 103 | + .font(.system(size: 16)) | ||
| 104 | + .fontWeight(.medium) | ||
| 105 | + .foregroundColor(Color(hex: 0x415564)) | ||
| 100 | .frame(maxWidth: self.uiscreen.width * 0.72, alignment: .topLeading) | 106 | .frame(maxWidth: self.uiscreen.width * 0.72, alignment: .topLeading) |
| 101 | .padding(.leading, self.uiscreen.width * 0.03) | 107 | .padding(.leading, self.uiscreen.width * 0.03) |
| 102 | .padding(.bottom, self.uiscreen.height * 0.01) | 108 | .padding(.bottom, self.uiscreen.height * 0.01) |
| ... | @@ -166,6 +172,7 @@ struct MoreForYouView: View { | ... | @@ -166,6 +172,7 @@ struct MoreForYouView: View { |
| 166 | .background( | 172 | .background( |
| 167 | LinearGradient(gradient: Gradient(colors: [Color(hex: 0x1AADCC), Color(hex: 0x83C062)]), startPoint: .top, endPoint: .bottom) | 173 | LinearGradient(gradient: Gradient(colors: [Color(hex: 0x1AADCC), Color(hex: 0x83C062)]), startPoint: .top, endPoint: .bottom) |
| 168 | ) | 174 | ) |
| 175 | + .cornerRadius(20, corners: [.topLeft]) | ||
| 169 | 176 | ||
| 170 | } | 177 | } |
| 171 | .frame(width:self.uiscreen.width, height:self.uiscreen.height ) | 178 | .frame(width:self.uiscreen.width, height:self.uiscreen.height ) | ... | ... |
| ... | @@ -7,7 +7,32 @@ | ... | @@ -7,7 +7,32 @@ |
| 7 | 7 | ||
| 8 | import SwiftUI | 8 | import SwiftUI |
| 9 | 9 | ||
| 10 | +class ProfileDataModel { | ||
| 11 | + var data: NSDictionary | ||
| 12 | + | ||
| 13 | + init() { //initializer method | ||
| 14 | + let instanceOfMyApi = MyApi() | ||
| 15 | + let profile = instanceOfMyApi.getProfile() | ||
| 16 | + var profileData = NSDictionary() | ||
| 17 | + if let profileDictionary = profile as? [String : AnyObject] { | ||
| 18 | + profileData = (profileDictionary["result"] as! NSDictionary) | ||
| 19 | + } | ||
| 20 | + self.data = profileData | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + var getData: NSDictionary { | ||
| 24 | + get { // getter | ||
| 25 | + return data | ||
| 26 | + } | ||
| 27 | + } | ||
| 28 | +} | ||
| 29 | + | ||
| 10 | extension WalletView { | 30 | extension WalletView { |
| 31 | + | ||
| 32 | + static func localizedWithParameter(parameter: String) -> LocalizedStringKey { | ||
| 33 | + return "\(parameter)" | ||
| 34 | + } | ||
| 35 | + | ||
| 11 | struct headerView: View { | 36 | struct headerView: View { |
| 12 | var goBack: () -> () | 37 | var goBack: () -> () |
| 13 | var uiscreen = UIScreen.main.bounds | 38 | var uiscreen = UIScreen.main.bounds |
| ... | @@ -31,6 +56,89 @@ extension WalletView { | ... | @@ -31,6 +56,89 @@ extension WalletView { |
| 31 | .frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.1) | 56 | .frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.1) |
| 32 | } | 57 | } |
| 33 | } | 58 | } |
| 59 | + | ||
| 60 | + struct ImageView: View { | ||
| 61 | + @ObservedObject var imageLoader:UrlImageModel | ||
| 62 | + @State var width:CGFloat | ||
| 63 | + @State var height:CGFloat | ||
| 64 | + @State var isFill:Bool | ||
| 65 | + | ||
| 66 | + var uiscreen = UIScreen.main.bounds | ||
| 67 | + | ||
| 68 | + init(withURL url:String , width:CGFloat, height: CGFloat, isFill:Bool) { | ||
| 69 | + imageLoader = UrlImageModel(urlString:url) | ||
| 70 | + self.width = width | ||
| 71 | + self.height = height | ||
| 72 | + self.isFill = isFill | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + var body: some View { | ||
| 76 | + | ||
| 77 | + Image(uiImage: imageLoader.image ?? UIImage()) | ||
| 78 | + .resizable() | ||
| 79 | + .frame(minWidth: self.uiscreen.width * 0.95, idealWidth: self.uiscreen.width * 0.95, maxWidth: self.uiscreen.width * 0.95, minHeight: self.uiscreen.height * 0.2, idealHeight: self.uiscreen.height * 0.2, maxHeight: self.uiscreen.height * 0.2, alignment: .leading) | ||
| 80 | + .scaledToFill() | ||
| 81 | + .aspectRatio(contentMode: isFill ? .fill : .fit) | ||
| 82 | + .cornerRadius(4) | ||
| 83 | + } | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + struct myCoupons: View { | ||
| 87 | + var uiscreen = UIScreen.main.bounds | ||
| 88 | + | ||
| 89 | + var body: some View { | ||
| 90 | + HStack { | ||
| 91 | + | ||
| 92 | + } | ||
| 93 | + .frame(width: self.uiscreen.width) | ||
| 94 | + } | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + struct linearView: View { | ||
| 98 | + var data: NSDictionary | ||
| 99 | + | ||
| 100 | + var uiscreen = UIScreen.main.bounds | ||
| 101 | + | ||
| 102 | + var body: some View { | ||
| 103 | + VStack{ | ||
| 104 | + HStack { | ||
| 105 | + VStack(alignment: .leading) { | ||
| 106 | + Text("Ενεργός κωδικός:") | ||
| 107 | + .font(.system(size: 17)) | ||
| 108 | + .fontWeight(.medium) | ||
| 109 | + .foregroundColor(Color(hex: 0x3C5365)) | ||
| 110 | + Text("961544809") | ||
| 111 | + .font(.system(size: 17)) | ||
| 112 | + .fontWeight(.bold) | ||
| 113 | + .foregroundColor(Color(hex: 0x3C5365)) | ||
| 114 | + Text("Λήγει σε 4 ημέρες") | ||
| 115 | + .font(.system(size: 11)) | ||
| 116 | + .fontWeight(.medium) | ||
| 117 | + .foregroundColor(Color(hex: 0x84929E)) | ||
| 118 | + } | ||
| 119 | + Spacer() | ||
| 120 | + Image("deals_for_you") | ||
| 121 | + .resizable() | ||
| 122 | + .frame(width: self.uiscreen.height * 0.08, height: self.uiscreen.height * 0.08) | ||
| 123 | + .padding(.top, self.uiscreen.height * 0.01) | ||
| 124 | + .padding(.bottom, self.uiscreen.height * 0.01) | ||
| 125 | + } | ||
| 126 | + .padding(.leading, self.uiscreen.width * 0.04) | ||
| 127 | + .padding(.trailing, self.uiscreen.width * 0.04) | ||
| 128 | + .frame(width: self.uiscreen.width * 0.95, alignment: .leading) | ||
| 129 | + .background(Color.white) | ||
| 130 | + .cornerRadius(3) | ||
| 131 | + .padding(.top, self.uiscreen.height * 0.04) | ||
| 132 | + .padding(.bottom, self.uiscreen.height * 0.04) | ||
| 133 | + myCoupons() | ||
| 134 | + } | ||
| 135 | + .frame(width: self.uiscreen.width, alignment: .center) | ||
| 136 | + .background( | ||
| 137 | + LinearGradient(gradient: Gradient(colors: [Color(hex: 0x1AADCC), Color(hex: 0x83C062)]), startPoint: .top, endPoint: .bottom) | ||
| 138 | + ) | ||
| 139 | + .cornerRadius(15, corners: [.topLeft]) | ||
| 140 | + } | ||
| 141 | + } | ||
| 34 | } | 142 | } |
| 35 | 143 | ||
| 36 | struct WalletView: View { | 144 | struct WalletView: View { |
| ... | @@ -38,6 +146,8 @@ struct WalletView: View { | ... | @@ -38,6 +146,8 @@ struct WalletView: View { |
| 38 | 146 | ||
| 39 | var uiscreen = UIScreen.main.bounds | 147 | var uiscreen = UIScreen.main.bounds |
| 40 | 148 | ||
| 149 | + var data: NSDictionary = ProfileDataModel().getData | ||
| 150 | + | ||
| 41 | func goBack(){ | 151 | func goBack(){ |
| 42 | for subview in parentView.subviews { | 152 | for subview in parentView.subviews { |
| 43 | if(subview.tag == 3) { | 153 | if(subview.tag == 3) { |
| ... | @@ -50,14 +160,64 @@ struct WalletView: View { | ... | @@ -50,14 +160,64 @@ struct WalletView: View { |
| 50 | VStack { | 160 | VStack { |
| 51 | headerView(goBack: goBack) | 161 | headerView(goBack: goBack) |
| 52 | ScrollView(showsIndicators: false) { | 162 | ScrollView(showsIndicators: false) { |
| 163 | + HStack { | ||
| 164 | + ZStack { | ||
| 165 | + if let value = (data["result"] as? String) { | ||
| 166 | + ImageView(withURL: value, width: self.uiscreen.height * 0.05, height: self.uiscreen.height * 0.05, isFill: true) | ||
| 167 | + .cornerRadius(self.uiscreen.height * 0.05) | ||
| 168 | + .padding(.leading, self.uiscreen.width * 0.05) | ||
| 53 | 169 | ||
| 170 | + } else { | ||
| 171 | + Image("generic_profile") | ||
| 172 | + .frame(width: self.uiscreen.height * 0.05, height: self.uiscreen.height * 0.05) | ||
| 173 | + .background(Color.black) | ||
| 174 | + .cornerRadius(self.uiscreen.height * 0.05) | ||
| 175 | + .padding(.leading, self.uiscreen.width * 0.05) | ||
| 176 | + } | ||
| 177 | + Circle() | ||
| 178 | + .strokeBorder(Color(hex: 0x22A9B5), lineWidth: 1) | ||
| 179 | + .frame(width: self.uiscreen.height * 0.05, height: self.uiscreen.height * 0.05) | ||
| 180 | + .padding(.leading, self.uiscreen.width * 0.05) | ||
| 181 | + } | ||
| 182 | + VStack(alignment: .leading) { | ||
| 183 | + Text(WalletView.localizedWithParameter(parameter: data["firstname"] as! String + " " + (data["lastname"] as! String))) | ||
| 184 | + .font(.system(size: 13)) | ||
| 185 | + .padding(.top, self.uiscreen.height * 0.005) | ||
| 186 | + .frame(width: self.uiscreen.width * 0.7, alignment: .leading) | ||
| 187 | + Spacer() | ||
| 188 | + if let value = (data["profile_metadata"] as? NSDictionary) { | ||
| 189 | + if ((value["answered"] != nil) == true) { | ||
| 190 | + VStack { | ||
| 54 | } | 191 | } |
| 55 | - .frame(width:self.uiscreen.width, height:self.uiscreen.height * 0.9 ) | ||
| 56 | .background( | 192 | .background( |
| 57 | - LinearGradient(gradient: Gradient(colors: [Color(hex: 0x1AADCC), Color(hex: 0x83C062)]), startPoint: .top, endPoint: .bottom) | 193 | + LinearGradient(gradient: Gradient(colors: [Color(hex: 0x1AADCC), Color(hex: 0x83C062)]), startPoint: .trailing, endPoint: .leading) |
| 58 | ) | 194 | ) |
| 195 | + } | ||
| 196 | + } else { | ||
| 197 | + HStack { | ||
| 198 | + Text("+") | ||
| 199 | + .font(.system(size: 17)) | ||
| 200 | + .padding(.bottom, 2) | ||
| 201 | + Text("Ερωτηματολόγιο") | ||
| 202 | + .font(.system(size: 13)) | ||
| 203 | + .fontWeight(.medium) | ||
| 204 | + } | ||
| 205 | + .padding(.leading, 5) | ||
| 206 | + .padding(.trailing, 5) | ||
| 207 | + .overlay( | ||
| 208 | + RoundedRectangle(cornerRadius: 16).stroke(Color(hex: 0x556778), lineWidth: 1) | ||
| 209 | + ) | ||
| 210 | + .padding(.bottom, self.uiscreen.height * 0.005) | ||
| 211 | + } | ||
| 212 | + } | ||
| 213 | + .padding(.leading , self.uiscreen.width * 0.025) | ||
| 214 | + } | ||
| 215 | + .frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.06, alignment: .leading) | ||
| 216 | + linearView(data: data) | ||
| 59 | 217 | ||
| 60 | } | 218 | } |
| 219 | + .frame(width:self.uiscreen.width, height:self.uiscreen.height * 0.9 ) | ||
| 220 | + } | ||
| 61 | .frame(width:self.uiscreen.width, height:self.uiscreen.height ) | 221 | .frame(width:self.uiscreen.width, height:self.uiscreen.height ) |
| 62 | } | 222 | } |
| 63 | } | 223 | } | ... | ... |
-
Please register or login to post a comment