-
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
re-codec using JSON and Codegen #13
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.
Not quite ready to approve as there are a few things that I would like you to look at, however generally I think this is a really good PR. Nice work @tiholic! 😀
android/src/main/java/io/ably/flutter/plugin/AblyEventStreamHandler.java
Outdated
Show resolved
Hide resolved
android/src/main/java/io/ably/flutter/plugin/AblyEventStreamHandler.java
Outdated
Show resolved
Hide resolved
android/src/main/java/io/ably/flutter/plugin/gen/PlatformConstants.java
Outdated
Show resolved
Hide resolved
[code consistency] remove space for ObjC arguments #13 (comment) Co-authored-by: Quintin <quintin@ably.io>
[cleanup] Adding NS_ASSUME_NONNULL_BEGIN and END as per the comment #13 (comment) Co-authored-by: Quintin <quintin@ably.io>
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 like where this is headed!
Caveat - I haven't done a full review, so don't rely on me for this PR's technical 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.
@QuintinWillison thanks for the comments. I've addressed them.
} | ||
''';}).join('\n')} | ||
'''; | ||
} |
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.
Agree 💯
Addressed in 72743fd
android/src/main/java/io/ably/flutter/plugin/AblyEventStreamHandler.java
Outdated
Show resolved
Hide resolved
android/src/main/java/io/ably/flutter/plugin/AblyEventStreamHandler.java
Outdated
Show resolved
Hide resolved
android/src/main/java/io/ably/flutter/plugin/AblyEventStreamHandler.java
Outdated
Show resolved
Hide resolved
android/src/main/java/io/ably/flutter/plugin/gen/PlatformConstants.java
Outdated
Show resolved
Hide resolved
- mustache template based codegen - generates codec types and platform methods - addresses #5 (comment)
- 4 generated files: - PlatformConstants.java - AblyPlatformConstants.h - AblyPlatformConstants.m - platformconstants.dart Changes related to the same in relevant files
1. Generation format changed from mustache templates to straight forward dart string interpolation 2. generating JSON keys for encodable/decodable objects. Properties of each object are generated to `TxObjectName` 3. generated JSON keys used in encoding/decoding methods
[code consistency] remove space for ObjC arguments #13 (comment) Co-authored-by: Quintin <quintin@ably.io>
[cleanup] Adding NS_ASSUME_NONNULL_BEGIN and END as per the comment #13 (comment) Co-authored-by: Quintin <quintin@ably.io>
- remove usage of abbreviations gen -> generated https://github.com/ably/ably-flutter/pull/13/files#r434369291 - remove commented code (will be re-implemented while working on channel events) https://github.com/ably/ably-flutter/pull/13/files#r434372985 - make Java static classes final https://github.com/ably/ably-flutter/pull/13/files#r434373812
- `@import Foundation;` https://github.com/ably/ably-flutter/pull/13/files#r434376328 https://github.com/ably/ably-flutter/pull/13/files#r434376097 - static externs instead of assigned properties https://github.com/ably/ably-flutter/pull/13/files#r434381831 - missing properties in platform libraries added to issue #14 https://github.com/ably/ably-flutter/pull/13/files#r434454731
b78eba3
to
5fcbad8
Compare
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.
Thanks for adding commentary, @tiholic ... Now that I'm looking at this again from a bit more of a zoomed out view, plus observing that you've reduced visibility for some of the types, I think some of the names can be simplified:
_CodecEncoder
rename to_Encoder
_CodecDecoder
rename to_Decoder
_CodecPair
rename to_Codec
(by definition bidirectional, thus implicitly a pair)
@QuintinWillison renamed |
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.
@tiholic please merge this when you're ready to.
[code consistency] remove space for ObjC arguments #13 (comment) Co-authored-by: Quintin <quintin@ably.io>
[cleanup] Adding NS_ASSUME_NONNULL_BEGIN and END as per the comment #13 (comment) Co-authored-by: Quintin <quintin@ably.io>
JSON based encoding and decoding.
Encoders and Decoders will now return
JSON
fromAbly type
and returnAbly type
fromJSON
Addressing: #12
Codegen for constants that need to be in Sync on platform side and flutter side
MethodChannel
andEventChannel
ClientOptions.authUrl
,ClientOptions.authMethod
, etc)PS
protobuf based codec didn't turnout to be a good approach as per trails and discussions.
And other approaches like flatbuffers don't have direct support for Objective-C, but support Swift which would require us to port iOS platform code to Swift.