Permalink
Browse files

Merge public master hot fixes

Summary:
Just a merge of the public changes into the private master repo,
in preparation for a push to public master

@merge-commit: jacl

Test Plan: Ran Hackbook and Scrumtious

Reviewers: gregschechte, mmarucheck, clang

Reviewed By: mmarucheck

CC: msdkexp@

Differential Revision: https://phabricator.fb.com/D534966

Task ID: 1235919
  • Loading branch information...
2 parents 5f882ed + af2fc3b commit 2a5ef249d96deaaec648521f9609d229af4689fd Jason Clark committed Aug 1, 2012
@@ -559,6 +559,7 @@ - (void)enableFrictionlessAppRequests {
otherButtonTitles:nil,
nil];
[alertView show];
+ [alertView release];
}
/*
@@ -697,6 +698,8 @@ - (void)apiGraphUserPhotosPost {
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
img, @"picture",
nil];
+ [img release];
+
[[delegate facebook] requestWithGraphPath:@"me/photos"
andParams:params
andHttpMethod:@"POST"
@@ -995,15 +998,17 @@ - (void)request:(FBRequest *)request didLoad:(id)result {
NSMutableArray *friendsWithApp = [[NSMutableArray alloc] initWithCapacity:1];
// Many results
if ([result isKindOfClass:[NSArray class]]) {
- friendsWithApp = [[NSMutableArray alloc] initWithArray:result copyItems:YES];
+ [friendsWithApp addObjectsFromArray:result];
} else if ([result isKindOfClass:[NSDecimalNumber class]]) {
- friendsWithApp = [[NSMutableArray alloc] initWithObjects:[result stringValue], nil];
+ [friendsWithApp addObject: [result stringValue]];
}
+
if ([friendsWithApp count] > 0) {
[self apiDialogRequestsSendToUsers:friendsWithApp];
} else {
[self showMessage:@"None of your friends are using the app."];
}
+
[friendsWithApp release];
break;
}
@@ -290,9 +290,6 @@ - (void)request:(FBRequest *)request didReceiveResponse:(NSURLResponse *)respons
* didReceiveResponse:(NSURLResponse *)response
*/
- (void)request:(FBRequest *)request didLoad:(id)result {
- if ([result isKindOfClass:[NSArray class]]) {
- result = [result objectAtIndex:0];
- }
[self showMessage:@"Checked in successfully"];
}
@@ -429,10 +429,10 @@ - (void)request:(FBRequest *)request didLoad:(id)result {
UIGraphicsBeginImageContext(CGSizeMake(px, px));
UIRectClip(clipRect);
[image drawInRect:clipRect];
- UIImage *imgThumb = UIGraphicsGetImageFromCurrentImageContext();
- [imgThumb retain];
-
+ UIImage *imgThumb = UIGraphicsGetImageFromCurrentImageContext();
+ UIGraphicsEndImageContext();
[profilePhotoImageView setImage:imgThumb];
+
[self apiGraphUserPermissions];
} else {
// Processing permissions information
View
@@ -494,7 +494,12 @@ - (void)webViewDidFinishLoad:(UIWebView *)webView {
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
// 102 == WebKitErrorFrameLoadInterruptedByPolicyChange
- if (!([error.domain isEqualToString:@"WebKitErrorDomain"] && error.code == 102)) {
+ // -999 == "Operation could not be completed", note -999 occurs when the user clicks away before
+ // the page has completely loaded, if we find cases where we want this to result in dialog failure
+ // (usually this just means quick-user), then we should add something more robust here to account
+ // for differences in application needs
+ if (!(([error.domain isEqualToString:@"NSURLErrorDomain"] && error.code == -999) ||
+ ([error.domain isEqualToString:@"WebKitErrorDomain"] && error.code == 102))) {
[self dismissWithError:error animated:YES];
}
}
View
@@ -31,6 +31,7 @@
// whenever possible
// up-front decl's
+@class FBFrictionlessRequestSettings;
@protocol FBRequestDelegate;
@protocol FBSessionDelegate;
@@ -49,6 +50,7 @@
NSString* _appId;
NSString* _urlSchemeSuffix;
BOOL _isExtendingAccessToken;
+ FBRequest *_requestExtendingAccessToken;
NSDate* _lastAccessTokenUpdate;
FBFrictionlessRequestSettings* _frictionlessRequestSettings;
}
View
@@ -15,6 +15,7 @@
*/
#import "Facebook.h"
+#import "FBFrictionlessRequestSettings.h"
#import "FBLoginDialog.h"
#import "FBRequest.h"
#import "FBError.h"
@@ -137,8 +138,13 @@ - (id)initWithAppId:(NSString *)appId
* Override NSObject : free the space
*/
- (void)dealloc {
+
+ // this is the one case where the delegate is this object
+ _requestExtendingAccessToken.delegate = nil;
+
[_session release];
[_tokenCaching release];
+
for (FBRequest* _request in _requests) {
[_request removeObserver:self forKeyPath:requestFinishedKeyPath];
}
@@ -363,7 +369,7 @@ - (void)extendAccessToken {
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"auth.extendSSOAccessToken", @"method",
nil];
- [self requestWithParams:params andDelegate:self];
+ _requestExtendingAccessToken = [self requestWithParams:params andDelegate:self];
}
/**
@@ -766,10 +772,12 @@ - (void)fbDialogNotLogin:(BOOL)cancelled {
- (void)request:(FBRequest *)request didFailWithError:(NSError *)error {
_isExtendingAccessToken = NO;
+ _requestExtendingAccessToken = nil;
}
- (void)request:(FBRequest *)request didLoad:(id)result {
_isExtendingAccessToken = NO;
+ _requestExtendingAccessToken = nil;
NSString* accessToken = [result objectForKey:@"access_token"];
NSString* expTime = [result objectForKey:@"expires_at"];

0 comments on commit 2a5ef24

Please sign in to comment.