Skip to content
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

Merged
merged 19 commits into from
Jul 6, 2020
Merged

re-codec using JSON and Codegen #13

merged 19 commits into from
Jul 6, 2020

Conversation

tiholic
Copy link
Contributor

@tiholic tiholic commented May 23, 2020

JSON based encoding and decoding.

Encoders and Decoders will now return JSON from Ably type and return Ably type from JSON
Addressing: #12

Codegen for constants that need to be in Sync on platform side and flutter side

  • Generate codec types (Addressing: Feature/platform message encoding #5 (comment))
  • Generate method names for MethodChannel and EventChannel
  • Generate Properties of all transferable objects (Ex: 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.

Copy link
Contributor

@QuintinWillison QuintinWillison left a 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! 😀

bin/README.md Show resolved Hide resolved
bin/codegen.dart Show resolved Hide resolved
ios/Classes/codec/AblyFlutterReader.h Outdated Show resolved Hide resolved
ios/Classes/codec/AblyFlutterReader.m Outdated Show resolved Hide resolved
ios/Classes/codec/AblyFlutterReader.m Outdated Show resolved Hide resolved
ios/Classes/codec/AblyFlutterWriter.m Outdated Show resolved Hide resolved
lib/src/codec.dart Outdated Show resolved Hide resolved
tiholic added a commit that referenced this pull request Jun 4, 2020
[code consistency] remove space for ObjC arguments

#13 (comment)

Co-authored-by: Quintin <quintin@ably.io>
tiholic added a commit that referenced this pull request Jun 4, 2020
[cleanup] Adding NS_ASSUME_NONNULL_BEGIN and END as per the comment

#13 (comment)

Co-authored-by: Quintin <quintin@ably.io>
Copy link
Member

@mattheworiordan mattheworiordan left a 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

tiholic pushed a commit that referenced this pull request Jun 5, 2020
tiholic pushed a commit that referenced this pull request Jun 5, 2020
Copy link
Contributor Author

@tiholic tiholic left a 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')}
''';
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree 💯

Addressed in 72743fd

Base automatically changed from feature/realtime-pilot to master June 20, 2020 09:43
Rohit R. Abbadi and others added 16 commits June 20, 2020 15:22
- 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
@tiholic tiholic force-pushed the feature/codec-upgrade branch from b78eba3 to 5fcbad8 Compare June 20, 2020 09:54
Copy link
Contributor

@QuintinWillison QuintinWillison left a 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)

@tiholic
Copy link
Contributor Author

tiholic commented Jun 27, 2020

@QuintinWillison renamed _CodecEncoder and _CodecDecoder, bit I'd prefer leaving the class name _CodecPair as is because the class extending StandardMessageCodec is named as Codec (ref)

2a49b96

Copy link
Contributor

@QuintinWillison QuintinWillison left a 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.

@tiholic tiholic merged commit 20bd3b5 into master Jul 6, 2020
tiholic added a commit that referenced this pull request Jul 6, 2020
[code consistency] remove space for ObjC arguments

#13 (comment)

Co-authored-by: Quintin <quintin@ably.io>
tiholic added a commit that referenced this pull request Jul 6, 2020
[cleanup] Adding NS_ASSUME_NONNULL_BEGIN and END as per the comment

#13 (comment)

Co-authored-by: Quintin <quintin@ably.io>
@tiholic tiholic deleted the feature/codec-upgrade branch July 6, 2020 18:59
tiholic pushed a commit that referenced this pull request Jul 6, 2020
tiholic pushed a commit that referenced this pull request Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants