mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
Add crashlitcs to app
This commit is contained in:
parent
d5c0d09035
commit
91b1f32d72
3 changed files with 25 additions and 0 deletions
|
|
@ -3,6 +3,8 @@ plugins {
|
|||
id 'org.jetbrains.kotlin.android'
|
||||
id 'kotlin-kapt'
|
||||
id 'dagger.hilt.android.plugin'
|
||||
id 'com.google.gms.google-services'
|
||||
id 'com.google.firebase.crashlytics'
|
||||
}
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
|
|
@ -111,6 +113,10 @@ dependencies {
|
|||
//Analytics
|
||||
implementation "com.amplitude:android-sdk:$amplitude_version"
|
||||
|
||||
implementation platform('com.google.firebase:firebase-bom:30.2.0')
|
||||
implementation 'com.google.firebase:firebase-crashlytics-ktx'
|
||||
implementation 'com.google.firebase:firebase-analytics-ktx'
|
||||
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
|
||||
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
|
||||
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
|
||||
|
|
|
|||
|
|
@ -2,6 +2,10 @@ package com.habitrpg.wearos.habitica
|
|||
|
||||
import android.app.Application
|
||||
import android.content.Intent
|
||||
import com.google.firebase.analytics.ktx.analytics
|
||||
import com.google.firebase.crashlytics.ktx.crashlytics
|
||||
import com.google.firebase.ktx.Firebase
|
||||
import com.habitrpg.android.habitica.BuildConfig
|
||||
import com.habitrpg.common.habitica.extensions.setupCoil
|
||||
import com.habitrpg.common.habitica.helpers.MarkdownParser
|
||||
import com.habitrpg.common.habitica.models.tasks.TaskType
|
||||
|
|
@ -30,6 +34,7 @@ class MainApplication : Application() {
|
|||
super.onCreate()
|
||||
MarkdownParser.setup(this)
|
||||
setupCoil()
|
||||
setupFirebase()
|
||||
|
||||
MainScope().launch {
|
||||
userRepository.getUser().onEach {
|
||||
|
|
@ -58,5 +63,18 @@ class MainApplication : Application() {
|
|||
taskRepository.retrieveTasks(user?.tasksOrder)
|
||||
}
|
||||
}
|
||||
|
||||
logLaunch()
|
||||
}
|
||||
|
||||
private fun logLaunch() {
|
||||
Firebase.analytics.logEvent("wear_launched", null)
|
||||
}
|
||||
|
||||
private fun setupFirebase() {
|
||||
if (!BuildConfig.DEBUG) {
|
||||
val crashlytics = Firebase.crashlytics
|
||||
crashlytics.setCustomKey("is_wear", true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -145,6 +145,7 @@ class MainActivity : BaseActivity<ActivityMainBinding, MainViewModel>() {
|
|||
}
|
||||
|
||||
private fun openTaskFormActivity() {
|
||||
throw RuntimeException("WEAR TEST")
|
||||
openTaskForm.launch(Intent(this, TaskFormActivity::class.java))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue