-
Notifications
You must be signed in to change notification settings - Fork 4k
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
fix(firebase_auth): Move communication to EventChannels #4643
Conversation
packages/firebase_auth/firebase_auth/ios/Classes/FLTFirebaseAuthPlugin.m
Show resolved
Hide resolved
@rrousselGit @Salakar @Ehesp hi there - this PR is ready for review. The e2e example currently fails due to the phone number being linked with another account. The same error can be observed on the master branch. Could you spare a minute to take a look? |
...th/firebase_auth_platform_interface/lib/src/method_channel/method_channel_firebase_auth.dart
Outdated
Show resolved
Hide resolved
...th/firebase_auth_platform_interface/lib/src/method_channel/method_channel_firebase_auth.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.
A few nitpicks from me. One other thing would be to run melos run format
from root as I think there is one iOS file that needs formatting. Other than that, great work again, @ened. We really appreciate it.
@@ -1377,9 +1216,9 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) { | |||
return Tasks.call( | |||
cachedThreadPool, | |||
() -> { | |||
removeEventListeners(); | |||
// TODO: not sure if this is applicable here. | |||
// removeEventListeners(); |
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.
@Salakar, will we need to clean up event listeners for didReinitializeFirebaseCore
?
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.
When does didReinitializeFirebaseCore
get called usually?
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.
Ah, when the core is reinitialized (doh!) - in the firebase core plugin. If the user changes the firebase project then we need to clean up the plugins. There is a problem in cloud_firestore
as well as this PR: The didReinitializeFirebaseCore
does not clear the event listeners, which may cause errors. The listeners get cleared up when the plugin is destroyed. Hm..
Sounds like a central cleanup method in the plugin would be the right way to go here.
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.
didReinitializeFirebaseCore
is also called on Dart Hot Restarts in dev (was mainly added for this purpose) - so it would be best if the event listeners are also cleaned up here otherwise these would linger in native when Dart is no longer aware of them?
...e_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPlugin.java
Outdated
Show resolved
Hide resolved
...oid/src/main/java/io/flutter/plugins/firebase/auth/PhoneNumberVerificationStreamHandler.java
Outdated
Show resolved
Hide resolved
...oid/src/main/java/io/flutter/plugins/firebase/auth/PhoneNumberVerificationStreamHandler.java
Outdated
Show resolved
Hide resolved
packages/firebase_auth/firebase_auth/ios/Classes/FLTAuthStateChannelStreamHandler.m
Outdated
Show resolved
Hide resolved
packages/firebase_auth/firebase_auth/ios/Classes/FLTPhoneNumberVerificationStreamHandler.m
Outdated
Show resolved
Hide resolved
'phoneNumber': phoneNumber, | ||
'timeout': timeout.inMilliseconds, | ||
'forceResendingToken': forceResendingToken, | ||
'autoRetrievedSmsCodeForTesting': autoRetrievedSmsCodeForTesting, | ||
}); | ||
|
||
EventChannel(eventChannelName!) |
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.
This StreamSubscription is not cancelled.
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
@googlebot I consent. |
Thank you @Salakar for joining :) |
No worries, I think this is the last bit and then we're good to merge and ship; The test failures re |
OK will take care. I did not see your reply before just now. |
Description
Similar to #4209, this PR addresses some issues rgd. isolate communication pertaining left-open "channels" to communicate back from native side to Dart.
Instead, the Flutter EventChannel mechanism is now used for the following parts:
Related Issues
Closes #3507
Closes #4416
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.///
).flutter 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?
Please help testing the PR
Add the following to your
pubspec.yaml
: