MKNetworkKit
MKNetworkKit copied to clipboard
[Enhancement] Enqueue dependencies of MKNetworkOperation
In my own business logic, I wish to chain multiple MKNetworkOperation
s.
For example, upload a file, get the file_id
of uploaded files then put it into post field of the next operation.
I make this with subclassing MKNetworkEngine
as follow.
- (void)enqueueOperation:(MKNetworkOperation *)request forceReload:(BOOL)forceReload
{
[request.dependencies enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
if ([obj isKindOfClass:[MKNetworkOperation class]]) {
[self enqueueOperation:obj forceReload:forceReload];
}
}];
[super enqueueOperation:request forceReload:forceReload];
}
I also insert a subclassable method in the -(void) main
of MKNetworkOpeartion
so I have the chance to modify the post filed before it start.
Because I'm not a experienced library developer, instead of sending a pull request, I wish you could add some kind of mechanism like that.
Best wishes.