Repository navigation
chore!: iOS Major Release 4.0 #873
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
Open
turnipdabeets
wants to merge
17
commits into
main
Choose a base branch
from
chore/v4-remove-deprecated
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+5,331
−6,211
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
96bafce
chore!: remove deprecated public APIs for v4
turnipdabeets ad6294a
docs: add Objective-C migration steps to the deprecated-API removal c…
turnipdabeets fd61c08
chore!: raise minimum iOS deployment target to 15 (#876)
turnipdabeets 98c8850
chore!: hide wrapper-only APIs behind SPI for v4 (#874)
turnipdabeets 6e5f0c7
chore!: remove PostHogDataMode.cellular for v4 (#890)
turnipdabeets 248b360
chore!: require Xcode 26 (swift-tools-version 6.2) (#898)
turnipdabeets c7a4181
chore!: raise minimum macOS to 11, tvOS to 15 and watchOS to 10 (#906)
turnipdabeets bb7db84
chore!: rename console log types to PostHogConsoleLog* for v4 (#912)
turnipdabeets 44bbc3a
chore!: remove the v2 legacy queue migration for v4 (#875)
turnipdabeets f01aafb
chore: update text and names left stale by the 4.0 changes (#910)
turnipdabeets fe934c5
chore!: drop legacy version and build from lifecycle events (#905)
turnipdabeets 078395c
chore!: pass the reload result to reloadFeatureFlags' callback (#913)
turnipdabeets 34b9735
chore!: return nil for malformed feature flag payloads (#903)
turnipdabeets f348446
chore!: replace vendored Reachability with NWPathMonitor (#909)
turnipdabeets 7bb79ca
feat: add SessionReplay and CrashReporting package traits (#916)
turnipdabeets 97a0017
chore!: remove wireframe session replay capture (#907)
turnipdabeets 95624b0
chore!: remove experimental screenshotModeBackgroundCapture (#937)
turnipdabeets File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'posthog-ios': patch | ||
| --- | ||
|
|
||
| Fix `errorTrackingConfig.ignoredExceptionTypes` not applying to manually captured exceptions on watchOS and visionOS. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'posthog-ios': minor | ||
| --- | ||
|
|
||
| Add `SessionReplay` and `CrashReporting` Swift package traits (on by default) so SwiftPM apps can leave out session replay with the vendored libwebp, and the vendored PLCrashReporter, with `traits: []`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'posthog-ios': minor | ||
| --- | ||
|
|
||
| Add a `Surveys` Swift package trait (on by default) so SwiftPM apps that don't use surveys can leave out the survey engine and UI. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'posthog-ios': major | ||
| --- | ||
|
|
||
| **Breaking:** return `nil` instead of the raw string for a malformed, empty or whitespace-only feature flag payload from `getFeatureFlagResult(_:)` and `getAllFeatureFlags()`. If you read a malformed payload as a `String`, fix the payload JSON in PostHog. String payloads passed to `PostHogBootstrapConfig.featureFlagPayloads` are no longer JSON-decoded a second time, so a bootstrapped `"123"` stays a `String`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'posthog-ios': major | ||
| --- | ||
|
|
||
| **Breaking:** raise the minimum iOS deployment target from 13.0 to 15.0. Mac Catalyst follows iOS. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'posthog-ios': major | ||
| --- | ||
|
|
||
| Network reachability now uses `NWPathMonitor` instead of the deprecated `SCNetworkReachability` API. `dataMode = .wifi` still counts any connection that isn't cellular as Wi-Fi, including wired. Some edge cases change. A path that needs a connection now counts as reachable, even when it needs user action (e.g. a VPN waiting for a password). With cellular data turned off for the app, queues now pause instead of sending requests that fail. If no path has arrived in the first 100 ms after setup, `.any` sends and `.wifi` waits for the first path, and events captured in that window leave out `$network_wifi` and `$network_cellular`. The unavailable `ReachabilityChangedNotification` global is removed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'posthog-ios': major | ||
| --- | ||
|
|
||
| **Breaking:** raise the minimum deployment targets to macOS 11.0 (from 10.15), tvOS 15.0 (from 13.0) and watchOS 10.0 (from 6.0). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| 'posthog-ios': major | ||
| --- | ||
|
|
||
| **Breaking:** `reloadFeatureFlags(_:)` now passes a `PostHogFeatureFlagsLoaded` to its callback, so you can tell whether the reload failed. | ||
|
|
||
| `errorsLoading` is `true` when the request failed or the SDK isn't set up, and `flags` and `variants` then hold the last known values. Update closures from `{ ... }` to `{ result in ... }` (or `{ _ in ... }`). In Objective-C, the block now takes a `PostHogFeatureFlagsLoaded *` argument. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'posthog-ios': major | ||
| --- | ||
|
|
||
| **Breaking:** remove `PostHogDataMode.cellular`. It always behaved the same as `.any`, so use `.any` instead (`PostHogDataModeAny` in Objective-C). Flushing behavior is unchanged. `.wifi` and `.any` keep their raw values 0 and 2; `PostHogDataMode(rawValue: 1)` now returns `nil`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| --- | ||
| 'posthog-ios': major | ||
| --- | ||
|
|
||
| **Breaking:** remove deprecated APIs. | ||
|
|
||
| - `PostHogConfig.apiKey`, `PostHogConfig(apiKey:)` and `PostHogConfig(apiKey:host:)`: use `projectToken`, `PostHogConfig(projectToken:)` and `PostHogConfig(projectToken:host:)`. | ||
| - `PostHogConfig.propertiesSanitizer` and the `PostHogPropertiesSanitizer` protocol: use `PostHogConfig.setBeforeSend(_:)`. | ||
| - `PostHogConfig.evaluationEnvironments`: use `evaluationContexts`. | ||
| - `PostHogConfig.remoteConfig`: delete the assignment. Remote config is always loaded. | ||
| - `PostHogSDK.getFeatureFlagPayload(_:)`: use `getFeatureFlagResult(_:)?.payload`. Pass `sendFeatureFlagEvent: false` to keep the old behavior of not capturing `$feature_flag_called`. | ||
| - `PostHogSessionReplayConfig.debouncerDelay`: use `throttleDelay`. | ||
| - `PostHogSessionReplayConfig.maskPhotoLibraryImages`: delete the assignment. It had no effect. | ||
|
|
||
| In Objective-C: | ||
|
|
||
| - `[[PostHogConfig alloc] apiKey:]` and `apiKey:host:`: use `projectToken:` and `projectToken:host:`. | ||
| - `[sdk getFeatureFlagPayload:key]`: use `[sdk getFeatureFlagResultWithKey:key sendFeatureFlagEvent:NO].payload`. | ||
| - `config.propertiesSanitizer`: use `[config setBeforeSend:@[...]]` with `BoxedBeforeSendBlock`s. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| 'posthog-ios': major | ||
| --- | ||
|
|
||
| **Breaking:** remove the migration of the event queue written by SDK 2.x (`posthog.queue.plist`). | ||
|
|
||
| Events still queued on disk by a 2.x SDK are deleted instead of sent when the app updates straight from 2.x to 4.0. Distinct ID, anonymous ID, groups and cached feature flags are still carried over. Events created by a 3.x SDK are not affected. | ||
|
|
||
| Queued events are no longer read in the 2.x format: a top-level `$set` and `message_id` are ignored. This includes 2.x events that 3.x imported and had not sent yet when the app updated to 4.0. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'posthog-ios': major | ||
| --- | ||
|
|
||
| **Breaking:** remove `version` and `build` from `Application Installed`, `Application Updated` and `Application Opened` events. Use `$app_version` and `$app_build` in insights and filters instead. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| --- | ||
| 'posthog-ios': major | ||
| --- | ||
|
|
||
| **Breaking:** remove wireframe session replay capture. Session replay now always records masked screenshots. | ||
|
|
||
| - Apps that didn't set `screenshotMode` now upload screenshots instead of wireframes, which uses more bandwidth and CPU per captured frame. | ||
| - Masking covers text, inputs, images and web views. Custom-drawn content (custom `draw(_:)` views, maps, video, charts) is now visible in recordings: wrap anything sensitive in `postHogMask()` or tag it `ph-no-capture`. | ||
| - Apps whose window root is a SwiftUI view, which previously recorded nothing, now record sessions. | ||
| - `PostHogSessionReplayConfig.screenshotMode` is deprecated and has no effect: delete the assignment. Setting it to `false` no longer prevents screenshots; use the masking options instead. | ||
| - The replay screen name now names the visible screen (SwiftUI screens report their view name), and is also sent when `screenshotMode` was enabled. It comes from the view controller's type name only: a plain `UIViewController`'s `title` is no longer sent, since it can contain user data. | ||
| - Secure-entry text fields now stay masked inside a `postHogNoMask()` or `ph-no-mask` subtree. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'posthog-ios': major | ||
| --- | ||
|
|
||
| **Breaking:** remove the experimental `PostHogSessionReplayConfig.screenshotModeBackgroundCapture` option. Delete the assignment. Screenshots are now always captured on the main thread, where rendering is fast enough that the off-main workaround is no longer needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'posthog-ios': major | ||
| --- | ||
|
|
||
| **Breaking:** rename `PostHogLogLevel` to `PostHogConsoleLogLevel` and `PostHogLogEntry` to `PostHogConsoleLogEntry`, so the session replay console log types aren't confused with the Logs types `PostHogLogSeverity` and `PostHogLogRecord`. Update custom `logSanitizer` and `minLogLevel` code to the new names (`PostHogConsoleLogLevelInfo`/`Warn`/`Error` in Objective-C). Behavior is unchanged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| 'posthog-ios': major | ||
| --- | ||
|
|
||
| **Breaking:** mark callbacks the SDK can call off the main thread `@Sendable` — `reloadFeatureFlags(_:)`, the `BeforeSendBlock` and `PostHogBeforeSendLogBlock` used by `setBeforeSend(_:)` on `PostHogConfig` and `PostHogLogsConfig`, `PostHogConfig.getAnonymousId`, `PostHogConfig.pushIdentityProvider` and its `completion`, and `sessionReplayConfig.captureLogsConfig.logSanitizer` — and make `PostHogFeatureFlagsLoaded` `Sendable`. This fixes a crash in Swift 6 apps when a `reloadFeatureFlags(_:)` callback is written in main-actor code. | ||
|
|
||
| To update main-actor state from `reloadFeatureFlags(_:)` or `pushIdentityProvider`, hop with `Task { @MainActor in ... }`. The other callbacks return a value immediately, so they must not read main-actor state. Declare closures you store in your own variables as `@Sendable` to avoid new Swift 5 warnings. Use the `BeforeSendBlock` and `PostHogBeforeSendLogBlock` typealiases for any `setBeforeSend(_:)` arrays you build or pass around, including your own helpers: in Swift 5 mode, converting an array between the old function type and these types compiles but crashes at runtime, in either direction. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'posthog-ios': major | ||
| --- | ||
|
|
||
| **Breaking:** require Xcode 26 or later (Swift 6.2 toolchain, `swift-tools-version` 6.2) to build PostHog, the same Xcode the App Store already requires for uploads; the SDK still compiles in Swift 5 language mode and its API is unchanged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] This is the same fix 3.92.0 already shipped (ea22826) under a different file name, so it'd survive the merge and show up again in the 4.0.0 changelog. Drop it when merging
main?