Migrate Essentials v0.0.1: Implement Client with openUrl method #2
Conversation
Added LICENSE preamble in files
…onse Partial migration from: unsuitable001/dart_cronet_sample to google/cronet.dart
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.
Round 1 of review.
fixed un-nessesary removal of code from .gitignore refined analysis options added changelog
Done. Please check the changes :) |
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.
Round 1.1 of review.
@unsuitable001 You can remove the empty dev_dependencies:
...
lints: ^1.0.1 |
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.
Round 2 of review.
behaviour change: If registerCallbacks & close api is used togather, the later called on will resolve with a RequestListenerException.
@mannprerak2 Resolved the issues. Please check :) I've also trimmed the flutter |
…lback's `next` callback is removed. It is now called directly. refactor: docs and cleaned api detection
@dcharkes @mannprerak2 Some changes and small fix for |
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.
Round 3 of review.
@mannprerak2 Changes done :) oppsie again. :) forgot to put newline between few as they cross that 80char limit. I'll push that with next review's changes. |
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.
Looking good so far! 👌
Here's my first round of comments.
Maybe we should remove flutter support from this PR and do it in a next one. Then we can focus on getting the dart standalone setup (package-wise, code-layout-wise, CI-wise) right in this PR, and focus on those aspects for Flutter in a follow up CL.
lib/src/prepare_cronet.dart
Outdated
|
||
/// Download [cronet] library | ||
/// from Github Releases | ||
Future<void> downloadCronetBinaries(String platform) async { |
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.
Can we get a buildCronetBinaries
as well? (Automating the steps you did locally to build the binary.)
That way we can just run buildCronetBinaries
when we want to make the binaries for a new version.
Also, that would enable users to build instead of download if they so prefer.
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.
Let's make this build utility to build the wrapper for that custom version and print the link to build cronet in the console. Should we also take the responsibility for building actual cronet binaries? I guess that may turn out to be a little bit hard to maintain. What's your view?
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.
Well, you need to build the libcronet.xxxx.so/dll yourself also right? It would be useful to have the steps to do that as a Dart script, so that you don't forget.
We can either have that script in tool/update_cronet.dart so that you can update the shared libraries with a simple step, or we can have it available in bin/setup.dart as dart run cronet:build-cronet
(or something similar).
@dcharkes Done with this round of changes. 😃 |
@dcharkes Done with this round of changes. There are few queries in some of the review threads. Waiting for your thoughts on them. Other than that, there's a change on what we discussed before. Change: Exposed few Reason: The executor (thread) we're using is written in C/C++ and a part of the wrapper. So, we've to expose few cronet apis to make executor work. And, wrapper also handles few memory management tasks (e.g. finalizers etc.) for us. So, I decided to keep the pattern and expose the function for registering callbacks to the wrapper. |
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.
Next round of comments
README.md
Outdated
|
||
```bash | ||
dart pub get | ||
dart run cronet <platform> # Downloads the cronet binaries. |
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.
dart run cronet:setup
@@ -0,0 +1,201 @@ | |||
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file |
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.
Nice! I like how this is set up!
requestParams, _method.toNativeUtf8().cast<Int8>()); | ||
wrapper.InitSampleExecutor(_callbackHandler.executor); | ||
|
||
final cronetCallbacks = cronet.Cronet_UrlRequestCallback_CreateWith( |
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.
Maybe add a TODO with a reference to the relevant ffigen issue with regard to the casts.
@dcharkes Typos are fixed and ffigen issue reference added. Tell Google to make a AI typo finder for me :p (Autocorrect for programmers) |
Summary
dart:io
style API.Exception
s are implemented.Notes and Breaking Changes from
dart:io
Custom SecurityContext is no longer handled by the client. Users have to handle it in other ways. (To be documented later)
userAgent property is now read-only. Custom userAgent should be passed as a constructor argument.
Force close isn't enabled in this PR.
Partial migration from: unsuitable001/dart_cronet_sample