Vasilis

fixes

Showing 25 changed files with 14 additions and 3595 deletions
......@@ -7,35 +7,13 @@
objects = {
/* Begin PBXBuildFile section */
1E7086652811A93F00704CA8 /* CouponBarcodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7086642811A93F00704CA8 /* CouponBarcodeView.swift */; };
1E7086672811A96E00704CA8 /* CouponBarcodeViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7086662811A96E00704CA8 /* CouponBarcodeViewInterface.swift */; };
1E735FF2281067320050A298 /* CampaignWebview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E735FF1281067320050A298 /* CampaignWebview.swift */; };
1E735FF42810681E0050A298 /* CampaignWebviewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E735FF32810681E0050A298 /* CampaignWebviewInterface.swift */; };
1E7536732822B72500149CC9 /* DetailsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7536722822B72500149CC9 /* DetailsViewInterface.swift */; };
1E7536752822B76000149CC9 /* DetailsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E7536742822B76000149CC9 /* DetailsView.swift */; };
1E879E25281AC96A0089F489 /* OldCouponsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E879E24281AC96A0089F489 /* OldCouponsView.swift */; };
1E879E27281AC99F0089F489 /* OldCouponsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E879E26281AC99F0089F489 /* OldCouponsViewInterface.swift */; };
1E98EC1428199C4F007524A0 /* AllGiftsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E98EC1328199C4F007524A0 /* AllGiftsView.swift */; };
1E98EC1628199C86007524A0 /* AllGiftsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E98EC1528199C86007524A0 /* AllGiftsViewInterface.swift */; };
1EBB036F281BE3610062F663 /* RSBarcodes_Swift in Frameworks */ = {isa = PBXBuildFile; productRef = 1EBB036E281BE3610062F663 /* RSBarcodes_Swift */; };
1EBEB02D280D69D800BF802C /* GiftsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBEB02C280D69D800BF802C /* GiftsView.swift */; };
1EBEB02F280D6AA500BF802C /* GiftsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */; };
260C6A1AFF7560C32E212F20 /* Pods_WarplySDKFrameworkIOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1353B8C484CC0649CAC2EB74 /* Pods_WarplySDKFrameworkIOS.framework */; };
E634A362282151E30069DE27 /* StepsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E634A361282151E30069DE27 /* StepsView.swift */; };
E634A364282168550069DE27 /* StepsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = E634A363282168550069DE27 /* StepsViewInterface.swift */; };
E634A369282299770069DE27 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E634A368282299760069DE27 /* Main.storyboard */; };
E634A36B2822999B0069DE27 /* CouponsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E634A36A2822999B0069DE27 /* CouponsViewController.swift */; };
E639EFA2280810E300B9DD94 /* CouponsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E639EFA0280810E300B9DD94 /* CouponsView.swift */; };
E639EFA3280810E300B9DD94 /* CouponsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = E639EFA1280810E300B9DD94 /* CouponsViewInterface.swift */; };
E639EFA52808244E00B9DD94 /* MyEmptyClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = E639EFA42808244E00B9DD94 /* MyEmptyClass.swift */; };
E639EFAB2808347700B9DD94 /* ic_back.png in Resources */ = {isa = PBXBuildFile; fileRef = E639EFAA2808347700B9DD94 /* ic_back.png */; };
E655D05A280590AD004F913C /* WarplySDKFrameworkIOS-Bridging-Header.h in Headers */ = {isa = PBXBuildFile; fileRef = E655D05928058A72004F913C /* WarplySDKFrameworkIOS-Bridging-Header.h */; };
E67D1EB8281055D900940F01 /* WalletViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = E67D1EB7281055D900940F01 /* WalletViewInterface.swift */; };
E67D1EBA281055F800940F01 /* MoreForYouViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = E67D1EB9281055F800940F01 /* MoreForYouViewInterface.swift */; };
E67D1EBE2810573900940F01 /* WalletView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E67D1EBD2810573900940F01 /* WalletView.swift */; };
E67D1EC02810579F00940F01 /* MoreForYouView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E67D1EBF2810579F00940F01 /* MoreForYouView.swift */; };
E67D1EC228113EED00940F01 /* CouponView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E67D1EC128113EED00940F01 /* CouponView.swift */; };
E67D1EC428113EFD00940F01 /* CouponViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = E67D1EC328113EFD00940F01 /* CouponViewInterface.swift */; };
E67D1EC828119ED300940F01 /* swiftApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = E67D1EC528117F2400940F01 /* swiftApi.swift */; };
E6D8DE6D27A942010006A3A9 /* WarplySDKFrameworkIOS.docc in Sources */ = {isa = PBXBuildFile; fileRef = E6D8DE6C27A942010006A3A9 /* WarplySDKFrameworkIOS.docc */; };
E6D8DE6E27A942010006A3A9 /* WarplySDKFrameworkIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = E6D8DE6B27A942010006A3A9 /* WarplySDKFrameworkIOS.h */; settings = {ATTRIBUTES = (Public, ); }; };
......@@ -154,34 +132,12 @@
/* Begin PBXFileReference section */
1353B8C484CC0649CAC2EB74 /* Pods_WarplySDKFrameworkIOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_WarplySDKFrameworkIOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
1E7086642811A93F00704CA8 /* CouponBarcodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponBarcodeView.swift; sourceTree = "<group>"; };
1E7086662811A96E00704CA8 /* CouponBarcodeViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponBarcodeViewInterface.swift; sourceTree = "<group>"; };
1E735FF1281067320050A298 /* CampaignWebview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CampaignWebview.swift; sourceTree = "<group>"; };
1E735FF32810681E0050A298 /* CampaignWebviewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CampaignWebviewInterface.swift; sourceTree = "<group>"; };
1E7536722822B72500149CC9 /* DetailsViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailsViewInterface.swift; sourceTree = "<group>"; };
1E7536742822B76000149CC9 /* DetailsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailsView.swift; sourceTree = "<group>"; };
1E879E24281AC96A0089F489 /* OldCouponsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OldCouponsView.swift; sourceTree = "<group>"; };
1E879E26281AC99F0089F489 /* OldCouponsViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OldCouponsViewInterface.swift; sourceTree = "<group>"; };
1E98EC1328199C4F007524A0 /* AllGiftsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllGiftsView.swift; sourceTree = "<group>"; };
1E98EC1528199C86007524A0 /* AllGiftsViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllGiftsViewInterface.swift; sourceTree = "<group>"; };
1EBEB02C280D69D800BF802C /* GiftsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GiftsView.swift; sourceTree = "<group>"; };
1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GiftsViewInterface.swift; sourceTree = "<group>"; };
B9413513157AD76ECE896B81 /* Pods-WarplySDKFrameworkIOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WarplySDKFrameworkIOS.release.xcconfig"; path = "Target Support Files/Pods-WarplySDKFrameworkIOS/Pods-WarplySDKFrameworkIOS.release.xcconfig"; sourceTree = "<group>"; };
E634A361282151E30069DE27 /* StepsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StepsView.swift; sourceTree = "<group>"; };
E634A363282168550069DE27 /* StepsViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StepsViewInterface.swift; sourceTree = "<group>"; };
E634A368282299760069DE27 /* Main.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
E634A36A2822999B0069DE27 /* CouponsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponsViewController.swift; sourceTree = "<group>"; };
E639EFA0280810E300B9DD94 /* CouponsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CouponsView.swift; sourceTree = "<group>"; };
E639EFA1280810E300B9DD94 /* CouponsViewInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CouponsViewInterface.swift; sourceTree = "<group>"; };
E639EFA42808244E00B9DD94 /* MyEmptyClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyEmptyClass.swift; sourceTree = "<group>"; };
E639EFAA2808347700B9DD94 /* ic_back.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ic_back.png; sourceTree = "<group>"; };
E655D05928058A72004F913C /* WarplySDKFrameworkIOS-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "WarplySDKFrameworkIOS-Bridging-Header.h"; sourceTree = "<group>"; };
E67D1EB7281055D900940F01 /* WalletViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletViewInterface.swift; sourceTree = "<group>"; };
E67D1EB9281055F800940F01 /* MoreForYouViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoreForYouViewInterface.swift; sourceTree = "<group>"; };
E67D1EBD2810573900940F01 /* WalletView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletView.swift; sourceTree = "<group>"; };
E67D1EBF2810579F00940F01 /* MoreForYouView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoreForYouView.swift; sourceTree = "<group>"; };
E67D1EC128113EED00940F01 /* CouponView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponView.swift; sourceTree = "<group>"; };
E67D1EC328113EFD00940F01 /* CouponViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponViewInterface.swift; sourceTree = "<group>"; };
E67D1EC528117F2400940F01 /* swiftApi.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = swiftApi.swift; sourceTree = "<group>"; };
E6D8DE6827A942010006A3A9 /* WarplySDKFrameworkIOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WarplySDKFrameworkIOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
E6D8DE6B27A942010006A3A9 /* WarplySDKFrameworkIOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WarplySDKFrameworkIOS.h; sourceTree = "<group>"; };
......@@ -360,26 +316,6 @@
isa = PBXGroup;
children = (
E639EFA92808347700B9DD94 /* UIResources */,
E639EFA0280810E300B9DD94 /* CouponsView.swift */,
E639EFA1280810E300B9DD94 /* CouponsViewInterface.swift */,
1EBEB02C280D69D800BF802C /* GiftsView.swift */,
1E7536722822B72500149CC9 /* DetailsViewInterface.swift */,
1E7536742822B76000149CC9 /* DetailsView.swift */,
1E98EC1328199C4F007524A0 /* AllGiftsView.swift */,
1E879E24281AC96A0089F489 /* OldCouponsView.swift */,
1E879E26281AC99F0089F489 /* OldCouponsViewInterface.swift */,
1E98EC1528199C86007524A0 /* AllGiftsViewInterface.swift */,
1E735FF1281067320050A298 /* CampaignWebview.swift */,
1E735FF32810681E0050A298 /* CampaignWebviewInterface.swift */,
1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */,
E67D1EB7281055D900940F01 /* WalletViewInterface.swift */,
E67D1EBD2810573900940F01 /* WalletView.swift */,
E67D1EB9281055F800940F01 /* MoreForYouViewInterface.swift */,
E67D1EBF2810579F00940F01 /* MoreForYouView.swift */,
E67D1EC128113EED00940F01 /* CouponView.swift */,
1E7086642811A93F00704CA8 /* CouponBarcodeView.swift */,
1E7086662811A96E00704CA8 /* CouponBarcodeViewInterface.swift */,
E67D1EC328113EFD00940F01 /* CouponViewInterface.swift */,
E6D8DF5E27A9429E0006A3A9 /* MyApi.h */,
E6D8DF5C27A9429E0006A3A9 /* MyApi.m */,
E6D8DE7427A942910006A3A9 /* Helpers */,
......@@ -390,8 +326,6 @@
E655D05928058A72004F913C /* WarplySDKFrameworkIOS-Bridging-Header.h */,
E639EFA42808244E00B9DD94 /* MyEmptyClass.swift */,
E67D1EC528117F2400940F01 /* swiftApi.swift */,
E634A361282151E30069DE27 /* StepsView.swift */,
E634A363282168550069DE27 /* StepsViewInterface.swift */,
E634A368282299760069DE27 /* Main.storyboard */,
E634A36A2822999B0069DE27 /* CouponsViewController.swift */,
);
......@@ -786,54 +720,34 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1E879E27281AC99F0089F489 /* OldCouponsViewInterface.swift in Sources */,
E634A364282168550069DE27 /* StepsViewInterface.swift in Sources */,
E6D8DF0B27A942920006A3A9 /* WLEvent.m in Sources */,
E6D8DF1E27A942920006A3A9 /* UIViewController+WLAdditions.m in Sources */,
E6D8DF2E27A942920006A3A9 /* UIRefreshControl+AFNetworking.m in Sources */,
E6D8DF4827A942920006A3A9 /* AFURLRequestSerialization.m in Sources */,
E67D1EC228113EED00940F01 /* CouponView.swift in Sources */,
1E7086672811A96E00704CA8 /* CouponBarcodeViewInterface.swift in Sources */,
1E98EC1428199C4F007524A0 /* AllGiftsView.swift in Sources */,
E6D8DEF327A942920006A3A9 /* WLNativeVideoTableViewCell.m in Sources */,
E6D8DF2527A942920006A3A9 /* WLSMSActionHanlder.m in Sources */,
E67D1EBE2810573900940F01 /* WalletView.swift in Sources */,
E6D8DF5727A942920006A3A9 /* FMResultSet.m in Sources */,
E67D1EC428113EFD00940F01 /* CouponViewInterface.swift in Sources */,
E6D8DF3A27A942920006A3A9 /* UIButton+AFNetworking.m in Sources */,
E6D8DF0627A942920006A3A9 /* WLBeacon.m in Sources */,
1E735FF2281067320050A298 /* CampaignWebview.swift in Sources */,
E6D8DF2927A942920006A3A9 /* NSData+SSToolkitAdditions.m in Sources */,
1EBEB02D280D69D800BF802C /* GiftsView.swift in Sources */,
E67D1EC02810579F00940F01 /* MoreForYouView.swift in Sources */,
E6D8DEFC27A942920006A3A9 /* WLCustomNativeAdTableViewCell.m in Sources */,
1E735FF42810681E0050A298 /* CampaignWebviewInterface.swift in Sources */,
E639EFA3280810E300B9DD94 /* CouponsViewInterface.swift in Sources */,
1EBEB02F280D6AA500BF802C /* GiftsViewInterface.swift in Sources */,
E67D1EBA281055F800940F01 /* MoreForYouViewInterface.swift in Sources */,
E6D8DF4A27A942920006A3A9 /* AFNetworkReachabilityManager.m in Sources */,
E6D8DF4B27A942920006A3A9 /* AFSecurityPolicy.m in Sources */,
E6D8DF1327A942920006A3A9 /* WLBeaconManager.m in Sources */,
E6D8DF0427A942920006A3A9 /* WLInboxItem.m in Sources */,
E6D8DF5127A942920006A3A9 /* FMDatabaseAdditions.m in Sources */,
1E879E25281AC96A0089F489 /* OldCouponsView.swift in Sources */,
E6D8DF2127A942920006A3A9 /* WLAPPActionHandler.m in Sources */,
E6D8DF5627A942920006A3A9 /* FMDatabasePool.m in Sources */,
E6D8DF4527A942920006A3A9 /* AFHTTPSessionManager.m in Sources */,
E6D8DF3B27A942920006A3A9 /* UIActivityIndicatorView+AFNetworking.m in Sources */,
E6D8DF3727A942920006A3A9 /* UIImageView+AFNetworking.m in Sources */,
E67D1EB8281055D900940F01 /* WalletViewInterface.swift in Sources */,
E6D8DF3127A942920006A3A9 /* AFNetworkActivityIndicatorManager.m in Sources */,
E6D8DF3D27A942920006A3A9 /* AFAutoPurgingImageCache.m in Sources */,
E634A362282151E30069DE27 /* StepsView.swift in Sources */,
E6D8DF0A27A942920006A3A9 /* WLAPSItem.m in Sources */,
E6D8DF2C27A942920006A3A9 /* UIProgressView+AFNetworking.m in Sources */,
E6D8DF3C27A942920006A3A9 /* UIWebView+AFNetworking.m in Sources */,
E639EFA2280810E300B9DD94 /* CouponsView.swift in Sources */,
1E98EC1628199C86007524A0 /* AllGiftsViewInterface.swift in Sources */,
E6D8DF1427A942920006A3A9 /* WLLocationManager.m in Sources */,
E6D8DF6027A9429E0006A3A9 /* MyApi.m in Sources */,
1E7536752822B76000149CC9 /* DetailsView.swift in Sources */,
E6D8DF3F27A942920006A3A9 /* AFImageDownloader.m in Sources */,
E6D8DEF727A942920006A3A9 /* WLNativeAdsCollectionMode.m in Sources */,
E6D8DEF427A942920006A3A9 /* WLCustomNativeCollectionViewCell.m in Sources */,
......@@ -843,7 +757,6 @@
E67D1EC828119ED300940F01 /* swiftApi.swift in Sources */,
E6D8DF5227A942920006A3A9 /* FMDatabase.m in Sources */,
E6D8DF1227A942920006A3A9 /* WLPushManager.m in Sources */,
1E7086652811A93F00704CA8 /* CouponBarcodeView.swift in Sources */,
E6D8DEF827A942920006A3A9 /* WLNativeAdTableViewCell.m in Sources */,
E6D8DE6D27A942010006A3A9 /* WarplySDKFrameworkIOS.docc in Sources */,
E6D8DF4427A942920006A3A9 /* AFURLResponseSerialization.m in Sources */,
......@@ -856,7 +769,6 @@
E6D8DEEE27A942920006A3A9 /* WarplyReactMethods.m in Sources */,
E6D8DEF927A942920006A3A9 /* WLNativeAdCollectionViewCell.m in Sources */,
E634A36B2822999B0069DE27 /* CouponsViewController.swift in Sources */,
1E7536732822B72500149CC9 /* DetailsViewInterface.swift in Sources */,
E6D8DF4E27A942920006A3A9 /* FMDatabaseQueue.m in Sources */,
E6D8DF0827A942920006A3A9 /* WLBaseItem.m in Sources */,
E6D8DF0727A942920006A3A9 /* WLInboxItemViewController.m in Sources */,
......@@ -989,6 +901,7 @@
baseConfigurationReference = F2447FDBC0B149DFB9DC6E40 /* Pods-WarplySDKFrameworkIOS.debug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
APPLICATION_EXTENSION_API_ONLY = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
......@@ -1025,6 +938,7 @@
baseConfigurationReference = B9413513157AD76ECE896B81 /* Pods-WarplySDKFrameworkIOS.release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
APPLICATION_EXTENSION_API_ONLY = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
......
//
// AllGiftsView.swift
// WarplySDKFrameworkIOS
//
// Created by Manos Chorianopoulos on 27/4/22.
//
#if canImport(SwiftUI)
import SwiftUI
import Combine
import Foundation
import UIKit
extension AllGiftsView {
struct headerView: View {
var goBack: () -> ()
var uiscreen = UIScreen.main.bounds
var body: some View {
HStack(alignment: .center) {
Button {
// Button Action
print("Back Button tapped!")
goBack()
} label: {
Image("ic_back", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02)
}
Spacer().frame(width: 0)
Text("Όλα τα δώρα μου")
.fontWeight(.medium)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196))
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
.padding(.horizontal)
.offset(x: -self.uiscreen.height * 0.0125)
}
.frame(maxWidth: .infinity)
.padding(.horizontal)
.padding(.vertical, 10)
}
}
struct ImageView: View {
@ObservedObject var imageLoader:UrlImageModel
@State var width:CGFloat
@State var isFill:Bool
var uiscreen = UIScreen.main.bounds
init(withURL url:String , width:CGFloat, isFill:Bool) {
imageLoader = UrlImageModel(urlString:url)
self.width = width
self.isFill = isFill
}
var body: some View {
Image(uiImage: imageLoader.image ?? UIImage())
.resizable()
.aspectRatio(contentMode: isFill ? .fill : .fit)
.frame(width: self.width)
.frame(maxHeight: .infinity)
}
}
struct giftItemView: View {
var item: swiftApi.CouponItemModel
var parentView: UIView
var uiscreen = UIScreen.main.bounds
var body: some View {
let couponSetData = item.couponset_data
Button {
// GiftItem Action
let instanceOfMySwiftApi = swiftApi()
let couponBarcodeViewController = instanceOfMySwiftApi.openCouponBarcode(parent: parentView, coupon: item)
couponBarcodeViewController.view.tag = 7
// addChild(couponsViewController)
couponBarcodeViewController.view.frame = parentView.frame
parentView.addSubview(couponBarcodeViewController.view)
// couponBarcodeViewController.didMove(toParent: UIHostingController(rootView: self))
} label: {
HStack(alignment: .center, spacing: 0.0) {
ImageView(withURL: couponSetData?.img_preview ?? "", width: self.uiscreen.width * 0.5, isFill: true)
VStack(alignment: .leading, spacing: 5.0) {
Text(couponSetData?.name ?? "")
.fontWeight(.bold)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
.multilineTextAlignment(.leading)
.padding([.top,.horizontal], 15)
.background(Color.white)
Text(couponSetData?.short_description ?? "")
.fontWeight(.regular)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
.multilineTextAlignment(.leading)
.padding([.bottom,.horizontal], 15)
.background(Color.white)
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
.background(Color.white)
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
.background(Color.white)
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
.frame(width: self.uiscreen.width * 0.95, height: self.uiscreen.height * 0.17)
.background(Color.white)
.cornerRadius(5)
.shadow(color: Color(red: 0, green: 0, blue: 0, opacity: 0.16), radius: 6, x: 0, y: 3)
}
}
struct couponsContainer: View {
@State var coupons:Array<swiftApi.CouponItemModel> = []
@State var parentView:UIView
var uiscreen = UIScreen.main.bounds
var body: some View {
VStack(alignment: .center, spacing: self.uiscreen.height * 0.03) {
ForEach(Array(coupons.enumerated()), id: \.offset) { index, item in
giftItemView(item: item, parentView: parentView)
}
}
.frame(maxWidth: .infinity)
.padding(.top, self.uiscreen.height * 0.05)
.padding(.bottom, self.uiscreen.height * 0.1)
}
}
}
@available(iOS 13.0.0, *)
struct AllGiftsView: View {
var parentView: UIView
var coupons:Array<swiftApi.CouponItemModel> = []
var uiscreen = UIScreen.main.bounds
init(parentView: UIView) { //initializer method
let instanceOfMySwiftApi = swiftApi()
let couponsData = instanceOfMySwiftApi.getCoupons()
self.coupons = couponsData
self.parentView = parentView
}
func goBack(){
for subview in parentView.subviews {
if(subview.tag == 8) {
subview.removeFromSuperview()
}
}
}
var body: some View {
VStack {
headerView(goBack: goBack)
VStack {
ScrollView(showsIndicators: false) {
VStack {
if (coupons.count) > 0 {
couponsContainer(coupons: coupons, parentView: parentView )
}
}
.frame(width:self.uiscreen.width)
}
.cornerRadius(30, corners: [.topLeft])
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
}
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
.padding(.top, 5)
.background(
Image("coupons_scrollview", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
)
}
.edgesIgnoringSafeArea([.bottom])
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
}
}
#endif
//struct AllGiftsView_Previews: PreviewProvider {
// static var previews: some View {
// AllGiftsView()
// }
//}
//
// AllGiftsViewInterface.swift
// WarplySDKFrameworkIOS
//
// Created by Manos Chorianopoulos on 27/4/22.
//
import Foundation
import SwiftUI
@available(iOS 13.0.0, *)
@objc public class AllGiftsViewInterface : NSObject {
@objc(allGiftsViewController:) static public func allGiftsViewController(parentView: UIView?) -> UIViewController {
return UIHostingController(rootView: AllGiftsView(parentView: parentView!))
}
}
//
// CampaignWebview.swift
// WarplySDKFrameworkIOS
//
// Created by Manos Chorianopoulos on 20/4/22.
//
#if canImport(SwiftUI)
import SwiftUI
import Combine
import Foundation
import UIKit
import WebKit
extension CampaignWebview {
struct headerView: View {
var goBack: () -> ()
var uiscreen = UIScreen.main.bounds
var body: some View {
HStack(alignment: .center) {
Button {
// Button Action
print("Back Button tapped!")
goBack()
} label: {
Image("ic_back", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02)
}
Spacer().frame(width: 0)
Text("")
.fontWeight(.medium)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196))
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
.padding(.horizontal)
.offset(x: -self.uiscreen.height * 0.0125)
}
.frame(maxWidth: .infinity)
.padding(.horizontal)
.padding(.vertical, 10)
}
}
struct WebView: UIViewRepresentable {
var url: String
func makeUIView(context: Context) -> WKWebView {
return WKWebView()
}
func updateUIView(_ webView: WKWebView, context: Context) {
var request = URLRequest(url: URL(string: url)!)
request.cachePolicy = .reloadRevalidatingCacheData
webView.load(request)
}
}
}
@available(iOS 13.0.0, *)
struct CampaignWebview: View {
var parentView: UIView
var campaign: String
var uiscreen = UIScreen.main.bounds
func goBack(){
for subview in parentView.subviews {
if(subview.tag == 6) {
subview.removeFromSuperview()
}
}
}
var body: some View {
VStack {
headerView(goBack: goBack)
VStack {
WebView(url: campaign)
}
.background(
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)
)
.cornerRadius(30, corners: [.topLeft])
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
}
.edgesIgnoringSafeArea([.bottom])
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
}
}
#endif
//@available(iOS 13.0.0, *)
//struct CampaignWebview_Previews: PreviewProvider {
// static var previews: some View {
//
// CampaignWebview()
//
// }
//}
//
// CampaignWebviewInterface.swift
// WarplySDKFrameworkIOS
//
// Created by Manos Chorianopoulos on 20/4/22.
//
import Foundation
import SwiftUI
@available(iOS 13.0.0, *)
@objc public class CampaignViewInterface : NSObject {
@objc(campaignViewController::) static public func campaignViewController(parentView: UIView?, campaign: String?) -> UIViewController {
return UIHostingController(rootView: CampaignWebview(parentView: parentView!, campaign: campaign ?? ""))
}
}
//
// CouponBarcodeView.swift
// WarplySDKFrameworkIOS
//
// Created by Manos Chorianopoulos on 21/4/22.
//
#if canImport(SwiftUI)
import SwiftUI
import Combine
import Foundation
import UIKit
// TODO: Uncomment for barcode
import RSBarcodes_Swift
import AVFoundation
extension String {
var length: Int {
return count
}
subscript (i: Int) -> String {
return self[i ..< i + 1]
}
func substring(fromIndex: Int) -> String {
return self[min(fromIndex, length) ..< length]
}
func substring(toIndex: Int) -> String {
return self[0 ..< max(0, toIndex)]
}
subscript (r: Range<Int>) -> String {
let range = Range(uncheckedBounds: (lower: max(0, min(length, r.lowerBound)),
upper: min(length, max(0, r.upperBound))))
let start = index(startIndex, offsetBy: range.lowerBound)
let end = index(start, offsetBy: range.upperBound - range.lowerBound)
return String(self[start ..< end])
}
}
extension CouponBarcodeView {
struct headerView: View {
var goBack: () -> ()
var uiscreen = UIScreen.main.bounds
var body: some View {
HStack(alignment: .center) {
Button {
// Button Action
goBack()
} label: {
Image("ic_back", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02)
}
Spacer().frame(width: 0)
Text("Εκπτωτικό κουπόνι")
.fontWeight(.medium)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196))
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
.padding(.horizontal)
.offset(x: -self.uiscreen.height * 0.0125)
}
.frame(maxWidth: .infinity)
.padding(.horizontal)
.padding(.vertical, 10)
}
}
struct couponContainer: View {
@State var coupon: swiftApi.CouponItemModel
// @State var couponset:CouponSetItemModel
var uiscreen = UIScreen.main.bounds
static func convertDateFormat(inputDate: String) -> String {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd hh:mm:ss"
if let date = dateFormatter.date(from: inputDate) {
dateFormatter.dateFormat = "dd/MM/yyyy"
let resultString = dateFormatter.string(from: date)
return resultString
} else {
return ""
}
}
func constructBarcode() -> String? {
// EAN 13 barcode construction
let couponData = coupon.couponset_data
let couponString = coupon.coupon ?? ""
if (!couponString.isEmpty) {
var checkDigit = 0;
var result = 0;
var fixedCouponCode = couponString;
if (fixedCouponCode.count < 12) {
let loops = 12 - fixedCouponCode.count;
var zerosStr = "";
for i in 0 ..< loops {
zerosStr += "0"
}
fixedCouponCode = zerosStr + fixedCouponCode;
}
var multiplier = 3;
for idx in (0 ... (fixedCouponCode.count - 1)).reversed() {
let curChar = fixedCouponCode[idx];
result += (Int(curChar) ?? 0) * multiplier;
multiplier = multiplier == 3 ? 1 : 3;
}
checkDigit = 10 - (result % 10);
let barcodeStr = fixedCouponCode + String(checkDigit);
return barcodeStr;
}
return ""
}
var body: some View {
let couponData = coupon.couponset_data
let barcodeString = constructBarcode() ?? ""
GeometryReader { geometry in
ScrollView(showsIndicators: false) {
VStack(alignment: .leading) {
ImageView(withURL: couponData?.img_preview ?? "")
VStack(alignment: .leading) {
Text(coupon.name!)
.fontWeight(.bold)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
.multilineTextAlignment(.leading)
.padding(.horizontal)
.padding(.top, self.uiscreen.height * 0.04)
.frame(maxHeight: .infinity)
Text(couponData?.short_description! ?? "")
.fontWeight(.regular)
.font(.system(size: 14))
.foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
.multilineTextAlignment(.leading)
.padding(.horizontal)
.padding(.top, self.uiscreen.height * 0.02)
Text("Κωδικός Κουπονιού")
.fontWeight(.medium)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
.multilineTextAlignment(.center)
.padding(.top, self.uiscreen.height * 0.05)
.padding(.horizontal)
.frame(maxWidth: .infinity)
VStack(alignment: .center) {
VStack {
Text(coupon.coupon!)
.fontWeight(.bold)
.font(.system(size: 27))
.foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
.multilineTextAlignment(.center)
.padding(.horizontal)
.padding(.vertical, 10)
// .padding(.all)
}
.frame(width: self.uiscreen.width * 0.8)
.background(Color(red: 0.9333333333333333, green: 0.9686274509803922, blue: 1.0))
.cornerRadius(10)
}
.frame(maxWidth: .infinity)
if (CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: coupon.coupon ?? ""))) {
VStack(alignment: .center) {
VStack {}
.frame(height: 1)
.frame(width: self.uiscreen.width * 0.9)
.background(Color(red: 0.9019607843137255, green: 0.9019607843137255, blue: 0.9019607843137255))
}
.frame(maxWidth: .infinity)
.padding(.top, self.uiscreen.height * 0.015)
// let isValid = RSUnifiedCodeValidator.shared.isValid(barcodeString, machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue)
// TODO: Uncomment for barcode
if let barcodeImage = RSUnifiedCodeGenerator.shared.generateCode(barcodeString, machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue, targetSize: CGSize(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.1)) {
//
VStack(alignment: .center) {
Image(uiImage: barcodeImage)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.1)
}
.frame(maxWidth: .infinity)
.padding(.top, self.uiscreen.height * 0.01)
}
Text(barcodeString)
.fontWeight(.regular)
.font(.system(size: 22))
.foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
.multilineTextAlignment(.center)
.padding(.vertical, self.uiscreen.height * 0.01)
.padding(.horizontal)
.frame(maxWidth: .infinity)
VStack(alignment: .center) {
VStack {}
.frame(height: 1)
.frame(width: self.uiscreen.width * 0.9)
.background(Color(red: 0.9019607843137255, green: 0.9019607843137255, blue: 0.9019607843137255))
}
.frame(maxWidth: .infinity)
}
Text("Το κουπόνι ισχύει έως " + CouponBarcodeView.couponContainer.convertDateFormat(inputDate: couponData?.expiration ?? ""))
.fontWeight(.medium)
.font(.system(size: 14))
.foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
.multilineTextAlignment(.center)
.padding(.top, self.uiscreen.height * 0.03)
.padding(.horizontal)
.frame(maxWidth: .infinity)
}
.frame(width:self.uiscreen.width)
Spacer()
VStack(alignment: .center) {
Button {
// Button Action
print("Send Gift Button tapped!")
} label: {
HStack {
Text("Κάντο δώρο!")
.fontWeight(.medium)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.3137254901960784, green: 0.6196078431372549, blue: 0.1843137254901961))
.multilineTextAlignment(.center)
.padding(.all)
// TODO: Add gift icon
}
.frame(maxWidth: .infinity)
}
.frame(width: self.uiscreen.width * 0.8)
.background(Color(red: 0.9019607843137255, green: 0.9019607843137255, blue: 0.9019607843137255))
.cornerRadius(7)
}
.frame(maxWidth: .infinity)
.padding(.top, self.uiscreen.height * 0.05)
// VStack(alignment: .center) {
// Button {
// // Button Action
// print("Shops Map Button tapped!")
// } label: {
// HStack {
// Text("Χάρτης Καταστημάτων")
// .fontWeight(.medium)
// .font(.system(size: 16))
// .foregroundColor(Color.white)
// .multilineTextAlignment(.center)
// .padding(.all)
// }
// .frame(maxWidth: .infinity)
// }
// .frame(width: self.uiscreen.width * 0.8)
// .background(Color(red: 0.4745098039215686, green: 0.7490196078431373, blue: 0.0784313725490196))
// .cornerRadius(7)
// }
// .frame(maxWidth: .infinity)
// .padding(.top, self.uiscreen.height * 0.015)
Button {
// Button Action
print("Terms Button tapped!")
} label: {
Text("Όροι χρήσης")
.fontWeight(.medium)
.font(.system(size: 14))
.foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
.underline()
.multilineTextAlignment(.center)
.padding(.top, self.uiscreen.height * 0.025)
.padding(.bottom, self.uiscreen.height * 0.03)
.padding(.horizontal)
.frame(maxWidth: .infinity)
}
.frame(maxWidth: .infinity)
}
.frame(width:self.uiscreen.width)
// .frame(minHeight: geometry.size.height)
.padding(.bottom, self.uiscreen.height * 0.03)
}
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
}
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
}
}
struct ImageView: View {
@ObservedObject var imageLoader:UrlImageModel
var uiscreen = UIScreen.main.bounds
init(withURL url:String) {
imageLoader = UrlImageModel(urlString:url)
}
var body: some View {
Image(uiImage: imageLoader.image ?? UIImage())
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.25)
}
}
}
@available(iOS 13.0.0, *)
struct CouponBarcodeView: View {
var parentView: UIView
var coupon: swiftApi.CouponItemModel
@State var couponset: swiftApi.CouponSetItemModel?
var uiscreen = UIScreen.main.bounds
func goBack() {
for subview in parentView.subviews {
if(subview.tag == 7) {
subview.removeFromSuperview()
}
}
}
var body: some View {
VStack {
headerView(goBack: goBack)
VStack {
couponContainer(coupon: coupon)
}
.background(Color.white)
.cornerRadius(30, corners: [.topLeft])
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
}
.edgesIgnoringSafeArea([.bottom])
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
// .onAppear {
// // If you want to setup data with model
// couponset = CouponSetItemModel(dictionary: coupon)
//
// }
}
}
#endif
//struct CouponBarcodeView_Previews: PreviewProvider {
// static var previews: some View {
// CouponBarcodeView()
// }
//}
//
// CouponBarcodeViewInterface.swift
// WarplySDKFrameworkIOS
//
// Created by Manos Chorianopoulos on 21/4/22.
//
import Foundation
import SwiftUI
@available(iOS 13.0.0, *)
@objc public class CouponBarcodeViewInterface : NSObject {
// @objc(couponBarcodeViewController::) static public func couponBarcodeViewController(parentView: UIView?, coupon: Dictionary<String, Any>) -> UIViewController {
// return UIHostingController(rootView: CouponBarcodeView(parentView: parentView!, coupon: coupon))
// }
}
//
// CouponView.swift
// WarplySDKFrameworkIOS
//
// Created by Βασιλης Σκουρας on 21/4/22.
//
#if canImport(SwiftUI)
import SwiftUI
import Combine
import Foundation
import UIKit
extension CouponView {
struct headerView: View {
var goBack: () -> ()
var uiscreen = UIScreen.main.bounds
var body: some View {
HStack(alignment: .center) {
Button {
// Button Action
goBack()
} label: {
Image("ic_back", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02)
}
Spacer().frame(width: 0)
Text("Εκπτωτικό κουπόνι")
.fontWeight(.medium)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196))
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
.padding(.horizontal)
.offset(x: -self.uiscreen.height * 0.0125)
}
.frame(maxWidth: .infinity)
.padding(.horizontal)
.padding(.vertical, 10)
}
}
struct couponContainer: View {
@State var coupon: swiftApi.CouponSetItemModel
// @State var couponset:CouponSetItemModel
var uiscreen = UIScreen.main.bounds
var body: some View {
GeometryReader { geometry in
ScrollView(showsIndicators: false) {
VStack(alignment: .leading) {
ImageView(withURL: coupon.img_preview as? String ?? "")
Text(coupon.name as? String ?? "")
.fontWeight(.bold)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
.multilineTextAlignment(.leading)
.padding(.horizontal)
.padding(.top, self.uiscreen.height * 0.04)
Text(coupon.short_description as? String ?? "")
.fontWeight(.regular)
.font(.system(size: 14))
.foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
.multilineTextAlignment(.leading)
.padding(.horizontal)
.padding(.top, self.uiscreen.height * 0.02)
Spacer()
VStack(alignment: .center) {
Button {
// Button Action
print("Back Button tapped!")
} label: {
HStack {
Text("Απόκτησέ το")
.fontWeight(.medium)
.font(.system(size: 16))
.foregroundColor(Color.white)
.multilineTextAlignment(.center)
.padding(.all)
}
}
.frame(width: self.uiscreen.width * 0.8)
.background(Color(red: 0.4745098039215686, green: 0.7490196078431373, blue: 0.0784313725490196))
.cornerRadius(7)
}
.frame(maxWidth: .infinity)
.padding(.top, self.uiscreen.height * 0.06)
Button {
// Button Action
print("Terms Button tapped!")
} label: {
Text("Όροι χρήσης")
.fontWeight(.medium)
.font(.system(size: 14))
.foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
.underline()
.multilineTextAlignment(.center)
.padding(.vertical, self.uiscreen.height * 0.03)
.padding(.horizontal)
.frame(maxWidth: .infinity)
}
.frame(maxWidth: .infinity)
}
.frame(width:self.uiscreen.width)
.frame(minHeight: geometry.size.height)
.padding(.bottom, self.uiscreen.height * 0.03)
}
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
}
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
}
}
struct ImageView: View {
@ObservedObject var imageLoader:UrlImageModel
var uiscreen = UIScreen.main.bounds
init(withURL url:String) {
imageLoader = UrlImageModel(urlString:url)
}
var body: some View {
Image(uiImage: imageLoader.image ?? UIImage())
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.25)
}
}
}
@available(iOS 13.0.0, *)
struct CouponView: View {
var parentView: UIView
var coupon: swiftApi.CouponSetItemModel
@State var couponset: swiftApi.CouponSetItemModel?
var uiscreen = UIScreen.main.bounds
func goBack() {
for subview in parentView.subviews {
if(subview.tag == 2) {
subview.removeFromSuperview()
}
}
}
var body: some View {
VStack {
headerView(goBack: goBack)
VStack {
couponContainer(coupon: coupon)
}
.background(Color.white)
.cornerRadius(30, corners: [.topLeft])
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
}
.edgesIgnoringSafeArea([.bottom])
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
// .onAppear {
// // If you want to setup data with model
// couponset = CouponSetItemModel(dictionary: coupon)
//
// }
}
}
#endif
//struct CouponView_Previews: PreviewProvider {
// static var previews: some View {
// CouponView()
// }
//}
//
// CouponViewInterface.swift
// WarplySDKFrameworkIOS
//
// Created by Βασιλης Σκουρας on 21/4/22.
//
import Foundation
import SwiftUI
@available(iOS 13.0.0, *)
@objc public class CouponViewInterface : NSObject {
// @objc(couponViewController::) static public func couponViewController(parentView: UIView?, coupon: Dictionary<String, Any>) -> UIViewController {
// return UIHostingController(rootView: CouponView(parentView: parentView!, coupon: coupon))
// }
}
//
// ProfileView.swift
// warplyFramework
//
// Created by Βασιλης Σκουρας on 13/1/22.
//
#if canImport(SwiftUI)
import SwiftUI
import Combine
import Foundation
import UIKit
class DataModel {
var data: Array<NSDictionary> = []
var data2: Array<swiftApi.CouponItemModel> = []
init() { //initializer method
let instanceOfMySwiftApi = swiftApi()
let couponsData = instanceOfMySwiftApi.getCoupons()
self.data2 = couponsData
let instanceOfMyApi = MyApi()
let couponSets = instanceOfMyApi.getCouponSets(withActive: true, andVisible: true, andUuids: nil)
let coupons = instanceOfMyApi.getCoupons() as AnyObject?
if let myCouponsSetsDictionary = couponSets as? [String : AnyObject] {
let couponSetsData = (myCouponsSetsDictionary["MAPP_COUPON"] as! Array<NSMutableDictionary>)
if let myCouponsDictionary = coupons as? [String : AnyObject] {
let couponsData = (myCouponsDictionary["result"] as! Array<NSMutableDictionary>)
if let sets = couponSetsData as? NSArray {
for set in sets {
let s = set as! NSDictionary
if let cpns = couponsData as? NSArray {
for coupon in cpns {
var c = coupon as! NSDictionary
// var temp = NSMutableDictionary(dictionary: s);
if c["couponset_uuid"] as! String == s["uuid"] as! String {
var temp = NSMutableDictionary(dictionary: s);
// temp.addEntries(from: c as! [AnyHashable : Any])
temp.setValue(c as! [AnyHashable : Any],forKey: "coupon_data")
self.data.append(temp as NSDictionary)
}
}
}
}
}
}
}
}
var getData2: Array<swiftApi.CouponItemModel> {
get { // getter
return data2
}
}
var getData: Array<NSDictionary> {
get { // getter
return data.filter({
let couponData = $0["coupon_data"] as? [String: Any] ?? ["":""]
return couponData["status"] as? Int == 1
})
}
}
var getOldCoupons: Array<NSDictionary> {
get { // getter
return data.filter({
let couponData = $0["coupon_data"] as? [String: Any] ?? ["":""]
return couponData["status"] as? Int != 1
})
}
}
}
class ImageLoader: ObservableObject {
var didChange = PassthroughSubject<Data, Never>()
var data = Data() {
didSet {
didChange.send(data)
}
}
init(urlString:String) {
guard let url = URL(string: urlString) else { return }
let task = URLSession.shared.dataTask(with: url) { data, response, error in
guard let data = data else { return }
DispatchQueue.main.async {
self.data = data
}
}
task.resume()
}
}
struct ImageView: View {
@ObservedObject var imageLoader:ImageLoader
@State var image:UIImage = UIImage()
init(withURL url:String) {
imageLoader = ImageLoader(urlString:url)
}
var body: some View {
Image(uiImage: image)
.resizable()
.aspectRatio(contentMode: .fit)
.onReceive(imageLoader.didChange) { data in
self.image = UIImage(data: data) ?? UIImage()
}
}
}
struct VLine: Shape {
func path(in rect: CGRect) -> Path {
Path { path in
path.move(to: CGPoint(x: rect.midX, y: rect.minY))
path.addLine(to: CGPoint(x: rect.midX, y: rect.maxY))
}
}
}
extension CouponsView {
struct headerView: View {
var goBack: () -> ()
var uiscreen = UIScreen.main.bounds
var body: some View {
HStack(alignment: .center) {
Button {
// Button Action
goBack()
} label: {
Image("ic_back", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02)
}
Spacer().frame(width: 0)
Text("Όλα τα κουπόνια μου")
.fontWeight(.medium)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196))
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
.padding(.horizontal)
.offset(x: -self.uiscreen.height * 0.0125)
}
.frame(maxWidth: .infinity)
.padding(.horizontal)
.padding(.vertical, 10)
}
}
struct couponView: View {
var result: swiftApi.CouponItemModel
var index: Int
var parentView: UIView
var uiscreen = UIScreen.main.bounds
static func localizedWithParameter(parameter: String) -> LocalizedStringKey {
return "\(parameter)"
}
static func convertDateFormat(inputDate: String) -> String {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd hh:mm:ss"
if let date = dateFormatter.date(from: inputDate) {
dateFormatter.dateFormat = "dd/MM/yyyy"
let resultString = dateFormatter.string(from: date)
return resultString
} else {
return ""
}
}
var body: some View {
// let couponData = result["coupon_data"] as? [String: Any] ?? ["":""]
let couponSetData = result.couponset_data
VStack(alignment: .leading) {
Button {
// GiftItem Action
let instanceOfMySwiftApi = swiftApi()
let couponBarcodeViewController = instanceOfMySwiftApi.openCouponBarcode(parent: parentView, coupon: result)
couponBarcodeViewController.view.tag = 7
// addChild(couponsViewController)
couponBarcodeViewController.view.frame = parentView.frame
parentView.addSubview(couponBarcodeViewController.view)
// couponBarcodeViewController.didMove(toParent: UIHostingController(rootView: self))
} label: {
HStack(alignment: .center) {
ImageView(withURL: couponSetData?.img_preview ?? "")
.frame(maxWidth: self.uiscreen.width * 0.15)
.padding(.leading , self.uiscreen.width * 0.055)
VLine()
.stroke(style: StrokeStyle(lineWidth: 1, dash: [5]))
.foregroundColor(Color(red: 0.4392156862745098, green: 0.4392156862745098, blue: 0.4392156862745098))
.frame(width: 1)
.padding(.leading, self.uiscreen.width * 0.01)
.padding(.top, self.uiscreen.height * 0.01)
.padding(.bottom, self.uiscreen.height * 0.0075)
Spacer()
VStack {
Text(CouponsView.couponView.localizedWithParameter(parameter: couponSetData?.name ?? ""))
.fontWeight(.medium)
.foregroundColor(Color(red: 0.22745098039215686, green: 0.3215686274509804, blue: 0.4))
.frame(maxWidth: self.uiscreen.width * 0.35, maxHeight: .infinity, alignment: .leading)
.font(.system(size: 15))
Text(CouponsView.couponView.localizedWithParameter(parameter: result.discount ?? ""))
.fontWeight(.bold)
.foregroundColor(Color(red: 0.22745098039215686, green: 0.3215686274509804, blue: 0.4))
.frame(maxWidth: self.uiscreen.width * 0.35, maxHeight: self.uiscreen.height * 0.05, alignment: .leading)
.font(.system(size: 47))
Text(CouponsView.couponView.localizedWithParameter(parameter: "Ισχύει εώς " + (result.expiration ?? "")))
.fontWeight(.medium)
.foregroundColor(Color(red: 0.3803921568627451, green: 0.44313725490196076, blue: 0.5058823529411764))
.frame(maxWidth: self.uiscreen.width * 0.35, maxHeight: .infinity, alignment: .leading)
.font(.system(size: 10))
}
.frame(maxHeight: .infinity)
.padding(.top, self.uiscreen.height * 0.03)
.padding(.bottom, self.uiscreen.height * 0.03)
VStack {
Text(CouponsView.couponView.localizedWithParameter(parameter: couponSetData?.short_description ?? ""))
.fontWeight(.medium)
.foregroundColor(Color(red: 0.3803921568627451, green: 0.44313725490196076, blue: 0.5058823529411764))
.frame(maxWidth: self.uiscreen.width * 0.22, maxHeight: self.uiscreen.height * 0.10)
.font(.system(size: 10))
}
.frame(maxWidth: self.uiscreen.width * 0.25, maxHeight: .infinity)
Spacer()
}
}
}
.frame(width: self.uiscreen.width * 0.95, height: self.uiscreen.height * 0.13)
.background(
Image("coupons_container", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
)
.padding(.bottom, self.uiscreen.height * 0.03)
}
}
}
@available(iOS 13.0.0, *)
struct CouponsView: View {
var data:Array<swiftApi.CouponItemModel> = []
// var data:Array<swiftApi.CouponItemModel> = DataModel().getData2
var parentView: UIView
var uiscreen = UIScreen.main.bounds
init(parentView: UIView) { //initializer method
let instanceOfMySwiftApi = swiftApi()
let couponsData = instanceOfMySwiftApi.getCoupons()
self.data = couponsData
self.parentView = parentView
}
func goBack(){
for subview in parentView.subviews {
if(subview.tag == 1) {
subview.removeFromSuperview()
}
}
}
var body: some View {
VStack {
headerView(goBack: goBack)
ScrollView(showsIndicators: false) {
VStack {
if (data.count) > 0 {
ForEach(Array(zip(data.indices, data)), id: \.0) { index, result in
couponView(result: result, index: index, parentView: parentView)
}
}
}
.padding(.top, self.uiscreen.height * 0.05)
}
.frame(maxWidth: .infinity, maxHeight: .infinity )
.background(
Image("coupons_scrollview", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
)
}
.frame(maxWidth: .infinity, maxHeight: .infinity )
// .frame(width:self.uiscreen.width, height:self.uiscreen.height )
}
}
#endif
@available(iOS 13.0.0, *)
struct Previews_CouponsView_Previews: PreviewProvider {
static var uiscreen = UIScreen.main.bounds
static var previews: some View {
ZStack {
Image("ic_back", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02)
.offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.05, y: self.uiscreen.height * 0.07)
Text("Όλα τα κουπόνια μου")
.frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.025, alignment: .center)
.offset( y: self.uiscreen.height * 0.07)
}
}
}
//
// ProfileViewController.swift
// warplyFramework
//
// Created by Βασιλης Σκουρας on 14/1/22.
//
import Foundation
import SwiftUI
@available(iOS 13.0.0, *)
@objc public class CouponsViewInterface : NSObject {
@objc(couponsViewController:) static public func couponsViewController(parentView: UIView?) -> UIViewController {
return UIHostingController(rootView: CouponsView(parentView: parentView!))
}
}
//
// DetailsView.swift
// WarplySDKFrameworkIOS
//
// Created by Manos Chorianopoulos on 3/5/22.
//
#if canImport(SwiftUI)
import SwiftUI
import Combine
import Foundation
import UIKit
extension DetailsView {
struct headerView: View {
var goBack: () -> ()
var uiscreen = UIScreen.main.bounds
var body: some View {
HStack(alignment: .center) {
Button {
// Button Action
print("Back Button tapped!")
goBack()
} label: {
Image("ic_back", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02)
}
Text("Ανάλυση")
.fontWeight(.medium)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196))
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
.padding(.horizontal)
.offset(x: -self.uiscreen.height * 0.025)
}
.frame(maxWidth: .infinity)
.padding(.horizontal)
.padding(.vertical, 10)
}
}
struct Tabs: View {
@Binding var tabs: [String] // The tab titles
@Binding var selection: Int // Currently selected tab
let uiscreen = UIScreen.main.bounds
var body: some View {
// Pack the tabs horizontally and allow them to be scrolled
// GeometryReader { geometry in
// ScrollView(.horizontal, showsIndicators: false) {
HStack(alignment: .center, spacing: self.uiscreen.width * 0.05) {
ForEach(tabs, id: \.self) {
self.tab(title: $0)
}
}
.padding(.horizontal, self.uiscreen.width * 0.1)
.frame(maxWidth: .infinity)
.padding(.vertical, 5)
// .frame(minWidth: geometry.size.width)
// }
// .frame(maxWidth: .infinity)
// }
// .frame(maxWidth: .infinity)
// }
}
private func tab(title: String) -> some View {
let index = self.tabs.firstIndex(of: title)!
let isSelected = index == selection
return Button (action: {
// // Allows for animated transitions of the underline,
// // as well as other views on the same screen
withAnimation {
self.selection = index
}
}) {
VStack(alignment: .center, spacing: 5.0) {
Text(title)
.font(.system(size: 16))
.fontWeight(.medium)
.foregroundColor(isSelected ? Color(red: 0.1803921568627451, green: 0.6980392156862745, blue: 0.7254901960784313) : Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196))
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
VStack {}
.frame(height: 3)
.frame(width: uiscreen.width * 0.2)
.foregroundColor(.clear)
.background(isSelected ?
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: .leading, endPoint: .trailing)
: LinearGradient(gradient: Gradient(colors: [.clear, .clear]), startPoint: .leading, endPoint: .trailing)
)
.cornerRadius(20)
}
.frame(maxWidth: .infinity)
}
.frame(maxWidth: .infinity)
}
}
struct ImageView: View {
@ObservedObject var imageLoader:UrlImageModel
@State var width:CGFloat
@State var isFill:Bool
var uiscreen = UIScreen.main.bounds
init(withURL url:String , width:CGFloat, isFill:Bool) {
imageLoader = UrlImageModel(urlString:url)
self.width = width
self.isFill = isFill
}
var body: some View {
Image(uiImage: imageLoader.image ?? UIImage())
.resizable()
.aspectRatio(contentMode: isFill ? .fill : .fit)
.frame(width: self.width)
.frame(maxHeight: .infinity)
}
}
struct DropdownOption: Hashable {
let key: String
let value: String
public static func == (lhs: DropdownOption, rhs: DropdownOption) -> Bool {
return lhs.key == rhs.key
}
}
struct DropdownRow: View {
var option: DropdownOption
var onOptionSelected: ((_ option: DropdownOption) -> Void)?
var body: some View {
Button(action: {
if let onOptionSelected = self.onOptionSelected {
onOptionSelected(self.option)
}
}) {
HStack {
Text(self.option.value)
.font(.system(size: 14))
.fontWeight(.regular)
.foregroundColor(Color(red: 0.23529411764705882, green: 0.23137254901960785, blue: 0.2823529411764706))
Spacer()
}
}
.padding(.horizontal, 16)
.padding(.vertical, 5)
}
}
struct Dropdown: View {
var options: [DropdownOption]
var onOptionSelected: ((_ option: DropdownOption) -> Void)?
var backColor: Color
var body: some View {
ScrollView {
VStack(alignment: .leading, spacing: 0) {
ForEach(self.options, id: \.self) { option in
DropdownRow(option: option, onOptionSelected: self.onOptionSelected)
}
}
}
.frame(minHeight: CGFloat(options.count) * 30, maxHeight: 250)
.padding(.vertical, 5)
.background(self.backColor)
.cornerRadius(8)
}
}
struct DropdownSelector: View {
@State private var shouldShowDropdown = false
@State private var selectedOption: DropdownOption? = nil
// var placeholder: String
var options: [DropdownOption]
var onOptionSelected: ((_ option: DropdownOption) -> Void)?
var backColor: Color
private let buttonHeight: CGFloat = 50
init(options: [DropdownOption], onOptionSelected: ((_ option: DropdownOption) -> Void)?, backColor: Color) {
self.selectedOption = options[0]
self.options = options
self.onOptionSelected = onOptionSelected
self.backColor = backColor
}
var body: some View {
Button(action: {
self.shouldShowDropdown.toggle()
}) {
HStack {
// Text(selectedOption == nil ? placeholder : selectedOption!.value)
Text(selectedOption?.value ?? "")
.font(.system(size: 14))
.fontWeight(.bold)
.foregroundColor(Color(red: 0.23529411764705882, green: 0.23137254901960785, blue: 0.2823529411764706))
// .foregroundColor(selectedOption == nil ? Color.gray: Color.black)
Spacer()
Image((self.shouldShowDropdown ? "ic_up" : "ic_down"), bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 15, height: 10)
}
}
.padding(.horizontal)
.cornerRadius(5)
.frame(height: self.buttonHeight)
.frame(maxWidth: .infinity)
.overlay(
VStack {
if self.shouldShowDropdown {
Spacer(minLength: buttonHeight + 10)
Dropdown(
options: self.options,
onOptionSelected: { option in
shouldShowDropdown = false
selectedOption = option
self.onOptionSelected?(option)
},
backColor: self.backColor
)
}
}, alignment: .topLeading
)
.background(
RoundedRectangle(cornerRadius: 8).fill(self.backColor)
)
}
}
//MARK:- Chart Data
struct ChartData: Identifiable {
var id = UUID()
var color : Color
var percent : CGFloat
var value : CGFloat
var title : String
var image : String
}
class ChartDataContainer : ObservableObject {
@Published var chartData: Array<ChartData>
init(chartData: Array<ChartData>) {
self.chartData = chartData
calc()
}
func calc(){
var value : CGFloat = 0
for i in 0..<chartData.count {
value += chartData[i].percent
chartData[i].value = value
}
}
}
//MARK:- Donut Graph
struct DonutChart : View {
@ObservedObject var charDataObj: ChartDataContainer
// @State var indexOfTappedSlice = -1
var uiscreen = UIScreen.main.bounds
init (charDataObj: ChartDataContainer) {
self.charDataObj = charDataObj
}
var body: some View {
VStack {
ZStack {
ForEach(Array(charDataObj.chartData.enumerated()), id: \.offset) { index, item in
Circle()
.trim(from: index == 0 ? 0.0 : charDataObj.chartData[index-1].value/100,
to: charDataObj.chartData[index].value/100)
.stroke(charDataObj.chartData[index].color,lineWidth: 12)
// .onTapGesture {
// indexOfTappedSlice = indexOfTappedSlice == index ? -1 : index
// }
// .scaleEffect(index == indexOfTappedSlice ? 1.1 : 1.0)
.animation(.spring())
}
Image("ic_cosmote_logo", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: self.uiscreen.width * 0.3, height: self.uiscreen.height * 0.04)
// if indexOfTappedSlice != -1 {
// Text(String(format: "%.2f", Double(charDataObj.chartData[indexOfTappedSlice].percent))+"%")
// .font(.title)
// }
}
.frame(width: self.uiscreen.width * 0.5, height: self.uiscreen.width * 0.5)
.padding()
.onAppear() {
self.charDataObj.calc()
}
}
}
}
}
@available(iOS 13.0.0, *)
struct DetailsView: View {
var parentView: UIView
var coupons:Array<swiftApi.CouponItemModel> = []
var uiscreen = UIScreen.main.bounds
@State private var selectedTab = 0
@State private var selectedCouponOption: DropdownOption? = couponOptions[0]
@State private var selectedRedeemOption: DropdownOption? = redeemOptions[0]
let couponsChartData: Array<ChartData> = [
ChartData(color: Color(red: 0.57, green: 0.82, blue: 0.02), percent: 60, value: 0, title: "Διασκέδαση", image: "ic_smile"),
ChartData(color: Color(red: 0.24, green: 0.32, blue: 0.40), percent: 22, value: 0, title: "Supermarket", image: "ic_cart"),
ChartData(color: Color(red: 0.14, green: 0.66, blue: 0.71), percent: 18, value: 0, title: "Ταξίδια", image: "ic_plane")
]
let giftsChartData: Array<ChartData> = [
ChartData(color: Color(red: 0.57, green: 0.82, blue: 0.02), percent: 50, value: 0, title: "Δώρο Γενεθλίων", image: "ic_gift"),
ChartData(color: Color(red: 0.24, green: 0.32, blue: 0.40), percent: 50, value: 0, title: "Safe driving", image: "ic_steering_wheel")
]
@State var charDataObj: ChartDataContainer
static var uniqueKey: String {
UUID().uuidString
}
static let couponOptions: [DropdownOption] = [
DropdownOption(key: uniqueKey, value: "Κουπόνια"),
DropdownOption(key: uniqueKey, value: "Δώρα"),
]
static let redeemOptions: [DropdownOption] = [
DropdownOption(key: uniqueKey, value: "Εξαργύρωση"),
DropdownOption(key: uniqueKey, value: "Συλλογή"),
]
init(parentView: UIView) { //initializer method
let instanceOfMySwiftApi = swiftApi()
let couponsData = instanceOfMySwiftApi.getCoupons()
self.coupons = couponsData
self.parentView = parentView
self.charDataObj = ChartDataContainer(chartData: couponsChartData)
}
func goBack(){
for subview in parentView.subviews {
if(subview.tag == 10) {
subview.removeFromSuperview()
}
}
}
var body: some View {
VStack {
headerView(goBack: goBack)
Tabs(tabs: .constant(["Μηνιαία", "6Μηνο", "12Μηνο"]),
selection: $selectedTab)
VStack {
GeometryReader { geometry in
ScrollView(showsIndicators: false) {
VStack {
VStack {
DropdownSelector(
// placeholder: "Δώρα",
options: DetailsView.couponOptions,
onOptionSelected: { option in
print(option)
selectedCouponOption = option
if (option == DetailsView.couponOptions[0]) {
self.charDataObj = ChartDataContainer(chartData: couponsChartData)
} else {
self.charDataObj = ChartDataContainer(chartData: giftsChartData)
}
},
backColor: Color(red: 0.9607843137254902, green: 0.9607843137254902, blue: 0.9607843137254902)
)
.padding(.horizontal, 25)
.padding(.top, self.uiscreen.height * 0.02)
.zIndex(2)
DonutChart(charDataObj: self.charDataObj)
.padding(.vertical, self.uiscreen.height * 0.03)
DropdownSelector(
// placeholder: "Δώρα",
options: DetailsView.redeemOptions,
onOptionSelected: { option in
selectedRedeemOption = option
},
backColor: Color(red: 0.9333333333333333, green: 0.9686274509803922, blue: 1.0)
)
.padding(.horizontal, 25)
.zIndex(1)
VStack {
VStack(spacing: self.uiscreen.width * 0.06) {
ForEach(Array(charDataObj.chartData.enumerated()), id: \.offset) { index, item in
HStack {
Image(charDataObj.chartData[index].image, bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: self.uiscreen.height * 0.02, height: self.uiscreen.height * 0.02)
Text(charDataObj.chartData[index].title)
.fontWeight(.medium)
.font(.system(size: 14))
.foregroundColor(Color(red: 0.30196078431372547, green: 0.2980392156862745, blue: 0.34509803921568627))
.padding(.horizontal)
Spacer()
// Text(String(format: "%.2f", Double(charDataObj.chartData[index].percent))+"%")
Text(String(format: "%.0f", Double(charDataObj.chartData[index].percent))+"%")
.fontWeight(.medium)
.font(.system(size: 16))
.foregroundColor(charDataObj.chartData[index].color)
}
.frame(maxWidth: .infinity)
}
}
.padding(.all, self.uiscreen.width * 0.06)
.frame(maxWidth: .infinity)
}
.frame(width:self.uiscreen.width * 0.86)
// .frame(maxHeight: .infinity)
.background(Color(red: 0.9490196078431372, green: 0.9490196078431372, blue: 0.9490196078431372, opacity: 0.49))
.cornerRadius(10)
.padding(.top, self.uiscreen.height * 0.04)
Spacer()
VStack(alignment: .center) {
Button {
// Button Action
print("More Details Button tapped!")
} label: {
HStack {
Text("Αναλυτικά")
.fontWeight(.medium)
.font(.system(size: 16))
.foregroundColor(Color.white)
.multilineTextAlignment(.center)
.padding(.all)
}
.frame(maxWidth: .infinity)
}
.frame(width: self.uiscreen.width * 0.8)
.background(Color(red: 0.4745098039215686, green: 0.7490196078431373, blue: 0.0784313725490196))
.cornerRadius(7)
}
.frame(maxWidth: .infinity)
.padding(.top, self.uiscreen.height * 0.04)
.padding(.bottom, self.uiscreen.height * 0.02)
// .padding(.horizontal, 25)
}
.frame(width:self.uiscreen.width * 0.93)
.frame(maxHeight: .infinity)
.background(Color.white)
.cornerRadius(10)
}
.padding(.vertical, self.uiscreen.height * 0.02)
.frame(minHeight: geometry.size.height)
// .frame(maxHeight: .infinity)
}
.cornerRadius(10, corners: [.topLeft])
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
}
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
}
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
.padding(.top, 5)
.background(
Image("coupons_scrollview", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
)
}
.edgesIgnoringSafeArea([.bottom])
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
}
}
#endif
//struct DetailsView_Previews: PreviewProvider {
// static var previews: some View {
// DetailsView()
// }
//}
//
// DetailsViewInterface.swift
// WarplySDKFrameworkIOS
//
// Created by Manos Chorianopoulos on 3/5/22.
//
import Foundation
import SwiftUI
@available(iOS 13.0.0, *)
@objc public class DetailsViewInterface : NSObject {
@objc(detailsViewController:) static public func detailsViewController(parentView: UIView?) -> UIViewController {
return UIHostingController(rootView: DetailsView(parentView: parentView!))
}
}
//
// GiftsView.swift
// WarplySDKFrameworkIOS
//
// Created by Manos Chorianopoulos on 18/4/22.
//
#if canImport(SwiftUI)
import SwiftUI
import Combine
import Foundation
import UIKit
extension String {
func htmlToString() -> String {
return try! NSAttributedString(data: self.data(using: .utf8)!,
options: [.documentType: NSAttributedString.DocumentType.html],
documentAttributes: nil).string
}
}
extension View {
func cornerRadius(_ radius: CGFloat, corners: UIRectCorner) -> some View {
clipShape( RoundedCorner(radius: radius, corners: corners) )
}
}
struct RoundedCorner: Shape {
var radius: CGFloat = .infinity
var corners: UIRectCorner = .allCorners
func path(in rect: CGRect) -> Path {
let path = UIBezierPath(roundedRect: rect, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
return Path(path.cgPath)
}
}
class UrlImageModel: ObservableObject {
@Published var image: UIImage?
var urlString: String?
var imageCache = ImageCache.getImageCache()
func loadImage() {
if loadImageFromCache() {
print("Cache hit")
return
}
print("Cache miss, loading from url")
loadImageFromUrl()
}
func loadImageFromCache() -> Bool {
guard let urlString = urlString else {
return false
}
guard let cacheImage = imageCache.get(forKey: urlString) else {
return false
}
image = cacheImage
return true
}
func loadImageFromUrl() {
guard let urlString = urlString else {
return
}
let url = URL(string: urlString)!
let task = URLSession.shared.dataTask(with: url, completionHandler: getImageFromResponse(data:response:error:))
task.resume()
}
func getImageFromResponse(data: Data?, response: URLResponse?, error: Error?) {
guard error == nil else {
print("Error: \(error!)")
return
}
guard let data = data else {
print("No data found")
return
}
DispatchQueue.main.async {
guard let loadedImage = UIImage(data: data) else {
return
}
self.imageCache.set(forKey: self.urlString!, image: loadedImage)
self.image = loadedImage
}
}
init(urlString:String) {
self.urlString = urlString
loadImage()
}
}
class ImageCache {
var cache = NSCache<NSString, UIImage>()
func get(forKey: String) -> UIImage? {
return cache.object(forKey: NSString(string: forKey))
}
func set(forKey: String, image: UIImage) {
cache.setObject(image, forKey: NSString(string: forKey))
}
}
extension ImageCache {
private static var imageCache = ImageCache()
static func getImageCache() -> ImageCache {
return imageCache
}
}
extension GiftsView {
struct headerView: View {
var goBack: () -> ()
var uiscreen = UIScreen.main.bounds
var body: some View {
HStack(alignment: .center) {
Button {
// Button Action
print("Back Button tapped!")
goBack()
} label: {
Image("ic_back", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02)
}
Text("Gifts for You")
.fontWeight(.medium)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196))
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
.padding(.horizontal)
Button {
// Button Action
print("Location tapped!")
} label: {
Image("location_icon", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: self.uiscreen.height * 0.04, height: self.uiscreen.height * 0.04)
}
}
.frame(maxWidth: .infinity)
.padding(.horizontal)
.padding(.vertical, 10)
}
}
struct searchView: View {
@State var searchText: String = ""
var uiscreen = UIScreen.main.bounds
var body: some View {
HStack(alignment: .center) {
HStack(alignment: .center) {
Image("search_icon", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.025)
.padding([.top, .leading, .bottom], 10)
TextField("Βρες το gift που σε ενδιαφέρει", text: $searchText)
.frame(maxWidth: .infinity)
.padding(.all, 10)
.foregroundColor(Color(red: 0.48627450980392156, green: 0.48627450980392156, blue: 0.48627450980392156))
.font(.system(size: 16, weight: .regular, design: .default))
}
.overlay(
RoundedRectangle(cornerRadius: 9)
.stroke(Color(red: 0.8235294117647058, green: 0.8235294117647058, blue: 0.8235294117647058), lineWidth: 1)
)
Button {
// Button Action
print("Filters tapped!")
} label: {
Image("filters_btn", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: self.uiscreen.height * 0.06, height: self.uiscreen.height * 0.04)
.padding(.leading, 5)
}
}
.frame(maxWidth: .infinity)
.padding(.horizontal, 20)
.padding(.vertical, 5)
}
}
struct ImageView: View {
@ObservedObject var imageLoader:UrlImageModel
@State var width:CGFloat
@State var isFill:Bool
var uiscreen = UIScreen.main.bounds
init(withURL url:String , width:CGFloat, isFill:Bool) {
imageLoader = UrlImageModel(urlString:url)
self.width = width
self.isFill = isFill
}
var body: some View {
Image(uiImage: imageLoader.image ?? UIImage())
.resizable()
.aspectRatio(contentMode: isFill ? .fill : .fit)
.frame(width: self.width)
.frame(maxHeight: .infinity)
}
}
struct giftItemView: View {
var item: swiftApi.CampaignItemModel
var isFirst: Bool
var isLast: Bool
var parentView: UIView
var uiscreen = UIScreen.main.bounds
var body: some View {
Button {
// GiftItem Action
let instanceOfMyApi = MyApi()
let campaignViewController = instanceOfMyApi.openCampaign(parentView, campaign: item.index_url)!
campaignViewController.view.tag = 6
// addChild(couponsViewController)
campaignViewController.view.frame = parentView.frame
parentView.addSubview(campaignViewController.view)
// campaignViewController.didMove(toParent: UIHostingController(rootView: self))
} label: {
HStack(alignment: .center) {
ImageView(withURL: item.logo_url ?? "", width: self.uiscreen.width * 0.5, isFill: true)
Text(item.title ?? "")
.fontWeight(.regular)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.22745098039215686, green: 0.3215686274509804, blue: 0.4))
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.padding(.all, 10)
.background(Color.white)
}
}
.frame(width: self.uiscreen.width * 0.9, height: self.uiscreen.height * 0.16)
.background(Color.white)
.cornerRadius(5)
.shadow(color: Color(red: 0, green: 0, blue: 0, opacity: 0.16), radius: 30, x: 0, y: 3)
.padding(.leading, isFirst ? 18 : 0)
.padding(.trailing, isLast ? 18 : 0)
}
}
struct giftsContainer: View {
@State var gifts:Array<swiftApi.CampaignItemModel> = []
@State var title:String = ""
@State var parentView:UIView
var uiscreen = UIScreen.main.bounds
var body: some View {
VStack(alignment: .leading) {
Text(title)
.fontWeight(.bold)
.font(.system(size: 17))
.foregroundColor(Color.white)
.multilineTextAlignment(.leading)
.padding(.horizontal)
.padding(.top, self.uiscreen.height * 0.05)
.padding(.bottom, self.uiscreen.height * 0.015)
ScrollView(.horizontal, showsIndicators: false) {
HStack(alignment: .center) {
ForEach(Array(gifts.enumerated()), id: \.offset) { index, item in
giftItemView(item: item, isFirst: index == 0, isLast: index == (gifts.count-1), parentView: parentView)
}
}
.frame(maxWidth: .infinity)
}
.frame(maxWidth: .infinity)
}
.frame(maxWidth: .infinity)
}
}
struct couponsContainer: View {
@State var coupons:Array<swiftApi.CouponSetItemModel> = []
@State var title:String = ""
@State var parentView:UIView
var uiscreen = UIScreen.main.bounds
var body: some View {
VStack(alignment: .leading) {
Text(title)
.fontWeight(.bold)
.font(.system(size: 17))
.foregroundColor(Color.white)
.multilineTextAlignment(.leading)
.padding(.horizontal)
.padding(.top, self.uiscreen.height * 0.05)
.padding(.bottom, self.uiscreen.height * 0.015)
ScrollView(.horizontal, showsIndicators: false) {
HStack(alignment: .center) {
ForEach(Array(coupons.enumerated()), id: \.offset) { index, item in
couponItemView(item: item, isFirst: index == 0, isLast: index == (coupons.count-1), parentView: parentView)
}
}
.frame(maxWidth: .infinity)
}
.frame(maxWidth: .infinity)
}
.frame(maxWidth: .infinity)
.padding(.bottom, self.uiscreen.height * 0.1)
}
}
struct couponItemView: View {
var item: swiftApi.CouponSetItemModel
var isFirst: Bool
var isLast: Bool
var parentView: UIView
var uiscreen = UIScreen.main.bounds
var body: some View {
Button {
// GiftItem Action
// let tempItem = item.asDictionary
let instanceOfMySwiftApi = swiftApi()
let couponViewController = instanceOfMySwiftApi.openCoupon(parent: parentView, coupon: item)
couponViewController.view.tag = 2
// addChild(couponsViewController)
couponViewController.view.frame = parentView.frame
parentView.addSubview(couponViewController.view)
// couponViewController.didMove(toParent: UIHostingController(rootView: self))
} label: {
HStack(alignment: .center) {
ImageView(withURL: item.img_preview ?? "", width: self.uiscreen.width * 0.15, isFill: false)
VLine()
.stroke(style: StrokeStyle(lineWidth: 1, dash: [5]))
.foregroundColor(Color(red: 0.4392156862745098, green: 0.4392156862745098, blue: 0.4392156862745098))
.frame(width: 1)
.padding(.leading, 10)
VStack(alignment: .leading, spacing: 8.0) {
Text(item.name ?? "")
.fontWeight(.medium)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.22745098039215686, green: 0.3215686274509804, blue: 0.4))
.multilineTextAlignment(.leading)
.lineLimit(1)
// .frame(maxWidth: .infinity)
HStack(alignment: .center) {
Text((item.discount ?? "")+"€")
.fontWeight(.bold)
.font(.system(size: 25))
.foregroundColor(Color(red: 0.22745098039215686, green: 0.3215686274509804, blue: 0.4))
.multilineTextAlignment(.leading)
.lineLimit(1)
// .frame(width: self.uiscreen.width * 0.3)
// .frame(maxWidth: .infinity, maxHeight: .infinity)
Text(item.short_description ?? "")
.fontWeight(.medium)
.font(.system(size: 11))
.foregroundColor(Color(red: 0.3803921568627451, green: 0.44313725490196076, blue: 0.5058823529411764))
.multilineTextAlignment(.leading)
.lineLimit(3)
// .frame(maxWidth: .infinity)
// .padding(.leading, 10)
}
// .padding(.vertical, 5)
// .frame(maxHeight: .infinity)
Text("Ισχύει έως "+(item.expiration ?? ""))
.fontWeight(.medium)
.font(.system(size: 11))
.foregroundColor(Color(red: 0.3803921568627451, green: 0.44313725490196076, blue: 0.5058823529411764))
.multilineTextAlignment(.leading)
// .frame(maxWidth: .infinity)
// .frame(maxWidth: .infinity, maxHeight: .infinity)
// .padding(.all, 10)
}
.padding(.all, 10)
// .frame(maxWidth: .infinity, maxHeight: .infinity)
Spacer()
}
.padding(.leading, 28)
.padding(.trailing)
}
.frame(width: self.uiscreen.width * 0.9, height: self.uiscreen.height * 0.14)
.cornerRadius(5)
.shadow(color: Color(red: 0, green: 0, blue: 0, opacity: 0.16), radius: 30, x: 0, y: 3)
.padding(.leading, isFirst ? 18 : 0)
.padding(.trailing, isLast ? 18 : 0)
.background(
Image("coupon_bg", bundle: Bundle(for: MyEmptyClass.self))
.resizable(resizingMode: .stretch)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.padding(.leading, isFirst ? 18 : 0)
.padding(.trailing, isLast ? 18 : 0)
)
}
}
struct VLine: Shape {
func path(in rect: CGRect) -> Path {
Path { path in
path.move(to: CGPoint(x: rect.midX, y: rect.minY))
path.addLine(to: CGPoint(x: rect.midX, y: rect.maxY))
}
}
}
}
@available(iOS 13.0.0, *)
struct GiftsView: View {
var parentView: UIView
// var coupons:Array<CouponSetItemModel> = CouponDataModel().getData
// var campains:Array<CampaignItemModel> = CampaignDataModel().getData.filter { $0.offer_category == "gifts_for_you" }
var coupons:Array<swiftApi.CouponSetItemModel> = []
var campains:Array<swiftApi.CampaignItemModel> = []
var uiscreen = UIScreen.main.bounds
init(parentView: UIView) { //initializer method
let instanceOfMySwiftApi = swiftApi()
let couponsData = instanceOfMySwiftApi.getCouponSets()
let campaignsData = instanceOfMySwiftApi.getCampaigns()
self.coupons = couponsData
self.campains = campaignsData.filter { $0.offer_category == "gifts_for_you" }
self.parentView = parentView
}
func goBack(){
for subview in parentView.subviews {
if(subview.tag == 5) {
subview.removeFromSuperview()
}
}
}
var body: some View {
VStack {
headerView(goBack: goBack)
searchView()
ScrollView(showsIndicators: false) {
VStack {
if (campains.filter { $0.subcategory == "gifts" }.count) > 0 {
giftsContainer(gifts: campains.filter { $0.subcategory == "gifts" }, title: "ΔΩΡΑ", parentView: parentView)
}
if (campains.filter { $0.subcategory == "rewards" }.count) > 0 {
giftsContainer(gifts: campains.filter { $0.subcategory == "rewards"}, title: "ΕΠΙΒΡΑΒΕΥΣΕΙΣ", parentView: parentView )
}
if (coupons.count) > 0 {
couponsContainer(coupons: coupons, title: "ΚΟΥΠΟΝΙΑ", parentView: parentView )
}
}
.frame(width:self.uiscreen.width)
}
.background(
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)
)
.cornerRadius(30, corners: [.topLeft])
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
}
.edgesIgnoringSafeArea([.bottom])
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
}
}
#endif
//@available(iOS 13.0.0, *)
//struct GiftsView_Previews: PreviewProvider {
// static var previews: some View {
//
// GiftsView()
//
// }
//}
//
// GiftsViewInterface.swift
// WarplySDKFrameworkIOS
//
// Created by Manos Chorianopoulos on 18/4/22.
//
import Foundation
import SwiftUI
@available(iOS 13.0.0, *)
@objc public class GiftsViewInterface : NSObject {
@objc(giftsViewController:) static public func giftsViewController(parentView: UIView?) -> UIViewController {
return UIHostingController(rootView: GiftsView(parentView: parentView!))
}
}
//
// MoreForYouView.swift
// WarplySDKFrameworkIOS
//
// Created by Βασιλης Σκουρας on 20/4/22.
//
import SwiftUI
import Combine
import Foundation
import UIKit
class DataMFYModel {
var data: Array<NSDictionary> = []
init() { //initializer method
let instanceOfMyApi = MyApi()
let inbox = instanceOfMyApi.getInbox() as! Array<NSDictionary>
data = inbox.filter({ $0["offer_category"] as! String == "more_for_you" })
}
var getData: Array<NSDictionary> {
get { // getter
return data
}
}
}
extension MoreForYouView {
struct headerView: View {
var goBack: () -> ()
var uiscreen = UIScreen.main.bounds
var body: some View {
HStack(alignment: .center) {
Button {
// Button Action
goBack()
} label: {
Image("ic_back", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02)
}
Spacer().frame(width: 0)
Text("More for you")
.fontWeight(.medium)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196))
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
.padding(.horizontal)
.offset(x: -self.uiscreen.height * 0.0125)
}
.frame(maxWidth: .infinity)
.padding(.horizontal)
.padding(.vertical, 10)
}
}
struct ImageView: View {
@ObservedObject var imageLoader:UrlImageModel
@State var width:CGFloat
@State var height:CGFloat
@State var isFill:Bool
var uiscreen = UIScreen.main.bounds
init(withURL url:String , width:CGFloat, height: CGFloat, isFill:Bool) {
imageLoader = UrlImageModel(urlString:url)
self.width = width
self.height = height
self.isFill = isFill
}
var body: some View {
Image(uiImage: imageLoader.image ?? UIImage())
.resizable()
.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)
.scaledToFill()
.aspectRatio(contentMode: isFill ? .fill : .fit)
.cornerRadius(4)
}
}
struct inboxView: View {
var result: NSDictionary
var index: Int
var uiscreen = UIScreen.main.bounds
static func localizedWithParameter(parameter: String) -> LocalizedStringKey {
return "\(parameter)"
}
var body: some View {
HStack {
VStack(alignment: .leading) {
Text(MoreForYouView.inboxView.localizedWithParameter(parameter: result["title"] as? String ?? ""))
.font(.system(size: 17).italic())
.fontWeight(.bold)
.foregroundColor(Color(hex: 0x3A5266))
.frame(maxWidth: self.uiscreen.width * 0.65, alignment: .topLeading)
.padding(.top, self.uiscreen.height * 0.01)
.padding(.leading, self.uiscreen.width * 0.03)
Spacer()
Text(MoreForYouView.inboxView.localizedWithParameter(parameter: result["subtitle"] as? String ?? ""))
.font(.system(size: 16))
.fontWeight(.medium)
.foregroundColor(Color(hex: 0x415564))
.frame(maxWidth: self.uiscreen.width * 0.72, alignment: .topLeading)
.padding(.leading, self.uiscreen.width * 0.03)
.padding(.bottom, self.uiscreen.height * 0.01)
}
.frame(width: self.uiscreen.width * 0.85, height: self.uiscreen.height * 0.2, alignment: .leading)
.background(
Image("MFY_container", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.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)
.scaledToFill()
.aspectRatio(contentMode: .fill)
)
.cornerRadius(4, corners: [.topLeft, .bottomLeft])
Spacer()
}
.frame(width: self.uiscreen.width * 0.95, height: self.uiscreen.height * 0.2)
.background(
ImageView(withURL: result["logo_url"] as! String, width: self.uiscreen.width * 0.95, height: self.uiscreen.height * 0.2, isFill: true)
)
.padding(.bottom, self.uiscreen.height * 0.01)
}
}
}
extension Color {
init(hex: Int, opacity: Double = 1.0) {
let red = Double((hex & 0xff0000) >> 16) / 255.0
let green = Double((hex & 0xff00) >> 8) / 255.0
let blue = Double((hex & 0xff) >> 0) / 255.0
self.init(.sRGB, red: red, green: green, blue: blue, opacity: opacity)
}
}
struct MoreForYouView: View {
var data:Array<NSDictionary> = DataMFYModel().getData
var parentView: UIView
var uiscreen = UIScreen.main.bounds
func goBack(){
for subview in parentView.subviews {
if(subview.tag == 4) {
subview.removeFromSuperview()
}
}
}
var body: some View {
VStack {
headerView(goBack: goBack)
ScrollView(showsIndicators: false) {
VStack {
if (data.count) > 0 {
ForEach(Array(zip(data.indices, data)), id: \.0) { index, result in
inboxView(result: result, index: index)
}
}
}
.padding(.top, self.uiscreen.height * 0.04)
.padding(.bottom, self.uiscreen.height * 0.05)
}
.frame(maxWidth: .infinity, maxHeight: .infinity )
.background(
LinearGradient(gradient: Gradient(colors: [Color(hex: 0x1AADCC), Color(hex: 0x83C062)]), startPoint: .top, endPoint: .bottom)
)
.cornerRadius(20, corners: [.topLeft])
}
.frame(maxWidth: .infinity, maxHeight: .infinity )
.edgesIgnoringSafeArea([.bottom])
// .frame(width:self.uiscreen.width, height:self.uiscreen.height )
}
}
//struct MoreForYouView_Previews: PreviewProvider {
// static var previews: some View {
// MoreForYouView()
// }
//}
//
// MoreForYouViewInterface.swift
// WarplySDKFrameworkIOS
//
// Created by Βασιλης Σκουρας on 20/4/22.
//
import Foundation
import SwiftUI
@available(iOS 13.0.0, *)
@objc public class MoreForYouViewInterface : NSObject {
@objc(moreForYouViewController:) static public func moreForYouViewController(parentView: UIView?) -> UIViewController {
return UIHostingController(rootView: MoreForYouView(parentView: parentView!))
}
}
......@@ -37,18 +37,18 @@ CMPedometer *pedometer;
NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:cacheSizeMemory diskCapacity:cacheSizeDisk diskPath:@"nsurlcache"];
[NSURLCache setSharedURLCache:sharedCache];
date = [NSDate date];
if ([CMPedometer isStepCountingAvailable]) {
pedometer = [[CMPedometer alloc] init];
[NSTimer scheduledTimerWithTimeInterval:0.5f
target:self
selector:@selector(recursiveQuery)
userInfo:nil
repeats:YES];
} else {
NSLog(@"Nothing available");
}
// date = [NSDate date];
// if ([CMPedometer isStepCountingAvailable]) {
// pedometer = [[CMPedometer alloc] init];
// [NSTimer scheduledTimerWithTimeInterval:0.5f
// target:self
// selector:@selector(recursiveQuery)
// userInfo:nil
// repeats:YES];
// } else {
// NSLog(@"Nothing available");
//
// }
}
- (void)queryDataFrom:(NSDate *)startDate toDate:(NSDate *)endDate {
......
//
// OldCouponsView.swift
// WarplySDKFrameworkIOS
//
// Created by Manos Chorianopoulos on 28/4/22.
//
#if canImport(SwiftUI)
import SwiftUI
import Combine
import Foundation
import UIKit
extension OldCouponsView {
struct headerView: View {
var goBack: () -> ()
var uiscreen = UIScreen.main.bounds
var body: some View {
HStack(alignment: .center) {
Button {
// Button Action
print("Back Button tapped!")
goBack()
} label: {
Image("ic_back", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02)
}
Text("Παλαιότερα κουπόνια")
.fontWeight(.medium)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196))
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
.padding(.horizontal)
Button {
// Button Action
print("Wallet tapped!")
} label: {
Image("ic_wallet", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: self.uiscreen.height * 0.04, height: self.uiscreen.height * 0.04)
}
}
.frame(maxWidth: .infinity)
.padding(.horizontal)
.padding(.vertical, 10)
}
}
struct ImageView: View {
@ObservedObject var imageLoader:UrlImageModel
@State var width:CGFloat
@State var isFill:Bool
var uiscreen = UIScreen.main.bounds
init(withURL url:String , width:CGFloat, isFill:Bool) {
imageLoader = UrlImageModel(urlString:url)
self.width = width
self.isFill = isFill
}
var body: some View {
Image(uiImage: imageLoader.image ?? UIImage())
.resizable()
.aspectRatio(contentMode: isFill ? .fill : .fit)
.frame(width: self.width)
.frame(maxHeight: .infinity)
}
}
struct couponItemView: View {
var item: swiftApi.CouponItemModel
var parentView: UIView
var uiscreen = UIScreen.main.bounds
var body: some View {
// let couponData = item["coupon_data"] as? [String: Any] ?? ["":""]
let couponSetData = item.couponset_data
Button {
// Coupon Action
print("Coupon tapped!")
// let instanceOfMyApi = MyApi()
// let couponBarcodeViewController = instanceOfMyApi.openCouponBarcode(parentView, coupon: item as! [String : Any])!
// couponBarcodeViewController.view.tag = 7
//// addChild(couponsViewController)
// couponBarcodeViewController.view.frame = parentView.frame
// parentView.addSubview(couponBarcodeViewController.view)
// couponBarcodeViewController.didMove(toParent: UIHostingController(rootView: self))
} label: {
HStack(alignment: .center) {
ImageView(withURL: couponSetData?.img_preview ?? "", width: self.uiscreen.width * 0.15, isFill: false)
VLine()
.stroke(style: StrokeStyle(lineWidth: 1, dash: [5]))
.foregroundColor(Color(red: 0.4392156862745098, green: 0.4392156862745098, blue: 0.4392156862745098))
.frame(width: 1)
.padding(.leading, 10)
VStack(alignment: .leading, spacing: 5.0) {
Text(couponSetData?.name ?? "")
.fontWeight(.medium)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.22745098039215686, green: 0.3215686274509804, blue: 0.4))
.multilineTextAlignment(.leading)
// .lineLimit(1)
HStack(alignment: .center) {
Text((item.discount ?? "")+"€")
.fontWeight(.bold)
.font(.system(size: 35))
.foregroundColor(Color(red: 0.22745098039215686, green: 0.3215686274509804, blue: 0.4))
.multilineTextAlignment(.leading)
.lineLimit(1)
// Text(couponSetData?.short_description ?? "")
// .fontWeight(.medium)
// .font(.system(size: 11))
// .foregroundColor(Color(red: 0.3803921568627451, green: 0.44313725490196076, blue: 0.5058823529411764))
// .multilineTextAlignment(.leading)
// .lineLimit(3)
}
Text("Εξαργυρώθηκε την " + (item.expiration ?? ""))
.fontWeight(.medium)
.font(.system(size: 11))
.foregroundColor(Color(red: 0.3803921568627451, green: 0.44313725490196076, blue: 0.5058823529411764))
.multilineTextAlignment(.leading)
}
.padding(.all, 10)
Spacer()
}
.padding(.leading, 28)
.padding(.trailing)
}
.frame(width: self.uiscreen.width * 0.9, height: self.uiscreen.height * 0.14)
// .cornerRadius(5)
// .shadow(color: Color(red: 0, green: 0, blue: 0, opacity: 0.16), radius: 30, x: 0, y: 3)
.background(
Image("coupon_bg", bundle: Bundle(for: MyEmptyClass.self))
.resizable(resizingMode: .stretch)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.colorMultiply(Color(red: 0.8901960784313725, green: 0.8901960784313725, blue: 0.8901960784313725))
)
}
}
struct VLine: Shape {
func path(in rect: CGRect) -> Path {
Path { path in
path.move(to: CGPoint(x: rect.midX, y: rect.minY))
path.addLine(to: CGPoint(x: rect.midX, y: rect.maxY))
}
}
}
struct couponsContainer: View {
@State var coupons:Array<swiftApi.CouponItemModel> = []
@State var parentView:UIView
var uiscreen = UIScreen.main.bounds
// static func convertDateFormat(inputDate: String) -> String {
// let dateFormatter = DateFormatter()
// dateFormatter.dateFormat = "yyyy-MM-dd hh:mm:ss"
// if let date = dateFormatter.date(from: inputDate) {
// dateFormatter.dateFormat = "dd/MM/yyyy"
// let resultString = dateFormatter.string(from: date)
// return resultString
// } else {
// return ""
// }
// }
var body: some View {
VStack(alignment: .center, spacing: self.uiscreen.height * 0.03) {
ForEach(Array(coupons.enumerated()), id: \.offset) { index, item in
couponItemView(item: item, parentView: parentView)
}
}
.frame(maxWidth: .infinity)
.padding(.top, self.uiscreen.height * 0.05)
.padding(.bottom, self.uiscreen.height * 0.1)
}
}
}
@available(iOS 13.0.0, *)
struct OldCouponsView: View {
var parentView: UIView
var coupons:Array<swiftApi.CouponItemModel> = []
var uiscreen = UIScreen.main.bounds
init(parentView: UIView) { //initializer method
let instanceOfMySwiftApi = swiftApi()
let couponsData = instanceOfMySwiftApi.getOldCoupons()
self.coupons = couponsData
self.parentView = parentView
}
func goBack(){
for subview in parentView.subviews {
if(subview.tag == 9) {
subview.removeFromSuperview()
}
}
}
var body: some View {
VStack {
headerView(goBack: goBack)
VStack {
ScrollView(showsIndicators: false) {
VStack {
if (coupons.count) > 0 {
couponsContainer(coupons: coupons, parentView: parentView )
}
}
.frame(width:self.uiscreen.width)
}
.cornerRadius(30, corners: [.topLeft])
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
}
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
.padding(.top, 5)
.background(
Image("coupons_scrollview", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
)
}
.edgesIgnoringSafeArea([.bottom])
.frame(width:self.uiscreen.width)
.frame(maxHeight: .infinity)
}
}
#endif
//struct OldCouponsView_Previews: PreviewProvider {
// static var previews: some View {
// OldCouponsView()
// }
//}
//
// OldCouponsViewInterface.swift
// WarplySDKFrameworkIOS
//
// Created by Manos Chorianopoulos on 28/4/22.
//
import Foundation
import SwiftUI
@available(iOS 13.0.0, *)
@objc public class OldCouponsViewInterface : NSObject {
@objc(oldCouponsViewController:) static public func oldCouponsViewController(parentView: UIView?) -> UIViewController {
return UIHostingController(rootView: OldCouponsView(parentView: parentView!))
}
}
//
// StepsView.swift
// WarplySDKFrameworkIOS
//
// Created by Βασιλης Σκουρας on 3/5/22.
//
#if canImport(SwiftUI)
import SwiftUI
import Combine
import Foundation
import UIKit
class StepsModel {
var steps: AnyObject
init() async { //initializer method
let instanceOfMyApi = MyApi()
self.steps = await instanceOfMyApi.getSteps { _ in
} as AnyObject
print(steps)
}
var getSteps: AnyObject {
get { // getter
return steps
}
}
}
extension StepsView {
struct headerView: View {
var goBack: () -> ()
var uiscreen = UIScreen.main.bounds
var body: some View {
HStack(alignment: .center) {
Button {
// Button Action
goBack()
} label: {
Image("ic_back", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02)
}
Spacer().frame(width: 0)
Text("Όλα τα κουπόνια μου")
.fontWeight(.medium)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196))
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
.padding(.horizontal)
.offset(x: -self.uiscreen.height * 0.0125)
}
.frame(maxWidth: .infinity)
.padding(.horizontal)
.padding(.vertical, 10)
}
}
}
@available(iOS 13.0.0, *)
struct StepsView: View {
@State private var steps = "Loading"
var parentView: UIView
func getSteps() async -> AnyObject {
return await StepsModel().getSteps
}
var uiscreen = UIScreen.main.bounds
init(parentView: UIView) { //initializer method
self.parentView = parentView
}
func goBack(){
for subview in parentView.subviews {
if(subview.tag == 11) {
subview.removeFromSuperview()
}
}
}
func getSteps() async -> String {
let instanceOfMyApi = MyApi()
let stepsData = await instanceOfMyApi.getSteps { _ in
} as AnyObject
// DispatchQueue.main.async {
// steps = ""
// }
return ""
}
var body: some View {
VStack {
headerView(goBack: goBack)
Text(steps)
.onAppear {
async {
let instanceOfMyApi = MyApi()
let stepsData = try? await instanceOfMyApi.getSteps { _ in
} as AnyObject
self.steps = ""
}
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity )
// .frame(width:self.uiscreen.width, height:self.uiscreen.height )
}
}
#endif
//@available(iOS 13.0.0, *)
//struct Previews_CouponsView_Previews: PreviewProvider {
// static var uiscreen = UIScreen.main.bounds
// static var previews: some View {
// ZStack {
// Image("ic_back", bundle: Bundle(for: MyEmptyClass.self))
// .resizable()
// .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02)
// .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.05, y: self.uiscreen.height * 0.07)
// Text("Όλα τα κουπόνια μου")
// .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.025, alignment: .center)
// .offset( y: self.uiscreen.height * 0.07)
// }
//
// }
//}
//
// StepsViewInterface.swift
// WarplySDKFrameworkIOS
//
// Created by Βασιλης Σκουρας on 3/5/22.
//
import Foundation
import SwiftUI
@available(iOS 13.0.0, *)
@objc public class StepsViewInterface : NSObject {
@objc(stepsViewController:) static public func stepsViewController(parentView: UIView?) -> UIViewController {
return UIHostingController(rootView: StepsView(parentView: parentView!))
}
}
//
// WalletView.swift
// WarplySDKFrameworkIOS
//
// Created by Βασιλης Σκουρας on 20/4/22.
//
import SwiftUI
class ProfileDataModel {
var data: NSDictionary
init() { //initializer method
let instanceOfMyApi = MyApi()
let profile = instanceOfMyApi.getProfile()
var profileData = NSDictionary()
if let profileDictionary = profile as? [String : AnyObject] {
profileData = (profileDictionary["result"] as! NSDictionary)
}
self.data = profileData
}
var getData: NSDictionary {
get { // getter
return data
}
}
}
extension WalletView {
static func localizedWithParameter(parameter: String) -> LocalizedStringKey {
return "\(parameter)"
}
struct headerView: View {
var goBack: () -> ()
var uiscreen = UIScreen.main.bounds
var body: some View {
HStack(alignment: .center) {
Button {
// Button Action
goBack()
} label: {
Image("ic_back", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02)
}
Spacer().frame(width: 0)
Text("My loyalty wallet")
.fontWeight(.medium)
.font(.system(size: 16))
.foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196))
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
.padding(.horizontal)
.offset(x: -self.uiscreen.height * 0.0125)
}
.frame(maxWidth: .infinity)
.padding(.horizontal)
.padding(.vertical, 10)
}
}
struct ImageView: View {
@ObservedObject var imageLoader:UrlImageModel
@State var width:CGFloat
@State var height:CGFloat
@State var isFill:Bool
var uiscreen = UIScreen.main.bounds
init(withURL url:String , width:CGFloat, height: CGFloat, isFill:Bool) {
imageLoader = UrlImageModel(urlString:url)
self.width = width
self.height = height
self.isFill = isFill
}
var body: some View {
Image(uiImage: imageLoader.image ?? UIImage())
.resizable()
.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)
.scaledToFill()
.aspectRatio(contentMode: isFill ? .fill : .fit)
.cornerRadius(4)
}
}
struct myCoupons: View {
var uiscreen = UIScreen.main.bounds
@State var parentView:UIView
var instanceOfMySwiftApi = swiftApi()
// var couponsLength = instanceOfMySwiftApi.getCoupons().filter({ $0.status! == 1 }).count
var body: some View {
VStack {
HStack {
Text("My coupons")
.font(.system(size: 18))
.foregroundColor(Color.white)
.fontWeight(.medium)
Spacer()
Button {
let instanceOfMyApi = MyApi()
let oldCouponsView = instanceOfMyApi.openOldCoupons(parentView)!
oldCouponsView.view.tag = 9
oldCouponsView.view.frame = parentView.frame
parentView.addSubview(oldCouponsView.view)
} label: {
Text("Παλαιότερα κουπόνια ->")
.font(.system(size: 14))
.foregroundColor(Color.white)
.fontWeight(.medium)
}
}
.padding(.leading, self.uiscreen.width * 0.05)
.padding(.trailing, self.uiscreen.width * 0.05)
HStack {
VStack {
Spacer()
Text(.init("Έχεις **" + String(instanceOfMySwiftApi.getCoupons().filter({ $0.status! == 1 }).count) + "** ενεργά κουπόνια"))
.frame(width: self.uiscreen.width * 0.35, alignment: .leading)
.font(.system(size: 17))
Spacer()
Button {
let instanceOfMyApi = MyApi()
let couponsView = instanceOfMyApi.openCoupons(parentView)!
couponsView.view.tag = 1
couponsView.view.frame = parentView.frame
parentView.addSubview(couponsView.view)
} label: {
Text("Δες τα όλα ->")
.font(.system(size: 12))
.fontWeight(.medium)
.frame(width: self.uiscreen.width * 0.35, alignment: .leading)
}
Spacer()
}
.padding(.leading, self.uiscreen.width * 0.1)
Spacer()
Image("ic_gifts_for_you", bundle: Bundle(for: MyEmptyClass.self))
.frame(width: self.uiscreen.height * 0.08, height: self.uiscreen.height * 0.1)
.padding(.trailing, self.uiscreen.width * 0.08)
}
.padding(.top, self.uiscreen.height * 0.01)
.padding(.bottom, self.uiscreen.height * 0.01)
.background(
Image("coupons_container", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.frame(minWidth: self.uiscreen.width * 0.975, idealWidth: self.uiscreen.width * 0.975, maxWidth: self.uiscreen.width * 0.975)
.scaledToFill()
.aspectRatio(contentMode: .fill)
)
.frame(width: self.uiscreen.width * 0.975)
}
.padding(.top, self.uiscreen.height * 0.025)
.padding(.bottom, self.uiscreen.height * 0.025)
.frame(width: self.uiscreen.width)
.background(Color(hex: 0xFFFFFF).opacity(0.13))
}
}
struct myRewards: View {
var uiscreen = UIScreen.main.bounds
@State var parentView:UIView
var instanceOfMySwiftApi = swiftApi()
var body: some View {
Button {
let instanceOfMyApi = MyApi()
let allGiftsViewController = instanceOfMyApi.openAllGifts(parentView)!
allGiftsViewController.view.tag = 8
allGiftsViewController.view.frame = parentView.frame
parentView.addSubview(allGiftsViewController.view)
} label: {
VStack {
HStack {
Text("My rewards")
.font(.system(size: 18))
.foregroundColor(Color.white)
.fontWeight(.medium)
Spacer()
Text("Παλαιότερα δώρα ->")
.font(.system(size: 14))
.foregroundColor(Color.white)
.fontWeight(.medium)
}
.padding(.leading, self.uiscreen.width * 0.05)
.padding(.trailing, self.uiscreen.width * 0.05)
HStack {
VStack {
Spacer()
Text(.init("Έχεις **" + String(instanceOfMySwiftApi.getCoupons().filter({ $0.status! == 1 }).count) + "** ενεργά δώρα"))
.frame(width: self.uiscreen.width * 0.35, alignment: .leading)
.font(.system(size: 17))
Spacer()
Text("Δες τα όλα ->")
.font(.system(size: 12))
.fontWeight(.medium)
.frame(width: self.uiscreen.width * 0.35, alignment: .leading)
Spacer()
}
.padding(.leading, self.uiscreen.width * 0.1)
Spacer()
Image("ic_loyalty_rewards", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.frame(width: self.uiscreen.height * 0.08, height: self.uiscreen.height * 0.08)
.padding(.trailing, self.uiscreen.width * 0.08)
}
.padding(.top, self.uiscreen.height * 0.02)
.padding(.bottom, self.uiscreen.height * 0.02)
.frame(width: self.uiscreen.width * 0.975)
.background(Color.white)
}
.padding(.top, self.uiscreen.height * 0.025)
.padding(.bottom, self.uiscreen.height * 0.025)
.frame(width: self.uiscreen.width)
.background(Color(hex: 0xFFFFFF).opacity(0.13))
.padding(.top, self.uiscreen.height * 0.02)
}
}
}
struct linearView: View {
var data: NSDictionary
var uiscreen = UIScreen.main.bounds
@State var parentView:UIView
var body: some View {
VStack{
HStack {
VStack(alignment: .leading) {
Text("Ενεργός κωδικός:")
.font(.system(size: 17))
.fontWeight(.medium)
.foregroundColor(Color(hex: 0x3C5365))
Text("961544809")
.font(.system(size: 17))
.fontWeight(.bold)
.foregroundColor(Color(hex: 0x3C5365))
Text("Λήγει σε 4 ημέρες")
.font(.system(size: 11))
.fontWeight(.medium)
.foregroundColor(Color(hex: 0x84929E))
}
Spacer()
Image("deals_for_you", bundle: Bundle(for: MyEmptyClass.self))
.resizable()
.frame(width: self.uiscreen.height * 0.08, height: self.uiscreen.height * 0.08)
.padding(.top, self.uiscreen.height * 0.01)
.padding(.bottom, self.uiscreen.height * 0.01)
}
.padding(.leading, self.uiscreen.width * 0.04)
.padding(.trailing, self.uiscreen.width * 0.04)
.frame(width: self.uiscreen.width * 0.975, alignment: .leading)
.background(Color.white)
.cornerRadius(3)
.padding(.top, self.uiscreen.height * 0.04)
.padding(.bottom, self.uiscreen.height * 0.04)
myCoupons(parentView: parentView)
myRewards(parentView: parentView)
HStack {
Text("Ανάλυση")
.font(.system(size: 14))
.fontWeight(.medium)
.foregroundColor(Color(hex: 0x509E2F))
.padding(.top, self.uiscreen.height * 0.015)
.padding(.bottom, self.uiscreen.height * 0.015)
}
.frame(width: self.uiscreen.width * 0.925)
.background(Color(hex: 0xE6E6E6))
.padding(.top, self.uiscreen.height * 0.02)
.padding(.bottom, self.uiscreen.height * 0.03)
}
.frame(width: self.uiscreen.width, alignment: .center)
.background(
LinearGradient(gradient: Gradient(colors: [Color(hex: 0x1AADCC), Color(hex: 0x83C062)]), startPoint: .top, endPoint: .bottom)
)
.cornerRadius(15, corners: [.topLeft])
}
}
}
struct WalletView: View {
var parentView: UIView
var uiscreen = UIScreen.main.bounds
var data: NSDictionary = ProfileDataModel().getData
func goBack(){
for subview in parentView.subviews {
if(subview.tag == 3) {
subview.removeFromSuperview()
}
}
}
var body: some View {
VStack {
headerView(goBack: goBack)
HStack {
ZStack {
if let value = (data["result"] as? String) {
ImageView(withURL: value, width: self.uiscreen.height * 0.05, height: self.uiscreen.height * 0.05, isFill: true)
.cornerRadius(self.uiscreen.height * 0.05)
.padding(.leading, self.uiscreen.width * 0.05)
} else {
Image("generic_profile")
.frame(width: self.uiscreen.height * 0.05, height: self.uiscreen.height * 0.05)
.background(Color.black)
.cornerRadius(self.uiscreen.height * 0.05)
.padding(.leading, self.uiscreen.width * 0.05)
}
Circle()
.strokeBorder(Color(hex: 0x22A9B5), lineWidth: 1)
.frame(width: self.uiscreen.height * 0.05, height: self.uiscreen.height * 0.05)
.padding(.leading, self.uiscreen.width * 0.05)
}
VStack(alignment: .leading) {
Text(WalletView.localizedWithParameter(parameter: data["firstname"] as! String + " " + (data["lastname"] as! String)))
.font(.system(size: 13))
.padding(.top, self.uiscreen.height * 0.005)
.frame(width: self.uiscreen.width * 0.7, alignment: .leading)
Spacer()
if let value = (data["profile_metadata"] as? NSDictionary) {
if ((value["answered"] != nil) == true) {
VStack {
}
.background(
LinearGradient(gradient: Gradient(colors: [Color(hex: 0x1AADCC), Color(hex: 0x83C062)]), startPoint: .trailing, endPoint: .leading)
)
}
} else {
HStack {
Text("+")
.font(.system(size: 17))
.padding(.bottom, 2)
Text("Ερωτηματολόγιο")
.font(.system(size: 13))
.fontWeight(.medium)
}
.padding(.leading, 5)
.padding(.trailing, 5)
.overlay(
RoundedRectangle(cornerRadius: 16).stroke(Color(hex: 0x556778), lineWidth: 1)
)
.padding(.bottom, self.uiscreen.height * 0.005)
}
}
.padding(.leading , self.uiscreen.width * 0.025)
}
.frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.06, alignment: .leading)
.padding(.top, self.uiscreen.height * 0.04)
.padding(.bottom, self.uiscreen.height * 0.02)
ScrollView(showsIndicators: false) {
linearView(data: data, parentView: parentView)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.edgesIgnoringSafeArea([.bottom])
}
.frame(maxWidth: .infinity, maxHeight: .infinity )
// .frame(width:self.uiscreen.width, height:self.uiscreen.height )
}
}
//struct WalletView_Previews: PreviewProvider {
// static var previews: some View {
// WalletView()
// }
//}
//
// WalletViewInterface.swift
// WarplySDKFrameworkIOS
//
// Created by Βασιλης Σκουρας on 20/4/22.
//
import Foundation
import SwiftUI
@available(iOS 13.0.0, *)
@objc public class WalletViewInterface : NSObject {
@objc(walletViewController:) static public func walletViewController(parentView: UIView?) -> UIViewController {
return UIHostingController(rootView: WalletView(parentView: parentView!))
}
}