Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Commit 6a91105

Browse files
authored
Update progress UI: instant percentage updates, sliding bar animation, fading status text
1 parent 7f4294d commit 6a91105

File tree

1 file changed

+23
-28
lines changed

1 file changed

+23
-28
lines changed

Sources/prosign/views/SignerView.swift

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ struct SignerView: View {
4343
}
4444
}
4545
.padding(.vertical, 4)
46-
4746
if hasSelectedCertificate, let name = selectedCertificateName {
4847
Text("The \(name) certificate will be used to sign the ipa file. If you wish to use a different certificate for signing, please select or add it to the certificates page.")
4948
.font(.subheadline)
@@ -55,7 +54,6 @@ struct SignerView: View {
5554
.padding(.vertical, 4)
5655
}
5756
}
58-
5957
Section {
6058
Button(action: runSign) {
6159
HStack {
@@ -76,7 +74,6 @@ struct SignerView: View {
7674
.animation(.easeInOut(duration: 0.2), value: isProcessing)
7775
}
7876
.padding(.vertical, 8)
79-
8077
if isProcessing || !currentStage.isEmpty {
8178
Section(header: Text("Progress")
8279
.font(.headline)
@@ -85,12 +82,16 @@ struct SignerView: View {
8582
HStack {
8683
Text(currentStage)
8784
.foregroundColor(currentStage == "Error" ? .red : currentStage == "Done!" ? .green : .primary)
85+
.animation(.easeInOut(duration: 0.2), value: currentStage)
8886
ProgressView(value: overallProgress)
8987
.progressViewStyle(.linear)
9088
.tint(barColor)
9189
.frame(maxWidth: .infinity)
90+
.animation(.easeInOut(duration: 0.5), value: overallProgress)
91+
.animation(.default, value: barColor)
9292
Text("\(Int(overallProgress * 100))%")
9393
.foregroundColor(currentStage == "Error" ? .red : currentStage == "Done!" ? .green : .primary)
94+
.animation(nil, value: overallProgress)
9495
}
9596
if isError {
9697
Text(errorDetails)
@@ -170,7 +171,6 @@ struct SignerView: View {
170171
let p12URL = certDir.appendingPathComponent("certificate.p12")
171172
let provURL = certDir.appendingPathComponent("profile.mobileprovision")
172173
let passwordURL = certDir.appendingPathComponent("password.txt")
173-
174174
guard FileManager.default.fileExists(atPath: p12URL.path), FileManager.default.fileExists(atPath: provURL.path) else {
175175
currentStage = "Error"
176176
errorDetails = "Error loading certificate files 😅"
@@ -181,22 +181,19 @@ struct SignerView: View {
181181
}
182182
return
183183
}
184-
185184
let p12Password: String
186185
if let passwordData = try? Data(contentsOf: passwordURL),
187186
let passwordStr = String(data: passwordData, encoding: .utf8) {
188187
p12Password = passwordStr
189188
} else {
190189
p12Password = ""
191190
}
192-
193191
isProcessing = true
194192
currentStage = "Preparing"
195193
overallProgress = 0.0
196194
barColor = .blue
197195
isError = false
198196
errorDetails = ""
199-
200197
ProStoreTools.sign(
201198
ipaURL: ipaURL,
202199
p12URL: p12URL,
@@ -236,27 +233,25 @@ struct SignerView: View {
236233
}
237234

238235
private func updateProgress(from message: String) {
239-
withAnimation {
240-
if message.contains("Preparing") {
241-
currentStage = "Preparing"
242-
overallProgress = 0.0
243-
} else if message.contains("Unzipping") {
244-
currentStage = "Unzipping"
245-
if let pct = extractPercentage(from: message) {
246-
overallProgress = 0.25 + (pct / 100.0) * 0.25
247-
} else {
248-
overallProgress = 0.25
249-
}
250-
} else if message.contains("Signing") {
251-
currentStage = "Signing"
252-
overallProgress = 0.5
253-
} else if message.contains("Zipping") {
254-
currentStage = "Zipping"
255-
if let pct = extractPercentage(from: message) {
256-
overallProgress = 0.75 + (pct / 100.0) * 0.25
257-
} else {
258-
overallProgress = 0.75
259-
}
236+
if message.contains("Preparing") {
237+
currentStage = "Preparing"
238+
overallProgress = 0.0
239+
} else if message.contains("Unzipping") {
240+
currentStage = "Unzipping"
241+
if let pct = extractPercentage(from: message) {
242+
overallProgress = 0.25 + (pct / 100.0) * 0.25
243+
} else {
244+
overallProgress = 0.25
245+
}
246+
} else if message.contains("Signing") {
247+
currentStage = "Signing"
248+
overallProgress = 0.5
249+
} else if message.contains("Zipping") {
250+
currentStage = "Zipping"
251+
if let pct = extractPercentage(from: message) {
252+
overallProgress = 0.75 + (pct / 100.0) * 0.25
253+
} else {
254+
overallProgress = 0.75
260255
}
261256
}
262257
}

0 commit comments

Comments
 (0)