Skip to content

Commit

Permalink
Merge pull request #31 from Winfooz/mhamdan/handle-multiple-embedded/…
Browse files Browse the repository at this point in the history
…2018-11-11

Handle null event
  • Loading branch information
winfoozmnayef authored Nov 11, 2018
2 parents 7fa4e99 + e1014fe commit 388641b
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion annotations/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ POM_DESCRIPTION=Annotations for use in your project
POM_BINTRAY_NAME=com.winfooz.winanalytics:annotations
POM_ARTIFACT_ID=annotations
POM_PACKAGING=jar
POM_VERSION=1.0.6-beta
POM_VERSION=1.0.7-beta
2 changes: 1 addition & 1 deletion compiler/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ POM_DESCRIPTION=For proccess annotations and generate code
POM_BINTRAY_NAME=com.winfooz.winanalytics:compiler
POM_ARTIFACT_ID=compiler
POM_PACKAGING=jar
POM_VERSION=1.0.6-beta
POM_VERSION=1.0.7-beta
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ fun String.toCamelCase(): String {
return camelCaseString
}

fun String.toProperCase(): String = "${substring(0, 1).toUpperCase()}${substring(1).toLowerCase()}"
fun String.toProperCase(): String = "${trim().substring(0, 1).toUpperCase()}${trim().substring(1).toLowerCase()}"
2 changes: 1 addition & 1 deletion winanalytics/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ POM_DESCRIPTION=For log analytics to firebase,fabric,mixpanel etc...
POM_BINTRAY_NAME=com.winfooz.winanalytics:winanalytics
POM_ARTIFACT_ID=winanalytics
POM_PACKAGING=jar
POM_VERSION=1.0.6-beta
POM_VERSION=1.0.7-beta
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ class FabricAnalytics(private val context: Context) : Analytics {
override fun log(data: Pair<String, MutableMap<String, String>>) {
val event = CustomEvent(data.first)
data.second.keys.forEach {
event.putCustomAttribute(it, data.second[it])
if (data.second[it] != null && data.second[it]?.isNotEmpty() == true) {
event.putCustomAttribute(it, data.second[it])
}
}
Answers.getInstance().logCustom(event)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ class FirebaseAnalytics(private val context: Context) : Analytics {
override fun log(data: Pair<String, MutableMap<String, String>>) {
val bundle = Bundle()
data.second.keys.forEach {
bundle.putString(it, data.second[it])
if (data.second[it] != null && data.second[it]?.isNotEmpty() == true) {
bundle.putString(it, data.second[it])
}
}
firebase.logEvent(data.first, bundle)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ class MixPanelAnalytics(private val context: Context, private val token: String)
try {
val jsonObject = JSONObject()
data.second.keys.forEach {
jsonObject.put(it, data.second[it])
if (data.second[it] != null && data.second[it]?.isNotEmpty() == true) {
jsonObject.put(it, data.second[it])
}
}
val mixpanel = MixpanelAPI.getInstance(context, token)
mixpanel.track(data.first, jsonObject)
Expand Down

0 comments on commit 388641b

Please sign in to comment.