Showing
25 changed files
with
12 additions
and
1336 deletions
This diff is collapsed. Click to expand it.
No preview for this file type
| 1 | -// | ||
| 2 | -// AllGiftsView.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Manos Chorianopoulos on 27/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | - | ||
| 9 | -#if canImport(SwiftUI) | ||
| 10 | -import SwiftUI | ||
| 11 | -import Combine | ||
| 12 | -import Foundation | ||
| 13 | -import UIKit | ||
| 14 | - | ||
| 15 | - | ||
| 16 | -extension AllGiftsView { | ||
| 17 | - struct headerView: View { | ||
| 18 | - var goBack: () -> () | ||
| 19 | - | ||
| 20 | - var uiscreen = UIScreen.main.bounds | ||
| 21 | - | ||
| 22 | - var body: some View { | ||
| 23 | - HStack(alignment: .center) { | ||
| 24 | - Button { | ||
| 25 | - // Button Action | ||
| 26 | - print("Back Button tapped!") | ||
| 27 | - goBack() | ||
| 28 | - } label: { | ||
| 29 | - Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 30 | - .resizable() | ||
| 31 | - .aspectRatio(contentMode: .fit) | ||
| 32 | - .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | ||
| 33 | - } | ||
| 34 | - Spacer().frame(width: 0) | ||
| 35 | - Text("Όλα τα δώρα μου") | ||
| 36 | - .fontWeight(.medium) | ||
| 37 | - .font(.system(size: 16)) | ||
| 38 | - .foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196)) | ||
| 39 | - .multilineTextAlignment(.center) | ||
| 40 | - .frame(maxWidth: .infinity) | ||
| 41 | - .padding(.horizontal) | ||
| 42 | - .offset(x: -self.uiscreen.height * 0.0125) | ||
| 43 | - } | ||
| 44 | - .frame(maxWidth: .infinity) | ||
| 45 | - .padding(.horizontal) | ||
| 46 | - .padding(.vertical, 10) | ||
| 47 | - } | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - struct ImageView: View { | ||
| 51 | - @ObservedObject var imageLoader:UrlImageModel | ||
| 52 | - @State var width:CGFloat | ||
| 53 | - @State var isFill:Bool | ||
| 54 | - | ||
| 55 | - var uiscreen = UIScreen.main.bounds | ||
| 56 | - | ||
| 57 | - init(withURL url:String , width:CGFloat, isFill:Bool) { | ||
| 58 | - imageLoader = UrlImageModel(urlString:url) | ||
| 59 | - self.width = width | ||
| 60 | - self.isFill = isFill | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - var body: some View { | ||
| 64 | - | ||
| 65 | - Image(uiImage: imageLoader.image ?? UIImage()) | ||
| 66 | - .resizable() | ||
| 67 | - .aspectRatio(contentMode: isFill ? .fill : .fit) | ||
| 68 | - .frame(width: self.width) | ||
| 69 | - .frame(maxHeight: .infinity) | ||
| 70 | - } | ||
| 71 | - } | ||
| 72 | - | ||
| 73 | - | ||
| 74 | - struct giftItemView: View { | ||
| 75 | - var item: swiftApi.CouponItemModel | ||
| 76 | - var parentView: UIView | ||
| 77 | - | ||
| 78 | - var uiscreen = UIScreen.main.bounds | ||
| 79 | - | ||
| 80 | - var body: some View { | ||
| 81 | - let couponSetData = item.couponset_data | ||
| 82 | - | ||
| 83 | - Button { | ||
| 84 | - // GiftItem Action | ||
| 85 | - let instanceOfMySwiftApi = swiftApi() | ||
| 86 | - let couponBarcodeViewController = instanceOfMySwiftApi.openCouponBarcode(parent: parentView, coupon: item) | ||
| 87 | - couponBarcodeViewController.view.tag = 7 | ||
| 88 | -// addChild(couponsViewController) | ||
| 89 | - couponBarcodeViewController.view.frame = parentView.frame | ||
| 90 | - parentView.addSubview(couponBarcodeViewController.view) | ||
| 91 | -// couponBarcodeViewController.didMove(toParent: UIHostingController(rootView: self)) | ||
| 92 | - } label: { | ||
| 93 | - HStack(alignment: .center, spacing: 0.0) { | ||
| 94 | - | ||
| 95 | - ImageView(withURL: couponSetData?.img_preview ?? "", width: self.uiscreen.width * 0.5, isFill: true) | ||
| 96 | - | ||
| 97 | - VStack(alignment: .leading, spacing: 5.0) { | ||
| 98 | - Text(couponSetData?.name ?? "") | ||
| 99 | - .fontWeight(.bold) | ||
| 100 | - .font(.system(size: 16)) | ||
| 101 | - .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | ||
| 102 | - .multilineTextAlignment(.leading) | ||
| 103 | - .padding([.top,.horizontal], 15) | ||
| 104 | - .background(Color.white) | ||
| 105 | - | ||
| 106 | - Text(couponSetData?.short_description ?? "") | ||
| 107 | - .fontWeight(.regular) | ||
| 108 | - .font(.system(size: 16)) | ||
| 109 | - .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | ||
| 110 | - .multilineTextAlignment(.leading) | ||
| 111 | - .padding([.bottom,.horizontal], 15) | ||
| 112 | - .background(Color.white) | ||
| 113 | - .frame(maxWidth: .infinity, maxHeight: .infinity) | ||
| 114 | - } | ||
| 115 | - .background(Color.white) | ||
| 116 | - .frame(maxWidth: .infinity, maxHeight: .infinity) | ||
| 117 | - } | ||
| 118 | - .background(Color.white) | ||
| 119 | - .frame(maxWidth: .infinity, maxHeight: .infinity) | ||
| 120 | - } | ||
| 121 | - .frame(width: self.uiscreen.width * 0.95, height: self.uiscreen.height * 0.17) | ||
| 122 | - .background(Color.white) | ||
| 123 | - .cornerRadius(5) | ||
| 124 | - .shadow(color: Color(red: 0, green: 0, blue: 0, opacity: 0.16), radius: 6, x: 0, y: 3) | ||
| 125 | - } | ||
| 126 | - } | ||
| 127 | - | ||
| 128 | - struct couponsContainer: View { | ||
| 129 | - @State var coupons:Array<swiftApi.CouponItemModel> = [] | ||
| 130 | - @State var parentView:UIView | ||
| 131 | - | ||
| 132 | - var uiscreen = UIScreen.main.bounds | ||
| 133 | - | ||
| 134 | - var body: some View { | ||
| 135 | - VStack(alignment: .center, spacing: self.uiscreen.height * 0.03) { | ||
| 136 | - | ||
| 137 | - ForEach(Array(coupons.enumerated()), id: \.offset) { index, item in | ||
| 138 | - | ||
| 139 | - giftItemView(item: item, parentView: parentView) | ||
| 140 | - } | ||
| 141 | - } | ||
| 142 | - .frame(maxWidth: .infinity) | ||
| 143 | - .padding(.top, self.uiscreen.height * 0.05) | ||
| 144 | - .padding(.bottom, self.uiscreen.height * 0.1) | ||
| 145 | - } | ||
| 146 | - } | ||
| 147 | - | ||
| 148 | -} | ||
| 149 | - | ||
| 150 | -@available(iOS 13.0.0, *) | ||
| 151 | -struct AllGiftsView: View { | ||
| 152 | - var parentView: UIView | ||
| 153 | - | ||
| 154 | - var coupons:Array<swiftApi.CouponItemModel> = [] | ||
| 155 | - | ||
| 156 | - var uiscreen = UIScreen.main.bounds | ||
| 157 | - | ||
| 158 | - init(parentView: UIView) { //initializer method | ||
| 159 | - | ||
| 160 | - let instanceOfMySwiftApi = swiftApi() | ||
| 161 | - let couponsData = instanceOfMySwiftApi.getCoupons() | ||
| 162 | - | ||
| 163 | - self.coupons = couponsData | ||
| 164 | - self.parentView = parentView | ||
| 165 | - } | ||
| 166 | - | ||
| 167 | - func goBack(){ | ||
| 168 | - for subview in parentView.subviews { | ||
| 169 | - if(subview.tag == 8) { | ||
| 170 | - subview.removeFromSuperview() | ||
| 171 | - } | ||
| 172 | - } | ||
| 173 | - } | ||
| 174 | - | ||
| 175 | - var body: some View { | ||
| 176 | - VStack { | ||
| 177 | - headerView(goBack: goBack) | ||
| 178 | - | ||
| 179 | - VStack { | ||
| 180 | - ScrollView(showsIndicators: false) { | ||
| 181 | - VStack { | ||
| 182 | - | ||
| 183 | - if (coupons.count) > 0 { | ||
| 184 | - couponsContainer(coupons: coupons, parentView: parentView ) | ||
| 185 | - } | ||
| 186 | - | ||
| 187 | - } | ||
| 188 | - .frame(width:self.uiscreen.width) | ||
| 189 | - } | ||
| 190 | - .cornerRadius(30, corners: [.topLeft]) | ||
| 191 | - .frame(width:self.uiscreen.width) | ||
| 192 | - .frame(maxHeight: .infinity) | ||
| 193 | - } | ||
| 194 | - .frame(width:self.uiscreen.width) | ||
| 195 | - .frame(maxHeight: .infinity) | ||
| 196 | - .padding(.top, 5) | ||
| 197 | - .background( | ||
| 198 | - Image("coupons_scrollview", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 199 | - .resizable() | ||
| 200 | - ) | ||
| 201 | - | ||
| 202 | - } | ||
| 203 | - .edgesIgnoringSafeArea([.bottom]) | ||
| 204 | - .frame(width:self.uiscreen.width) | ||
| 205 | - .frame(maxHeight: .infinity) | ||
| 206 | - } | ||
| 207 | -} | ||
| 208 | -#endif | ||
| 209 | - | ||
| 210 | -//struct AllGiftsView_Previews: PreviewProvider { | ||
| 211 | -// static var previews: some View { | ||
| 212 | -// AllGiftsView() | ||
| 213 | -// } | ||
| 214 | -//} |
| 1 | -// | ||
| 2 | -// AllGiftsViewInterface.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Manos Chorianopoulos on 27/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import Foundation | ||
| 9 | -import SwiftUI | ||
| 10 | - | ||
| 11 | -@available(iOS 13.0.0, *) | ||
| 12 | -@objc public class AllGiftsViewInterface : NSObject { | ||
| 13 | - | ||
| 14 | - @objc(allGiftsViewController:) static public func allGiftsViewController(parentView: UIView?) -> UIViewController { | ||
| 15 | - return UIHostingController(rootView: AllGiftsView(parentView: parentView!)) | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | -} |
| 1 | -// | ||
| 2 | -// CampaignWebview.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Manos Chorianopoulos on 20/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | - | ||
| 9 | -#if canImport(SwiftUI) | ||
| 10 | -import SwiftUI | ||
| 11 | -import Combine | ||
| 12 | -import Foundation | ||
| 13 | -import UIKit | ||
| 14 | -import WebKit | ||
| 15 | - | ||
| 16 | - | ||
| 17 | -extension CampaignWebview { | ||
| 18 | - struct headerView: View { | ||
| 19 | - var goBack: () -> () | ||
| 20 | - | ||
| 21 | - var uiscreen = UIScreen.main.bounds | ||
| 22 | - | ||
| 23 | - var body: some View { | ||
| 24 | - HStack(alignment: .center) { | ||
| 25 | - Button { | ||
| 26 | - // Button Action | ||
| 27 | - print("Back Button tapped!") | ||
| 28 | - goBack() | ||
| 29 | - } label: { | ||
| 30 | - Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 31 | - .resizable() | ||
| 32 | - .aspectRatio(contentMode: .fit) | ||
| 33 | - .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | ||
| 34 | - } | ||
| 35 | - Spacer().frame(width: 0) | ||
| 36 | - Text("") | ||
| 37 | - .fontWeight(.medium) | ||
| 38 | - .font(.system(size: 16)) | ||
| 39 | - .foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196)) | ||
| 40 | - .multilineTextAlignment(.center) | ||
| 41 | - .frame(maxWidth: .infinity) | ||
| 42 | - .padding(.horizontal) | ||
| 43 | - .offset(x: -self.uiscreen.height * 0.0125) | ||
| 44 | - } | ||
| 45 | - .frame(maxWidth: .infinity) | ||
| 46 | - .padding(.horizontal) | ||
| 47 | - .padding(.vertical, 10) | ||
| 48 | - } | ||
| 49 | - } | ||
| 50 | - | ||
| 51 | - struct WebView: UIViewRepresentable { | ||
| 52 | - | ||
| 53 | - var url: String | ||
| 54 | - | ||
| 55 | - func makeUIView(context: Context) -> WKWebView { | ||
| 56 | - return WKWebView() | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - func updateUIView(_ webView: WKWebView, context: Context) { | ||
| 60 | - var request = URLRequest(url: URL(string: url)!) | ||
| 61 | - request.cachePolicy = .reloadRevalidatingCacheData | ||
| 62 | - webView.load(request) | ||
| 63 | - } | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | -} | ||
| 67 | - | ||
| 68 | -@available(iOS 13.0.0, *) | ||
| 69 | -struct CampaignWebview: View { | ||
| 70 | - var parentView: UIView | ||
| 71 | - var campaign: String | ||
| 72 | - | ||
| 73 | - var uiscreen = UIScreen.main.bounds | ||
| 74 | - | ||
| 75 | - func goBack(){ | ||
| 76 | - for subview in parentView.subviews { | ||
| 77 | - if(subview.tag == 6) { | ||
| 78 | - subview.removeFromSuperview() | ||
| 79 | - } | ||
| 80 | - } | ||
| 81 | - } | ||
| 82 | - | ||
| 83 | - var body: some View { | ||
| 84 | - VStack { | ||
| 85 | - headerView(goBack: goBack) | ||
| 86 | - | ||
| 87 | - VStack { | ||
| 88 | - WebView(url: campaign) | ||
| 89 | - } | ||
| 90 | - .background( | ||
| 91 | - LinearGradient(gradient: Gradient(colors: [Color(red: 0.06, green: 0.67, blue: 0.84), Color(red: 0.47, green: 0.75, blue: 0.43)]), startPoint: .top, endPoint: .bottom) | ||
| 92 | - ) | ||
| 93 | - .cornerRadius(30, corners: [.topLeft]) | ||
| 94 | - .frame(width:self.uiscreen.width) | ||
| 95 | - .frame(maxHeight: .infinity) | ||
| 96 | - } | ||
| 97 | - .edgesIgnoringSafeArea([.bottom]) | ||
| 98 | - .frame(width:self.uiscreen.width) | ||
| 99 | - .frame(maxHeight: .infinity) | ||
| 100 | - } | ||
| 101 | -} | ||
| 102 | -#endif | ||
| 103 | - | ||
| 104 | -//@available(iOS 13.0.0, *) | ||
| 105 | -//struct CampaignWebview_Previews: PreviewProvider { | ||
| 106 | -// static var previews: some View { | ||
| 107 | -// | ||
| 108 | -// CampaignWebview() | ||
| 109 | -// | ||
| 110 | -// } | ||
| 111 | -//} |
| 1 | -// | ||
| 2 | -// CampaignWebviewInterface.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Manos Chorianopoulos on 20/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import Foundation | ||
| 9 | -import SwiftUI | ||
| 10 | - | ||
| 11 | -@available(iOS 13.0.0, *) | ||
| 12 | -@objc public class CampaignViewInterface : NSObject { | ||
| 13 | - | ||
| 14 | - @objc(campaignViewController::) static public func campaignViewController(parentView: UIView?, campaign: String?) -> UIViewController { | ||
| 15 | - return UIHostingController(rootView: CampaignWebview(parentView: parentView!, campaign: campaign ?? "")) | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | -} |
This diff is collapsed. Click to expand it.
| 1 | -// | ||
| 2 | -// CouponBarcodeViewInterface.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Manos Chorianopoulos on 21/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import Foundation | ||
| 9 | -import SwiftUI | ||
| 10 | - | ||
| 11 | -@available(iOS 13.0.0, *) | ||
| 12 | -@objc public class CouponBarcodeViewInterface : NSObject { | ||
| 13 | - | ||
| 14 | -// @objc(couponBarcodeViewController::) static public func couponBarcodeViewController(parentView: UIView?, coupon: Dictionary<String, Any>) -> UIViewController { | ||
| 15 | -// return UIHostingController(rootView: CouponBarcodeView(parentView: parentView!, coupon: coupon)) | ||
| 16 | -// } | ||
| 17 | - | ||
| 18 | -} | ||
| 19 | - |
| 1 | -// | ||
| 2 | -// CouponView.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Βασιλης Σκουρας on 21/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | - | ||
| 9 | -#if canImport(SwiftUI) | ||
| 10 | -import SwiftUI | ||
| 11 | -import Combine | ||
| 12 | -import Foundation | ||
| 13 | -import UIKit | ||
| 14 | - | ||
| 15 | - | ||
| 16 | - | ||
| 17 | -extension CouponView { | ||
| 18 | - struct headerView: View { | ||
| 19 | - var goBack: () -> () | ||
| 20 | - | ||
| 21 | - var uiscreen = UIScreen.main.bounds | ||
| 22 | - | ||
| 23 | - var body: some View { | ||
| 24 | - HStack(alignment: .center) { | ||
| 25 | - Button { | ||
| 26 | - // Button Action | ||
| 27 | - goBack() | ||
| 28 | - } label: { | ||
| 29 | - Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 30 | - .resizable() | ||
| 31 | - .aspectRatio(contentMode: .fit) | ||
| 32 | - .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | ||
| 33 | - } | ||
| 34 | - Spacer().frame(width: 0) | ||
| 35 | - Text("Εκπτωτικό κουπόνι") | ||
| 36 | - .fontWeight(.medium) | ||
| 37 | - .font(.system(size: 16)) | ||
| 38 | - .foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196)) | ||
| 39 | - .multilineTextAlignment(.center) | ||
| 40 | - .frame(maxWidth: .infinity) | ||
| 41 | - .padding(.horizontal) | ||
| 42 | - .offset(x: -self.uiscreen.height * 0.0125) | ||
| 43 | - } | ||
| 44 | - .frame(maxWidth: .infinity) | ||
| 45 | - .padding(.horizontal) | ||
| 46 | - .padding(.vertical, 10) | ||
| 47 | - } | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - struct couponContainer: View { | ||
| 51 | - @State var coupon: swiftApi.CouponSetItemModel | ||
| 52 | -// @State var couponset:CouponSetItemModel | ||
| 53 | - | ||
| 54 | - var uiscreen = UIScreen.main.bounds | ||
| 55 | - | ||
| 56 | - var body: some View { | ||
| 57 | - GeometryReader { geometry in | ||
| 58 | - ScrollView(showsIndicators: false) { | ||
| 59 | - VStack(alignment: .leading) { | ||
| 60 | - | ||
| 61 | - ImageView(withURL: coupon.img_preview as? String ?? "") | ||
| 62 | - | ||
| 63 | - Text(coupon.name as? String ?? "") | ||
| 64 | - .fontWeight(.bold) | ||
| 65 | - .font(.system(size: 16)) | ||
| 66 | - .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | ||
| 67 | - .multilineTextAlignment(.leading) | ||
| 68 | - .padding(.horizontal) | ||
| 69 | - .padding(.top, self.uiscreen.height * 0.04) | ||
| 70 | - | ||
| 71 | - Text(coupon.short_description as? String ?? "") | ||
| 72 | - .fontWeight(.regular) | ||
| 73 | - .font(.system(size: 14)) | ||
| 74 | - .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | ||
| 75 | - .multilineTextAlignment(.leading) | ||
| 76 | - .padding(.horizontal) | ||
| 77 | - .padding(.top, self.uiscreen.height * 0.02) | ||
| 78 | - | ||
| 79 | - Spacer() | ||
| 80 | - | ||
| 81 | - VStack(alignment: .center) { | ||
| 82 | - Button { | ||
| 83 | - // Button Action | ||
| 84 | - print("Back Button tapped!") | ||
| 85 | - } label: { | ||
| 86 | - HStack { | ||
| 87 | - Text("Απόκτησέ το") | ||
| 88 | - .fontWeight(.medium) | ||
| 89 | - .font(.system(size: 16)) | ||
| 90 | - .foregroundColor(Color.white) | ||
| 91 | - .multilineTextAlignment(.center) | ||
| 92 | - .padding(.all) | ||
| 93 | - } | ||
| 94 | - } | ||
| 95 | - .frame(width: self.uiscreen.width * 0.8) | ||
| 96 | - .background(Color(red: 0.4745098039215686, green: 0.7490196078431373, blue: 0.0784313725490196)) | ||
| 97 | - .cornerRadius(7) | ||
| 98 | - } | ||
| 99 | - .frame(maxWidth: .infinity) | ||
| 100 | - .padding(.top, self.uiscreen.height * 0.06) | ||
| 101 | - | ||
| 102 | - Button { | ||
| 103 | - // Button Action | ||
| 104 | - print("Terms Button tapped!") | ||
| 105 | - } label: { | ||
| 106 | - Text("Όροι χρήσης") | ||
| 107 | - .fontWeight(.medium) | ||
| 108 | - .font(.system(size: 14)) | ||
| 109 | - .foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803)) | ||
| 110 | - .underline() | ||
| 111 | - .multilineTextAlignment(.center) | ||
| 112 | - .padding(.vertical, self.uiscreen.height * 0.03) | ||
| 113 | - .padding(.horizontal) | ||
| 114 | - .frame(maxWidth: .infinity) | ||
| 115 | - } | ||
| 116 | - .frame(maxWidth: .infinity) | ||
| 117 | - | ||
| 118 | - | ||
| 119 | - } | ||
| 120 | - .frame(width:self.uiscreen.width) | ||
| 121 | - .frame(minHeight: geometry.size.height) | ||
| 122 | - .padding(.bottom, self.uiscreen.height * 0.03) | ||
| 123 | - } | ||
| 124 | - .frame(width:self.uiscreen.width) | ||
| 125 | - .frame(maxHeight: .infinity) | ||
| 126 | - } | ||
| 127 | - .frame(width:self.uiscreen.width) | ||
| 128 | - .frame(maxHeight: .infinity) | ||
| 129 | - } | ||
| 130 | - } | ||
| 131 | - | ||
| 132 | - struct ImageView: View { | ||
| 133 | - @ObservedObject var imageLoader:UrlImageModel | ||
| 134 | - | ||
| 135 | - var uiscreen = UIScreen.main.bounds | ||
| 136 | - | ||
| 137 | - init(withURL url:String) { | ||
| 138 | - imageLoader = UrlImageModel(urlString:url) | ||
| 139 | - } | ||
| 140 | - | ||
| 141 | - var body: some View { | ||
| 142 | - | ||
| 143 | - Image(uiImage: imageLoader.image ?? UIImage()) | ||
| 144 | - .resizable() | ||
| 145 | - .aspectRatio(contentMode: .fill) | ||
| 146 | - .frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.25) | ||
| 147 | - } | ||
| 148 | - } | ||
| 149 | - | ||
| 150 | -} | ||
| 151 | - | ||
| 152 | -@available(iOS 13.0.0, *) | ||
| 153 | -struct CouponView: View { | ||
| 154 | - var parentView: UIView | ||
| 155 | - var coupon: swiftApi.CouponSetItemModel | ||
| 156 | - @State var couponset: swiftApi.CouponSetItemModel? | ||
| 157 | - | ||
| 158 | - var uiscreen = UIScreen.main.bounds | ||
| 159 | - | ||
| 160 | - func goBack() { | ||
| 161 | - for subview in parentView.subviews { | ||
| 162 | - if(subview.tag == 2) { | ||
| 163 | - subview.removeFromSuperview() | ||
| 164 | - } | ||
| 165 | - } | ||
| 166 | - } | ||
| 167 | - | ||
| 168 | - | ||
| 169 | - var body: some View { | ||
| 170 | - VStack { | ||
| 171 | - headerView(goBack: goBack) | ||
| 172 | - | ||
| 173 | - VStack { | ||
| 174 | - couponContainer(coupon: coupon) | ||
| 175 | - } | ||
| 176 | - .background(Color.white) | ||
| 177 | - .cornerRadius(30, corners: [.topLeft]) | ||
| 178 | - .frame(width:self.uiscreen.width) | ||
| 179 | - .frame(maxHeight: .infinity) | ||
| 180 | - } | ||
| 181 | - .edgesIgnoringSafeArea([.bottom]) | ||
| 182 | - .frame(width:self.uiscreen.width) | ||
| 183 | - .frame(maxHeight: .infinity) | ||
| 184 | -// .onAppear { | ||
| 185 | -// // If you want to setup data with model | ||
| 186 | -// couponset = CouponSetItemModel(dictionary: coupon) | ||
| 187 | -// | ||
| 188 | -// } | ||
| 189 | - } | ||
| 190 | -} | ||
| 191 | -#endif | ||
| 192 | - | ||
| 193 | -//struct CouponView_Previews: PreviewProvider { | ||
| 194 | -// static var previews: some View { | ||
| 195 | -// CouponView() | ||
| 196 | -// } | ||
| 197 | -//} |
| 1 | -// | ||
| 2 | -// CouponViewInterface.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Βασιλης Σκουρας on 21/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import Foundation | ||
| 9 | -import SwiftUI | ||
| 10 | - | ||
| 11 | -@available(iOS 13.0.0, *) | ||
| 12 | -@objc public class CouponViewInterface : NSObject { | ||
| 13 | - | ||
| 14 | -// @objc(couponViewController::) static public func couponViewController(parentView: UIView?, coupon: Dictionary<String, Any>) -> UIViewController { | ||
| 15 | -// return UIHostingController(rootView: CouponView(parentView: parentView!, coupon: coupon)) | ||
| 16 | -// } | ||
| 17 | - | ||
| 18 | -} |
This diff is collapsed. Click to expand it.
| 1 | -// | ||
| 2 | -// ProfileViewController.swift | ||
| 3 | -// warplyFramework | ||
| 4 | -// | ||
| 5 | -// Created by Βασιλης Σκουρας on 14/1/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import Foundation | ||
| 9 | -import SwiftUI | ||
| 10 | - | ||
| 11 | -@available(iOS 13.0.0, *) | ||
| 12 | -@objc public class CouponsViewInterface : NSObject { | ||
| 13 | - | ||
| 14 | - @objc(couponsViewController:) static public func couponsViewController(parentView: UIView?) -> UIViewController { | ||
| 15 | - return UIHostingController(rootView: CouponsView(parentView: parentView!)) | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | -} |
This diff is collapsed. Click to expand it.
| 1 | -// | ||
| 2 | -// DetailsViewInterface.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Manos Chorianopoulos on 3/5/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import Foundation | ||
| 9 | -import SwiftUI | ||
| 10 | - | ||
| 11 | -@available(iOS 13.0.0, *) | ||
| 12 | -@objc public class DetailsViewInterface : NSObject { | ||
| 13 | - | ||
| 14 | - @objc(detailsViewController:) static public func detailsViewController(parentView: UIView?) -> UIViewController { | ||
| 15 | - return UIHostingController(rootView: DetailsView(parentView: parentView!)) | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | -} |
This diff is collapsed. Click to expand it.
| 1 | -// | ||
| 2 | -// GiftsViewInterface.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Manos Chorianopoulos on 18/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import Foundation | ||
| 9 | -import SwiftUI | ||
| 10 | - | ||
| 11 | -@available(iOS 13.0.0, *) | ||
| 12 | -@objc public class GiftsViewInterface : NSObject { | ||
| 13 | - | ||
| 14 | - @objc(giftsViewController:) static public func giftsViewController(parentView: UIView?) -> UIViewController { | ||
| 15 | - return UIHostingController(rootView: GiftsView(parentView: parentView!)) | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | -} |
| 1 | -// | ||
| 2 | -// MoreForYouView.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Βασιλης Σκουρας on 20/4/22. | ||
| 6 | -// | ||
| 7 | -import SwiftUI | ||
| 8 | -import Combine | ||
| 9 | -import Foundation | ||
| 10 | -import UIKit | ||
| 11 | - | ||
| 12 | -class DataMFYModel { | ||
| 13 | - var data: Array<NSDictionary> = [] | ||
| 14 | - | ||
| 15 | - init() { //initializer method | ||
| 16 | - let instanceOfMyApi = MyApi() | ||
| 17 | - let inbox = instanceOfMyApi.getInbox() as! Array<NSDictionary> | ||
| 18 | - data = inbox.filter({ $0["offer_category"] as! String == "more_for_you" }) | ||
| 19 | - } | ||
| 20 | - | ||
| 21 | - var getData: Array<NSDictionary> { | ||
| 22 | - get { // getter | ||
| 23 | - return data | ||
| 24 | - } | ||
| 25 | - } | ||
| 26 | -} | ||
| 27 | - | ||
| 28 | -extension MoreForYouView { | ||
| 29 | - | ||
| 30 | - | ||
| 31 | - struct headerView: View { | ||
| 32 | - var goBack: () -> () | ||
| 33 | - var uiscreen = UIScreen.main.bounds | ||
| 34 | - | ||
| 35 | - | ||
| 36 | - var body: some View { | ||
| 37 | - HStack(alignment: .center) { | ||
| 38 | - Button { | ||
| 39 | - // Button Action | ||
| 40 | - goBack() | ||
| 41 | - } label: { | ||
| 42 | - Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 43 | - .resizable() | ||
| 44 | - .aspectRatio(contentMode: .fit) | ||
| 45 | - .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | ||
| 46 | - } | ||
| 47 | - Spacer().frame(width: 0) | ||
| 48 | - Text("More for you") | ||
| 49 | - .fontWeight(.medium) | ||
| 50 | - .font(.system(size: 16)) | ||
| 51 | - .foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196)) | ||
| 52 | - .multilineTextAlignment(.center) | ||
| 53 | - .frame(maxWidth: .infinity) | ||
| 54 | - .padding(.horizontal) | ||
| 55 | - .offset(x: -self.uiscreen.height * 0.0125) | ||
| 56 | - } | ||
| 57 | - .frame(maxWidth: .infinity) | ||
| 58 | - .padding(.horizontal) | ||
| 59 | - .padding(.vertical, 10) | ||
| 60 | - } | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - struct ImageView: View { | ||
| 64 | - @ObservedObject var imageLoader:UrlImageModel | ||
| 65 | - @State var width:CGFloat | ||
| 66 | - @State var height:CGFloat | ||
| 67 | - @State var isFill:Bool | ||
| 68 | - | ||
| 69 | - var uiscreen = UIScreen.main.bounds | ||
| 70 | - | ||
| 71 | - init(withURL url:String , width:CGFloat, height: CGFloat, isFill:Bool) { | ||
| 72 | - imageLoader = UrlImageModel(urlString:url) | ||
| 73 | - self.width = width | ||
| 74 | - self.height = height | ||
| 75 | - self.isFill = isFill | ||
| 76 | - } | ||
| 77 | - | ||
| 78 | - var body: some View { | ||
| 79 | - | ||
| 80 | - Image(uiImage: imageLoader.image ?? UIImage()) | ||
| 81 | - .resizable() | ||
| 82 | - .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) | ||
| 83 | - .scaledToFill() | ||
| 84 | - .aspectRatio(contentMode: isFill ? .fill : .fit) | ||
| 85 | - .cornerRadius(4) | ||
| 86 | - } | ||
| 87 | - } | ||
| 88 | - | ||
| 89 | - struct inboxView: View { | ||
| 90 | - var result: NSDictionary | ||
| 91 | - var index: Int | ||
| 92 | - | ||
| 93 | - var uiscreen = UIScreen.main.bounds | ||
| 94 | - | ||
| 95 | - static func localizedWithParameter(parameter: String) -> LocalizedStringKey { | ||
| 96 | - return "\(parameter)" | ||
| 97 | - } | ||
| 98 | - | ||
| 99 | - var body: some View { | ||
| 100 | - HStack { | ||
| 101 | - VStack(alignment: .leading) { | ||
| 102 | - Text(MoreForYouView.inboxView.localizedWithParameter(parameter: result["title"] as? String ?? "")) | ||
| 103 | - .font(.system(size: 17).italic()) | ||
| 104 | - .fontWeight(.bold) | ||
| 105 | - .foregroundColor(Color(hex: 0x3A5266)) | ||
| 106 | - .frame(maxWidth: self.uiscreen.width * 0.65, alignment: .topLeading) | ||
| 107 | - .padding(.top, self.uiscreen.height * 0.01) | ||
| 108 | - .padding(.leading, self.uiscreen.width * 0.03) | ||
| 109 | - Spacer() | ||
| 110 | - Text(MoreForYouView.inboxView.localizedWithParameter(parameter: result["subtitle"] as? String ?? "")) | ||
| 111 | - .font(.system(size: 16)) | ||
| 112 | - .fontWeight(.medium) | ||
| 113 | - .foregroundColor(Color(hex: 0x415564)) | ||
| 114 | - .frame(maxWidth: self.uiscreen.width * 0.72, alignment: .topLeading) | ||
| 115 | - .padding(.leading, self.uiscreen.width * 0.03) | ||
| 116 | - .padding(.bottom, self.uiscreen.height * 0.01) | ||
| 117 | - } | ||
| 118 | - .frame(width: self.uiscreen.width * 0.85, height: self.uiscreen.height * 0.2, alignment: .leading) | ||
| 119 | - .background( | ||
| 120 | - Image("MFY_container", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 121 | - .resizable() | ||
| 122 | - .frame(minWidth: self.uiscreen.width * 0.85, idealWidth: self.uiscreen.width * 0.85, maxWidth: self.uiscreen.width * 0.85, minHeight: self.uiscreen.height * 0.2, idealHeight: self.uiscreen.height * 0.2, maxHeight: self.uiscreen.height * 0.2, alignment: .leading) | ||
| 123 | - .scaledToFill() | ||
| 124 | - .aspectRatio(contentMode: .fill) | ||
| 125 | - ) | ||
| 126 | - .cornerRadius(4, corners: [.topLeft, .bottomLeft]) | ||
| 127 | - Spacer() | ||
| 128 | - } | ||
| 129 | - .frame(width: self.uiscreen.width * 0.95, height: self.uiscreen.height * 0.2) | ||
| 130 | - .background( | ||
| 131 | - ImageView(withURL: result["logo_url"] as! String, width: self.uiscreen.width * 0.95, height: self.uiscreen.height * 0.2, isFill: true) | ||
| 132 | - ) | ||
| 133 | - .padding(.bottom, self.uiscreen.height * 0.01) | ||
| 134 | - | ||
| 135 | - } | ||
| 136 | - } | ||
| 137 | -} | ||
| 138 | - | ||
| 139 | -extension Color { | ||
| 140 | - init(hex: Int, opacity: Double = 1.0) { | ||
| 141 | - let red = Double((hex & 0xff0000) >> 16) / 255.0 | ||
| 142 | - let green = Double((hex & 0xff00) >> 8) / 255.0 | ||
| 143 | - let blue = Double((hex & 0xff) >> 0) / 255.0 | ||
| 144 | - self.init(.sRGB, red: red, green: green, blue: blue, opacity: opacity) | ||
| 145 | - } | ||
| 146 | -} | ||
| 147 | - | ||
| 148 | -struct MoreForYouView: View { | ||
| 149 | - | ||
| 150 | - var data:Array<NSDictionary> = DataMFYModel().getData | ||
| 151 | - | ||
| 152 | - var parentView: UIView | ||
| 153 | - | ||
| 154 | - var uiscreen = UIScreen.main.bounds | ||
| 155 | - | ||
| 156 | - func goBack(){ | ||
| 157 | - for subview in parentView.subviews { | ||
| 158 | - if(subview.tag == 4) { | ||
| 159 | - subview.removeFromSuperview() | ||
| 160 | - } | ||
| 161 | - } | ||
| 162 | - } | ||
| 163 | - | ||
| 164 | - var body: some View { | ||
| 165 | - VStack { | ||
| 166 | - headerView(goBack: goBack) | ||
| 167 | - ScrollView(showsIndicators: false) { | ||
| 168 | - VStack { | ||
| 169 | - if (data.count) > 0 { | ||
| 170 | - ForEach(Array(zip(data.indices, data)), id: \.0) { index, result in | ||
| 171 | - inboxView(result: result, index: index) | ||
| 172 | - | ||
| 173 | - } | ||
| 174 | - } | ||
| 175 | - } | ||
| 176 | - .padding(.top, self.uiscreen.height * 0.04) | ||
| 177 | - .padding(.bottom, self.uiscreen.height * 0.05) | ||
| 178 | - } | ||
| 179 | - .frame(maxWidth: .infinity, maxHeight: .infinity ) | ||
| 180 | - .background( | ||
| 181 | - LinearGradient(gradient: Gradient(colors: [Color(hex: 0x1AADCC), Color(hex: 0x83C062)]), startPoint: .top, endPoint: .bottom) | ||
| 182 | - ) | ||
| 183 | - .cornerRadius(20, corners: [.topLeft]) | ||
| 184 | - | ||
| 185 | - } | ||
| 186 | - .frame(maxWidth: .infinity, maxHeight: .infinity ) | ||
| 187 | - .edgesIgnoringSafeArea([.bottom]) | ||
| 188 | - // .frame(width:self.uiscreen.width, height:self.uiscreen.height ) | ||
| 189 | - } | ||
| 190 | -} | ||
| 191 | - | ||
| 192 | -//struct MoreForYouView_Previews: PreviewProvider { | ||
| 193 | -// static var previews: some View { | ||
| 194 | -// MoreForYouView() | ||
| 195 | -// } | ||
| 196 | -//} |
| 1 | -// | ||
| 2 | -// MoreForYouViewInterface.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Βασιλης Σκουρας on 20/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import Foundation | ||
| 9 | -import SwiftUI | ||
| 10 | - | ||
| 11 | -@available(iOS 13.0.0, *) | ||
| 12 | -@objc public class MoreForYouViewInterface : NSObject { | ||
| 13 | - | ||
| 14 | - @objc(moreForYouViewController:) static public func moreForYouViewController(parentView: UIView?) -> UIViewController { | ||
| 15 | - return UIHostingController(rootView: MoreForYouView(parentView: parentView!)) | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | -} |
| ... | @@ -37,18 +37,18 @@ CMPedometer *pedometer; | ... | @@ -37,18 +37,18 @@ CMPedometer *pedometer; |
| 37 | NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:cacheSizeMemory diskCapacity:cacheSizeDisk diskPath:@"nsurlcache"]; | 37 | NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:cacheSizeMemory diskCapacity:cacheSizeDisk diskPath:@"nsurlcache"]; |
| 38 | [NSURLCache setSharedURLCache:sharedCache]; | 38 | [NSURLCache setSharedURLCache:sharedCache]; |
| 39 | 39 | ||
| 40 | - date = [NSDate date]; | 40 | +// date = [NSDate date]; |
| 41 | - if ([CMPedometer isStepCountingAvailable]) { | 41 | +// if ([CMPedometer isStepCountingAvailable]) { |
| 42 | - pedometer = [[CMPedometer alloc] init]; | 42 | +// pedometer = [[CMPedometer alloc] init]; |
| 43 | - [NSTimer scheduledTimerWithTimeInterval:0.5f | 43 | +// [NSTimer scheduledTimerWithTimeInterval:0.5f |
| 44 | - target:self | 44 | +// target:self |
| 45 | - selector:@selector(recursiveQuery) | 45 | +// selector:@selector(recursiveQuery) |
| 46 | - userInfo:nil | 46 | +// userInfo:nil |
| 47 | - repeats:YES]; | 47 | +// repeats:YES]; |
| 48 | - } else { | 48 | +// } else { |
| 49 | - NSLog(@"Nothing available"); | 49 | +// NSLog(@"Nothing available"); |
| 50 | - | 50 | +// |
| 51 | - } | 51 | +// } |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | - (void)queryDataFrom:(NSDate *)startDate toDate:(NSDate *)endDate { | 54 | - (void)queryDataFrom:(NSDate *)startDate toDate:(NSDate *)endDate { | ... | ... |
| 1 | -// | ||
| 2 | -// OldCouponsView.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Manos Chorianopoulos on 28/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -#if canImport(SwiftUI) | ||
| 9 | -import SwiftUI | ||
| 10 | -import Combine | ||
| 11 | -import Foundation | ||
| 12 | -import UIKit | ||
| 13 | - | ||
| 14 | - | ||
| 15 | -extension OldCouponsView { | ||
| 16 | - struct headerView: View { | ||
| 17 | - var goBack: () -> () | ||
| 18 | - | ||
| 19 | - var uiscreen = UIScreen.main.bounds | ||
| 20 | - | ||
| 21 | - var body: some View { | ||
| 22 | - HStack(alignment: .center) { | ||
| 23 | - Button { | ||
| 24 | - // Button Action | ||
| 25 | - print("Back Button tapped!") | ||
| 26 | - goBack() | ||
| 27 | - } label: { | ||
| 28 | - Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 29 | - .resizable() | ||
| 30 | - .aspectRatio(contentMode: .fit) | ||
| 31 | - .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | ||
| 32 | - } | ||
| 33 | - | ||
| 34 | - Text("Παλαιότερα κουπόνια") | ||
| 35 | - .fontWeight(.medium) | ||
| 36 | - .font(.system(size: 16)) | ||
| 37 | - .foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196)) | ||
| 38 | - .multilineTextAlignment(.center) | ||
| 39 | - .frame(maxWidth: .infinity) | ||
| 40 | - .padding(.horizontal) | ||
| 41 | - | ||
| 42 | - Button { | ||
| 43 | - // Button Action | ||
| 44 | - print("Wallet tapped!") | ||
| 45 | - } label: { | ||
| 46 | - Image("ic_wallet", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 47 | - .resizable() | ||
| 48 | - .aspectRatio(contentMode: .fit) | ||
| 49 | - .frame(width: self.uiscreen.height * 0.04, height: self.uiscreen.height * 0.04) | ||
| 50 | - } | ||
| 51 | - } | ||
| 52 | - .frame(maxWidth: .infinity) | ||
| 53 | - .padding(.horizontal) | ||
| 54 | - .padding(.vertical, 10) | ||
| 55 | - } | ||
| 56 | - } | ||
| 57 | - | ||
| 58 | - struct ImageView: View { | ||
| 59 | - @ObservedObject var imageLoader:UrlImageModel | ||
| 60 | - @State var width:CGFloat | ||
| 61 | - @State var isFill:Bool | ||
| 62 | - | ||
| 63 | - var uiscreen = UIScreen.main.bounds | ||
| 64 | - | ||
| 65 | - init(withURL url:String , width:CGFloat, isFill:Bool) { | ||
| 66 | - imageLoader = UrlImageModel(urlString:url) | ||
| 67 | - self.width = width | ||
| 68 | - self.isFill = isFill | ||
| 69 | - } | ||
| 70 | - | ||
| 71 | - var body: some View { | ||
| 72 | - | ||
| 73 | - Image(uiImage: imageLoader.image ?? UIImage()) | ||
| 74 | - .resizable() | ||
| 75 | - .aspectRatio(contentMode: isFill ? .fill : .fit) | ||
| 76 | - .frame(width: self.width) | ||
| 77 | - .frame(maxHeight: .infinity) | ||
| 78 | - } | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | - struct couponItemView: View { | ||
| 82 | - var item: swiftApi.CouponItemModel | ||
| 83 | - var parentView: UIView | ||
| 84 | - | ||
| 85 | - var uiscreen = UIScreen.main.bounds | ||
| 86 | - | ||
| 87 | - var body: some View { | ||
| 88 | -// let couponData = item["coupon_data"] as? [String: Any] ?? ["":""] | ||
| 89 | - let couponSetData = item.couponset_data | ||
| 90 | - | ||
| 91 | - Button { | ||
| 92 | - // Coupon Action | ||
| 93 | - print("Coupon tapped!") | ||
| 94 | -// let instanceOfMyApi = MyApi() | ||
| 95 | -// let couponBarcodeViewController = instanceOfMyApi.openCouponBarcode(parentView, coupon: item as! [String : Any])! | ||
| 96 | -// couponBarcodeViewController.view.tag = 7 | ||
| 97 | -//// addChild(couponsViewController) | ||
| 98 | -// couponBarcodeViewController.view.frame = parentView.frame | ||
| 99 | -// parentView.addSubview(couponBarcodeViewController.view) | ||
| 100 | -// couponBarcodeViewController.didMove(toParent: UIHostingController(rootView: self)) | ||
| 101 | - } label: { | ||
| 102 | - | ||
| 103 | - HStack(alignment: .center) { | ||
| 104 | - | ||
| 105 | - ImageView(withURL: couponSetData?.img_preview ?? "", width: self.uiscreen.width * 0.15, isFill: false) | ||
| 106 | - | ||
| 107 | - VLine() | ||
| 108 | - .stroke(style: StrokeStyle(lineWidth: 1, dash: [5])) | ||
| 109 | - .foregroundColor(Color(red: 0.4392156862745098, green: 0.4392156862745098, blue: 0.4392156862745098)) | ||
| 110 | - .frame(width: 1) | ||
| 111 | - .padding(.leading, 10) | ||
| 112 | - | ||
| 113 | - VStack(alignment: .leading, spacing: 5.0) { | ||
| 114 | - Text(couponSetData?.name ?? "") | ||
| 115 | - .fontWeight(.medium) | ||
| 116 | - .font(.system(size: 16)) | ||
| 117 | - .foregroundColor(Color(red: 0.22745098039215686, green: 0.3215686274509804, blue: 0.4)) | ||
| 118 | - .multilineTextAlignment(.leading) | ||
| 119 | -// .lineLimit(1) | ||
| 120 | - | ||
| 121 | - HStack(alignment: .center) { | ||
| 122 | - Text((item.discount ?? "")+"€") | ||
| 123 | - .fontWeight(.bold) | ||
| 124 | - .font(.system(size: 35)) | ||
| 125 | - .foregroundColor(Color(red: 0.22745098039215686, green: 0.3215686274509804, blue: 0.4)) | ||
| 126 | - .multilineTextAlignment(.leading) | ||
| 127 | - .lineLimit(1) | ||
| 128 | - | ||
| 129 | -// Text(couponSetData?.short_description ?? "") | ||
| 130 | -// .fontWeight(.medium) | ||
| 131 | -// .font(.system(size: 11)) | ||
| 132 | -// .foregroundColor(Color(red: 0.3803921568627451, green: 0.44313725490196076, blue: 0.5058823529411764)) | ||
| 133 | -// .multilineTextAlignment(.leading) | ||
| 134 | -// .lineLimit(3) | ||
| 135 | - } | ||
| 136 | - | ||
| 137 | - Text("Εξαργυρώθηκε την " + (item.expiration ?? "")) | ||
| 138 | - .fontWeight(.medium) | ||
| 139 | - .font(.system(size: 11)) | ||
| 140 | - .foregroundColor(Color(red: 0.3803921568627451, green: 0.44313725490196076, blue: 0.5058823529411764)) | ||
| 141 | - .multilineTextAlignment(.leading) | ||
| 142 | - } | ||
| 143 | - .padding(.all, 10) | ||
| 144 | - | ||
| 145 | - Spacer() | ||
| 146 | - | ||
| 147 | - } | ||
| 148 | - .padding(.leading, 28) | ||
| 149 | - .padding(.trailing) | ||
| 150 | - } | ||
| 151 | - .frame(width: self.uiscreen.width * 0.9, height: self.uiscreen.height * 0.14) | ||
| 152 | -// .cornerRadius(5) | ||
| 153 | -// .shadow(color: Color(red: 0, green: 0, blue: 0, opacity: 0.16), radius: 30, x: 0, y: 3) | ||
| 154 | - .background( | ||
| 155 | - Image("coupon_bg", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 156 | - .resizable(resizingMode: .stretch) | ||
| 157 | - .frame(maxWidth: .infinity, maxHeight: .infinity) | ||
| 158 | - .colorMultiply(Color(red: 0.8901960784313725, green: 0.8901960784313725, blue: 0.8901960784313725)) | ||
| 159 | - ) | ||
| 160 | - } | ||
| 161 | - } | ||
| 162 | - | ||
| 163 | - struct VLine: Shape { | ||
| 164 | - func path(in rect: CGRect) -> Path { | ||
| 165 | - Path { path in | ||
| 166 | - path.move(to: CGPoint(x: rect.midX, y: rect.minY)) | ||
| 167 | - path.addLine(to: CGPoint(x: rect.midX, y: rect.maxY)) | ||
| 168 | - } | ||
| 169 | - } | ||
| 170 | - } | ||
| 171 | - | ||
| 172 | - struct couponsContainer: View { | ||
| 173 | - @State var coupons:Array<swiftApi.CouponItemModel> = [] | ||
| 174 | - @State var parentView:UIView | ||
| 175 | - | ||
| 176 | - var uiscreen = UIScreen.main.bounds | ||
| 177 | - | ||
| 178 | -// static func convertDateFormat(inputDate: String) -> String { | ||
| 179 | -// let dateFormatter = DateFormatter() | ||
| 180 | -// dateFormatter.dateFormat = "yyyy-MM-dd hh:mm:ss" | ||
| 181 | -// if let date = dateFormatter.date(from: inputDate) { | ||
| 182 | -// dateFormatter.dateFormat = "dd/MM/yyyy" | ||
| 183 | -// let resultString = dateFormatter.string(from: date) | ||
| 184 | -// return resultString | ||
| 185 | -// } else { | ||
| 186 | -// return "" | ||
| 187 | -// } | ||
| 188 | -// } | ||
| 189 | - | ||
| 190 | - var body: some View { | ||
| 191 | - VStack(alignment: .center, spacing: self.uiscreen.height * 0.03) { | ||
| 192 | - | ||
| 193 | - ForEach(Array(coupons.enumerated()), id: \.offset) { index, item in | ||
| 194 | - | ||
| 195 | - couponItemView(item: item, parentView: parentView) | ||
| 196 | - } | ||
| 197 | - } | ||
| 198 | - .frame(maxWidth: .infinity) | ||
| 199 | - .padding(.top, self.uiscreen.height * 0.05) | ||
| 200 | - .padding(.bottom, self.uiscreen.height * 0.1) | ||
| 201 | - } | ||
| 202 | - } | ||
| 203 | - | ||
| 204 | -} | ||
| 205 | - | ||
| 206 | -@available(iOS 13.0.0, *) | ||
| 207 | -struct OldCouponsView: View { | ||
| 208 | - var parentView: UIView | ||
| 209 | - | ||
| 210 | - var coupons:Array<swiftApi.CouponItemModel> = [] | ||
| 211 | - | ||
| 212 | - var uiscreen = UIScreen.main.bounds | ||
| 213 | - | ||
| 214 | - | ||
| 215 | - init(parentView: UIView) { //initializer method | ||
| 216 | - | ||
| 217 | - let instanceOfMySwiftApi = swiftApi() | ||
| 218 | - let couponsData = instanceOfMySwiftApi.getOldCoupons() | ||
| 219 | - | ||
| 220 | - self.coupons = couponsData | ||
| 221 | - self.parentView = parentView | ||
| 222 | - } | ||
| 223 | - | ||
| 224 | - func goBack(){ | ||
| 225 | - for subview in parentView.subviews { | ||
| 226 | - if(subview.tag == 9) { | ||
| 227 | - subview.removeFromSuperview() | ||
| 228 | - } | ||
| 229 | - } | ||
| 230 | - } | ||
| 231 | - | ||
| 232 | - var body: some View { | ||
| 233 | - VStack { | ||
| 234 | - headerView(goBack: goBack) | ||
| 235 | - | ||
| 236 | - VStack { | ||
| 237 | - ScrollView(showsIndicators: false) { | ||
| 238 | - VStack { | ||
| 239 | - | ||
| 240 | - if (coupons.count) > 0 { | ||
| 241 | - couponsContainer(coupons: coupons, parentView: parentView ) | ||
| 242 | - } | ||
| 243 | - | ||
| 244 | - } | ||
| 245 | - .frame(width:self.uiscreen.width) | ||
| 246 | - } | ||
| 247 | - .cornerRadius(30, corners: [.topLeft]) | ||
| 248 | - .frame(width:self.uiscreen.width) | ||
| 249 | - .frame(maxHeight: .infinity) | ||
| 250 | - } | ||
| 251 | - .frame(width:self.uiscreen.width) | ||
| 252 | - .frame(maxHeight: .infinity) | ||
| 253 | - .padding(.top, 5) | ||
| 254 | - .background( | ||
| 255 | - Image("coupons_scrollview", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 256 | - .resizable() | ||
| 257 | - ) | ||
| 258 | - | ||
| 259 | - } | ||
| 260 | - .edgesIgnoringSafeArea([.bottom]) | ||
| 261 | - .frame(width:self.uiscreen.width) | ||
| 262 | - .frame(maxHeight: .infinity) | ||
| 263 | - } | ||
| 264 | -} | ||
| 265 | -#endif | ||
| 266 | - | ||
| 267 | -//struct OldCouponsView_Previews: PreviewProvider { | ||
| 268 | -// static var previews: some View { | ||
| 269 | -// OldCouponsView() | ||
| 270 | -// } | ||
| 271 | -//} |
| 1 | -// | ||
| 2 | -// OldCouponsViewInterface.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Manos Chorianopoulos on 28/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | - | ||
| 9 | -import Foundation | ||
| 10 | -import SwiftUI | ||
| 11 | - | ||
| 12 | -@available(iOS 13.0.0, *) | ||
| 13 | -@objc public class OldCouponsViewInterface : NSObject { | ||
| 14 | - | ||
| 15 | - @objc(oldCouponsViewController:) static public func oldCouponsViewController(parentView: UIView?) -> UIViewController { | ||
| 16 | - return UIHostingController(rootView: OldCouponsView(parentView: parentView!)) | ||
| 17 | - } | ||
| 18 | - | ||
| 19 | -} |
| 1 | -// | ||
| 2 | -// StepsView.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Βασιλης Σκουρας on 3/5/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -#if canImport(SwiftUI) | ||
| 9 | -import SwiftUI | ||
| 10 | -import Combine | ||
| 11 | -import Foundation | ||
| 12 | -import UIKit | ||
| 13 | - | ||
| 14 | -class StepsModel { | ||
| 15 | - var steps: AnyObject | ||
| 16 | - | ||
| 17 | - init() async { //initializer method | ||
| 18 | - let instanceOfMyApi = MyApi() | ||
| 19 | - self.steps = await instanceOfMyApi.getSteps { _ in | ||
| 20 | - } as AnyObject | ||
| 21 | - print(steps) | ||
| 22 | - } | ||
| 23 | - | ||
| 24 | - var getSteps: AnyObject { | ||
| 25 | - get { // getter | ||
| 26 | - return steps | ||
| 27 | - } | ||
| 28 | - } | ||
| 29 | -} | ||
| 30 | - | ||
| 31 | -extension StepsView { | ||
| 32 | - struct headerView: View { | ||
| 33 | - var goBack: () -> () | ||
| 34 | - var uiscreen = UIScreen.main.bounds | ||
| 35 | - | ||
| 36 | - | ||
| 37 | - var body: some View { | ||
| 38 | - HStack(alignment: .center) { | ||
| 39 | - Button { | ||
| 40 | - // Button Action | ||
| 41 | - goBack() | ||
| 42 | - } label: { | ||
| 43 | - Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 44 | - .resizable() | ||
| 45 | - .aspectRatio(contentMode: .fit) | ||
| 46 | - .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | ||
| 47 | - } | ||
| 48 | - Spacer().frame(width: 0) | ||
| 49 | - Text("Όλα τα κουπόνια μου") | ||
| 50 | - .fontWeight(.medium) | ||
| 51 | - .font(.system(size: 16)) | ||
| 52 | - .foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196)) | ||
| 53 | - .multilineTextAlignment(.center) | ||
| 54 | - .frame(maxWidth: .infinity) | ||
| 55 | - .padding(.horizontal) | ||
| 56 | - .offset(x: -self.uiscreen.height * 0.0125) | ||
| 57 | - } | ||
| 58 | - .frame(maxWidth: .infinity) | ||
| 59 | - .padding(.horizontal) | ||
| 60 | - .padding(.vertical, 10) | ||
| 61 | - } | ||
| 62 | - } | ||
| 63 | - | ||
| 64 | -} | ||
| 65 | - | ||
| 66 | -@available(iOS 13.0.0, *) | ||
| 67 | -struct StepsView: View { | ||
| 68 | - @State private var steps = "Loading" | ||
| 69 | - var parentView: UIView | ||
| 70 | - | ||
| 71 | - func getSteps() async -> AnyObject { | ||
| 72 | - return await StepsModel().getSteps | ||
| 73 | - } | ||
| 74 | - | ||
| 75 | - var uiscreen = UIScreen.main.bounds | ||
| 76 | - | ||
| 77 | - init(parentView: UIView) { //initializer method | ||
| 78 | - self.parentView = parentView | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | - func goBack(){ | ||
| 82 | - for subview in parentView.subviews { | ||
| 83 | - if(subview.tag == 11) { | ||
| 84 | - subview.removeFromSuperview() | ||
| 85 | - } | ||
| 86 | - } | ||
| 87 | - } | ||
| 88 | - | ||
| 89 | - func getSteps() async -> String { | ||
| 90 | - let instanceOfMyApi = MyApi() | ||
| 91 | - let stepsData = await instanceOfMyApi.getSteps { _ in | ||
| 92 | - } as AnyObject | ||
| 93 | -// DispatchQueue.main.async { | ||
| 94 | -// steps = "" | ||
| 95 | -// } | ||
| 96 | - return "" | ||
| 97 | - } | ||
| 98 | - | ||
| 99 | - var body: some View { | ||
| 100 | - VStack { | ||
| 101 | - headerView(goBack: goBack) | ||
| 102 | - Text(steps) | ||
| 103 | - .onAppear { | ||
| 104 | - async { | ||
| 105 | - let instanceOfMyApi = MyApi() | ||
| 106 | - let stepsData = try? await instanceOfMyApi.getSteps { _ in | ||
| 107 | - } as AnyObject | ||
| 108 | - self.steps = "" | ||
| 109 | - } | ||
| 110 | - } | ||
| 111 | - | ||
| 112 | - } | ||
| 113 | - .frame(maxWidth: .infinity, maxHeight: .infinity ) | ||
| 114 | -// .frame(width:self.uiscreen.width, height:self.uiscreen.height ) | ||
| 115 | - } | ||
| 116 | -} | ||
| 117 | -#endif | ||
| 118 | - | ||
| 119 | -//@available(iOS 13.0.0, *) | ||
| 120 | -//struct Previews_CouponsView_Previews: PreviewProvider { | ||
| 121 | -// static var uiscreen = UIScreen.main.bounds | ||
| 122 | -// static var previews: some View { | ||
| 123 | -// ZStack { | ||
| 124 | -// Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 125 | -// .resizable() | ||
| 126 | -// .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | ||
| 127 | -// .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.05, y: self.uiscreen.height * 0.07) | ||
| 128 | -// Text("Όλα τα κουπόνια μου") | ||
| 129 | -// .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.025, alignment: .center) | ||
| 130 | -// .offset( y: self.uiscreen.height * 0.07) | ||
| 131 | -// } | ||
| 132 | -// | ||
| 133 | -// } | ||
| 134 | -//} | ||
| 135 | - |
| 1 | -// | ||
| 2 | -// StepsViewInterface.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Βασιλης Σκουρας on 3/5/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import Foundation | ||
| 9 | -import SwiftUI | ||
| 10 | - | ||
| 11 | -@available(iOS 13.0.0, *) | ||
| 12 | -@objc public class StepsViewInterface : NSObject { | ||
| 13 | - | ||
| 14 | - @objc(stepsViewController:) static public func stepsViewController(parentView: UIView?) -> UIViewController { | ||
| 15 | - return UIHostingController(rootView: StepsView(parentView: parentView!)) | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | -} |
This diff is collapsed. Click to expand it.
| 1 | -// | ||
| 2 | -// WalletViewInterface.swift | ||
| 3 | -// WarplySDKFrameworkIOS | ||
| 4 | -// | ||
| 5 | -// Created by Βασιλης Σκουρας on 20/4/22. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import Foundation | ||
| 9 | -import SwiftUI | ||
| 10 | - | ||
| 11 | -@available(iOS 13.0.0, *) | ||
| 12 | -@objc public class WalletViewInterface : NSObject { | ||
| 13 | - | ||
| 14 | - @objc(walletViewController:) static public func walletViewController(parentView: UIView?) -> UIViewController { | ||
| 15 | - return UIHostingController(rootView: WalletView(parentView: parentView!)) | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | -} |
-
Please register or login to post a comment