Vasilis
......@@ -7,6 +7,8 @@
objects = {
/* Begin PBXBuildFile section */
1E735FF2281067320050A298 /* CampaignWebview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E735FF1281067320050A298 /* CampaignWebview.swift */; };
1E735FF42810681E0050A298 /* CampaignWebviewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E735FF32810681E0050A298 /* CampaignWebviewInterface.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 */; };
......@@ -139,6 +141,8 @@
/* Begin PBXFileReference section */
1353B8C484CC0649CAC2EB74 /* Pods_WarplySDKFrameworkIOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_WarplySDKFrameworkIOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
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>"; };
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>"; };
......@@ -333,6 +337,8 @@
E639EFA0280810E300B9DD94 /* CouponsView.swift */,
E639EFA1280810E300B9DD94 /* CouponsViewInterface.swift */,
1EBEB02C280D69D800BF802C /* GiftsView.swift */,
1E735FF1281067320050A298 /* CampaignWebview.swift */,
1E735FF32810681E0050A298 /* CampaignWebviewInterface.swift */,
1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */,
E67D1EB7281055D900940F01 /* WalletViewInterface.swift */,
E67D1EBD2810573900940F01 /* WalletView.swift */,
......@@ -747,11 +753,13 @@
E6D8DF5727A942920006A3A9 /* FMResultSet.m 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 */,
E6EA2F702806E8C200EC4CF5 /* Coupons.swift in Sources */,
1E735FF42810681E0050A298 /* CampaignWebviewInterface.swift in Sources */,
E639EFA3280810E300B9DD94 /* CouponsViewInterface.swift in Sources */,
1EBEB02F280D6AA500BF802C /* GiftsViewInterface.swift in Sources */,
E67D1EBA281055F800940F01 /* MoreForYouViewInterface.swift in Sources */,
......
//
// CampaignWebview.swift
// WarplySDKFrameworkIOS
//
// Created by Manos Chorianopoulos on 20/4/22.
//
#if canImport(SwiftUI)
import SwiftUI
import Combine
import Foundation
import UIKit
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)
}
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)
}
.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) {
let request = URLRequest(url: URL(string: url)!)
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 ?? ""))
}
}