Simplied Analytics objects

This commit is contained in:
Lucas Lima 2020-06-21 14:10:52 -03:00 committed by Lucas Lima
parent 27cab25b31
commit 439d6c9a02
4 changed files with 20 additions and 20 deletions

View file

@ -191,7 +191,7 @@ class GameActivity : AppCompatActivity(), DialogInterface.OnDismissListener {
resumeGame()
}
analyticsManager.sentEvent(Analytics.Resume())
analyticsManager.sentEvent(Analytics.Resume)
}
}
}
@ -203,7 +203,7 @@ class GameActivity : AppCompatActivity(), DialogInterface.OnDismissListener {
viewModel.pauseGame()
}
analyticsManager.sentEvent(Analytics.Quit())
analyticsManager.sentEvent(Analytics.Quit)
}
override fun onCreateOptionsMenu(menu: Menu): Boolean =
@ -270,7 +270,7 @@ class GameActivity : AppCompatActivity(), DialogInterface.OnDismissListener {
override fun onDrawerOpened(drawerView: View) {
viewModel.pauseGame()
analyticsManager.sentEvent(Analytics.OpenDrawer())
analyticsManager.sentEvent(Analytics.OpenDrawer)
}
override fun onDrawerClosed(drawerView: View) {
@ -278,7 +278,7 @@ class GameActivity : AppCompatActivity(), DialogInterface.OnDismissListener {
viewModel.resumeGame()
}
analyticsManager.sentEvent(Analytics.CloseDrawer())
analyticsManager.sentEvent(Analytics.CloseDrawer)
}
override fun onDrawerStateChanged(newState: Int) {
@ -425,28 +425,28 @@ class GameActivity : AppCompatActivity(), DialogInterface.OnDismissListener {
}
private fun showAbout() {
analyticsManager.sentEvent(Analytics.OpenAbout())
analyticsManager.sentEvent(Analytics.OpenAbout)
Intent(this, AboutActivity::class.java).apply {
startActivity(this)
}
}
private fun openSaveHistory() {
analyticsManager.sentEvent(Analytics.OpenSaveHistory())
analyticsManager.sentEvent(Analytics.OpenSaveHistory)
Intent(this, HistoryActivity::class.java).apply {
startActivity(this)
}
}
private fun openStats() {
analyticsManager.sentEvent(Analytics.OpenStats())
analyticsManager.sentEvent(Analytics.OpenStats)
Intent(this, StatsActivity::class.java).apply {
startActivity(this)
}
}
private fun showSettings() {
analyticsManager.sentEvent(Analytics.OpenSettings())
analyticsManager.sentEvent(Analytics.OpenSettings)
Intent(this, PreferencesActivity::class.java).apply {
startActivity(this)
}

View file

@ -15,7 +15,7 @@ open class MainApplication : MultiDexApplication() {
super.onCreate()
analyticsManager.apply {
setup(applicationContext, mapOf())
sentEvent(Analytics.Open())
sentEvent(Analytics.Open)
}
}
}

View file

@ -109,7 +109,7 @@ class GameViewModel @ViewModelInject constructor(
}
saveId.postValue(save.uid.toLong())
analyticsManager.sentEvent(Analytics.ResumePreviousGame())
analyticsManager.sentEvent(Analytics.ResumePreviousGame)
return setup
}

View file

@ -8,7 +8,7 @@ sealed class Analytics(
val title: String,
val extra: Map<String, String> = mapOf()
) {
class Open : Analytics("Open game")
object Open : Analytics("Open game")
class NewGame(
minefield: Minefield,
@ -46,7 +46,7 @@ sealed class Analytics(
)
)
class ResumePreviousGame : Analytics("Resume previous game")
object ResumePreviousGame : Analytics("Resume previous game")
class OpenTile(index: Int) : Analytics("Open Tile", mapOf("Index" to index.toString()))
@ -77,21 +77,21 @@ sealed class Analytics(
)
)
class Resume : Analytics("Back to the game")
object Resume : Analytics("Back to the game")
class Quit : Analytics("Quit game")
object Quit : Analytics("Quit game")
class OpenDrawer : Analytics("Opened Drawer")
object OpenDrawer : Analytics("Opened Drawer")
class CloseDrawer : Analytics("Closed Drawer")
object CloseDrawer : Analytics("Closed Drawer")
class OpenAbout : Analytics("Open About")
object OpenAbout : Analytics("Open About")
class OpenStats : Analytics("Open Stats")
object OpenStats : Analytics("Open Stats")
class OpenSettings : Analytics("Open Settings")
object OpenSettings : Analytics("Open Settings")
class OpenSaveHistory : Analytics("Open Save History")
object OpenSaveHistory : Analytics("Open Save History")
class ShowRatingRequest(usages: Int) : Analytics("Shown Rating Request", mapOf("Usages" to usages.toString()))