mirror of
https://github.com/ankidroid/Anki-Android.git
synced 2024-09-20 03:52:15 +02:00
refactor: Simplify sendAnalyticsEvent
This commit is contained in:
parent
86a0a4bc97
commit
8d52aedfba
@ -25,6 +25,7 @@
|
|||||||
<w>autoreport</w>
|
<w>autoreport</w>
|
||||||
<w>barfoo</w>
|
<w>barfoo</w>
|
||||||
<w>beolingus</w>
|
<w>beolingus</w>
|
||||||
|
<w>brayan</w>
|
||||||
<w>canonify</w>
|
<w>canonify</w>
|
||||||
<w>cardbrowser</w>
|
<w>cardbrowser</w>
|
||||||
<w>cardviewer</w>
|
<w>cardviewer</w>
|
||||||
|
@ -205,17 +205,6 @@ object UsageAnalytics {
|
|||||||
sAnalytics!!.screenView().screenName(screenName).sendAsync()
|
sAnalytics!!.screenView().screenName(screenName).sendAsync()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Send an arbitrary analytics event - these should be noun/verb pairs, e.g. "text to speech", "enabled"
|
|
||||||
*
|
|
||||||
* @param category the category of event, make your own but use a constant so reporting is good
|
|
||||||
* @param action the action the user performed
|
|
||||||
*/
|
|
||||||
@KotlinCleanup("remove when all callers are Kotlin")
|
|
||||||
fun sendAnalyticsEvent(category: String, action: String) {
|
|
||||||
sendAnalyticsEvent(category, action, Integer.MIN_VALUE, null)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a detailed arbitrary analytics event, with noun/verb pairs and extra data if needed
|
* Send a detailed arbitrary analytics event, with noun/verb pairs and extra data if needed
|
||||||
*
|
*
|
||||||
@ -224,7 +213,7 @@ object UsageAnalytics {
|
|||||||
* @param value A value for the event, Integer.MIN_VALUE signifies caller shouldn't send the value
|
* @param value A value for the event, Integer.MIN_VALUE signifies caller shouldn't send the value
|
||||||
* @param label A label for the event, may be null
|
* @param label A label for the event, may be null
|
||||||
*/
|
*/
|
||||||
fun sendAnalyticsEvent(category: String, action: String, value: Int = Int.MIN_VALUE, label: String? = null) {
|
fun sendAnalyticsEvent(category: String, action: String, value: Int? = null, label: String? = null) {
|
||||||
Timber.d("sendAnalyticsEvent() category/action/value/label: %s/%s/%s/%s", category, action, value, label)
|
Timber.d("sendAnalyticsEvent() category/action/value/label: %s/%s/%s/%s", category, action, value, label)
|
||||||
if (!optIn) {
|
if (!optIn) {
|
||||||
return
|
return
|
||||||
@ -233,7 +222,7 @@ object UsageAnalytics {
|
|||||||
if (label != null) {
|
if (label != null) {
|
||||||
event.eventLabel(label)
|
event.eventLabel(label)
|
||||||
}
|
}
|
||||||
if (value > Int.MIN_VALUE) {
|
if (value != null) {
|
||||||
event.eventValue(value)
|
event.eventValue(value)
|
||||||
}
|
}
|
||||||
event.sendAsync()
|
event.sendAsync()
|
||||||
|
Loading…
Reference in New Issue
Block a user