--- a/Plugins/Twitter Plugin/STTwitter/STTwitterAPIWrapper.h Thu Mar 21 11:36:41 2013 +0100
+++ b/Plugins/Twitter Plugin/STTwitter/STTwitterAPIWrapper.h Thu Mar 21 14:06:17 2013 +0100
@@ -20,7 +20,7 @@
#import <Foundation/Foundation.h>
+#import "STTwitterOAuth.h" Partial Objective-C front-end for https://dev.twitter.com/docs/api/1.1
@@ -42,7 +42,11 @@
https://dev.twitter.com/blog/new-withheld-content-fields-api-responses
-@interface STTwitterAPIWrapper : NSObject
+@interface STTwitterAPIWrapper : NSObject { + NSObject <STTwitterOAuthProtocol> *_oauth; + NSString *_consumerName; + (STTwitterAPIWrapper *)twitterAPIWithOAuthConsumerName:(NSString *)consumerName
consumerKey:(NSString *)consumerKey
--- a/Plugins/Twitter Plugin/STTwitter/STTwitterAPIWrapper.m Thu Mar 21 11:36:41 2013 +0100
+++ b/Plugins/Twitter Plugin/STTwitter/STTwitterAPIWrapper.m Thu Mar 21 14:06:17 2013 +0100
@@ -18,6 +18,10 @@
@implementation STTwitterAPIWrapper
+@synthesize oauth = _oauth; +@synthesize consumerName = _consumerName; +@synthesize userName = _userName; @@ -183,8 +187,8 @@
mparams = [NSMutableDictionary new];
- if (optionalSinceID) mparams[@"since_id"] = optionalSinceID;
- if (optionalCount != NSNotFound) mparams[@"count"] = [@(optionalCount) stringValue];
+ if (optionalSinceID) [mparams setObject:optionalSinceID forKey:@"since_id"]; + if (optionalCount != NSNotFound) [mparams setObject:[@(optionalCount) stringValue] forKey:@"count"]; __block NSMutableArray *statuses = [NSMutableArray new];
__block void (^requestHandler)(id response) = nil;
@@ -200,7 +204,7 @@
NSUInteger maxID = [[NSDecimalNumber decimalNumberWithString:lastID] unsignedIntegerValue];
- mparams[@"max_id"] = [@(--maxID) stringValue];
+ [mparams setObject:[@(--maxID) stringValue] forKey:@"max_id"]; [_oauth getResource:timeline parameters:mparams
@@ -293,16 +297,16 @@
NSMutableDictionary *md = [NSMutableDictionary dictionaryWithObject:status forKey:@"status"];
if(optionalExistingStatusID) {
- md[@"in_reply_to_status_id"] = optionalExistingStatusID;
+ [md setObject:optionalExistingStatusID forKey:@"in_reply_to_status_id"]; - md[@"place_id"] = optionalPlaceID;
- md[@"display_coordinates"] = @"true";
+ [md setObject:optionalPlaceID forKey:@"place_id"]; + [md setObject:@"true" forKey:@"display_coordinates"]; } else if(optionalLat && optionalLon) {
- md[@"lat"] = optionalLat;
- md[@"lon"] = optionalLon;
- md[@"display_coordinates"] = @"true";
+ [md setObject:optionalLat forKey:@"lat"]; + [md setObject:optionalLon forKey:@"lon"]; + [md setObject:@"true" forKey:@"display_coordinates"]; [_oauth postResource:@"statuses/update.json" parameters:md successBlock:^(id response) {
@@ -326,16 +330,16 @@
NSMutableDictionary *md = [[ @{ @"status":status, @"media[]":data, @"postDataKey":@"media[]" } mutableCopy] autorelease];
if(optionalExistingStatusID) {
- md[@"in_reply_to_status_id"] = optionalExistingStatusID;
+ [md setObject:optionalExistingStatusID forKey:@"in_reply_to_status_id"]; - md[@"place_id"] = optionalPlaceID;
- md[@"display_coordinates"] = @"true";
+ [md setObject:optionalPlaceID forKey:@"place_id"]; + [md setObject:@"true" forKey:@"display_coordinates"]; } else if(optionalLat && optionalLon) {
- md[@"lat"] = optionalLat;
- md[@"lon"] = optionalLon;
- md[@"display_coordinates"] = @"true";
+ [md setObject:optionalLat forKey:@"lat"]; + [md setObject:optionalLon forKey:@"lon"]; + [md setObject:@"true" forKey:@"display_coordinates"]; [_oauth postResource:@"statuses/update_with_media.json" parameters:md successBlock:^(id response) {
@@ -431,7 +435,7 @@
[ids addObjectsFromArray:[response objectForKey:@"users"]];
cursor = [[response objectForKey:@"next_cursor_str"] copy];
+ [d setObject:cursor forKey:@"cursor"]; if ([cursor isEqualToString:@"0"]) {
@@ -487,7 +491,7 @@
successBlock:(void(^)(NSDictionary *relationship))successBlock
errorBlock:(void(^)(NSError *error))errorBlock {
NSMutableDictionary *d = [NSMutableDictionary dictionaryWithObject:screenName forKey:@"screen_name"];
- d[@"device"] = notify ? @"true" : @"false";
+ [d setObject:notify ? @"true" : @"false" forKey:@"device"]; [_oauth getResource:@"friendships/update.json" parameters:d successBlock:^(id response) {
successBlock(removeNull(response));
--- a/Plugins/Twitter Plugin/STTwitter/STTwitterAppOnly.h Thu Mar 21 11:36:41 2013 +0100
+++ b/Plugins/Twitter Plugin/STTwitter/STTwitterAppOnly.h Thu Mar 21 14:06:17 2013 +0100
@@ -10,7 +10,9 @@
#import "STTwitterOAuthProtocol.h"
@interface STTwitterAppOnly : NSObject <STTwitterOAuthProtocol> {
+ NSString *_consumerKey; + NSString *_consumerSecret; + NSString *_bearerToken; @property (nonatomic, retain) NSString *consumerKey;
--- a/Plugins/Twitter Plugin/STTwitter/STTwitterAppOnly.m Thu Mar 21 11:36:41 2013 +0100
+++ b/Plugins/Twitter Plugin/STTwitter/STTwitterAppOnly.m Thu Mar 21 14:06:17 2013 +0100
@@ -16,6 +16,11 @@
@implementation STTwitterAppOnly
+@synthesize consumerKey = _consumerKey; +@synthesize consumerSecret = _consumerSecret; +@synthesize bearerToken = _bearerToken; [_consumerSecret release];
--- a/Plugins/Twitter Plugin/STTwitter/STTwitterOAuth.h Thu Mar 21 11:36:41 2013 +0100
+++ b/Plugins/Twitter Plugin/STTwitter/STTwitterOAuth.h Thu Mar 21 14:06:17 2013 +0100
@@ -20,7 +20,19 @@
-@interface STTwitterOAuth : NSObject <STTwitterOAuthProtocol>
+@interface STTwitterOAuth : NSObject <STTwitterOAuthProtocol> { + NSString *_oauthConsumerName; + NSString *_oauthConsumerKey; + NSString *_oauthConsumerSecret; + NSString *_oauthRequestToken; + NSString *_oauthRequestTokenSecret; + NSString *_oauthAccessToken; + NSString *_oauthAccessTokenSecret; + NSString *_testOauthNonce; + NSString *_testOauthTimestamp; + (STTwitterOAuth *)twitterServiceWithConsumerName:(NSString *)consumerName
consumerKey:(NSString *)consumerKey
--- a/Plugins/Twitter Plugin/STTwitter/STTwitterOAuth.m Thu Mar 21 11:36:41 2013 +0100
+++ b/Plugins/Twitter Plugin/STTwitter/STTwitterOAuth.m Thu Mar 21 14:06:17 2013 +0100
@@ -38,6 +38,18 @@
@implementation STTwitterOAuth
+@synthesize username = _username; +@synthesize password = _password; +@synthesize oauthConsumerName = _oauthConsumerName; +@synthesize oauthConsumerKey = _oauthConsumerKey; +@synthesize oauthConsumerSecret = _oauthConsumerSecret; +@synthesize oauthRequestToken = _oauthRequestToken; +@synthesize oauthRequestTokenSecret = _oauthRequestTokenSecret; +@synthesize oauthAccessToken = _oauthAccessToken; +@synthesize oauthAccessTokenSecret = _oauthAccessTokenSecret; +@synthesize testOauthNonce = _testOauthNonce; +@synthesize testOauthTimestamp = _testOauthTimestamp; @@ -276,8 +288,8 @@
NSURL *url = [NSURL URLWithString:s];
- self.oauthRequestToken = d[@"oauth_token"];
- self.oauthRequestTokenSecret = d[@"oauth_token_secret"]; // unused
+ self.oauthRequestToken = [d objectForKey:@"oauth_token"]; + self.oauthRequestTokenSecret = [d objectForKey:@"oauth_token_secret"]; // unused successBlock(url, _oauthRequestToken);
@@ -303,10 +315,10 @@
// https://api.twitter.com/oauth/authorize?oauth_token=OAUTH_TOKEN&oauth_token_secret=OAUTH_TOKEN_SECRET&user_id=USER_ID&screen_name=SCREEN_NAME
- self.oauthAccessToken = dict[@"oauth_token"];
- self.oauthAccessTokenSecret = dict[@"oauth_token_secret"];
+ self.oauthAccessToken = [dict objectForKey:@"oauth_token"]; + self.oauthAccessTokenSecret = [dict objectForKey:@"oauth_token_secret"]; - successBlock(_oauthAccessToken, _oauthAccessTokenSecret, dict[@"user_id"], dict[@"screen_name"]);
+ successBlock(_oauthAccessToken, _oauthAccessTokenSecret, [dict objectForKey:@"user_id"], [dict objectForKey:@"screen_name"]); } errorBlock:^(NSError *error) {
@@ -333,10 +345,10 @@
// https://api.twitter.com/oauth/authorize?oauth_token=OAUTH_TOKEN&oauth_token_secret=OAUTH_TOKEN_SECRET&user_id=USER_ID&screen_name=SCREEN_NAME
- self.oauthAccessToken = dict[@"oauth_token"];
- self.oauthAccessTokenSecret = dict[@"oauth_token_secret"];
+ self.oauthAccessToken = [dict objectForKey:@"oauth_token"]; + self.oauthAccessTokenSecret = [dict objectForKey:@"oauth_token_secret"]; - successBlock(_oauthAccessToken, _oauthAccessTokenSecret, dict[@"user_id"], dict[@"screen_name"]);
+ successBlock(_oauthAccessToken, _oauthAccessTokenSecret, [dict objectForKey:@"user_id"], [dict objectForKey:@"screen_name"]); } errorBlock:^(NSError *error) {
@@ -554,7 +566,7 @@
NSArray *kv = [s componentsSeparatedByString:@"="];
NSAssert([kv count] == 2, @"-- bad length");
if([kv count] != 2) continue;
- [ma addObject:@{kv[0] : kv[1]}];
+ [ma addObject:@{[kv objectAtIndex:0] : [kv objectAtIndex:1]}]; @@ -603,7 +615,7 @@
- [md setObject:keyValue[1] forKey:keyValue[0]];
+ [md setObject:[keyValue objectAtIndex:1] forKey:[keyValue objectAtIndex:0]]; --- a/Plugins/Twitter Plugin/STTwitter/Vendor/STHTTPRequest.h Thu Mar 21 11:36:41 2013 +0100
+++ b/Plugins/Twitter Plugin/STTwitter/Vendor/STHTTPRequest.h Thu Mar 21 14:06:17 2013 +0100
@@ -22,7 +22,33 @@
typedef void (^completionBlock_t)(NSDictionary *headers, NSString *body);
typedef void (^errorBlock_t)(NSError *error);
-@interface STHTTPRequest : NSObject <NSURLConnectionDelegate>
+@interface STHTTPRequest : NSObject <NSURLConnectionDelegate> { + NSURLConnection *_connection; + NSMutableData *_responseData; + NSString *_responseStringEncodingName; + NSDictionary *_responseHeaders; + NSString *_POSTFilePath; + NSString *_POSTFileMimeType; + NSString *_POSTFileName; + NSString *_POSTFileParameter; + uploadProgressBlock_t _uploadProgressBlock; + completionBlock_t _completionBlock; + errorBlock_t _errorBlock; + NSStringEncoding _postDataEncoding; + NSDictionary *_POSTDictionary; + NSMutableDictionary *_requestHeaders; + NSInteger _responseStatus; + NSString *_responseString; + NSStringEncoding _forcedResponseEncoding; + BOOL _encodePOSTDictionary; + NSUInteger _timeoutSeconds; + BOOL _addCredentialsToURL; @property (copy) uploadProgressBlock_t uploadProgressBlock;
@property (copy) completionBlock_t completionBlock;
--- a/Plugins/Twitter Plugin/STTwitter/Vendor/STHTTPRequest.m Thu Mar 21 11:36:41 2013 +0100
+++ b/Plugins/Twitter Plugin/STTwitter/Vendor/STHTTPRequest.m Thu Mar 21 14:06:17 2013 +0100
@@ -36,6 +36,31 @@
@implementation STHTTPRequest
+@synthesize connection = _connection; +@synthesize responseData = _responseData; +@synthesize responseStringEncodingName = _responseStringEncodingName; +@synthesize responseHeaders = _responseHeaders; +@synthesize error = _error; +@synthesize POSTFilePath = _POSTFilePath; +@synthesize POSTFileData = _POSTFileData; +@synthesize POSTFileMimeType = _POSTFileMimeType; +@synthesize POSTFileName = _POSTFileName; +@synthesize POSTFileParameter = _POSTFileParameter; +@synthesize uploadProgressBlock = _uploadProgressBlock; +@synthesize completionBlock = _completionBlock; +@synthesize errorBlock = _errorBlock; +@synthesize postDataEncoding = _postDataEncoding; +@synthesize POSTDictionary = _POSTDictionary; +@synthesize POSTData = _POSTData; +@synthesize requestHeaders = _requestHeaders; +@synthesize responseStatus = _responseStatus; +@synthesize responseString = _responseString; +@synthesize forcedResponseEncoding = _forcedResponseEncoding; +@synthesize encodePOSTDictionary = _encodePOSTDictionary; +@synthesize timeoutSeconds = _timeoutSeconds; +@synthesize addCredentialsToURL = _addCredentialsToURL; #pragma mark Initializers
+ (STHTTPRequest *)requestWithURL:(NSURL *)url {