From 05a75e1d7fd3ea48bfbe9a5837269bf3593b3a93 Mon Sep 17 00:00:00 2001 From: Ross Butler Date: Sun, 17 May 2020 20:51:38 +0100 Subject: [PATCH] Release 1.0.0 --- CHANGELOG.md | 4 ++ .../project.pbxproj | 6 ++- Example/Pods/Pods.xcodeproj/project.pbxproj | 40 ++++++++----------- .../Hyperconnectivity-Info.plist | 40 +++++++++---------- .../Tests/ConnectivityPublisherTests.swift | 6 +-- .../Tests/ConnectivitySubscriptionTests.swift | 1 - .../Tests/ReachabilityPublisherTests.swift | 29 ++++++++++++++ Hyperconnectivity.podspec | 2 +- .../Combine/ReachabilityPublisher.swift | 2 +- .../Combine/ReachabilitySubscription.swift | 3 +- .../Classes/Model/Configuration.swift | 27 +++++++++---- README.md | 2 - 12 files changed, 102 insertions(+), 60 deletions(-) create mode 100644 Example/Tests/ReachabilityPublisherTests.swift diff --git a/CHANGELOG.md b/CHANGELOG.md index 956ed3b..2c747df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.0.0] - 2020-05-17 +### Added +- Increased unit test coverage to 90%. + ## [0.2.0] - 2020-05-08 ### Added - Support for Carthage and Swift Package Manager. diff --git a/Example/Hyperconnectivity.xcodeproj/project.pbxproj b/Example/Hyperconnectivity.xcodeproj/project.pbxproj index 4c1f5a1..fd37800 100644 --- a/Example/Hyperconnectivity.xcodeproj/project.pbxproj +++ b/Example/Hyperconnectivity.xcodeproj/project.pbxproj @@ -22,6 +22,7 @@ 13962F2024719F1700CCE8B9 /* string-contains-response.html in Resources */ = {isa = PBXBuildFile; fileRef = 13962F1B24719EDE00CCE8B9 /* string-contains-response.html */; }; 13962F232471AA1600CCE8B9 /* ConnectivityPublisherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13962F222471AA1600CCE8B9 /* ConnectivityPublisherTests.swift */; }; 13962F252471B48700CCE8B9 /* failure-response.html in Resources */ = {isa = PBXBuildFile; fileRef = 13962F242471B48700CCE8B9 /* failure-response.html */; }; + 13C3D88F2471C36800E0A879 /* ReachabilityPublisherTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13C3D88E2471C36800E0A879 /* ReachabilityPublisherTests.swift */; }; 13EDCA922465DDFB006FAE75 /* UIColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13EDCA912465DDFB006FAE75 /* UIColor.swift */; }; 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; }; 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; }; @@ -55,6 +56,7 @@ 13962F1D24719EF600CCE8B9 /* string-equality-response.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "string-equality-response.html"; sourceTree = ""; }; 13962F222471AA1600CCE8B9 /* ConnectivityPublisherTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectivityPublisherTests.swift; sourceTree = ""; }; 13962F242471B48700CCE8B9 /* failure-response.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "failure-response.html"; sourceTree = ""; }; + 13C3D88E2471C36800E0A879 /* ReachabilityPublisherTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReachabilityPublisherTests.swift; sourceTree = ""; }; 13EDCA912465DDFB006FAE75 /* UIColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIColor.swift; sourceTree = ""; }; 3CA628B2EBED9449AB582CF5 /* Pods-Hyperconnectivity_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Hyperconnectivity_Tests.release.xcconfig"; path = "Target Support Files/Pods-Hyperconnectivity_Tests/Pods-Hyperconnectivity_Tests.release.xcconfig"; sourceTree = ""; }; 5906C1669FAA2FD5D578F683 /* Pods_Hyperconnectivity_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Hyperconnectivity_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -172,13 +174,14 @@ 607FACE81AFB9204008FA782 /* Tests */ = { isa = PBXGroup; children = ( - 13962F212471A95F00CCE8B9 /* Response Validation Tests */, 13962F102471919F00CCE8B9 /* Mocks */, + 13962F212471A95F00CCE8B9 /* Response Validation Tests */, 134B21BF2468779E00A8F332 /* ConnectionTests.swift */, 134B21BC2466DC7200A8F332 /* ConnectivityStateTests.swift */, 607FACEB1AFB9204008FA782 /* PercentageTests.swift */, 13962F09246F3F7300CCE8B9 /* ConnectivitySubscriptionTests.swift */, 13962F222471AA1600CCE8B9 /* ConnectivityPublisherTests.swift */, + 13C3D88E2471C36800E0A879 /* ReachabilityPublisherTests.swift */, 607FACE91AFB9204008FA782 /* Supporting Files */, ); path = Tests; @@ -428,6 +431,7 @@ 13962F0A246F3F7300CCE8B9 /* ConnectivitySubscriptionTests.swift in Sources */, 13962F1A247196F800CCE8B9 /* ResponseContainsStringValidatorTests.swift in Sources */, 13962F18247196AE00CCE8B9 /* ResponseStringEqualityValidatorTests.swift in Sources */, + 13C3D88F2471C36800E0A879 /* ReachabilityPublisherTests.swift in Sources */, 13962F162471968300CCE8B9 /* ResponseRegExValidatorTests.swift in Sources */, 607FACEC1AFB9204008FA782 /* PercentageTests.swift in Sources */, 134B21C1246877F300A8F332 /* ConnectionTests.swift in Sources */, diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index a23cb52..2722303 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -87,7 +87,7 @@ 053D11B7D73CF7BBCDF43E9700F9B90E /* ConnectivitySubscription.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ConnectivitySubscription.swift; sourceTree = ""; }; 05795D80F7ADBF5F4A6F778B7729A2F6 /* HTTPStubsPathHelpers.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = HTTPStubsPathHelpers.m; path = Sources/OHHTTPStubs/HTTPStubsPathHelpers.m; sourceTree = ""; }; 179D4DB955D6AC3900B45340DC1B3C34 /* Hyperconnectivity-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Hyperconnectivity-prefix.pch"; sourceTree = ""; }; - 17E33041B314FA837A3CAEB9DF3CDE9F /* OHHTTPStubs.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = OHHTTPStubs.framework; path = OHHTTPStubs.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 17E33041B314FA837A3CAEB9DF3CDE9F /* OHHTTPStubs.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OHHTTPStubs.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 1AC9AAE6418AF877A38D1FDCBC620BE5 /* NSURLRequest+HTTPBodyTesting.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSURLRequest+HTTPBodyTesting.h"; path = "Sources/OHHTTPStubs/include/NSURLRequest+HTTPBodyTesting.h"; sourceTree = ""; }; 1DDC31213D773CC32C814301205789A1 /* Hyperconnectivity-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Hyperconnectivity-Info.plist"; sourceTree = ""; }; 1EA7A0DF098EAF45B066AE098AD25275 /* Pods-Hyperconnectivity_Example-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Hyperconnectivity_Example-acknowledgements.plist"; sourceTree = ""; }; @@ -98,7 +98,7 @@ 30A4CC96C037900E078D3A990DE797E0 /* Network.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Network.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/Network.framework; sourceTree = DEVELOPER_DIR; }; 337B66C3878858D5EEAD02A77062BB5A /* Configuration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Configuration.swift; sourceTree = ""; }; 34B286CFEF5C91E4AA477AA343C22372 /* Pods-Hyperconnectivity_Example-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Hyperconnectivity_Example-Info.plist"; sourceTree = ""; }; - 3C7D6CFAE7F76F9EE3685D4C948825E8 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; path = README.md; sourceTree = ""; }; + 3C7D6CFAE7F76F9EE3685D4C948825E8 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 444D43335D402FE711DD910A20491CFB /* HTTPStubs+NSURLSessionConfiguration.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "HTTPStubs+NSURLSessionConfiguration.m"; path = "Sources/OHHTTPStubs/HTTPStubs+NSURLSessionConfiguration.m"; sourceTree = ""; }; 47996ECC3F3C0091DF67E18683D77AEA /* HTTPStubs.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = HTTPStubs.m; path = Sources/OHHTTPStubs/HTTPStubs.m; sourceTree = ""; }; 4BAC86218E0E2E14BC573C3AC41F5C81 /* Pods-Hyperconnectivity_Example-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Hyperconnectivity_Example-frameworks.sh"; sourceTree = ""; }; @@ -111,15 +111,15 @@ 5CEC6CB5CED75CC2FC24115BD0BDAD6B /* OHHTTPStubs.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = OHHTTPStubs.release.xcconfig; sourceTree = ""; }; 636DF3058B92AF46A526983B670D61A7 /* Publishers.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Publishers.swift; sourceTree = ""; }; 6901745544A72844F752AF8F91FCD563 /* hyperconnectivity-banner.png */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = image.png; name = "hyperconnectivity-banner.png"; path = "docs/images/hyperconnectivity-banner.png"; sourceTree = ""; }; - 6B7DCD250B25735AAC46EDE7EC95305D /* Hyperconnectivity.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; path = Hyperconnectivity.podspec; sourceTree = ""; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 6B7DCD250B25735AAC46EDE7EC95305D /* Hyperconnectivity.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; path = Hyperconnectivity.podspec; sourceTree = ""; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 6BF767C709E555CAD026886FC65A6E34 /* ConnectivityState.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ConnectivityState.swift; sourceTree = ""; }; - 6DA81334B924ACAC5303B1CEB9330271 /* hyperconnectivity-banner.afdesign */ = {isa = PBXFileReference; includeInIndex = 1; name = "hyperconnectivity-banner.afdesign"; path = "docs/images/hyperconnectivity-banner.afdesign"; sourceTree = ""; }; + 6DA81334B924ACAC5303B1CEB9330271 /* hyperconnectivity-banner.afdesign */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = file; name = "hyperconnectivity-banner.afdesign"; path = "docs/images/hyperconnectivity-banner.afdesign"; sourceTree = ""; }; 7138276606AC8675B64B81D61626A25F /* Hyperconnectivity-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Hyperconnectivity-umbrella.h"; sourceTree = ""; }; 72468E28AE8E4A1C954928A810C29633 /* HTTPStubsResponse+JSON.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "HTTPStubsResponse+JSON.m"; path = "Sources/OHHTTPStubs/HTTPStubsResponse+JSON.m"; sourceTree = ""; }; 736A8A782D7E9DD56B2D71B6B6BDE130 /* OHHTTPStubsSwift.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = OHHTTPStubsSwift.swift; path = Sources/OHHTTPStubsSwift/OHHTTPStubsSwift.swift; sourceTree = ""; }; 76ECE6049BBB7D8EC1A83DB3C317321F /* HTTPStubsPathHelpers.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = HTTPStubsPathHelpers.h; path = Sources/OHHTTPStubs/include/HTTPStubsPathHelpers.h; sourceTree = ""; }; 7733FD4A1A3AB538B245BD517B663B28 /* HTTPStubsMethodSwizzling.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = HTTPStubsMethodSwizzling.h; path = Sources/OHHTTPStubs/HTTPStubsMethodSwizzling.h; sourceTree = ""; }; - 87158F2B91F50DDDEE53E2F37D37E949 /* comparison-with-connectivity.graffle */ = {isa = PBXFileReference; includeInIndex = 1; name = "comparison-with-connectivity.graffle"; path = "docs/images/comparison-with-connectivity.graffle"; sourceTree = ""; }; + 87158F2B91F50DDDEE53E2F37D37E949 /* comparison-with-connectivity.graffle */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = file; name = "comparison-with-connectivity.graffle"; path = "docs/images/comparison-with-connectivity.graffle"; sourceTree = ""; }; 8752ED48BF48F46C57381CD46FB0C493 /* HTTPStubsResponse.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = HTTPStubsResponse.m; path = Sources/OHHTTPStubs/HTTPStubsResponse.m; sourceTree = ""; }; 87993037B36995B389B337107260CA9F /* Hyperconnectivity.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Hyperconnectivity.debug.xcconfig; sourceTree = ""; }; 8E8F87888190219C69EEDBF9BF1848ED /* HTTPStubsResponse+JSON.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "HTTPStubsResponse+JSON.h"; path = "Sources/OHHTTPStubs/include/HTTPStubsResponse+JSON.h"; sourceTree = ""; }; @@ -129,7 +129,7 @@ 94707DE30C4D3C1B7F35540E121A89B9 /* Pods-Hyperconnectivity_Tests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-Hyperconnectivity_Tests-acknowledgements.markdown"; sourceTree = ""; }; 96B09F70D8318D3B3C6B25589AAE9933 /* OHHTTPStubs-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "OHHTTPStubs-dummy.m"; sourceTree = ""; }; 9A5A7EE20E4606C0657AD4E9366570F0 /* ResponseRegExValidator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ResponseRegExValidator.swift; sourceTree = ""; }; - 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; A1A873E30AC116CB02ADD7276CE63A9B /* ResponseStringEqualityValidator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ResponseStringEqualityValidator.swift; sourceTree = ""; }; A7922776CF9368A95AC803E59C87094A /* Pods-Hyperconnectivity_Example-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-Hyperconnectivity_Example-umbrella.h"; sourceTree = ""; }; A81596E242B9E114FAA1C4A1CACD911E /* Pods-Hyperconnectivity_Tests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-Hyperconnectivity_Tests.modulemap"; sourceTree = ""; }; @@ -139,16 +139,16 @@ BF3F66B3E0CF91C536869F9EBF7D7D82 /* OHHTTPStubs.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = OHHTTPStubs.modulemap; sourceTree = ""; }; C228F176D1218B17D2531CEE1E4A1841 /* Pods-Hyperconnectivity_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Hyperconnectivity_Tests.release.xcconfig"; sourceTree = ""; }; C5B3FA0599D0A7C417BA046810CD61AD /* Hyperconnectivity.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Hyperconnectivity.swift; sourceTree = ""; }; - C5BCC19A35DAC668A16A53E98380B242 /* hyperconnectivity-logo.afdesign */ = {isa = PBXFileReference; includeInIndex = 1; name = "hyperconnectivity-logo.afdesign"; path = "docs/images/hyperconnectivity-logo.afdesign"; sourceTree = ""; }; + C5BCC19A35DAC668A16A53E98380B242 /* hyperconnectivity-logo.afdesign */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = file; name = "hyperconnectivity-logo.afdesign"; path = "docs/images/hyperconnectivity-logo.afdesign"; sourceTree = ""; }; C8DE7546074FDF481FAF83BB45571D2B /* ResponseValidator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ResponseValidator.swift; sourceTree = ""; }; - C97B510A7D3FE7228E2A0710C429F6E7 /* Pods_Hyperconnectivity_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_Hyperconnectivity_Tests.framework; path = "Pods-Hyperconnectivity_Tests.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + C97B510A7D3FE7228E2A0710C429F6E7 /* Pods_Hyperconnectivity_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Hyperconnectivity_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; CB96ACE59DFEF32EB746B8B5C21C9E6B /* Pods-Hyperconnectivity_Tests-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Hyperconnectivity_Tests-Info.plist"; sourceTree = ""; }; - CC9E48909A522B49B24B2F049264E731 /* Hyperconnectivity.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Hyperconnectivity.framework; path = Hyperconnectivity.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + CC9E48909A522B49B24B2F049264E731 /* Hyperconnectivity.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Hyperconnectivity.framework; sourceTree = BUILT_PRODUCTS_DIR; }; CCFF9E21458CBB990302388AAC721FEF /* ResponseContainsStringValidator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ResponseContainsStringValidator.swift; sourceTree = ""; }; CD220818A23936E2AB3394735DD1D124 /* OHHTTPStubs-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "OHHTTPStubs-umbrella.h"; sourceTree = ""; }; D1233D20896561397787188965775C36 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; D75EA0CABEC546B520B4ACECA171ED9A /* Pods-Hyperconnectivity_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Hyperconnectivity_Example.debug.xcconfig"; sourceTree = ""; }; - D7C5DFAE6E92FB59A53EB41153DCAB2F /* Pods_Hyperconnectivity_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_Hyperconnectivity_Example.framework; path = "Pods-Hyperconnectivity_Example.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; + D7C5DFAE6E92FB59A53EB41153DCAB2F /* Pods_Hyperconnectivity_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Hyperconnectivity_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D7F30CE024D2EADE2364EA5F8CF8EC59 /* ConnectivityResult.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ConnectivityResult.swift; sourceTree = ""; }; D8271BE9485D327CBECA394306611B48 /* OHHTTPStubs-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "OHHTTPStubs-Info.plist"; sourceTree = ""; }; D8DAAB3AA259BAA87D0CE56BACDA2AD6 /* Pods-Hyperconnectivity_Tests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-Hyperconnectivity_Tests-umbrella.h"; sourceTree = ""; }; @@ -158,7 +158,7 @@ DF099818E9E7284AE96AE098C1740C56 /* comparison-with-connectivity.png */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = image.png; name = "comparison-with-connectivity.png"; path = "docs/images/comparison-with-connectivity.png"; sourceTree = ""; }; E5974C8DE7AE7FF6FE92CAA0263F48E5 /* Pods-Hyperconnectivity_Example-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-Hyperconnectivity_Example-acknowledgements.markdown"; sourceTree = ""; }; ED22765F073D19E4C1C2BCB7E81723DC /* Pods-Hyperconnectivity_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Hyperconnectivity_Example.release.xcconfig"; sourceTree = ""; }; - F21F638E8A79544E121AADA8D8ED1D85 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; path = LICENSE; sourceTree = ""; }; + F21F638E8A79544E121AADA8D8ED1D85 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; F49B3BAF34EF424D8418DEDB4B2C1964 /* Hyperconnectivity-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Hyperconnectivity-dummy.m"; sourceTree = ""; }; F9EF3A68A47550BC06977140CBCF2B57 /* Hyperconnectivity.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = Hyperconnectivity.modulemap; sourceTree = ""; }; FA9104B13FA4CDFA3B9E98F37F21ED3F /* HTTPStubsResponse.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = HTTPStubsResponse.h; path = Sources/OHHTTPStubs/include/HTTPStubsResponse.h; sourceTree = ""; }; @@ -345,7 +345,6 @@ EF81891485D5AFBA5E33C1B67A5433FD /* Support Files */, 0389F2F489917D675F66FA48F47E9C27 /* Swift */, ); - name = OHHTTPStubs; path = OHHTTPStubs; sourceTree = ""; }; @@ -608,7 +607,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1100; - LastUpgradeCheck = 1100; + LastUpgradeCheck = 1140; }; buildConfigurationList = 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */; compatibilityVersion = "Xcode 3.2"; @@ -749,7 +748,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = 87993037B36995B389B337107260CA9F /* Hyperconnectivity.debug.xcconfig */; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -765,7 +763,9 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MARKETING_VERSION = 1.0.0; MODULEMAP_FILE = "Target Support Files/Hyperconnectivity/Hyperconnectivity.modulemap"; + PRODUCT_BUNDLE_IDENTIFIER = com.rwbutler.Hyperconnectivity; PRODUCT_MODULE_NAME = Hyperconnectivity; PRODUCT_NAME = Hyperconnectivity; SDKROOT = iphoneos; @@ -831,8 +831,7 @@ MTL_FAST_MATH = YES; PRODUCT_NAME = "$(TARGET_NAME)"; STRIP_INSTALLED_PRODUCT = NO; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 5.0; SYMROOT = "${SRCROOT}/../build"; }; @@ -843,7 +842,6 @@ baseConfigurationReference = D75EA0CABEC546B520B4ACECA171ED9A /* Pods-Hyperconnectivity_Example.debug.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -878,7 +876,6 @@ baseConfigurationReference = ED22765F073D19E4C1C2BCB7E81723DC /* Pods-Hyperconnectivity_Example.release.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -913,7 +910,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = FE683674D6039F16F55A1797F2CD0AA6 /* Hyperconnectivity.release.xcconfig */; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -929,7 +925,9 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MARKETING_VERSION = 1.0.0; MODULEMAP_FILE = "Target Support Files/Hyperconnectivity/Hyperconnectivity.modulemap"; + PRODUCT_BUNDLE_IDENTIFIER = com.rwbutler.Hyperconnectivity; PRODUCT_MODULE_NAME = Hyperconnectivity; PRODUCT_NAME = Hyperconnectivity; SDKROOT = iphoneos; @@ -947,7 +945,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = 5CEC6CB5CED75CC2FC24115BD0BDAD6B /* OHHTTPStubs.release.xcconfig */; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; @@ -980,7 +977,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = 8EC3488DA660920038760CC2C11CB1DA /* OHHTTPStubs.debug.xcconfig */; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; @@ -1013,7 +1009,6 @@ baseConfigurationReference = 297188B7E204CF553568013790D614A4 /* Pods-Hyperconnectivity_Tests.debug.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -1048,7 +1043,6 @@ baseConfigurationReference = C228F176D1218B17D2531CEE1E4A1841 /* Pods-Hyperconnectivity_Tests.release.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; diff --git a/Example/Pods/Target Support Files/Hyperconnectivity/Hyperconnectivity-Info.plist b/Example/Pods/Target Support Files/Hyperconnectivity/Hyperconnectivity-Info.plist index 0d7bfa2..72caab8 100644 --- a/Example/Pods/Target Support Files/Hyperconnectivity/Hyperconnectivity-Info.plist +++ b/Example/Pods/Target Support Files/Hyperconnectivity/Hyperconnectivity-Info.plist @@ -2,25 +2,25 @@ - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - ${PRODUCT_BUNDLE_IDENTIFIER} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - FMWK - CFBundleShortVersionString - 0.2.0 - CFBundleSignature - ???? - CFBundleVersion - ${CURRENT_PROJECT_VERSION} - NSPrincipalClass - + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + $(MARKETING_VERSION) + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + diff --git a/Example/Tests/ConnectivityPublisherTests.swift b/Example/Tests/ConnectivityPublisherTests.swift index 6f1a962..d6c407a 100644 --- a/Example/Tests/ConnectivityPublisherTests.swift +++ b/Example/Tests/ConnectivityPublisherTests.swift @@ -13,8 +13,8 @@ import XCTest @testable import Hyperconnectivity class ConnectivityPublisherTests: XCTestCase { - private var cancellable: AnyCancellable? + private let timeout: TimeInterval = 5.0 override func tearDown() { super.tearDown() @@ -38,7 +38,7 @@ class ConnectivityPublisherTests: XCTestCase { XCTAssertEqual(result.state, .wifiWithInternet) expectation.fulfill() }) - wait(for: [expectation], timeout: 2.0) + wait(for: [expectation], timeout: timeout) } func testSubscriberInvokedOnFailedConnectivityCheck() throws { @@ -51,6 +51,6 @@ class ConnectivityPublisherTests: XCTestCase { XCTAssertEqual(result.state, .wifiWithoutInternet) expectation.fulfill() }) - wait(for: [expectation], timeout: 2.0) + wait(for: [expectation], timeout: timeout) } } diff --git a/Example/Tests/ConnectivitySubscriptionTests.swift b/Example/Tests/ConnectivitySubscriptionTests.swift index 090b762..82a1206 100644 --- a/Example/Tests/ConnectivitySubscriptionTests.swift +++ b/Example/Tests/ConnectivitySubscriptionTests.swift @@ -13,7 +13,6 @@ import XCTest @testable import Hyperconnectivity class ConnectivitySubscriptionTests: XCTestCase { - private let timeout: TimeInterval = 5.0 private func sut(subscriber: Subscribers.Sink? = nil, connectivity: Connectivity? = nil) -> ConnectivitySubscription> { diff --git a/Example/Tests/ReachabilityPublisherTests.swift b/Example/Tests/ReachabilityPublisherTests.swift new file mode 100644 index 0000000..854dab5 --- /dev/null +++ b/Example/Tests/ReachabilityPublisherTests.swift @@ -0,0 +1,29 @@ +// +// ReachabilityPublisherTests.swift +// Hyperconnectivity +// +// Created by Ross Butler on 17/05/2020. +// Copyright © 2020 Ross Butler. All rights reserved. +// + +import Combine +import Foundation +import OHHTTPStubs +import XCTest +@testable import Hyperconnectivity + +class ReachabilityPublisherTests: XCTestCase { + private var cancellable: AnyCancellable? + private let timeout: TimeInterval = 5.0 + + func testSubscriberInvokedOnSuccessfulReachabilityCheck() throws { + let expectation = XCTestExpectation(description: "Reachability check succeeds") + cancellable = Publishers.Reachability().sink(receiveCompletion: { _ in + }, receiveValue: { result in + XCTAssertEqual(result.connection, .wifi) + XCTAssertTrue(result.isReachable) + expectation.fulfill() + }) + wait(for: [expectation], timeout: timeout) + } +} diff --git a/Hyperconnectivity.podspec b/Hyperconnectivity.podspec index 8c86a21..c99fe94 100644 --- a/Hyperconnectivity.podspec +++ b/Hyperconnectivity.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Hyperconnectivity' - s.version = '0.2.0' + s.version = '1.0.0' s.swift_version = '5.0' s.summary = 'Modern replacement for Apple\'s Reachability written in Swift and made elegant using Combine' s.description = <<-DESC diff --git a/Hyperconnectivity/Classes/Combine/ReachabilityPublisher.swift b/Hyperconnectivity/Classes/Combine/ReachabilityPublisher.swift index 6375958..9507b64 100644 --- a/Hyperconnectivity/Classes/Combine/ReachabilityPublisher.swift +++ b/Hyperconnectivity/Classes/Combine/ReachabilityPublisher.swift @@ -19,7 +19,7 @@ public struct ReachabilityPublisher: Publisher { private let configuration: Configuration public init(configuration: Configuration = Configuration()) { - self.configuration = configuration + self.configuration = configuration.cloneForReachability() } public func receive(subscriber: S) where S : Subscriber, Self.Failure == S.Failure, Self.Output == S.Input { diff --git a/Hyperconnectivity/Classes/Combine/ReachabilitySubscription.swift b/Hyperconnectivity/Classes/Combine/ReachabilitySubscription.swift index eda7318..1a97dbd 100644 --- a/Hyperconnectivity/Classes/Combine/ReachabilitySubscription.swift +++ b/Hyperconnectivity/Classes/Combine/ReachabilitySubscription.swift @@ -14,7 +14,7 @@ class ReachabilitySubscription: Subscription where S.Input == Rea private var subscriber: S? init(configuration: Hyperconnectivity.Configuration, subscriber: S) { - self.configuration = configuration + self.configuration = configuration.cloneForReachability() self.subscriber = subscriber startNotifier(with: subscriber) } @@ -40,6 +40,7 @@ private extension ReachabilitySubscription { private func stopNotifier() { connectivity?.stopNotifier() connectivity = nil + subscriber?.receive(completion: Subscribers.Completion.finished) subscriber = nil } } diff --git a/Hyperconnectivity/Classes/Model/Configuration.swift b/Hyperconnectivity/Classes/Model/Configuration.swift index 7726af8..298c3eb 100644 --- a/Hyperconnectivity/Classes/Model/Configuration.swift +++ b/Hyperconnectivity/Classes/Model/Configuration.swift @@ -9,9 +9,10 @@ import Foundation public struct HyperconnectivityConfiguration { public static let defaultConnectivityURLs = [ - URL(string: "https://www.apple.com/library/test/success.html")!, - URL(string: "https://captive.apple.com/hotspot-detect.html")! - ] + URL(string: "https://www.apple.com/library/test/success.html"), + URL(string: "https://captive.apple.com/hotspot-detect.html") + ] + .compactMap { $0 } public static let defaultURLSessionConfiguration: URLSessionConfiguration = { let sessionConfiguration = URLSessionConfiguration.default sessionConfiguration.requestCachePolicy = .reloadIgnoringCacheData @@ -33,22 +34,34 @@ public struct HyperconnectivityConfiguration { public init(callbackQueue: DispatchQueue = DispatchQueue.main, connectivityQueue: DispatchQueue = DispatchQueue.global(qos: .utility), connectivityURLs: [URL] = Self.defaultConnectivityURLs, - responseValidator: ResponseValidator = ResponseStringValidator( - validationMode: .containsExpectedResponseString - ), + responseValidator: ResponseValidator? = nil, shouldCheckConnectivity: Bool = true, successThreshold: Percentage = Percentage(50.0), urlSessionConfiguration: URLSessionConfiguration = Self.defaultURLSessionConfiguration ) { + let defaultValidator = ResponseStringValidator( + validationMode: .containsExpectedResponseString + ) self.callbackQueue = callbackQueue self.connectivityQueue = connectivityQueue self.connectivityURLs = connectivityURLs - self.responseValidator = responseValidator + self.responseValidator = responseValidator ?? defaultValidator self.shouldCheckConnectivity = shouldCheckConnectivity self.successThreshold = successThreshold self.urlSessionConfiguration = urlSessionConfiguration } + func cloneForReachability() -> Self { + return HyperconnectivityConfiguration( + callbackQueue: callbackQueue, + connectivityQueue: connectivityQueue, + connectivityURLs: [], + responseValidator: responseValidator, + shouldCheckConnectivity: false, + successThreshold: Percentage(0.0), + urlSessionConfiguration: urlSessionConfiguration) + } + /// Convenience method for determining whether or not the response is valid. func isResponseValid(_ response: (Data, URLResponse)) -> Bool { responseValidator.isResponseValid(response.1, data: response.0) diff --git a/README.md b/README.md index 9203552..0981b06 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,6 @@ [![Swift 5.0](https://img.shields.io/badge/Swift-5.0-orange.svg?style=flat)](https://swift.org/) [![Twitter](https://img.shields.io/badge/twitter-@ross_w_butler-blue.svg?style=flat)](https://twitter.com/ross_w_butler) -⚠️ _Note that this framework is a work in progress until reaching version 1.0._ - Hyperconnectivity is a modern replacement for Reachability written fully in Swift and using Apple's [Combine](https://developer.apple.com/documentation/combine) framework. It offers the ability to detect reachability, Internet connectivity as well the presence of [captive portals](https://en.wikipedia.org/wiki/Captive_portal). It is an offshoot of the [Connectivity](https://github.com/rwbutler/Connectivity) project which offers similar features. To find out which one is right for you, take a look at the [Connectivity vs Hyperconnectivity](#connectivity-vs-hyperconnectivity) section below for a comparison. - [Features](#features)