Skip to content
7 changes: 7 additions & 0 deletions Demo/Sources/iOS/Pulse_Demo_iOSApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ private final class AppViewModel: ObservableObject {
init() {
// This code registers the store with the `RemoteLogger` (important!)
LoggerStore.shared = .demo

/*
//Disable: options -> 1. "Settings", "Get Pulse Pro", "Report Issue"
UserDefaults.standard.set(true, forKey: "pulse-disable-support-prompts")
UserDefaults.standard.set(true, forKey: "pulse-disable-report-issue-prompts")
UserDefaults.standard.set(true, forKey: "pulse-disable-settings-prompts")
*/

// RemoteLogger.shared.isAutomaticConnectionEnabled = true

Expand Down
1 change: 1 addition & 0 deletions Sources/Pulse/Helpers/Helpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ extension URLRequest {
var bodyStreamData = Data()
while bodyStream.hasBytesAvailable {
let readData = bodyStream.read(buffer, maxLength: bufferSize)
guard readData != -1 else { return nil } // read failed
bodyStreamData.append(buffer, count: readData)
}
return bodyStreamData
Expand Down
4 changes: 4 additions & 0 deletions Sources/Pulse/NetworkLogger/NetworkLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//
// Copyright (c) 2020-2024 Alexander Grebenyuk (github.com/kean).

import AVFoundation
import Foundation

/// A wrapper on top of ``LoggerStore`` that simplifies logging of network requests.
Expand Down Expand Up @@ -167,6 +168,9 @@ public final class NetworkLogger: @unchecked Sendable {
let context = context(for: task)
lock.unlock()

#if !os(tvOS) && !os(watchOS)
guard !task.isKind(of: AVAssetDownloadTask.self) else { return }
#endif
guard let originalRequest = task.originalRequest else { return }
send(.networkTaskCreated(LoggerStore.Event.NetworkTaskCreated(
taskId: context.taskId,
Expand Down
13 changes: 9 additions & 4 deletions Sources/PulseUI/Features/Console/Views/ConsoleContextMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ struct ConsoleContextMenu: View {
ConsoleSortByMenu()
}
Section {
Button(action: { router.isShowingSettings = true }) {
Label("Settings", systemImage: "gear")
if !UserDefaults.standard.bool(forKey: "pulse-disable-settings-prompts") {
Button(action: { router.isShowingSettings = true }) {
Label("Settings", systemImage: "gear")
}
}

if !environment.store.options.contains(.readonly) {
Button(role: .destructive, action: environment.removeAllLogs) {
Label("Remove Logs", systemImage: "trash")
Expand All @@ -40,8 +43,10 @@ struct ConsoleContextMenu: View {
Label("Get Pulse Pro", systemImage: "link")
}
}
Button(action: buttonSendFeedbackTapped) {
Label("Report Issue", systemImage: "envelope")
if !UserDefaults.standard.bool(forKey: "pulse-disable-report-issue-prompts") {
Button(action: buttonSendFeedbackTapped) {
Label("Report Issue", systemImage: "envelope")
}
}
}
} label: {
Expand Down