Skip to content

Commit ff85d16

Browse files
committed
Merge branch 'master' into refactor-web-version-9-shepeliev
# Conflicts: # firebase-auth/src/jsMain/kotlin/dev/gitlive/firebase/auth/user.kt # firebase-common/src/jsMain/kotlin/dev/gitlive/firebase/externals.kt # firebase-common/src/jsMain/kotlin/dev/gitlive/firebase/externals2.kt # firebase-database/src/jsMain/kotlin/dev/gitlive/firebase/database/database.kt # firebase-firestore/src/jsMain/kotlin/dev/gitlive/firebase/firestore/firestore.kt # firebase-functions/src/commonMain/kotlin/dev/gitlive/firebase/functions/functions.kt # firebase-functions/src/jsMain/kotlin/dev/gitlive/firebase/functions/functions.kt
2 parents cfbc082 + 849a19f commit ff85d16

File tree

93 files changed

+2184
-358
lines changed

Some content is hidden

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

93 files changed

+2184
-358
lines changed

.github/workflows/publish.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ jobs:
4242
run: ./gradlew :firebase-firestore:publish
4343
- name: Publish Firebase Functions
4444
run: ./gradlew :firebase-functions:publish
45+
- name: Publish Firebase Storage
46+
run: ./gradlew :firebase-storage:publish
4547
- name: Publish Firebase Installations
4648
run: ./gradlew :firebase-installations:publish
4749
- name: Publish Firebase Performance

README.md

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
11
<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">
33
<b>Built and maintained with 🧡 by <a href="https://git.live">GitLive</a></b><br/>
4-
<i>Real-time code collaboration inside any IDE</i><br/>
4+
<i>Development teams merge faster with GitLive</i><br/>
55
<br/>
66
<br/>
7-
The Firebase Kotlin SDK is a Kotlin-first SDK for Firebase. It's API is similar to the <a href="https://firebase.github.io/firebase-android-sdk/reference/kotlin/firebase-ktx/">Firebase Android SDK Kotlin Extensions</a> but also supports multiplatform projects, enabling you to use Firebase directly from your common source targeting <strong>iOS</strong>, <strong>Android</strong> or <strong>JS</strong>.
7+
The Firebase Kotlin SDK is a Kotlin-first SDK for Firebase. It's API is similar to the
8+
<a href="https://firebase.github.io/firebase-android-sdk/reference/kotlin/firebase-ktx/">Firebase Android SDK Kotlin Extensions</a>
9+
but also supports multiplatform projects, enabling you to use Firebase directly from your common source targeting
10+
<strong>iOS</strong>, <strong>Android</strong>, <strong>Desktop</strong> or <strong>Web</strong>, enabling the use of
11+
Firebase as a backend for<a href="https://www.jetbrains.com/lp/compose-multiplatform/">Compose Multiplatform</a>, for example.
812

913
## Available libraries
1014

1115
The following libraries are available for the various Firebase products.
1216

13-
| Service or Product | Gradle Dependency | API Coverage |
14-
|---------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
15-
| [Authentication](https://firebase.google.com/docs/auth) | [`dev.gitlive:firebase-auth:1.8.0`](https://search.maven.org/artifact/dev.gitlive/firebase-auth/1.8.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) | [`dev.gitlive:firebase-database:1.8.0`](https://search.maven.org/artifact/dev.gitlive/firebase-database/1.8.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) | [`dev.gitlive:firebase-firestore:1.8.0`](https://search.maven.org/artifact/dev.gitlive/firebase-firestore/1.8.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) | [`dev.gitlive:firebase-functions:1.8.0`](https://search.maven.org/artifact/dev.gitlive/firebase-functions/1.8.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/cloud-messaging) | [`dev.gitlive:firebase-messaging:1.8.0`](https://search.maven.org/artifact/dev.gitlive/firebase-messaging/1.8.0/pom) | ![0%](https://img.shields.io/badge/-0%25-lightgrey?style=flat-square) |
20-
| [Cloud Storage](https://firebase.google.com/docs/storage) | [`dev.gitlive:firebase-storage:1.8.0`](https://search.maven.org/artifact/dev.gitlive/firebase-storage/1.8.0/pom) | ![0%](https://img.shields.io/badge/-0%25-lightgrey?style=flat-square) |
21-
| [Installations](https://firebase.google.com/docs/projects/manage-installations) | [`dev.gitlive:firebase-installations:1.8.0`](https://search.maven.org/artifact/dev.gitlive/firebase-installations/1.8.0/pom) | [![90%](https://img.shields.io/badge/-90%25-green?style=flat-square)](/firebase-installations/src/commonMain/kotlin/dev/gitlive/firebase/installations/installations.kt) |
22-
| [Remote Config](https://firebase.google.com/docs/remote-config) | [`dev.gitlive:firebase-config:1.8.0`](https://search.maven.org/artifact/dev.gitlive/firebase-config/1.8.0/pom) | ![20%](https://img.shields.io/badge/-20%25-orange?style=flat-square) |
23-
| [Performance](https://firebase.google.com/docs/perf-mon) | [`dev.gitlive:firebase-perf:1.8.0`](https://search.maven.org/artifact/dev.gitlive/firebase-perf/1.8.0/pom) | ![1%](https://img.shields.io/badge/-1%25-orange?style=flat-square) |
24-
| [Crashlytics](https://firebase.google.com/docs/crashlytics) | [`dev.gitlive:firebase-crashlytics:1.8.0`](https://search.maven.org/artifact/dev.gitlive/firebase-crashlytics/1.8.0/pom) | ![80%](https://img.shields.io/badge/-1%25-orange?style=flat-square) |
25-
26-
27-
17+
| Service or Product | Gradle Dependency | API Coverage |
18+
|---------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
19+
| [Authentication](https://firebase.google.com/docs/auth) | [`dev.gitlive:firebase-auth:1.8.2`](https://search.maven.org/artifact/dev.gitlive/firebase-auth/1.8.2/pom) | [![80%](https://img.shields.io/badge/-80%25-green?style=flat-square)](/firebase-auth/src/commonMain/kotlin/dev/gitlive/firebase/auth/auth.kt) |
20+
| [Realtime Database](https://firebase.google.com/docs/database) | [`dev.gitlive:firebase-database:1.8.2`](https://search.maven.org/artifact/dev.gitlive/firebase-database/1.8.2/pom) | [![70%](https://img.shields.io/badge/-70%25-orange?style=flat-square)](/firebase-database/src/commonMain/kotlin/dev/gitlive/firebase/database/database.kt) |
21+
| [Cloud Firestore](https://firebase.google.com/docs/firestore) | [`dev.gitlive:firebase-firestore:1.8.2`](https://search.maven.org/artifact/dev.gitlive/firebase-firestore/1.8.2/pom) | [![60%](https://img.shields.io/badge/-60%25-orange?style=flat-square)](/firebase-firestore/src/commonMain/kotlin/dev/gitlive/firebase/firestore/firestore.kt) |
22+
| [Cloud Functions](https://firebase.google.com/docs/functions) | [`dev.gitlive:firebase-functions:1.8.2`](https://search.maven.org/artifact/dev.gitlive/firebase-functions/1.8.2/pom) | [![80%](https://img.shields.io/badge/-80%25-green?style=flat-square)](/firebase-functions/src/commonMain/kotlin/dev/gitlive/firebase/functions/functions.kt) |
23+
| [Cloud Messaging](https://firebase.google.com/docs/cloud-messaging) | [`dev.gitlive:firebase-messaging:1.8.2`](https://search.maven.org/artifact/dev.gitlive/firebase-messaging/1.8.2/pom) | ![0%](https://img.shields.io/badge/-0%25-lightgrey?style=flat-square) |
24+
| [Cloud Storage](https://firebase.google.com/docs/storage) | [`dev.gitlive:firebase-storage:1.8.2`](https://search.maven.org/artifact/dev.gitlive/firebase-storage/1.8.2/pom) | [![40%](https://img.shields.io/badge/-40%25-orange?style=flat-square)](/firebase-storage/src/commonMain/kotlin/dev/gitlive/firebase/storage/storage.kt) |
25+
| [Installations](https://firebase.google.com/docs/projects/manage-installations) | [`dev.gitlive:firebase-installations:1.8.2`](https://search.maven.org/artifact/dev.gitlive/firebase-installations/1.8.2/pom) | [![90%](https://img.shields.io/badge/-90%25-green?style=flat-square)](/firebase-installations/src/commonMain/kotlin/dev/gitlive/firebase/installations/installations.kt) |
26+
| [Remote Config](https://firebase.google.com/docs/remote-config) | [`dev.gitlive:firebase-config:1.8.2`](https://search.maven.org/artifact/dev.gitlive/firebase-config/1.8.2/pom) | [![20%](https://img.shields.io/badge/-20%25-orange?style=flat-square)](/firebase-config/src/commonMain/kotlin/dev/gitlive/firebase/remoteconfig/FirebaseRemoteConfig.kt) |
27+
| [Performance](https://firebase.google.com/docs/perf-mon) | [`dev.gitlive:firebase-perf:1.8.2`](https://search.maven.org/artifact/dev.gitlive/firebase-perf/1.8.2/pom) | [![1%](https://img.shields.io/badge/-1%25-orange?style=flat-square)](/firebase-perf/src/commonMain/kotlin/dev/gitlive/firebase/perf/performance.kt) |
28+
| [Crashlytics](https://firebase.google.com/docs/crashlytics) | [`dev.gitlive:firebase-crashlytics:1.8.2`](https://search.maven.org/artifact/dev.gitlive/firebase-crashlytics/1.8.2/pom) | [![80%](https://img.shields.io/badge/-1%25-orange?style=flat-square)](/firebase-crashlytics/src/commonMain/kotlin/dev/gitlive/firebase/crashlytics/crashlytics.kt) |
2829

2930
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)
3031

@@ -88,6 +89,7 @@ db.collection("cities").document("LA").set(City.serializer(), city, encodeDefaul
8889
```
8990

9091
The `encodeDefaults` parameter is optional and defaults to `true`, set this to false to omit writing optional properties if they are equal to theirs default values.
92+
Using [@EncodeDefault](https://kotlinlang.org/api/kotlinx.serialization/kotlinx-serialization-core/kotlinx.serialization/-encode-default/) on properties is a recommended way to locally override the behavior set with `encodeDefaults`.
9193

9294
You can also omit the serializer but this is discouraged due to a [current limitation on Kotlin/JS and Kotlin/Native](https://github.com/Kotlin/kotlinx.serialization/issues/1116#issuecomment-704342452)
9395

@@ -110,6 +112,21 @@ data class Post(
110112
)
111113
```
112114

115+
In addition `firebase-firestore` provides [GeoPoint] and [DocumentReference] classes which allow persisting
116+
geo points and document references in a native way:
117+
118+
```kotlin
119+
@Serializable
120+
data class PointOfInterest(
121+
val reference: DocumentReference,
122+
val location: GeoPoint
123+
)
124+
val document = PointOfInterest(
125+
reference = Firebase.firestore.collection("foo").document("bar"),
126+
location = GeoPoint(51.939, 4.506)
127+
)
128+
```
129+
113130
<h4>Polymorphic serialization (sealed classes)</h4>
114131

115132
This sdk will handle polymorphic serialization automatically if you have a sealed class and its children marked as `Serializable`. It will include a `type` property that will be used to discriminate which child class is the serialized.
@@ -189,6 +206,8 @@ In cases where it makes sense, such as Firebase Functions HTTPS Callable, operat
189206

190207
The Firebase Kotlin SDK provides a common API to access Firebase for projects targeting *iOS*, *Android* and *JS* meaning you can use Firebase directly in your common code. Under the hood, the SDK achieves this by binding to the respective official Firebase SDK for each supported platform.
191208

209+
It uses the <a href="https://github.com/GitLiveApp/firebase-java-sdk">Firebase Java SDK</a> to support the JVM target.
210+
192211
### Accessing the underlying Firebase SDK
193212

194213
In some cases you might want to access the underlying official Firebase SDK in platform specific code, for example when the common API is missing the functionality you need. For this purpose each class in the SDK has `android`, `ios` and `js` properties which holds the equivalent object of the underlying official Firebase SDK.
@@ -201,23 +220,10 @@ These properties are only accessible from the equivalent target's source set. Fo
201220
.build()
202221
```
203222

204-
### NPM modules
205-
206-
If you are building a Kotlin multiplatform library which will be consumed from JS code you may need to include the SDK in your `package.json`, you can do it as follows:
207-
208-
```json
209-
"dependencies": {
210-
"@gitlive/firebase-auth": "1.8.0",
211-
"@gitlive/firebase-config": "1.8.0",
212-
"@gitlive/firebase-database": "1.8.0",
213-
"@gitlive/firebase-firestore": "1.8.0",
214-
"@gitlive/firebase-functions": "1.8.0",
215-
"@gitlive/firebase-installations": "1.8.0",
216-
"@gitlive/firebase-messaging": "1.8.0",
217-
"@gitlive/firebase-storage": "1.8.0"
218-
"@gitlive/firebase-perf": "1.8.0"
219-
"@gitlive/firebase-crashlytics": "1.8.0"
220-
}
221-
```
222-
223-
223+
## Contributing
224+
If you'd like to contribute to this project then you can fork this repository.
225+
You can build and test the project locally.
226+
1. Open the project in IntelliJ IDEA.
227+
2. Install cocoapods via `sudo gem install -n /usr/local/bin cocoapods`
228+
3. Install the GitLive plugin into IntelliJ
229+
4. After a gradle sync then run `publishToMavenLocal`

0 commit comments

Comments
 (0)