diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..0d322a2 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: lunij diff --git a/Sources/Netbob/Extensions/Color.swift b/Sources/Netbob/Extensions/Color.swift new file mode 100644 index 0000000..1579a16 --- /dev/null +++ b/Sources/Netbob/Extensions/Color.swift @@ -0,0 +1,23 @@ +// +// Copyright © Marc Schultz. All rights reserved. +// + +import SwiftUI + +extension Color { + static var systemGreen: Color { + Color(UIColor.systemGreen) + } + + static var systemGroupedBackground: Color { + Color(UIColor.systemGroupedBackground) + } + + static var systemOrange: Color { + Color(UIColor.systemOrange) + } + + static var systemRed: Color { + Color(UIColor.systemRed) + } +} diff --git a/Sources/Netbob/Modules/Detail/DetailView.swift b/Sources/Netbob/Modules/Detail/DetailView.swift index 8139652..a765139 100644 --- a/Sources/Netbob/Modules/Detail/DetailView.swift +++ b/Sources/Netbob/Modules/Detail/DetailView.swift @@ -15,6 +15,7 @@ struct DetailView: View { ResponseTab(state: state).tag(2) } .tabViewStyle(PageTabViewStyle(indexDisplayMode: .never)) + .background(Color.systemGroupedBackground) .toolbar { ToolbarItem(placement: .topBarTrailing) { ShareButton(state: state) diff --git a/Sources/Netbob/Modules/List/ListView.swift b/Sources/Netbob/Modules/List/ListView.swift index bc407d0..9ce5cca 100644 --- a/Sources/Netbob/Modules/List/ListView.swift +++ b/Sources/Netbob/Modules/List/ListView.swift @@ -60,8 +60,8 @@ struct ListRow: View { var body: some View { HStack { rectangle - .frame(width: 10) - .foregroundColor(viewData.statusColor) + .frame(width: 6) + .foregroundColor(viewData.statusColor.opacity(0.8)) VStack(alignment: .leading, spacing: 4) { HStack { @@ -82,6 +82,7 @@ struct ListRow: View { .lineLimit(4) } } + .opacity(viewData.isFromCurrentSession ? 1 : 0.6) } @ViewBuilder @@ -99,11 +100,11 @@ extension HTTPConnectionViewData { var statusColor: Color { switch status { case .success: - return .green + return .systemGreen case .failure: - return .red + return .systemRed case .timeout: - return .orange + return .systemOrange } } } diff --git a/Tests/NetbobTests/Fakes/HTTPConnection.swift b/Tests/NetbobTests/Fakes/HTTPConnection.swift index ceb6efd..7d9c287 100644 --- a/Tests/NetbobTests/Fakes/HTTPConnection.swift +++ b/Tests/NetbobTests/Fakes/HTTPConnection.swift @@ -9,9 +9,11 @@ import UIKit extension HTTPConnection { static func fake( request: HTTPRequest = .fake(), - response: HTTPResponse? = .fake() + response: HTTPResponse? = .fake(), + isFromCurrentSession: Bool = true ) -> HTTPConnection { let connection = HTTPConnection(request: request) + connection.isFromCurrentSession = isFromCurrentSession if let response = response { connection.store(response: response) } diff --git a/Tests/NetbobTests/Modules/List/ListViewTests.swift b/Tests/NetbobTests/Modules/List/ListViewTests.swift index afffca5..bee8459 100644 --- a/Tests/NetbobTests/Modules/List/ListViewTests.swift +++ b/Tests/NetbobTests/Modules/List/ListViewTests.swift @@ -30,7 +30,10 @@ class ListViewStateMock: ListViewStateAbstract { connections = [ .init(.fake()), .init(.fake(response: nil)), - .init(.fake(response: .fake(httpUrlResponse: .fake(statusCode: 400)))) + .init(.fake(response: .fake(httpUrlResponse: .fake(statusCode: 400)))), + .init(.fake(isFromCurrentSession: false)), + .init(.fake(response: nil, isFromCurrentSession: false)), + .init(.fake(response: .fake(httpUrlResponse: .fake(statusCode: 400)), isFromCurrentSession: false)) ] } } diff --git a/Tests/NetbobTests/Modules/List/__Snapshots__/ListViewTests/test_listView.1.png b/Tests/NetbobTests/Modules/List/__Snapshots__/ListViewTests/test_listView.1.png index 3902846..fb76d02 100644 Binary files a/Tests/NetbobTests/Modules/List/__Snapshots__/ListViewTests/test_listView.1.png and b/Tests/NetbobTests/Modules/List/__Snapshots__/ListViewTests/test_listView.1.png differ