Skip to content

Commit

Permalink
The following situation would fail: user opens app A and proceeds to …
Browse files Browse the repository at this point in the history
…buy compatible app B. When coming back to app A to send to app B, app B would still be in the "more apps" list. I'm forcing the screens to rebuild when they appear and when they're still visible when the app becomes active again.
  • Loading branch information
gpambrozio committed Jul 21, 2011
1 parent 28018d3 commit d7bd25f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
23 changes: 23 additions & 0 deletions PhotoAppLink/PALMoreAppsController.m
Expand Up @@ -76,6 +76,29 @@ - (void)viewDidLoad
}
}

// Called by the notification center if the app becomes active and this view is still visible
// This is necessary to reload the list of compatible apps as it can change when the app
// becomes active again (user might buy another compatible app, for example)
- (void)applicationDidBecomeActive
{
[additionalApps release];
additionalApps = [[[PALManager sharedPALManager] moreApps] retain];
[self.tableView reloadData];
}

- (void)viewWillAppear:(BOOL)animated
{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationDidBecomeActive)
name:UIApplicationDidBecomeActiveNotification
object:nil];
}

- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:self];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
Expand Down
23 changes: 20 additions & 3 deletions PhotoAppLink/PALSendToController.m
Expand Up @@ -123,8 +123,6 @@ - (void)viewDidLoad
[[self navigationItem] setLeftBarButtonItem:cancelButton];
[cancelButton release];
}

[self setupScrollViewContent];
}

- (void)viewDidUnload
Expand All @@ -138,14 +136,29 @@ - (void)viewDidUnload
[super viewDidUnload];
}

-(void)viewDidAppear:(BOOL)animated
// Called by the notification center if the app becomes active and this view is still visible
// This is necessary to reload the list of compatible apps as it can change when the app
// becomes active again (user might buy another compatible app, for example)
- (void)applicationDidBecomeActive
{
[self setupScrollViewContent];
}

- (void)viewWillAppear:(BOOL)animated
{
[self setupScrollViewContent];
_chosenOption = -1;

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationDidBecomeActive)
name:UIApplicationDidBecomeActiveNotification
object:nil];
}

- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:self];

if (_chosenOption >= 0)
{
Expand Down Expand Up @@ -200,6 +213,10 @@ - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceO

- (void)setupScrollViewContent
{
for (UIView *view in [_iconsScrollView subviews]) {
[view removeFromSuperview];
}

int pos = 0;

// First add the custom sharing options
Expand Down

0 comments on commit d7bd25f

Please sign in to comment.