Showing
6 changed files
with
140 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 */; }; |
| ... | @@ -134,6 +136,8 @@ | ... | @@ -134,6 +136,8 @@ |
| 134 | 136 | ||
| 135 | /* Begin PBXFileReference section */ | 137 | /* Begin PBXFileReference section */ |
| 136 | 1353B8C484CC0649CAC2EB74 /* Pods_WarplySDKFrameworkIOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_WarplySDKFrameworkIOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; | 138 | 1353B8C484CC0649CAC2EB74 /* Pods_WarplySDKFrameworkIOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_WarplySDKFrameworkIOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; |
| 139 | + 1E735FF1281067320050A298 /* CampaignWebview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CampaignWebview.swift; sourceTree = "<group>"; }; | ||
| 140 | + 1E735FF32810681E0050A298 /* CampaignWebviewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CampaignWebviewInterface.swift; sourceTree = "<group>"; }; | ||
| 137 | 1EBEB02C280D69D800BF802C /* GiftsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GiftsView.swift; sourceTree = "<group>"; }; | 141 | 1EBEB02C280D69D800BF802C /* GiftsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GiftsView.swift; sourceTree = "<group>"; }; |
| 138 | 1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GiftsViewInterface.swift; sourceTree = "<group>"; }; | 142 | 1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GiftsViewInterface.swift; sourceTree = "<group>"; }; |
| 139 | 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>"; }; | 143 | 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>"; }; |
| ... | @@ -323,6 +327,8 @@ | ... | @@ -323,6 +327,8 @@ |
| 323 | E639EFA0280810E300B9DD94 /* CouponsView.swift */, | 327 | E639EFA0280810E300B9DD94 /* CouponsView.swift */, |
| 324 | E639EFA1280810E300B9DD94 /* CouponsViewInterface.swift */, | 328 | E639EFA1280810E300B9DD94 /* CouponsViewInterface.swift */, |
| 325 | 1EBEB02C280D69D800BF802C /* GiftsView.swift */, | 329 | 1EBEB02C280D69D800BF802C /* GiftsView.swift */, |
| 330 | + 1E735FF1281067320050A298 /* CampaignWebview.swift */, | ||
| 331 | + 1E735FF32810681E0050A298 /* CampaignWebviewInterface.swift */, | ||
| 326 | 1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */, | 332 | 1EBEB02E280D6AA500BF802C /* GiftsViewInterface.swift */, |
| 327 | E6D8DF5E27A9429E0006A3A9 /* MyApi.h */, | 333 | E6D8DF5E27A9429E0006A3A9 /* MyApi.h */, |
| 328 | E6D8DF5C27A9429E0006A3A9 /* MyApi.m */, | 334 | E6D8DF5C27A9429E0006A3A9 /* MyApi.m */, |
| ... | @@ -730,10 +736,12 @@ | ... | @@ -730,10 +736,12 @@ |
| 730 | E6D8DF5727A942920006A3A9 /* FMResultSet.m in Sources */, | 736 | E6D8DF5727A942920006A3A9 /* FMResultSet.m in Sources */, |
| 731 | E6D8DF3A27A942920006A3A9 /* UIButton+AFNetworking.m in Sources */, | 737 | E6D8DF3A27A942920006A3A9 /* UIButton+AFNetworking.m in Sources */, |
| 732 | E6D8DF0627A942920006A3A9 /* WLBeacon.m in Sources */, | 738 | E6D8DF0627A942920006A3A9 /* WLBeacon.m in Sources */, |
| 739 | + 1E735FF2281067320050A298 /* CampaignWebview.swift in Sources */, | ||
| 733 | E6D8DF2927A942920006A3A9 /* NSData+SSToolkitAdditions.m in Sources */, | 740 | E6D8DF2927A942920006A3A9 /* NSData+SSToolkitAdditions.m in Sources */, |
| 734 | 1EBEB02D280D69D800BF802C /* GiftsView.swift in Sources */, | 741 | 1EBEB02D280D69D800BF802C /* GiftsView.swift in Sources */, |
| 735 | E6D8DEFC27A942920006A3A9 /* WLCustomNativeAdTableViewCell.m in Sources */, | 742 | E6D8DEFC27A942920006A3A9 /* WLCustomNativeAdTableViewCell.m in Sources */, |
| 736 | E6EA2F702806E8C200EC4CF5 /* Coupons.swift in Sources */, | 743 | E6EA2F702806E8C200EC4CF5 /* Coupons.swift in Sources */, |
| 744 | + 1E735FF42810681E0050A298 /* CampaignWebviewInterface.swift in Sources */, | ||
| 737 | E639EFA3280810E300B9DD94 /* CouponsViewInterface.swift in Sources */, | 745 | E639EFA3280810E300B9DD94 /* CouponsViewInterface.swift in Sources */, |
| 738 | 1EBEB02F280D6AA500BF802C /* GiftsViewInterface.swift in Sources */, | 746 | 1EBEB02F280D6AA500BF802C /* GiftsViewInterface.swift in Sources */, |
| 739 | E6D8DF4A27A942920006A3A9 /* AFNetworkReachabilityManager.m in Sources */, | 747 | E6D8DF4A27A942920006A3A9 /* AFNetworkReachabilityManager.m 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") | ||
| 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 | +} |
| ... | @@ -17,6 +17,7 @@ | ... | @@ -17,6 +17,7 @@ |
| 17 | - (void) setLang:(NSString*) lang; | 17 | - (void) setLang:(NSString*) lang; |
| 18 | - (UIViewController *) openCoupons:(UIView*) parentView; | 18 | - (UIViewController *) openCoupons:(UIView*) parentView; |
| 19 | - (UIViewController *) openGifts:(UIView*) parentView; | 19 | - (UIViewController *) openGifts:(UIView*) parentView; |
| 20 | +- (UIViewController *) openCampaign:(UIView*) parentView campaign:(NSString*) campaign; | ||
| 20 | - (void) applicationDidEnterBackground:(UIApplication *)application; | 21 | - (void) applicationDidEnterBackground:(UIApplication *)application; |
| 21 | - (void) applicationWillEnterForeground:(UIApplication *)application; | 22 | - (void) applicationWillEnterForeground:(UIApplication *)application; |
| 22 | - (void) applicationDidBecomeActive:(UIApplication *)application; | 23 | - (void) applicationDidBecomeActive:(UIApplication *)application; | ... | ... |
| ... | @@ -58,6 +58,10 @@ NSString *LANG; | ... | @@ -58,6 +58,10 @@ NSString *LANG; |
| 58 | return giftsViewController; | 58 | return giftsViewController; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | +- (UIViewController *) openCampaign:(UIView*) parentView campaign:(NSString*) campaign; { | ||
| 62 | + UIViewController *campaignViewController = [CampaignViewInterface campaignViewController:parentView:campaign]; | ||
| 63 | + return campaignViewController; | ||
| 64 | +} | ||
| 61 | 65 | ||
| 62 | /////////////////////////////////////////////////////////////////////////////////////////////////// | 66 | /////////////////////////////////////////////////////////////////////////////////////////////////// |
| 63 | - (void)applicationDidEnterBackground:(UIApplication *)application | 67 | - (void)applicationDidEnterBackground:(UIApplication *)application | ... | ... |
-
Please register or login to post a comment