diff --git a/.changeset/v4-internalize-wrapper-apis.md b/.changeset/v4-internalize-wrapper-apis.md new file mode 100644 index 000000000..37731cca1 --- /dev/null +++ b/.changeset/v4-internalize-wrapper-apis.md @@ -0,0 +1,23 @@ +--- +'posthog-ios': major +--- + +**Breaking:** hide SDK internals that were public only for PostHog's own wrapper SDKs. + +Moved behind `@_spi(PostHogInternal)`. These are for PostHog's wrapper SDKs and carry no stability guarantees: + +- `postHogSdkName` and `postHogVersion` +- `PostHogSessionManager`: use `PostHogSDK.getSessionId()`, `startSession()` and `endSession()`. +- `PostHogStorageManager` and `PostHogConfig.storageManager`: use the `PostHogSDK` identity methods such as `identify`, `getDistinctId()` and `reset()`. +- `PostHogConfig.snapshotEndpoint` +- `dateToMillis(_:)`: use `Int64(date.timeIntervalSince1970 * 1000)`. +- `imageToBase64(_:_:)`: no public replacement. It returned a WebP `data:` URI, or JPEG when WebP encoding failed. + +No longer public: + +- `toISO8601String(_:)`, `toISO8601Date(_:)`, `sanitizeDictionary(_:)`, `deleteSafely(_:)` and `postHogiOSSdkName` +- `Gzip`, `GzipError` and `CompressionLevel` +- `ReachabilityError` +- `UIColor.init(hex:)` and `UIColor.hexDescription(_:)` + +`PostHogSessionManager.shared`, `PostHogSessionManager.setSessionId(_:)` and `PostHogConfig.snapshotEndpoint` are no longer exposed to Objective-C. diff --git a/PostHog/PostHogConfig.swift b/PostHog/PostHogConfig.swift index 71da12c2d..9e94807d7 100644 --- a/PostHog/PostHogConfig.swift +++ b/PostHog/PostHogConfig.swift @@ -380,7 +380,7 @@ public typealias BeforeSendBlock = (PostHogEvent) -> PostHogEvent? /// /// - Warning: This value is managed by the SDK from remote configuration and should not /// be changed by application code. - @objc public var snapshotEndpoint: String = "/s/" + @_spi(PostHogInternal) public var snapshotEndpoint: String = "/s/" /// Default PostHog ingestion host for US Cloud projects. /// @@ -479,7 +479,7 @@ public typealias BeforeSendBlock = (PostHogEvent) -> PostHogEvent? /// /// - Warning: This is an SDK extension point used internally to share identity storage /// with SDK integrations and tests. Application code should not normally replace it. - public var storageManager: PostHogStorageManager? + @_spi(PostHogInternal) public var storageManager: PostHogStorageManager? private static func normalizeProjectToken(_ projectToken: String) -> String { projectToken.trimmingCharacters(in: .whitespacesAndNewlines) diff --git a/PostHog/PostHogSessionManager.swift b/PostHog/PostHogSessionManager.swift index d239902f6..7220dd224 100644 --- a/PostHog/PostHogSessionManager.swift +++ b/PostHog/PostHogSessionManager.swift @@ -9,10 +9,10 @@ import Foundation /// Manages the active PostHog session ID and session rotation state. /// -/// - Warning: This class is public for backwards compatibility, but is intended for -/// SDK-internal use only. Application code should use `PostHogSDK.getSessionId()`, +/// - Warning: For PostHog's wrapper SDKs only, which import it with +/// `@_spi(PostHogInternal)`. Application code should use `PostHogSDK.getSessionId()`, /// `startSession()`, and `endSession()` instead of interacting with this manager directly. -@objc public class PostHogSessionManager: NSObject { +@_spi(PostHogInternal) @objc public class PostHogSessionManager: NSObject { enum SessionIDChangeReason: String { case sessionIdEmpty = "Session id was empty" case sessionStart = "Session started" @@ -24,8 +24,7 @@ import Foundation } /// Session manager used by `PostHogSDK.shared`. - @available(*, deprecated, message: "PostHogSessionManager becomes SDK-internal in PostHog 4.0. Use PostHogSDK.shared.getSessionId(), startSession() and endSession() instead. From 4.0, wrapper SDKs must import PostHog with @_spi(PostHogInternal) to use it.") - @objc public static var shared: PostHogSessionManager { + public static var shared: PostHogSessionManager { PostHogSDK.shared.sessionManager } @@ -75,8 +74,7 @@ import Foundation /// Use with care: changing the session ID affects analytics session attribution and session replay. /// /// - Parameter sessionId: Session ID to use for subsequent events. - @available(*, deprecated, message: "PostHogSessionManager becomes SDK-internal in PostHog 4.0. Use PostHogSDK.shared.getSessionId(), startSession() and endSession() instead. From 4.0, wrapper SDKs must import PostHog with @_spi(PostHogInternal) to use it.") - @objc public func setSessionId(_ sessionId: String) { + public func setSessionId(_ sessionId: String) { setSessionIdInternal(sessionId, at: now(), reason: .customSessionId) } diff --git a/PostHog/PostHogStorageManager.swift b/PostHog/PostHogStorageManager.swift index a18393a6b..25571844e 100644 --- a/PostHog/PostHogStorageManager.swift +++ b/PostHog/PostHogStorageManager.swift @@ -9,10 +9,10 @@ import Foundation /// Manages persisted identity metadata for a PostHog SDK instance. /// -/// - Warning: This class is public for backwards compatibility, but is intended for -/// SDK-internal use only. Application code should use `PostHogSDK` identity APIs +/// - Warning: For PostHog's wrapper SDKs only, which import it with +/// `@_spi(PostHogInternal)`. Application code should use `PostHogSDK` identity APIs /// instead of interacting with storage directly. -public class PostHogStorageManager { +@_spi(PostHogInternal) public class PostHogStorageManager { private let storage: PostHogStorage! private let anonLock = NSLock() diff --git a/PostHog/PostHogVersion.swift b/PostHog/PostHogVersion.swift index d9de02b22..16ce681a0 100644 --- a/PostHog/PostHogVersion.swift +++ b/PostHog/PostHogVersion.swift @@ -11,12 +11,12 @@ import Foundation /// Current SDK version string. /// /// - Warning: This is intended for SDK internals and integrations. Application code should not mutate it. -public var postHogVersion = "3.90.0" +@_spi(PostHogInternal) public var postHogVersion = "3.90.0" /// Default SDK name reported by the native iOS SDK. -public let postHogiOSSdkName = "posthog-ios" +let postHogiOSSdkName = "posthog-ios" /// SDK name included in captured event context. /// /// - Warning: This is intended for SDK internals and wrapper SDKs. Application code should not mutate it. -public var postHogSdkName = postHogiOSSdkName +@_spi(PostHogInternal) public var postHogSdkName = postHogiOSSdkName diff --git a/PostHog/Replay/Date+Util.swift b/PostHog/Replay/Date+Util.swift index 842425d4c..1492da527 100644 --- a/PostHog/Replay/Date+Util.swift +++ b/PostHog/Replay/Date+Util.swift @@ -17,7 +17,6 @@ extension Date { /// /// - Parameter date: Date to convert. /// - Returns: Milliseconds since 1970-01-01 00:00:00 UTC. -@available(*, deprecated, message: "dateToMillis(_:) becomes SDK-internal in PostHog 4.0. Use Int64(date.timeIntervalSince1970 * 1000) instead. From 4.0, wrapper SDKs must import PostHog with @_spi(PostHogInternal) to use it.") -public func dateToMillis(_ date: Date) -> Int64 { +@_spi(PostHogInternal) public func dateToMillis(_ date: Date) -> Int64 { date.toMillis() } diff --git a/PostHog/Replay/UIImage+Util.swift b/PostHog/Replay/UIImage+Util.swift index 1d4329006..1645348e9 100644 --- a/PostHog/Replay/UIImage+Util.swift +++ b/PostHog/Replay/UIImage+Util.swift @@ -37,8 +37,7 @@ /// - image: Image to encode. /// - compressionQuality: Compression quality from `0.0` to `1.0`. Defaults to `0.3`. /// - Returns: A `data:image/...;base64` string, or `nil` if encoding fails. - @available(*, deprecated, message: "imageToBase64(_:_:) becomes SDK-internal in PostHog 4.0. From 4.0, wrapper SDKs must import PostHog with @_spi(PostHogInternal) to use it.") - public func imageToBase64(_ image: UIImage, _ compressionQuality: CGFloat = 0.3) -> String? { + @_spi(PostHogInternal) public func imageToBase64(_ image: UIImage, _ compressionQuality: CGFloat = 0.3) -> String? { image.toBase64(compressionQuality) } #endif diff --git a/PostHog/Surveys/Utils/Survey+Util.swift b/PostHog/Surveys/Utils/Survey+Util.swift index 29459978d..f188d9447 100644 --- a/PostHog/Surveys/Utils/Survey+Util.swift +++ b/PostHog/Surveys/Utils/Survey+Util.swift @@ -30,7 +30,7 @@ // swiftlint:disable identifier_name /// Convenience helpers for creating and describing survey colors. - public extension UIColor { + extension UIColor { /** Creates an immutable UIColor instance specified by a hex string, CSS color name, or nil. @@ -71,7 +71,6 @@ - Returns: A new `String` with the color's hexadecimal value. */ - @available(*, deprecated, message: "UIColor.hexDescription(_:) is removed from the public API in PostHog 4.0.") func hexDescription(_ includeAlpha: Bool = false) -> String { guard cgColor.numberOfComponents == 4 else { return "Color not RGB." diff --git a/PostHog/Utils/Data+Gzip.swift b/PostHog/Utils/Data+Gzip.swift index ef88000e5..a2920bc6d 100644 --- a/PostHog/Utils/Data+Gzip.swift +++ b/PostHog/Utils/Data+Gzip.swift @@ -38,47 +38,47 @@ import Foundation #endif /// Namespace for gzip constants used by the SDK's compression helpers. -public enum Gzip { +enum Gzip { /// Maximum value for windowBits (`MAX_WBITS`). - public static let maxWindowBits = MAX_WBITS + static let maxWindowBits = MAX_WBITS } /// Compression level whose raw value is based on zlib constants. -public struct CompressionLevel: RawRepresentable, Sendable { +struct CompressionLevel: RawRepresentable, Sendable { /// Compression level in the range of `0` (no compression) to `9` (maximum compression). - public let rawValue: Int32 + let rawValue: Int32 /// zlib `Z_NO_COMPRESSION` level. - public static let noCompression = Self(Z_NO_COMPRESSION) + static let noCompression = Self(Z_NO_COMPRESSION) /// zlib `Z_BEST_SPEED` level. - public static let bestSpeed = Self(Z_BEST_SPEED) + static let bestSpeed = Self(Z_BEST_SPEED) /// zlib `Z_BEST_COMPRESSION` level. - public static let bestCompression = Self(Z_BEST_COMPRESSION) + static let bestCompression = Self(Z_BEST_COMPRESSION) /// zlib `Z_DEFAULT_COMPRESSION` level. - public static let defaultCompression = Self(Z_DEFAULT_COMPRESSION) + static let defaultCompression = Self(Z_DEFAULT_COMPRESSION) /// Creates a compression level from a zlib raw value. /// /// - Parameter rawValue: zlib compression level constant. - public init(rawValue: Int32) { + init(rawValue: Int32) { self.rawValue = rawValue } /// Creates a compression level from a zlib raw value. /// /// - Parameter rawValue: zlib compression level constant. - public init(_ rawValue: Int32) { + init(_ rawValue: Int32) { self.rawValue = rawValue } } /// Errors on gzipping/gunzipping based on the zlib error codes. -public struct GzipError: Swift.Error, Sendable { +struct GzipError: Swift.Error, Sendable { // cf. http://www.zlib.net/manual.html /// High-level zlib error category. - public enum Kind: Equatable, Sendable { + enum Kind: Equatable, Sendable { /// The stream structure was inconsistent. /// /// - Note: Underlying zlib error: `Z_STREAM_ERROR` (-2). @@ -112,10 +112,10 @@ public struct GzipError: Swift.Error, Sendable { } /// Error kind. - public let kind: Kind + let kind: Kind /// Returned message by zlib. - public let message: String + let message: String init(code: Int32, msg: UnsafePointer?) { message = msg.flatMap(String.init(validatingUTF8:)) ?? "Unknown gzip error" @@ -123,7 +123,7 @@ public struct GzipError: Swift.Error, Sendable { } /// Human-readable zlib error message. - public var localizedDescription: String { + var localizedDescription: String { message } } diff --git a/PostHog/Utils/DateUtils.swift b/PostHog/Utils/DateUtils.swift index c59b558f1..818996a2d 100644 --- a/PostHog/Utils/DateUtils.swift +++ b/PostHog/Utils/DateUtils.swift @@ -36,7 +36,7 @@ let apiDateFormatter = PostHogAPIDateFormatter() /// /// - Parameter date: Date to format. /// - Returns: An ISO-8601-like timestamp string with milliseconds. -public func toISO8601String(_ date: Date) -> String { +func toISO8601String(_ date: Date) -> String { apiDateFormatter.string(from: date) } @@ -44,7 +44,7 @@ public func toISO8601String(_ date: Date) -> String { /// /// - Parameter date: Timestamp string with optional milliseconds. /// - Returns: A parsed `Date`, or `nil` when the string is invalid. -public func toISO8601Date(_ date: String) -> Date? { +func toISO8601Date(_ date: String) -> Date? { apiDateFormatter.date(from: date) } diff --git a/PostHog/Utils/DictUtils.swift b/PostHog/Utils/DictUtils.swift index 61ab6834f..66a893632 100644 --- a/PostHog/Utils/DictUtils.swift +++ b/PostHog/Utils/DictUtils.swift @@ -45,7 +45,7 @@ func fromJSONData(_ data: Data, options: JSONSerialization.ReadingOptions = []) /// /// - Parameter dict: Dictionary to sanitize. /// - Returns: A sanitized dictionary, or `nil` when the input is `nil` or empty. -public func sanitizeDictionary(_ dict: [String: Any]?) -> [String: Any]? { +func sanitizeDictionary(_ dict: [String: Any]?) -> [String: Any]? { if dict == nil || dict!.isEmpty { return nil } diff --git a/PostHog/Utils/FileUtils.swift b/PostHog/Utils/FileUtils.swift index dcc7bb1f5..abbe3a67b 100644 --- a/PostHog/Utils/FileUtils.swift +++ b/PostHog/Utils/FileUtils.swift @@ -10,7 +10,7 @@ import Foundation /// Deletes a file if it exists, logging and ignoring any removal error. /// /// - Parameter file: File URL to delete. -public func deleteSafely(_ file: URL) { +func deleteSafely(_ file: URL) { if FileManager.default.fileExists(atPath: file.path) { do { try FileManager.default.removeItem(at: file) diff --git a/PostHog/Utils/Reachability.swift b/PostHog/Utils/Reachability.swift index 19d66b9c5..65516a394 100644 --- a/PostHog/Utils/Reachability.swift +++ b/PostHog/Utils/Reachability.swift @@ -31,7 +31,7 @@ import Foundation import SystemConfiguration /// Errors thrown while creating or configuring reachability monitoring. - public enum ReachabilityError: Error { + enum ReachabilityError: Error { /// Failed to create reachability with a socket address. /// /// - Parameters: diff --git a/PostHogExample/SessionRecordingView.swift b/PostHogExample/SessionRecordingView.swift index ba7e5b8df..fdfb641d7 100644 --- a/PostHogExample/SessionRecordingView.swift +++ b/PostHogExample/SessionRecordingView.swift @@ -52,8 +52,9 @@ struct SessionRecordingView: View { Section("Event Trigger") { Button { PostHogSDK.shared.stopSessionRecording() + PostHogSDK.shared.endSession() + PostHogSDK.shared.startSession() PostHogSDK.shared.startSessionRecording() - PostHogSessionManager.shared.setSessionId(UUID().uuidString) refreshStatus() } label: { Text("Restart & Rotate Session Id") diff --git a/PostHogTests/PostHogContextTest.swift b/PostHogTests/PostHogContextTest.swift index 98fb9b46c..255decefd 100644 --- a/PostHogTests/PostHogContextTest.swift +++ b/PostHogTests/PostHogContextTest.swift @@ -7,7 +7,7 @@ import Foundation import Nimble -@testable import PostHog +@_spi(PostHogInternal) @testable import PostHog import Quick class PostHogContextTest: QuickSpec { diff --git a/PostHogTests/PostHogDeviceBucketingTests.swift b/PostHogTests/PostHogDeviceBucketingTests.swift index 681593c03..da8d55138 100644 --- a/PostHogTests/PostHogDeviceBucketingTests.swift +++ b/PostHogTests/PostHogDeviceBucketingTests.swift @@ -6,7 +6,7 @@ // import Foundation -@testable import PostHog +@_spi(PostHogInternal) @testable import PostHog import Testing import XCTest diff --git a/PostHogTests/PostHogEventSnapshotTests.swift b/PostHogTests/PostHogEventSnapshotTests.swift index b9d55b5ee..600b5902e 100644 --- a/PostHogTests/PostHogEventSnapshotTests.swift +++ b/PostHogTests/PostHogEventSnapshotTests.swift @@ -1,5 +1,5 @@ import Foundation -@testable import PostHog +@_spi(PostHogInternal) @testable import PostHog import Testing import XCTest diff --git a/PostHogTests/PostHogIdentityTests.swift b/PostHogTests/PostHogIdentityTests.swift index a8d8ff1a6..cfb4697d9 100644 --- a/PostHogTests/PostHogIdentityTests.swift +++ b/PostHogTests/PostHogIdentityTests.swift @@ -6,7 +6,7 @@ // import Foundation -@testable import PostHog +@_spi(PostHogInternal) @testable import PostHog import Testing @Suite("Identity tests", .serialized) diff --git a/PostHogTests/PostHogLogsQueueTest.swift b/PostHogTests/PostHogLogsQueueTest.swift index 7e18b5131..bac6397ad 100644 --- a/PostHogTests/PostHogLogsQueueTest.swift +++ b/PostHogTests/PostHogLogsQueueTest.swift @@ -6,7 +6,7 @@ import Foundation import OHHTTPStubs import OHHTTPStubsSwift -@testable import PostHog +@_spi(PostHogInternal) @testable import PostHog import Testing import XCTest diff --git a/PostHogTests/PostHogMemoryExceptionReporterTest.swift b/PostHogTests/PostHogMemoryExceptionReporterTest.swift index b723b9c28..140291186 100644 --- a/PostHogTests/PostHogMemoryExceptionReporterTest.swift +++ b/PostHogTests/PostHogMemoryExceptionReporterTest.swift @@ -1,5 +1,5 @@ import Foundation -@testable import PostHog +@_spi(PostHogInternal) @testable import PostHog import Testing #if os(iOS) && !targetEnvironment(macCatalyst) && compiler(>=6.4) diff --git a/PostHogTests/PostHogRemoteConfigTest.swift b/PostHogTests/PostHogRemoteConfigTest.swift index d8e623761..1810c894a 100644 --- a/PostHogTests/PostHogRemoteConfigTest.swift +++ b/PostHogTests/PostHogRemoteConfigTest.swift @@ -5,7 +5,7 @@ // Created by Yiannis Josephides on 20/01/2025. // -@testable import PostHog +@_spi(PostHogInternal) @testable import PostHog import Testing import XCTest diff --git a/PostHogTests/PostHogSDKTest.swift b/PostHogTests/PostHogSDKTest.swift index 05f2889d1..de7b2562d 100644 --- a/PostHogTests/PostHogSDKTest.swift +++ b/PostHogTests/PostHogSDKTest.swift @@ -7,7 +7,7 @@ import Foundation import Nimble -@testable import PostHog +@_spi(PostHogInternal) @testable import PostHog #if SWIFT_PACKAGE import PostHogTestsObjC #endif diff --git a/PostHogTests/PostHogSamplingTest.swift b/PostHogTests/PostHogSamplingTest.swift index da826916f..c7614409b 100644 --- a/PostHogTests/PostHogSamplingTest.swift +++ b/PostHogTests/PostHogSamplingTest.swift @@ -1,5 +1,5 @@ import Foundation -@testable import PostHog +@_spi(PostHogInternal) @testable import PostHog import Testing @Suite("Session Replay Sampling Tests") diff --git a/PostHogTests/PostHogSessionManagerTest.swift b/PostHogTests/PostHogSessionManagerTest.swift index 68511d05b..c8f0c5fd5 100644 --- a/PostHogTests/PostHogSessionManagerTest.swift +++ b/PostHogTests/PostHogSessionManagerTest.swift @@ -6,7 +6,7 @@ // import Foundation -@testable import PostHog +@_spi(PostHogInternal) @testable import PostHog import Testing @Suite(.serialized, .resetsGlobalState) diff --git a/PostHogTests/PostHogSessionReplayEventTriggersTest.swift b/PostHogTests/PostHogSessionReplayEventTriggersTest.swift index 6f6aebc90..365eaf22a 100644 --- a/PostHogTests/PostHogSessionReplayEventTriggersTest.swift +++ b/PostHogTests/PostHogSessionReplayEventTriggersTest.swift @@ -1,6 +1,6 @@ #if os(iOS) import Foundation - @testable import PostHog + @_spi(PostHogInternal) @testable import PostHog import Testing @Suite("Session Replay Event Triggers", .serialized) diff --git a/PostHogTests/PostHogSessionReplayManualModeTest.swift b/PostHogTests/PostHogSessionReplayManualModeTest.swift index de56f37f9..86290a346 100644 --- a/PostHogTests/PostHogSessionReplayManualModeTest.swift +++ b/PostHogTests/PostHogSessionReplayManualModeTest.swift @@ -1,6 +1,6 @@ #if os(iOS) import Foundation - @testable import PostHog + @_spi(PostHogInternal) @testable import PostHog import Testing @Suite("Session Replay Manual Mode", .serialized) diff --git a/PostHogTests/PostHogSessionReplayPluginTest.swift b/PostHogTests/PostHogSessionReplayPluginTest.swift index d877a244b..a4741aff8 100644 --- a/PostHogTests/PostHogSessionReplayPluginTest.swift +++ b/PostHogTests/PostHogSessionReplayPluginTest.swift @@ -1,6 +1,6 @@ #if os(iOS) import Foundation - @testable import PostHog + @_spi(PostHogInternal) @testable import PostHog #if !SWIFT_PACKAGE import CwlCatchException #endif diff --git a/PostHogTests/PostHogStorageManagerTest.swift b/PostHogTests/PostHogStorageManagerTest.swift index b436e3ad8..63d58fa96 100644 --- a/PostHogTests/PostHogStorageManagerTest.swift +++ b/PostHogTests/PostHogStorageManagerTest.swift @@ -7,7 +7,7 @@ import Foundation import Nimble -@testable import PostHog +@_spi(PostHogInternal) @testable import PostHog import Quick class PostHogStorageManagerTest: QuickSpec { diff --git a/PostHogTests/PostHogSurveyEventsTest.swift b/PostHogTests/PostHogSurveyEventsTest.swift index 03c2e807a..227766fb7 100644 --- a/PostHogTests/PostHogSurveyEventsTest.swift +++ b/PostHogTests/PostHogSurveyEventsTest.swift @@ -6,7 +6,7 @@ // import Foundation -@testable import PostHog +@_spi(PostHogInternal) @testable import PostHog import Testing @Suite("Test Survey Events", .serialized) diff --git a/PostHogTests/TestUtils/TestPostHog.swift b/PostHogTests/TestUtils/TestPostHog.swift index b4e812011..3969f5443 100644 --- a/PostHogTests/TestUtils/TestPostHog.swift +++ b/PostHogTests/TestUtils/TestPostHog.swift @@ -7,7 +7,7 @@ import Foundation import Nimble -@testable import PostHog +@_spi(PostHogInternal) @testable import PostHog import Quick import Testing import XCTest diff --git a/api/posthog-ios.public-api.txt b/api/posthog-ios.public-api.txt index abc154384..550e306fc 100644 --- a/api/posthog-ios.public-api.txt +++ b/api/posthog-ios.public-api.txt @@ -9,27 +9,6 @@ PostHog | BoxedBeforeSendBlock.init(block:) | init | @objc(block:) init(block: @ PostHog | BoxedBeforeSendLogBlock | class | @objc final class BoxedBeforeSendLogBlock | c:@M@PostHog@objc(cs)BoxedBeforeSendLogBlock PostHog | BoxedBeforeSendLogBlock.block | property | @objc let block: PostHogBeforeSendLogBlock | c:@M@PostHog@objc(cs)BoxedBeforeSendLogBlock(py)block PostHog | BoxedBeforeSendLogBlock.init(block:) | init | @objc(block:) init(block: @escaping PostHogBeforeSendLogBlock) | c:@M@PostHog@objc(cs)BoxedBeforeSendLogBlock(im)block: -PostHog | CompressionLevel | struct | struct CompressionLevel | s:7PostHog16CompressionLevelV -PostHog | CompressionLevel.bestCompression | type.property | static let bestCompression: CompressionLevel | s:7PostHog16CompressionLevelV04bestC0ACvpZ -PostHog | CompressionLevel.bestSpeed | type.property | static let bestSpeed: CompressionLevel | s:7PostHog16CompressionLevelV9bestSpeedACvpZ -PostHog | CompressionLevel.defaultCompression | type.property | static let defaultCompression: CompressionLevel | s:7PostHog16CompressionLevelV07defaultC0ACvpZ -PostHog | CompressionLevel.init(_:) | init | init(_ rawValue: Int32) | s:7PostHog16CompressionLevelVyACs5Int32Vcfc -PostHog | CompressionLevel.init(rawValue:) | init | init(rawValue: Int32) | s:7PostHog16CompressionLevelV8rawValueACs5Int32V_tcfc -PostHog | CompressionLevel.noCompression | type.property | static let noCompression: CompressionLevel | s:7PostHog16CompressionLevelV02noC0ACvpZ -PostHog | CompressionLevel.rawValue | property | let rawValue: Int32 | s:7PostHog16CompressionLevelV8rawValues5Int32Vvp -PostHog | Gzip | enum | enum Gzip | s:7PostHog4GzipO -PostHog | Gzip.maxWindowBits | type.property | static let maxWindowBits: Int32 | s:7PostHog4GzipO13maxWindowBitss5Int32VvpZ -PostHog | GzipError | struct | struct GzipError | s:7PostHog9GzipErrorV -PostHog | GzipError.Kind | enum | enum Kind | s:7PostHog9GzipErrorV4KindO -PostHog | GzipError.Kind.buffer | enum.case | case buffer | s:7PostHog9GzipErrorV4KindO6bufferyA2EmF -PostHog | GzipError.Kind.data | enum.case | case data | s:7PostHog9GzipErrorV4KindO4datayA2EmF -PostHog | GzipError.Kind.memory | enum.case | case memory | s:7PostHog9GzipErrorV4KindO6memoryyA2EmF -PostHog | GzipError.Kind.stream | enum.case | case stream | s:7PostHog9GzipErrorV4KindO6streamyA2EmF -PostHog | GzipError.Kind.unknown(code:) | enum.case | case unknown(code: Int) | s:7PostHog9GzipErrorV4KindO7unknownyAESi_tcAEmF -PostHog | GzipError.Kind.version | enum.case | case version | s:7PostHog9GzipErrorV4KindO7versionyA2EmF -PostHog | GzipError.kind | property | let kind: GzipError.Kind | s:7PostHog9GzipErrorV4kindAC4KindOvp -PostHog | GzipError.localizedDescription | property | var localizedDescription: String { get } | s:7PostHog9GzipErrorV20localizedDescriptionSSvp -PostHog | GzipError.message | property | let message: String | s:7PostHog9GzipErrorV7messageSSvp PostHog | OnPostHogSurveyClosed | typealias | typealias OnPostHogSurveyClosed = (PostHogDisplaySurvey) -> Void | s:7PostHog02OnaB12SurveyCloseda PostHog | OnPostHogSurveyResponse | typealias | typealias OnPostHogSurveyResponse = (PostHogDisplaySurvey, Int, PostHogSurveyResponse) -> PostHogNextSurveyQuestion? | s:7PostHog02OnaB14SurveyResponsea PostHog | OnPostHogSurveyShown | typealias | typealias OnPostHogSurveyShown = (PostHogDisplaySurvey) -> Void | s:7PostHog02OnaB11SurveyShowna @@ -97,8 +76,6 @@ PostHog | PostHogConfig.setBeforeSend(_:) | method | @objc func setBeforeSend(_ PostHog | PostHogConfig.setBeforeSend(_:) | method | func setBeforeSend(_ blocks: BeforeSendBlock...) | s:7PostHog0aB6ConfigC13setBeforeSendyyAA0aB5EventCSgAFcd_tF PostHog | PostHogConfig.setBeforeSend(_:) | method | func setBeforeSend(_ blocks: [BeforeSendBlock]) | s:7PostHog0aB6ConfigC13setBeforeSendyySayAA0aB5EventCSgAFcGF PostHog | PostHogConfig.setDefaultPersonProperties | property | @objc var setDefaultPersonProperties: Bool | c:@M@PostHog@objc(cs)PostHogConfig(py)setDefaultPersonProperties -PostHog | PostHogConfig.snapshotEndpoint | property | @objc var snapshotEndpoint: String | c:@M@PostHog@objc(cs)PostHogConfig(py)snapshotEndpoint -PostHog | PostHogConfig.storageManager | property | var storageManager: PostHogStorageManager? | s:7PostHog0aB6ConfigC14storageManagerAA0ab7StorageE0CSgvp PostHog | PostHogConfig.surveys | property | @objc var surveys: Bool { get set } | c:@M@PostHog@objc(cs)PostHogConfig(py)surveys PostHog | PostHogConfig.surveysConfig | property | @objc var surveysConfig: PostHogSurveysConfig { get set } | c:@M@PostHog@objc(cs)PostHogConfig(py)surveysConfig PostHog | PostHogConfig.tracingHeaders | property | @objc var tracingHeaders: [String]? | c:@M@PostHog@objc(cs)PostHogConfig(py)tracingHeaders @@ -359,9 +336,6 @@ PostHog | PostHogSDK.stopSessionRecording() | method | @objc func stopSessionRec PostHog | PostHogSDK.unregister(_:) | method | @objc(unregisterProperties:) func unregister(_ key: String) | c:@M@PostHog@objc(cs)PostHogSDK(im)unregisterProperties: PostHog | PostHogSDK.unregisterPushNotificationToken() | method | @objc func unregisterPushNotificationToken() | c:@M@PostHog@objc(cs)PostHogSDK(im)unregisterPushNotificationToken PostHog | PostHogSDK.with(_:) | type.method | @objc static func with(_ config: PostHogConfig) -> PostHogSDK | c:@M@PostHog@objc(cs)PostHogSDK(cm)with: -PostHog | PostHogSessionManager | class | @objc class PostHogSessionManager | c:@M@PostHog@objc(cs)PostHogSessionManager -PostHog | PostHogSessionManager.setSessionId(_:) | method | @objc func setSessionId(_ sessionId: String) | c:@M@PostHog@objc(cs)PostHogSessionManager(im)setSessionId: -PostHog | PostHogSessionManager.shared | type.property | @objc static var shared: PostHogSessionManager { get } | c:@M@PostHog@objc(cs)PostHogSessionManager(cpy)shared PostHog | PostHogSessionReplayConfig | class | @objc(PostHogSessionReplayConfig) class PostHogSessionReplayConfig | c:@M@PostHog@objc(cs)PostHogSessionReplayConfig PostHog | PostHogSessionReplayConfig.captureLogs | property | @objc var captureLogs: Bool | c:@M@PostHog@objc(cs)PostHogSessionReplayConfig(py)captureLogs PostHog | PostHogSessionReplayConfig.captureLogsConfig | property | @objc var captureLogsConfig: PostHogSessionReplayConsoleLogConfig | c:@M@PostHog@objc(cs)PostHogSessionReplayConfig(py)captureLogsConfig @@ -377,17 +351,6 @@ PostHog | PostHogSessionReplayConfig.throttleDelay | property | @objc var thrott PostHog | PostHogSessionReplayConsoleLogConfig | class | @objc class PostHogSessionReplayConsoleLogConfig | c:@M@PostHog@objc(cs)PostHogSessionReplayConsoleLogConfig PostHog | PostHogSessionReplayConsoleLogConfig.logSanitizer | property | @objc var logSanitizer: (String) -> PostHogLogEntry? | c:@M@PostHog@objc(cs)PostHogSessionReplayConsoleLogConfig(py)logSanitizer PostHog | PostHogSessionReplayConsoleLogConfig.minLogLevel | property | @objc var minLogLevel: PostHogLogLevel | c:@M@PostHog@objc(cs)PostHogSessionReplayConsoleLogConfig(py)minLogLevel -PostHog | PostHogStorageManager | class | class PostHogStorageManager | s:7PostHog0aB14StorageManagerC -PostHog | PostHogStorageManager.getAnonymousId() | method | func getAnonymousId() -> String | s:7PostHog0aB14StorageManagerC14getAnonymousIdSSyF -PostHog | PostHogStorageManager.getDeviceId() | method | func getDeviceId() -> String | s:7PostHog0aB14StorageManagerC11getDeviceIdSSyF -PostHog | PostHogStorageManager.getDistinctId() | method | func getDistinctId() -> String | s:7PostHog0aB14StorageManagerC13getDistinctIdSSyF -PostHog | PostHogStorageManager.isIdentified() | method | func isIdentified() -> Bool | s:7PostHog0aB14StorageManagerC12isIdentifiedSbyF -PostHog | PostHogStorageManager.isPersonProcessing() | method | func isPersonProcessing() -> Bool | s:7PostHog0aB14StorageManagerC18isPersonProcessingSbyF -PostHog | PostHogStorageManager.reset(keepAnonymousId:_:) | method | func reset(keepAnonymousId: Bool = false, _ resetStorage: Bool = false) | s:7PostHog0aB14StorageManagerC5reset15keepAnonymousId_ySb_SbtF -PostHog | PostHogStorageManager.setAnonymousId(_:) | method | func setAnonymousId(_ id: String) | s:7PostHog0aB14StorageManagerC14setAnonymousIdyySSF -PostHog | PostHogStorageManager.setDistinctId(_:) | method | func setDistinctId(_ id: String) | s:7PostHog0aB14StorageManagerC13setDistinctIdyySSF -PostHog | PostHogStorageManager.setIdentified(_:) | method | func setIdentified(_ isIdentified: Bool) | s:7PostHog0aB14StorageManagerC13setIdentifiedyySbF -PostHog | PostHogStorageManager.setPersonProcessing(_:) | method | func setPersonProcessing(_ enable: Bool) | s:7PostHog0aB14StorageManagerC19setPersonProcessingyySbF PostHog | PostHogSurveyResponse | class | @objc @objcMembers class PostHogSurveyResponse | c:@M@PostHog@objc(cs)PostHogSurveyResponse PostHog | PostHogSurveyResponse.link(_:) | type.method | static func link(_ clicked: Bool) -> PostHogSurveyResponse | c:@M@PostHog@objc(cs)PostHogSurveyResponse(cm)link: PostHog | PostHogSurveyResponse.linkClicked | property | let linkClicked: Bool? | s:7PostHog0aB14SurveyResponseC11linkClickedSbSgvp @@ -414,14 +377,6 @@ PostHog | PostHogSurveysDelegate.cleanupSurveys() | method | @objc func cleanupS PostHog | PostHogSurveysDelegate.renderSurvey(_:onSurveyShown:onSurveyResponse:onSurveyClosed:) | method | @objc func renderSurvey(_ survey: PostHogDisplaySurvey, onSurveyShown: @escaping OnPostHogSurveyShown, onSurveyResponse: @escaping OnPostHogSurveyResponse, onSurveyClosed: @escaping OnPostHogSurveyClosed) | c:@M@PostHog@objc(pl)PostHogSurveysDelegate(im)renderSurvey:onSurveyShown:onSurveyResponse:onSurveyClosed: PostHog | PostHogSurveysDelegate.supportsSurveyResume | property | @objc optional var supportsSurveyResume: Bool { get } | c:@M@PostHog@objc(pl)PostHogSurveysDelegate(py)supportsSurveyResume PostHog | PostHogSurveysDelegate.updateSurvey(_:) | method | @objc optional func updateSurvey(_ survey: PostHogDisplaySurvey) | c:@M@PostHog@objc(pl)PostHogSurveysDelegate(im)updateSurvey: -PostHog | ReachabilityError | enum | enum ReachabilityError | s:7PostHog17ReachabilityErrorO -PostHog | ReachabilityError.failedToCreateWithAddress(_:_:) | enum.case | case failedToCreateWithAddress(sockaddr, Int32) | s:7PostHog17ReachabilityErrorO25failedToCreateWithAddressyACSo8sockaddrV_s5Int32VtcACmF -PostHog | ReachabilityError.failedToCreateWithHostname(_:_:) | enum.case | case failedToCreateWithHostname(String, Int32) | s:7PostHog17ReachabilityErrorO26failedToCreateWithHostnameyACSS_s5Int32VtcACmF -PostHog | ReachabilityError.unableToGetFlags(_:) | enum.case | case unableToGetFlags(Int32) | s:7PostHog17ReachabilityErrorO16unableToGetFlagsyACs5Int32VcACmF -PostHog | ReachabilityError.unableToSetCallback(_:) | enum.case | case unableToSetCallback(Int32) | s:7PostHog17ReachabilityErrorO19unableToSetCallbackyACs5Int32VcACmF -PostHog | ReachabilityError.unableToSetDispatchQueue(_:) | enum.case | case unableToSetDispatchQueue(Int32) | s:7PostHog17ReachabilityErrorO24unableToSetDispatchQueueyACs5Int32VcACmF -PostHog | UIColor.hexDescription(_:) | method | func hexDescription(_ includeAlpha: Bool = false) -> String | s:So7UIColorC7PostHogE14hexDescriptionySSSbF -PostHog | UIColor.init(hex:) | init | convenience init(hex: String?) | s:So7UIColorC7PostHogE3hexABSSSg_tcfc PostHog | UIView.postHogLabel | property | @MainActor var postHogLabel: String? { get set } | s:So6UIViewC7PostHogE04postC5LabelSSSgvp PostHog | URLSession.postHogData(for:delegate:postHog:) | method | func postHogData(for request: URLRequest, delegate: (any URLSessionTaskDelegate)? = nil, postHog: PostHogSDK? = nil) async throws -> (Data, URLResponse) | s:So12NSURLSessionC7PostHogE04postC4Data3for8delegate0dC010Foundation0E0V_So13NSURLResponseCtAH10URLRequestV_So0A12TaskDelegate_pSgAC0bC3SDKCSgtYaKF PostHog | URLSession.postHogData(for:postHog:) | method | func postHogData(for request: URLRequest, postHog: PostHogSDK? = nil) async throws -> (Data, URLResponse) | s:So12NSURLSessionC7PostHogE04postC4Data3for0dC010Foundation0E0V_So13NSURLResponseCtAG10URLRequestV_AC0bC3SDKCSgtYaKF @@ -448,12 +403,3 @@ PostHog | View.postHogScreenView(_:_:postHog:) | method | @MainActor func postHo | s:7SwiftUI4ViewP7PostHogE04poste6ScreenC0__0fE0QrSSSg_SDySSypGSgAD0dE3SDKCSgtF PostHog | View.postHogViewSeen(_:_:postHog:) | method | @MainActor func postHogViewSeen(_ event: String, _ properties: [String : Any]? = nil, postHog: PostHogSDK? = nil) -> some View | s:7SwiftUI4ViewP7PostHogE04posteC4Seen__0fE0QrSS_SDySSypGSgAD0dE3SDKCSgtF -PostHog | dateToMillis(_:) | func | func dateToMillis(_ date: Date) -> Int64 | s:7PostHog12dateToMillisys5Int64V10Foundation4DateVF -PostHog | deleteSafely(_:) | func | func deleteSafely(_ file: URL) | s:7PostHog12deleteSafelyyy10Foundation3URLVF -PostHog | imageToBase64(_:_:) | func | func imageToBase64(_ image: UIImage, _ compressionQuality: CGFloat = 0.3) -> String? | s:7PostHog13imageToBase64ySSSgSo7UIImageC_14CoreFoundation7CGFloatVtF -PostHog | postHogSdkName | var | var postHogSdkName: String | s:7PostHog04postB7SdkNameSSvp -PostHog | postHogVersion | var | var postHogVersion: String | s:7PostHog04postB7VersionSSvp -PostHog | postHogiOSSdkName | var | let postHogiOSSdkName: String | s:7PostHog17postHogiOSSdkNameSSvp -PostHog | sanitizeDictionary(_:) | func | func sanitizeDictionary(_ dict: [String : Any]?) -> [String : Any]? | s:7PostHog18sanitizeDictionaryySDySSypGSgADF -PostHog | toISO8601Date(_:) | func | func toISO8601Date(_ date: String) -> Date? | s:7PostHog13toISO8601Datey10Foundation0E0VSgSSF -PostHog | toISO8601String(_:) | func | func toISO8601String(_ date: Date) -> String | s:7PostHog15toISO8601StringySS10Foundation4DateVF diff --git a/sdk_compliance_adapter/Sources/main.swift b/sdk_compliance_adapter/Sources/main.swift index b74766ad1..40780cfdf 100644 --- a/sdk_compliance_adapter/Sources/main.swift +++ b/sdk_compliance_adapter/Sources/main.swift @@ -1,5 +1,5 @@ import Foundation -import PostHog +@_spi(PostHogInternal) import PostHog import Vapor // Redirect all SDK on-disk storage into a private sandbox this adapter fully owns, so a @@ -50,7 +50,7 @@ app.middleware.use(RouteLoggingMiddleware()) // Health endpoint app.get("health") { req async throws -> Response in let health: [String: Any] = [ - "sdk_name": postHogiOSSdkName, + "sdk_name": postHogSdkName, "sdk_version": postHogVersion, "adapter_version": "1.0.0", // Declares which test suites apply. The iOS SDK posts events to /batch