Permalink
Browse files

Added method cancel login

  • Loading branch information...
1 parent 5274535 commit 4bd927807371ecc693ed73d3f033259ddd8e7495 @lucascorrea committed May 1, 2012
Showing with 36 additions and 1 deletion.
  1. +36 −1 SCTwitter/SCTwitter/SCTwitter.m
@@ -43,7 +43,7 @@ - (void)getUserInformationFor:(NSString *)username callback:(void (^)(BOOL succe
- (void)directMessage:(NSString *)message to:(NSString *)username callback:(void (^)(BOOL success, id result))aCallback;
- (void)retweetMessage:(NSString *)updateID callback:(void (^)(BOOL success, id result))aCallback;
- (void)postWithMessage:(NSString *)message uploadPhoto:(UIImage *)image latitude:(double)lat longitude:(double)lng callback:(void (^)(BOOL success, id result))aCallback;
-
+- (void)postWithMessage:(NSString *)message replyToStatusId:(unsigned long)replyTo latitude:(double)lat longitude:(double)lng callback:(void (^)(BOOL success, id result))aCallback;
@end
@@ -149,6 +149,16 @@ + (void)postWithMessage:(NSString *)message uploadPhoto:(UIImage *)image latitud
[[SCTwitter shared] postWithMessage:message uploadPhoto:image latitude:lat longitude:lng callback:aCallback];
}
++ (void)postWithMessage:(NSString *)message latitude:(double)lat longitude:(double)lng callback:(void (^)(BOOL success, id result))aCallback
+{
+ [[SCTwitter shared] postWithMessage:message replyToStatusId:0 latitude:lat longitude:lng callback:aCallback];
+}
+
++ (void)postWithMessage:(NSString *)message replyToStatusId:(unsigned long)replyTo latitude:(double)lat longitude:(double)lng callback:(void (^)(BOOL success, id result))aCallback
+{
+ [[SCTwitter shared] postWithMessage:message replyToStatusId:replyTo latitude:lat longitude:lng callback:aCallback];
+}
+
@@ -317,6 +327,22 @@ - (void)postWithMessage:(NSString *)message uploadPhoto:(UIImage *)image latitud
}
}
+- (void)postWithMessage:(NSString *)message replyToStatusId:(unsigned long)replyTo latitude:(double)lat longitude:(double)lng callback:(void (^)(BOOL success, id result))aCallback
+{
+ if (![self isSessionValid]) {
+
+ // Call the login callback if we have one
+ if (aCallback) {
+ aCallback(NO, @"Error");
+ }
+
+ }else{
+
+ self.statusCallback = aCallback;
+ [_engine sendUpdate:message inReplyTo:replyTo latitude:lat longitude:lng];
+ }
+}
+
@@ -333,6 +359,15 @@ - (void) OAuthTwitterController: (SA_OAuthTwitterController *) controller authen
}
+- (void)OAuthTwitterControllerCanceled:(SA_OAuthTwitterController *)controller
+{
+ // Call the login callback
+ if (self.loginCallback) {
+ self.loginCallback(NO);
+ self.loginCallback = nil;
+ }
+}
+
#pragma mark -
#pragma mark - SA_OAuthTwitterEngineDelegate methods

0 comments on commit 4bd9278

Please sign in to comment.