Skip to content

armgit / xtool

Public Imported from GitHub
0

Cross-platform Xcode replacement. Build and deploy iOS apps with SwiftPM on Linux, Windows, macOS.

Prepare for eventual DeveloperServices login fix

kabiroberaib5392ecdc7a3
diff --git a/Supersign/DeveloperServices/DeveloperServicesPlatformRequest.swift b/Supersign/DeveloperServices/DeveloperServicesPlatformRequest.swift
index f815eae..febf154 100644
--- a/Supersign/DeveloperServices/DeveloperServicesPlatformRequest.swift
+++ b/Supersign/DeveloperServices/DeveloperServicesPlatformRequest.swift
@@ -8,15 +8,26 @@
import Foundation
-public enum DeveloperServicesPlatform: String, Decodable {
- case iOS = "ios"
- case watchOS = "watchos"
- case tvOS = "tvos"
+public enum DeveloperServicesPlatform: Decodable, CaseIterable {
+ case unknown
+ case iOS
+ case watchOS
+ case tvOS
+
+ var rawValue: String {
+ switch self {
+ case .iOS: return "ios"
+ case .watchOS: return "watchos"
+ case .tvOS: return "tvos"
+ case .unknown: return ""
+ }
+ }
var os: String {
switch self {
case .iOS, .watchOS: return "ios"
case .tvOS: return "tvos"
+ case .unknown: return ""
}
}
@@ -24,6 +35,7 @@ public enum DeveloperServicesPlatform: String, Decodable {
switch self {
case .iOS, .watchOS: return nil
case .tvOS: return "tvOS"
+ case .unknown: return ""
}
}
@@ -36,6 +48,11 @@ public enum DeveloperServicesPlatform: String, Decodable {
return .iOS
#endif
}()
+
+ public init(from decoder: Decoder) throws {
+ let rawValue = try String(from: decoder)
+ self = Self.allCases.first { $0.rawValue == rawValue } ?? .unknown
+ }
}
protocol DeveloperServicesPlatformRequest: DeveloperServicesRequest {
diff --git a/SupersignTests/Tests/SupersignDeveloperServicesTests.swift b/SupersignTests/Tests/SupersignDeveloperServicesTests.swift
index 122efb4..3480f0e 100644
--- a/SupersignTests/Tests/SupersignDeveloperServicesTests.swift
+++ b/SupersignTests/Tests/SupersignDeveloperServicesTests.swift
@@ -25,7 +25,22 @@ class SupersignDeveloperServicesTests: XCTestCase {
// integration test for provisioning
func testProvisioningIntegration() throws {
+ let listTeams = DeveloperServicesListTeamsRequest()
+ let teams = try XCTTry(client.sendTest(listTeams))
+ let team = teams.first { $0.status == "active" && $0.memberships.contains { $0.platform == .iOS } }!
+
+ let bundle = Bundle(for: Self.self)
+ let source = try! XCTUnwrap(bundle.url(forResource: "test", withExtension: "app"))
+
+ let context = try XCTTry(SigningContext(
+ udid: "00008030-001409AA0298802E", team: team, signerImpl: .first(), client: client
+ ))
+
+ let waiter = ResultWaiter<DeveloperServicesProvisioningOperation.Response>(description: "Failed to provision")
+ DeveloperServicesProvisioningOperation(context: context, app: source).perform(completion: waiter.completion)
+ let response = try XCTTry(waiter.wait(timeout: 10000))
+ print(response)
}
func testListTeams() throws {