Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
  • Loading branch information
jguerinet committed Oct 23, 2017
2 parents d47765d + c71f863 commit 54f1cbb
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Change Log

## Version 2.1.1 (2017-10-23)
## Version 2.1.2 (2017-10-23)
* `dialog`:
* Fixed the multi list dialog button type

## Version 2.1.1 (2017-09-23)
* `analytics`
* Switched `isDisabled()` to be a method instead of a variable

## Version 2.1.0 (2017-08-31)
* `analytics`
* Added the Analytics module for Google Analytics helper methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,23 @@ import com.google.android.gms.analytics.Tracker
*
* @param context App context
* @param config Xml file used to configure the tracker
* @param disabled True if we should not send to Google Analytics, false otherwise
*/
open class GAManager(context: Context, @XmlRes config: Int, var disabled: Boolean = false) {
open class GAManager(context: Context, @XmlRes config: Int) {

val tracker: Tracker = GoogleAnalytics.getInstance(context).newTracker(config)
private val tracker: Tracker = GoogleAnalytics.getInstance(context).newTracker(config)

/**
* True if we should not send anything to Google Analytics, false otherwise.
* Should be overridden by the clients if it does need to be disabled
*/
open fun isDisabled(): Boolean = false

/**
* Sends an event with the given [category], [action], and optional [label] to Google Analytics
*/
@JvmOverloads
fun sendEvent(category: String, action: String, label: String? = null) {
if (disabled) {
if (isDisabled()) {
Log.d("GAManager", "Event: $category, $action, $label")
return
}
Expand All @@ -63,7 +68,7 @@ open class GAManager(context: Context, @XmlRes config: Int, var disabled: Boolea
* Sends a screen with the given [name] to Google Analytics
*/
fun sendScreen(name: String) {
if (disabled) {
if (isDisabled()) {
Log.d("GAManager", "Screen: $name")
return
}
Expand Down

0 comments on commit 54f1cbb

Please sign in to comment.