-
Notifications
You must be signed in to change notification settings - Fork 4k
feat(cloud_functions): add support for cloud functions stream #17214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
packages/cloud_functions/cloud_functions/lib/src/firebase_functions.dart
Outdated
Show resolved
Hide resolved
...nctions_platform_interface/lib/src/method_channel/method_channel_https_callable_streams.dart
Outdated
Show resolved
Hide resolved
@@ -64,6 +64,7 @@ android { | |||
implementation platform("com.google.firebase:firebase-bom:${getRootProjectExtOrCoreProperty("FirebaseSDKVersion", firebaseCoreProject)}") | |||
implementation 'com.google.firebase:firebase-functions' | |||
implementation 'androidx.annotation:annotation:1.7.0' | |||
implementation 'org.reactivestreams:reactive-streams:1.0.4' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why we would need an external library to handle this? We managed to do all the other implementations without it AFAIK/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The other ones provided a way to add listeners directly (eg. addOnConfigUpdatedListener) whereas this one doesn't. It returns a Publisher
so this is the only way around it AFAIK.
Reference: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/functions/HttpsCallableReference#summary
final String eventChannelName = METHOD_CHANNEL_NAME + "/" + eventId; | ||
final EventChannel eventChannel = | ||
new EventChannel(pluginBinding.getBinaryMessenger(), eventChannelName); | ||
eventChannel.setStreamHandler(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather have another class that implements EventChannel.StreamHandler so it's properly separated and easier to review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. I'll update the PR
…base/flutterfire into feat/cloud_functions_stream_support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doc and some nit.
The main thing missing are e2e tests
Really good job
...oud_functions/cloud_functions/ios/cloud_functions/Sources/cloud_functions/CodecUtility.swift
Show resolved
Hide resolved
packages/cloud_functions/cloud_functions/lib/src/https_callable_stream_result.dart
Show resolved
Hide resolved
packages/cloud_functions/cloud_functions/lib/src/https_callable_stream_result.dart
Show resolved
Hide resolved
packages/cloud_functions/cloud_functions/lib/src/firebase_functions.dart
Outdated
Show resolved
Hide resolved
packages/cloud_functions/cloud_functions/lib/src/firebase_functions.dart
Outdated
Show resolved
Hide resolved
packages/cloud_functions/cloud_functions/lib/src/https_callable_stream.dart
Outdated
Show resolved
Hide resolved
...ons_platform_interface/lib/src/platform_interface/platform_interface_firebase_functions.dart
Outdated
Show resolved
Hide resolved
...platform_interface/lib/src/platform_interface/platform_interface_https_callable_streams.dart
Outdated
Show resolved
Hide resolved
...ns/android/src/main/java/io/flutter/plugins/firebase/functions/StreamResponseSubscriber.java
Outdated
Show resolved
Hide resolved
...oud_functions/cloud_functions/ios/cloud_functions/Sources/cloud_functions/CodecUtility.swift
Outdated
Show resolved
Hide resolved
...ons/cloud_functions/ios/cloud_functions/Sources/cloud_functions/FunctionsStreamHandler.swift
Outdated
Show resolved
Hide resolved
packages/cloud_functions/cloud_functions/lib/src/https_callable_stream_result.dart
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,85 @@ | |||
// Copyright 2018 The Chromium Authors. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry missed to catch this one in the last round
/// automatically includes a Firebase Instance ID token to identify the app | ||
/// instance. If a user is logged in with Firebase Auth, an auth ID token for | ||
/// the user is also automatically included. | ||
Stream<StreamResponse> stream<T, R>([Object? input]) async* { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the API doc, there's HttpsCallableStreamOptions as an optional parameter, but I don't find the code in this PR. Anything changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I had forgotten to update the documentation earlier. The original plan was to match the JS SDK’s stream
signature, but we later decided to follow the native (Android/Java) convention instead. I’ve just updated the docs to reflect this change.
packages/cloud_functions/cloud_functions_platform_interface/lib/src/https_callable_options.dart
Outdated
Show resolved
Hide resolved
packages/cloud_functions/cloud_functions_platform_interface/lib/src/https_callable_options.dart
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved for API.
Wowwww thank you so much @SelaseKay and everyone else ;) |
* chore(ci): bump macos-14 to macos-15 (#17311) * feat(cloud_functions): add support for cloud functions stream (#17214) * chore: add platform interface and method channel implementation for Cloud Functions stream * chore: add `httpsCallableStreamFromUrl` and `httpsStreamCallableWithUri` * chore: resolve comments * chore: add Android implementation for Cloud Functions stream * chore: resolve formatting issues * chore: correct variable name * chore: add support for Cloud Functions Stream(Android) * chore: create dedicated StreamHandler class * chore: add streamhandler implementation for ios * chore: add iOS implementation for Cloud Functions stream * chore: add license header to stream handler files * chore: web Cloud Functions stream wip * chore: push all * chore: update functions based on API Doc modification * chore: clean up code * chore: add web package * chore: add streaming example * chore: fix ci issues * chore: fix ci * chore: fix cloud function test * chore: add missing doc * chore: fixes and clean up * chore: add e2e for Cloud Functions Stream * chore: fix formatting issue * chore: add more tests and fix timeout for Android * chore: add test for map and list * chore: fix test * chore: update year to 2025 in files * chore(web): add support for abort signal * chore: resolve comments and add test for Abort * chore: fix test * chore: fix test * chore: update copyright year * chore: print error to console * chore(release): publish packages (#17314) * chore(release): publish packages - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected]+1 * chore: BoM Version 3.10.0 * constants * fix(auth,apple): prevent EXC_BAD_ACCESS crash in Apple Sign-In completion handler (#17273) - Locally captures completion handler to prevent deallocation - Fixes crash during async Apple Sign-In operations * chore(docs): Update Extension Helper Docs (#17327) * feat(vertexai): Add HarmBlockThreshold.OFF (#17325) * Add HarmBlockThreshold.OFF. Add unit test for api. Fix the schema output json. * fix a nit * feat(fdc): Included platform detection changes (#17308) * feat(vertexai): Add responseModality (#17326) * Add responseModality * review comments * handle omit tokenCount nicely (#17336) * Add new attributes for schema (#17340) * tweak after merge main * fix analyzer for vertexai/api_test.dart * remove dependency_overrides in pubspec.yaml --------- Co-authored-by: MichaelV00 <[email protected]> Co-authored-by: Jude Selase Kwashie <[email protected]> Co-authored-by: Guillaume Bernos <[email protected]> Co-authored-by: Luke Memet <[email protected]> Co-authored-by: Maneesh Tewani <[email protected]>
Description
Replace this paragraph with a description of what this PR is doing. If you're modifying existing behavior, describe the existing behavior, how this PR is changing it, and what motivated the change.
Related Issues
Closes #17076
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
).This will ensure a smooth and quick review process. Updating the
pubspec.yaml
and changelogs is not required.///
).melos run analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?