diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index f498473..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,79 +0,0 @@ -# 1.6.0 - -- RxSwift 6.0.0 support (#101) -- Feature: added 2 new cases to ReCaptchaError (`.responseExpired` and `.failedRender`) (#79) - -- Fix: retire JS arrow functions in favor of standard functions (#78) - -# 1.5.0 - -- Swift 5.0 support -- Feature: `didFinishLoading` callback notifier - -- Fix: Resources loading validation (#72 #56 #60) - -# 1.4.2 - -- Fix: Webview's resource loading detection (#56 #60) - -# 1.4.1 - -- Fix RxSwift dependency version (#58) - -# 1.4 - -- Feature: Support Swift 4.2 -- Feature: enable validation to be skipped for testing - -# 1.3.1 - -- Fix: Removing leftover print -- Fix: Removing Result dependency from Carthage - -# 1.3 - -- Feature: Locale support (#39) - -- Fix: Reset not flagging ReCaptha as ready-to-execute (#36) -- Fix: Multiple configure calls after app being idle (#40) - -# 1.2 - -- Feature: Resettable ReCaptchas. (#23) -- Feature: Forcing visible challenge on DEBUG. (#19) - -- Fix: Better encapsulation architecture. -- Fix: Retiring Result dependency. (#24) -- Fix: `validate` completion closure being called consecutively. (#29) -- Fix: `configureWebView` being called multiple times. (#31) - -# 1.1 - -- Fix: better logging for when protocol isn't found on -- Fix: Alternate endpoint not loading -- Fix: Prepends a scheme if `baseURL` doesn't have one - -# 1.0.2 - -- Fix: Better detection of resources loading end (#16) - -# 1.0.1 - -- Fix: Webview content being dismissed when clicking outside of div frame area (#14) - -# 1.0.0 - -- Swift 4 support - -# 0.3.0 - -- Carthage support -- Refactored framework errors -- Alternate endpoint to bypass firewall limitations (#10) -- Fix: JS not loaded (#7) -- Fix: Wrong Domain retrieving (#6) - -# 0.2.0 - -- Removing `presenterView` from ReCaptchaWebViewManager -- Adding view to `validate(on:)` parameters diff --git a/Cartfile b/Cartfile deleted file mode 100644 index bcb3591..0000000 --- a/Cartfile +++ /dev/null @@ -1 +0,0 @@ -github "ReactiveX/RxSwift" ~> 6.0 diff --git a/Cartfile.resolved b/Cartfile.resolved deleted file mode 100644 index c07923a..0000000 --- a/Cartfile.resolved +++ /dev/null @@ -1 +0,0 @@ -github "ReactiveX/RxSwift" "6.0.0" diff --git a/Example/Podfile b/Example/Podfile deleted file mode 100644 index 20ff1b9..0000000 --- a/Example/Podfile +++ /dev/null @@ -1,33 +0,0 @@ -platform :ios, 9.0 - -use_frameworks! -inhibit_all_warnings! - -target 'ReCaptcha_Example' do - pod 'ReCaptcha/RxSwift', :path => '../' - pod 'RxCocoa', '~> 6.0' - pod 'SwiftLint', '~> 0.33' - - target 'ReCaptcha_Tests' do - inherit! :search_paths - - pod 'AppSwizzle', '~> 1.3' - pod 'RxBlocking', '~> 6.0' - end - - target 'ReCaptcha_UITests' do - inherit! :search_paths - end -end - -post_install do |i| - target = File.join(Dir.pwd, "../.git/hooks/pre-push") - unless File.symlink?(target) - puts "Installing git hook for pre-push" - - begin - File.symlink(File.join(Dir.pwd, "../pre-push.sh"), target) - rescue => exc - end - end -end diff --git a/Example/Podfile.lock b/Example/Podfile.lock deleted file mode 100644 index e957acb..0000000 --- a/Example/Podfile.lock +++ /dev/null @@ -1,48 +0,0 @@ -PODS: - - AppSwizzle (1.3.1) - - ReCaptcha/Core (1.6.0) - - ReCaptcha/RxSwift (1.6.0): - - ReCaptcha/Core - - RxSwift (~> 6.0) - - RxBlocking (6.0.0): - - RxSwift (= 6.0.0) - - RxCocoa (6.0.0): - - RxRelay (= 6.0.0) - - RxSwift (= 6.0.0) - - RxRelay (6.0.0): - - RxSwift (= 6.0.0) - - RxSwift (6.0.0) - - SwiftLint (0.33.0) - -DEPENDENCIES: - - AppSwizzle (~> 1.3) - - ReCaptcha/RxSwift (from `../`) - - RxBlocking (~> 6.0) - - RxCocoa (~> 6.0) - - SwiftLint (~> 0.33) - -SPEC REPOS: - trunk: - - AppSwizzle - - RxBlocking - - RxCocoa - - RxRelay - - RxSwift - - SwiftLint - -EXTERNAL SOURCES: - ReCaptcha: - :path: "../" - -SPEC CHECKSUMS: - AppSwizzle: db36e436f56110d93e5ae0147683435df593cabc - ReCaptcha: d493ed256054a7b6a7eabcaf0b47ec9a8f42a16e - RxBlocking: c025b8c6fe08c5b18c039b5b11d41ec413f8a59e - RxCocoa: 3f79328fafa3645b34600f37c31e64c73ae3a80e - RxRelay: 8d593be109c06ea850df027351beba614b012ffb - RxSwift: c14e798c59b9f6e9a2df8fd235602e85cc044295 - SwiftLint: fed9c66336e41fc74dc48a73678380718f0c8b0e - -PODFILE CHECKSUM: 927f56f754e86345b695231d8b5f252ec7c18b35 - -COCOAPODS: 1.10.0 diff --git a/Example/ReCaptcha.xcodeproj/project.pbxproj b/Example/ReCaptcha.xcodeproj/project.pbxproj deleted file mode 100644 index cc4a8ce..0000000 --- a/Example/ReCaptcha.xcodeproj/project.pbxproj +++ /dev/null @@ -1,862 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; }; - 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; }; - 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; }; - 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; }; - 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; }; - 9D85E832734B73CFBD0156E0 /* Pods_ReCaptcha_UITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B4C17A11F39B6DC940891AE0 /* Pods_ReCaptcha_UITests.framework */; }; - BD850CB2DF4C9C94FC51226C /* Pods_ReCaptcha_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 62BEEA62161F672468CCFD64 /* Pods_ReCaptcha_Example.framework */; }; - D091B6E053FD250B4757E34C /* Pods_ReCaptcha_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9417A28DC340FF0BC1627B3F /* Pods_ReCaptcha_Tests.framework */; }; - F206BAD51F8D3FEB00A25807 /* Cartfile in Resources */ = {isa = PBXBuildFile; fileRef = F206BAD41F8D3FEB00A25807 /* Cartfile */; }; - F211C22220F7E0B100709B26 /* ReCaptcha_Endpoint__Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F211C22120F7E0B100709B26 /* ReCaptcha_Endpoint__Tests.swift */; }; - F231B3971FEC325A00F82943 /* DispatchQueue__Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F231B3961FEC325A00F82943 /* DispatchQueue__Tests.swift */; }; - F231B39F1FED4A8C00F82943 /* ReCaptchaDecoder+Helper.swift in Sources */ = {isa = PBXBuildFile; fileRef = F231B39E1FED4A8C00F82943 /* ReCaptchaDecoder+Helper.swift */; }; - F288E9451F9537760018688D /* ReCaptchaError+Equatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F288E9441F9537760018688D /* ReCaptchaError+Equatable.swift */; }; - F28FAC9F200E425600E14987 /* ReCaptcha_UITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F28FAC9E200E425600E14987 /* ReCaptcha_UITests.swift */; }; - F2AE8612204F3430002E28D7 /* ReCaptchaResult__Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2AE8611204F3430002E28D7 /* ReCaptchaResult__Tests.swift */; }; - F2E2685E1F7AEE3400CD876D /* ReCaptcha__Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2E2685D1F7AEE3400CD876D /* ReCaptcha__Tests.swift */; }; - F2ECCF8A1E9FCEFE0097B199 /* ReCaptchaDecoder__Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2ECCF891E9FCEFE0097B199 /* ReCaptchaDecoder__Tests.swift */; }; - F2ECCF8C1E9FE37C0097B199 /* mock.html in Resources */ = {isa = PBXBuildFile; fileRef = F2ECCF8B1E9FE37C0097B199 /* mock.html */; }; - F2ECCF8E1E9FE68C0097B199 /* ReCaptchaWebViewManager__Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2ECCF8D1E9FE68C0097B199 /* ReCaptchaWebViewManager__Tests.swift */; }; - F2ECCF931EA009360097B199 /* ReCaptcha+Rx__Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2ECCF921EA009360097B199 /* ReCaptcha+Rx__Tests.swift */; }; - F2ECCF961EA00A5B0097B199 /* ReCaptchaWebViewManager+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2ECCF951EA00A5B0097B199 /* ReCaptchaWebViewManager+Helpers.swift */; }; - F2ECCF981EA011370097B199 /* Result+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2ECCF971EA011370097B199 /* Result+Helpers.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - F28FACA1200E425600E14987 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 607FACC81AFB9204008FA782 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 607FACCF1AFB9204008FA782; - remoteInfo = ReCaptcha_Example; - }; - F2ECCF7B1E9FC47B0097B199 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 607FACC81AFB9204008FA782 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 607FACCF1AFB9204008FA782; - remoteInfo = ReCaptcha_Example; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 0A2D0E5B4C6E445BF971488B /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; - 44568771DD76CFBDF2D1C83D /* Pods-ReCaptcha_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReCaptcha_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-ReCaptcha_Tests/Pods-ReCaptcha_Tests.release.xcconfig"; sourceTree = ""; }; - 4A242A5E18CBBFA095B66558 /* Pods-ReCaptcha_UITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReCaptcha_UITests.release.xcconfig"; path = "Pods/Target Support Files/Pods-ReCaptcha_UITests/Pods-ReCaptcha_UITests.release.xcconfig"; sourceTree = ""; }; - 4FED8267564AACFFEE83DB15 /* Pods-ReCaptcha_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReCaptcha_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ReCaptcha_Tests/Pods-ReCaptcha_Tests.debug.xcconfig"; sourceTree = ""; }; - 607FACD01AFB9204008FA782 /* ReCaptcha_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ReCaptcha_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 607FACD71AFB9204008FA782 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; - 607FACDA1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - 607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; - 62BEEA62161F672468CCFD64 /* Pods_ReCaptcha_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ReCaptcha_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 62C1DD0E80E9920845E5DA51 /* ReCaptcha.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = ReCaptcha.podspec; path = ../ReCaptcha.podspec; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; - 80FF4E03D71AACBD81A36301 /* Pods-ReCaptcha_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReCaptcha_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ReCaptcha_Example/Pods-ReCaptcha_Example.debug.xcconfig"; sourceTree = ""; }; - 930BD5ACA20B973070B89ACF /* Pods-ReCaptcha_UITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReCaptcha_UITests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ReCaptcha_UITests/Pods-ReCaptcha_UITests.debug.xcconfig"; sourceTree = ""; }; - 9417A28DC340FF0BC1627B3F /* Pods_ReCaptcha_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ReCaptcha_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - B4C17A11F39B6DC940891AE0 /* Pods_ReCaptcha_UITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ReCaptcha_UITests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - C2A0BDD35B5E219129E9BC65 /* Pods-ReCaptcha_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReCaptcha_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-ReCaptcha_Example/Pods-ReCaptcha_Example.release.xcconfig"; sourceTree = ""; }; - C8537003ECC47117AF54DCA9 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; - F206BAD41F8D3FEB00A25807 /* Cartfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Cartfile; path = ../Cartfile; sourceTree = ""; }; - F211C22120F7E0B100709B26 /* ReCaptcha_Endpoint__Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReCaptcha_Endpoint__Tests.swift; sourceTree = ""; }; - F21901D91F98D62F00D8E2C9 /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = CHANGELOG.md; path = ../CHANGELOG.md; sourceTree = ""; }; - F231B3961FEC325A00F82943 /* DispatchQueue__Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DispatchQueue__Tests.swift; sourceTree = ""; }; - F231B39E1FED4A8C00F82943 /* ReCaptchaDecoder+Helper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ReCaptchaDecoder+Helper.swift"; sourceTree = ""; }; - F288E9441F9537760018688D /* ReCaptchaError+Equatable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ReCaptchaError+Equatable.swift"; sourceTree = ""; }; - F28FAC9C200E425600E14987 /* ReCaptcha_UITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ReCaptcha_UITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - F28FAC9E200E425600E14987 /* ReCaptcha_UITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReCaptcha_UITests.swift; sourceTree = ""; }; - F28FACA0200E425600E14987 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - F2AE8611204F3430002E28D7 /* ReCaptchaResult__Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReCaptchaResult__Tests.swift; sourceTree = ""; }; - F2E2685D1F7AEE3400CD876D /* ReCaptcha__Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReCaptcha__Tests.swift; sourceTree = ""; }; - F2ECCF761E9FC47B0097B199 /* ReCaptcha_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ReCaptcha_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - F2ECCF7A1E9FC47B0097B199 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - F2ECCF891E9FCEFE0097B199 /* ReCaptchaDecoder__Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReCaptchaDecoder__Tests.swift; sourceTree = ""; }; - F2ECCF8B1E9FE37C0097B199 /* mock.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = mock.html; sourceTree = ""; }; - F2ECCF8D1E9FE68C0097B199 /* ReCaptchaWebViewManager__Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReCaptchaWebViewManager__Tests.swift; sourceTree = ""; }; - F2ECCF921EA009360097B199 /* ReCaptcha+Rx__Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ReCaptcha+Rx__Tests.swift"; sourceTree = ""; }; - F2ECCF951EA00A5B0097B199 /* ReCaptchaWebViewManager+Helpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ReCaptchaWebViewManager+Helpers.swift"; sourceTree = ""; }; - F2ECCF971EA011370097B199 /* Result+Helpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Result+Helpers.swift"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 607FACCD1AFB9204008FA782 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - BD850CB2DF4C9C94FC51226C /* Pods_ReCaptcha_Example.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F28FAC99200E425600E14987 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9D85E832734B73CFBD0156E0 /* Pods_ReCaptcha_UITests.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F2ECCF731E9FC47B0097B199 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - D091B6E053FD250B4757E34C /* Pods_ReCaptcha_Tests.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 607FACC71AFB9204008FA782 = { - isa = PBXGroup; - children = ( - 607FACF51AFB993E008FA782 /* Podspec Metadata */, - 607FACD21AFB9204008FA782 /* Example for ReCaptcha */, - F2ECCF771E9FC47B0097B199 /* ReCaptcha_Tests */, - F28FAC9D200E425600E14987 /* ReCaptcha_UITests */, - 607FACD11AFB9204008FA782 /* Products */, - 716E2370DBF48D5E2C86E802 /* Pods */, - FDC29111B59FAB9F0F44DADB /* Frameworks */, - ); - sourceTree = ""; - }; - 607FACD11AFB9204008FA782 /* Products */ = { - isa = PBXGroup; - children = ( - 607FACD01AFB9204008FA782 /* ReCaptcha_Example.app */, - F2ECCF761E9FC47B0097B199 /* ReCaptcha_Tests.xctest */, - F28FAC9C200E425600E14987 /* ReCaptcha_UITests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - 607FACD21AFB9204008FA782 /* Example for ReCaptcha */ = { - isa = PBXGroup; - children = ( - 607FACD51AFB9204008FA782 /* AppDelegate.swift */, - 607FACD71AFB9204008FA782 /* ViewController.swift */, - 607FACD91AFB9204008FA782 /* Main.storyboard */, - 607FACDC1AFB9204008FA782 /* Images.xcassets */, - 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */, - 607FACD31AFB9204008FA782 /* Supporting Files */, - ); - name = "Example for ReCaptcha"; - path = ReCaptcha; - sourceTree = ""; - }; - 607FACD31AFB9204008FA782 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 607FACD41AFB9204008FA782 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 607FACF51AFB993E008FA782 /* Podspec Metadata */ = { - isa = PBXGroup; - children = ( - 62C1DD0E80E9920845E5DA51 /* ReCaptcha.podspec */, - F206BAD41F8D3FEB00A25807 /* Cartfile */, - 0A2D0E5B4C6E445BF971488B /* README.md */, - C8537003ECC47117AF54DCA9 /* LICENSE */, - F21901D91F98D62F00D8E2C9 /* CHANGELOG.md */, - ); - name = "Podspec Metadata"; - sourceTree = ""; - }; - 716E2370DBF48D5E2C86E802 /* Pods */ = { - isa = PBXGroup; - children = ( - 80FF4E03D71AACBD81A36301 /* Pods-ReCaptcha_Example.debug.xcconfig */, - C2A0BDD35B5E219129E9BC65 /* Pods-ReCaptcha_Example.release.xcconfig */, - 4FED8267564AACFFEE83DB15 /* Pods-ReCaptcha_Tests.debug.xcconfig */, - 44568771DD76CFBDF2D1C83D /* Pods-ReCaptcha_Tests.release.xcconfig */, - 930BD5ACA20B973070B89ACF /* Pods-ReCaptcha_UITests.debug.xcconfig */, - 4A242A5E18CBBFA095B66558 /* Pods-ReCaptcha_UITests.release.xcconfig */, - ); - name = Pods; - sourceTree = ""; - }; - F28FAC9D200E425600E14987 /* ReCaptcha_UITests */ = { - isa = PBXGroup; - children = ( - F28FAC9E200E425600E14987 /* ReCaptcha_UITests.swift */, - F28FACA0200E425600E14987 /* Info.plist */, - ); - path = ReCaptcha_UITests; - sourceTree = ""; - }; - F2ECCF771E9FC47B0097B199 /* ReCaptcha_Tests */ = { - isa = PBXGroup; - children = ( - F2ECCF8B1E9FE37C0097B199 /* mock.html */, - F2ECCF821E9FC4AC0097B199 /* Core */, - F2ECCF911EA009220097B199 /* RxSwift */, - F2ECCF941EA00A4A0097B199 /* Helpers */, - F2ECCF7A1E9FC47B0097B199 /* Info.plist */, - ); - path = ReCaptcha_Tests; - sourceTree = ""; - }; - F2ECCF821E9FC4AC0097B199 /* Core */ = { - isa = PBXGroup; - children = ( - F2ECCF891E9FCEFE0097B199 /* ReCaptchaDecoder__Tests.swift */, - F2ECCF8D1E9FE68C0097B199 /* ReCaptchaWebViewManager__Tests.swift */, - F2E2685D1F7AEE3400CD876D /* ReCaptcha__Tests.swift */, - F231B3961FEC325A00F82943 /* DispatchQueue__Tests.swift */, - F2AE8611204F3430002E28D7 /* ReCaptchaResult__Tests.swift */, - F211C22120F7E0B100709B26 /* ReCaptcha_Endpoint__Tests.swift */, - ); - path = Core; - sourceTree = ""; - }; - F2ECCF911EA009220097B199 /* RxSwift */ = { - isa = PBXGroup; - children = ( - F2ECCF921EA009360097B199 /* ReCaptcha+Rx__Tests.swift */, - ); - path = RxSwift; - sourceTree = ""; - }; - F2ECCF941EA00A4A0097B199 /* Helpers */ = { - isa = PBXGroup; - children = ( - F2ECCF951EA00A5B0097B199 /* ReCaptchaWebViewManager+Helpers.swift */, - F2ECCF971EA011370097B199 /* Result+Helpers.swift */, - F288E9441F9537760018688D /* ReCaptchaError+Equatable.swift */, - F231B39E1FED4A8C00F82943 /* ReCaptchaDecoder+Helper.swift */, - ); - path = Helpers; - sourceTree = ""; - }; - FDC29111B59FAB9F0F44DADB /* Frameworks */ = { - isa = PBXGroup; - children = ( - 62BEEA62161F672468CCFD64 /* Pods_ReCaptcha_Example.framework */, - 9417A28DC340FF0BC1627B3F /* Pods_ReCaptcha_Tests.framework */, - B4C17A11F39B6DC940891AE0 /* Pods_ReCaptcha_UITests.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 607FACCF1AFB9204008FA782 /* ReCaptcha_Example */ = { - isa = PBXNativeTarget; - buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "ReCaptcha_Example" */; - buildPhases = ( - 51299F67A8756E2B3EAE411A /* [CP] Check Pods Manifest.lock */, - 607FACCC1AFB9204008FA782 /* Sources */, - 607FACCD1AFB9204008FA782 /* Frameworks */, - 607FACCE1AFB9204008FA782 /* Resources */, - 8F03FFB3F5C55E873C23C682 /* [CP] Embed Pods Frameworks */, - F231B3981FEC3B7F00F82943 /* SwiftLint */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = ReCaptcha_Example; - productName = ReCaptcha; - productReference = 607FACD01AFB9204008FA782 /* ReCaptcha_Example.app */; - productType = "com.apple.product-type.application"; - }; - F28FAC9B200E425600E14987 /* ReCaptcha_UITests */ = { - isa = PBXNativeTarget; - buildConfigurationList = F28FACA5200E425600E14987 /* Build configuration list for PBXNativeTarget "ReCaptcha_UITests" */; - buildPhases = ( - B8A66872166B84DAD39A3E1F /* [CP] Check Pods Manifest.lock */, - F28FAC98200E425600E14987 /* Sources */, - F28FAC99200E425600E14987 /* Frameworks */, - F28FAC9A200E425600E14987 /* Resources */, - F28FACA6200E447600E14987 /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - F28FACA2200E425600E14987 /* PBXTargetDependency */, - ); - name = ReCaptcha_UITests; - productName = ReCaptcha_UITests; - productReference = F28FAC9C200E425600E14987 /* ReCaptcha_UITests.xctest */; - productType = "com.apple.product-type.bundle.ui-testing"; - }; - F2ECCF751E9FC47B0097B199 /* ReCaptcha_Tests */ = { - isa = PBXNativeTarget; - buildConfigurationList = F2ECCF7D1E9FC47B0097B199 /* Build configuration list for PBXNativeTarget "ReCaptcha_Tests" */; - buildPhases = ( - DDB47454887253730AB35230 /* [CP] Check Pods Manifest.lock */, - F2ECCF721E9FC47B0097B199 /* Sources */, - F2ECCF731E9FC47B0097B199 /* Frameworks */, - F2ECCF741E9FC47B0097B199 /* Resources */, - 77003100630E7783A936C451 /* [CP] Embed Pods Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - F2ECCF7C1E9FC47B0097B199 /* PBXTargetDependency */, - ); - name = ReCaptcha_Tests; - productName = ReCaptcha_Tests; - productReference = F2ECCF761E9FC47B0097B199 /* ReCaptcha_Tests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 607FACC81AFB9204008FA782 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0910; - LastUpgradeCheck = 0900; - ORGANIZATIONNAME = ReCaptcha; - TargetAttributes = { - 607FACCF1AFB9204008FA782 = { - CreatedOnToolsVersion = 6.3.1; - DevelopmentTeam = 58EEZG76L8; - LastSwiftMigration = 1020; - ProvisioningStyle = Manual; - }; - F28FAC9B200E425600E14987 = { - CreatedOnToolsVersion = 9.1; - LastSwiftMigration = 1020; - ProvisioningStyle = Automatic; - TestTargetID = 607FACCF1AFB9204008FA782; - }; - F2ECCF751E9FC47B0097B199 = { - CreatedOnToolsVersion = 8.3; - LastSwiftMigration = 1020; - ProvisioningStyle = Automatic; - TestTargetID = 607FACCF1AFB9204008FA782; - }; - }; - }; - buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "ReCaptcha" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - English, - en, - Base, - ); - mainGroup = 607FACC71AFB9204008FA782; - productRefGroup = 607FACD11AFB9204008FA782 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 607FACCF1AFB9204008FA782 /* ReCaptcha_Example */, - F2ECCF751E9FC47B0097B199 /* ReCaptcha_Tests */, - F28FAC9B200E425600E14987 /* ReCaptcha_UITests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 607FACCE1AFB9204008FA782 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - F206BAD51F8D3FEB00A25807 /* Cartfile in Resources */, - 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */, - 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */, - 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F28FAC9A200E425600E14987 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F2ECCF741E9FC47B0097B199 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - F2ECCF8C1E9FE37C0097B199 /* mock.html in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 51299F67A8756E2B3EAE411A /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-ReCaptcha_Example-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - 77003100630E7783A936C451 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-ReCaptcha_Tests/Pods-ReCaptcha_Tests-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework", - "${BUILT_PRODUCTS_DIR}/AppSwizzle/AppSwizzle.framework", - "${BUILT_PRODUCTS_DIR}/RxBlocking/RxBlocking.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwift.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AppSwizzle.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxBlocking.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReCaptcha_Tests/Pods-ReCaptcha_Tests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 8F03FFB3F5C55E873C23C682 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-ReCaptcha_Example/Pods-ReCaptcha_Example-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/ReCaptcha/ReCaptcha.framework", - "${BUILT_PRODUCTS_DIR}/RxCocoa/RxCocoa.framework", - "${BUILT_PRODUCTS_DIR}/RxRelay/RxRelay.framework", - "${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ReCaptcha.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxCocoa.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxRelay.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwift.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReCaptcha_Example/Pods-ReCaptcha_Example-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - B8A66872166B84DAD39A3E1F /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-ReCaptcha_UITests-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - DDB47454887253730AB35230 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-ReCaptcha_Tests-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - F231B3981FEC3B7F00F82943 /* SwiftLint */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = SwiftLint; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/SwiftLint/swiftlint\" --path \"${PROJECT_DIR}/..\"\n"; - }; - F28FACA6200E447600E14987 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "# Unfortuantely, Xcode 7.3 and Cocoapods are not yet fully compatible. The location of the xctest bundle has changed and so we need to manually copy some things ...\n# this fix is necesary - tested on Cocoapods 1.1.rc2 that still have the issue.\n# ver 0.2\n\n# set variables\nBUILD_ROOT=\"${BUILT_PRODUCTS_DIR}\"\n\nMAIN_TARGET_NAME=\"ReCaptcha_Example.app\" #if you know how to get this from here do let me know!\nMAIN_TARGET_FRAMEWORKS=\"${BUILT_PRODUCTS_DIR}/${MAIN_TARGET_NAME}/Frameworks\"\n\nTEST_TARGET_NAME=\"ReCaptcha_UITests\"\nTEST_RUNNER_TARGET_FRAMEWORKS=\"${BUILT_PRODUCTS_DIR}/${TEST_TARGET_NAME}-Runner.app\"\n\n# COPY FRAMEWORKS FROM MAIN TARGET TO TEST TARGET if framework folder exists\nif [[ -d \"${MAIN_TARGET_FRAMEWORKS}\" ]]; then\necho \"**** COPYING FRAMEWORKS FROM \\\"${MAIN_TARGET_FRAMEWORKS}\\\" TO \\\"${TEST_RUNNER_TARGET_FRAMEWORKS}\\\" ...\"\ncp -R \"${MAIN_TARGET_FRAMEWORKS}\" \"${TEST_RUNNER_TARGET_FRAMEWORKS}\"\nfi\n\n# You don't really need this section below if your script works, otherwise it is quite helpful to troubleshoot any problems with paths.\n\n# DEBUG SECTION\necho \"BUILD_ROOT : ${BUILD_ROOT}\"\necho \"MAIN_TARGET_NAME : ${MAIN_TARGET_NAME}\"\necho \"MAIN_TARGET_FRAMEWORKS ${MAIN_TARGET_FRAMEWORKS}\"\necho \"TEST_TARGET_NAME : ${TEST_TARGET_NAME}\"\necho \"TEST_RUNNER_TARGET_FRAMEWORKS : ${TEST_TARGET_FRAMEWORKS}\"\necho \"CONTENT: ${CONTENTS_FOLDER_PATH}\"\necho \"FRAMEWORK PATH: ${FRAMEWORKS_FOLDER_PATH}\"\necho \"TARGET BUILD DIR: ${TARGET_BUILD_DIR}\""; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 607FACCC1AFB9204008FA782 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */, - 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F28FAC98200E425600E14987 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - F28FAC9F200E425600E14987 /* ReCaptcha_UITests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F2ECCF721E9FC47B0097B199 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - F2AE8612204F3430002E28D7 /* ReCaptchaResult__Tests.swift in Sources */, - F2ECCF961EA00A5B0097B199 /* ReCaptchaWebViewManager+Helpers.swift in Sources */, - F2ECCF8E1E9FE68C0097B199 /* ReCaptchaWebViewManager__Tests.swift in Sources */, - F2ECCF981EA011370097B199 /* Result+Helpers.swift in Sources */, - F231B3971FEC325A00F82943 /* DispatchQueue__Tests.swift in Sources */, - F231B39F1FED4A8C00F82943 /* ReCaptchaDecoder+Helper.swift in Sources */, - F211C22220F7E0B100709B26 /* ReCaptcha_Endpoint__Tests.swift in Sources */, - F2E2685E1F7AEE3400CD876D /* ReCaptcha__Tests.swift in Sources */, - F2ECCF931EA009360097B199 /* ReCaptcha+Rx__Tests.swift in Sources */, - F288E9451F9537760018688D /* ReCaptchaError+Equatable.swift in Sources */, - F2ECCF8A1E9FCEFE0097B199 /* ReCaptchaDecoder__Tests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - F28FACA2200E425600E14987 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 607FACCF1AFB9204008FA782 /* ReCaptcha_Example */; - targetProxy = F28FACA1200E425600E14987 /* PBXContainerItemProxy */; - }; - F2ECCF7C1E9FC47B0097B199 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 607FACCF1AFB9204008FA782 /* ReCaptcha_Example */; - targetProxy = F2ECCF7B1E9FC47B0097B199 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 607FACD91AFB9204008FA782 /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 607FACDA1AFB9204008FA782 /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */ = { - isa = PBXVariantGroup; - children = ( - 607FACDF1AFB9204008FA782 /* Base */, - ); - name = LaunchScreen.xib; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 607FACED1AFB9204008FA782 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - 607FACEE1AFB9204008FA782 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 607FACF01AFB9204008FA782 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 80FF4E03D71AACBD81A36301 /* Pods-ReCaptcha_Example.debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_STYLE = Manual; - DEVELOPMENT_TEAM = 58EEZG76L8; - INFOPLIST_FILE = ReCaptcha/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MODULE_NAME = ExampleApp; - PRODUCT_BUNDLE_IDENTIFIER = "com.flaviocaetano.ReCaptcha-Example"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "Development Wildcard"; - SWIFT_VERSION = 5.0; - }; - name = Debug; - }; - 607FACF11AFB9204008FA782 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = C2A0BDD35B5E219129E9BC65 /* Pods-ReCaptcha_Example.release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_STYLE = Manual; - DEVELOPMENT_TEAM = ""; - INFOPLIST_FILE = ReCaptcha/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MODULE_NAME = ExampleApp; - PRODUCT_BUNDLE_IDENTIFIER = "com.flaviocaetano.ReCaptcha-Example"; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 5.0; - }; - name = Release; - }; - F28FACA3200E425600E14987 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 930BD5ACA20B973070B89ACF /* Pods-ReCaptcha_UITests.debug.xcconfig */; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_IDENTITY = "iPhone Developer"; - CODE_SIGN_STYLE = Automatic; - DEBUG_INFORMATION_FORMAT = dwarf; - GCC_C_LANGUAGE_STANDARD = gnu11; - INFOPLIST_FILE = ReCaptcha_UITests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "ReCaptcha.ReCaptcha-UITests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_TARGET_NAME = ReCaptcha_Example; - }; - name = Debug; - }; - F28FACA4200E425600E14987 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 4A242A5E18CBBFA095B66558 /* Pods-ReCaptcha_UITests.release.xcconfig */; - buildSettings = { - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_IDENTITY = "iPhone Developer"; - CODE_SIGN_STYLE = Automatic; - GCC_C_LANGUAGE_STANDARD = gnu11; - INFOPLIST_FILE = ReCaptcha_UITests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "ReCaptcha.ReCaptcha-UITests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_TARGET_NAME = ReCaptcha_Example; - }; - name = Release; - }; - F2ECCF7E1E9FC47B0097B199 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 4FED8267564AACFFEE83DB15 /* Pods-ReCaptcha_Tests.debug.xcconfig */; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - DEVELOPMENT_TEAM = ""; - INFOPLIST_FILE = ReCaptcha_Tests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.flaviocaetano.ReCaptcha-Tests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG UNIT_TESTS"; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReCaptcha_Example.app/ReCaptcha_Example"; - }; - name = Debug; - }; - F2ECCF7F1E9FC47B0097B199 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 44568771DD76CFBDF2D1C83D /* Pods-ReCaptcha_Tests.release.xcconfig */; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - DEVELOPMENT_TEAM = ""; - INFOPLIST_FILE = ReCaptcha_Tests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.flaviocaetano.ReCaptcha-Tests"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReCaptcha_Example.app/ReCaptcha_Example"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "ReCaptcha" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 607FACED1AFB9204008FA782 /* Debug */, - 607FACEE1AFB9204008FA782 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "ReCaptcha_Example" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 607FACF01AFB9204008FA782 /* Debug */, - 607FACF11AFB9204008FA782 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - F28FACA5200E425600E14987 /* Build configuration list for PBXNativeTarget "ReCaptcha_UITests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - F28FACA3200E425600E14987 /* Debug */, - F28FACA4200E425600E14987 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - F2ECCF7D1E9FC47B0097B199 /* Build configuration list for PBXNativeTarget "ReCaptcha_Tests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - F2ECCF7E1E9FC47B0097B199 /* Debug */, - F2ECCF7F1E9FC47B0097B199 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 607FACC81AFB9204008FA782 /* Project object */; -} diff --git a/Example/ReCaptcha.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Example/ReCaptcha.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index eb752a5..0000000 --- a/Example/ReCaptcha.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Example/ReCaptcha.xcodeproj/xcshareddata/xcschemes/ReCaptcha-Example.xcscheme b/Example/ReCaptcha.xcodeproj/xcshareddata/xcschemes/ReCaptcha-Example.xcscheme deleted file mode 100644 index f31bfd0..0000000 --- a/Example/ReCaptcha.xcodeproj/xcshareddata/xcschemes/ReCaptcha-Example.xcscheme +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Example/ReCaptcha.xcodeproj/xcshareddata/xcschemes/ReCaptcha_UITests.xcscheme b/Example/ReCaptcha.xcodeproj/xcshareddata/xcschemes/ReCaptcha_UITests.xcscheme deleted file mode 100644 index f562b77..0000000 --- a/Example/ReCaptcha.xcodeproj/xcshareddata/xcschemes/ReCaptcha_UITests.xcscheme +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Example/ReCaptcha.xcworkspace/contents.xcworkspacedata b/Example/ReCaptcha.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 80c5b41..0000000 --- a/Example/ReCaptcha.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/Example/ReCaptcha.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/ReCaptcha.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d9810..0000000 --- a/Example/ReCaptcha.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/Example/ReCaptcha/.swiftlint.yml b/Example/ReCaptcha/.swiftlint.yml deleted file mode 100644 index 84f8494..0000000 --- a/Example/ReCaptcha/.swiftlint.yml +++ /dev/null @@ -1,2 +0,0 @@ -disabled_rules: - - explicit_top_level_acl diff --git a/Example/ReCaptcha/AppDelegate.swift b/Example/ReCaptcha/AppDelegate.swift deleted file mode 100644 index 86054b4..0000000 --- a/Example/ReCaptcha/AppDelegate.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// AppDelegate.swift -// ReCaptcha -// -// Created by Flávio Caetano on 03/22/17. -// Copyright © 2018 ReCaptcha. All rights reserved. -// - -import UIKit - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - - var window: UIWindow? - - - func application( - _ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? - ) -> Bool { - // Override point for customization after application launch. - return true - } -} diff --git a/Example/ReCaptcha/Base.lproj/LaunchScreen.xib b/Example/ReCaptcha/Base.lproj/LaunchScreen.xib deleted file mode 100644 index b505c79..0000000 --- a/Example/ReCaptcha/Base.lproj/LaunchScreen.xib +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Example/ReCaptcha/Base.lproj/Main.storyboard b/Example/ReCaptcha/Base.lproj/Main.storyboard deleted file mode 100644 index e888f64..0000000 --- a/Example/ReCaptcha/Base.lproj/Main.storyboard +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Example/ReCaptcha/Images.xcassets/AppIcon.appiconset/Contents.json b/Example/ReCaptcha/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 19882d5..0000000 --- a/Example/ReCaptcha/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "3x" - }, - { - "idiom" : "ios-marketing", - "size" : "1024x1024", - "scale" : "1x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Example/ReCaptcha/Info.plist b/Example/ReCaptcha/Info.plist deleted file mode 100644 index acfbed7..0000000 --- a/Example/ReCaptcha/Info.plist +++ /dev/null @@ -1,45 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSApplicationCategoryType - - LSRequiresIPhoneOS - - ReCaptchaDomain - http://localhost - ReCaptchaKey - 6LdE-hkUAAAAAKWfpXjXrsLMwDc0psCcjvpBgGr6 - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - - - diff --git a/Example/ReCaptcha/ViewController.swift b/Example/ReCaptcha/ViewController.swift deleted file mode 100644 index 67b25ad..0000000 --- a/Example/ReCaptcha/ViewController.swift +++ /dev/null @@ -1,134 +0,0 @@ -// -// ViewController.swift -// ReCaptcha -// -// Created by Flávio Caetano on 03/22/17. -// Copyright © 2018 ReCaptcha. All rights reserved. -// - -import ReCaptcha -import RxCocoa -import RxSwift -import UIKit - - -class ViewController: UIViewController { - private struct Constants { - static let webViewTag = 123 - static let testLabelTag = 321 - } - - private var recaptcha: ReCaptcha! - private var disposeBag = DisposeBag() - - private var locale: Locale? - private var endpoint = ReCaptcha.Endpoint.default - - @IBOutlet private weak var label: UILabel! - @IBOutlet private weak var spinner: UIActivityIndicatorView! - @IBOutlet private weak var localeSegmentedControl: UISegmentedControl! - @IBOutlet private weak var endpointSegmentedControl: UISegmentedControl! - @IBOutlet private weak var visibleChallengeSwitch: UISwitch! - - override func viewDidLoad() { - super.viewDidLoad() - setupReCaptcha() - } - - @IBAction func didPressEndpointSegmentedControl(_ sender: UISegmentedControl) { - label.text = "" - switch sender.selectedSegmentIndex { - case 0: endpoint = .default - case 1: endpoint = .alternate - default: assertionFailure("invalid index") - } - - setupReCaptcha() - } - - @IBAction func didPressLocaleSegmentedControl(_ sender: UISegmentedControl) { - label.text = "" - switch sender.selectedSegmentIndex { - case 0: locale = nil - case 1: locale = Locale(identifier: "zh-CN") - default: assertionFailure("invalid index") - } - - setupReCaptcha() - } - - @IBAction private func didPressButton(button: UIButton) { - disposeBag = DisposeBag() - - recaptcha.rx.didFinishLoading - .debug("did finish loading") - .subscribe() - .disposed(by: disposeBag) - - let validate = recaptcha.rx.validate(on: view, resetOnError: false) - .catch { error in - return .just("Error \(error)") - } - .debug("validate") - .share() - - let isLoading = validate - .map { _ in false } - .startWith(true) - .share(replay: 1) - - isLoading - .bind(to: spinner.rx.isAnimating) - .disposed(by: disposeBag) - - let isEnabled = isLoading - .map { !$0 } - .catchAndReturn(false) - .share(replay: 1) - - isEnabled - .bind(to: button.rx.isEnabled) - .disposed(by: disposeBag) - - isEnabled - .bind(to: endpointSegmentedControl.rx.isEnabled) - .disposed(by: disposeBag) - - validate - .map { [weak self] _ in - self?.view.viewWithTag(Constants.webViewTag) - } - .subscribe(onNext: { subview in - subview?.removeFromSuperview() - }) - .disposed(by: disposeBag) - - validate - .bind(to: label.rx.text) - .disposed(by: disposeBag) - - visibleChallengeSwitch.rx.value - .subscribe(onNext: { [weak recaptcha] value in - recaptcha?.forceVisibleChallenge = value - }) - .disposed(by: disposeBag) - } - - private func setupReCaptcha() { - // swiftlint:disable:next force_try - recaptcha = try! ReCaptcha(endpoint: endpoint, locale: locale) - - recaptcha.configureWebView { [weak self] webview in - webview.frame = self?.view.bounds ?? CGRect.zero - webview.tag = Constants.webViewTag - - // For testing purposes - // If the webview requires presentation, this should work as a way of detecting the webview in UI tests - self?.view.viewWithTag(Constants.testLabelTag)?.removeFromSuperview() - let label = UILabel(frame: CGRect(x: 0, y: 0, width: 1, height: 1)) - label.tag = Constants.testLabelTag - label.accessibilityLabel = "webview" - self?.view.addSubview(label) - } - } -} diff --git a/Example/ReCaptcha_Tests/.swiftlint.yml b/Example/ReCaptcha_Tests/.swiftlint.yml deleted file mode 100644 index 777177c..0000000 --- a/Example/ReCaptcha_Tests/.swiftlint.yml +++ /dev/null @@ -1,9 +0,0 @@ -disabled_rules: - - type_name - - nesting - - force_unwrapping - - explicit_top_level_acl - - function_body_length - - identifier_name - - file_length - - type_body_length diff --git a/Example/ReCaptcha_Tests/Core/DispatchQueue__Tests.swift b/Example/ReCaptcha_Tests/Core/DispatchQueue__Tests.swift deleted file mode 100644 index c5e8fce..0000000 --- a/Example/ReCaptcha_Tests/Core/DispatchQueue__Tests.swift +++ /dev/null @@ -1,197 +0,0 @@ -// -// DispatchQueue__Tests.swift -// ReCaptcha -// -// Created by Flávio Caetano on 21/12/17. -// Copyright © 2018 ReCaptcha. All rights reserved. -// - -@testable import ReCaptcha -import XCTest - -class DispatchQueue__Tests: XCTestCase { - override func setUp() { - super.setUp() - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDown() { - // Put teardown code here. This method is called after the invocation of each test method in the class. - super.tearDown() - } - - // MARK: Throttle - - func test__Throttle_Nil_Context() { - // Execute closure called once - let exp0 = expectation(description: "did call single closure") - - DispatchQueue.main.throttle(deadline: .now() + 0.1) { - exp0.fulfill() - } - - waitForExpectations(timeout: 1) - - // Does not execute first closure - let exp1 = expectation(description: "did call last closure") - DispatchQueue.main.throttle(deadline: .now() + 0.1) { - XCTFail("Shouldn't be called") - } - - DispatchQueue.main.throttle( - deadline: .now() + 0.1, - action: exp1.fulfill - ) - - waitForExpectations(timeout: 1) - } - - func test__Throttle_Context() { - // Execute closure called once - let exp0 = expectation(description: "did call single closure") - let c0 = UUID() - - DispatchQueue.main.throttle( - deadline: .now() + 0.1, - context: c0, - action: exp0.fulfill - ) - - waitForExpectations(timeout: 1) - - // Does not execute first closure - let exp1 = expectation(description: "execute on valid context") - let c1 = UUID() - DispatchQueue.main.throttle(deadline: .now() + 0.1, context: c1) { - XCTFail("Shouldn't be called") - } - - DispatchQueue.main.throttle( - deadline: .now() + 0.1, - context: c1, - action: exp1.fulfill - ) - - // Execute in a different context - let exp2 = expectation(description: "execute on different context") - let c2 = UUID() - DispatchQueue.main.throttle( - deadline: .now() + 0.1, - context: c2, - action: exp2.fulfill - ) - - waitForExpectations(timeout: 1) - } - - // MARK: Debounce - - func test__Debounce_Nil_Context() { - // Does not execute sequenced closures - let exp0 = expectation(description: "did call first closure") - - DispatchQueue.main.debounce( - interval: 0.1, - action: exp0.fulfill - ) - - DispatchQueue.main.debounce(interval: 0) { - XCTFail("Shouldn't be called") - } - - waitForExpectations(timeout: 1) - - // Executes closure after previous has timed out - let exp1 = expectation(description: "did call closure") - DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { - DispatchQueue.main.debounce( - interval: 0.1, - action: exp1.fulfill - ) - } - - waitForExpectations(timeout: 3) - } - - func test__Debounce_Context() { - // Does not execute sequenced closures - let exp0 = expectation(description: "did call first closure") - let c0 = UUID() - - DispatchQueue.main.debounce( - interval: 0.1, - context: c0, - action: exp0.fulfill - ) - - DispatchQueue.main.debounce(interval: 0, context: c0) { - XCTFail("Shouldn't be called") - } - - // Execute in a different context - let c1 = UUID() - let exp1 = expectation(description: "executes in different context") - DispatchQueue.main.debounce( - interval: 0, - context: c1, - action: exp1.fulfill - ) - - waitForExpectations(timeout: 1) - - // Executes closure after previous has timed out - let exp2 = expectation(description: "did call closure") - DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { - DispatchQueue.main.debounce( - interval: 0.1, - context: c0, - action: exp2.fulfill - ) - } - - waitForExpectations(timeout: 5) - } - - // MARK: Once - - func test__Once__Single_Dispatch() { - let token = 3 - var dispatchCount = 0 - - // Does dispatch the given action - DispatchQueue.once(token: token) { - dispatchCount = 1 - } - - XCTAssertEqual(dispatchCount, 1) - - // Does not dispatch again for the same token - DispatchQueue.once(token: token) { - dispatchCount = 2 - } - - XCTAssertEqual(dispatchCount, 1) - } - - func test__Once__Multiple_Dispatches() { - let token1 = 4 - var didDispatch1 = false - - // Does dispatch the given action - DispatchQueue.once(token: token1) { - didDispatch1 = true - } - - XCTAssertTrue(didDispatch1) - - // Dispatch for a different token - let token2 = 6 - var didDispatch2 = false - - DispatchQueue.once(token: token2) { - didDispatch2 = true - } - - XCTAssertTrue(didDispatch2) - } -} diff --git a/Example/ReCaptcha_Tests/Core/ReCaptchaDecoder__Tests.swift b/Example/ReCaptcha_Tests/Core/ReCaptchaDecoder__Tests.swift deleted file mode 100644 index bb08513..0000000 --- a/Example/ReCaptcha_Tests/Core/ReCaptchaDecoder__Tests.swift +++ /dev/null @@ -1,243 +0,0 @@ -// -// ReCaptchaDecoder__Tests.swift -// ReCaptcha -// -// Created by Flávio Caetano on 13/04/17. -// Copyright © 2018 ReCaptcha. All rights reserved. -// - -@testable import ReCaptcha - -import WebKit -import XCTest - - -class ReCaptchaDecoder__Tests: XCTestCase { - fileprivate typealias Result = ReCaptchaDecoder.Result - - fileprivate var assertResult: ((Result) -> Void)? - fileprivate var decoder: ReCaptchaDecoder! - - override func setUp() { - super.setUp() - - decoder = ReCaptchaDecoder { [weak self] result in - self?.assertResult?(result) - } - } - - override func tearDown() { - // Put teardown code here. This method is called after the invocation of each test method in the class. - super.tearDown() - } - - - func test__Send_Error() { - let exp = expectation(description: "send error message") - var result: Result? - - assertResult = { res in - result = res - exp.fulfill() - } - - - // Send - let err = ReCaptchaError.random() - decoder.send(error: err) - - waitForExpectations(timeout: 1) - - - // Check - XCTAssertNotNil(result) - XCTAssertEqual(result, .error(err)) - } - - - func test__Decode__Wrong_Format() { - let exp = expectation(description: "send unsupported message") - var result: Result? - - assertResult = { res in - result = res - exp.fulfill() - } - - - // Send - let message = MockMessage(message: "foobar") - decoder.send(message: message) - - waitForExpectations(timeout: 1) - - - // Check - XCTAssertEqual(result, .error(ReCaptchaError.wrongMessageFormat)) - } - - - func test__Decode__Unexpected_Action() { - let exp = expectation(description: "send message with unexpected action") - var result: Result? - - assertResult = { res in - result = res - exp.fulfill() - } - - - // Send - let message = MockMessage(message: ["action": "bar"]) - decoder.send(message: message) - - waitForExpectations(timeout: 1) - - - // Check - XCTAssertEqual(result, .error(ReCaptchaError.wrongMessageFormat)) - } - - - func test__Decode__ShowReCaptcha() { - let exp = expectation(description: "send showReCaptcha message") - var result: Result? - - assertResult = { res in - result = res - exp.fulfill() - } - - - // Send - let message = MockMessage(message: ["action": "showReCaptcha"]) - decoder.send(message: message) - - waitForExpectations(timeout: 1) - - - // Check - XCTAssertEqual(result, .showReCaptcha) - } - - - func test__Decode__Token() { - let exp = expectation(description: "send token message") - var result: Result? - - assertResult = { res in - result = res - exp.fulfill() - } - - - // Send - let token = String(arc4random()) - let message = MockMessage(message: ["token": token]) - decoder.send(message: message) - - waitForExpectations(timeout: 1) - - - // Check - XCTAssertEqual(result, .token(token)) - } - - - func test__Decode__DidLoad() { - let exp = expectation(description: "send did load message") - var result: Result? - - assertResult = { res in - result = res - exp.fulfill() - } - - - // Send - let message = MockMessage(message: ["action": "didLoad"]) - decoder.send(message: message) - - waitForExpectations(timeout: 1) - - - // Check - XCTAssertEqual(result, .didLoad) - } - - func test__Decode__Error_Setup_Failed() { - let exp = expectation(description: "send error") - var result: Result? - - assertResult = { res in - result = res - exp.fulfill() - } - - // Send - let message = MockMessage(message: ["error": 27]) - decoder.send(message: message) - - waitForExpectations(timeout: 1) - - // Check - XCTAssertEqual(result, .error(.failedSetup)) - } - - func test__Decode__Error_Response_Expired() { - let exp = expectation(description: "send error") - var result: Result? - - assertResult = { res in - result = res - exp.fulfill() - } - - // Send - let message = MockMessage(message: ["error": 28]) - decoder.send(message: message) - - waitForExpectations(timeout: 1) - - // Check - XCTAssertEqual(result, .error(.responseExpired)) - } - - func test__Decode__Error_Render_Failed() { - let exp = expectation(description: "send error") - var result: Result? - - assertResult = { res in - result = res - exp.fulfill() - } - - // Send - let message = MockMessage(message: ["error": 29]) - decoder.send(message: message) - - waitForExpectations(timeout: 1) - - // Check - XCTAssertEqual(result, .error(.failedRender)) - } - - func test__Decode__Error_Wrong_Format() { - let exp = expectation(description: "send error") - var result: Result? - - assertResult = { res in - result = res - exp.fulfill() - } - - // Send - let message = MockMessage(message: ["error": 26]) - decoder.send(message: message) - - waitForExpectations(timeout: 1) - - // Check - XCTAssertEqual(result, .error(.wrongMessageFormat)) - } -} diff --git a/Example/ReCaptcha_Tests/Core/ReCaptchaResult__Tests.swift b/Example/ReCaptcha_Tests/Core/ReCaptchaResult__Tests.swift deleted file mode 100644 index 7922832..0000000 --- a/Example/ReCaptcha_Tests/Core/ReCaptchaResult__Tests.swift +++ /dev/null @@ -1,39 +0,0 @@ -// -// ReCaptchaResult__Tests.swift -// ReCaptcha -// -// Created by Flávio Caetano on 06/03/18. -// Copyright © 2018 ReCaptcha. All rights reserved. -// - -@testable import ReCaptcha -import XCTest - - -class ReCaptchaResult__Tests: XCTestCase { - func test__Get_Token() { - let token = UUID().uuidString - let result = ReCaptchaResult.token(token) - - do { - let value = try result.dematerialize() - XCTAssertEqual(value, token) - } - catch let err { - XCTFail(err.localizedDescription) - } - } - - func test__Get_Token__Error() { - let error = ReCaptchaError.random() - let result = ReCaptchaResult.error(error) - - do { - _ = try result.dematerialize() - XCTFail("Shouldn't have completed") - } - catch let err { - XCTAssertEqual(err as? ReCaptchaError, error) - } - } -} diff --git a/Example/ReCaptcha_Tests/Core/ReCaptchaWebViewManager__Tests.swift b/Example/ReCaptcha_Tests/Core/ReCaptchaWebViewManager__Tests.swift deleted file mode 100644 index 2a9e5b6..0000000 --- a/Example/ReCaptcha_Tests/Core/ReCaptchaWebViewManager__Tests.swift +++ /dev/null @@ -1,435 +0,0 @@ -// -// ReCaptchaWebViewManager__Tests.swift -// ReCaptcha -// -// Created by Flávio Caetano on 13/04/17. -// Copyright © 2018 ReCaptcha. All rights reserved. -// - -@testable import ReCaptcha - -import WebKit -import XCTest - - -class ReCaptchaWebViewManager__Tests: XCTestCase { - - fileprivate var apiKey: String! - fileprivate var presenterView: UIView! - - override func setUp() { - super.setUp() - - presenterView = UIApplication.shared.keyWindow! - apiKey = String(arc4random()) - } - - override func tearDown() { - presenterView = nil - apiKey = nil - - super.tearDown() - } - - // MARK: Validate - - func test__Validate__Token() { - let exp1 = expectation(description: "load token") - var result1: ReCaptchaResult? - - // Validate - let manager = ReCaptchaWebViewManager(messageBody: "{token: key}", apiKey: apiKey) - manager.configureWebView { _ in - XCTFail("should not ask to configure the webview") - } - - manager.validate(on: presenterView) { response in - result1 = response - exp1.fulfill() - } - - waitForExpectations(timeout: 10) - - - // Verify - XCTAssertNotNil(result1) - XCTAssertNil(result1?.error) - XCTAssertEqual(result1?.token, apiKey) - - - // Validate again - let exp2 = expectation(description: "reload token") - var result2: ReCaptchaResult? - - // Validate - manager.validate(on: presenterView) { response in - result2 = response - exp2.fulfill() - } - - waitForExpectations(timeout: 10) - - - // Verify - XCTAssertNotNil(result2) - XCTAssertNil(result2?.error) - XCTAssertEqual(result2?.token, apiKey) - } - - - func test__Validate__Show_ReCaptcha() { - let exp = expectation(description: "show recaptcha") - - // Validate - let manager = ReCaptchaWebViewManager(messageBody: "{action: \"showReCaptcha\"}") - manager.configureWebView { _ in - exp.fulfill() - } - - manager.validate(on: presenterView) { _ in - XCTFail("should not call completion") - } - - waitForExpectations(timeout: 10) - } - - - func test__Validate__Message_Error() { - var result: ReCaptchaResult? - let exp = expectation(description: "message error") - - // Validate - let manager = ReCaptchaWebViewManager(messageBody: "\"foobar\"") - manager.configureWebView { _ in - XCTFail("should not ask to configure the webview") - } - - manager.validate(on: presenterView, resetOnError: false) { response in - result = response - exp.fulfill() - } - - waitForExpectations(timeout: 10) - - // Verify - XCTAssertNotNil(result) - XCTAssertEqual(result?.error, .wrongMessageFormat) - XCTAssertNil(result?.token) - } - - func test__Validate__JS_Error() { - var result: ReCaptchaResult? - let exp = expectation(description: "js error") - - // Validate - let manager = ReCaptchaWebViewManager(messageBody: "foobar") - manager.configureWebView { _ in - XCTFail("should not ask to configure the webview") - } - - manager.validate(on: presenterView, resetOnError: false) { response in - result = response - exp.fulfill() - } - - waitForExpectations(timeout: 10) - - // Verify - XCTAssertNotNil(result) - XCTAssertNotNil(result?.error) - XCTAssertNil(result?.token) - - switch result!.error! { - case .unexpected(let error as NSError): - XCTAssertEqual(error.code, WKError.javaScriptExceptionOccurred.rawValue) - default: - XCTFail("Unexpected error received") - } - } - - // MARK: Configure WebView - - func test__Configure_Web_View__Empty() { - let exp = expectation(description: "configure webview") - - // Configure WebView - let manager = ReCaptchaWebViewManager(messageBody: "{action: \"showReCaptcha\"}") - manager.validate(on: presenterView) { _ in - XCTFail("should not call completion") - } - - DispatchQueue.main.asyncAfter(deadline: .now() + 2) { - exp.fulfill() - } - - waitForExpectations(timeout: 10) - } - - func test__Configure_Web_View() { - let exp = expectation(description: "configure webview") - - // Configure WebView - let manager = ReCaptchaWebViewManager(messageBody: "{action: \"showReCaptcha\"}") - manager.configureWebView { [unowned self] webView in - XCTAssertEqual(webView.superview, self.presenterView) - exp.fulfill() - } - - manager.validate(on: presenterView) { _ in - XCTFail("should not call completion") - } - - waitForExpectations(timeout: 10) - } - - func test__Configure_Web_View__Called_Once() { - var count = 0 - let exp0 = expectation(description: "configure webview") - - // Configure WebView - let manager = ReCaptchaWebViewManager(messageBody: "{action: \"showReCaptcha\"}") - manager.configureWebView { _ in - if count < 3 { - manager.webView.evaluateJavaScript("execute();") { XCTAssertNil($1) } - } - - count += 1 - exp0.fulfill() - } - - manager.validate(on: presenterView) { _ in - XCTFail("should not call completion") - } - - waitForExpectations(timeout: 10) - - let exp1 = expectation(description: "waiting for extra calls") - DispatchQueue.main.asyncAfter(deadline: .now() + 1, execute: exp1.fulfill) - waitForExpectations(timeout: 2) - - XCTAssertEqual(count, 1) - } - - func test__Configure_Web_View__Called_Again_With_Reset() { - let exp0 = expectation(description: "configure webview 0") - - let manager = ReCaptchaWebViewManager(messageBody: "{action: \"showReCaptcha\"}") - manager.validate(on: presenterView) { _ in - XCTFail("should not call completion") - } - - // Configure Webview - manager.configureWebView { _ in - manager.webView.evaluateJavaScript("execute();") { XCTAssertNil($1) } - exp0.fulfill() - } - - waitForExpectations(timeout: 10) - - // Reset and ensure it calls again - let exp1 = expectation(description: "configure webview 1") - - manager.configureWebView { _ in - manager.webView.evaluateJavaScript("execute();") { XCTAssertNil($1) } - exp1.fulfill() - } - - manager.reset() - waitForExpectations(timeout: 10) - } - - // MARK: Stop - - func test__Stop() { - let exp = expectation(description: "stop loading") - - // Stop - let manager = ReCaptchaWebViewManager(messageBody: "{action: \"showReCaptcha\"}") - manager.stop() - manager.configureWebView { _ in - XCTFail("should not ask to configure the webview") - } - - manager.validate(on: presenterView) { _ in - XCTFail("should not validate") - } - - DispatchQueue.main.asyncAfter(deadline: .now() + 2) { - exp.fulfill() - } - - waitForExpectations(timeout: 10) - } - - // MARK: Setup - - func test__Key_Setup() { - let exp = expectation(description: "setup key") - var result: ReCaptchaResult? - - // Validate - let manager = ReCaptchaWebViewManager(messageBody: "{token: key}", apiKey: apiKey) - manager.configureWebView { _ in - XCTFail("should not ask to configure the webview") - } - - manager.validate(on: presenterView) { response in - result = response - exp.fulfill() - } - - waitForExpectations(timeout: 10) - - XCTAssertNotNil(result) - XCTAssertNil(result?.error) - XCTAssertEqual(result?.token, apiKey) - } - - func test__Endpoint_Setup() { - let exp = expectation(description: "setup endpoint") - let endpoint = ReCaptcha.Endpoint.alternate.getURL(locale: nil) - var result: ReCaptchaResult? - - let manager = ReCaptchaWebViewManager(messageBody: "{token: endpoint}", endpoint: endpoint) - manager.configureWebView { _ in - XCTFail("should not ask to configure the webview") - } - - manager.validate(on: presenterView) { response in - result = response - exp.fulfill() - } - - waitForExpectations(timeout: 10) - - XCTAssertNotNil(result) - XCTAssertNil(result?.error) - XCTAssertEqual(result?.token, endpoint) - } - - // MARK: Reset - - func test__Reset() { - let exp1 = expectation(description: "fail on first execution") - var result1: ReCaptchaResult? - - // Validate - let manager = ReCaptchaWebViewManager(messageBody: "{token: key}", apiKey: apiKey, shouldFail: true) - manager.configureWebView { _ in - XCTFail("should not ask to configure the webview") - } - - // Error - manager.validate(on: presenterView, resetOnError: false) { result in - result1 = result - exp1.fulfill() - } - - waitForExpectations(timeout: 10) - XCTAssertEqual(result1?.error, .wrongMessageFormat) - - // Resets and tries again - let exp2 = expectation(description: "validates after reset") - var result2: ReCaptchaResult? - - manager.reset() - manager.validate(on: presenterView, resetOnError: false) { result in - result2 = result - exp2.fulfill() - } - - waitForExpectations(timeout: 10) - - XCTAssertNil(result2?.error) - XCTAssertEqual(result2?.token, apiKey) - } - - func test__Validate__Reset_On_Error() { - let exp = expectation(description: "fail on first execution") - var result: ReCaptchaResult? - - // Validate - let manager = ReCaptchaWebViewManager(messageBody: "{token: key}", apiKey: apiKey, shouldFail: true) - manager.configureWebView { _ in - XCTFail("should not ask to configure the webview") - } - - // Error - manager.validate(on: presenterView, resetOnError: true) { response in - result = response - exp.fulfill() - } - - waitForExpectations(timeout: 10) - - XCTAssertNil(result?.error) - XCTAssertEqual(result?.token, apiKey) - } - - func test__Validate__Should_Skip_For_Tests() { - let exp = expectation(description: "did skip validation") - - let manager = ReCaptchaWebViewManager() - manager.shouldSkipForTests = true - - manager.completion = { result in - XCTAssertEqual(result.token, "") - exp.fulfill() - } - - manager.validate(on: presenterView) - - waitForExpectations(timeout: 1) - } - - // MARK: Force Challenge Visible - - func test__Force_Visible_Challenge() { - let manager = ReCaptchaWebViewManager() - - // Initial value - XCTAssertFalse(manager.forceVisibleChallenge) - - // Set True - manager.forceVisibleChallenge = true - XCTAssertEqual(manager.webView.customUserAgent, "Googlebot/2.1") - - // Set False - manager.forceVisibleChallenge = false - XCTAssertNotEqual(manager.webView.customUserAgent?.isEmpty, false) - } - - // MARK: On Did Finish Loading - - func test__Did_Finish_Loading__Immediate() { - let exp = expectation(description: "did finish loading") - - let manager = ReCaptchaWebViewManager() - - /// Should call closure immediately since it's already loaded - manager.onDidFinishLoading = { - manager.onDidFinishLoading = exp.fulfill - } - - waitForExpectations(timeout: 1) - } - - func test__Did_Finish_Loading__Delayed() { - let exp = expectation(description: "did finish loading") - - let manager = ReCaptchaWebViewManager(shouldFail: true) - - var called = false - manager.onDidFinishLoading = { - called = true - } - - XCTAssertFalse(called) - - // Reset - manager.onDidFinishLoading = exp.fulfill - manager.reset() - - waitForExpectations(timeout: 3) - } -} diff --git a/Example/ReCaptcha_Tests/Core/ReCaptcha_Endpoint__Tests.swift b/Example/ReCaptcha_Tests/Core/ReCaptcha_Endpoint__Tests.swift deleted file mode 100644 index 7411bed..0000000 --- a/Example/ReCaptcha_Tests/Core/ReCaptcha_Endpoint__Tests.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// ReCaptcha_Endpoint__.swift -// ReCaptcha -// -// Created by Flávio Caetano on 12/07/18. -// Copyright © 2018 ReCaptcha. All rights reserved. -// - -@testable import ReCaptcha -import XCTest - -class ReCaptcha_Endpoint__Tests: XCTestCase { - - private let endpoint = ReCaptcha.Endpoint.default - private let endpointURL = "https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" - - // MARK: - Locale - - func test__Locale__Nil() { - XCTAssertEqual(endpoint.getURL(locale: nil), endpointURL) - } - - func test__Locale__Valid() { - let locale = Locale(identifier: "pt-BR") - XCTAssertEqual(endpoint.getURL(locale: locale), "\(endpointURL)&hl=pt-BR") - } -} diff --git a/Example/ReCaptcha_Tests/Core/ReCaptcha__Tests.swift b/Example/ReCaptcha_Tests/Core/ReCaptcha__Tests.swift deleted file mode 100644 index 232b508..0000000 --- a/Example/ReCaptcha_Tests/Core/ReCaptcha__Tests.swift +++ /dev/null @@ -1,135 +0,0 @@ -// -// ReCaptcha__Tests.swift -// ReCaptcha -// -// Created by Flávio Caetano on 26/09/17. -// Copyright © 2018 ReCaptcha. All rights reserved. -// - -import AppSwizzle -@testable import ReCaptcha -import RxSwift -import XCTest - - -class ReCaptcha__Tests: XCTestCase { - fileprivate struct Constants { - struct InfoDictKeys { - static let APIKey = "ReCaptchaKey" - static let Domain = "ReCaptchaDomain" - } - } - - func test__Fails_Without_HTML_File() { - _ = Bundle.swizzleInstanceMethod( - origSelector: #selector(Bundle.path(forResource:ofType:)), - toAlterSelector: #selector(Bundle.failHTMLLoad(_:type:)) - ) - - do { - _ = try ReCaptcha() - XCTFail("Should have failed") - } catch let e as ReCaptchaError { - print(e) - XCTAssertEqual(e, ReCaptchaError.htmlLoadError) - } catch let e { - XCTFail("Unexpected error: \(e)") - } - - // Unswizzle - _ = Bundle.swizzleInstanceMethod( - origSelector: #selector(Bundle.path(forResource:ofType:)), - toAlterSelector: #selector(Bundle.failHTMLLoad(_:type:)) - ) - } - - func test__Base_URL() { - // Ensures baseURL failure when nil - do { - _ = try ReCaptcha.Config(apiKey: "", infoPlistKey: nil, baseURL: nil, infoPlistURL: nil) - XCTFail("Should have failed") - } catch let e as ReCaptchaError { - print(e) - XCTAssertEqual(e, ReCaptchaError.baseURLNotFound) - } catch let e { - XCTFail("Unexpected error: \(e)") - } - - // Ensures plist url if nil key - let plistURL = URL(string: "https://bar")! - let config1 = try? ReCaptcha.Config(apiKey: "", infoPlistKey: nil, baseURL: nil, infoPlistURL: plistURL) - XCTAssertEqual(config1?.baseURL, plistURL) - - // Ensures preference of given url over plist entry - let url = URL(string: "ftp://foo")! - let config2 = try? ReCaptcha.Config(apiKey: "", infoPlistKey: nil, baseURL: url, infoPlistURL: plistURL) - XCTAssertEqual(config2?.baseURL, url) - } - - func test__Base_URL_Without_Scheme() { - // Ignores URL with scheme - let goodURL = URL(string: "https://foo.bar")! - let config0 = try? ReCaptcha.Config(apiKey: "", infoPlistKey: nil, baseURL: goodURL, infoPlistURL: nil) - XCTAssertEqual(config0?.baseURL, goodURL) - - // Fixes URL without scheme - let badURL = URL(string: "foo")! - let config = try? ReCaptcha.Config(apiKey: "", infoPlistKey: nil, baseURL: badURL, infoPlistURL: nil) - XCTAssertEqual(config?.baseURL.absoluteString, "http://" + badURL.absoluteString) - } - - func test__API_Key() { - // Ensures key failure when nil - do { - _ = try ReCaptcha.Config(apiKey: nil, infoPlistKey: nil, baseURL: nil, infoPlistURL: nil) - XCTFail("Should have failed") - } catch let e as ReCaptchaError { - print(e) - XCTAssertEqual(e, ReCaptchaError.apiKeyNotFound) - } catch let e { - XCTFail("Unexpected error: \(e)") - } - - // Ensures plist key if nil key - let plistKey = "bar" - let config1 = try? ReCaptcha.Config( - apiKey: nil, - infoPlistKey: plistKey, - baseURL: URL(string: "foo"), - infoPlistURL: nil - ) - XCTAssertEqual(config1?.apiKey, plistKey) - - // Ensures preference of given key over plist entry - let key = "foo" - let config2 = try? ReCaptcha.Config( - apiKey: key, - infoPlistKey: plistKey, - baseURL: URL(string: "foo"), - infoPlistURL: nil - ) - XCTAssertEqual(config2?.apiKey, key) - } - - func test__Force_Visible_Challenge() { - let recaptcha = ReCaptcha(manager: ReCaptchaWebViewManager()) - - // Initial value - XCTAssertFalse(recaptcha.forceVisibleChallenge) - - // Set true - recaptcha.forceVisibleChallenge = true - XCTAssertTrue(recaptcha.forceVisibleChallenge) - } -} - - -private extension Bundle { - @objc func failHTMLLoad(_ resource: String, type: String) -> String? { - guard resource == "recaptcha" && type == "html" else { - return failHTMLLoad(resource, type: type) - } - - return nil - } -} diff --git a/Example/ReCaptcha_Tests/Helpers/ReCaptchaDecoder+Helper.swift b/Example/ReCaptcha_Tests/Helpers/ReCaptchaDecoder+Helper.swift deleted file mode 100644 index 63b2a8b..0000000 --- a/Example/ReCaptcha_Tests/Helpers/ReCaptchaDecoder+Helper.swift +++ /dev/null @@ -1,55 +0,0 @@ -// -// ReCaptchaDecoder+Helper.swift -// ReCaptcha -// -// Created by Flávio Caetano on 22/12/17. -// Copyright © 2018 ReCaptcha. All rights reserved. -// - -import Foundation -@testable import ReCaptcha -import WebKit - -class MockMessage: WKScriptMessage { - override var body: Any { - return storedBody - } - - fileprivate let storedBody: Any - - init(message: Any) { - storedBody = message - } -} - -// MARK: - Decoder Helpers -extension ReCaptchaDecoder { - func send(message: MockMessage) { - userContentController(WKUserContentController(), didReceive: message) - } -} - -// MARK: - Result Helpers -extension ReCaptchaDecoder.Result: Equatable { - var error: ReCaptchaError? { - guard case .error(let error) = self else { return nil } - return error - } - - public static func == (lhs: ReCaptchaDecoder.Result, rhs: ReCaptchaDecoder.Result) -> Bool { - switch (lhs, rhs) { - case (.showReCaptcha, .showReCaptcha), - (.didLoad, .didLoad): - return true - - case (.token(let lht), .token(let rht)): - return lht == rht - - case (.error(let lhe), .error(let rhe)): - return lhe == rhe - - default: - return false - } - } -} diff --git a/Example/ReCaptcha_Tests/Helpers/ReCaptchaError+Equatable.swift b/Example/ReCaptcha_Tests/Helpers/ReCaptchaError+Equatable.swift deleted file mode 100644 index 264edfa..0000000 --- a/Example/ReCaptcha_Tests/Helpers/ReCaptchaError+Equatable.swift +++ /dev/null @@ -1,42 +0,0 @@ -// -// ReCaptchaError+Equatable.swift -// ReCaptcha -// -// Created by Flávio Caetano on 16/10/17. -// Copyright © 2018 ReCaptcha. All rights reserved. -// - -import Foundation -@testable import ReCaptcha - -extension ReCaptchaError: Equatable { - public static func == (lhs: ReCaptchaError, rhs: ReCaptchaError) -> Bool { - switch (lhs, rhs) { - case (.htmlLoadError, .htmlLoadError), - (.apiKeyNotFound, .apiKeyNotFound), - (.baseURLNotFound, .baseURLNotFound), - (.wrongMessageFormat, .wrongMessageFormat), - (.failedSetup, .failedSetup), - (.responseExpired, .responseExpired), - (.failedRender, .failedRender): - return true - case (.unexpected(let lhe as NSError), .unexpected(let rhe as NSError)): - return lhe == rhe - default: - return false - } - } - - static func random() -> ReCaptchaError { - switch arc4random_uniform(7) { - case 0: return .htmlLoadError - case 1: return .apiKeyNotFound - case 2: return .baseURLNotFound - case 3: return .wrongMessageFormat - case 4: return .failedSetup - case 5: return .responseExpired - case 6: return .failedRender - default: return .unexpected(NSError()) - } - } -} diff --git a/Example/ReCaptcha_Tests/Helpers/ReCaptchaWebViewManager+Helpers.swift b/Example/ReCaptcha_Tests/Helpers/ReCaptchaWebViewManager+Helpers.swift deleted file mode 100644 index 7d4f35f..0000000 --- a/Example/ReCaptcha_Tests/Helpers/ReCaptchaWebViewManager+Helpers.swift +++ /dev/null @@ -1,50 +0,0 @@ -// -// ReCaptchaWebViewManager+Helpers.swift -// ReCaptcha -// -// Created by Flávio Caetano on 13/04/17. -// Copyright © 2018 ReCaptcha. All rights reserved. -// - -import Foundation -@testable import ReCaptcha -import WebKit - -extension ReCaptchaWebViewManager { - private static let unformattedHTML: String! = { - Bundle(for: ReCaptchaWebViewManager__Tests.self) - .path(forResource: "mock", ofType: "html") - .flatMap { try? String(contentsOfFile: $0) } - }() - - convenience init( - messageBody: String = "", - apiKey: String? = nil, - endpoint: String? = nil, - shouldFail: Bool = false - ) { - let localhost = URL(string: "http://localhost")! - let html = String(format: ReCaptchaWebViewManager.unformattedHTML, arguments: [ - "message": messageBody, - "shouldFail": shouldFail.description - ]) - - self.init( - html: html, - apiKey: apiKey ?? String(arc4random()), - baseURL: localhost, - endpoint: endpoint ?? localhost.absoluteString - ) - } - - func configureWebView(_ configure: @escaping (WKWebView) -> Void) { - configureWebView = configure - } - - func validate(on view: UIView, resetOnError: Bool = true, completion: @escaping (ReCaptchaResult) -> Void) { - self.shouldResetOnError = resetOnError - self.completion = completion - - validate(on: view) - } -} diff --git a/Example/ReCaptcha_Tests/Helpers/Result+Helpers.swift b/Example/ReCaptcha_Tests/Helpers/Result+Helpers.swift deleted file mode 100644 index c39a055..0000000 --- a/Example/ReCaptcha_Tests/Helpers/Result+Helpers.swift +++ /dev/null @@ -1,22 +0,0 @@ -// -// Result+Helpers.swift -// ReCaptcha -// -// Created by Flávio Caetano on 13/04/17. -// Copyright © 2018 ReCaptcha. All rights reserved. -// - -@testable import ReCaptcha - - -extension ReCaptchaResult { - var token: String? { - guard case .token(let value) = self else { return nil } - return value - } - - var error: ReCaptchaError? { - guard case .error(let error) = self else { return nil } - return error - } -} diff --git a/Example/ReCaptcha_Tests/Info.plist b/Example/ReCaptcha_Tests/Info.plist deleted file mode 100644 index 6c6c23c..0000000 --- a/Example/ReCaptcha_Tests/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/Example/ReCaptcha_Tests/RxSwift/ReCaptcha+Rx__Tests.swift b/Example/ReCaptcha_Tests/RxSwift/ReCaptcha+Rx__Tests.swift deleted file mode 100644 index 9e6c43c..0000000 --- a/Example/ReCaptcha_Tests/RxSwift/ReCaptcha+Rx__Tests.swift +++ /dev/null @@ -1,265 +0,0 @@ -// -// ReCaptcha+Rx__Tests.swift -// ReCaptcha -// -// Created by Flávio Caetano on 13/04/17. -// Copyright © 2018 ReCaptcha. All rights reserved. -// - -@testable import ReCaptcha - -import RxBlocking -import RxCocoa -import RxSwift -import XCTest - - -class ReCaptcha_Rx__Tests: XCTestCase { - - fileprivate var apiKey: String! - fileprivate var presenterView: UIView! - - override func setUp() { - super.setUp() - - presenterView = UIApplication.shared.keyWindow! - apiKey = String(arc4random()) - } - - override func tearDown() { - presenterView = nil - apiKey = nil - - super.tearDown() - } - - - func test__Validate__Token() { - let recaptcha = ReCaptcha(manager: ReCaptchaWebViewManager(messageBody: "{token: key}", apiKey: apiKey)) - recaptcha.configureWebView { _ in - XCTFail("should not ask to configure the webview") - } - - do { - // Validate - let result = try recaptcha.rx.validate(on: presenterView) - .toBlocking() - .single() - - // Verify - XCTAssertEqual(result, apiKey) - } - catch let error { - XCTFail(error.localizedDescription) - } - } - - - func test__Validate__Show_ReCaptcha() { - let recaptcha = ReCaptcha( - manager: ReCaptchaWebViewManager(messageBody: "{action: \"showReCaptcha\"}", apiKey: apiKey) - ) - - var didConfigureWebView = false - - recaptcha.configureWebView { _ in - didConfigureWebView = true - } - - do { - // Validate - _ = try recaptcha.rx.validate(on: presenterView) - .toBlocking(timeout: 2) - .single() - - XCTFail("should have thrown exception") - } - catch let error { - XCTAssertEqual(String(describing: error), RxError.timeout.debugDescription) - XCTAssertTrue(didConfigureWebView) - } - } - - - func test__Validate__Error() { - let recaptcha = ReCaptcha(manager: ReCaptchaWebViewManager(messageBody: "\"foobar\"", apiKey: apiKey)) - recaptcha.configureWebView { _ in - XCTFail("should not ask to configure the webview") - } - - do { - // Validate - _ = try recaptcha.rx.validate(on: presenterView, resetOnError: false) - .toBlocking() - .single() - - XCTFail("should have thrown exception") - } - catch let error { - XCTAssertEqual(error as? ReCaptchaError, .wrongMessageFormat) - } - } - - // MARK: - Did Finish Loading - - func test__Did_Finish_Loading__Immediate() { - let manager = ReCaptchaWebViewManager() - let recaptcha = ReCaptcha(manager: manager) - - manager.onDidFinishLoading = { - do { - try recaptcha.rx.didFinishLoading - .toBlocking() - .first() - } - catch let error { - XCTFail(error.localizedDescription) - } - } - } - - func test__Did_Finish_Loading__Multiple() { - let recaptcha = ReCaptcha(manager: ReCaptchaWebViewManager()) - - do { - let obs = recaptcha.rx.didFinishLoading - .take(2) - .share() - - let reset = obs.do(onNext: recaptcha.reset).subscribe() - - let result = try obs - .toBlocking() - .toArray() - - XCTAssertEqual(result.count, 2) - reset.dispose() - } - catch let error { - XCTFail(error.localizedDescription) - } - } - - func test__Did_Finish_Loading__Delayed() { - let recaptcha = ReCaptcha(manager: ReCaptchaWebViewManager(shouldFail: true)) - - do { - _ = try recaptcha.rx.didFinishLoading - .toBlocking(timeout: 0.1) - .first() - - XCTFail("should have timed out") - } - catch let error { - XCTAssertEqual(String(describing: error), RxError.timeout.debugDescription) - } - - do { - recaptcha.reset() - - try recaptcha.rx.didFinishLoading - .toBlocking() - .first() - } - catch let error { - XCTFail(error.localizedDescription) - } - } - - func test__Did_Finish_Loading__Dispose() { - let manager = ReCaptchaWebViewManager() - let recaptcha = ReCaptcha(manager: manager) - - let obs = recaptcha.rx.didFinishLoading - .subscribe() - - XCTAssertNotNil(manager.onDidFinishLoading) - - obs.dispose() - XCTAssertNil(manager.onDidFinishLoading) - } - - // MARK: - Dispose - - func test__Dispose() { - let exp = expectation(description: "stop loading") - - // Stop - let recaptcha = ReCaptcha(manager: ReCaptchaWebViewManager(messageBody: "{log: \"foo\"}")) - recaptcha.configureWebView { _ in - XCTFail("should not ask to configure the webview") - } - - let disposable = recaptcha.rx.validate(on: presenterView) - .do(onDispose: exp.fulfill) - .subscribe { _ in - XCTFail("should not validate") - } - - DispatchQueue.main.asyncAfter(deadline: .now() + 1, execute: disposable.dispose) - - waitForExpectations(timeout: 10) - } - - // MARK: - Reset - - func test__Reset() { - // Validate - let recaptcha = ReCaptcha( - manager: ReCaptchaWebViewManager(messageBody: "{token: key}", apiKey: apiKey, shouldFail: true) - ) - - recaptcha.configureWebView { _ in - XCTFail("should not ask to configure the webview") - } - - do { - // Error - _ = try recaptcha.rx.validate(on: presenterView, resetOnError: false) - .toBlocking() - .single() - } - catch let error { - XCTAssertEqual(error as? ReCaptchaError, .wrongMessageFormat) - - // Resets after failure - _ = Observable.just(()) - .bind(to: recaptcha.rx.reset) - } - - do { - // Resets and tries again - let result = try recaptcha.rx.validate(on: presenterView, resetOnError: false) - .toBlocking() - .single() - - XCTAssertEqual(result, apiKey) - } - catch let error { - XCTFail(error.localizedDescription) - } - } - - func test__Validate__Reset_On_Error() { - // Validate - let recaptcha = ReCaptcha( - manager: ReCaptchaWebViewManager(messageBody: "{token: key}", apiKey: apiKey, shouldFail: true) - ) - - recaptcha.configureWebView { _ in - XCTFail("should not ask to configure the webview") - } - - do { - // Error - let result = try recaptcha.rx.validate(on: presenterView, resetOnError: true) - .toBlocking() - .single() - - XCTAssertEqual(result, apiKey) - } - catch let error { - XCTFail(error.localizedDescription) - } - } -} diff --git a/Example/ReCaptcha_Tests/mock.html b/Example/ReCaptcha_Tests/mock.html deleted file mode 100644 index 09b3c17..0000000 --- a/Example/ReCaptcha_Tests/mock.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - diff --git a/Example/ReCaptcha_UITests/.swiftlint.yml b/Example/ReCaptcha_UITests/.swiftlint.yml deleted file mode 100644 index 2d9f9c0..0000000 --- a/Example/ReCaptcha_UITests/.swiftlint.yml +++ /dev/null @@ -1,5 +0,0 @@ -disabled_rules: - - type_name - - nesting - - force_unwrapping - - explicit_top_level_acl diff --git a/Example/ReCaptcha_UITests/Info.plist b/Example/ReCaptcha_UITests/Info.plist deleted file mode 100644 index 6c40a6c..0000000 --- a/Example/ReCaptcha_UITests/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/Example/ReCaptcha_UITests/ReCaptcha_UITests.swift b/Example/ReCaptcha_UITests/ReCaptcha_UITests.swift deleted file mode 100644 index 8cde2d9..0000000 --- a/Example/ReCaptcha_UITests/ReCaptcha_UITests.swift +++ /dev/null @@ -1,51 +0,0 @@ -// -// ReCaptcha_UITests.swift -// ReCaptcha -// -// Created by Flávio Caetano on 16/01/18. -// Copyright © 2018 ReCaptcha. All rights reserved. -// - -import Foundation -@testable import ReCaptcha -@testable import ReCaptcha_Example -import XCTest - -class ReCaptcha_UITests: XCTestCase { - - override func setUp() { - super.setUp() - - // In UI tests it is usually best to stop immediately when a failure occurs. - continueAfterFailure = false - XCUIApplication().launch() - } - - func test__Validate__Default_Endpoint() { - let app = XCUIApplication() - app.segmentedControls.buttons["Default Endpoint"].tap() - app.switches["Switch"].tap() - app.buttons["Validate"].tap() - - verifyValidation() - } - - func test__Validate__Alternate_Endpoint() { - let app = XCUIApplication() - app.segmentedControls.buttons["Alternate"].tap() - app.switches["Switch"].tap() - app.buttons["Validate"].tap() - - verifyValidation() - } - - // MARK: Private Methods - - private func verifyValidation() { - let app = XCUIApplication() - let webview = app.staticTexts.element(matching: .any, identifier: "webview") - let webviewExists = webview.waitForExistence(timeout: 10) - - XCTAssertTrue(webviewExists) - } -} diff --git a/Gemfile b/Gemfile deleted file mode 100644 index 1549a90..0000000 --- a/Gemfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://rubygems.org' - -gem 'fastlane', '~> 2.163.0' -gem 'cocoapods', '~> 1.10.0' -gem 'jazzy', '~> 0.13' \ No newline at end of file diff --git a/LICENSE b/LICENSE deleted file mode 100644 index e29326a..0000000 --- a/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright © Flávio Caetano - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..7adcda5 --- /dev/null +++ b/Package.swift @@ -0,0 +1,30 @@ +// swift-tools-version:5.3 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "ReCaptcha", + platforms: [.iOS(.v13)], + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "ReCaptcha", + targets: ["ReCaptcha"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "ReCaptcha", + dependencies: [], + resources: [.copy("recaptcha.html")]), + .testTarget( + name: "ReCaptchaTests", + dependencies: ["ReCaptcha"]), + ] +) diff --git a/README.md b/README.md index d0fd1c9..1ba9328 100644 --- a/README.md +++ b/README.md @@ -1,117 +1,3 @@ # ReCaptcha -[![Build Status](https://travis-ci.org/fjcaetano/ReCaptcha.svg?branch=master)](https://travis-ci.org/fjcaetano/ReCaptcha) -[![codecov](https://codecov.io/gh/fjcaetano/ReCaptcha/branch/master/graph/badge.svg)](https://codecov.io/gh/fjcaetano/ReCaptcha) -[![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/fjcaetano/ReCaptcha/pulls) -[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-orange.svg)](https://github.com/Carthage/Carthage) -[![Version](https://img.shields.io/cocoapods/v/ReCaptcha.svg?style=flat)](http://cocoapods.org/pods/ReCaptcha) -[![License](https://img.shields.io/cocoapods/l/ReCaptcha.svg?style=flat)](http://cocoapods.org/pods/ReCaptcha) -[![Platform](https://img.shields.io/cocoapods/p/ReCaptcha.svg?style=flat)](http://cocoapods.org/pods/ReCaptcha) - ------ - -Add Google's [Invisible ReCaptcha v2](https://developers.google.com/recaptcha/docs/invisible) to your project. This library -automatically handles ReCaptcha's events and retrieves the validation token or notifies you to present the challenge if -invisibility is not possible. - -![Example Gif 2](https://raw.githubusercontent.com/fjcaetano/ReCaptcha/master/example2.gif) ![Example Gif](https://raw.githubusercontent.com/fjcaetano/ReCaptcha/master/example.gif) - -#### _Warning_ ⚠️ - -Beware that this library only works for ReCaptcha v2 Invisible keys! Make sure to check the reCAPTCHA -v2 Invisible badge option when creating your [API Key](https://www.google.com/recaptcha/admin/create). - -![ReCaptcha v2 invisible key example](https://raw.githubusercontent.com/fjcaetano/ReCaptcha/master/example-v2-key.png) - -You won't be able to use a ReCaptcha v3 key because it requires server-side validation. On v3, all -challenges succeed into a token which is then validated in the server for a score. For this reason, -a frontend app can't know on its own wether or not a user is valid since the challenge will always -result in a valid token. - -## Installation - -ReCaptcha is available through [CocoaPods](http://cocoapods.org) and [Carthage](https://github.com/Carthage/Carthage). -To install it, simply add the following line to your dependencies file: - -#### Cocoapods -``` ruby -pod "ReCaptcha" -# or -pod "ReCaptcha/RxSwift" -``` - -#### Carthage -``` ruby -github "fjcaetano/ReCaptcha" -``` - -Carthage will create two different frameworks named `ReCaptcha` and `ReCaptcha_RxSwift`, the latter containing the RxSwift -extension for the ReCaptcha framework. - -## Usage - -The reCAPTCHA keys can be specified as Info.plist keys or can be passed as parameters when instantiating ReCaptcha(). - -For the Info.plist configuration, add `ReCaptchaKey` and `ReCaptchaDomain` (with a protocol ex. http:// or https://) to your Info.plist and run: - -``` swift -let recaptcha = try? ReCaptcha() - -override func viewDidLoad() { - super.viewDidLoad() - - recaptcha?.configureWebView { [weak self] webview in - webview.frame = self?.view.bounds ?? CGRect.zero - } -} - - -func validate() { - recaptcha?.validate(on: view) { [weak self] (result: ReCaptchaResult) in - print(try? result.dematerialize()) - } -} -``` - -If instead you prefer to keep the information out of the Info.plist, you can use: -``` swift -let recaptcha = try? ReCaptcha( - apiKey: "YOUR_RECAPTCHA_KEY", - baseURL: URL(string: "YOUR_RECAPTCHA_DOMAIN")! -) - -... -``` - -You can also install the reactive subpod and use it with RxSwift: - -``` swift -recaptcha.rx.validate(on: view) - .subscribe(onNext: { (token: String) in - // Do something - }) -``` - -#### Alternte endpoint - -If your app has firewall limitations that may be blocking Google's API, the JS endpoint may be changed on initialization. -It'll then point to `https://www.recaptcha.net/recaptcha/api.js`: - -``` swift -public enum Endpoint { - case default, alternate -} - -let recaptcha = try? ReCaptcha(endpoint: .alternate) // Defaults to `default` when unset -``` - -## Help Wanted - -Do you love ReCaptcha and work actively on apps that use it? We'd love if you could help us keep improving it! -Feel free to message us or to start contributing right away! - -## [Full Documentation](http://fjcaetano.github.io/ReCaptcha) - -## License - -ReCaptcha is available under the MIT license. See the LICENSE file for more info. +A description of this package. diff --git a/ReCaptcha-Carthage.xcodeproj/project.pbxproj b/ReCaptcha-Carthage.xcodeproj/project.pbxproj deleted file mode 100644 index 36e4ac3..0000000 --- a/ReCaptcha-Carthage.xcodeproj/project.pbxproj +++ /dev/null @@ -1,561 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - F206BAB51F8D3DE900A25807 /* ReCaptcha-Carthage.h in Headers */ = {isa = PBXBuildFile; fileRef = F206BAB31F8D3DE900A25807 /* ReCaptcha-Carthage.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F206BB1D1F8D4DBC00A25807 /* ReCaptcha_RxSwift.h in Headers */ = {isa = PBXBuildFile; fileRef = F206BB1B1F8D4DBC00A25807 /* ReCaptcha_RxSwift.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F206BB221F8D4DDF00A25807 /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F206BB121F8D4D1400A25807 /* RxSwift.framework */; }; - F231B39A1FEC51C800F82943 /* DispatchQueue+Throttle.swift in Sources */ = {isa = PBXBuildFile; fileRef = F231B3991FEC51C800F82943 /* DispatchQueue+Throttle.swift */; }; - F24EA1E11F9683FB001DEC17 /* ReCaptcha+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = F24EA1DD1F9683F5001DEC17 /* ReCaptcha+Rx.swift */; }; - F24EA1E21F968403001DEC17 /* ReCaptchaDecoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = F24EA1D81F9683F5001DEC17 /* ReCaptchaDecoder.swift */; }; - F24EA1E31F968403001DEC17 /* ReCaptchaWebViewManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F24EA1D91F9683F5001DEC17 /* ReCaptchaWebViewManager.swift */; }; - F24EA1E41F968403001DEC17 /* String+Dict.swift in Sources */ = {isa = PBXBuildFile; fileRef = F24EA1DA1F9683F5001DEC17 /* String+Dict.swift */; }; - F24EA1E51F968403001DEC17 /* ReCaptchaError.swift in Sources */ = {isa = PBXBuildFile; fileRef = F24EA1DB1F9683F5001DEC17 /* ReCaptchaError.swift */; }; - F24EA1E61F968403001DEC17 /* ReCaptcha.swift in Sources */ = {isa = PBXBuildFile; fileRef = F24EA1DE1F9683F5001DEC17 /* ReCaptcha.swift */; }; - F24EA1E71F968406001DEC17 /* recaptcha.html in Resources */ = {isa = PBXBuildFile; fileRef = F24EA1E01F9683F5001DEC17 /* recaptcha.html */; }; - F2AE8614204F3B42002E28D7 /* ReCaptchaResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2AE8613204F3B41002E28D7 /* ReCaptchaResult.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - F206BB231F8D4DF800A25807 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = F206BAA71F8D3DE900A25807 /* Project object */; - proxyType = 1; - remoteGlobalIDString = F206BAAF1F8D3DE900A25807; - remoteInfo = ReCaptcha; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - F206BAB01F8D3DE900A25807 /* ReCaptcha.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ReCaptcha.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - F206BAB31F8D3DE900A25807 /* ReCaptcha-Carthage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ReCaptcha-Carthage.h"; sourceTree = ""; }; - F206BAB41F8D3DE900A25807 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - F206BACF1F8D3E2800A25807 /* Cartfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cartfile; sourceTree = ""; }; - F206BB121F8D4D1400A25807 /* RxSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RxSwift.framework; path = Carthage/Build/iOS/RxSwift.framework; sourceTree = ""; }; - F206BB191F8D4DBC00A25807 /* ReCaptcha_RxSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ReCaptcha_RxSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - F206BB1B1F8D4DBC00A25807 /* ReCaptcha_RxSwift.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReCaptcha_RxSwift.h; sourceTree = ""; }; - F206BB1C1F8D4DBC00A25807 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - F231B3991FEC51C800F82943 /* DispatchQueue+Throttle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DispatchQueue+Throttle.swift"; sourceTree = ""; }; - F24EA1D81F9683F5001DEC17 /* ReCaptchaDecoder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReCaptchaDecoder.swift; sourceTree = ""; }; - F24EA1D91F9683F5001DEC17 /* ReCaptchaWebViewManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReCaptchaWebViewManager.swift; sourceTree = ""; }; - F24EA1DA1F9683F5001DEC17 /* String+Dict.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Dict.swift"; sourceTree = ""; }; - F24EA1DB1F9683F5001DEC17 /* ReCaptchaError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReCaptchaError.swift; sourceTree = ""; }; - F24EA1DD1F9683F5001DEC17 /* ReCaptcha+Rx.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ReCaptcha+Rx.swift"; sourceTree = ""; }; - F24EA1DE1F9683F5001DEC17 /* ReCaptcha.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReCaptcha.swift; sourceTree = ""; }; - F24EA1E01F9683F5001DEC17 /* recaptcha.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = recaptcha.html; sourceTree = ""; }; - F2AE8613204F3B41002E28D7 /* ReCaptchaResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReCaptchaResult.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - F206BAAC1F8D3DE900A25807 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F206BB151F8D4DBC00A25807 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - F206BB221F8D4DDF00A25807 /* RxSwift.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - F206BAA61F8D3DE900A25807 = { - isa = PBXGroup; - children = ( - F206BACF1F8D3E2800A25807 /* Cartfile */, - F206BAB21F8D3DE900A25807 /* ReCaptcha-Carthage */, - F206BB1A1F8D4DBC00A25807 /* ReCaptcha_RxSwift */, - F206BAB11F8D3DE900A25807 /* Products */, - F206BAD11F8D3E7600A25807 /* Frameworks */, - F24EA1D41F967F21001DEC17 /* Recovered References */, - ); - sourceTree = ""; - }; - F206BAB11F8D3DE900A25807 /* Products */ = { - isa = PBXGroup; - children = ( - F206BAB01F8D3DE900A25807 /* ReCaptcha.framework */, - F206BB191F8D4DBC00A25807 /* ReCaptcha_RxSwift.framework */, - ); - name = Products; - sourceTree = ""; - }; - F206BAB21F8D3DE900A25807 /* ReCaptcha-Carthage */ = { - isa = PBXGroup; - children = ( - F24EA1D61F9683F5001DEC17 /* ReCaptcha */, - F206BAB31F8D3DE900A25807 /* ReCaptcha-Carthage.h */, - F206BAB41F8D3DE900A25807 /* Info.plist */, - ); - path = "ReCaptcha-Carthage"; - sourceTree = ""; - }; - F206BAD11F8D3E7600A25807 /* Frameworks */ = { - isa = PBXGroup; - children = ( - F206BB121F8D4D1400A25807 /* RxSwift.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - F206BB1A1F8D4DBC00A25807 /* ReCaptcha_RxSwift */ = { - isa = PBXGroup; - children = ( - F206BB1B1F8D4DBC00A25807 /* ReCaptcha_RxSwift.h */, - F206BB1C1F8D4DBC00A25807 /* Info.plist */, - ); - path = ReCaptcha_RxSwift; - sourceTree = ""; - }; - F24EA1D41F967F21001DEC17 /* Recovered References */ = { - isa = PBXGroup; - children = ( - ); - name = "Recovered References"; - sourceTree = ""; - }; - F24EA1D61F9683F5001DEC17 /* ReCaptcha */ = { - isa = PBXGroup; - children = ( - F24EA1D71F9683F5001DEC17 /* Classes */, - F24EA1DF1F9683F5001DEC17 /* Assets */, - ); - path = ReCaptcha; - sourceTree = SOURCE_ROOT; - }; - F24EA1D71F9683F5001DEC17 /* Classes */ = { - isa = PBXGroup; - children = ( - F24EA1D81F9683F5001DEC17 /* ReCaptchaDecoder.swift */, - F24EA1D91F9683F5001DEC17 /* ReCaptchaWebViewManager.swift */, - F24EA1DA1F9683F5001DEC17 /* String+Dict.swift */, - F24EA1DB1F9683F5001DEC17 /* ReCaptchaError.swift */, - F2AE8613204F3B41002E28D7 /* ReCaptchaResult.swift */, - F231B3991FEC51C800F82943 /* DispatchQueue+Throttle.swift */, - F24EA1DC1F9683F5001DEC17 /* Rx */, - F24EA1DE1F9683F5001DEC17 /* ReCaptcha.swift */, - ); - path = Classes; - sourceTree = ""; - }; - F24EA1DC1F9683F5001DEC17 /* Rx */ = { - isa = PBXGroup; - children = ( - F24EA1DD1F9683F5001DEC17 /* ReCaptcha+Rx.swift */, - ); - path = Rx; - sourceTree = ""; - }; - F24EA1DF1F9683F5001DEC17 /* Assets */ = { - isa = PBXGroup; - children = ( - F24EA1E01F9683F5001DEC17 /* recaptcha.html */, - ); - path = Assets; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - F206BAAD1F8D3DE900A25807 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - F206BAB51F8D3DE900A25807 /* ReCaptcha-Carthage.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F206BB161F8D4DBC00A25807 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - F206BB1D1F8D4DBC00A25807 /* ReCaptcha_RxSwift.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - F206BAAF1F8D3DE900A25807 /* ReCaptcha */ = { - isa = PBXNativeTarget; - buildConfigurationList = F206BAB81F8D3DE900A25807 /* Build configuration list for PBXNativeTarget "ReCaptcha" */; - buildPhases = ( - F206BAAB1F8D3DE900A25807 /* Sources */, - F206BAAC1F8D3DE900A25807 /* Frameworks */, - F206BAAD1F8D3DE900A25807 /* Headers */, - F206BAAE1F8D3DE900A25807 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = ReCaptcha; - productName = "ReCaptcha-Carthage"; - productReference = F206BAB01F8D3DE900A25807 /* ReCaptcha.framework */; - productType = "com.apple.product-type.framework"; - }; - F206BB181F8D4DBC00A25807 /* ReCaptcha_RxSwift */ = { - isa = PBXNativeTarget; - buildConfigurationList = F206BB1E1F8D4DBC00A25807 /* Build configuration list for PBXNativeTarget "ReCaptcha_RxSwift" */; - buildPhases = ( - F206BB141F8D4DBC00A25807 /* Sources */, - F206BB151F8D4DBC00A25807 /* Frameworks */, - F206BB161F8D4DBC00A25807 /* Headers */, - F206BB171F8D4DBC00A25807 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - F206BB241F8D4DF800A25807 /* PBXTargetDependency */, - ); - name = ReCaptcha_RxSwift; - productName = ReCaptcha_RxSwift; - productReference = F206BB191F8D4DBC00A25807 /* ReCaptcha_RxSwift.framework */; - productType = "com.apple.product-type.framework"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - F206BAA71F8D3DE900A25807 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0900; - ORGANIZATIONNAME = "Flávio Caetano"; - TargetAttributes = { - F206BAAF1F8D3DE900A25807 = { - CreatedOnToolsVersion = 8.3.2; - ProvisioningStyle = Automatic; - }; - F206BB181F8D4DBC00A25807 = { - CreatedOnToolsVersion = 8.3.2; - ProvisioningStyle = Automatic; - }; - }; - }; - buildConfigurationList = F206BAAA1F8D3DE900A25807 /* Build configuration list for PBXProject "ReCaptcha-Carthage" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - English, - en, - ); - mainGroup = F206BAA61F8D3DE900A25807; - productRefGroup = F206BAB11F8D3DE900A25807 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - F206BAAF1F8D3DE900A25807 /* ReCaptcha */, - F206BB181F8D4DBC00A25807 /* ReCaptcha_RxSwift */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - F206BAAE1F8D3DE900A25807 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - F24EA1E71F968406001DEC17 /* recaptcha.html in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F206BB171F8D4DBC00A25807 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - F206BAAB1F8D3DE900A25807 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - F24EA1E51F968403001DEC17 /* ReCaptchaError.swift in Sources */, - F24EA1E21F968403001DEC17 /* ReCaptchaDecoder.swift in Sources */, - F2AE8614204F3B42002E28D7 /* ReCaptchaResult.swift in Sources */, - F24EA1E61F968403001DEC17 /* ReCaptcha.swift in Sources */, - F24EA1E31F968403001DEC17 /* ReCaptchaWebViewManager.swift in Sources */, - F24EA1E41F968403001DEC17 /* String+Dict.swift in Sources */, - F231B39A1FEC51C800F82943 /* DispatchQueue+Throttle.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F206BB141F8D4DBC00A25807 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - F24EA1E11F9683FB001DEC17 /* ReCaptcha+Rx.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - F206BB241F8D4DF800A25807 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = F206BAAF1F8D3DE900A25807 /* ReCaptcha */; - targetProxy = F206BB231F8D4DF800A25807 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - F206BAB61F8D3DE900A25807 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - F206BAB71F8D3DE900A25807 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.2; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - F206BAB91F8D3DE900A25807 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Carthage/Build/iOS", - ); - INFOPLIST_FILE = "ReCaptcha-Carthage/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.flaviocaetano.ReCaptcha; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; - }; - name = Debug; - }; - F206BABA1F8D3DE900A25807 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Carthage/Build/iOS", - ); - INFOPLIST_FILE = "ReCaptcha-Carthage/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.flaviocaetano.ReCaptcha; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; - }; - name = Release; - }; - F206BB1F1F8D4DBC00A25807 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Carthage/Build/iOS", - "$(PROJECT_DIR)\\ Carthage\\ Test/Carthage/Build/iOS", - ); - INFOPLIST_FILE = ReCaptcha_RxSwift/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - OTHER_SWIFT_FLAGS = "-D IMPORT_RECAPTCHA"; - PRODUCT_BUNDLE_IDENTIFIER = "com.flaviocaetano.ReCaptcha-RxSwift"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; - }; - name = Debug; - }; - F206BB201F8D4DBC00A25807 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Carthage/Build/iOS", - "$(PROJECT_DIR)\\ Carthage\\ Test/Carthage/Build/iOS", - ); - INFOPLIST_FILE = ReCaptcha_RxSwift/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - OTHER_SWIFT_FLAGS = "-D IMPORT_RECAPTCHA"; - PRODUCT_BUNDLE_IDENTIFIER = "com.flaviocaetano.ReCaptcha-RxSwift"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 4.2; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - F206BAAA1F8D3DE900A25807 /* Build configuration list for PBXProject "ReCaptcha-Carthage" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - F206BAB61F8D3DE900A25807 /* Debug */, - F206BAB71F8D3DE900A25807 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - F206BAB81F8D3DE900A25807 /* Build configuration list for PBXNativeTarget "ReCaptcha" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - F206BAB91F8D3DE900A25807 /* Debug */, - F206BABA1F8D3DE900A25807 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - F206BB1E1F8D4DBC00A25807 /* Build configuration list for PBXNativeTarget "ReCaptcha_RxSwift" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - F206BB1F1F8D4DBC00A25807 /* Debug */, - F206BB201F8D4DBC00A25807 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = F206BAA71F8D3DE900A25807 /* Project object */; -} diff --git a/ReCaptcha-Carthage.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ReCaptcha-Carthage.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 0c3c5b1..0000000 --- a/ReCaptcha-Carthage.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/ReCaptcha-Carthage.xcodeproj/xcshareddata/xcschemes/ReCaptcha.xcscheme b/ReCaptcha-Carthage.xcodeproj/xcshareddata/xcschemes/ReCaptcha.xcscheme deleted file mode 100644 index bd454ec..0000000 --- a/ReCaptcha-Carthage.xcodeproj/xcshareddata/xcschemes/ReCaptcha.xcscheme +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ReCaptcha-Carthage.xcodeproj/xcshareddata/xcschemes/ReCaptcha/RxSwift.xcscheme b/ReCaptcha-Carthage.xcodeproj/xcshareddata/xcschemes/ReCaptcha/RxSwift.xcscheme deleted file mode 100644 index 558e9c0..0000000 --- a/ReCaptcha-Carthage.xcodeproj/xcshareddata/xcschemes/ReCaptcha/RxSwift.xcscheme +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ReCaptcha-Carthage.xcodeproj/xcshareddata/xcschemes/ReCaptcha_RxSwift.xcscheme b/ReCaptcha-Carthage.xcodeproj/xcshareddata/xcschemes/ReCaptcha_RxSwift.xcscheme deleted file mode 100644 index 558e9c0..0000000 --- a/ReCaptcha-Carthage.xcodeproj/xcshareddata/xcschemes/ReCaptcha_RxSwift.xcscheme +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ReCaptcha-Carthage/Info.plist b/ReCaptcha-Carthage/Info.plist deleted file mode 100644 index fbe1e6b..0000000 --- a/ReCaptcha-Carthage/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/ReCaptcha-Carthage/ReCaptcha-Carthage.h b/ReCaptcha-Carthage/ReCaptcha-Carthage.h deleted file mode 100644 index cac74ac..0000000 --- a/ReCaptcha-Carthage/ReCaptcha-Carthage.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// ReCaptcha-Carthage.h -// ReCaptcha-Carthage -// -// Created by Flávio Caetano on 10/10/17. -// Copyright © 2017 Flávio Caetano. All rights reserved. -// - -#import - -//! Project version number for ReCaptcha-Carthage. -FOUNDATION_EXPORT double ReCaptcha_CarthageVersionNumber; - -//! Project version string for ReCaptcha-Carthage. -FOUNDATION_EXPORT const unsigned char ReCaptcha_CarthageVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - - diff --git a/ReCaptcha.podspec b/ReCaptcha.podspec deleted file mode 100644 index f00daf4..0000000 --- a/ReCaptcha.podspec +++ /dev/null @@ -1,38 +0,0 @@ - -Pod::Spec.new do |s| - s.name = 'ReCaptcha' - s.version = '1.6.0' - s.summary = 'ReCaptcha for iOS' - s.swift_version = '5.0' - - s.description = <<-DESC -Add Google's [Invisible ReCaptcha](https://developers.google.com/recaptcha/docs/invisible) to your project. This library -automatically handles ReCaptcha's events and retrieves the validation token or notifies you to present the challenge if -invisibility is not possible. - DESC - - s.homepage = 'https://github.com/fjcaetano/ReCaptcha' - s.license = { :type => 'MIT', :file => 'LICENSE' } - s.author = { 'Flávio Caetano' => 'flavio@vieiracaetano.com' } - s.source = { :git => 'https://github.com/fjcaetano/ReCaptcha.git', :tag => s.version.to_s } - s.social_media_url = 'https://twitter.com/flavio_caetano' - s.documentation_url = 'http://fjcaetano.github.io/ReCaptcha' - - s.ios.deployment_target = '9.0' - s.default_subspecs = 'Core' - - s.subspec 'Core' do |core| - core.source_files = 'ReCaptcha/Classes/*' - core.frameworks = 'WebKit' - - core.resource_bundles = { - 'ReCaptcha' => ['ReCaptcha/Assets/**/*'] - } - end - - s.subspec 'RxSwift' do |rx| - rx.source_files = 'ReCaptcha/Classes/Rx/**/*' - rx.dependency 'ReCaptcha/Core' - rx.dependency 'RxSwift', '~> 6.0' - end -end diff --git a/ReCaptcha/Classes/Rx/ReCaptcha+Rx.swift b/ReCaptcha/Classes/Rx/ReCaptcha+Rx.swift deleted file mode 100644 index 100d792..0000000 --- a/ReCaptcha/Classes/Rx/ReCaptcha+Rx.swift +++ /dev/null @@ -1,84 +0,0 @@ -// -// ReCaptcha+Rx.swift -// ReCaptcha -// -// Created by Flávio Caetano on 11/04/17. -// Copyright © 2018 ReCaptcha. All rights reserved. -// - -import RxSwift -import UIKit - -/// Makes ReCaptcha compatible with RxSwift extensions -extension ReCaptcha: ReactiveCompatible {} - -/// Provides a public extension on ReCaptcha that makes it reactive. -public extension Reactive where Base: ReCaptcha { - - /** - - parameters: - - view: The view that should present the webview. - - resetOnError: If ReCaptcha should be reset if it errors. Defaults to `true` - - Starts the challenge validation uppon subscription. - - The stream's element is a String with the validation token. - - Sends `stop()` uppon disposal. - - - See: `ReCaptcha.validate(on:resetOnError:completion:)` - - See: `ReCaptcha.stop()` - */ - func validate(on view: UIView, resetOnError: Bool = true) -> Observable { - return Single.create { [weak base] single in - base?.validate(on: view, resetOnError: resetOnError) { result in - switch result { - case .token(let token): - single(.success(token)) - - case .error(let error): - single(.failure(error)) - } - } - - return Disposables.create { [weak base] in - base?.stop() - } - } - .asObservable() - } - - /** - Resets the ReCaptcha. - - The reset is achieved by calling `grecaptcha.reset()` on the JS API. - - - See: `ReCaptcha.reset()` - */ - var reset: AnyObserver { - return AnyObserver { [weak base] event in - guard case .next = event else { - return - } - - base?.reset() - } - } - - /** - Notifies when the webview finishes loading all JS resources - - This Observable may produce multiple events since the resources may be loaded multiple times in - case of error or reset. This may also immediately produce an event if the resources have - already finished loading when you subscribe to this Observable. - */ - var didFinishLoading: Observable { - return Observable.create { [weak base] (observer: AnyObserver) in - base?.didFinishLoading { observer.onNext(()) } - - return Disposables.create { [weak base] in - base?.didFinishLoading(nil) - } - } - } -} diff --git a/ReCaptcha_RxSwift/Info.plist b/ReCaptcha_RxSwift/Info.plist deleted file mode 100644 index fbe1e6b..0000000 --- a/ReCaptcha_RxSwift/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/ReCaptcha_RxSwift/ReCaptcha_RxSwift.h b/ReCaptcha_RxSwift/ReCaptcha_RxSwift.h deleted file mode 100644 index 02c3ca6..0000000 --- a/ReCaptcha_RxSwift/ReCaptcha_RxSwift.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// ReCaptcha_RxSwift.h -// ReCaptcha_RxSwift -// -// Created by Flávio Caetano on 10/10/17. -// Copyright © 2017 Flávio Caetano. All rights reserved. -// - -#import - -@import ReCaptcha; - -//! Project version number for ReCaptcha_RxSwift. -FOUNDATION_EXPORT double ReCaptcha_RxSwiftVersionNumber; - -//! Project version string for ReCaptcha_RxSwift. -FOUNDATION_EXPORT const unsigned char ReCaptcha_RxSwiftVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - - diff --git a/ReCaptcha/Classes/DispatchQueue+Throttle.swift b/Sources/ReCaptcha/DispatchQueue+Throttle.swift similarity index 100% rename from ReCaptcha/Classes/DispatchQueue+Throttle.swift rename to Sources/ReCaptcha/DispatchQueue+Throttle.swift diff --git a/ReCaptcha/Classes/ReCaptcha.swift b/Sources/ReCaptcha/ReCaptcha.swift similarity index 96% rename from ReCaptcha/Classes/ReCaptcha.swift rename to Sources/ReCaptcha/ReCaptcha.swift index d552175..11447ca 100644 --- a/ReCaptcha/Classes/ReCaptcha.swift +++ b/Sources/ReCaptcha/ReCaptcha.swift @@ -5,7 +5,6 @@ // Created by Flávio Caetano on 22/03/17. // Copyright © 2018 ReCaptcha. All rights reserved. // - import Foundation import WebKit @@ -56,14 +55,7 @@ public class ReCaptcha { /// The Bundle that holds ReCaptcha's assets private static let bundle: Bundle = { - let bundle = Bundle(for: ReCaptcha.self) - guard let cocoapodsBundle = bundle - .path(forResource: "ReCaptcha", ofType: "bundle") - .flatMap(Bundle.init(path:)) else { - return bundle - } - - return cocoapodsBundle + return Bundle.module }() /** @@ -72,7 +64,6 @@ public class ReCaptcha { - infoPlistKey: The API key retrived from the application's Info.plist - baseURL: The base URL sent to the ReCaptcha init - infoPlistURL: The base URL retrieved from the application's Info.plist - - Throws: `ReCaptchaError.htmlLoadError`: if is unable to load the HTML embedded in the bundle. - Throws: `ReCaptchaError.apiKeyNotFound`: if an `apiKey` is not provided and can't find one in the project's Info.plist. @@ -112,12 +103,9 @@ public class ReCaptcha { - locale: A locale value to translate ReCaptcha into a different language Initializes a ReCaptcha object - Both `apiKey` and `baseURL` may be nil, in which case the lib will look for entries of `ReCaptchaKey` and `ReCaptchaDomain`, respectively, in the project's Info.plist - A key may be aquired here: https://www.google.com/recaptcha/admin#list - - Throws: `ReCaptchaError.htmlLoadError`: if is unable to load the HTML embedded in the bundle. - Throws: `ReCaptchaError.apiKeyNotFound`: if an `apiKey` is not provided and can't find one in the project's Info.plist. @@ -148,7 +136,6 @@ public class ReCaptcha { /** - parameter manager: A ReCaptchaWebViewManager instance. - Initializes ReCaptcha with the given manager */ init(manager: ReCaptchaWebViewManager) { @@ -160,7 +147,6 @@ public class ReCaptcha { - view: The view that should present the webview. - resetOnError: If ReCaptcha should be reset if it errors. Defaults to `true`. - completion: A closure that receives a ReCaptchaResult which may contain a valid result token. - Starts the challenge validation */ public func validate(on view: UIView, resetOnError: Bool = true, completion: @escaping (ReCaptchaResult) -> Void) { @@ -179,9 +165,7 @@ public class ReCaptcha { /** - parameter configure: A closure that receives an instance of `WKWebView` for configuration. - Provides a closure to configure the webview for presentation if necessary. - If presentation is required, the webview will already be a subview of `presenterView` if one is provided. Otherwise it might need to be added in a view currently visible. */ @@ -191,7 +175,6 @@ public class ReCaptcha { /** Resets the ReCaptcha. - The reset is achieved by calling `grecaptcha.reset()` on the JS API. */ public func reset() { @@ -200,9 +183,7 @@ public class ReCaptcha { /** - parameter closure: A closure that is called when the JS bundle finishes loading. - Provides a closure to be notified when the webview finishes loading JS resources. - The closure may be called multiple times since the resources may also be loaded multiple times in case of error or reset. This may also be immediately called if the resources have already finished loading when you set the closure. @@ -210,9 +191,16 @@ public class ReCaptcha { public func didFinishLoading(_ closure: (() -> Void)?) { manager.onDidFinishLoading = closure } + + /** + - parameter closure: A closure that is called when ReCaptcha view will be shown. + Doesn't get called in case of invisible validation. + */ + public func onWillShowReCaptchaView(_ closure: (() -> Void)?) { + manager.onWillShowReCaptchaView = closure + } // MARK: - Development - #if DEBUG /// Forces the challenge widget to be explicitly displayed. public var forceVisibleChallenge: Bool { @@ -222,7 +210,6 @@ public class ReCaptcha { /** Allows validation stubbing for testing - When this property is set to `true`, every call to `validate()` will immediately be resolved with `.token("")`. Use only when testing your application. @@ -235,12 +222,10 @@ public class ReCaptcha { } // MARK: - Private Methods - private extension ReCaptcha.Config { /** - parameter url: The URL to be fixed - returns: An URL with scheme - If the given URL has no scheme, prepends `http://` to it and return the fixed URL. */ static func fixSchemeIfNeeded(for url: URL) -> URL { diff --git a/ReCaptcha/Classes/ReCaptchaDecoder.swift b/Sources/ReCaptcha/ReCaptchaDecoder.swift similarity index 100% rename from ReCaptcha/Classes/ReCaptchaDecoder.swift rename to Sources/ReCaptcha/ReCaptchaDecoder.swift diff --git a/ReCaptcha/Classes/ReCaptchaError.swift b/Sources/ReCaptcha/ReCaptchaError.swift similarity index 100% rename from ReCaptcha/Classes/ReCaptchaError.swift rename to Sources/ReCaptcha/ReCaptchaError.swift diff --git a/ReCaptcha/Classes/ReCaptchaResult.swift b/Sources/ReCaptcha/ReCaptchaResult.swift similarity index 100% rename from ReCaptcha/Classes/ReCaptchaResult.swift rename to Sources/ReCaptcha/ReCaptchaResult.swift diff --git a/ReCaptcha/Classes/ReCaptchaWebViewManager.swift b/Sources/ReCaptcha/ReCaptchaWebViewManager.swift similarity index 97% rename from ReCaptcha/Classes/ReCaptchaWebViewManager.swift rename to Sources/ReCaptcha/ReCaptchaWebViewManager.swift index b808040..32c90dd 100644 --- a/ReCaptcha/Classes/ReCaptchaWebViewManager.swift +++ b/Sources/ReCaptcha/ReCaptchaWebViewManager.swift @@ -52,6 +52,9 @@ internal class ReCaptchaWebViewManager { } } } + + /// Notifies that ReCaptcha view will be shown. Doesn't call in case of invisible validation. + var onWillShowReCaptchaView: (() -> Void)? /// Configures the webview for display when required var configureWebView: ((WKWebView) -> Void)? @@ -199,6 +202,7 @@ fileprivate extension ReCaptchaWebViewManager { } case .showReCaptcha: + onWillShowReCaptchaView?() DispatchQueue.once(token: configureWebViewDispatchToken) { [weak self] in guard let `self` = self else { return } self.configureWebView?(self.webView) diff --git a/ReCaptcha/Classes/String+Dict.swift b/Sources/ReCaptcha/String+Dict.swift similarity index 100% rename from ReCaptcha/Classes/String+Dict.swift rename to Sources/ReCaptcha/String+Dict.swift diff --git a/ReCaptcha/Assets/recaptcha.html b/Sources/ReCaptcha/recaptcha.html similarity index 100% rename from ReCaptcha/Assets/recaptcha.html rename to Sources/ReCaptcha/recaptcha.html diff --git a/Tests/ReCaptchaTests/ReCaptchaTests.swift b/Tests/ReCaptchaTests/ReCaptchaTests.swift new file mode 100644 index 0000000..5c59d8a --- /dev/null +++ b/Tests/ReCaptchaTests/ReCaptchaTests.swift @@ -0,0 +1,11 @@ + import XCTest + @testable import ReCaptcha + + final class ReCaptchaTests: XCTestCase { + func testExample() { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct + // results. + XCTAssertEqual(ReCaptcha().text, "Hello, World!") + } + } diff --git a/_Pods.xcodeproj b/_Pods.xcodeproj deleted file mode 120000 index 3c5a8e7..0000000 --- a/_Pods.xcodeproj +++ /dev/null @@ -1 +0,0 @@ -Example/Pods/Pods.xcodeproj \ No newline at end of file diff --git a/carthage.sh b/carthage.sh deleted file mode 100755 index fa44975..0000000 --- a/carthage.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -# carthage.sh -# Usage example: ./carthage.sh build --platform iOS - -set -euo pipefail - -xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX) -trap 'rm -f "$xcconfig"' INT TERM HUP EXIT - -# For Xcode 12 make sure EXCLUDED_ARCHS is set to arm architectures otherwise -# the build will fail on lipo due to duplicate architectures. -echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig -echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig - -export XCODE_XCCONFIG_FILE="$xcconfig" -carthage "$@" \ No newline at end of file diff --git a/codecov.yml b/codecov.yml deleted file mode 100644 index 2c11920..0000000 --- a/codecov.yml +++ /dev/null @@ -1,26 +0,0 @@ -codecov: - branch: master - -coverage: - precision: 2 - round: down - range: "75...95" - - status: - project: - default: - target: auto - threshold: null - branches: null - - patch: - default: - target: auto - branches: null - - changes: - default: - branches: null - -ignore: - - "Example/" diff --git a/example-v2-key.png b/example-v2-key.png deleted file mode 100644 index 77d877d..0000000 Binary files a/example-v2-key.png and /dev/null differ diff --git a/example.gif b/example.gif deleted file mode 100644 index cc99209..0000000 Binary files a/example.gif and /dev/null differ diff --git a/example2.gif b/example2.gif deleted file mode 100644 index 7538d69..0000000 Binary files a/example2.gif and /dev/null differ diff --git a/fastlane/Fastfile b/fastlane/Fastfile deleted file mode 100644 index a947148..0000000 --- a/fastlane/Fastfile +++ /dev/null @@ -1,169 +0,0 @@ -fastlane_version "2.126" - -default_platform :ios - -platform :ios do - skip_docs - - devices = ["iPhone X (~> 12)"] - # devices << "iPhone X (~> 11)" if !Helper.is_ci? - # devices << "iPhone 7 (~> 10)" if !Helper.is_ci? - # devices << "iPhone 6s (~> 9)" if !Helper.is_ci? - - desc "Runs the following lanes:\n- test\n- pod_lint\n- carthage_lint" - lane :ci do - test - pod_lint - carthage_lint - end - - desc "Runs all the tests" - lane :test do - cocoapods( - podfile: "Example/Podfile", - try_repo_update_on_error: true, - ) - - swiftlint( - executable: "Example/Pods/Swiftlint/swiftlint", - strict: true, - reporter: "emoji", - ) - - # The problem lies in the fact (or rather: serious bug in xcodebuild) that - # the timeout for connecting to the XCTest server starts at the moment you - # issue the command xcodebuild. The timeout is 120 seconds, so if your - # compilation + startup of the simulator takes longer than 2 minutes - # xcodebuild will give this "Canceling tests due to timeout" error. - # https://stackoverflow.com/questions/37922146/xctests-failing-on-physical-device-canceling-tests-due-to-timeout/40790171#40790171 - scan( - build_for_testing: true, - devices: self.select_similar_simulator(devices), - scheme: "ReCaptcha-Example", - workspace: "Example/ReCaptcha.xcworkspace", - code_coverage: true, - ) - - scan( - test_without_building: true, - devices: self.select_similar_simulator(devices), - scheme: "ReCaptcha-Example", - workspace: "Example/ReCaptcha.xcworkspace", - code_coverage: true, - ) - - codecov( - project_name: 'ReCaptcha', - use_xcodeplist: true, - ) - - unless Helper.is_ci? - puts "Running UI Tests" - scan( - test_without_building: true, - devices: self.select_similar_simulator(devices), - scheme: "ReCaptcha_UITests", - workspace: "Example/ReCaptcha.xcworkspace", - code_coverage: true, - ) - - puts "Not CI: Skipping coverage files upload" - end - end - - desc "Lint Cocoapods Lib" - lane :pod_lint do - pod_lib_lint( - allow_warnings: true, # Temporarily necessary while this issue isn't fixed: https://github.com/CocoaPods/CocoaPods/issues/10291 - ) - end - - desc "Lint Carthage lib" - lane :carthage_lint do - - # This is a temporary fix while Carthage is broken with Xcode 12 - # https://github.com/Carthage/Carthage/issues/3019#issuecomment-665136323 - # - # The default Fastlane action can be used when a new Carthage version with a fix has been released - # and the ./carthage.sh script can be removed - Dir.chdir("..") do - sh("./carthage.sh", "update", "--platform", "iOS", "--cache-builds") - - sh("./carthage.sh", "build", "--no-skip-current", "--platform", "iOS", "--cache-builds") - end - - # carthage( - # command: "update", - # platform: "iOS", - # cache_builds: true, - # ) - - # carthage( - # command: "build", - # platform: "iOS", - # cache_builds: true, - # no_skip_current: true, - # ) - end - - desc "Deploy a new version to Github and Cocoapods" - lane :release do - # Checking files - tag = last_git_tag - - changelog_contents = File.read '../CHANGELOG.md' - if !changelog_contents.include? tag - UI.user_error! "CHANGELOG hasn't been updated" - end - - if version_get_podspec != tag - UI.user_error! "Podspec version different than tag name" - end - - # This is a temporary fix while Carthage is broken with Xcode 12 - # https://github.com/Carthage/Carthage/issues/3019#issuecomment-665136323 - # - # The default Fastlane action can be used when a new Carthage version with a fix has been released - # and the ./carthage.sh script can be removed - Dir.chdir("..") do - sh("./carthage.sh", "archive") - end - - # carthage( - # command: "archive", - # ) - - pod_push( - path: "ReCaptcha.podspec", - verbose: true, - ) - - prev_tag = sh "git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`" - changelog = changelog_from_git_commits( - between: [tag, prev_tag.strip], - pretty: "- %s" - ) - - set_github_release( - repository_name: "fjcaetano/ReCaptcha", - tag_name: tag, - name: tag, - upload_assets: ["ReCaptcha.framework.zip"], - description: changelog, - ) - end - - # Private - - def select_similar_simulator(args) - args.map { |device_string| - pieces = device_string.split(' (') - FastlaneCore::Simulator.all - .select { |s| s.name == pieces.first } - .sort_by { |s| Gem::Version.create(s.os_version) } - .detect { |s| Gem::Requirement.new(pieces[1].tr('()', '')).satisfied_by?(Gem::Version.create(s.os_version)) } - } - .compact - .map { |s| "#{s.name} (#{s.ios_version})"} - end -end diff --git a/fastlane/actions/codecov b/fastlane/actions/codecov deleted file mode 160000 index 86af438..0000000 --- a/fastlane/actions/codecov +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 86af4384bb211fcb3194522e40aa9274af00fc08 diff --git a/fastlane/actions/codecov.rb b/fastlane/actions/codecov.rb deleted file mode 120000 index d4efafe..0000000 --- a/fastlane/actions/codecov.rb +++ /dev/null @@ -1 +0,0 @@ -codecov/codecov.rb \ No newline at end of file diff --git a/pre-push.sh b/pre-push.sh deleted file mode 100755 index ed04ae4..0000000 --- a/pre-push.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -if $(which bundle &> /dev/null); then - bundle exec fastlane ci -elif $(which fastlane &> /dev/null); then - fastlane ci -else - echo 'Fastlane not installed; Run `bundle install` or install Fastlane directly' - exit 1 -fi