Skip to content

Commit 5f7a909

Browse files
authored
Merge pull request #14 from splendo/upstream/merge-master
Upstream/merge master
2 parents a3ecd94 + 9558271 commit 5f7a909

File tree

60 files changed

+867
-248
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+867
-248
lines changed

.github/workflows/pull_request.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ jobs:
2222
run: chmod +x gradlew
2323
- name: Install Carthage
2424
run: brew list carthage || brew install carthage
25+
- name: Install Firebase tools
26+
run: npm install -g firebase-tools
27+
- name: Start Firebase emulator
28+
run: "firebase emulators:start --config=./test/firebase.json &"
2529
- name: Assemble
2630
run: ./gradlew assemble
2731
- name: Run JS Tests

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ firebase-database/src/iosMain/c_interop/modules/
1313
Firebase*.zip
1414
/Firebase
1515
/.DS_Store
16+
*.log
1617

1718

1819
/**/Cartfile.resolved

README.md

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
<h1 align="left">Firebase Kotlin SDK <img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/gitliveapp/firebase-kotlin-sdk?style=flat-square"> <a href="https://teamhub.dev"><img src="https://img.shields.io/badge/collaborate-on%20gitlive-blueviolet?style=flat-square"></a></h1>
1+
<h1 align="left">Firebase Kotlin SDK <img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/gitliveapp/firebase-kotlin-sdk?style=flat-square"> <a href="https://git.live"><img src="https://img.shields.io/badge/collaborate-on%20gitlive-blueviolet?style=flat-square"></a></h1>
22
<img align="left" width="75px" src="https://avatars2.githubusercontent.com/u/42865805?s=200&v=4">
3-
<b>Built and maintained with 🧡 by <a href="https://teamhub.dev">GitLive</a></b><br/>
3+
<b>Built and maintained with 🧡 by <a href="https://git.live">GitLive</a></b><br/>
44
<i>Real-time code collaboration inside any IDE</i><br/>
5-
🔓 <a href="https://teamhub.typeform.com/to/uSS8cv">Request Early Access</a>
6-
<h4></h4>
7-
5+
<br/>
6+
<br/>
87
The Firebase Kotlin SDK is a Kotlin-first SDK for Firebase. It's API is similar to the [Firebase Android SDK Kotlin Extensions](https://firebase.github.io/firebase-android-sdk/reference/kotlin/firebase-ktx/) but also supports multiplatform projects, enabling you to use Firebase directly from your common source targeting *iOS*, *Android* or *JS*.
98

109
## Available libraries
@@ -13,12 +12,12 @@ The following libraries are available for the various Firebase products.
1312

1413
| Service or Product | Gradle Dependency | API Coverage |
1514
| ------------------------------------------------------------------------------------ | :-----------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
16-
| [Authentication](https://firebase.google.com/docs/auth#kotlin-android) | [`dev.gitlive:firebase-auth:1.0.0`](https://search.maven.org/artifact/dev.gitlive/firebase-auth/1.0.0/pom) | [![80%](https://img.shields.io/badge/-80%25-green?style=flat-square)](/firebase-auth/src/commonMain/kotlin/dev/gitlive/firebase/auth/auth.kt) |
17-
| [Realtime Database](https://firebase.google.com/docs/database#kotlin-android) | [`dev.gitlive:firebase-database:1.0.0`](https://search.maven.org/artifact/dev.gitlive/firebase-database/1.0.0/pom) | [![70%](https://img.shields.io/badge/-70%25-orange?style=flat-square)](/firebase-database/src/commonMain/kotlin/dev/gitlive/firebase/database/database.kt) |
18-
| [Cloud Firestore](https://firebase.google.com/docs/firestore#kotlin-android) | [`dev.gitlive:firebase-firestore:1.0.0`](https://search.maven.org/artifact/dev.gitlive/firebase-firestore/1.0.0/pom) | [![60%](https://img.shields.io/badge/-60%25-orange?style=flat-square)](/firebase-firestore/src/commonMain/kotlin/dev/gitlive/firebase/firestore/firestore.kt) |
19-
| [Cloud Functions](https://firebase.google.com/docs/functions/callable#kotlin-android)| [`dev.gitlive:firebase-functions:1.0.0`](https://search.maven.org/artifact/dev.gitlive/firebase-functions/1.0.0/pom) | [![80%](https://img.shields.io/badge/-80%25-green?style=flat-square)](/firebase-functions/src/commonMain/kotlin/dev/gitlive/firebase/functions/functions.kt) |
20-
| [Cloud Messaging](https://firebase.google.com/docs/messaging#kotlin-android) | [`dev.gitlive:firebase-messaging:1.0.0`](https://search.maven.org/artifact/dev.gitlive/firebase-messaging/1.0.0/pom) | ![0%](https://img.shields.io/badge/-0%25-lightgrey?style=flat-square) |
21-
| [Cloud Storage](https://firebase.google.com/docs/storage#kotlin-android) | [`dev.gitlive:firebase-storage:1.0.0`](https://search.maven.org/artifact/dev.gitlive/firebase-storage/1.0.0/pom) | ![0%](https://img.shields.io/badge/-0%25-lightgrey?style=flat-square) |
15+
| [Authentication](https://firebase.google.com/docs/auth#kotlin-android) | [`dev.gitlive:firebase-auth:1.2.0`](https://search.maven.org/artifact/dev.gitlive/firebase-auth/1.2.0/pom) | [![80%](https://img.shields.io/badge/-80%25-green?style=flat-square)](/firebase-auth/src/commonMain/kotlin/dev/gitlive/firebase/auth/auth.kt) |
16+
| [Realtime Database](https://firebase.google.com/docs/database#kotlin-android) | [`dev.gitlive:firebase-database:1.2.0`](https://search.maven.org/artifact/dev.gitlive/firebase-database/1.2.0/pom) | [![70%](https://img.shields.io/badge/-70%25-orange?style=flat-square)](/firebase-database/src/commonMain/kotlin/dev/gitlive/firebase/database/database.kt) |
17+
| [Cloud Firestore](https://firebase.google.com/docs/firestore#kotlin-android) | [`dev.gitlive:firebase-firestore:1.2.0`](https://search.maven.org/artifact/dev.gitlive/firebase-firestore/1.2.0/pom) | [![60%](https://img.shields.io/badge/-60%25-orange?style=flat-square)](/firebase-firestore/src/commonMain/kotlin/dev/gitlive/firebase/firestore/firestore.kt) |
18+
| [Cloud Functions](https://firebase.google.com/docs/functions/callable#kotlin-android)| [`dev.gitlive:firebase-functions:1.2.0`](https://search.maven.org/artifact/dev.gitlive/firebase-functions/1.2.0/pom) | [![80%](https://img.shields.io/badge/-80%25-green?style=flat-square)](/firebase-functions/src/commonMain/kotlin/dev/gitlive/firebase/functions/functions.kt) |
19+
| [Cloud Messaging](https://firebase.google.com/docs/messaging#kotlin-android) | [`dev.gitlive:firebase-messaging:1.2.0`](https://search.maven.org/artifact/dev.gitlive/firebase-messaging/1.2.0/pom) | ![0%](https://img.shields.io/badge/-0%25-lightgrey?style=flat-square) |
20+
| [Cloud Storage](https://firebase.google.com/docs/storage#kotlin-android) | [`dev.gitlive:firebase-storage:1.2.0`](https://search.maven.org/artifact/dev.gitlive/firebase-storage/1.2.0/pom) | ![0%](https://img.shields.io/badge/-0%25-lightgrey?style=flat-square) |
2221

2322
Is the Firebase library or API you need missing? [Create an issue](https://github.com/GitLiveApp/firebase-kotlin-sdk/issues/new?labels=API+coverage&template=increase-api-coverage.md&title=Add+%5Bclass+name%5D.%5Bfunction+name%5D+to+%5Blibrary+name%5D+for+%5Bplatform+names%5D) to request additional API coverage or be awesome and [submit a PR](https://github.com/GitLiveApp/firebase-kotlin-sdk/fork)
2423

@@ -87,7 +86,7 @@ You can also omit the serializer but this is discouraged due to a [current limit
8786

8887
<h4><a href="https://firebase.google.com/docs/firestore/manage-data/add-data#server_timestamp">Server Timestamp</a></h3>
8988

90-
[Firestore](https://firebase.google.com/docs/reference/js/firebase.database.ServerValue#timestamp) and the [Realtime Database](https://firebase.google.com/docs/reference/android/com/google/firebase/database/ServerValue#TIMESTAMP) provide a sentinel value you can use to set a field in your document to a server timestamp. So you can use these values in custom classes they are of type `Double`:
89+
[Firestore](https://firebase.google.com/docs/reference/kotlin/com/google/firebase/firestore/FieldValue?hl=en#serverTimestamp()) and the [Realtime Database](https://firebase.google.com/docs/reference/android/com/google/firebase/database/ServerValue#TIMESTAMP) provide a sentinel value you can use to set a field in your document to a server timestamp. So you can use these values in custom classes they are of type `Double`:
9190

9291
```kotlin
9392
@Serializable
@@ -164,12 +163,12 @@ If you are building a Kotlin multiplatform library which will be consumed from J
164163

165164
```json
166165
"dependencies": {
167-
"@gitlive/firebase-auth": "1.0.0",
168-
"@gitlive/firebase-database": "1.0.0",
169-
"@gitlive/firebase-firestore": "1.0.0",
170-
"@gitlive/firebase-functions": "1.0.0",
171-
"@gitlive/firebase-storage": "1.0.0",
172-
"@gitlive/firebase-messaging": "1.0.0"
166+
"@gitlive/firebase-auth": "1.2.0",
167+
"@gitlive/firebase-database": "1.2.0",
168+
"@gitlive/firebase-firestore": "1.2.0",
169+
"@gitlive/firebase-functions": "1.2.0",
170+
"@gitlive/firebase-storage": "1.2.0",
171+
"@gitlive/firebase-messaging": "1.2.0"
173172
}
174173
```
175174

build.gradle.kts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
44
import org.gradle.api.tasks.testing.logging.TestLogEvent
55

66
plugins {
7-
kotlin("multiplatform") version "1.4.10" apply false
8-
id("de.undercouch.download").version("3.4.3")
7+
kotlin("multiplatform") version "1.4.21" apply false
8+
id("de.undercouch.download").version("4.1.1")
99
id("base")
1010
}
1111

@@ -19,8 +19,8 @@ buildscript {
1919
}
2020
}
2121
dependencies {
22-
classpath("com.android.tools.build:gradle:4.0.1")
23-
classpath("de.undercouch:gradle-download-task:4.0.4")
22+
classpath("com.android.tools.build:gradle:4.0.2")
23+
classpath("de.undercouch:gradle-download-task:4.1.1")
2424
classpath("com.adarshr:gradle-test-logger-plugin:2.0.0")
2525
}
2626
}
@@ -187,18 +187,18 @@ subprojects {
187187

188188
dependencies {
189189
"commonMainImplementation"(kotlin("stdlib-common"))
190-
"commonMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9")
190+
"commonMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2")
191191
"jsMainImplementation"(kotlin("stdlib-js"))
192-
"androidMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.3.9")
192+
"androidMainImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.4.2")
193193
"commonTestImplementation"(kotlin("test-common"))
194194
"commonTestImplementation"(kotlin("test-annotations-common"))
195-
"commonTestImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9")
195+
"commonTestImplementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2")
196196
"jsTestImplementation"(kotlin("test-js"))
197197
"androidAndroidTestImplementation"(kotlin("test-junit"))
198198
"androidAndroidTestImplementation"("junit:junit:4.13")
199-
"androidAndroidTestImplementation"("androidx.test:core:1.2.0")
200-
"androidAndroidTestImplementation"("androidx.test.ext:junit:1.1.1")
201-
"androidAndroidTestImplementation"("androidx.test:runner:1.2.0")
199+
"androidAndroidTestImplementation"("androidx.test:core:1.3.0")
200+
"androidAndroidTestImplementation"("androidx.test.ext:junit:1.1.2")
201+
"androidAndroidTestImplementation"("androidx.test:runner:1.3.0")
202202
}
203203
}
204204

firebase-app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ kotlin {
6868
}
6969
val androidMain by getting {
7070
dependencies {
71-
api("com.google.firebase:firebase-common:19.3.1")
71+
api("com.google.firebase:firebase-common:19.4.0")
7272
}
7373
}
7474

firebase-app/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitlive/firebase-app",
3-
"version": "0",
3+
"version": "1.0.0",
44
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
55
"main": "firebase-app.js",
66
"scripts": {
@@ -23,9 +23,9 @@
2323
},
2424
"homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk",
2525
"dependencies": {
26-
"@gitlive/firebase-common": "0",
27-
"firebase": "7.14.0",
28-
"kotlin": "1.3.72",
29-
"kotlinx-coroutines-core": "1.3.5"
26+
"@gitlive/firebase-common": "1.1.0",
27+
"firebase": "8.2.0",
28+
"kotlin": "1.4.21",
29+
"kotlinx-coroutines-core": "1.4.2"
3030
}
3131
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAnalyticsBinary.json" == 6.30.0
1+
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAnalyticsBinary.json" == 7.3.0

firebase-app/src/jsTest/kotlin/dev/gitlive/firebase/firebase.kt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,20 @@ import kotlinx.coroutines.promise
99

1010
actual val context: Any = Unit
1111

12-
actual fun runTest(test: suspend () -> Unit) = GlobalScope.promise { test() }.unsafeCast<Unit>()
12+
actual fun runTest(test: suspend () -> Unit) = GlobalScope
13+
.promise {
14+
try {
15+
test()
16+
} catch (e: dynamic) {
17+
e.log()
18+
throw e
19+
}
20+
}.asDynamic()
21+
22+
internal fun Throwable.log() {
23+
console.error(this)
24+
cause?.let {
25+
console.error("Caused by:")
26+
it.log()
27+
}
28+
}

firebase-auth/build.gradle.kts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ android {
3131
getByName("main") {
3232
manifest.srcFile("src/androidMain/AndroidManifest.xml")
3333
}
34-
getByName("androidTest").java.srcDir(file("src/androidAndroidTest/kotlin"))
34+
getByName("androidTest"){
35+
java.srcDir(file("src/androidAndroidTest/kotlin"))
36+
manifest.srcFile("src/androidAndroidTest/AndroidManifest.xml")
37+
}
3538
}
3639
testOptions {
3740
unitTests.apply {
@@ -99,7 +102,7 @@ kotlin {
99102

100103
val androidMain by getting {
101104
dependencies {
102-
api("com.google.firebase:firebase-auth:19.3.2")
105+
api("com.google.firebase:firebase-auth:20.0.1")
103106
}
104107
}
105108

firebase-auth/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gitlive/firebase-auth",
3-
"version": "0",
3+
"version": "1.0.0",
44
"description": "Wrapper around firebase for usage in Kotlin Multiplatform projects",
55
"main": "firebase-auth.js",
66
"scripts": {
@@ -23,9 +23,9 @@
2323
},
2424
"homepage": "https://github.com/GitLiveApp/firebase-kotlin-sdk",
2525
"dependencies": {
26-
"@gitlive/firebase-app": "0",
27-
"firebase": "7.14.0",
28-
"kotlin": "1.3.72",
29-
"kotlinx-coroutines-core": "1.3.5"
26+
"@gitlive/firebase-app": "1.1.0",
27+
"firebase": "8.2.0",
28+
"kotlin": "1.4.21",
29+
"kotlinx-coroutines-core": "1.4.2"
3030
}
3131
}

0 commit comments

Comments
 (0)