File tree 3 files changed +24
-1
lines changed
3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 1
1
## Next
2
2
3
+ - recording: do not rotate the session id for hybrid SDKs ([ #253 ] ( https://github.com/PostHog/posthog-ios/pull/253 ) )
4
+
3
5
## 3.15.2 - 2024-11-13
4
6
5
7
- fix: allow changing person properties after identify ([ #249 ] ( https://github.com/PostHog/posthog-ios/pull/249 ) )
Original file line number Diff line number Diff line change @@ -46,7 +46,17 @@ import Foundation
46
46
timeNow - sessionLastTimestamp > sessionChangeThreshold
47
47
}
48
48
49
+ private func isiOSNativeSdk( ) -> Bool {
50
+ // postHogSdkName will be set to eg posthog-react-native if not
51
+ postHogSdkName == postHogiOSSdkName
52
+ }
53
+
49
54
func resetSessionIfExpired( _ completion: ( ) -> Void ) {
55
+ // for hybrid SDKs, the session is handled by the hybrid SDK
56
+ guard isiOSNativeSdk ( ) else {
57
+ return
58
+ }
59
+
50
60
sessionLock. withLock {
51
61
let timeNow = now ( ) . timeIntervalSince1970
52
62
if sessionId != nil ,
@@ -79,6 +89,11 @@ import Foundation
79
89
}
80
90
81
91
func rotateSessionIdIfRequired( _ completion: @escaping ( ( ) -> Void ) ) {
92
+ // for hybrid SDKs, the session is handled by the hybrid SDK
93
+ guard isiOSNativeSdk ( ) else {
94
+ return
95
+ }
96
+
82
97
sessionLock. withLock {
83
98
let timeNow = now ( ) . timeIntervalSince1970
84
99
@@ -94,6 +109,11 @@ import Foundation
94
109
}
95
110
96
111
func updateSessionLastTime( ) {
112
+ // for hybrid SDKs, the session is handled by the hybrid SDK
113
+ guard isiOSNativeSdk ( ) else {
114
+ return
115
+ }
116
+
97
117
sessionLock. withLock {
98
118
sessionLastTimestamp = now ( ) . timeIntervalSince1970
99
119
}
Original file line number Diff line number Diff line change @@ -11,5 +11,6 @@ import Foundation
11
11
// This property is internal only
12
12
public var postHogVersion = " 3.15.2 "
13
13
14
+ public let postHogiOSSdkName = " posthog-ios "
14
15
// This property is internal only
15
- public var postHogSdkName = " posthog-ios "
16
+ public var postHogSdkName = postHogiOSSdkName
You can’t perform that action at this time.
0 commit comments