Skip to content

Commit 2304c0d

Browse files
committed
scaling
1 parent c29bf39 commit 2304c0d

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

Coder-Desktop/Coder-Desktop/VPN/VPNProgress.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ struct VPNProgressView: View {
1313
var body: some View {
1414
VStack {
1515
CircularProgressView(value: value)
16-
// We'll estimate that the last 25% takes 9 seconds
16+
// We estimate that the last half takes 8 seconds
1717
// so it doesn't appear stuck
18-
.autoComplete(threshold: 0.75, duration: 9)
18+
.autoComplete(threshold: 0.5, duration: 8)
1919
Text(progressMessage)
2020
.multilineTextAlignment(.center)
2121
}
@@ -42,7 +42,7 @@ struct VPNProgressView: View {
4242
}
4343
switch progress.stage {
4444
case .initial:
45-
return 0.10
45+
return 0.05
4646
case .downloading:
4747
guard let downloadProgress = progress.downloadProgress else {
4848
// We can't make this illegal state unrepresentable because XPC
@@ -52,17 +52,17 @@ struct VPNProgressView: View {
5252
// 40MB if the server doesn't give us the expected size
5353
let totalBytes = downloadProgress.totalBytesToWrite ?? 40_000_000
5454
let downloadPercent = min(1.0, Float(downloadProgress.totalBytesWritten) / Float(totalBytes))
55-
return 0.10 + 0.6 * downloadPercent
55+
return 0.05 + 0.4 * downloadPercent
5656
case .validating:
57-
return 0.71
57+
return 0.42
5858
case .removingQuarantine:
59-
return 0.72
59+
return 0.44
6060
case .opening:
61-
return 0.73
61+
return 0.46
6262
case .settingUpTunnel:
63-
return 0.74
63+
return 0.48
6464
case .startingTunnel:
65-
return 0.75
65+
return 0.50
6666
}
6767
}
6868
}

Coder-Desktop/Coder-Desktop/Views/VPN/Agents.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ struct Agents<VPN: VPNService>: View {
3333
if hasToggledExpansion {
3434
return
3535
}
36-
expandedItem = visibleItems.first?.id
36+
withAnimation(.snappy(duration: Theme.Animation.collapsibleDuration)) {
37+
expandedItem = visibleItems.first?.id
38+
}
3739
hasToggledExpansion = true
3840
}
3941
if items.count == 0 {

Coder-Desktop/VPNLib/Download.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ extension DownloadManager: URLSessionDownloadDelegate {
238238
try FileManager.default.moveItem(at: location, to: dest)
239239
} catch {
240240
continuation.resume(throwing: DownloadError.fileOpError(error))
241+
return
241242
}
242243

243244
continuation.resume()
@@ -278,7 +279,8 @@ extension DownloadManager: URLSessionDownloadDelegate {
278279
override public var description: String {
279280
let fmt = ByteCountFormatter()
280281
let done = fmt.string(fromByteCount: totalBytesWritten)
281-
let tot = totalBytesToWrite.map { fmt.string(fromByteCount: $0) } ?? "Unknown"
282-
return "\(done) / \(tot)"
282+
.padding(toLength: 7, withPad: " ", startingAt: 0)
283+
let total = totalBytesToWrite.map { fmt.string(fromByteCount: $0) } ?? "Unknown"
284+
return "\(done) / \(total)"
283285
}
284286
}

0 commit comments

Comments
 (0)