diff --git a/.gitignore b/.gitignore index 1b9a583..82c5134 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .idea/ .gradle/ +.kotlin/ build/ *.iml /local.properties diff --git a/README.md b/README.md index d44e302..432d6d7 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ You can add the library via Gradle: ```kotlin dependencies { - implementation("dev.gitlive:firebase-java-sdk:0.4.5") + implementation("dev.gitlive:firebase-java-sdk:0.4.6") } ``` @@ -35,7 +35,7 @@ Or Maven: dev.gitlive firebase-java-sdk - 0.4.5 + 0.4.6 ``` @@ -104,14 +104,15 @@ val app = Firebase.initialize(new Application(), options) The following libraries are available for the various Firebase products. -| Service or Product | Port of Android version | -|-----------------------------------------------------------------------------------|:------------------------| -| [Authentication](https://firebase.google.com/docs/auth) | N/A[^1] | -| [Cloud Firestore](https://firebase.google.com/docs/firestore) | `24.10.0` | -| [Realtime Database](https://firebase.google.com/docs/database) | `20.3.0` | -| [Cloud Functions](https://firebase.google.com/docs/functions) | `20.4.0` | -| ~[Remote Config](https://firebase.google.com/docs/remote-config)~ | `21.6.0`[^2] | -| ~[Installations](https://firebase.google.com/docs/projects/manage-installations)~ | `17.2.0`[^2] | +| Service or Product | Port of Android version | +|---------------------------------------------------------------------------------------------------|:------------------------| +| [Firebase Android BoM](https://maven.google.com/web/index.html?#com.google.firebase:firebase-bom) | `32.7.0` | +| [Authentication](https://firebase.google.com/docs/auth) | N/A[^1] | +| [Cloud Firestore](https://firebase.google.com/docs/firestore) | `24.10.0` | +| [Realtime Database](https://firebase.google.com/docs/database) | `20.3.0` | +| [Cloud Functions](https://firebase.google.com/docs/functions) | `20.4.0` | +| ~[Remote Config](https://firebase.google.com/docs/remote-config)~ | `21.6.0`[^2] | +| ~[Installations](https://firebase.google.com/docs/projects/manage-installations)~ | `17.2.0`[^2] | [^1]: Google has not open-sourced the Firebase Auth implementation for Android so a basic implementation using the Rest API is provided. [^2]: Although the libraries are inlcuded they are currently not funtional diff --git a/build.gradle.kts b/build.gradle.kts index e9f40bf..bf3b0dc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,4 @@ +import java.util.Locale buildscript { repositories { @@ -86,7 +87,7 @@ val jar by tasks.getting(Jar::class) { val sourceSets = project.the() val cleanLibs by tasks.creating(Delete::class) { - delete("$buildDir/libs") + delete("$${layout.buildDirectory.asFile.get().path}/libs") } publishing { @@ -146,9 +147,11 @@ publishing { dependencies { compileOnly(libs.robolectric.android.all) testImplementation(libs.junit) - testImplementation(libs.kotlinx.coroutines.swing) testImplementation(libs.kotlinx.coroutines.play.services) + testImplementation(libs.kotlinx.coroutines.swing) + testImplementation(libs.kotlinx.coroutines.test) // firebase aars + aar(platform(libs.google.firebase.bom)) aar(libs.google.firebase.firestore) aar(libs.google.firebase.functions) aar(libs.google.firebase.database) @@ -195,7 +198,8 @@ signing { tasks.withType { fun isNonStable(version: String): Boolean { - val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) } + val stableKeyword = listOf("RELEASE", "FINAL", "GA") + .any { version.uppercase(Locale.ROOT).contains(it) } val versionMatch = "^[0-9,.v-]+(-r)?$".toRegex().matches(version) return (stableKeyword || versionMatch).not() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a1910e3..6673045 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,7 @@ [versions] androidx-lifecycle = "2.9.0-alpha01" ben-manes-versions = "0.51.0" +google-firebase-bom = "32.7.0" io-grpc = "1.66.0" jlleitschuh-ktlint = "12.1.1" kotlin = "2.0.20" @@ -12,11 +13,12 @@ ktlint = "0.47.1" androidx-collection = { module = "androidx.collection:collection", version = "1.4.3" } androidx-lifecycle-common = { module = "androidx.lifecycle:lifecycle-common", version.ref = "androidx-lifecycle" } androidx-lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel", version.ref = "androidx-lifecycle" } -google-firebase-config = { module = "com.google.firebase:firebase-config", version = "21.6.0" } -google-firebase-database = { module = "com.google.firebase:firebase-database", version = "20.3.0" } -google-firebase-firestore = { module = "com.google.firebase:firebase-firestore", version = "24.10.0" } -google-firebase-functions = { module = "com.google.firebase:firebase-functions", version = "20.4.0" } -google-firebase-installations = { module = "com.google.firebase:firebase-installations", version = "17.2.0" } +google-firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "google-firebase-bom" } +google-firebase-config = { module = "com.google.firebase:firebase-config" } +google-firebase-database = { module = "com.google.firebase:firebase-database" } +google-firebase-firestore = { module = "com.google.firebase:firebase-firestore" } +google-firebase-functions = { module = "com.google.firebase:firebase-functions" } +google-firebase-installations = { module = "com.google.firebase:firebase-installations" } io-grpc-okhttp = { module = "io.grpc:grpc-okhttp", version.ref = "io-grpc" } io-grpc-protobuf-lite = { module = "io.grpc:grpc-protobuf-lite", version.ref = "io-grpc" } io-grpc-stub = { module = "io.grpc:grpc-stub", version.ref = "io-grpc" } @@ -25,6 +27,7 @@ junit = { module = "junit:junit", version = "4.13.2" } kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } kotlinx-coroutines-play-services = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-play-services", version.ref = "kotlinx-coroutines" } kotlinx-coroutines-swing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" } kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinx-serialization" } kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" } okhttp = { module = "com.squareup.okhttp3:okhttp", version = "3.12.13" } diff --git a/src/main/java/android/os/Looper.java b/src/main/java/android/os/Looper.java index d0b570d..420dc88 100644 --- a/src/main/java/android/os/Looper.java +++ b/src/main/java/android/os/Looper.java @@ -5,6 +5,10 @@ public class Looper { private static final Looper main = new Looper(); + public Thread getThread() { + return Thread.currentThread(); + } + public static Looper getMainLooper() { return main; } diff --git a/src/test/kotlin/FirestoreTest.kt b/src/test/kotlin/FirestoreTest.kt index 50677f4..95afc48 100644 --- a/src/test/kotlin/FirestoreTest.kt +++ b/src/test/kotlin/FirestoreTest.kt @@ -4,8 +4,8 @@ import com.google.firebase.FirebaseOptions import com.google.firebase.FirebasePlatform import com.google.firebase.firestore.firestore import com.google.firebase.initialize -import kotlinx.coroutines.runBlocking import kotlinx.coroutines.tasks.await +import kotlinx.coroutines.test.runTest import org.junit.Assert.assertEquals import org.junit.Before import org.junit.Test @@ -34,7 +34,7 @@ class FirestoreTest : FirebaseTest() { } @Test - fun testFirestore(): Unit = runBlocking { + fun testFirestore(): Unit = runTest { val data = Data("jim") val doc = Firebase.firestore.document("sally/jim") doc.set(data)