├── .github └── workflows │ └── main.yml ├── .gitignore ├── .idea ├── .gitignore ├── .name ├── codeStyles │ ├── Project.xml │ └── codeStyleConfig.xml ├── compiler.xml ├── copyright │ ├── Apache_2_0.xml │ └── profiles_settings.xml ├── git_toolbox_prj.xml ├── gradle.xml ├── jarRepositories.xml ├── misc.xml └── vcs.xml ├── .opensource └── project.json ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── io │ │ └── github │ │ └── horaciocome1 │ │ └── firestore_flow │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── horaciocome1 │ │ │ └── firestore_flow │ │ │ └── MainActivity.kt │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── values-night │ │ └── themes.xml │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── themes.xml │ └── test │ └── java │ └── io │ └── github │ └── horaciocome1 │ └── firestore_flow │ └── ExampleUnitTest.kt ├── build.gradle ├── fireflow ├── .gitignore ├── build.gradle ├── consumer-rules.pro ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── io │ │ └── github │ │ └── horaciocome1 │ │ └── fireflow │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ └── java │ │ └── io │ │ └── github │ │ └── horaciocome1 │ │ └── fireflow │ │ ├── Extensions.kt │ │ └── Snapshot.kt │ └── test │ └── java │ └── io │ └── github │ └── horaciocome1 │ └── fireflow │ └── ExampleUnitTest.kt ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── jitpack.yml └── settings.gradle /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Android CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - develop 7 | pull_request: 8 | branches: 9 | - develop 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | 17 | - name: set up JDK 18 | uses: actions/setup-java@v1 19 | with: 20 | java-version: 11 21 | 22 | - name: Cache Gradle and wrapper 23 | uses: actions/cache@v2 24 | with: 25 | path: | 26 | ~/.gradle/caches 27 | ~/.gradle/wrapper 28 | key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} 29 | restore-keys: | 30 | ${{ runner.os }}-gradle- 31 | 32 | - name: Make Gradle executable 33 | run: chmod +x ./gradlew 34 | 35 | - name: Build with Gradle 36 | run: ./gradlew build 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | local.properties 16 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | firestore-flow -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 116 | 117 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/copyright/Apache_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/git_toolbox_prj.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.opensource/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fireflow", 3 | 4 | "platforms": [ 5 | "Android" 6 | ], 7 | 8 | "content": "README.md", 9 | 10 | "related": [ 11 | "firebase/firebase-android-sdk" 12 | ] 13 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # fireflow 2 | [![](https://jitpack.io/v/horaciocome1/fireflow.svg)](https://jitpack.io/#horaciocome1/fireflow) [![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0) [![API](https://img.shields.io/badge/API-19%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=19) 3 | 4 | ## Getting Started 5 | Android library that aims to hide Firebase Firestore listener implementation and expose only a Kotlin Flow of specified type. ;) 6 | Works for ColletionReferences, Queries, and DocumentReferences. 7 | 8 | ## Pre-requisites 9 | Check the pre-requisites for Firebase Firestore and for Kotlin Flow on respective documentation. 10 | Be familiar with Kotlin Coroutines. 11 | Based on versions **24.0.0** and **1.4.1** of _firebase-firestore-ktx_ and _kotlinx-coroutines-play-services_ respectively 12 | 13 | ## Adding to your project 14 | Lets start by adding a corresponding repository in your _root_ `build.gradle` file. 15 | ```gradle 16 | allprojects { 17 | repositories { 18 | .. 19 | maven { url 'https://jitpack.io' } 20 | } 21 | } 22 | ``` 23 | The next task is to add the dependency to your _app_ `build.gradle` file. [![](https://jitpack.io/v/horaciocome1/fireflow.svg)](https://jitpack.io/#horaciocome1/fireflow) 24 | ```gradle 25 | dependencies { 26 | .. 27 | implementation 'com.github.horaciocome1:fireflow:$VERSION' 28 | } 29 | ``` 30 | Now you ready to go. 31 | You might want to _**sync your project**_ first. ;) 32 | 33 | ## How to use 34 | ### without fireflow 35 | ```kotlin 36 | val db = FirebaseFirestore.getInstance() 37 | val ref = db.collection("posts") 38 | ref.addSnapshotListener { snapshot, error -> 39 | if (error != null) { 40 | // handle 41 | } else if (snapshot != null) { 42 | val posts = snapshot.toObjects(Post::class.java) 43 | // set posts to UI 44 | } 45 | } 46 | ``` 47 | ### with fireflow 48 | ```kotlin 49 | val db = FirebaseFirestore.getInstance() 50 | db.collection("posts").asFlow().collect { posts -> 51 | // set posts to UI 52 | } 53 | ``` 54 | You can also specify a `coroutineContext`. Default is `Dispatchers.IO`. 55 | ```kotlin 56 | val db = FirebaseFirestore.getInstance() 57 | db.collection("posts").asFlow(coroutineContext = Dispatchers.Main).collect { posts -> 58 | // set posts to UI 59 | } 60 | ``` 61 | You can also read documents as flows 62 | ```kotlin 63 | val db = FirebaseFirestore.getInstance() 64 | db.collection("posts").document("1") 65 | .asFlow().collect { post -> 66 | // set post to UI 67 | } 68 | ``` 69 | You can also serve as livedata (if you are using Jetpack Lifecycle) 70 | ```kotlin 71 | val db = FirebaseFirestore.getInstance() 72 | db.collection("posts").document("1") 73 | .asFlow() 74 | .asLivedata() 75 | ``` 76 | You can also get the snapshot itself (_"we never know ..."_) 77 | ```kotlin 78 | val db = FirebaseFirestore.getInstance() 79 | db.collection("posts").document("1") 80 | .snapshotAsFlow().collect { snapshot -> 81 | // handle 82 | } 83 | ``` 84 | 85 | ## Troubleshooting 86 | There is no Java support. 87 | For other things please open an Issue or reach me via [hcome@pm.me](mailto:hcome@pm.me) 88 | 89 | ## Licenses 90 | Copyright 2021 Horácio Flávio Comé Júnior 91 | 92 | Licensed under the Apache License, Version 2.0 (the "License"); 93 | you may not use this file except in compliance with the License. 94 | You may obtain a copy of the License at 95 | 96 | http://www.apache.org/licenses/LICENSE-2.0 97 | 98 | Unless required by applicable law or agreed to in writing, software 99 | distributed under the License is distributed on an "AS IS" BASIS, 100 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 101 | See the License for the specific language governing permissions and 102 | limitations under the License. 103 | ### Not maintained by us 104 | [Firebase Firestore](https://firebase.google.com/docs/firestore/) is a product from Google. 105 | [Kotlin](https://kotlinlang.org/) is a product from Jetbrains. 106 | 107 | ## How to contribute 108 | We open to suggestions of any kind. 109 | Email me, open pull requests, etc. 110 | 111 | ## More 112 | Hope you development experience gets smootherrrrr. 113 | If you want to see another utility please check my work on Recyclerview. 114 | [Simple RecyclerView Listener](https://github.com/horaciocome1/simple-recyclerview-listener) 115 | [Simple RecyclerView Adapter](https://github.com/horaciocome1/simple-recyclerview-adapter) 116 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Horácio Flávio Comé Júnior 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | plugins { 18 | id 'com.android.application' 19 | id 'kotlin-android' 20 | } 21 | 22 | android { 23 | compileSdkVersion 32 24 | 25 | defaultConfig { 26 | applicationId "io.github.horaciocome1.firestore_flow" 27 | minSdkVersion 19 28 | targetSdkVersion 32 29 | versionCode 1 30 | versionName "1.0" 31 | 32 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 33 | } 34 | 35 | buildTypes { 36 | release { 37 | minifyEnabled false 38 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 39 | } 40 | } 41 | compileOptions { 42 | sourceCompatibility JavaVersion.VERSION_1_8 43 | targetCompatibility JavaVersion.VERSION_1_8 44 | } 45 | kotlinOptions { 46 | jvmTarget = '1.8' 47 | } 48 | } 49 | 50 | dependencies { 51 | implementation 'androidx.core:core-ktx:1.7.0' 52 | implementation 'androidx.appcompat:appcompat:1.4.1' 53 | implementation 'com.google.android.material:material:1.5.0' 54 | implementation 'androidx.constraintlayout:constraintlayout:2.1.3' 55 | testImplementation 'junit:junit:4.13.2' 56 | androidTestImplementation 'androidx.test.ext:junit:1.1.3' 57 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' 58 | } -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /app/src/androidTest/java/io/github/horaciocome1/firestore_flow/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package io.github.horaciocome1.firestore_flow 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("io.github.horaciocome1.firestore_flow", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/java/io/github/horaciocome1/firestore_flow/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package io.github.horaciocome1.firestore_flow 2 | 3 | import androidx.appcompat.app.AppCompatActivity 4 | import android.os.Bundle 5 | //import com.google.firebase.firestore.FirebaseFirestore 6 | //import com.google.firebase.firestore.Query 7 | //import kotlinx.coroutines.ExperimentalCoroutinesApi 8 | //import kotlinx.coroutines.flow.collect 9 | 10 | class MainActivity : AppCompatActivity() { 11 | 12 | class Post 13 | 14 | class User 15 | 16 | class Topic 17 | 18 | override fun onCreate(savedInstanceState: Bundle?) { 19 | super.onCreate(savedInstanceState) 20 | setContentView(R.layout.activity_main) 21 | } 22 | 23 | // // common way 24 | // fun getPostsA() { 25 | // val db = FirebaseFirestore.getInstance() 26 | // val ref = db.collection("posts") 27 | // ref.addSnapshotListener { snapshot, error -> 28 | // if (error != null) { 29 | // // handle 30 | // } else if (snapshot != null) { 31 | // val posts = snapshot.toObjects(Post::class.java) 32 | // // set posts to UI 33 | // } 34 | // } 35 | // } 36 | // 37 | // // with fireflow 38 | // @ExperimentalCoroutinesApi 39 | // suspend fun getPostsB() { 40 | // val db = FirebaseFirestore.getInstance() 41 | // db.collection("posts").getAsFlow().collect { posts -> 42 | // // set posts to UI 43 | // } 44 | // } 45 | // 46 | // // with fireflow document 47 | // @ExperimentalCoroutinesApi 48 | // suspend fun getPost() { 49 | // val db = FirebaseFirestore.getInstance() 50 | // db.collection("posts") 51 | // .document("1") 52 | // .getAsFlow().collect { post -> 53 | // // set post to UI 54 | // } 55 | // } 56 | 57 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horaciocome1/fireflow/383b530504fd6d8215bb271fbfce0a7d66247cf3/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horaciocome1/fireflow/383b530504fd6d8215bb271fbfce0a7d66247cf3/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horaciocome1/fireflow/383b530504fd6d8215bb271fbfce0a7d66247cf3/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horaciocome1/fireflow/383b530504fd6d8215bb271fbfce0a7d66247cf3/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horaciocome1/fireflow/383b530504fd6d8215bb271fbfce0a7d66247cf3/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horaciocome1/fireflow/383b530504fd6d8215bb271fbfce0a7d66247cf3/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horaciocome1/fireflow/383b530504fd6d8215bb271fbfce0a7d66247cf3/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horaciocome1/fireflow/383b530504fd6d8215bb271fbfce0a7d66247cf3/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horaciocome1/fireflow/383b530504fd6d8215bb271fbfce0a7d66247cf3/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horaciocome1/fireflow/383b530504fd6d8215bb271fbfce0a7d66247cf3/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | firestore-flow 3 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/test/java/io/github/horaciocome1/firestore_flow/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package io.github.horaciocome1.firestore_flow 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Horácio Flávio Comé Júnior 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 18 | buildscript { 19 | repositories { 20 | google() 21 | mavenCentral() 22 | } 23 | dependencies { 24 | classpath 'com.android.tools.build:gradle:7.1.2' 25 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10" 26 | 27 | // NOTE: Do not place your application dependencies here; they belong 28 | // in the individual module build.gradle files 29 | } 30 | } 31 | 32 | allprojects { 33 | repositories { 34 | google() 35 | mavenCentral() 36 | } 37 | } 38 | 39 | task clean(type: Delete) { 40 | delete rootProject.buildDir 41 | } -------------------------------------------------------------------------------- /fireflow/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /fireflow/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Horácio Flávio Comé Júnior 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | plugins { 18 | id 'com.android.library' 19 | id 'kotlin-android' 20 | id 'maven-publish' 21 | } 22 | 23 | group = 'com.github.horaciocome1.fireflow' 24 | version = '0.0.6' 25 | 26 | android { 27 | compileSdkVersion 32 28 | 29 | defaultConfig { 30 | minSdkVersion 19 31 | targetSdkVersion 32 32 | versionCode 11 33 | versionName "0.0.6" 34 | 35 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 36 | consumerProguardFiles "consumer-rules.pro" 37 | } 38 | 39 | buildTypes { 40 | release { 41 | minifyEnabled false 42 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 43 | } 44 | } 45 | compileOptions { 46 | sourceCompatibility JavaVersion.VERSION_1_8 47 | targetCompatibility JavaVersion.VERSION_1_8 48 | } 49 | kotlinOptions { 50 | jvmTarget = '1.8' 51 | } 52 | } 53 | 54 | dependencies { 55 | implementation 'androidx.core:core-ktx:1.7.0' 56 | implementation 'com.google.firebase:firebase-firestore-ktx:24.0.1' 57 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.4.1" 58 | testImplementation 'junit:junit:4.13.2' 59 | androidTestImplementation 'androidx.test.ext:junit:1.1.3' 60 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' 61 | } 62 | 63 | afterEvaluate { 64 | publishing { 65 | publications { 66 | // Creates a Maven publication called "release". 67 | release(MavenPublication) { 68 | from components.release 69 | groupId = 'com.github.horaciocome1.fireflow' 70 | artifactId = 'fireflow' 71 | version = '0.0.6' 72 | } 73 | } 74 | } 75 | } -------------------------------------------------------------------------------- /fireflow/consumer-rules.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horaciocome1/fireflow/383b530504fd6d8215bb271fbfce0a7d66247cf3/fireflow/consumer-rules.pro -------------------------------------------------------------------------------- /fireflow/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /fireflow/src/androidTest/java/io/github/horaciocome1/fireflow/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package io.github.horaciocome1.fireflow 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("io.github.horaciocome1.fireflow.test", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /fireflow/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /fireflow/src/main/java/io/github/horaciocome1/fireflow/Extensions.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Horácio Flávio Comé Júnior 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.horaciocome1.fireflow 18 | 19 | import com.google.firebase.firestore.DocumentReference 20 | import com.google.firebase.firestore.Query 21 | import kotlinx.coroutines.Dispatchers 22 | import kotlinx.coroutines.ExperimentalCoroutinesApi 23 | import kotlinx.coroutines.flow.Flow 24 | import kotlinx.coroutines.flow.map 25 | import kotlin.coroutines.CoroutineContext 26 | 27 | /** 28 | * returns a flow that listens to querySnapshot changes and offers them 29 | * @param coroutineContext default is Dispatchers.IO 30 | */ 31 | @ExperimentalCoroutinesApi 32 | inline fun Query.asFlow( 33 | coroutineContext: CoroutineContext = Dispatchers.IO, 34 | ): Flow> = snapshotAsFlow(coroutineContext).map { 35 | it?.toObjects(T::class.java) ?: mutableListOf() 36 | } 37 | 38 | /** 39 | * returns a flow that listens to documentSnapshot changes and offers them 40 | * @param coroutineContext default is Dispatchers.IO 41 | */ 42 | @ExperimentalCoroutinesApi 43 | inline fun DocumentReference.asFlow( 44 | coroutineContext: CoroutineContext = Dispatchers.IO, 45 | ): Flow = snapshotAsFlow(coroutineContext).map { 46 | it?.toObject(T::class.java) 47 | } 48 | -------------------------------------------------------------------------------- /fireflow/src/main/java/io/github/horaciocome1/fireflow/Snapshot.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Horácio Flávio Comé Júnior 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package io.github.horaciocome1.fireflow 18 | 19 | import com.google.firebase.FirebaseException 20 | import com.google.firebase.firestore.DocumentReference 21 | import com.google.firebase.firestore.DocumentSnapshot 22 | import com.google.firebase.firestore.EventListener 23 | import com.google.firebase.firestore.FirebaseFirestoreException 24 | import com.google.firebase.firestore.Query 25 | import com.google.firebase.firestore.QuerySnapshot 26 | import kotlinx.coroutines.Dispatchers 27 | import kotlinx.coroutines.ExperimentalCoroutinesApi 28 | import kotlinx.coroutines.channels.awaitClose 29 | import kotlinx.coroutines.flow.Flow 30 | import kotlinx.coroutines.flow.callbackFlow 31 | import kotlinx.coroutines.flow.flowOn 32 | import kotlin.coroutines.CoroutineContext 33 | 34 | /** 35 | * returns a flow that listens to documentSnapshot changes and offer it 36 | * @param coroutineContext default is Dispatchers.IO 37 | */ 38 | @ExperimentalCoroutinesApi 39 | fun DocumentReference.snapshotAsFlow( 40 | coroutineContext: CoroutineContext = Dispatchers.IO, 41 | ): Flow = callbackFlow { 42 | try { 43 | val listener = EventListener { snapshot, error -> 44 | if (error != null) { 45 | close(error) 46 | return@EventListener 47 | } 48 | offer(snapshot) 49 | } 50 | val registration = addSnapshotListener(listener) 51 | awaitClose { registration.remove() } 52 | } catch (e: FirebaseFirestoreException) { 53 | close(e) 54 | } catch (e: FirebaseException) { 55 | close(e) 56 | } 57 | }.flowOn(coroutineContext) 58 | 59 | /** 60 | * returns a flow that listens to querySnapshot changes and offer it 61 | * @param coroutineContext default is Dispatchers.IO 62 | */ 63 | @ExperimentalCoroutinesApi 64 | fun Query.snapshotAsFlow( 65 | coroutineContext: CoroutineContext = Dispatchers.IO, 66 | ): Flow = callbackFlow { 67 | try { 68 | val listener = EventListener { snapshot, error -> 69 | if (error != null) { 70 | close(error) 71 | return@EventListener 72 | } 73 | offer(snapshot) 74 | } 75 | val registration = addSnapshotListener(listener) 76 | awaitClose { registration.remove() } 77 | } catch (e: FirebaseFirestoreException) { 78 | close(e) 79 | } catch (e: FirebaseException) { 80 | close(e) 81 | } 82 | }.flowOn(coroutineContext) 83 | -------------------------------------------------------------------------------- /fireflow/src/test/java/io/github/horaciocome1/fireflow/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package io.github.horaciocome1.fireflow 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2022 Horácio Flávio Comé Júnior 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # Project-wide Gradle settings. 18 | # IDE (e.g. Android Studio) users: 19 | # Gradle settings configured through the IDE *will override* 20 | # any settings specified in this file. 21 | # For more details on how to configure your build environment visit 22 | # http://www.gradle.org/docs/current/userguide/build_environment.html 23 | # Specifies the JVM arguments used for the daemon process. 24 | # The setting is particularly useful for tweaking memory settings. 25 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 26 | # When configured, Gradle will run in incubating parallel mode. 27 | # This option should only be used with decoupled projects. More details, visit 28 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 29 | # org.gradle.parallel=true 30 | # AndroidX package structure to make it clearer which packages are bundled with the 31 | # Android operating system, and which are packaged with your app"s APK 32 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 33 | android.useAndroidX=true 34 | # Kotlin code style for this project: "official" or "obsolete": 35 | kotlin.code.style=official -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/horaciocome1/fireflow/383b530504fd6d8215bb271fbfce0a7d66247cf3/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2022 Horácio Flávio Comé Júnior 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | #Sat Jun 05 13:45:03 CAT 2021 18 | distributionBase=GRADLE_USER_HOME 19 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip 20 | distributionPath=wrapper/dists 21 | zipStorePath=wrapper/dists 22 | zipStoreBase=GRADLE_USER_HOME 23 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /jitpack.yml: -------------------------------------------------------------------------------- 1 | jdk: 2 | - openjdk11 -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = "firestore-flow" 2 | include ':app' 3 | include ':fireflow' 4 | --------------------------------------------------------------------------------