Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update colors and contrast #16

Merged
merged 2 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: lunij
23 changes: 23 additions & 0 deletions Sources/Netbob/Extensions/Color.swift
Original file line number Diff line number Diff line change
@@ -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)
}
}
1 change: 1 addition & 0 deletions Sources/Netbob/Modules/Detail/DetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 6 additions & 5 deletions Sources/Netbob/Modules/List/ListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -82,6 +82,7 @@ struct ListRow: View {
.lineLimit(4)
}
}
.opacity(viewData.isFromCurrentSession ? 1 : 0.6)
}

@ViewBuilder
Expand All @@ -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
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion Tests/NetbobTests/Fakes/HTTPConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
5 changes: 4 additions & 1 deletion Tests/NetbobTests/Modules/List/ListViewTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
]
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading