Merge branch 'master' of https://git.warp.ly/open-source/warply_sdk_framework
Showing
4 changed files
with
135 additions
and
0 deletions
... | @@ -7,6 +7,8 @@ | ... | @@ -7,6 +7,8 @@ |
7 | objects = { | 7 | objects = { |
8 | 8 | ||
9 | /* Begin PBXBuildFile section */ | 9 | /* Begin PBXBuildFile section */ |
10 | + 1E735FF2281067320050A298 /* CampaignWebview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E735FF1281067320050A298 /* CampaignWebview.swift */; }; | ||
11 | + 1E735FF42810681E0050A298 /* CampaignWebviewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E735FF32810681E0050A298 /* CampaignWebviewInterface.swift */; }; | ||
10 | 1EBEB02D280D69D800BF802C /* GiftsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBEB02C280D69D800BF802C /* GiftsView.swift */; }; | 12 | 1EBEB02D280D69D800BF802C /* GiftsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBEB02C280D69D800BF802C /* GiftsView.swift */; }; |
11 | 1EBEB02F280D6AA500BF802C /* GiftsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */; }; | 13 | 1EBEB02F280D6AA500BF802C /* GiftsViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */; }; |
12 | 260C6A1AFF7560C32E212F20 /* Pods_WarplySDKFrameworkIOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1353B8C484CC0649CAC2EB74 /* Pods_WarplySDKFrameworkIOS.framework */; }; | 14 | 260C6A1AFF7560C32E212F20 /* Pods_WarplySDKFrameworkIOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1353B8C484CC0649CAC2EB74 /* Pods_WarplySDKFrameworkIOS.framework */; }; |
... | @@ -139,6 +141,8 @@ | ... | @@ -139,6 +141,8 @@ |
139 | 141 | ||
140 | /* Begin PBXFileReference section */ | 142 | /* Begin PBXFileReference section */ |
141 | 1353B8C484CC0649CAC2EB74 /* Pods_WarplySDKFrameworkIOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_WarplySDKFrameworkIOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; | 143 | 1353B8C484CC0649CAC2EB74 /* Pods_WarplySDKFrameworkIOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_WarplySDKFrameworkIOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; |
144 | + 1E735FF1281067320050A298 /* CampaignWebview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CampaignWebview.swift; sourceTree = "<group>"; }; | ||
145 | + 1E735FF32810681E0050A298 /* CampaignWebviewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CampaignWebviewInterface.swift; sourceTree = "<group>"; }; | ||
142 | 1EBEB02C280D69D800BF802C /* GiftsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GiftsView.swift; sourceTree = "<group>"; }; | 146 | 1EBEB02C280D69D800BF802C /* GiftsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GiftsView.swift; sourceTree = "<group>"; }; |
143 | 1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GiftsViewInterface.swift; sourceTree = "<group>"; }; | 147 | 1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GiftsViewInterface.swift; sourceTree = "<group>"; }; |
144 | 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>"; }; | 148 | 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 @@ | ... | @@ -333,6 +337,8 @@ |
333 | E639EFA0280810E300B9DD94 /* CouponsView.swift */, | 337 | E639EFA0280810E300B9DD94 /* CouponsView.swift */, |
334 | E639EFA1280810E300B9DD94 /* CouponsViewInterface.swift */, | 338 | E639EFA1280810E300B9DD94 /* CouponsViewInterface.swift */, |
335 | 1EBEB02C280D69D800BF802C /* GiftsView.swift */, | 339 | 1EBEB02C280D69D800BF802C /* GiftsView.swift */, |
340 | + 1E735FF1281067320050A298 /* CampaignWebview.swift */, | ||
341 | + 1E735FF32810681E0050A298 /* CampaignWebviewInterface.swift */, | ||
336 | 1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */, | 342 | 1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */, |
337 | E67D1EB7281055D900940F01 /* WalletViewInterface.swift */, | 343 | E67D1EB7281055D900940F01 /* WalletViewInterface.swift */, |
338 | E67D1EBD2810573900940F01 /* WalletView.swift */, | 344 | E67D1EBD2810573900940F01 /* WalletView.swift */, |
... | @@ -747,11 +753,13 @@ | ... | @@ -747,11 +753,13 @@ |
747 | E6D8DF5727A942920006A3A9 /* FMResultSet.m in Sources */, | 753 | E6D8DF5727A942920006A3A9 /* FMResultSet.m in Sources */, |
748 | E6D8DF3A27A942920006A3A9 /* UIButton+AFNetworking.m in Sources */, | 754 | E6D8DF3A27A942920006A3A9 /* UIButton+AFNetworking.m in Sources */, |
749 | E6D8DF0627A942920006A3A9 /* WLBeacon.m in Sources */, | 755 | E6D8DF0627A942920006A3A9 /* WLBeacon.m in Sources */, |
756 | + 1E735FF2281067320050A298 /* CampaignWebview.swift in Sources */, | ||
750 | E6D8DF2927A942920006A3A9 /* NSData+SSToolkitAdditions.m in Sources */, | 757 | E6D8DF2927A942920006A3A9 /* NSData+SSToolkitAdditions.m in Sources */, |
751 | 1EBEB02D280D69D800BF802C /* GiftsView.swift in Sources */, | 758 | 1EBEB02D280D69D800BF802C /* GiftsView.swift in Sources */, |
752 | E67D1EC02810579F00940F01 /* MoreForYouView.swift in Sources */, | 759 | E67D1EC02810579F00940F01 /* MoreForYouView.swift in Sources */, |
753 | E6D8DEFC27A942920006A3A9 /* WLCustomNativeAdTableViewCell.m in Sources */, | 760 | E6D8DEFC27A942920006A3A9 /* WLCustomNativeAdTableViewCell.m in Sources */, |
754 | E6EA2F702806E8C200EC4CF5 /* Coupons.swift in Sources */, | 761 | E6EA2F702806E8C200EC4CF5 /* Coupons.swift in Sources */, |
762 | + 1E735FF42810681E0050A298 /* CampaignWebviewInterface.swift in Sources */, | ||
755 | E639EFA3280810E300B9DD94 /* CouponsViewInterface.swift in Sources */, | 763 | E639EFA3280810E300B9DD94 /* CouponsViewInterface.swift in Sources */, |
756 | 1EBEB02F280D6AA500BF802C /* GiftsViewInterface.swift in Sources */, | 764 | 1EBEB02F280D6AA500BF802C /* GiftsViewInterface.swift in Sources */, |
757 | E67D1EBA281055F800940F01 /* MoreForYouViewInterface.swift in Sources */, | 765 | E67D1EBA281055F800940F01 /* MoreForYouViewInterface.swift in Sources */, | ... | ... |
No preview for this file type
1 | +// | ||
2 | +// CampaignWebview.swift | ||
3 | +// WarplySDKFrameworkIOS | ||
4 | +// | ||
5 | +// Created by Manos Chorianopoulos on 20/4/22. | ||
6 | +// | ||
7 | + | ||
8 | + | ||
9 | +#if canImport(SwiftUI) | ||
10 | +import SwiftUI | ||
11 | +import Combine | ||
12 | +import Foundation | ||
13 | +import UIKit | ||
14 | + | ||
15 | + | ||
16 | +extension CampaignWebview { | ||
17 | + struct headerView: View { | ||
18 | + var goBack: () -> () | ||
19 | + | ||
20 | + var uiscreen = UIScreen.main.bounds | ||
21 | + | ||
22 | + var body: some View { | ||
23 | + HStack(alignment: .center) { | ||
24 | + Button { | ||
25 | + // Button Action | ||
26 | + print("Back Button tapped!") | ||
27 | + goBack() | ||
28 | + } label: { | ||
29 | + Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | ||
30 | + .resizable() | ||
31 | + .aspectRatio(contentMode: .fit) | ||
32 | + .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | ||
33 | + } | ||
34 | + | ||
35 | + Text("") | ||
36 | + .fontWeight(.medium) | ||
37 | + .font(.system(size: 16)) | ||
38 | + .foregroundColor(Color(red: 0.20784313725490197, green: 0.3176470588235294, blue: 0.40784313725490196)) | ||
39 | + .multilineTextAlignment(.center) | ||
40 | + .frame(maxWidth: .infinity) | ||
41 | + .padding(.horizontal) | ||
42 | + | ||
43 | + } | ||
44 | + .frame(maxWidth: .infinity) | ||
45 | + .padding(.horizontal) | ||
46 | + .padding(.vertical, 10) | ||
47 | + } | ||
48 | + } | ||
49 | + | ||
50 | + struct WebView: UIViewRepresentable { | ||
51 | + | ||
52 | + var url: String | ||
53 | + | ||
54 | + func makeUIView(context: Context) -> WKWebView { | ||
55 | + return WKWebView() | ||
56 | + } | ||
57 | + | ||
58 | + func updateUIView(_ webView: WKWebView, context: Context) { | ||
59 | + let request = URLRequest(url: URL(string: url)!) | ||
60 | + webView.load(request) | ||
61 | + } | ||
62 | + } | ||
63 | + | ||
64 | +} | ||
65 | + | ||
66 | +@available(iOS 13.0.0, *) | ||
67 | +struct CampaignWebview: View { | ||
68 | + var parentView: UIView | ||
69 | + var campaign: String | ||
70 | + | ||
71 | + var uiscreen = UIScreen.main.bounds | ||
72 | + | ||
73 | + func goBack(){ | ||
74 | + for subview in parentView.subviews { | ||
75 | + if(subview.tag == 6) { | ||
76 | + subview.removeFromSuperview() | ||
77 | + } | ||
78 | + } | ||
79 | + } | ||
80 | + | ||
81 | + var body: some View { | ||
82 | + VStack { | ||
83 | + headerView(goBack: goBack) | ||
84 | + | ||
85 | + VStack { | ||
86 | + WebView(url: campaign) | ||
87 | + } | ||
88 | + .background( | ||
89 | + 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) | ||
90 | + ) | ||
91 | + .cornerRadius(30, corners: [.topLeft]) | ||
92 | + .frame(width:self.uiscreen.width) | ||
93 | + .frame(maxHeight: .infinity) | ||
94 | + } | ||
95 | + .edgesIgnoringSafeArea([.bottom]) | ||
96 | + .frame(width:self.uiscreen.width) | ||
97 | + .frame(maxHeight: .infinity) | ||
98 | + } | ||
99 | +} | ||
100 | +#endif | ||
101 | + | ||
102 | +//@available(iOS 13.0.0, *) | ||
103 | +//struct CampaignWebview_Previews: PreviewProvider { | ||
104 | +// static var previews: some View { | ||
105 | +// | ||
106 | +// CampaignWebview() | ||
107 | +// | ||
108 | +// } | ||
109 | +//} |
1 | +// | ||
2 | +// CampaignWebviewInterface.swift | ||
3 | +// WarplySDKFrameworkIOS | ||
4 | +// | ||
5 | +// Created by Manos Chorianopoulos on 20/4/22. | ||
6 | +// | ||
7 | + | ||
8 | +import Foundation | ||
9 | +import SwiftUI | ||
10 | + | ||
11 | +@available(iOS 13.0.0, *) | ||
12 | +@objc public class CampaignViewInterface : NSObject { | ||
13 | + | ||
14 | + @objc(campaignViewController::) static public func campaignViewController(parentView: UIView?, campaign: String?) -> UIViewController { | ||
15 | + return UIHostingController(rootView: CampaignWebview(parentView: parentView!, campaign: campaign ?? "")) | ||
16 | + } | ||
17 | + | ||
18 | +} |
-
Please register or login to post a comment