diff --git a/UIViews/src/main/java/com/programmersbox/uiviews/BaseMainActivity.kt b/UIViews/src/main/java/com/programmersbox/uiviews/BaseMainActivity.kt index eb909fc48..55834a561 100644 --- a/UIViews/src/main/java/com/programmersbox/uiviews/BaseMainActivity.kt +++ b/UIViews/src/main/java/com/programmersbox/uiviews/BaseMainActivity.kt @@ -232,8 +232,7 @@ abstract class BaseMainActivity : AppCompatActivity() { ) { NavHost( navController = navController, - //startDestination = Screen.RecentScreen.route, - startDestination = Screen.Settings.route + startDestination = Screen.RecentScreen.route, ) { navGraph(customPreferences, windowSize) } } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 12a4a8f4d..47dc2ef72 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -269,8 +269,9 @@ androidxWebkit = "androidx.webkit:webkit:1.8.0" mlkitTranslate = "com.google.mlkit:translate:17.0.2" mlkitLanguage = "com.google.mlkit:language-id:17.0.4" -firebaseDatabase = "com.google.firebase:firebase-database-ktx:20.3.0" -firebaseFirestore = "com.google.firebase:firebase-firestore-ktx:24.9.1" +firebasePlatform = "com.google.firebase:firebase-bom:32.5.0" +firebaseDatabase = { group = "com.google.firebase", name = "firebase-database" } +firebaseFirestore = { group = "com.google.firebase", name = "firebase-firestore" } firebaseUiAuth = "com.firebaseui:firebase-ui-auth:8.0.2" protobufJava = { module = "com.google.protobuf:protobuf-javalite", version.ref = "protobufVersion" } diff --git a/sharedutils/build.gradle.kts b/sharedutils/build.gradle.kts index ef46e96b5..c5df2b471 100644 --- a/sharedutils/build.gradle.kts +++ b/sharedutils/build.gradle.kts @@ -36,6 +36,7 @@ dependencies { fullImplementation(libs.mlkitTranslate) fullImplementation(libs.mlkitLanguage) + fullImplementation(platform(libs.firebasePlatform)) fullImplementation(libs.firebaseDatabase) fullImplementation(libs.firebaseFirestore) fullImplementation(libs.firebaseAuth) diff --git a/sharedutils/src/full/java/FirebaseUtils.kt b/sharedutils/src/full/java/FirebaseUtils.kt index 772e695f8..85f477037 100644 --- a/sharedutils/src/full/java/FirebaseUtils.kt +++ b/sharedutils/src/full/java/FirebaseUtils.kt @@ -16,7 +16,8 @@ import com.google.firebase.firestore.FieldValue import com.google.firebase.firestore.FirebaseFirestore import com.google.firebase.firestore.FirebaseFirestoreSettings import com.google.firebase.firestore.ListenerRegistration -import com.google.firebase.firestore.ktx.toObjects +import com.google.firebase.firestore.PersistentCacheSettings +import com.google.firebase.firestore.toObjects import com.programmersbox.favoritesdatabase.ChapterWatched import com.programmersbox.favoritesdatabase.DbModel import kotlinx.coroutines.channels.awaitClose @@ -100,7 +101,7 @@ object FirebaseDb { @SuppressLint("StaticFieldLeak") private val db = FirebaseFirestore.getInstance().apply { firestoreSettings = FirebaseFirestoreSettings.Builder() - .setPersistenceEnabled(true) + .setLocalCacheSettings(PersistentCacheSettings.newBuilder().build()) /*.setHost("10.0.2.2:8080") .setSslEnabled(false) .setPersistenceEnabled(false)*/ @@ -111,8 +112,12 @@ object FirebaseDb { private fun Task.await(): TResult = Tasks.await(this) - private val showDoc2 get() = FirebaseAuthentication.currentUser?.let { db.collection(COLLECTION_ID).document(DOCUMENT_ID).collection(it.uid) } - private val episodeDoc2 get() = FirebaseAuthentication.currentUser?.let { db.collection(COLLECTION_ID).document(CHAPTERS_ID).collection(it.uid) } + private val showDoc2 get() = FirebaseAuthentication.currentUser?.let { + runCatching { db.collection(COLLECTION_ID).document(DOCUMENT_ID).collection(it.uid) }.getOrNull() + } + private val episodeDoc2 get() = FirebaseAuthentication.currentUser?.let { + runCatching { db.collection(COLLECTION_ID).document(CHAPTERS_ID).collection(it.uid) }.getOrNull() + } private data class FirebaseAllShows(val first: String = DOCUMENT_ID, val second: List = emptyList())