File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Anytype/Sources/Analytics/AnytypeAnalytics Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff 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 {
You can’t perform that action at this time.
0 commit comments