Skip to content

Commit

Permalink
Remove dependency on TCDownload again.
Browse files Browse the repository at this point in the history
  • Loading branch information
uliwitness authored and alexrepty committed Mar 19, 2010
1 parent de7cea7 commit 2840711
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 29 deletions.
5 changes: 3 additions & 2 deletions MGTwitterEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@

#import "MGTwitterEngineDelegate.h"
#import "MGTwitterParserDelegate.h"
#import "TCDownload.h"

@interface MGTwitterEngine : NSObject <MGTwitterParserDelegate, TCDownloadDelegate> {

@interface MGTwitterEngine : NSObject <MGTwitterParserDelegate>
{
__weak NSObject <MGTwitterEngineDelegate> *_delegate;
NSString *_username;
NSString *_password;
Expand Down
21 changes: 6 additions & 15 deletions MGTwitterEngine.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ - (NSString *)_sendRequestWithMethod:(NSString *)method
requestType:(MGTwitterRequestType)requestType
responseType:(MGTwitterResponseType)responseType;

-(NSString *)_sendRequest:(NSURLRequest *)theRequest
withRequestType:(MGTwitterRequestType)requestType
responseType:(MGTwitterResponseType)responseType;

// Parsing methods
- (void)_parseDataForConnection:(MGTwitterHTTPURLConnection *)connection;

Expand Down Expand Up @@ -571,7 +575,8 @@ - (NSString *)_sendRequestWithMethod:(NSString *)method

-(NSString *)_sendRequest:(NSURLRequest *)theRequest
withRequestType:(MGTwitterRequestType)requestType
responseType:(MGTwitterResponseType)responseType{
responseType:(MGTwitterResponseType)responseType
{
// Create a connection using this request, with the default timeout and caching policy,
// and appropriate Twitter request and response types for parsing and error reporting.
MGTwitterHTTPURLConnection *connection;
Expand Down Expand Up @@ -776,20 +781,6 @@ - (void)parsedObject:(NSDictionary *)dictionary forRequest:(NSString *)requestId

#endif

#pragma mark TCDownload delegate methods

-(void)downloadDidBegin:(TCDownload *)download{
if ([self _isValidDelegateForSelector:@selector(connectionStarted:)])
[_delegate connectionStarted:[[download userInfo] objectForKey:@"identifier"]];
}

-(void)downloadFinished:(TCDownload *)download{
[self connectionDidFinishLoading:(MGTwitterHTTPURLConnection*)download];
}

-(void)download:(TCDownload *)download hadError:(NSError *)error{
[self connection:(MGTwitterHTTPURLConnection*)download didFailWithError:error];
}

#pragma mark NSURLConnection delegate methods

Expand Down
7 changes: 2 additions & 5 deletions MGTwitterHTTPURLConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@

#import "MGTwitterRequestTypes.h"

#import "TCDownload.h"

@interface MGTwitterHTTPURLConnection : NSURLConnection {
@interface MGTwitterHTTPURLConnection : NSURLConnection
{
NSMutableData *_data; // accumulated data received on this connection
MGTwitterRequestType _requestType; // general type of this request, mostly for error handling
MGTwitterResponseType _responseType; // type of response data expected (if successful)
NSString *_identifier;
NSURL *_URL; // the URL used for the connection (needed as a base URL when parsing with libxml)

TCDownload *_download;
}

// Initializer
Expand All @@ -37,6 +35,5 @@
- (MGTwitterRequestType)requestType;
- (MGTwitterResponseType)responseType;
- (NSString *)description;
- (TCDownload *)download;

@end
7 changes: 0 additions & 7 deletions MGTwitterHTTPURLConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ - (id)initWithRequest:(NSURLRequest *)request delegate:(id)delegate
_requestType = requestType;
_responseType = responseType;
_URL = [[request URL] retain];

_download = [[TCDownload alloc] initWithURL:_URL];
}

return self;
Expand Down Expand Up @@ -97,9 +95,4 @@ - (NSString *)description
return [description stringByAppendingFormat:@" (requestType = %d, identifier = %@)", _requestType, _identifier];
}

- (TCDownload *)download{
return _download;
}


@end

0 comments on commit 2840711

Please sign in to comment.