Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixes breaking change introduced by (e79d072)
Summary:
The problem is that e79d072 fixes odd behavior in Hackbook,
which had support in the SDK code’s logout function. Prior to e79d072
Hackbook was more convoluted, and the logout behavior broke
encapsulation. The solution is to put back a deprecated logout method that
matches the original signature, and keeps most of the original behavior
(though it does not break encapsulation, which was badness.)

Test Plan:
Manually modify Hackbook, and whitebox test each of the following
permutations:
* login with no delegate (call the cached delegate)
* login with a delegate matching the cached delegate (call the cached delegate)
* login with a delegate different from the cached delegate (call both)

Reviewers: yariv, caabernathy, mmarucheck, vijaye

Reviewed By: yariv

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

Task ID: 905137
  • Loading branch information
onebit committed Feb 8, 2012
1 parent daed6b2 commit 8ed244a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -20,3 +20,6 @@ test/UnitTest/build/
*~
*#
.arcconfig
.DS_Store
project.xcworkspace
xcuserdata
2 changes: 2 additions & 0 deletions src/Facebook.h
Expand Up @@ -63,6 +63,8 @@

- (void)logout;

- (void)logout:(id<FBSessionDelegate>)delegate;

- (FBRequest*)requestWithParams:(NSMutableDictionary *)params
andDelegate:(id <FBRequestDelegate>)delegate;

Expand Down
16 changes: 16 additions & 0 deletions src/Facebook.m
Expand Up @@ -472,6 +472,22 @@ - (void)logout {
}
}

/**
* Invalidate the current user session by removing the access token in
* memory and clearing the browser cookie.
*
* @deprecated Use of a single session delegate, set at app init, is preferred
*/
- (void)logout:(id<FBSessionDelegate>)delegate {
[self logout];
// preserve deprecated callback behavior, but leave cached delegate intact
// avoid calling twice if the passed and cached delegates are the same
if (delegate != self.sessionDelegate &&
[delegate respondsToSelector:@selector(fbDidLogout)]) {
[delegate fbDidLogout];
}
}

/**
* Make a request to Facebook's REST API with the given
* parameters. One of the parameter keys must be "method" and its value
Expand Down

0 comments on commit 8ed244a

Please sign in to comment.