Skip to content

Commit

Permalink
Hide default toggle when it's not settable
Browse files Browse the repository at this point in the history
  • Loading branch information
lazerwalker committed Apr 21, 2014
1 parent 2c9df2f commit 1e67f05
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions IntentKit/Apps/UIWebView/INKWebViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#import "INKWebViewController.h"
#import "IntentKit.h"
#import "INKOpenInActivity.h"

@interface INKWebViewController ()<UIWebViewDelegate, UIPopoverControllerDelegate>
@property (strong, nonatomic) UIWebView *webView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@warning It is assumed the delegate (typically an `INKHandler`) is responsible for maintaining the stateful knowledge of which handler this is for. */
- (void)addDefault:(INKActivity *)activity;

/** If NO, the toggle view will be disabled/grayed-out.
/** If NO, the toggle view will be hidden.
This is used when the user's preferred app for a handler cannot perform the task they're trying to do; we don't want them to try to register a secondary default. */
- (BOOL)canSetDefault;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ - (NSInteger)numberOfApplications {

- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.defaultToggleView.enabled = self.delegate.canSetDefault;
BOOL canSetDefault = self.delegate.canSetDefault;
self.defaultToggleView.enabled = canSetDefault;
self.defaultToggleView.hidden = !canSetDefault;
if (!canSetDefault) {
self.defaultToggleView.frame = CGRectZero;
}

[self setBounds];
self.presentingViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
}
Expand Down

0 comments on commit 1e67f05

Please sign in to comment.