Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
647c213
- Created cloud_firestore_platform interface package
amrfarid140 Dec 14, 2019
9ed7d8c
- Created cloud_firestore_web package
amrfarid140 Dec 14, 2019
7fdd1c8
Created query interface
amrfarid140 Dec 15, 2019
14bad9c
created base QuerySnapshot
amrfarid140 Dec 16, 2019
552305d
organised platform_interface module
amrfarid140 Dec 16, 2019
63f3488
- created query_web
amrfarid140 Dec 16, 2019
9c7ea4a
- fixed method_channel_query_snapshot
amrfarid140 Dec 16, 2019
250f017
- implemented query_web
amrfarid140 Dec 16, 2019
dfaa02a
- delegated collection_reference_web to use query_web
amrfarid140 Dec 16, 2019
46349f6
- added firestore web to firestore package
amrfarid140 Dec 16, 2019
d731ecd
- create delegate for collection reference
amrfarid140 Dec 16, 2019
9ad5779
- create delegate for document related items
amrfarid140 Dec 16, 2019
8557df2
- create delegate for transaction and query
amrfarid140 Dec 16, 2019
fa06657
delegate cloud_firestore to abstract types
amrfarid140 Dec 17, 2019
993b86a
- added method_channel_firestore_test
amrfarid140 Dec 17, 2019
2a160d5
Use support multiple apps in FirestoreWeb
amrfarid140 Dec 17, 2019
3e24ca2
added transaction implementation
amrfarid140 Dec 17, 2019
76037e7
updated readmes
amrfarid140 Dec 17, 2019
e1f1591
Merge pull request #1 from amrfarid140/feature/firestore_web_support
amrfarid140 Dec 17, 2019
ffb12cd
fixed copy typo on readme
amrfarid140 Dec 17, 2019
c30f1f7
- Added change log
amrfarid140 Dec 17, 2019
65984ff
Added support for field value
amrfarid140 Dec 18, 2019
ec595fe
Build example for web and mobile
amrfarid140 Dec 18, 2019
aa7d422
Support new FieldValueInterface on mobile
amrfarid140 Dec 18, 2019
082baa3
Fix query delegation on web
amrfarid140 Dec 18, 2019
61cc5b1
Use PlaformUtils for conversions in DocumentChange
amrfarid140 Dec 18, 2019
aa3089e
Fixed typo in variable name
amrfarid140 Dec 18, 2019
2d3e712
Pass timeout value for transaction
amrfarid140 Dec 18, 2019
abed99e
Delete unused cloud_firestore/firestore_message_codec
amrfarid140 Dec 18, 2019
269d71e
removed unused imports
amrfarid140 Dec 18, 2019
d820fbc
removed empty constructor
amrfarid140 Dec 18, 2019
685d168
Fixed argument name
amrfarid140 Dec 18, 2019
c618131
Addressed comments for cloud_firestore_platform_interface setup
amrfarid140 Dec 18, 2019
874fdfb
Use cast
amrfarid140 Dec 18, 2019
124501e
Add timeout to web transaction
amrfarid140 Dec 18, 2019
3f182de
Fixed cloud_firestore_web version
amrfarid140 Dec 18, 2019
8b93dfa
Improved Query code and added documentation for main interface classes
amrfarid140 Dec 18, 2019
b2e46f1
Minor PR fixes
amrfarid140 Dec 18, 2019
98bfeb2
Fixed current analyze and fmt issues
amrfarid140 Dec 18, 2019
dc3e4cc
Fix message codec to run transaction on mobile
amrfarid140 Dec 19, 2019
b7cb9a3
Fix transaction writes on mobile and web
amrfarid140 Dec 19, 2019
05584ed
Updated example to showcase transactions
amrfarid140 Dec 19, 2019
b74bd77
PR feedback fixes
amrfarid140 Dec 19, 2019
0e261aa
Added write batch support
amrfarid140 Dec 19, 2019
d73dcce
Formatting
amrfarid140 Dec 19, 2019
0bfd691
Fix write batch examples
amrfarid140 Dec 19, 2019
3c7faa0
Added comments to match existing API level documentation
amrfarid140 Dec 19, 2019
dab85d2
Avoid setting host and ssl if either is null
amrfarid140 Dec 19, 2019
b23805c
Bug fixes for QueryWeb and CollectionWeb
amrfarid140 Dec 19, 2019
6632ae7
Added support for handling Blob and GeoPoint
amrfarid140 Dec 19, 2019
e74a230
Started code utility stuff
amrfarid140 Dec 19, 2019
3932bdf
Handle maps and arrays for codec conversions
amrfarid140 Dec 19, 2019
67574b1
Removed cupertino import
amrfarid140 Dec 19, 2019
7cd3c13
Lazily load Firestore instances
amrfarid140 Dec 19, 2019
64392c4
PR Feedback fixes
amrfarid140 Dec 19, 2019
9967067
Use PlatformInterface to check for verify implementation
amrfarid140 Dec 20, 2019
164b8b5
removed comments on analysis file
amrfarid140 Dec 20, 2019
b6050f9
removed todo as its not a client side logic
amrfarid140 Dec 20, 2019
762daae
Removed ensureInitialized() call
amrfarid140 Dec 20, 2019
2082303
Added null checks for codec_utility
amrfarid140 Dec 20, 2019
d3c65ad
Use setUpAll for test
amrfarid140 Dec 20, 2019
a2623e1
Use toList()
amrfarid140 Dec 20, 2019
73627b6
Added platform_interface/document_reference_test.dart
amrfarid140 Dec 20, 2019
f77739d
Added platform_interface field value test
amrfarid140 Dec 20, 2019
ef5d223
Fixed method_channel_document_reference
amrfarid140 Dec 20, 2019
3e70296
Add comments on public functions for field_value_factory
amrfarid140 Dec 20, 2019
103f534
added platform_interface_query_test
amrfarid140 Dec 20, 2019
8513162
Added unit tests for method channel document and collection reference
amrfarid140 Dec 20, 2019
efa315d
added snapshot() unit test for document reference
amrfarid140 Dec 20, 2019
b4fa2db
Added method_channel_field_value_factory_test
amrfarid140 Dec 20, 2019
afd6b0e
added transaction unit test
amrfarid140 Dec 20, 2019
8860659
Separated common testing logic
amrfarid140 Dec 20, 2019
cc2af37
use serve delegates in transaction
amrfarid140 Dec 20, 2019
ade9dbf
use serve delegates in write batch
amrfarid140 Dec 20, 2019
98d021e
Formatting changes
amrfarid140 Dec 20, 2019
6491ade
Started firestore_web tests
amrfarid140 Dec 20, 2019
77f4318
Completed collection_reference_web_test
amrfarid140 Dec 20, 2019
118780d
Avoid storing non-default Firestore app as static instance
amrfarid140 Dec 21, 2019
e4519d4
Fixed method_channel_transaction
amrfarid140 Dec 21, 2019
e26a812
Check for null data in codec_utility
amrfarid140 Dec 21, 2019
f8bc035
Unit test firestore_web
amrfarid140 Dec 21, 2019
4b79e26
Fix typo
amrfarid140 Dec 21, 2019
5391128
Fix analyze issues
amrfarid140 Dec 21, 2019
d3e60d5
Added firestore_web codec_utility_test
amrfarid140 Dec 21, 2019
cac92e2
Added test for field factory web
amrfarid140 Dec 22, 2019
207cc23
unit tested get document for QueryWeb
amrfarid140 Dec 22, 2019
5accb7a
Added more unit tests for QueryWeb
amrfarid140 Dec 22, 2019
ac1907d
Formatted code
amrfarid140 Dec 22, 2019
7c2ff05
Added public methods documentation
amrfarid140 Dec 22, 2019
37f7bd0
added TransactionWeb unit test
amrfarid140 Dec 22, 2019
a771d88
Added WriteBatchTest
amrfarid140 Dec 22, 2019
49edada
Added visiblefortesting annotation
amrfarid140 Dec 23, 2019
50ef0f1
Fix analyzer
amrfarid140 Dec 23, 2019
566e011
Delete unnecessary timestamp.dart
amrfarid140 Jan 3, 2020
b2b445c
Handle DateTime to Timestamp conversion for web
amrfarid140 Jan 3, 2020
9b786db
Use codec_utility across web
amrfarid140 Jan 3, 2020
24adc0c
Avoid building unnecessary instances of FirebaseApp
amrfarid140 Jan 3, 2020
19b094c
Added platform interface updates
amrfarid140 Jan 8, 2020
abacb4c
Add latest update for platform_interface
amrfarid140 Jan 8, 2020
e7204f2
Use platform interface types in cloud_firestore
amrfarid140 Jan 17, 2020
5bcaa82
removed material import from firestore_web
amrfarid140 Jan 17, 2020
09aa7ff
Fixed documentation comments
amrfarid140 Jan 17, 2020
b09cd24
Added comment on the purpose of lazy init of Firestore delegate
amrfarid140 Jan 17, 2020
7428da2
Separate Platform Interface source from Method Channel.
ditman Jan 27, 2020
06242c8
Start fixing imports
ditman Jan 27, 2020
52008c6
Moved some more
ditman Jan 27, 2020
5be6db8
Some more moving
ditman Jan 27, 2020
91ed554
Fix imports after moving files around. Interface should be identical …
ditman Jan 27, 2020
3c207c1
Make all platform_interface classes names consistent.
collinjackson Jan 29, 2020
182d2ae
Ensure platform interfaces can only be extended, not implemented.
collinjackson Jan 29, 2020
082ae1d
MethodChannelFieldValueFactory now extends FieldValueFactoryPlatform
ditman Jan 29, 2020
e7be32a
.appName() -> .app.name
collinjackson Jan 29, 2020
b036a96
Ensure PlatformInterface _delegate classes extend the Platform class,
collinjackson Jan 29, 2020
c2c75d0
Get web going again...
ditman Jan 30, 2020
3214bb1
Remove unneeded mocking on app.name so web tests pass again.
ditman Jan 30, 2020
8a1e1c8
Add token verification to instances of FieldValueFactoryPlatform.
ditman Jan 30, 2020
f68b5ea
Use FieldValuePlatform instead of FieldValueInterface. Ensure it's "e…
ditman Jan 31, 2020
6f4d042
Docs update
collinjackson Feb 1, 2020
5b80b50
Merge pull request #60 from collinjackson/amr-master-pr-2
ditman Feb 1, 2020
9dcc1c9
Hide most of the API surface from cloud_firestore_web.
ditman Feb 1, 2020
8b95bc9
Hide _webFirestore
collinjackson Feb 1, 2020
b7b5fc9
Moving some more stuff around
ditman Feb 1, 2020
bd96dde
Hide the MethodChannel implementation from the world.
ditman Feb 1, 2020
15dd903
analyze + dartfmt
ditman Feb 3, 2020
e8fe1a6
Hide FieldPathType from the world, since it's only used by MethodChan…
ditman Feb 3, 2020
2b4cde2
Use import/export instead of part in cloud_firestore_platform_interfa…
ditman Feb 3, 2020
e40a1c3
Add copyright notices everywhere.
ditman Feb 4, 2020
6f74929
Ensure FieldValue extends Platform, not implements.
ditman Feb 4, 2020
192ad66
Remove implements web.FieldValue from FieldValueWeb, since the
ditman Feb 4, 2020
ff5561e
Remove `serverDelegates` from `FieldValuePlatform`, and convert to a
ditman Feb 4, 2020
b4de785
dartfmt
ditman Feb 4, 2020
d69f67e
Remove appName() from FirestorePlatform.
ditman Feb 4, 2020
7009ef6
Use Source and DocumentChangeType enums from PlatformInterface.
ditman Feb 4, 2020
3b30165
Transaction constructor is properly public, not visibleForTesting. da…
ditman Feb 4, 2020
926ba55
Do not export auto_id_generator from PlatformInterface.
ditman Feb 4, 2020
4cb361c
Remove as much logic as possible from FieldValue instances.
ditman Feb 4, 2020
7c92e7c
FieldValue now internally stores the platform-dependent value.
ditman Feb 5, 2020
542a8e3
Merge pull request #2 from amrfarid140/amr-master-pr
amrfarid140 Feb 5, 2020
12277b0
Merge branch 'master' of github.com:FirebaseExtended/flutterfire and …
amrfarid140 Feb 5, 2020
00e04ed
Merge branch 'master' of github.com:FirebaseExtended/flutterfire
amrfarid140 Feb 6, 2020
48e5ba3
Use published version of `cloud_firestore_platform_interface`
amrfarid140 Feb 6, 2020
60ae8e7
Remove references of _web and update changelog
amrfarid140 Feb 6, 2020
0e99356
Added _web plugin
amrfarid140 Feb 6, 2020
54a0d09
Merge branch 'master' of github.com:FirebaseExtended/flutterfire into…
amrfarid140 Feb 7, 2020
cd5783c
renamed `firestore_web` to `cloud_firestore_web`
amrfarid140 Feb 7, 2020
45a876e
Update packages/cloud_firestore/cloud_firestore_web/lib/src/field_val…
amrfarid140 Feb 7, 2020
ebd6e24
Update packages/cloud_firestore/cloud_firestore_web/lib/src/query_web…
amrfarid140 Feb 7, 2020
7927430
hide webFirestore
amrfarid140 Feb 7, 2020
ab87eff
Merge remote-tracking branch 'origin/firestore_web/cloud_firestore_we…
amrfarid140 Feb 7, 2020
c424237
Encode values using in Query#where
amrfarid140 Feb 8, 2020
695c53c
Merge branch 'master' of github.com:FirebaseExtended/flutterfire into…
amrfarid140 Feb 9, 2020
04a00ca
- Removed pathComponents
amrfarid140 Feb 9, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/cloud_firestore/cloud_firestore_web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.1.0

- Initial release
27 changes: 27 additions & 0 deletions packages/cloud_firestore/cloud_firestore_web/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2017 The Chromium Authors. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52 changes: 52 additions & 0 deletions packages/cloud_firestore/cloud_firestore_web/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# cloud_firestore_web

The web implementation of [`cloud_firestore`][1].

## Usage

### Import the package

To use this plugin in your Flutter app on the web, simply add it as a
dependency in your `pubspec.yaml` alongside the base `cloud_firestore`
plugin.

_(This is only temporary: in the future we hope to make this package
an "endorsed" implementation of `cloud_firestore`, so it will automatically
be included in your app when you run your Flutter app on the web.)_

Add this to your `pubspec.yaml`:

```yaml
...
dependencies:
...
cloud_firestore: ^0.13.1
cloud_firestore_web: ^0.1.0
...
```

### Updating `index.html`

Due to [this bug in dartdevc][2], you will need to manually add the Firebase
JavaScript files to your `index.html` file.

In your app directory, edit `web/index.html` to add the line:

```html
<html>
...
<body>
<script src="https://www.gstatic.com/firebasejs/7.5.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.5.0/firebase-firestore.js"></script>
<script src="main.dart.js"></script>
</body>
</html>
```

### Using the plugin

Once you have added the `cloud_firebase_web` dependency to your pubspec,
you can use `package:cloud_firebase` as normal.

[1]: ../cloud_firestore
[2]: https://github.com/dart-lang/sdk/issues/33979
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
33 changes: 33 additions & 0 deletions packages/cloud_firestore/cloud_firestore_web/android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
group 'io.flutter.plugins.cloud_firestore_web'
version '1.0'

buildscript {
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
}
}

rootProject.allprojects {
repositories {
google()
jcenter()
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion 28

defaultConfig {
minSdkVersion 16
}
lintOptions {
disable 'InvalidPackage'
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'cloud_firestore_web'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.flutter.plugins.cloud_firestore_web">
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.flutter.plugins.cloud_firestore_web;

import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.plugin.common.PluginRegistry.Registrar;

/** FirebaseAuthWebPlugin */
public class FirestoreWebPlugin implements FlutterPlugin {
@Override
public void onAttachedToEngine(FlutterPluginBinding flutterPluginBinding) {}

public static void registerWith(Registrar registrar) {}

@Override
public void onDetachedFromEngine(FlutterPluginBinding binding) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'cloud_firestore_web'
s.version = '0.1.0'
s.summary = 'No-op implementation of cloud_firestore_web web plugin to avoid build issues on iOS'
s.description = <<-DESC
temp fake firebase_auth_web plugin
DESC
s.homepage = 'https://github.com/FirebaseExtended/flutterfire/tree/master/packages/cloud_firestore/cloud_firestore_web'
s.license = { :file => '../LICENSE' }
s.author = { 'Flutter Team' => 'flutter-dev@googlegroups.com' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'

s.ios.deployment_target = '8.0'
end

Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
// Copyright 2017, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:cloud_firestore_platform_interface/cloud_firestore_platform_interface.dart';
import 'package:firebase/firebase.dart' as firebase;
import 'package:firebase/firestore.dart' show Firestore, Settings;
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';

import 'package:cloud_firestore_web/src/collection_reference_web.dart';
import 'package:cloud_firestore_web/src/field_value_factory_web.dart';
import 'package:cloud_firestore_web/src/document_reference_web.dart';
import 'package:cloud_firestore_web/src/query_web.dart';
import 'package:cloud_firestore_web/src/transaction_web.dart';
import 'package:cloud_firestore_web/src/write_batch_web.dart';

/// Web implementation for [FirestorePlatform]
/// delegates calls to firestore web plugin
class FirestoreWeb extends FirestorePlatform {
/// instance of Firestore from the web plugin
final Firestore _webFirestore;

/// Called by PluginRegistry to register this plugin for Flutter Web
static void registerWith(Registrar registrar) {
FirestorePlatform.instance = FirestoreWeb();
}

/// Builds an instance of [CloudFirestoreWeb] with an optional [FirebaseApp] instance
/// If [app] is null then the created instance will use the default [FirebaseApp]
FirestoreWeb({FirebaseApp app})
: _webFirestore = firebase
.firestore(firebase.app((app ?? FirebaseApp.instance).name)),
super(app: app ?? FirebaseApp.instance) {
FieldValueFactoryPlatform.instance = FieldValueFactoryWeb();
}

@override
FirestorePlatform withApp(FirebaseApp app) => FirestoreWeb(app: app);

@override
CollectionReferencePlatform collection(String path) {
return CollectionReferenceWeb(this, _webFirestore, path.split('/'));
}

@override
QueryPlatform collectionGroup(String path) {
return QueryWeb(this, path, _webFirestore.collectionGroup(path),
isCollectionGroup: true);
}

@override
DocumentReferencePlatform document(String path) =>
DocumentReferenceWeb(_webFirestore, this, path.split('/'));

@override
WriteBatchPlatform batch() => WriteBatchWeb(_webFirestore.batch());

@override
Future<void> enablePersistence(bool enable) async {
if (enable) {
await _webFirestore.enablePersistence();
}
}

@override
Future<void> settings(
{bool persistenceEnabled,
String host,
bool sslEnabled,
int cacheSizeBytes}) async {
if (host != null && sslEnabled != null) {
_webFirestore.settings(Settings(
cacheSizeBytes: cacheSizeBytes ?? 40000000,
host: host,
ssl: sslEnabled));
} else {
_webFirestore
.settings(Settings(cacheSizeBytes: cacheSizeBytes ?? 40000000));
}
if (persistenceEnabled) {
await _webFirestore.enablePersistence();
}
}

@override
Future<Map<String, dynamic>> runTransaction(
TransactionHandler transactionHandler,
{Duration timeout = const Duration(seconds: 5)}) async {
Map<String, dynamic> result;
await _webFirestore.runTransaction((transaction) async {
result = await transactionHandler(TransactionWeb(transaction, this));
}).timeout(timeout);
return result is Map<String, dynamic> ? result : <String, dynamic>{};
}
}
Loading