Fix warnings on watchOS

This commit is contained in:
kean
2023-08-27 18:44:03 -04:00
parent 062d8112f3
commit b39146ac7e
2 changed files with 10 additions and 8 deletions
+7 -5
View File
@@ -67,11 +67,11 @@ enum ConsoleFormatter {
return label.capitalized
}
static func subheadline(for task: NetworkTaskEntity, hasTime: Bool = true) -> String {
static func subheadline(for task: NetworkTaskEntity, hasTime: Bool = true, store: LoggerStore) -> String {
return [
hasTime ? time(for: task.createdAt) : nil,
task.httpMethod ?? "GET",
status(for: task),
status(for: task, store: store),
transferSize(for: task),
duration(for: task)
].compactMap { $0 }.joined(separator: separator)
@@ -99,9 +99,11 @@ enum ConsoleFormatter {
}
}
@available(*, deprecated, renamed: "Ds", message: "ds")
static func status(for task: NetworkTaskEntity) -> String {
switch task.state {
static func status(for task: NetworkTaskEntity, store: LoggerStore) -> String {
guard let state = task.state(in: store) else {
return "Unknown"
}
switch state {
case .pending:
return ProgressViewModel.title(for: task)
case .success:
+3 -3
View File
@@ -90,7 +90,7 @@ final class TextRenderer {
if content.contains(.largeHeader) {
renderLargeHeader(for: task, store: store)
} else if content.contains(.header) {
renderHeader(for: task)
renderHeader(for: task, store: store)
}
if content.contains(.taskDetails) {
@@ -171,11 +171,11 @@ final class TextRenderer {
addSpacer()
}
private func renderHeader(for task: NetworkTaskEntity) {
private func renderHeader(for task: NetworkTaskEntity, store: LoggerStore) {
let isTitleColored = task.state == .failure && options.color != .monochrome
let titleColor = isTitleColored ? UXColor.systemRed : UXColor.secondaryLabel
let detailsColor = isTitleColored ? UXColor.systemRed : UXColor.label
let title = ConsoleFormatter.subheadline(for: task)
let title = ConsoleFormatter.subheadline(for: task, store: store)
string.append(title + "\n", helper.attributes(role: .subheadline, style: .monospacedDigital, width: .condensed, color: titleColor))
var urlAttributes = helper.attributes(role: .body2, weight: .medium, color: detailsColor)
urlAttributes[.underlineColor] = UXColor.clear