Skip to content

Commit 3ff0982

Browse files
amrfarid140ditmancollinjackson
authored
[cloud_firestore] Created firestore web plugin (#1950)
Add an implementation of `cloud_firestore_platform_interface` for the web platform. Co-authored-by: David Iglesias <[email protected]> Co-authored-by: Collin Jackson <[email protected]>
1 parent 35ae59e commit 3ff0982

30 files changed

+1950
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.1.0
2+
3+
- Initial release
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2017 The Chromium Authors. All rights reserved.
2+
//
3+
// Redistribution and use in source and binary forms, with or without
4+
// modification, are permitted provided that the following conditions are
5+
// met:
6+
//
7+
// * Redistributions of source code must retain the above copyright
8+
// notice, this list of conditions and the following disclaimer.
9+
// * Redistributions in binary form must reproduce the above
10+
// copyright notice, this list of conditions and the following disclaimer
11+
// in the documentation and/or other materials provided with the
12+
// distribution.
13+
// * Neither the name of Google Inc. nor the names of its
14+
// contributors may be used to endorse or promote products derived from
15+
// this software without specific prior written permission.
16+
//
17+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# cloud_firestore_web
2+
3+
The web implementation of [`cloud_firestore`][1].
4+
5+
## Usage
6+
7+
### Import the package
8+
9+
To use this plugin in your Flutter app on the web, simply add it as a
10+
dependency in your `pubspec.yaml` alongside the base `cloud_firestore`
11+
plugin.
12+
13+
_(This is only temporary: in the future we hope to make this package
14+
an "endorsed" implementation of `cloud_firestore`, so it will automatically
15+
be included in your app when you run your Flutter app on the web.)_
16+
17+
Add this to your `pubspec.yaml`:
18+
19+
```yaml
20+
...
21+
dependencies:
22+
...
23+
cloud_firestore: ^0.13.1
24+
cloud_firestore_web: ^0.1.0
25+
...
26+
```
27+
28+
### Updating `index.html`
29+
30+
Due to [this bug in dartdevc][2], you will need to manually add the Firebase
31+
JavaScript files to your `index.html` file.
32+
33+
In your app directory, edit `web/index.html` to add the line:
34+
35+
```html
36+
<html>
37+
...
38+
<body>
39+
<script src="https://www.gstatic.com/firebasejs/7.5.0/firebase-app.js"></script>
40+
<script src="https://www.gstatic.com/firebasejs/7.5.0/firebase-firestore.js"></script>
41+
<script src="main.dart.js"></script>
42+
</body>
43+
</html>
44+
```
45+
46+
### Using the plugin
47+
48+
Once you have added the `cloud_firebase_web` dependency to your pubspec,
49+
you can use `package:cloud_firebase` as normal.
50+
51+
[1]: ../cloud_firestore
52+
[2]: https://github.com/dart-lang/sdk/issues/33979
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/workspace.xml
5+
/.idea/libraries
6+
.DS_Store
7+
/build
8+
/captures
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
group 'io.flutter.plugins.cloud_firestore_web'
2+
version '1.0'
3+
4+
buildscript {
5+
repositories {
6+
google()
7+
jcenter()
8+
}
9+
10+
dependencies {
11+
classpath 'com.android.tools.build:gradle:3.5.0'
12+
}
13+
}
14+
15+
rootProject.allprojects {
16+
repositories {
17+
google()
18+
jcenter()
19+
}
20+
}
21+
22+
apply plugin: 'com.android.library'
23+
24+
android {
25+
compileSdkVersion 28
26+
27+
defaultConfig {
28+
minSdkVersion 16
29+
}
30+
lintOptions {
31+
disable 'InvalidPackage'
32+
}
33+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
org.gradle.jvmargs=-Xmx1536M
2+
android.enableR8=true
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
zipStoreBase=GRADLE_USER_HOME
4+
zipStorePath=wrapper/dists
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'cloud_firestore_web'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="io.flutter.plugins.cloud_firestore_web">
3+
</manifest>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package io.flutter.plugins.cloud_firestore_web;
2+
3+
import io.flutter.embedding.engine.plugins.FlutterPlugin;
4+
import io.flutter.plugin.common.PluginRegistry.Registrar;
5+
6+
/** FirebaseAuthWebPlugin */
7+
public class FirestoreWebPlugin implements FlutterPlugin {
8+
@Override
9+
public void onAttachedToEngine(FlutterPluginBinding flutterPluginBinding) {}
10+
11+
public static void registerWith(Registrar registrar) {}
12+
13+
@Override
14+
public void onDetachedFromEngine(FlutterPluginBinding binding) {}
15+
}

0 commit comments

Comments
 (0)