Skip to content

Commit

Permalink
Small cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jakepurple13 committed Nov 16, 2023
1 parent 969a555 commit b34c177
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
}
}
Expand Down
5 changes: 3 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
1 change: 1 addition & 0 deletions sharedutils/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ dependencies {

fullImplementation(libs.mlkitTranslate)
fullImplementation(libs.mlkitLanguage)
fullImplementation(platform(libs.firebasePlatform))
fullImplementation(libs.firebaseDatabase)
fullImplementation(libs.firebaseFirestore)
fullImplementation(libs.firebaseAuth)
Expand Down
13 changes: 9 additions & 4 deletions sharedutils/src/full/java/FirebaseUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)*/
Expand All @@ -111,8 +112,12 @@ object FirebaseDb {

private fun <TResult> Task<TResult>.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<FirebaseDbModel> = emptyList())

Expand Down

0 comments on commit b34c177

Please sign in to comment.