Skip to content

Commit

Permalink
feat: Add is team member segmentation to app.open event (WPB-14523) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ohassine authored Jan 28, 2025
1 parent 0a8b0c6 commit f4566e5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
11 changes: 10 additions & 1 deletion app/src/main/kotlin/com/wire/android/WireApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,16 @@ class WireApplication : BaseApp() {
.isAppVisibleFlow()
.filter { isVisible -> isVisible }
.collect {
AnonymousAnalyticsManagerImpl.sendEvent(AnalyticsEvent.AppOpen)
val currentSessionResult = coreLogic.get().getGlobalScope().session.currentSessionFlow().first()
val isTeamMember = if (currentSessionResult is CurrentSessionResult.Success) {
coreLogic.get().getSessionScope(currentSessionResult.accountInfo.userId).team.isSelfATeamMember()
} else {
null
}

AnonymousAnalyticsManagerImpl.sendEvent(
AnalyticsEvent.AppOpen(isTeamMember)
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,13 @@ interface AnalyticsEvent {
*/
fun toSegmentation(): Map<String, Any> = mapOf()

data object AppOpen : AnalyticsEvent {
data class AppOpen(val isTeamMember: Boolean?) : AnalyticsEvent {
override val key: String = AnalyticsEventConstants.APP_OPEN
override fun toSegmentation(): Map<String, Any> {
return isTeamMember?.let {
mapOf(IS_TEAM_MEMBER to it)
} ?: super.toSegmentation()
}
}

/**
Expand Down

0 comments on commit f4566e5

Please sign in to comment.