Skip to content

Commit

Permalink
Merge pull request #5 from Tinder/revert-3-mac_os_support
Browse files Browse the repository at this point in the history
Revert "Add injectable platform support for macOS"
  • Loading branch information
tinder-maxwellelliott authored Jun 23, 2023
2 parents 9c80e39 + 309c946 commit 0037551
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ internal struct CreateProvisioningProfileCommand: ParsableCommand {
case opensslPath = "opensslPath"
case intermediaryAppleCertificates = "intermediaryAppleCertificates"
case certificateSigningRequestSubject = "certificateSigningRequestSubject"
case platform = "platform"
}

@Option(help: "The key identifier of the private key (https://developer.apple.com/documentation/appstoreconnectapi/generating_tokens_for_api_requests)")
Expand All @@ -147,9 +146,6 @@ internal struct CreateProvisioningProfileCommand: ParsableCommand {
@Option(help: "The bundle identifier name for the desired bundle identifier, this is optional but if it is not set the logic will select the first bundle id it finds that matches `--bundle-identifier`")
internal var bundleIdentifierName: String?

@Option(help: "The platform to filter bundle identifiers for")
internal var platform: Platform

@Option(help: "The profile type which you wish to create (https://developer.apple.com/documentation/appstoreconnectapi/profilecreaterequest/data/attributes)")
internal var profileType: String

Expand Down Expand Up @@ -222,8 +218,7 @@ internal struct CreateProvisioningProfileCommand: ParsableCommand {
opensslPath: String,
intermediaryAppleCertificates: [String],
certificateSigningRequestSubject: String,
bundleIdentifierName: String?,
platform: Platform
bundleIdentifierName: String?
) {
self.files = files
self.log = log
Expand All @@ -245,7 +240,6 @@ internal struct CreateProvisioningProfileCommand: ParsableCommand {
self.intermediaryAppleCertificates = intermediaryAppleCertificates
self.certificateSigningRequestSubject = certificateSigningRequestSubject
self.bundleIdentifierName = bundleIdentifierName
self.platform = platform
}

internal init(from decoder: Decoder) throws {
Expand Down Expand Up @@ -278,8 +272,7 @@ internal struct CreateProvisioningProfileCommand: ParsableCommand {
opensslPath: try container.decode(String.self, forKey: .opensslPath),
intermediaryAppleCertificates: try container.decodeIfPresent([String].self, forKey: .intermediaryAppleCertificates) ?? [],
certificateSigningRequestSubject: try container.decode(String.self, forKey: .certificateSigningRequestSubject),
bundleIdentifierName: try container.decodeIfPresent(String.self, forKey: .bundleIdentifierName),
platform: try container.decode(Platform.self, forKey: .platform)
bundleIdentifierName: try container.decodeIfPresent(String.self, forKey: .bundleIdentifierName)
)
}

Expand Down Expand Up @@ -310,8 +303,7 @@ internal struct CreateProvisioningProfileCommand: ParsableCommand {
bundleId: try iTunesConnectService.determineBundleIdITCId(
jsonWebToken: jsonWebToken,
bundleIdentifier: bundleIdentifier,
bundleIdentifierName: bundleIdentifierName,
platform: platform
bundleIdentifierName: bundleIdentifierName
),
certificateId: certificateId,
deviceIDs: deviceIDs,
Expand Down
14 changes: 0 additions & 14 deletions Sources/SignHereLibrary/Models/Platform.swift

This file was deleted.

8 changes: 3 additions & 5 deletions Sources/SignHereLibrary/Services/iTunesConnectService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ internal protocol iTunesConnectService {
func determineBundleIdITCId(
jsonWebToken: String,
bundleIdentifier: String,
bundleIdentifierName: String?,
platform: Platform
bundleIdentifierName: String?
) throws -> String
func fetchITCDeviceIDs(jsonWebToken: String) throws -> Set<String>
func createProfile(
Expand Down Expand Up @@ -227,16 +226,15 @@ internal class iTunesConnectServiceImp: iTunesConnectService {
func determineBundleIdITCId(
jsonWebToken: String,
bundleIdentifier: String,
bundleIdentifierName: String?,
platform: Platform
bundleIdentifierName: String?
) throws -> String {
var urlComponents: URLComponents = .init()
urlComponents.scheme = Constants.httpsScheme
urlComponents.host = Constants.itcHost
urlComponents.path = "/v1/bundleIds"
urlComponents.queryItems = [
.init(name: "filter[identifier]", value: bundleIdentifier),
.init(name: "filter[platform]", value: platform.rawValue),
.init(name: "filter[platform]", value: "IOS"),
.init(name: "limit", value: "200")
]
guard let url: URL = urlComponents.url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ final class CreateProvisioningProfileCommandTests: XCTestCase {
opensslPath: "/opensslPath",
intermediaryAppleCertificates: ["/intermediaryAppleCertificate"],
certificateSigningRequestSubject: "certificateSigningRequestSubject",
bundleIdentifierName: "bundleIdentifierName",
platform: .iOS
bundleIdentifierName: "bundleIdentifierName"
)
}

Expand Down Expand Up @@ -158,8 +157,7 @@ final class CreateProvisioningProfileCommandTests: XCTestCase {
"outputPath": "/outputPath",
"opensslPath": "/opensslPath",
"certificateSigningRequestSubject": "certificateSigningRequestSubject",
"bundleIdentifierName": "bundleIdentifierName",
"platform": "IOS"
"bundleIdentifierName": "bundleIdentifierName"
}
""".utf8)

Expand All @@ -178,7 +176,6 @@ final class CreateProvisioningProfileCommandTests: XCTestCase {
XCTAssertEqual(subject.certificateType, "certificateType")
XCTAssertEqual(subject.outputPath, "/outputPath")
XCTAssertEqual(subject.bundleIdentifierName, "bundleIdentifierName")
XCTAssertEqual(subject.platform, .iOS)
}

func test_execute_alreadyActiveCertificate() throws {
Expand Down
16 changes: 0 additions & 16 deletions Tests/SignHereLibraryTests/PlatformTests.swift

This file was deleted.

12 changes: 4 additions & 8 deletions Tests/SignHereLibraryTests/iTunesConnectServiceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,7 @@ final class iTunesConnectServiceTests: XCTestCase {
let value: String = try subject.determineBundleIdITCId(
jsonWebToken: "jsonWebToken",
bundleIdentifier: "bundleIdentifier",
bundleIdentifierName: nil,
platform: .iOS
bundleIdentifierName: nil
)

// THEN
Expand All @@ -408,8 +407,7 @@ final class iTunesConnectServiceTests: XCTestCase {
let value: String = try subject.determineBundleIdITCId(
jsonWebToken: "jsonWebToken",
bundleIdentifier: "bundleIdentifier",
bundleIdentifierName: "name",
platform: .iOS
bundleIdentifierName: "name"
)

// THEN
Expand All @@ -433,8 +431,7 @@ final class iTunesConnectServiceTests: XCTestCase {
XCTAssertThrowsError(try subject.determineBundleIdITCId(
jsonWebToken: "jsonWebToken",
bundleIdentifier: "bundleIdentifier",
bundleIdentifierName: "invalid",
platform: .iOS
bundleIdentifierName: "invalid"
)) {
if case iTunesConnectServiceImp.Error.unableToDetermineITCIdForBundleId = $0 {
return
Expand All @@ -461,8 +458,7 @@ final class iTunesConnectServiceTests: XCTestCase {
XCTAssertThrowsError(try subject.determineBundleIdITCId(
jsonWebToken: "jsonWebToken",
bundleIdentifier: "bundleIdentifier",
bundleIdentifierName: nil,
platform: .iOS
bundleIdentifierName: nil
)) {
if case iTunesConnectServiceImp.Error.unableToDecodeResponse = $0 {
return
Expand Down

0 comments on commit 0037551

Please sign in to comment.