diff --git a/demos/ios-webview/procaptcha.xcodeproj/project.pbxproj b/demos/ios-webview/procaptcha.xcodeproj/project.pbxproj index f5ba2f6c3c..eafc943803 100644 --- a/demos/ios-webview/procaptcha.xcodeproj/project.pbxproj +++ b/demos/ios-webview/procaptcha.xcodeproj/project.pbxproj @@ -11,6 +11,7 @@ 6093CEA72CA96BB9006699D1 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6093CEA62CA96BB9006699D1 /* ContentView.swift */; }; 6093CEA92CA96BBD006699D1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6093CEA82CA96BBD006699D1 /* Assets.xcassets */; }; 6093CEAD2CA96BBD006699D1 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6093CEAC2CA96BBD006699D1 /* Preview Assets.xcassets */; }; + CE79A1EA2D38EC2200047A40 /* procaptcha.html in Resources */ = {isa = PBXBuildFile; fileRef = CE79A1E92D38EC2200047A40 /* procaptcha.html */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -20,6 +21,7 @@ 6093CEA82CA96BBD006699D1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 6093CEAA2CA96BBD006699D1 /* procaptcha.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = procaptcha.entitlements; sourceTree = ""; }; 6093CEAC2CA96BBD006699D1 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + CE79A1E92D38EC2200047A40 /* procaptcha.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = procaptcha.html; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -55,6 +57,7 @@ 6093CEA42CA96BB9006699D1 /* procaptchaApp.swift */, 6093CEA62CA96BB9006699D1 /* ContentView.swift */, 6093CEA82CA96BBD006699D1 /* Assets.xcassets */, + CE79A1E92D38EC2200047A40 /* procaptcha.html */, 6093CEAA2CA96BBD006699D1 /* procaptcha.entitlements */, 6093CEAB2CA96BBD006699D1 /* Preview Content */, ); @@ -127,6 +130,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + CE79A1EA2D38EC2200047A40 /* procaptcha.html in Resources */, 6093CEAD2CA96BBD006699D1 /* Preview Assets.xcassets in Resources */, 6093CEA92CA96BBD006699D1 /* Assets.xcassets in Resources */, ); @@ -282,6 +286,7 @@ "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 13.3; MARKETING_VERSION = 1.0; + NSExceptionAllInsecureHTTPLoads = YES; PRODUCT_BUNDLE_IDENTIFIER = io.prosopo.procaptcha; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; @@ -320,6 +325,7 @@ "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 13.3; MARKETING_VERSION = 1.0; + NSExceptionAllInsecureHTTPLoads = YES; PRODUCT_BUNDLE_IDENTIFIER = io.prosopo.procaptcha; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; diff --git a/demos/ios-webview/procaptcha.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/demos/ios-webview/procaptcha.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000000..0c67376eba --- /dev/null +++ b/demos/ios-webview/procaptcha.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,5 @@ + + + + + diff --git a/demos/ios-webview/procaptcha.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate b/demos/ios-webview/procaptcha.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000000..b735c8fd07 Binary files /dev/null and b/demos/ios-webview/procaptcha.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/demos/ios-webview/procaptcha.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/WorkspaceSettings.xcsettings b/demos/ios-webview/procaptcha.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/WorkspaceSettings.xcsettings new file mode 100644 index 0000000000..bbfef027f2 --- /dev/null +++ b/demos/ios-webview/procaptcha.xcodeproj/project.xcworkspace/xcuserdata/user.xcuserdatad/WorkspaceSettings.xcsettings @@ -0,0 +1,14 @@ + + + + + BuildLocationStyle + UseAppPreferences + CustomBuildLocationType + RelativeToDerivedData + DerivedDataLocationStyle + Default + ShowSharedSchemesAutomaticallyEnabled + + + diff --git a/demos/ios-webview/procaptcha.xcodeproj/xcuserdata/user.xcuserdatad/xcschemes/xcschememanagement.plist b/demos/ios-webview/procaptcha.xcodeproj/xcuserdata/user.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000000..68f807e837 --- /dev/null +++ b/demos/ios-webview/procaptcha.xcodeproj/xcuserdata/user.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + procaptcha.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/demos/ios-webview/procaptcha/ContentView.swift b/demos/ios-webview/procaptcha/ContentView.swift index 8bf7575c9e..74bc68952b 100644 --- a/demos/ios-webview/procaptcha/ContentView.swift +++ b/demos/ios-webview/procaptcha/ContentView.swift @@ -2,7 +2,7 @@ import SwiftUI import WebKit struct WebView: UIViewRepresentable { - let htmlString: String + let filePath: String func makeCoordinator() -> Coordinator { return Coordinator(self) @@ -49,8 +49,10 @@ struct WebView: UIViewRepresentable { webView.isInspectable = true //DispatchQueue.main.asyncAfter(deadline: .now() + 30) { - // baseURL must be set for localstorage to work. If localstorage is not required, it can be set to nil. Localstorage errors appear like "SecurityError: The operation is insecure." - webView.loadHTMLString(htmlString, baseURL: URL(string: "https://prosopo.io")) + guard let fileUrl = Bundle.main.url(forResource: filePath, withExtension: nil) else { + fatalError("html file \(filePath) not found") + } + webView.loadFileURL(fileUrl, allowingReadAccessTo: fileUrl.deletingLastPathComponent()) //} return webView @@ -89,25 +91,7 @@ struct ContentView: View { var body: some View { VStack { Text("Demo Procaptcha:") - WebView(htmlString: """ - - -Procaptcha - - - - -
- - -

image

-
-
- -
- - -""") + WebView(filePath: "procaptcha.html") } .padding() } diff --git a/demos/ios-webview/procaptcha/procaptcha.html b/demos/ios-webview/procaptcha/procaptcha.html new file mode 100644 index 0000000000..b8b83de5c6 --- /dev/null +++ b/demos/ios-webview/procaptcha/procaptcha.html @@ -0,0 +1,17 @@ +
+ +Procaptcha + + + + +
+ + +
+
+ +
+ + +