-
Notifications
You must be signed in to change notification settings - Fork 548
Implementing Feature Switch for CFNetworkHandler and NSUrlSessionHandler #19003
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
Closed
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
410cd4b
Add UseCFNetworkHandler and UseNSUrlSessionHandler internal static bo…
Agnik7 c334747
Compute the value for properties UseCFNetworkHandler and UseNSUrlSess…
Agnik7 04e103a
Computing the values for UseCFNetworkHandler and UseNSUrlSessionHandler
Agnik7 d00e2b8
Added 2 new Runtimes
Agnik7 ee19d84
Reworked code to use 2 new Runtime properties
Agnik7 4e9835e
Fixed compilation errors, moved logic to Read() method.
dustin-wojciechowski 89f467f
Fixed formatting
dustin-wojciechowski d32496e
Auto-format source code
d9902b8
Merge branch 'net8.0' into net8.0
dalexsoto 5ec35c6
Created backing fields for UseCFNetworkHandler and UseNSURLSessionHan…
dustin-wojciechowski 88b9703
Whitespace
dustin-wojciechowski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,6 +156,15 @@ internal static TypeDefinition GetHttpMessageHandler (Application app, RuntimeOp | |
|
||
internal static RuntimeOptions? Read () | ||
{ | ||
#if NET | ||
var options = new RuntimeOptions (); | ||
if (Runtime.UseCFNetworkHandler) | ||
options.http_message_handler = CFNetworkHandlerValue; | ||
else if (Runtime.UseNSUrlSessionHandler) | ||
options.http_message_handler = NSUrlSessionHandlerValue; | ||
|
||
return options; | ||
#else | ||
Comment on lines
157
to
+167
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this can be simplified a lot more, by inlining this logic in the GetHttpMessageHandler method below: internal static HttpMessageHandler GetHttpMessageHandler ()
{
#if NET
if (Runtime.UseCFNetworkHandler)
return new CFNetworkHandler ();
if (Runtime.UseNSUrlSessionHandler)
return new NSUrlSessionHandler ();
return new HttpClientHandler ();
#else
// existing logic
#endif
} |
||
// for iOS NSBundle.ResourcePath returns the path to the root of the app bundle | ||
// for macOS apps NSBundle.ResourcePath returns foo.app/Contents/Resources | ||
// for macOS frameworks NSBundle.ResourcePath returns foo.app/Versions/Current/Resources | ||
|
@@ -171,6 +180,7 @@ internal static TypeDefinition GetHttpMessageHandler (Application app, RuntimeOp | |
options.http_message_handler = (NSString) plist ["HttpMessageHandler"]; | ||
return options; | ||
} | ||
#endif | ||
} | ||
|
||
// This is invoked by | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The assignment to the default value is unnecessary, except that the default is to use NSUrlSessionHandler: