Skip to content

Commit c210861

Browse files
committed
Adjust network response labels to show millis instead of seconds
1 parent a4b9e43 commit c210861

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

Sources/Scyther/Components/Cells/NetworkLogCell.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class NetworkLogCell: UITableViewCell {
5555
/// Setup `timeLabel`
5656
timeLabel.textAlignment = .center
5757
timeLabel.font = .systemFont(ofSize: 11)
58+
timeLabel.numberOfLines = 2
5859
contentView.addSubview(timeLabel)
5960
}
6061

Sources/Scyther/User Interface/Network Logger/Log Details View Controller/LogDetailsViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ internal class LogDetailsViewModel {
129129
overviewSection.rows.append(defaultRow(name: "Date",
130130
value: httpModel?.requestDate?.formatted()))
131131
overviewSection.rows.append(defaultRow(name: "Duration",
132-
value: String(format: "%.2fs", httpModel?.requestDuration ?? 0)))
132+
value: String(format: "%.0fms", httpModel?.requestDuration ?? 0)))
133133

134134
/// Setup Request Headers Section
135135
var requestHeadersSection: Section = Section()

Sources/Scyther/User Interface/Network Logger/Log View Controller/NetworkLoggerViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ internal class NetworkLoggerViewModel {
2525
let row: NetworkLogRow = NetworkLogRow()
2626
row.httpMethod = httpModel.requestMethod
2727
row.httpStatusCode = httpModel.responseStatus
28-
row.httpRequestTime = String(format: "%.2fs", httpModel.requestDuration ?? 0)
28+
row.httpRequestTime = String(format: "%.0fms", httpModel.requestDuration ?? 0)
2929
row.httpStatusColor = httpStatusColor(for: httpModel.responseStatus ?? 0)
3030
row.httpRequestURL = httpModel.requestURL
3131
row.httpModel = httpModel

Sources/Scyther/Utilities/Network Logger/LoggerHTTPModel.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,9 @@ fileprivate func < <T : Comparable>(lhs: T?, rhs: T?) -> Bool {
133133
self.shortType = getShortTypeFrom(self.responseType ?? "").rawValue
134134
}
135135

136-
self.requestDuration = Float(self.responseDate!.timeIntervalSince(self.requestDate!))
136+
if let responseDate = responseDate, let requestDate = requestDate {
137+
self.requestDuration = Float(responseDate.timeIntervalSince(requestDate) * 1000)
138+
}
137139

138140
saveResponseBodyData(data)
139141
formattedResponseLogEntry().appendToFile(filePath: LoggerFilePath.SessionLog)

0 commit comments

Comments
 (0)