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

feat: Add pulse logging control #39

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
await PackageManager.shared.setup(
serverProviders: providers,
configurableProxySessionProvider: Container.shared.configurableSessionProvider.resolve(),
customControls: CustomControlsView(model: model)
customControls: CustomControlsView(model: model),
pulseLoggingEnabled: false
)
}

Expand Down
12 changes: 9 additions & 3 deletions Sources/AppDebugMode/Dependencies/PackageManager.swift
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated, ale @andrej-jasso preco sa tato trieda vola PackageManager 😄 ocakaval by som ze budem volat napr. AppDebugMode.shared.setup(...) namiesto aktualneho (a trochu menej intuitivneho nazvu)PackageManager.shared.setup(...)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bola tam issue. Ale ak to premenujeme ešte raz tak ma odpáli.

Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public actor PackageManager {
internal var customControlsViewIsVisible: Bool {
!(customControls is EmptyView)
}
internal var pulseLoggingEnabled: Bool = true

// MARK: - State

Expand Down Expand Up @@ -81,9 +82,13 @@ public extension PackageManager {
serverProviders: [DebugSelectableServerProvider],
configurableProxySessionProvider: ConfigurableSessionProvider?,
firebaseMessaging: AnyObject? = nil,
customControls: (some View)? = nil
customControls: (some View)? = nil,
pulseLoggingEnabled: Bool = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zatial moze byt, improvement do buducna: mozno by nebol zly nejaky Flags struct s takymito konfiguraciami, nech nemame pri setupe privela parametrov

) async {
NetworkLogger.enableProxy()
self.pulseLoggingEnabled = pulseLoggingEnabled
if pulseLoggingEnabled {
NetworkLogger.enableProxy()
}

if !serverProviders.isEmpty {
Container.shared.setupServerProviders(providers: serverProviders)
Expand Down Expand Up @@ -111,7 +116,8 @@ public extension PackageManager {
func start() async -> UIViewController {
let viewController = await AppDebugView(
customControls: AnyView(customControls),
customControlsViewIsVisible: customControlsViewIsVisible
customControlsViewIsVisible: customControlsViewIsVisible,
pulseLoggingEnabled: pulseLoggingEnabled
)
.eraseToUIViewController()

Expand Down
15 changes: 9 additions & 6 deletions Sources/AppDebugMode/Views/AppDebugView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ struct AppDebugView<CustomControls: View>: View {

init(
customControls: CustomControls,
customControlsViewIsVisible: Bool
customControlsViewIsVisible: Bool,
pulseLoggingEnabled: Bool
) {
self.customControls = customControls
self.customControlsViewIsVisible = customControlsViewIsVisible
Expand All @@ -72,11 +73,13 @@ struct AppDebugView<CustomControls: View>: View {
))
}

self.screens.append(Screen(
title: "Pulse Logs",
image: Image(systemName: "wave.3.forward"),
destination: AnyView(PulseUI.ConsoleView().tint(AppDebugColors.primary))
))
if pulseLoggingEnabled {
self.screens.append(Screen(
title: "Pulse Logs",
image: Image(systemName: "wave.3.forward"),
destination: AnyView(PulseUI.ConsoleView().tint(AppDebugColors.primary))
))
}

self.screens.append(contentsOf: [
Screen(
Expand Down