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

Network Rearchitecture #1341

Merged
merged 109 commits into from
Sep 11, 2020
Merged

Conversation

designatednerd
Copy link
Contributor

This PR relates to the RFC for the new networking stack - this branch is basically where I've been doing explorations thus far.

@designatednerd designatednerd force-pushed the explore/interceptors branch 2 times, most recently from 6172015 to df6024d Compare August 4, 2020 21:30
@designatednerd designatednerd force-pushed the explore/interceptors branch 4 times, most recently from 91c9c47 to 0bde055 Compare August 13, 2020 01:51
@designatednerd designatednerd force-pushed the explore/interceptors branch 2 times, most recently from 6af46dc to 515b1db Compare August 20, 2020 19:39
import Foundation

/// An error interceptor called to allow further examination of error data when an error occurs in the chain.
public protocol ApolloErrorInterceptor {
Copy link

@amadeu01 amadeu01 Aug 26, 2020

Choose a reason for hiding this comment

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

I'm not sure if it would work, but what do you think of instead using protocol for this interceptor, actually, use just a function. For instance,

typealias ApolloErrorInterceptor =  (Error,
       RequestChain,
       HTTPRequest<Operation>,
       HTTPResponse<Operation>?,
       @escaping (Result<GraphQLResult<Operation.Data>, Error>) -> Void)) -> Void

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would wayyyyyy rather have this as a protocol, particularly since it gives longer term flexibility to add more methods if needed.

@designatednerd designatednerd force-pushed the explore/interceptors branch 4 times, most recently from af574ef to 1dd71de Compare September 3, 2020 18:04
extension GraphQLResult where Data: Decodable {

public init<T: FlexibleDecoder>(from data: Foundation.Data, decoder: T) throws {
// SWIFT CODEGEN: fix this to handle codable better
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thoroughly punting on this for now.

@designatednerd
Copy link
Contributor Author

A preview of the updated networking setup instructions can be found here.

Going to be updating the tutorial portion dealing with these changes before cutting a beta. Would love feedback!

…entifier for watcher context vs identifier for actual URLSessionTask
@designatednerd designatednerd changed the base branch from main to betas/networking-stack September 10, 2020 21:36
@designatednerd designatednerd changed the title [DRAFT]: Network Rearchitecture Network Rearchitecture Sep 10, 2020
@designatednerd designatednerd marked this pull request as ready for review September 10, 2020 21:36
@designatednerd
Copy link
Contributor Author

OK, pointing this at betas/networking-stack - once tests pass here I'll be cutting a beta from that branch and further PRs will go to that branch until the networking stack gets merged to main.

@designatednerd designatednerd merged commit 713430d into betas/networking-stack Sep 11, 2020
@designatednerd designatednerd deleted the explore/interceptors branch September 11, 2020 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants