Skip to content

Commit

Permalink
Improves timing of location request in scrumptious
Browse files Browse the repository at this point in the history
Summary: Waits until the user is logged on before asking for location access

Test Plan: Ran the sample with both integrated and downlevel auth, confirmed request is in the right spot

Reviewers: clang

Reviewed By: clang

CC: msdkexp@

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

Task ID: 1731992
  • Loading branch information
onebit committed Sep 24, 2012
1 parent 2e7841e commit 3eb1a97
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions samples/Scrumptious/scrumptious/SCAppDelegate.m
Expand Up @@ -68,6 +68,7 @@ - (void)sessionStateChanged:(FBSession *)session
// is opened successfully, hide the login controller and show the main UI.
switch (state) {
case FBSessionStateOpen: {
[self.mainViewController startLocationManager];
if (self.loginViewController != nil) {
UIViewController *topViewController = [self.navController topViewController];
[topViewController dismissModalViewControllerAnimated:YES];
Expand Down
2 changes: 2 additions & 0 deletions samples/Scrumptious/scrumptious/SCViewController.h
Expand Up @@ -25,4 +25,6 @@ typedef void(^SelectItemCallback)(id sender, id selectedItem);
// are with and where they are, and choose a photo for attaching to an Open Graph Action.
@interface SCViewController : UIViewController <FBUserSettingsDelegate>

- (void)startLocationManager;

@end
5 changes: 4 additions & 1 deletion samples/Scrumptious/scrumptious/SCViewController.m
Expand Up @@ -244,6 +244,10 @@ - (IBAction)announce:(id)sender {
}
}

- (void)startLocationManager {
[self.locationManager startUpdatingLocation];
}

- (void)centerAndShowActivityIndicator {
CGRect frame = self.view.frame;
CGPoint center = CGPointMake(CGRectGetMidX(frame), CGRectGetMidY(frame));
Expand Down Expand Up @@ -407,7 +411,6 @@ - (void)viewDidLoad {
// We don't want to be notified of small changes in location, preferring to use our
// last cached results, if any.
self.locationManager.distanceFilter = 50;
[self.locationManager startUpdatingLocation];

// This avoids a gray background in the table view on iPad.
if ([self.menuTableView respondsToSelector:@selector(backgroundView)]) {
Expand Down

0 comments on commit 3eb1a97

Please sign in to comment.