Skip to content

Commit ff9545a

Browse files
committed
Add support for visionOS
1 parent 5077fa8 commit ff9545a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+97
-75
lines changed

PostHog.xcodeproj/project.pbxproj

+18-11
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@
108108
69F518182BAC80A300F52C14 /* String+Util.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69F518172BAC80A300F52C14 /* String+Util.swift */; };
109109
69F5181A2BAC81FC00F52C14 /* UITextInputTraits+Util.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69F518192BAC81FC00F52C14 /* UITextInputTraits+Util.swift */; };
110110
69F518382BB2BA0100F52C14 /* PostHogSwizzler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69F518372BB2BA0100F52C14 /* PostHogSwizzler.swift */; };
111-
DA0C944B2D54CDD000BFD9FB /* PostHogStorageMigrationTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA0C944A2D54CDD000BFD9FB /* PostHogStorageMigrationTest.swift */; };
112111
DA0B66A52D64EC00006F5FF3 /* ph_sharpyuv_csp.h in Headers */ = {isa = PBXBuildFile; fileRef = DA0B66982D64EC00006F5FF3 /* ph_sharpyuv_csp.h */; settings = {ATTRIBUTES = (Public, ); }; };
113112
DA0B66A62D64EC00006F5FF3 /* ph_sharpyuv_dsp.h in Headers */ = {isa = PBXBuildFile; fileRef = DA0B66992D64EC00006F5FF3 /* ph_sharpyuv_dsp.h */; settings = {ATTRIBUTES = (Public, ); }; };
114113
DA0B66A72D64EC00006F5FF3 /* ph_huffman_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DA0B668A2D64EC00006F5FF3 /* ph_huffman_utils.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -153,12 +152,13 @@
153152
DA0B66CE2D64EC00006F5FF3 /* ph_endian_inl_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DA0B66852D64EC00006F5FF3 /* ph_endian_inl_utils.h */; settings = {ATTRIBUTES = (Public, ); }; };
154153
DA0B66CF2D64EC00006F5FF3 /* ph_cpu.h in Headers */ = {isa = PBXBuildFile; fileRef = DA0B66812D64EC00006F5FF3 /* ph_cpu.h */; settings = {ATTRIBUTES = (Public, ); }; };
155154
DA0B66D02D64EC00006F5FF3 /* ph_sharpyuv_gamma.h in Headers */ = {isa = PBXBuildFile; fileRef = DA0B669A2D64EC00006F5FF3 /* ph_sharpyuv_gamma.h */; settings = {ATTRIBUTES = (Public, ); }; };
155+
DA0C944B2D54CDD000BFD9FB /* PostHogStorageMigrationTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA0C944A2D54CDD000BFD9FB /* PostHogStorageMigrationTest.swift */; };
156156
DA0CA6F12CFF6B6300AF9500 /* UIWindow+.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA0CA6F02CFF6B6300AF9500 /* UIWindow+.swift */; };
157157
DA1044882D0B1D2D00C4ACF3 /* View+PostHogLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA1044852D0B1D2D00C4ACF3 /* View+PostHogLabel.swift */; };
158158
DA1044892D0B1D2D00C4ACF3 /* UIView+PostHogLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA1044872D0B1D2D00C4ACF3 /* UIView+PostHogLabel.swift */; };
159159
DA1044902D0B1D4300C4ACF3 /* AssociatedKeys.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA10448F2D0B1D4300C4ACF3 /* AssociatedKeys.swift */; };
160-
DA1044D42D0B34F200C4ACF3 /* PostHog.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AC745B5296D6FE60025C109 /* PostHog.framework */; };
161-
DA1044D52D0B34F200C4ACF3 /* PostHog.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3AC745B5296D6FE60025C109 /* PostHog.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
160+
DA1044D42D0B34F200C4ACF3 /* PostHog.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AC745B5296D6FE60025C109 /* PostHog.framework */; platformFilters = (ios, maccatalyst, ); };
161+
DA1044D52D0B34F200C4ACF3 /* PostHog.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3AC745B5296D6FE60025C109 /* PostHog.framework */; platformFilters = (ios, maccatalyst, ); settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
162162
DA1D295E2D10B7B2003A31DA /* ApplicationLifecyclePublisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA1D29582D10B7A6003A31DA /* ApplicationLifecyclePublisher.swift */; };
163163
DA1D29602D10C810003A31DA /* PostHogSessionManagerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA1D295F2D10C80D003A31DA /* PostHogSessionManagerTest.swift */; };
164164
DA1D29622D115E17003A31DA /* DI.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA1D29612D115E13003A31DA /* DI.swift */; };
@@ -567,7 +567,6 @@
567567
69F518172BAC80A300F52C14 /* String+Util.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Util.swift"; sourceTree = "<group>"; };
568568
69F518192BAC81FC00F52C14 /* UITextInputTraits+Util.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITextInputTraits+Util.swift"; sourceTree = "<group>"; };
569569
69F518372BB2BA0100F52C14 /* PostHogSwizzler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHogSwizzler.swift; sourceTree = "<group>"; };
570-
DA0C944A2D54CDD000BFD9FB /* PostHogStorageMigrationTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHogStorageMigrationTest.swift; sourceTree = "<group>"; };
571570
DA0B66792D64EC00006F5FF3 /* ph_backward_references_enc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ph_backward_references_enc.h; sourceTree = "<group>"; };
572571
DA0B667A2D64EC00006F5FF3 /* ph_bit_reader_utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ph_bit_reader_utils.h; sourceTree = "<group>"; };
573572
DA0B667B2D64EC00006F5FF3 /* ph_bit_writer_utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ph_bit_writer_utils.h; sourceTree = "<group>"; };
@@ -612,6 +611,7 @@
612611
DA0B66A22D64EC00006F5FF3 /* ph_vp8li_enc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ph_vp8li_enc.h; sourceTree = "<group>"; };
613612
DA0B66A32D64EC00006F5FF3 /* ph_webpi_dec.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ph_webpi_dec.h; sourceTree = "<group>"; };
614613
DA0B66A42D64EC00006F5FF3 /* ph_yuv.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ph_yuv.h; sourceTree = "<group>"; };
614+
DA0C944A2D54CDD000BFD9FB /* PostHogStorageMigrationTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostHogStorageMigrationTest.swift; sourceTree = "<group>"; };
615615
DA0CA6F02CFF6B6300AF9500 /* UIWindow+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIWindow+.swift"; sourceTree = "<group>"; };
616616
DA1044852D0B1D2D00C4ACF3 /* View+PostHogLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+PostHogLabel.swift"; sourceTree = "<group>"; };
617617
DA1044872D0B1D2D00C4ACF3 /* UIView+PostHogLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+PostHogLabel.swift"; sourceTree = "<group>"; };
@@ -2000,6 +2000,10 @@
20002000
};
20012001
DA1044D72D0B34F200C4ACF3 /* PBXTargetDependency */ = {
20022002
isa = PBXTargetDependency;
2003+
platformFilters = (
2004+
ios,
2005+
maccatalyst,
2006+
);
20032007
target = 3AC745B4296D6FE60025C109 /* PostHog */;
20042008
targetProxy = DA1044D62D0B34F200C4ACF3 /* PBXContainerItemProxy */;
20052009
};
@@ -2092,12 +2096,13 @@
20922096
PRODUCT_BUNDLE_IDENTIFIER = com.posthog.PostHogExample;
20932097
PRODUCT_NAME = "$(TARGET_NAME)";
20942098
PROVISIONING_PROFILE_SPECIFIER = "";
2095-
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
2099+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator";
20962100
SUPPORTS_MACCATALYST = YES;
20972101
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
2102+
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
20982103
SWIFT_EMIT_LOC_STRINGS = YES;
20992104
SWIFT_VERSION = 5.0;
2100-
TARGETED_DEVICE_FAMILY = "1,2";
2105+
TARGETED_DEVICE_FAMILY = "1,2,7";
21012106
TVOS_DEPLOYMENT_TARGET = 13.0;
21022107
};
21032108
name = Debug;
@@ -2127,12 +2132,13 @@
21272132
MARKETING_VERSION = 4.0;
21282133
PRODUCT_BUNDLE_IDENTIFIER = com.posthog.PostHogExample;
21292134
PRODUCT_NAME = "$(TARGET_NAME)";
2130-
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
2135+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator";
21312136
SUPPORTS_MACCATALYST = YES;
21322137
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
2138+
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
21332139
SWIFT_EMIT_LOC_STRINGS = YES;
21342140
SWIFT_VERSION = 5.0;
2135-
TARGETED_DEVICE_FAMILY = "1,2";
2141+
TARGETED_DEVICE_FAMILY = "1,2,7";
21362142
TVOS_DEPLOYMENT_TARGET = 13.0;
21372143
};
21382144
name = Release;
@@ -2858,12 +2864,13 @@
28582864
PRODUCT_BUNDLE_IDENTIFIER = com.posthog.PostHogExample.yj;
28592865
PRODUCT_NAME = "$(TARGET_NAME)";
28602866
PROVISIONING_PROFILE_SPECIFIER = "";
2861-
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
2862-
SUPPORTS_MACCATALYST = NO;
2867+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator";
2868+
SUPPORTS_MACCATALYST = YES;
28632869
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
2870+
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
28642871
SWIFT_EMIT_LOC_STRINGS = YES;
28652872
SWIFT_VERSION = 5.0;
2866-
TARGETED_DEVICE_FAMILY = "1,2";
2873+
TARGETED_DEVICE_FAMILY = "1,2,7";
28672874
TVOS_DEPLOYMENT_TARGET = 13.0;
28682875
};
28692876
name = Testing;

PostHog/App Life Cycle/ApplicationLifecyclePublisher.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Created by Yiannis Josephides on 16/12/2024.
66
//
77

8-
#if os(iOS) || os(tvOS)
8+
#if os(iOS) || os(tvOS) || os(visionOS)
99
import UIKit
1010
#elseif os(macOS)
1111
import AppKit
@@ -49,7 +49,7 @@ final class ApplicationLifecyclePublisher: BaseApplicationLifecyclePublisher {
4949

5050
let defaultCenter = NotificationCenter.default
5151

52-
#if os(iOS) || os(tvOS)
52+
#if os(iOS) || os(tvOS) || os(visionOS)
5353
defaultCenter.addObserver(self,
5454
selector: #selector(appDidFinishLaunching),
5555
name: UIApplication.didFinishLaunchingNotification,

PostHog/DI.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ enum DI {
1717
// publishes global screen view events (UIViewController.viewDidAppear)
1818
lazy var screenViewPublisher: ScreenViewPublishing = ApplicationScreenViewPublisher.shared
1919

20-
#if os(iOS) || os(tvOS)
20+
#if os(iOS) || os(tvOS) || os(visionOS)
2121
// publishes global application events (UIApplication.sendEvent)
2222
lazy var applicationEventPublisher: ApplicationEventPublishing = ApplicationEventPublisher.shared
2323
#endif

PostHog/PostHogConfig.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ import Foundation
6363
/// or EU Host: 'https://eu.i.posthog.com'
6464
public static let defaultHost: String = "https://us.i.posthog.com"
6565

66-
#if os(iOS)
66+
#if os(iOS) || os(visionOS)
6767
/// Enable Recording of Session Replays for iOS
6868
/// Default: false
6969
@objc public var sessionReplay: Bool = false
@@ -106,7 +106,7 @@ import Foundation
106106
integrations.append(PostHogAppLifeCycleIntegration())
107107
}
108108

109-
#if os(iOS)
109+
#if os(iOS) || os(visionOS)
110110
if sessionReplay {
111111
integrations.append(PostHogReplayIntegration())
112112
}

PostHog/PostHogContext.swift

+15-9
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import Foundation
99

10-
#if os(iOS) || os(tvOS)
10+
#if os(iOS) || os(tvOS) || os(visionOS)
1111
import UIKit
1212
#elseif os(macOS)
1313
import AppKit
@@ -55,7 +55,7 @@ class PostHogContext {
5555

5656
// iOS app running in compatibility mode (Designed for iPad/iPhone)
5757
var isiOSAppOnMac = false
58-
#if os(iOS)
58+
#if os(iOS) || os(visionOS)
5959
if #available(iOS 14.0, *) {
6060
isiOSAppOnMac = ProcessInfo.processInfo.isiOSAppOnMac
6161
}
@@ -71,7 +71,7 @@ class PostHogContext {
7171
properties["$is_ios_running_on_mac"] = isiOSAppOnMac
7272
properties["$is_mac_catalyst_app"] = isMacCatalystApp
7373

74-
#if os(iOS) || os(tvOS)
74+
#if os(iOS) || os(tvOS) || os(visionOS)
7575
let device = UIDevice.current
7676
// use https://github.com/devicekit/DeviceKit
7777
let processInfo = ProcessInfo.processInfo
@@ -188,7 +188,7 @@ class PostHogContext {
188188
// - "hw.model" returns mac model
189189
#if targetEnvironment(macCatalyst)
190190
sysctlName = "hw.model"
191-
#elseif os(iOS)
191+
#elseif os(iOS) || os(visionOS)
192192
if #available(iOS 14.0, *) {
193193
if ProcessInfo.processInfo.isiOSAppOnMac {
194194
sysctlName = "hw.model"
@@ -211,8 +211,14 @@ class PostHogContext {
211211
properties["$screen_height"] = Float(screenSize.height)
212212
}
213213

214-
if Locale.current.languageCode != nil {
215-
properties["$locale"] = Locale.current.languageCode
214+
if #available(iOS 13.0, *) {
215+
if Locale.current.language.languageCode != nil {
216+
properties["$locale"] = Locale.current.language.languageCode
217+
}
218+
} else {
219+
if Locale.current.languageCode != nil {
220+
properties["$locale"] = Locale.current.languageCode
221+
}
216222
}
217223
properties["$timezone"] = TimeZone.current.identifier
218224

@@ -227,7 +233,7 @@ class PostHogContext {
227233
}
228234

229235
private func registerNotifications() {
230-
#if os(iOS) || os(tvOS)
236+
#if os(iOS) || os(tvOS) || os(visionOS)
231237
#if os(iOS)
232238
NotificationCenter.default.addObserver(self,
233239
selector: #selector(onOrientationDidChange),
@@ -262,7 +268,7 @@ class PostHogContext {
262268
}
263269

264270
private func unregisterNotifications() {
265-
#if os(iOS) || os(tvOS)
271+
#if os(iOS) || os(tvOS) || os(visionOS)
266272
#if os(iOS)
267273
NotificationCenter.default.removeObserver(self,
268274
name: UIDevice.orientationDidChangeNotification,
@@ -293,7 +299,7 @@ class PostHogContext {
293299

294300
/// Retrieves the current screen size of the application window based on platform
295301
private func getScreenSize() -> CGSize? {
296-
#if os(iOS) || os(tvOS)
302+
#if os(iOS) || os(tvOS) || os(visionOS)
297303
return UIApplication.getCurrentWindow(filterForegrounded: false)?.bounds.size
298304
#elseif os(macOS)
299305
// NSScreen.frame represents the full screen rectangle and includes any space occupied by menu, dock or camera bezel

PostHog/PostHogFeatureFlags.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class PostHogFeatureFlags {
135135
}
136136
let errorsWhileComputingFlags = data?["errorsWhileComputingFlags"] as? Bool ?? false
137137

138-
#if os(iOS)
138+
#if os(iOS) || os(visionOS)
139139
if let sessionRecording = data?["sessionRecording"] as? Bool {
140140
self.sessionReplayFlagActive = sessionRecording
141141

@@ -276,7 +276,7 @@ class PostHogFeatureFlags {
276276
return value
277277
}
278278

279-
#if os(iOS)
279+
#if os(iOS) || os(visionOS)
280280
func isSessionReplayFlagActive() -> Bool {
281281
sessionReplayFlagActive
282282
}

PostHog/PostHogSDK.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import Foundation
1111

12-
#if os(iOS) || os(tvOS)
12+
#if os(iOS) || os(tvOS) || os(visionOS)
1313
import UIKit
1414
#elseif os(macOS)
1515
import AppKit
@@ -308,7 +308,7 @@ let maxRetryDelay = 30.0
308308
}
309309
// only Session replay requires $window_id, so we set as the same as $session_id.
310310
// the backend might fallback to $session_id if $window_id is not present next.
311-
#if os(iOS)
311+
#if os(iOS) || os(visionOS)
312312
if !appendSharedProps, isSessionReplayActive() {
313313
props["$window_id"] = sessionId
314314
}
@@ -967,7 +967,7 @@ let maxRetryDelay = 30.0
967967
}
968968
}
969969

970-
#if os(iOS)
970+
#if os(iOS) || os(visionOS)
971971
/**
972972
Starts session recording.
973973
This method will have no effect if PostHog is not enabled, or if session replay is disabled in your project settings
@@ -1051,7 +1051,7 @@ let maxRetryDelay = 30.0
10511051
return postHog
10521052
}
10531053

1054-
#if os(iOS)
1054+
#if os(iOS) || os(visionOS)
10551055
@objc public func isSessionReplayActive() -> Bool {
10561056
if !isEnabled() {
10571057
return false
@@ -1113,7 +1113,7 @@ let maxRetryDelay = 30.0
11131113
}
11141114
#endif
11151115

1116-
#if os(iOS)
1116+
#if os(iOS) || os(visionOS)
11171117
func getReplayIntegration() -> PostHogReplayIntegration? {
11181118
installedIntegrations.compactMap {
11191119
$0 as? PostHogReplayIntegration

PostHog/PostHogSessionManager.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ import Foundation
224224
private var applicationEventToken: RegistrationToken?
225225

226226
private func registerApplicationSendEvent() {
227-
#if os(iOS) || os(tvOS)
227+
#if os(iOS) || os(tvOS) || os(visionOS)
228228
let applicationEventPublisher = DI.main.applicationEventPublisher
229229
applicationEventToken = applicationEventPublisher.onApplicationEvent { [weak self] _, _ in
230230
// update "last active" session

PostHog/Replay/ApplicationEventPublisher.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import Foundation
99

10-
#if os(iOS) || os(tvOS)
10+
#if os(iOS) || os(tvOS) || os(visionOS)
1111
import UIKit
1212

1313
typealias ApplicationEventHandler = (_ event: UIEvent, _ date: Date) -> Void

PostHog/Replay/CGColor+Util.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Created by Manoel Aranda Neto on 21.03.24.
66
//
77

8-
#if os(iOS)
8+
#if os(iOS) || os(visionOS)
99

1010
import Foundation
1111
import UIKit

PostHog/Replay/CGSize+Util.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Created by Manoel Aranda Neto on 24.07.24.
66
//
77

8-
#if os(iOS)
8+
#if os(iOS) || os(visionOS)
99
import Foundation
1010

1111
extension CGSize {

PostHog/Replay/MethodSwizzler.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Copyright 2019-Present Datadog, Inc.
55
*/
66

7-
#if os(iOS)
7+
#if os(iOS) || os(visionOS)
88
import Foundation
99

1010
class MethodSwizzler<TypedIMP, TypedBlockIMP> {

PostHog/Replay/NetworkSample.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Created by Manoel Aranda Neto on 26.03.24.
66
//
77

8-
#if os(iOS)
8+
#if os(iOS) || os(visionOS)
99
import Foundation
1010

1111
struct NetworkSample {

PostHog/Replay/PostHogReplayIntegration.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
// Created by Manoel Aranda Neto on 19.03.24.
88
//
9-
#if os(iOS)
9+
#if os(iOS) || os(visionOS)
1010
import Foundation
1111
import PhotosUI
1212
import SwiftUI

PostHog/Replay/PostHogSessionReplayConfig.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//
55
// Created by Manoel Aranda Neto on 19.03.24.
66
//
7-
#if os(iOS)
7+
#if os(iOS) || os(visionOS)
88
import Foundation
99

1010
@objc(PostHogSessionReplayConfig) public class PostHogSessionReplayConfig: NSObject {

PostHog/Replay/RRWireframe.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//
99

1010
import Foundation
11-
#if os(iOS)
11+
#if os(iOS) || os(visionOS)
1212
import UIKit
1313
#endif
1414

@@ -24,7 +24,7 @@ class RRWireframe {
2424
var text: String?
2525
var label: String?
2626
var value: Any? // string or number
27-
#if os(iOS)
27+
#if os(iOS) || os(visionOS)
2828
var image: UIImage?
2929
var maskableWidgets: [CGRect]?
3030
#endif
@@ -37,7 +37,7 @@ class RRWireframe {
3737
// internal
3838
var parentId: Int?
3939

40-
#if os(iOS)
40+
#if os(iOS) || os(visionOS)
4141
private func maskImage() -> UIImage? {
4242
if let image = image {
4343
// the scale also affects the image size/resolution, from usually 100kb to 15kb each
@@ -92,7 +92,7 @@ class RRWireframe {
9292
dict["value"] = value
9393
}
9494

95-
#if os(iOS)
95+
#if os(iOS) || os(visionOS)
9696
if let image = image {
9797
if let maskedImage = maskImage() {
9898
base64 = maskedImage.toBase64()

0 commit comments

Comments
 (0)