Skip to content

Commit

Permalink
Merge pull request #29 from diogobalseiro/master
Browse files Browse the repository at this point in the history
Made Models Properties Public, Removed Cocoapods Support
  • Loading branch information
diogobalseiro authored Nov 12, 2024
2 parents 4a2cd59 + abec958 commit 48e25ab
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 164 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/changes-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
25 changes: 0 additions & 25 deletions .github/workflows/cocoapods-spec-publish.yml

This file was deleted.

18 changes: 0 additions & 18 deletions FNMNetworkMonitor.podspec

This file was deleted.

33 changes: 20 additions & 13 deletions NetworkMonitor/Classes/Profile/FNMProfile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -77,6 +80,7 @@ open class FNMProfile: NSObject, Codable {
case request
case responses
case priority
case tag
}

public func encode(to encoder: Encoder) throws {
Expand All @@ -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 {
Expand All @@ -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)
}
}
}
Expand Down Expand Up @@ -213,10 +220,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,
Expand Down Expand Up @@ -338,14 +345,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,
Expand Down Expand Up @@ -439,7 +446,7 @@ public extension FNMProfileResponse {

public final class FNMHTTPURLResponse: NSObject {

let meta: HTTPURLResponse
public let meta: HTTPURLResponse

init(meta: HTTPURLResponse) {

Expand Down
14 changes: 0 additions & 14 deletions Sample/Podfile

This file was deleted.

16 changes: 0 additions & 16 deletions Sample/Podfile.lock

This file was deleted.

108 changes: 44 additions & 64 deletions Sample/Sample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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 = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
6BFF80FB261E138A002CDCD1 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand All @@ -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 = "<group>";
};
6BFF80ED261E138A002CDCD1 = {
isa = PBXGroup;
children = (
6BFF80F8261E138A002CDCD1 /* Sample */,
6BFF80F7261E138A002CDCD1 /* Products */,
6BFF811C261E2253002CDCD1 /* Frameworks */,
56B01F73C61F8E7C27621BDA /* Pods */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -105,7 +98,6 @@
isa = PBXGroup;
children = (
6BFF8124261E249B002CDCD1 /* NetworkMonitor.xcodeproj */,
072C49F0C9882097EFB96B5A /* Pods_Sample.framework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand All @@ -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 = (
);
Expand Down Expand Up @@ -165,6 +155,9 @@
Base,
);
mainGroup = 6BFF80ED261E138A002CDCD1;
packageReferences = (
F7407C892CE359F200FC97BE /* XCRemoteSwiftPackageReference "network-monitor-ios" */,
);
productRefGroup = 6BFF80F7261E138A002CDCD1 /* Products */;
projectDirPath = "";
projectReferences = (
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -403,7 +354,6 @@
};
6BFF810B261E138C002CDCD1 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 4D2D2D18CE6F3DDB4DCAE6CD /* Pods-Sample.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
Expand All @@ -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";
Expand All @@ -421,7 +371,6 @@
};
6BFF810C261E138C002CDCD1 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 3C6C75649A8806EECDCC6508 /* Pods-Sample.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
Expand All @@ -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";
Expand Down Expand Up @@ -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 */;
}
Loading

0 comments on commit 48e25ab

Please sign in to comment.