Skip to content

Commit 1b73b28

Browse files
committed
IOS-5416 Add data
1 parent e0bfa2a commit 1b73b28

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Anytype/Sources/Analytics/AnytypeAnalytics/AnytypeAnalytics.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ final class AnytypeAnalytics: @unchecked Sendable {
2828

2929
@Injected(\.participantSpacesStorage)
3030
private var participantSpacesStorage: any ParticipantSpacesStorageProtocol
31+
@Injected(\.activeSpaceManager)
32+
private var activeSpaceManager: any ActiveSpaceManagerProtocol
3133

3234
private init() {
3335
userProperties[Keys.interfaceLang] = Locale.current.language.languageCode?.identifier
@@ -99,10 +101,20 @@ final class AnytypeAnalytics: @unchecked Sendable {
99101
eventProperties[AnalyticsEventsPropertiesKey.uxType] = uxType
100102
}
101103

102-
logEvent(eventType, withEventProperties: eventProperties)
104+
logRawEvent(eventType, withEventProperties: eventProperties)
103105
}
104106

105107
func logEvent(_ eventType: String, withEventProperties eventProperties: [String : Any] = [:]) {
108+
if let workspaceInfo = activeSpaceManager.workspaceInfo {
109+
logEvent(eventType, spaceId: workspaceInfo.accountSpaceId, withEventProperties: eventProperties)
110+
} else {
111+
logRawEvent(eventType, withEventProperties: eventProperties)
112+
}
113+
}
114+
115+
// MARK: - Private
116+
117+
private func logRawEvent(_ eventType: String, withEventProperties eventProperties: [String : Any] = [:]) {
106118
let eventConfiguration = eventsConfiguration[eventType]
107119

108120
if case .notInRow = eventConfiguration?.threshold, lastEvents == eventType {

0 commit comments

Comments
 (0)