[WIP] Federated cloud firestore platform interface#1568
[WIP] Federated cloud firestore platform interface#1568ditman wants to merge 16 commits intofirebase:masterfrom ditman:federated_cloud_firestore_platform_interface
Conversation
|
(Force-pushed after rebasing with the latest master) |
…napshots' This is to prevent naming collisions with the same method from Document References.
There was a problem hiding this comment.
I have one high level concern about how we're structuring the platform interface (see below) and some style nits that apply throughout this PR:
Use a trailing comma for arguments, parameters, and list items, but only if they each have their own line.
Example:
List<int> myList = [
1,
2,
];
myList = <int>[3, 4];
foo1(
bar,
baz,
);
foo2(bar, baz);
Only use => when everything, including the function declaration, fits on a single line.
| @@ -0,0 +1 @@ | |||
| {"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"cloud_firestore","dependencies":["firebase_core"]},{"name":"firebase_core","dependencies":[]}]} No newline at end of file | |||
There was a problem hiding this comment.
Should not be checked in to version control
There was a problem hiding this comment.
I have no idea where this is coming from; I'll remove it from the PR, and add it to .gitignore
packages/cloud_firestore/cloud_firestore/lib/src/document_reference.dart
Outdated
Show resolved
Hide resolved
packages/cloud_firestore/cloud_firestore/lib/src/document_reference.dart
Outdated
Show resolved
Hide resolved
packages/cloud_firestore/cloud_firestore/lib/src/document_reference.dart
Outdated
Show resolved
Hide resolved
| @@ -10,28 +10,6 @@ part of cloud_firestore; | |||
| class Firestore { | |||
| Firestore({FirebaseApp app}) : app = app ?? FirebaseApp.instance { | |||
| if (_initialized) return; | |||
There was a problem hiding this comment.
This can be removed now.
...oud_firestore/cloud_firestore_platform_interface/lib/src/method_channel_cloud_firestore.dart
Outdated
Show resolved
Hide resolved
...oud_firestore/cloud_firestore_platform_interface/lib/src/method_channel_cloud_firestore.dart
Outdated
Show resolved
Hide resolved
...oud_firestore/cloud_firestore_platform_interface/lib/src/method_channel_cloud_firestore.dart
Outdated
Show resolved
Hide resolved
...oud_firestore/cloud_firestore_platform_interface/lib/src/method_channel_cloud_firestore.dart
Outdated
Show resolved
Hide resolved
| TestWidgetsFlutterBinding.ensureInitialized(); | ||
|
|
||
| group('$MethodChannelCloudFirestore', () { | ||
| final MethodChannelCloudFirestore channelPlatform = |
There was a problem hiding this comment.
Lots more to write here :)
…s stream. (Corrected return type of Stream controller for the Query snapshots as well)
| } | ||
|
|
||
| // Document Reference | ||
| Future<void> setDocumentReferenceData( |
There was a problem hiding this comment.
@amirh Does this seem right to you as a style convention for federated plugins that are wrapping instances of native classes other than the main class of the plugin?
Right now we're shoehorning everything onto CloudFirestorePlatform instead of having a PlatformDocumentReference that has the same extends-only semantics as CloudFirestorePlatform.
If we were ok with being less idiomatically Dart we could call it something like DocumentReference_setData... not sure that's actually better but I just want to make sure that we're ok with the pattern being established here.
There was a problem hiding this comment.
I think it's definitely makes sense for the platform interface to be composed from multiple classes. In fact we've already done this in the webview plugin (WebViewPlatform and WebViewPlatformController). I think it's less of a convention thing and more of a "whatever design works fits better for a given plugin".
For this case, after discussing with Collin, it seems like multiple classes is a better choice.
|
|
||
| void _handleDocumentSnapshot(MethodCall call) { | ||
| final int handle = call.arguments['handle']; | ||
| _queryObservers[handle].add(call.arguments); |
There was a problem hiding this comment.
_queryObservers should be _documentObservers, right?
| ); | ||
| } | ||
|
|
||
| static final Map<int, StreamController<int>> _documentObservers = |
There was a problem hiding this comment.
Map should be Map<int, StreamController<dynamic>>
| ); | ||
| } | ||
|
|
||
| static final Map<int, StreamController<int>> _queryObservers = |
There was a problem hiding this comment.
Map should be Map<int, StreamController<dynamic>>
|
(I'm going to close this, so no more effort is wasted here. Apologies @andrea689, I'll keep your reviews in mind in my next iteration of this! And thanks again!) |
Description
WIP the platform interface + native plugin changes for cloud_firestore federation.
Many things missing, chief of which are: