-
Notifications
You must be signed in to change notification settings - Fork 16
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
Synchronous API for creating instances and Hot-reload fix #18
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.
Hi @tiholic ... thanks for your work on this.
Looking pretty good but there are a few things:
- I see that
pubspec.lock
has changed but there's no corresponding change topubspec.yaml
... I'm presuming that's because checking in this file was overlooked from a previous PR? Can you keep an eye on this if that is the case as it makes it impossible to look at this PR atomically in respect of the impact it has on the codebase as a whole. - Given the nature of plugin development, as I think I may have mentioned a while back, we need to see changes to Java, iOS and the Dart code at the same time - making the PR deliver a feature completely across all runtimes. I'm worried about approving this PR when we have no idea whether this is replicable in Cocoa.
- In
StreamsChannel.java
(acknowledging it is somebody else's code) there is inconsistency around the use offinal
on args to methods. I also had another concern which I commented on directly in that file. This makes me worry a little about the quality of that code. Was it unit tested, for example, where it came from?
I'm going to continue noodling around locally, but I am yet to work out how to actually build the plugin from the command line (i.e. not just run it within the example app). What am I missing? Could we have some instructions somewhere for this, perhaps in the developer notes for now?
Also, one of the things I put in place early on was pedantic. Some of the minor spacing issues and stuff like that I can see in this PR should have been picked up by that. Can I run that from the command line also? It should be running, of course, on every build.
android/src/main/java/io/ably/flutter/plugin/AblyEventStreamHandler.java
Show resolved
Hide resolved
## Sync + Lazy = Slazy!!! 😉 1. All platform calls from dart side are made lazy 2. Singleton Ably library instances on Android side (iOS will be caught up) ## Hot-reload issue 3. register ably is now used to dispose off any registered platform instances 4. StreamsChannel source is duplicated on android side and necessary changes are made to make hot-reload work well
da5de0f
to
6582afe
Compare
Thanks for the responses to my review comments, @tiholic. I think there are still a few improvements before we can merge this. Thanks. |
and a timeout to rule it out in case we never hear back from platform side
@QuintinWillison Yeah, this PR is still in draft state. I just getting some inputs on how the final API should look like. |
import 'package:ably_flutter_plugin/ably.dart' as ably; ably.Rest and ably.Realtime are now available directly to interact with instead of a scoping inside a singleton class
## Sync + Lazy = Slazy!!! 1. Singleton AblyFlutter instance on iOS side ## Hot-reload issue 2. register ably is now used to dispose off any registered platform instances 3. StreamsChannel source is duplicated on iOS side and necessary changes are made to make hot-reload work well
1. Update example code to suit well with new API 2. respective lock files updated after removing streams_channel
@QuintinWillison iOS side caught up, if the runway is clear for landing, we can merge this. Regarding the Updated DeveloperNotes with instructions on static code analysis (includes all build time checks) |
Regarding There is perhaps a wider discussion to be had here at Ably, across all client libraries, around dependency version management / auto management. |
#18 (review) 1. rename singleton returning static method to `sharedInstance` 2. remove `dispose` from header to make it private 3. code indents/formatting 4. remove `self->` from `AblyStreamsChannel` wherever not required 5. improve DeveloperNotes.md
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.
Happy for you to land this when you are ready, @tiholic. Thanks for all the work you've put in to resolve comments.
#18 (review) 1. rename singleton returning static method to `sharedInstance` 2. remove `dispose` from header to make it private 3. code indents/formatting 4. remove `self->` from `AblyStreamsChannel` wherever not required 5. improve DeveloperNotes.md
This PR mainly focuses on creating Ably instances in a synchronous manner.
The following changes were made possible as all other operations on each ably instances is an asynchronous operation.
If not async? then, Sync + Lazy = Slazy!!! 😉
A peek on new APIs
Hot-reload issue fix 🌶️ ♻️ 🎉 🎉
registerAbly
is now used to dispose off any registered platform instancesStreamsChannel
source is replicated and necessary changes are made to dispose all listeners on hot-reload (Will be removing the streams_channel plugin dependency eventually)@QuintinWillison @mattheworiordan @paddybyers Please share your feedback on the API. Will make necessary changes and proceed with implementing iOS platform related changes.