Last active
January 18, 2021 21:01
-
-
Save amsterdatech/7b1e1144e71613ede8e7277e3a935879 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Trackable { | |
@EventName | |
val eventName: String | |
val properties: Map<String, String>? | |
} | |
sealed class Event : Trackable { | |
data class EventTrack( | |
@EventName override val eventName: String, | |
override val properties: Map<String, String>? = null | |
) : Event() { | |
companion object | |
} | |
data class CrashTrack( | |
@EventName override val eventName: String, | |
override val properties: Map<String, String>? = null | |
) : Event() { | |
companion object | |
} | |
} | |
@Retention(AnnotationRetention.SOURCE) | |
@StringDef( | |
PAGE_VIEW, EXCEPTION, STACK_TRACE, PROPERTY_FILE, PROPERTY_LINE_NUMBER, | |
PROPERTY_COLUMN_NUMBER, PROPERTY_METHOD, CAUSE, MESSAGE | |
) | |
annotation class EventName { | |
companion object { | |
const val PAGE_VIEW = "pageView" | |
const val EXCEPTION = "exception" | |
const val STACK_TRACE = "stack_trace" | |
const val CAUSE = "cause" | |
const val MESSAGE = "message" | |
const val PROPERTY_FILE = "file" | |
const val PROPERTY_LINE_NUMBER = "lineNumber" | |
const val PROPERTY_COLUMN_NUMBER = "columnNumber" | |
const val PROPERTY_METHOD = "method" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment