Rename AnalyticsManager
This commit is contained in:
parent
438ab58e16
commit
818b05f5d9
7 changed files with 12 additions and 30 deletions
|
@ -32,7 +32,7 @@ import dev.lucasnlm.antimine.common.level.models.Status
|
|||
import dev.lucasnlm.antimine.common.level.repository.ISavesRepository
|
||||
import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel
|
||||
import dev.lucasnlm.antimine.control.ControlDialogFragment
|
||||
import dev.lucasnlm.antimine.core.analytics.AnalyticsManager
|
||||
import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager
|
||||
import dev.lucasnlm.antimine.core.analytics.models.Analytics
|
||||
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository
|
||||
import dev.lucasnlm.antimine.history.HistoryActivity
|
||||
|
@ -57,7 +57,7 @@ class GameActivity : AppCompatActivity(R.layout.activity_game), DialogInterface.
|
|||
lateinit var preferencesRepository: IPreferencesRepository
|
||||
|
||||
@Inject
|
||||
lateinit var analyticsManager: AnalyticsManager
|
||||
lateinit var analyticsManager: IAnalyticsManager
|
||||
|
||||
@Inject
|
||||
lateinit var instantAppManager: InstantAppManager
|
||||
|
|
|
@ -2,14 +2,14 @@ package dev.lucasnlm.antimine
|
|||
|
||||
import androidx.multidex.MultiDexApplication
|
||||
import dagger.hilt.android.HiltAndroidApp
|
||||
import dev.lucasnlm.antimine.core.analytics.AnalyticsManager
|
||||
import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager
|
||||
import dev.lucasnlm.antimine.core.analytics.models.Analytics
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltAndroidApp
|
||||
open class MainApplication : MultiDexApplication() {
|
||||
@Inject
|
||||
lateinit var analyticsManager: AnalyticsManager
|
||||
lateinit var analyticsManager: IAnalyticsManager
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
|
|
|
@ -1,32 +1,14 @@
|
|||
package dev.lucasnlm.antimine.custom.viewmodel
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Intent
|
||||
import android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
import android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION
|
||||
import android.net.Uri
|
||||
import androidx.hilt.lifecycle.ViewModelInject
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import dev.lucasnlm.antimine.DeepLink
|
||||
import androidx.lifecycle.ViewModel
|
||||
import dev.lucasnlm.antimine.common.level.models.Minefield
|
||||
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository
|
||||
|
||||
class CreateGameViewModel @ViewModelInject constructor(
|
||||
application: Application,
|
||||
private val preferencesRepository: IPreferencesRepository
|
||||
) : AndroidViewModel(application) {
|
||||
) : ViewModel() {
|
||||
fun updateCustomGameMode(minefield: Minefield) {
|
||||
preferencesRepository.updateCustomGameMode(minefield)
|
||||
}
|
||||
|
||||
fun startCustomGame() {
|
||||
val intent = Intent(Intent.ACTION_VIEW).apply {
|
||||
data = Uri.parse(DeepLink.CUSTOM_NEW_GAME)
|
||||
addFlags(FLAG_ACTIVITY_NEW_TASK)
|
||||
addFlags(FLAG_ACTIVITY_CLEAR_TASK)
|
||||
addFlags(FLAG_ACTIVITY_NO_ANIMATION)
|
||||
}
|
||||
getApplication<Application>().startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import dev.lucasnlm.antimine.common.level.repository.ISavesRepository
|
|||
import dev.lucasnlm.antimine.common.level.repository.IStatsRepository
|
||||
import dev.lucasnlm.antimine.common.level.utils.Clock
|
||||
import dev.lucasnlm.antimine.common.level.utils.IHapticFeedbackManager
|
||||
import dev.lucasnlm.antimine.core.analytics.AnalyticsManager
|
||||
import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager
|
||||
import dev.lucasnlm.antimine.core.analytics.models.Analytics
|
||||
import dev.lucasnlm.antimine.core.control.ActionResponse
|
||||
import dev.lucasnlm.antimine.core.control.GameControl
|
||||
|
@ -42,7 +42,7 @@ class GameViewModel @ViewModelInject constructor(
|
|||
private val hapticFeedbackManager: IHapticFeedbackManager,
|
||||
private val soundManager: ISoundManager,
|
||||
private val minefieldRepository: IMinefieldRepository,
|
||||
private val analyticsManager: AnalyticsManager,
|
||||
private val analyticsManager: IAnalyticsManager,
|
||||
private val clock: Clock
|
||||
) : ViewModel() {
|
||||
val eventObserver = MutableLiveData<Event>()
|
||||
|
|
|
@ -4,7 +4,7 @@ import android.content.Context
|
|||
import android.util.Log
|
||||
import dev.lucasnlm.antimine.core.analytics.models.Analytics
|
||||
|
||||
class DebugAnalyticsManager : AnalyticsManager {
|
||||
class DebugAnalyticsManager : IAnalyticsManager {
|
||||
override fun setup(context: Context, userProperties: Map<String, String>) {
|
||||
Log.d(TAG, "Setup Analytics using $userProperties")
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package dev.lucasnlm.antimine.core.analytics
|
|||
import android.content.Context
|
||||
import dev.lucasnlm.antimine.core.analytics.models.Analytics
|
||||
|
||||
interface AnalyticsManager {
|
||||
interface IAnalyticsManager {
|
||||
fun setup(context: Context, userProperties: Map<String, String>)
|
||||
fun sentEvent(event: Analytics)
|
||||
}
|
|
@ -6,7 +6,7 @@ import dagger.Provides
|
|||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.android.components.ApplicationComponent
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import dev.lucasnlm.antimine.core.analytics.AnalyticsManager
|
||||
import dev.lucasnlm.antimine.core.analytics.IAnalyticsManager
|
||||
import dev.lucasnlm.antimine.core.analytics.DebugAnalyticsManager
|
||||
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository
|
||||
import dev.lucasnlm.antimine.core.preferences.PreferencesManager
|
||||
|
@ -28,7 +28,7 @@ class CommonModule {
|
|||
): PreferencesManager = PreferencesManager(context)
|
||||
|
||||
@Provides
|
||||
fun provideAnalyticsManager(): AnalyticsManager = DebugAnalyticsManager()
|
||||
fun provideAnalyticsManager(): IAnalyticsManager = DebugAnalyticsManager()
|
||||
|
||||
@Provides
|
||||
fun provideSoundManager(
|
||||
|
|
Loading…
Reference in a new issue