Permalink
Browse files

Add alert and comment to describe the case where users disallow re-au…

…th retry in scrumptious.

Summary:
Add alert and comment to describe the case where users disallow re-auth retry
in scrumptious.

Test Plan:
1. login->allow->post->allow.
2. on server, remove post permission
3. in app, try to post again. App should ask for post permissions again
4. disallow, and see the new alert.
5. try to post again and see the new alert (without asking).
6. note slider is off in settings. turn slider back to on
7. try to post again and ios will ask for permissions again.

Revert Plan:

Reviewers: jacl

Reviewed By: jacl

Differential Revision: https://phabricator.fb.com/D590337
  • Loading branch information...
1 parent d9661d3 commit b2248152f93d7860d631825fba7ec6c2eb1270ad @chrisp-fb chrisp-fb committed Oct 2, 2012
Showing with 13 additions and 2 deletions.
  1. +13 −2 samples/Scrumptious/scrumptious/SCViewController.m
View
15 samples/Scrumptious/scrumptious/SCViewController.m
@@ -154,11 +154,22 @@ - (void)postOpenGraphAction {
if ([[error userInfo][FBErrorParsedJSONResponseKey][@"body"][@"error"][@"code"] compare:@200] == NSOrderedSame) {
[FBSession.activeSession reauthorizeWithPublishPermissions:[NSArray arrayWithObject:@"publish_actions"]
defaultAudience:FBSessionDefaultAudienceFriends
- completionHandler:^(FBSession *session, NSError *error) {
- if (!error) {
+ completionHandler:^(FBSession *session, NSError *innerError) {
+ if (!innerError) {
// re-call assuming we now have the permission
[self postOpenGraphAction];
}
+ else{
+ //If we are here, this means the user has disallowed posting after a retry
+ // which means iOS will have turned the app's slider to "off" in the
+ // device settings->Facebook.
+ [[[UIAlertView alloc] initWithTitle:@"Permission To Post Disallowed"
+ message:@"Use device settings->Facebook to re-enable permission to post."
+ delegate:nil
+ cancelButtonTitle:@"Thanks!"
+ otherButtonTitles:nil]
+ show];
+ }
}];
} else {
[[[UIAlertView alloc] initWithTitle:@"Result"

0 comments on commit b224815

Please sign in to comment.