Modern Apps git

xtool.git

Public
git clone https://git.maproj.org/xtool.git
appstore-distribution ▾

xtool.git / Sources / XKit / DeveloperServices / DeveloperServicesProvisioningOperation.swift

DeveloperServicesProvisioningOperation.swift61 lines · 1.8 KiBRaw
1//
2// DeveloperServicesProvisioningOperation.swift
3// XKit
4//
5// Created by Kabir Oberai on 12/10/19.
6// Copyright © 2019 Kabir Oberai. All rights reserved.
7//
8
9import Foundation
10
11public struct ProvisioningInfo: Sendable {
12 public let newBundleID: String
13 public let entitlements: Entitlements
14 public let mobileprovision: Mobileprovision
15}
16
17public struct DeveloperServicesProvisioningOperation: DeveloperServicesOperation {
18
19 public struct Response {
20 public let signingInfo: SigningInfo
21 public let provisioningDict: [URL: ProvisioningInfo]
22 }
23
24 public let context: SigningContext
25 public let app: URL
26 public let confirmRevocation: @Sendable ([DeveloperServicesCertificate]) async -> Bool
27 public let progress: @Sendable (Double) -> Void
28 public init(
29 context: SigningContext,
30 app: URL,
31 confirmRevocation: @escaping @Sendable ([DeveloperServicesCertificate]) async -> Bool,
32 progress: @escaping @Sendable (Double) -> Void
33 ) {
34 self.context = context
35 self.app = app
36 self.confirmRevocation = confirmRevocation
37 self.progress = progress
38 }
39
40 public func perform() async throws -> Response {
41 progress(0/3)
42 try await DeveloperServicesAddDeviceOperation(context: context).perform()
43
44 progress(1/3)
45 let signingInfo = try await DeveloperServicesFetchCertificateOperation(
46 context: self.context,
47 confirmRevocation: confirmRevocation
48 ).perform()
49
50 progress(2/3)
51 let provisioningDict = try await DeveloperServicesAddAppOperation(
52 context: context,
53 signingInfo: signingInfo,
54 root: app
55 ).perform()
56
57 progress(3/3)
58 return .init(signingInfo: signingInfo, provisioningDict: provisioningDict)
59 }
60
61}