Skip to content

Commit

Permalink
display current API key
Browse files Browse the repository at this point in the history
  • Loading branch information
ski-u committed May 3, 2024
1 parent 25e227a commit 433d26c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Features/Sources/APIClient/APIClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ extension DependencyValues {
}

extension APIClient: DependencyKey {
private static var apiKey: APIKey?
private(set) public static var apiKey: APIKey?

public static let liveValue = APIClient(
apod: {
Expand Down
4 changes: 2 additions & 2 deletions Features/Sources/Settings/Settings/Settings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public struct Settings {
switch action {
case let .path(action):
switch action {
case .element(id: _, action: .apiKeySetting):
state.path.append(.apiKeySetting(APIKeySetting.State()))
case let .element(id: id, action: .apiKeySetting(.updateButtonTapped)):
state.path.pop(from: id)
return .none

default:
Expand Down
6 changes: 6 additions & 0 deletions Features/Sources/Settings/Settings/SettingsView.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import APIClient
import ComposableArchitecture
import SwiftUI

Expand Down Expand Up @@ -27,6 +28,11 @@ public struct SettingsView: View {
.padding(.trailing, 8)

Text("API Key")

Spacer()

Text(APIClient.apiKey?.rawValue ?? "None")
.foregroundStyle(Color.secondary)
}
}

Expand Down

0 comments on commit 433d26c

Please sign in to comment.