From dbf8c219c06366bd3f480e61b22a6469cdebe90e Mon Sep 17 00:00:00 2001 From: "diogo.balseiro" Date: Mon, 11 Nov 2024 17:30:51 +0000 Subject: [PATCH 1/4] Made Models Properties Public --- .../Classes/Profile/FNMProfile.swift | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/NetworkMonitor/Classes/Profile/FNMProfile.swift b/NetworkMonitor/Classes/Profile/FNMProfile.swift index 8d13a24..770f7e1 100644 --- a/NetworkMonitor/Classes/Profile/FNMProfile.swift +++ b/NetworkMonitor/Classes/Profile/FNMProfile.swift @@ -213,10 +213,10 @@ extension Sequence where Iterator.Element == FNMProfile.ProfileRequestMatchingRe public final class FNMProfileRequest: NSObject { - let urlPattern: FNMRequestURLPattern - let httpMethod: FNMHTTPMethod - let headers: [String: String]? - let body: Data? + public let urlPattern: FNMRequestURLPattern + public let httpMethod: FNMHTTPMethod + public let headers: [String: String]? + public let body: Data? public init(urlPattern: FNMRequestURLPattern, httpMethod: FNMHTTPMethod = .get, @@ -338,14 +338,14 @@ extension FNMResponseRepeatability: Equatable { public final class FNMProfileResponse: NSObject { - let identifier: String + public let identifier: String - let meta: FNMHTTPURLResponse - let response: Data? - let redirectionURL: URL? + public let meta: FNMHTTPURLResponse + public let response: Data? + public let redirectionURL: URL? - var repeatability: FNMResponseRepeatability - let delay: TimeInterval + public private(set) var repeatability: FNMResponseRepeatability + public let delay: TimeInterval public init(identifier: String, meta: FNMHTTPURLResponse, @@ -439,7 +439,7 @@ public extension FNMProfileResponse { public final class FNMHTTPURLResponse: NSObject { - let meta: HTTPURLResponse + public let meta: HTTPURLResponse init(meta: HTTPURLResponse) { From b552601f40b7ff8b25d4179e72a961423e2091fc Mon Sep 17 00:00:00 2001 From: "diogo.balseiro" Date: Mon, 11 Nov 2024 17:35:19 +0000 Subject: [PATCH 2/4] Updated Podspec --- FNMNetworkMonitor.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FNMNetworkMonitor.podspec b/FNMNetworkMonitor.podspec index faa95dc..016305a 100755 --- a/FNMNetworkMonitor.podspec +++ b/FNMNetworkMonitor.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |spec| spec.name = 'FNMNetworkMonitor' spec.module_name = 'FNMNetworkMonitor' - spec.version = '12.0.0' + spec.version = '12.1.0' spec.summary = 'A network monitor' spec.homepage = 'https://github.com/Farfetch/network-monitor-ios' spec.license = 'MIT' From 558f36098688f3333ded7e9f2d3f931d7691e50e Mon Sep 17 00:00:00 2001 From: "diogo.balseiro" Date: Tue, 12 Nov 2024 09:41:29 +0000 Subject: [PATCH 3/4] More cleanup --- FNMNetworkMonitor.podspec | 18 --- .../Classes/Profile/FNMProfile.swift | 11 +- Sample/Podfile | 14 --- Sample/Podfile.lock | 16 --- Sample/Sample.xcodeproj/project.pbxproj | 108 +++++++----------- .../xcshareddata/swiftpm/Package.resolved | 15 +++ .../contents.xcworkspacedata | 10 -- 7 files changed, 68 insertions(+), 124 deletions(-) delete mode 100755 FNMNetworkMonitor.podspec delete mode 100755 Sample/Podfile delete mode 100644 Sample/Podfile.lock create mode 100644 Sample/Sample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved delete mode 100644 Sample/Sample.xcworkspace/contents.xcworkspacedata diff --git a/FNMNetworkMonitor.podspec b/FNMNetworkMonitor.podspec deleted file mode 100755 index 016305a..0000000 --- a/FNMNetworkMonitor.podspec +++ /dev/null @@ -1,18 +0,0 @@ -Pod::Spec.new do |spec| - spec.name = 'FNMNetworkMonitor' - spec.module_name = 'FNMNetworkMonitor' - spec.version = '12.1.0' - spec.summary = 'A network monitor' - spec.homepage = 'https://github.com/Farfetch/network-monitor-ios' - spec.license = 'MIT' - spec.author = 'Farfetch' - spec.source = { :git => 'https://github.com/Farfetch/network-monitor-ios.git', :tag => spec.version.to_s } - - spec.ios.deployment_target = '15.0' - spec.requires_arc = true - - spec.cocoapods_version = '>= 1.7' - spec.swift_versions = ['5.0', '5.1', '5.2', '5.3'] - - spec.source_files = 'NetworkMonitor/Classes/**/*.{h,m,swift}' -end diff --git a/NetworkMonitor/Classes/Profile/FNMProfile.swift b/NetworkMonitor/Classes/Profile/FNMProfile.swift index 770f7e1..84d263a 100644 --- a/NetworkMonitor/Classes/Profile/FNMProfile.swift +++ b/NetworkMonitor/Classes/Profile/FNMProfile.swift @@ -18,14 +18,17 @@ open class FNMProfile: NSObject, Codable { /// Priority is used as a tiebreaker when we have several possible profiles for the request made. /// The profile with the highest priority (Uint.min [aka 0] being the highest value and UInt.max the lowest value) will be used. public let priority: UInt + public let tag: String public required init(request: FNMProfileRequest, responses: [FNMProfileResponse], - priority: UInt = UInt.min) { + priority: UInt = UInt.min, + tag: String = "") { self.request = request self.responses = responses self.priority = priority + self.tag = tag } convenience init?(record: FNMHTTPRequestRecord) { @@ -77,6 +80,7 @@ open class FNMProfile: NSObject, Codable { case request case responses case priority + case tag } public func encode(to encoder: Encoder) throws { @@ -85,6 +89,7 @@ open class FNMProfile: NSObject, Codable { try container.encode(self.request, forKey: .request) try container.encode(self.responses, forKey: .responses) try container.encode(self.priority, forKey: .priority) + try container.encode(self.tag, forKey: .tag) } public convenience required init(from decoder: Decoder) throws { @@ -94,10 +99,12 @@ open class FNMProfile: NSObject, Codable { do { let priority = try values.decodeIfPresent(UInt.self, forKey: .priority) ?? UInt.min + let tag = try values.decodeIfPresent(String.self, forKey: .tag) ?? "" try self.init(request: values.decode(FNMProfileRequest.self, forKey: .request), responses: values.decode([FNMProfileResponse].self, forKey: .responses), - priority: priority) + priority: priority, + tag: tag) } } } diff --git a/Sample/Podfile b/Sample/Podfile deleted file mode 100755 index bc1b659..0000000 --- a/Sample/Podfile +++ /dev/null @@ -1,14 +0,0 @@ -# Sources configuration -source 'https://cdn.cocoapods.org/' - -PLATFORM_DEPLOYMENT_TARGET = '15.0'.freeze - -platform :ios, PLATFORM_DEPLOYMENT_TARGET -use_frameworks! - -workspace 'Sample' - -target 'Sample' do - - pod 'FNMNetworkMonitor' -end \ No newline at end of file diff --git a/Sample/Podfile.lock b/Sample/Podfile.lock deleted file mode 100644 index 39f3efb..0000000 --- a/Sample/Podfile.lock +++ /dev/null @@ -1,16 +0,0 @@ -PODS: - - FNMNetworkMonitor (11.11.1) - -DEPENDENCIES: - - FNMNetworkMonitor - -SPEC REPOS: - trunk: - - FNMNetworkMonitor - -SPEC CHECKSUMS: - FNMNetworkMonitor: 8dc090b3d0873c5fec8e389d6568af73683312cd - -PODFILE CHECKSUM: ed71bf10e5bc3bdbe6c5632c5a63496350fa381f - -COCOAPODS: 1.15.2 diff --git a/Sample/Sample.xcodeproj/project.pbxproj b/Sample/Sample.xcodeproj/project.pbxproj index 3a1b3dd..acac8bc 100644 --- a/Sample/Sample.xcodeproj/project.pbxproj +++ b/Sample/Sample.xcodeproj/project.pbxproj @@ -7,13 +7,16 @@ objects = { /* Begin PBXBuildFile section */ - 161DA2BD7F2BECA3F395CECE /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 072C49F0C9882097EFB96B5A /* Pods_Sample.framework */; }; 6BFF80FA261E138A002CDCD1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BFF80F9261E138A002CDCD1 /* AppDelegate.swift */; }; 6BFF80FC261E138A002CDCD1 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BFF80FB261E138A002CDCD1 /* SceneDelegate.swift */; }; 6BFF80FE261E138A002CDCD1 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BFF80FD261E138A002CDCD1 /* ViewController.swift */; }; 6BFF8101261E138A002CDCD1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6BFF80FF261E138A002CDCD1 /* Main.storyboard */; }; 6BFF8103261E138C002CDCD1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6BFF8102261E138C002CDCD1 /* Assets.xcassets */; }; 6BFF8106261E138C002CDCD1 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6BFF8104261E138C002CDCD1 /* LaunchScreen.storyboard */; }; + F7407C832CE359A700FC97BE /* FNMNetworkMonitor in Frameworks */ = {isa = PBXBuildFile; productRef = F7407C822CE359A700FC97BE /* FNMNetworkMonitor */; }; + F7407C862CE359D600FC97BE /* FNMNetworkMonitor in Frameworks */ = {isa = PBXBuildFile; productRef = F7407C852CE359D600FC97BE /* FNMNetworkMonitor */; }; + F7407C882CE359E000FC97BE /* FNMNetworkMonitor in Frameworks */ = {isa = PBXBuildFile; productRef = F7407C872CE359E000FC97BE /* FNMNetworkMonitor */; }; + F7407C8B2CE359F200FC97BE /* FNMNetworkMonitor in Frameworks */ = {isa = PBXBuildFile; productRef = F7407C8A2CE359F200FC97BE /* FNMNetworkMonitor */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -34,9 +37,6 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 072C49F0C9882097EFB96B5A /* Pods_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 3C6C75649A8806EECDCC6508 /* Pods-Sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.release.xcconfig"; path = "Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig"; sourceTree = ""; }; - 4D2D2D18CE6F3DDB4DCAE6CD /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = ""; }; 6BFF80F6261E138A002CDCD1 /* Sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 6BFF80F9261E138A002CDCD1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 6BFF80FB261E138A002CDCD1 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -53,29 +53,22 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 161DA2BD7F2BECA3F395CECE /* Pods_Sample.framework in Frameworks */, + F7407C8B2CE359F200FC97BE /* FNMNetworkMonitor in Frameworks */, + F7407C862CE359D600FC97BE /* FNMNetworkMonitor in Frameworks */, + F7407C882CE359E000FC97BE /* FNMNetworkMonitor in Frameworks */, + F7407C832CE359A700FC97BE /* FNMNetworkMonitor in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 56B01F73C61F8E7C27621BDA /* Pods */ = { - isa = PBXGroup; - children = ( - 4D2D2D18CE6F3DDB4DCAE6CD /* Pods-Sample.debug.xcconfig */, - 3C6C75649A8806EECDCC6508 /* Pods-Sample.release.xcconfig */, - ); - path = Pods; - sourceTree = ""; - }; 6BFF80ED261E138A002CDCD1 = { isa = PBXGroup; children = ( 6BFF80F8261E138A002CDCD1 /* Sample */, 6BFF80F7261E138A002CDCD1 /* Products */, 6BFF811C261E2253002CDCD1 /* Frameworks */, - 56B01F73C61F8E7C27621BDA /* Pods */, ); sourceTree = ""; }; @@ -105,7 +98,6 @@ isa = PBXGroup; children = ( 6BFF8124261E249B002CDCD1 /* NetworkMonitor.xcodeproj */, - 072C49F0C9882097EFB96B5A /* Pods_Sample.framework */, ); name = Frameworks; sourceTree = ""; @@ -126,11 +118,9 @@ isa = PBXNativeTarget; buildConfigurationList = 6BFF810A261E138C002CDCD1 /* Build configuration list for PBXNativeTarget "Sample" */; buildPhases = ( - 3C36A257F314A352A7E2485D /* [CP] Check Pods Manifest.lock */, 6BFF80F2261E138A002CDCD1 /* Sources */, 6BFF80F3261E138A002CDCD1 /* Frameworks */, 6BFF80F4261E138A002CDCD1 /* Resources */, - 2C5BC43B98C6B2CB3B46C2AF /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -165,6 +155,9 @@ Base, ); mainGroup = 6BFF80ED261E138A002CDCD1; + packageReferences = ( + F7407C892CE359F200FC97BE /* XCRemoteSwiftPackageReference "network-monitor-ios" */, + ); productRefGroup = 6BFF80F7261E138A002CDCD1 /* Products */; projectDirPath = ""; projectReferences = ( @@ -210,48 +203,6 @@ }; /* End PBXResourcesBuildPhase section */ -/* Begin PBXShellScriptBuildPhase section */ - 2C5BC43B98C6B2CB3B46C2AF /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Sample/Pods-Sample-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Sample/Pods-Sample-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Sample/Pods-Sample-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 3C36A257F314A352A7E2485D /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Sample-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; - }; -/* End PBXShellScriptBuildPhase section */ - /* Begin PBXSourcesBuildPhase section */ 6BFF80F2261E138A002CDCD1 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -403,7 +354,6 @@ }; 6BFF810B261E138C002CDCD1 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 4D2D2D18CE6F3DDB4DCAE6CD /* Pods-Sample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; @@ -412,7 +362,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.networkmonitor..Sample; + PRODUCT_BUNDLE_IDENTIFIER = com.networkmonitor.Sample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -421,7 +371,6 @@ }; 6BFF810C261E138C002CDCD1 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 3C6C75649A8806EECDCC6508 /* Pods-Sample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; @@ -430,7 +379,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.networkmonitor..Sample; + PRODUCT_BUNDLE_IDENTIFIER = com.networkmonitor.Sample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -459,6 +408,37 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + F7407C892CE359F200FC97BE /* XCRemoteSwiftPackageReference "network-monitor-ios" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/Farfetch/network-monitor-ios.git"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 12.0.0; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + F7407C822CE359A700FC97BE /* FNMNetworkMonitor */ = { + isa = XCSwiftPackageProductDependency; + productName = FNMNetworkMonitor; + }; + F7407C852CE359D600FC97BE /* FNMNetworkMonitor */ = { + isa = XCSwiftPackageProductDependency; + productName = FNMNetworkMonitor; + }; + F7407C872CE359E000FC97BE /* FNMNetworkMonitor */ = { + isa = XCSwiftPackageProductDependency; + productName = FNMNetworkMonitor; + }; + F7407C8A2CE359F200FC97BE /* FNMNetworkMonitor */ = { + isa = XCSwiftPackageProductDependency; + package = F7407C892CE359F200FC97BE /* XCRemoteSwiftPackageReference "network-monitor-ios" */; + productName = FNMNetworkMonitor; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 6BFF80EE261E138A002CDCD1 /* Project object */; } diff --git a/Sample/Sample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Sample/Sample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..d999d35 --- /dev/null +++ b/Sample/Sample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,15 @@ +{ + "originHash" : "28fac3843ca88fa2d3e10985fd41d29b2ec00069c3a49abc9ac522b1260cc53a", + "pins" : [ + { + "identity" : "network-monitor-ios", + "kind" : "remoteSourceControl", + "location" : "https://github.com/Farfetch/network-monitor-ios.git", + "state" : { + "revision" : "638c8b6cdf8c6ed6b4372b09b31abf552a5acf05", + "version" : "12.0.0" + } + } + ], + "version" : 3 +} diff --git a/Sample/Sample.xcworkspace/contents.xcworkspacedata b/Sample/Sample.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 7b5a2f3..0000000 --- a/Sample/Sample.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - From abec95899796e24d7df8478b57a8b2faa2cd56e7 Mon Sep 17 00:00:00 2001 From: "diogo.balseiro" Date: Tue, 12 Nov 2024 10:11:23 +0000 Subject: [PATCH 4/4] Tweaked github actions --- .github/workflows/changes-action.yml | 6 ++--- .github/workflows/cocoapods-spec-publish.yml | 25 -------------------- 2 files changed, 2 insertions(+), 29 deletions(-) delete mode 100644 .github/workflows/cocoapods-spec-publish.yml diff --git a/.github/workflows/changes-action.yml b/.github/workflows/changes-action.yml index 9af4cf4..8922f6b 100644 --- a/.github/workflows/changes-action.yml +++ b/.github/workflows/changes-action.yml @@ -19,7 +19,5 @@ jobs: run: xcodebuild build -scheme NetworkMonitor -destination 'platform=iOS Simulator,name=iPhone 15 Pro Max' - name: Test Network Monitor run: xcodebuild clean test -scheme NetworkMonitor -destination 'platform=iOS Simulator,name=iPhone 15 Pro Max' - - name: Install Cocoapods - run: gem install cocoapods - - name: Pod lib lint - run: pod lib lint FNMNetworkMonitor.podspec --allow-warnings --analyze + - name: Build Sample + run: cd Sample; xcodebuild build -scheme Sample -project Sample.xcodeproj -destination 'platform=iOS Simulator,name=iPhone 15 Pro Max' diff --git a/.github/workflows/cocoapods-spec-publish.yml b/.github/workflows/cocoapods-spec-publish.yml deleted file mode 100644 index aa27a15..0000000 --- a/.github/workflows/cocoapods-spec-publish.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Cocoapods Spec Publish - -on: - push: - tags: - - '*' - -jobs: - build: - - runs-on: macOS-latest - - steps: - - uses: actions/checkout@v1 - - - name: Install Cocoapods - run: gem install cocoapods - - name: Deploy to Cocoapods - run: | - set -eo pipefail - pod repo update - pod lib lint --allow-warnings - pod trunk push --allow-warnings - env: - COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}