Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions automotive/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.ksp)
alias(libs.plugins.hilt)
alias(libs.plugins.google.services)
alias(libs.plugins.firebase.crashlytics)
}

android {
Expand All @@ -14,8 +12,8 @@ android {
applicationId = "com.chamika.dashtune"
minSdk = 28
targetSdk = 36
versionCode = 18
versionName = "1.2.2"
versionCode = 19
versionName = "1.2.3"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -84,11 +82,6 @@ dependencies {
implementation(libs.androidx.room.ktx)
ksp(libs.androidx.room.compiler)

// Firebase
implementation(platform(libs.firebase.bom))
implementation(libs.firebase.analytics)
implementation(libs.firebase.crashlytics)

testImplementation(libs.junit)
testImplementation(libs.mockk)
testImplementation(libs.robolectric)
Expand Down
29 changes: 0 additions & 29 deletions automotive/google-services.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,30 +1,7 @@
package com.chamika.dashtune

import android.app.Application
import android.util.Log
import com.chamika.dashtune.Constants.LOG_TAG
import com.google.firebase.Firebase
import com.google.firebase.analytics.analytics
import com.google.firebase.crashlytics.crashlytics
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class DashTuneApplication : Application() {
override fun onCreate() {
super.onCreate()

// Disable Firebase collection in debug builds.
// Wrapped in try-catch because Firebase depends on Google Play Services, which may not
// yet be ready shortly after a car software update (GMS can take several minutes to
// initialise on first boot after an OTA). Crashing here would prevent the media service
// from starting and cause the AAOS "Something went wrong" error dialog.
try {
if (BuildConfig.DEBUG) {
Firebase.analytics.setAnalyticsCollectionEnabled(false)
Firebase.crashlytics.setCrashlyticsCollectionEnabled(false)
}
} catch (e: Exception) {
Log.w(LOG_TAG, "Firebase init skipped – Google Play Services not ready yet", e)
}
}
}
class DashTuneApplication : Application()
39 changes: 5 additions & 34 deletions automotive/src/main/java/com/chamika/dashtune/FirebaseUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,26 @@ package com.chamika.dashtune

import android.util.Log
import com.chamika.dashtune.Constants.LOG_TAG
import com.google.firebase.crashlytics.FirebaseCrashlytics

object FirebaseUtils {

/**
* Records [e] to Firebase Crashlytics, swallowing any exception that might occur if Google
* Play Services is not yet available (e.g. shortly after a car OTA update).
*/
fun safeRecordException(e: Exception) {
try {
FirebaseCrashlytics.getInstance().recordException(e)
} catch (crashlyticsError: Exception) {
Log.w(LOG_TAG, "Crashlytics unavailable – Google Play Services not ready yet", crashlyticsError)
}
Log.w(LOG_TAG, "Exception recorded: ${e.message}", e)
}

/** Logs [message] to Firebase Crashlytics, safe against GMS unavailability. */
fun safeLog(message: String) {
try {
FirebaseCrashlytics.getInstance().log(message)
} catch (e: Exception) {
Log.w(LOG_TAG, "Crashlytics unavailable – Google Play Services not ready yet", e)
}
Log.i(LOG_TAG, message)
}

/** Sets a string custom key on Firebase Crashlytics, safe against GMS unavailability. */
fun safeSetCustomKey(key: String, value: String) {
try {
FirebaseCrashlytics.getInstance().setCustomKey(key, value)
} catch (e: Exception) {
Log.w(LOG_TAG, "Crashlytics unavailable – Google Play Services not ready yet", e)
}
Log.d(LOG_TAG, "[$key] $value")
}

/** Sets an int custom key on Firebase Crashlytics, safe against GMS unavailability. */
fun safeSetCustomKey(key: String, value: Int) {
try {
FirebaseCrashlytics.getInstance().setCustomKey(key, value)
} catch (e: Exception) {
Log.w(LOG_TAG, "Crashlytics unavailable – Google Play Services not ready yet", e)
}
Log.d(LOG_TAG, "[$key] $value")
}

/** Sets a boolean custom key on Firebase Crashlytics, safe against GMS unavailability. */
fun safeSetCustomKey(key: String, value: Boolean) {
try {
FirebaseCrashlytics.getInstance().setCustomKey(key, value)
} catch (e: Exception) {
Log.w(LOG_TAG, "Crashlytics unavailable – Google Play Services not ready yet", e)
}
Log.d(LOG_TAG, "[$key] $value")
}
}
155 changes: 0 additions & 155 deletions automotive/src/test/java/com/chamika/dashtune/FirebaseUtilsTest.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.chamika.dashtune.signin

import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import com.chamika.dashtune.auth.JellyfinAccountManager
import com.google.firebase.crashlytics.FirebaseCrashlytics
import io.mockk.every
import io.mockk.mockk
import io.mockk.mockkStatic
Expand Down Expand Up @@ -53,9 +52,6 @@ class SignInViewModelTest {
apiClient = mockk(relaxed = true)
systemApi = mockk(relaxed = true)

mockkStatic(FirebaseCrashlytics::class)
every { FirebaseCrashlytics.getInstance() } returns mockk(relaxed = true)

// Stub options before createApi so createApi$default can resolve default parameters
jellyfin = mockk(relaxed = true)
val mockOptions = mockk<JellyfinOptions>(relaxed = true)
Expand Down
2 changes: 0 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.ksp) apply false
alias(libs.plugins.hilt) apply false
alias(libs.plugins.google.services) apply false
alias(libs.plugins.firebase.crashlytics) apply false
}
8 changes: 0 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ jellyfinSdk = "1.8.6"
preferenceKtx = "1.2.1"
lifecycleViewmodel = "2.10.0"
concurrentFutures = "1.3.0"
firebaseBom = "34.9.0"
googleServices = "4.4.4"
firebaseCrashlyticsPlugin = "3.0.6"
slf4jAndroid = "1.7.36"
room = "2.7.1"
archCoreTesting = "2.2.0"
Expand All @@ -49,9 +46,6 @@ jellyfin-core = { group = "org.jellyfin.sdk", name = "jellyfin-core", version.re
okhttp = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp" }
hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" }
hilt-compiler = { group = "com.google.dagger", name = "hilt-compiler", version.ref = "hilt" }
firebase-bom = { group = "com.google.firebase", name = "firebase-bom", version.ref = "firebaseBom" }
firebase-analytics = { group = "com.google.firebase", name = "firebase-analytics" }
firebase-crashlytics = { group = "com.google.firebase", name = "firebase-crashlytics" }
slf4j-android = { group = "org.slf4j", name = "slf4j-android", version.ref = "slf4jAndroid" }
androidx-room-runtime = { group = "androidx.room", name = "room-runtime", version.ref = "room" }
androidx-room-ktx = { group = "androidx.room", name = "room-ktx", version.ref = "room" }
Expand All @@ -64,5 +58,3 @@ android-application = { id = "com.android.application", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
google-services = { id = "com.google.gms.google-services", version.ref = "googleServices" }
firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebaseCrashlyticsPlugin" }
Loading