Skip to content

Commit

Permalink
Location sharing (#83)
Browse files Browse the repository at this point in the history
Add screen name and composer's actions for tracking location sharing.
  • Loading branch information
Flescio committed Jul 3, 2023
1 parent 67f7b33 commit 42b2faa
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 3 deletions.
14 changes: 13 additions & 1 deletion schemas/Composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,20 @@
"startsThread": {
"description": "Whether this message begins a new thread or not.",
"type": "boolean"
},
"isLocation": {
"description": "Whether this message it's a shared location.",
"type": "boolean"
},
"locationType": {
"description": "The type of the shared location",
"type": "string",
"oneOf": [
{"const": "PinDrop", "description": "Pin drop location"},
{"const": "MyLocation", "description": "User current location"}
]
}
},
"required": ["eventName", "isEditing", "isReply", "inThread"],
"required": ["eventName", "isEditing", "isReply", "inThread", "isLocation"],
"additionalProperties": false
}
4 changes: 3 additions & 1 deletion schemas/MobileScreen.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@
{"const": "ThreadList", "description": "Screen that displays list of threads for a room."},
{"const": "SpaceBottomSheet", "description": "Room accessed via space bottom sheet list."},
{"const": "Invites", "description": "Room accessed via space bottom sheet list."},
{"const": "CreateSpace", "description": "The screen shown to create a new space."}
{"const": "CreateSpace", "description": "The screen shown to create a new space."},
{"const": "LocationSend", "description": "The screen shown to share location."},
{"const": "LocationView", "description": "The screen shown to view a shared location."}
]
},
"durationMs": {
Expand Down
10 changes: 10 additions & 0 deletions types/kotlin/Composer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,21 @@ data class Composer (
*/
val isEditing: Boolean,

/**
* Whether this message it's a shared location.
*/
val isLocation: Boolean,

/**
* Whether the user's composer interaction was a reply to a previously sent event.
*/
val isReply: Boolean,

/**
* The type of the shared location
*/
val locationType: String? = null,

/**
* Whether this message begins a new thread or not.
*/
Expand Down
22 changes: 22 additions & 0 deletions types/kotlin2/Composer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,46 @@ data class Composer(
* event.
*/
val isEditing: Boolean,
/**
* Whether this message it's a shared location.
*/
val isLocation: Boolean,
/**
* Whether the user's composer interaction was a reply to a previously
* sent event.
*/
val isReply: Boolean,
/**
* The type of the shared location
*/
val locationType: LocationType? = null,
/**
* Whether this message begins a new thread or not.
*/
val startsThread: Boolean? = null,
) : VectorAnalyticsEvent {

enum class LocationType {
/**
* User current location
*/
MyLocation,

/**
* Pin drop location
*/
PinDrop,
}

override fun getName() = "Composer"

override fun getProperties(): Map<String, Any>? {
return mutableMapOf<String, Any>().apply {
put("inThread", inThread)
put("isEditing", isEditing)
put("isLocation", isLocation)
put("isReply", isReply)
locationType?.let { put("locationType", it.name) }
startsThread?.let { put("startsThread", it) }
}.takeIf { it.isNotEmpty() }
}
Expand Down
10 changes: 10 additions & 0 deletions types/kotlin2/MobileScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ data class MobileScreen(
*/
Invites,

/**
* The screen shown to share location.
*/
LocationSend,

/**
* The screen shown to view a shared location.
*/
LocationView,

/**
* The screen that displays the login flow (when the user already has an
* account).
Expand Down
17 changes: 16 additions & 1 deletion types/swift/Composer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,38 @@ extension AnalyticsEvent {
public let inThread: Bool
/// Whether the user's composer interaction was editing a previously sent event.
public let isEditing: Bool
/// Whether this message it's a shared location.
public let isLocation: Bool
/// Whether the user's composer interaction was a reply to a previously sent event.
public let isReply: Bool
/// The type of the shared location
public let locationType: LocationType?
/// Whether this message begins a new thread or not.
public let startsThread: Bool?

public init(inThread: Bool, isEditing: Bool, isReply: Bool, startsThread: Bool?) {
public init(inThread: Bool, isEditing: Bool, isLocation: Bool, isReply: Bool, locationType: LocationType?, startsThread: Bool?) {
self.inThread = inThread
self.isEditing = isEditing
self.isLocation = isLocation
self.isReply = isReply
self.locationType = locationType
self.startsThread = startsThread
}

public enum LocationType: String {
/// User current location
case MyLocation
/// Pin drop location
case PinDrop
}

public var properties: [String: Any] {
return [
"inThread": inThread,
"isEditing": isEditing,
"isLocation": isLocation,
"isReply": isReply,
"locationType": locationType?.rawValue as Any,
"startsThread": startsThread as Any
]
}
Expand Down
4 changes: 4 additions & 0 deletions types/swift/MobileScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ extension AnalyticsEvent {
case InviteFriends
/// Room accessed via space bottom sheet list.
case Invites
/// The screen shown to share location.
case LocationSend
/// The screen shown to view a shared location.
case LocationView
/// The screen that displays the login flow (when the user already has an account).
case Login
/// Legacy: The screen that shows all groups/communities you have joined.
Expand Down

0 comments on commit 42b2faa

Please sign in to comment.