Skip to content

Commit

Permalink
Merge public master hot fixes
Browse files Browse the repository at this point in the history
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
Jason Clark committed Aug 1, 2012
2 parents 5f882ed + af2fc3b commit 2a5ef24
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 10 deletions.
9 changes: 7 additions & 2 deletions samples/Hackbook/Hackbook/APICallsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ - (void)enableFrictionlessAppRequests {
otherButtonTitles:nil,
nil];
[alertView show];
[alertView release];
}

/*
Expand Down Expand Up @@ -697,6 +698,8 @@ - (void)apiGraphUserPhotosPost {
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
img, @"picture",
nil];
[img release];

[[delegate facebook] requestWithGraphPath:@"me/photos"
andParams:params
andHttpMethod:@"POST"
Expand Down Expand Up @@ -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;
}
Expand Down
3 changes: 0 additions & 3 deletions samples/Hackbook/Hackbook/APIResultsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
}

Expand Down
6 changes: 3 additions & 3 deletions samples/Hackbook/Hackbook/RootViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion src/FBDialog.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/Facebook.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
// whenever possible

// up-front decl's
@class FBFrictionlessRequestSettings;
@protocol FBRequestDelegate;
@protocol FBSessionDelegate;

Expand All @@ -49,6 +50,7 @@
NSString* _appId;
NSString* _urlSchemeSuffix;
BOOL _isExtendingAccessToken;
FBRequest *_requestExtendingAccessToken;
NSDate* _lastAccessTokenUpdate;
FBFrictionlessRequestSettings* _frictionlessRequestSettings;
}
Expand Down
10 changes: 9 additions & 1 deletion src/Facebook.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

#import "Facebook.h"
#import "FBFrictionlessRequestSettings.h"
#import "FBLoginDialog.h"
#import "FBRequest.h"
#import "FBError.h"
Expand Down Expand Up @@ -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];
}
Expand Down Expand Up @@ -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];
}

/**
Expand Down Expand Up @@ -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"];

Expand Down

0 comments on commit 2a5ef24

Please sign in to comment.