Skip to content

Commit ea2d5fa

Browse files
authored
Fix bug
1 parent 200e79a commit ea2d5fa

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

Sources/prostore/certificates/CertificatesManager.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// CertificatesManager.swift
21
import Foundation
32
import Security
43
import CryptoKit
@@ -56,7 +55,10 @@ public final class CertificatesManager: ObservableObject {
5655
return nil
5756
}
5857

59-
return identityAny as! SecIdentity
58+
guard let identity = identityAny as? SecIdentity else {
59+
return nil
60+
}
61+
return identity
6062
}
6163

6264
// MARK: - SHA256 hex
@@ -138,11 +140,14 @@ public final class CertificatesManager: ObservableObject {
138140
guard status == errSecSuccess,
139141
let itemsArray = items as? [[String: Any]],
140142
let identityAny = itemsArray.first?[kSecImportItemIdentity as String],
141-
CFGetTypeID(identityAny as CFTypeRef) == SecIdentityGetTypeID(),
142-
let identity = identityAny as? SecIdentity else {
143+
CFGetTypeID(identityAny as CFTypeRef) == SecIdentityGetTypeID() else {
143144
return .failure(CertificateError.p12ImportFailed(status))
144145
}
145146

147+
guard let identity = identityAny as? SecIdentity else {
148+
return .failure(CertificateError.identityExtractionFailed)
149+
}
150+
146151
var certRef: SecCertificate?
147152
guard SecIdentityCopyCertificate(identity, &certRef) == errSecSuccess,
148153
let p12Cert = certRef else {

Sources/prostore/install/installApp.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ public func installApp(from ipaURL: URL) async throws {
1313
let viewModel = InstallerStatusViewModel()
1414

1515
// Create the installation proxy
16-
// Note: InstallationProxy(viewModel:) initializer is NOT async in current IDeviceSwift versions
17-
let installer = InstallationProxy(viewModel: viewModel)
16+
let installer = await InstallationProxy(viewModel: viewModel)
1817

1918
// Perform the actual installation
2019
try await installer.install(at: ipaURL)

Sources/prostore/signing/DownloadSignManager.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ final class DownloadSignManager: ObservableObject, @unchecked Sendable {
7777
}
7878

7979
private func downloadIPA(from url: URL, to destination: URL, completion: @escaping (Result<Void, Error>) -> Void) {
80-
let task = URLSession.shared.downloadTask(with: url) { [weak self] tempURL, _, error in
80+
let task = URLSession.shared.downloadTask(with: url) { tempURL, _, error in
8181
if let error {
8282
completion(.failure(error))
8383
return
@@ -101,7 +101,7 @@ final class DownloadSignManager: ObservableObject, @unchecked Sendable {
101101
}
102102

103103
// Progress observation
104-
let observation = task.progress.observe(\.fractionCompleted) { [weak self] progress, _ in
104+
_ = task.progress.observe(\.fractionCompleted) { [weak self] progress, _ in
105105
let downloadProgress = progress.fractionCompleted * 0.5
106106
DispatchQueue.main.async {
107107
self?.progress = downloadProgress
@@ -111,8 +111,6 @@ final class DownloadSignManager: ObservableObject, @unchecked Sendable {
111111

112112
self.downloadTask = task
113113
task.resume()
114-
115-
// Clean up observation when task finishes (invalidate manually in completion if needed)
116114
}
117115

118116
private func getCertificateFiles(for folderName: String) -> (p12URL: URL, provURL: URL, password: String)? {

0 commit comments

Comments
 (0)