Skip to content

Commit

Permalink
Move Pulse to cocoapods & exclude from Release
Browse files Browse the repository at this point in the history
  • Loading branch information
bjtitus committed Jun 14, 2024
1 parent e437fe9 commit f480240
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 43 deletions.
16 changes: 0 additions & 16 deletions Modules/Utils/Package.resolved

This file was deleted.

4 changes: 0 additions & 4 deletions Modules/Utils/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@ let package = Package(
targets: ["PocketCastsUtils"]
)
],
dependencies: [
.package(url: "/~https://github.com/kean/Pulse.git", from: "4.2.3")
],
targets: [
.target(
name: "PocketCastsUtils",
dependencies: ["Pulse", .product(name: "PulseUI", package: "Pulse")],
path: "Sources"
),
.testTarget(
Expand Down
12 changes: 2 additions & 10 deletions Modules/Utils/Sources/PocketCastsUtils/Logging/FileLog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import Combine
import Foundation
import os

@_exported import Pulse
@_exported import PulseUI

actor LogBuffer {
private let bufferThreshold: UInt

Expand Down Expand Up @@ -116,6 +113,7 @@ public final class FileLog {
}()

private var logBuffer: LogBuffer
public let publisher = PassthroughSubject<String, Never>()

init(
logPersistence: PersistentTextWriting,
Expand All @@ -129,13 +127,7 @@ public final class FileLog {
public func addMessage(_ message: String, date: Date = Date()) {
Task {
await logBuffer.append(message, date: date)
if FeatureFlag.networkDebugging.enabled {
LoggerStore.shared.storeMessage(
label: "FileLog",
level: .debug,
message: message
)
}
publisher.send(message)
}
}

Expand Down
2 changes: 2 additions & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ end
target 'podcasts' do
platform :ios, app_ios_deployment_target.version
common_pods
pod 'PulseCore', :git => '/~https://github.com/kean/Pulse.git', :tag => '4.2.4', :configurations => ['Debug', 'Staging', 'Prototype']
pod 'PulseUI', :git => '/~https://github.com/kean/Pulse.git', :tag => '4.2.4', :configurations => ['Debug', 'Staging', 'Prototype']
end

target 'PocketCastsTests' do
Expand Down
21 changes: 20 additions & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
PODS:
- google-cast-sdk-no-bluetooth (1.0.0)
- PulseCore (4.2.4)
- PulseUI (4.2.4):
- PulseCore (~> 4.2)
- SwiftGen (6.5.1)
- SwiftLint (0.54.0)

DEPENDENCIES:
- google-cast-sdk-no-bluetooth (from `/~https://github.com/shiftyjelly/google-cast.git`)
- PulseCore (from `/~https://github.com/kean/Pulse.git`, tag `4.2.4`)
- PulseUI (from `/~https://github.com/kean/Pulse.git`, tag `4.2.4`)
- SwiftGen (~> 6.0)
- SwiftLint (= 0.54.0)

Expand All @@ -16,17 +21,31 @@ SPEC REPOS:
EXTERNAL SOURCES:
google-cast-sdk-no-bluetooth:
:git: /~https://github.com/shiftyjelly/google-cast.git
PulseCore:
:git: /~https://github.com/kean/Pulse.git
:tag: 4.2.4
PulseUI:
:git: /~https://github.com/kean/Pulse.git
:tag: 4.2.4

CHECKOUT OPTIONS:
google-cast-sdk-no-bluetooth:
:commit: 3d02e3bf9e4feb044f4ef6b5ec001d06def76f88
:git: /~https://github.com/shiftyjelly/google-cast.git
PulseCore:
:git: /~https://github.com/kean/Pulse.git
:tag: 4.2.4
PulseUI:
:git: /~https://github.com/kean/Pulse.git
:tag: 4.2.4

SPEC CHECKSUMS:
google-cast-sdk-no-bluetooth: fd144bf43bb76000a8e92b0410ae605937aa83bf
PulseCore: a40e40555e355948829a4d3b5f997578098a49c4
PulseUI: f7464009d4fca0c88de41f6153d7aef4ae0a906a
SwiftGen: a6d22010845f08fe18fbdf3a07a8e380fd22e0ea
SwiftLint: c1de071d9d08c8aba837545f6254315bc900e211

PODFILE CHECKSUM: 264a30ec005cbb37698304b90df2aed6f23dda3a
PODFILE CHECKSUM: 0e185a045339562186e19d10c2aa0259da224fc9

COCOAPODS: 1.14.2
9 changes: 0 additions & 9 deletions podcasts.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,6 @@
"version": "2.4.0"
}
},
{
"package": "Pulse",
"repositoryURL": "/~https://github.com/kean/Pulse.git",
"state": {
"branch": null,
"revision": "2d37916b14718f7b654606d72f6cf23f299dc47a",
"version": "4.2.3"
}
},
{
"package": "Sentry",
"repositoryURL": "/~https://github.com/getsentry/sentry-cocoa",
Expand Down
14 changes: 14 additions & 0 deletions podcasts/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import Foundation
import PocketCastsDataModel
import PocketCastsServer
import PocketCastsUtils
import Combine
#if canImport(Pulse)
import Pulse
#endif

class AppDelegate: UIResponder, UIApplicationDelegate {
private static let initialRefreshDelay = 2.seconds
Expand All @@ -28,11 +31,22 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

lazy var whatsNew: WhatsNew = WhatsNew()

private var cancellables = Set<AnyCancellable>()

// MARK: - App Lifecycle

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
if FeatureFlag.networkDebugging.enabled {
#if canImport(Pulse)
URLSessionProxyDelegate.enableAutomaticRegistration()
FileLog.shared.publisher.sink { message in
LoggerStore.shared.storeMessage(
label: "FileLog",
level: .debug,
message: message
)
}.store(in: &cancellables)
#endif
}
configureFirebase()
TraceManager.shared.setup(handler: traceHandler)
Expand Down
4 changes: 4 additions & 0 deletions podcasts/DatabaseExport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import Foundation
import PocketCastsDataModel
import PocketCastsUtils
import Combine
#if canImport(Pulse)
import Pulse
#endif

class DatabaseExport {
/// The resulting file name of the zip file
Expand Down Expand Up @@ -71,8 +73,10 @@ class DatabaseExport {
let logsFile = exportDirectory.appendingPathComponent("logs.txt", isDirectory: false)
try fileManager.copyItem(at: URL(fileURLWithPath: logFile), to: logsFile)

#if canImport(Pulse)
let networkLogsFile = exportDirectory.appendingPathComponent("network.pulse", isDirectory: false)
try await LoggerStore.shared.export(to: networkLogsFile)
#endif

// Write the bundle document
let exportFile = exportDirectory.appendingPathComponent("export", conformingTo: .pcasts)
Expand Down
13 changes: 10 additions & 3 deletions podcasts/DeveloperMenu.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import SwiftUI
import PocketCastsServer
import PocketCastsDataModel
import PocketCastsUtils
#if canImport(PulseUI)
import PulseUI
#endif

struct DeveloperMenu: View {
@State var showingImporter = false
Expand Down Expand Up @@ -62,10 +65,14 @@ struct DeveloperMenu: View {
})
}

Section {
NavigationLink(destination: ConsoleView()) {
Text("Network Debugger")
if FeatureFlag.networkDebugging.enabled {
#if canImport(PulseUI)
Section {
NavigationLink(destination: ConsoleView()) {
Text("Network Debugger")
}
}
#endif
}

Section {
Expand Down

0 comments on commit f480240

Please sign in to comment.