Fix Play Games theme

This commit is contained in:
Lucas Lima 2020-08-24 22:05:54 -03:00
parent 56e1e61e34
commit 0d547b339e
No known key found for this signature in database
GPG key ID: C5EEF4C30BFBF8D7
4 changed files with 12 additions and 3 deletions

View file

@ -19,7 +19,7 @@ val ViewModelModule = module {
viewModel { CreateGameViewModel(get()) }
viewModel { HistoryViewModel(get(), get()) }
viewModel { EndGameDialogViewModel(get()) }
viewModel { PlayGamesViewModel(get()) }
viewModel { PlayGamesViewModel(get(), get()) }
viewModel { StatsViewModel(get(), get()) }
viewModel { TextViewModel(get()) }
viewModel { ThemeViewModel(get(), get(), get(), get()) }

View file

@ -1,6 +1,5 @@
package dev.lucasnlm.antimine.playgames
import android.app.AlertDialog
import android.app.Dialog
import android.content.Context
import android.os.Bundle
@ -10,6 +9,7 @@ import android.view.ViewGroup
import android.widget.BaseAdapter
import android.widget.FrameLayout
import android.widget.TextView
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatDialogFragment
import androidx.appcompat.widget.AppCompatImageView
import androidx.lifecycle.lifecycleScope

View file

@ -2,12 +2,15 @@ package dev.lucasnlm.antimine.playgames.viewmodel
import android.app.Activity
import dev.lucasnlm.antimine.R
import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager
import dev.lucasnlm.antimine.core.analytics.models.Analytics
import dev.lucasnlm.antimine.core.viewmodel.StatelessViewModel
import dev.lucasnlm.antimine.playgames.model.PlayGamesItem
import dev.lucasnlm.external.IPlayGamesManager
class PlayGamesViewModel(
private val playGamesManager: IPlayGamesManager
private val playGamesManager: IPlayGamesManager,
private val analyticsManager: IAnalyticsManager
) : StatelessViewModel<PlayGamesEvent>() {
val playGamesItems = listOf(
@ -16,10 +19,12 @@ class PlayGamesViewModel(
)
fun openAchievements(activity: Activity) {
analyticsManager.sentEvent(Analytics.OpenAchievements)
playGamesManager.openAchievements(activity)
}
fun openLeaderboards(activity: Activity) {
analyticsManager.sentEvent(Analytics.OpenLeaderboards)
playGamesManager.openLeaderboards(activity)
}
}

View file

@ -91,6 +91,10 @@ sealed class Analytics(
object OpenThemes : Analytics("Open Themes")
object OpenAchievements : Analytics("Open Achievements")
object OpenLeaderboards : Analytics("Open Leaderboards")
data class ClickTheme(
private val themeId: Long
) : Analytics("Click Theme", mapOf("id" to themeId.toString()))