-
Notifications
You must be signed in to change notification settings - Fork 212
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
Single response #445
Single response #445
Conversation
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.
Reviewable status: 0 of 1 files reviewed, 3 unresolved discussions (waiting on @emawby, @Jeasmine, @nan-li, and @tanaynigam)
android/src/main/java/com/onesignal/flutter/OneSignalPlugin.java, line 161 at r1 (raw file):
private void addObservers() { // Clean observers before setting, avoid being call twice
These are already in main. Looks like this branch is branched from fix/sms-userid-number
, so once that is merged in this diff will probably be fixed.
android/src/main/java/com/onesignal/flutter/OneSignalPlugin.java, line 390 at r1 (raw file):
static class OSFlutterEmailHandle extends FlutterRegistrarResponder implements OneSignal.EmailUpdateHandler {
Why do we have OSFlutterEmailHandle
and then OSFlutterResultHandler
for all the other callbacks? This is inconsistent, they should either all be their own class or all under the same one.
android/src/main/java/com/onesignal/flutter/OneSignalPlugin.java, line 405 at r1 (raw file):
public void onSuccess() { if (this.replySubmitted.getAndSet(true)) return;
Can we also print a warning to the logcat if this happens? This way we have it if we need to debug in the future.
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.
Reviewed 1 of 1 files at r1.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @Jeasmine, @jkasten2, @nan-li, and @tanaynigam)
android/src/main/java/com/onesignal/flutter/OneSignalPlugin.java, line 390 at r1 (raw file):
Previously, jkasten2 (Josh Kasten) wrote…
Why do we have
OSFlutterEmailHandle
and thenOSFlutterResultHandler
for all the other callbacks? This is inconsistent, they should either all be their own class or all under the same one.
It looks like the other callbacks are sharing a success block (email is the only channel sending null in replySuccess()
, but aren't sharing failure blocks. Since we already aren't sharing failure blocks I think we should have separate handlers for each channel
* Avoid handlers being set more that once, native side will keep reference too all handlers set
* Some calls might end being called twice from the native side. Even if we already cover this from the native side, add safe check to avoid more than one call to the same flutter response
42b04ae
to
19fdc8f
Compare
* Add base handler * Add log for handler called more than once
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.
Reviewable status: 0 of 1 files reviewed, 4 unresolved discussions (waiting on @emawby, @Jeasmine, @jkasten2, @nan-li, and @tanaynigam)
android/src/main/java/com/onesignal/flutter/OneSignalPlugin.java, line 402 at r2 (raw file):
implements OneSignal.EmailUpdateHandler { OSFlutterEmailHandle(PluginRegistry.Registrar flutterRegistrar, MethodChannel channel, Result res, String methodName) {
Typo in the name. This should be OSFlutterEmailHandler
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 PR will cover the issue so approving. We probably want to try find a better balance with code reuse where possible but still have consistency for the future with these callbacks.
Reviewed 1 of 1 files at r2.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @Jeasmine, @jkasten2, @nan-li, and @tanaynigam)
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.
Reviewed 1 of 1 files at r3.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @Jeasmine, @jkasten2, @nan-li, and @tanaynigam)
Add single response handler
check to avoid more than one call to the same flutter response
Clear handlers commit already approved, review commit "Add single response handler"
This change is