Fix FeedbackActivity using Navigation Controller

No idea why I couldn't get this simple thing working the other day
This commit is contained in:
Andreas Linde 2012-10-16 17:24:52 +02:00
parent eb05becb5b
commit 28b2d802d0
2 changed files with 19 additions and 47 deletions

View File

@ -30,20 +30,12 @@
- (BOOL)canPerformWithActivityItems:(NSArray *)activityItems {
if ([BITHockeyManager sharedHockeyManager].disableFeedbackManager) return NO;
// we can present the user data screen on top of the compose screen
// so for now only allow this if all required user data is available
BITFeedbackManager *feedbackManager = [BITHockeyManager sharedHockeyManager].feedbackManager;
if ([feedbackManager askManualUserDataAvailable] &&
([feedbackManager requireManualUserDataMissing])
)
return NO;
for (UIActivityItemProvider *item in activityItems) {
if ([item isKindOfClass:[UIImage class]]) {
return YES;
} else if ([item isKindOfClass:[NSString class]]) {
return YES;
} else if ([item isKindOfClass:[NSString class]]) {
} else if ([item isKindOfClass:[NSURL class]]) {
return YES;
}
}
@ -66,9 +58,13 @@
- (UIViewController *)activityViewController {
// TODO: return compose controller with activity content added
BITFeedbackComposeViewController *composeViewController = [[BITHockeyManager sharedHockeyManager].feedbackManager feedbackComposeViewControllerWithDelegate:self];
composeViewController.modalPresentationStyle = UIModalPresentationFormSheet;
return composeViewController;
BITFeedbackComposeViewController *composeViewController = [[BITHockeyManager sharedHockeyManager].feedbackManager feedbackComposeViewControllerWithScreenshot:NO delegate:self];
UINavigationController *navController = [[[UINavigationController alloc] initWithRootViewController: composeViewController] autorelease];
navController.modalPresentationStyle = UIModalPresentationFormSheet;
navController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
return navController;
}
-(void)feedbackComposeViewControllerDidFinish:(BITFeedbackComposeViewController *)composeViewController {

View File

@ -79,48 +79,24 @@
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
CGFloat yPos = 0;
// when being used inside an activity, we don't have a navigation controller embedded
if (!self.navigationController) {
UINavigationBar *navigationBar = [[[UINavigationBar alloc] initWithFrame:CGRectMake(self.view.bounds.origin.x, self.view.bounds.origin.y, self.view.bounds.size.width, 44)] autorelease];
navigationBar.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin;
[self.view addSubview:navigationBar];
[navigationBar sizeToFit];
yPos = navigationBar.frame.size.height;
UIBarButtonItem *cancelItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
target:self
action:@selector(dismissAction:)] autorelease];
UIBarButtonItem *saveItem = [[[UIBarButtonItem alloc] initWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackComposeSend")
style:UIBarButtonItemStyleDone
target:self
action:@selector(sendAction:)] autorelease];
UINavigationItem *navigationItem = [[[UINavigationItem alloc] initWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackComposeTitle")] autorelease];
navigationItem.leftBarButtonItem = cancelItem;
navigationItem.rightBarButtonItem = saveItem;
[navigationBar pushNavigationItem:navigationItem animated:NO];
} else {
// Do any additional setup after loading the view.
self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
target:self
action:@selector(dismissAction:)] autorelease];
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackComposeSend")
style:UIBarButtonItemStyleDone
target:self
action:@selector(sendAction:)] autorelease];
}
// Do any additional setup after loading the view.
self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
target:self
action:@selector(dismissAction:)] autorelease];
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackComposeSend")
style:UIBarButtonItemStyleDone
target:self
action:@selector(sendAction:)] autorelease];
// message input textfield
CGRect frame = CGRectZero;
if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad) {
frame = CGRectMake(0, yPos, self.view.bounds.size.width, 200-yPos);
frame = CGRectMake(0, 0, self.view.bounds.size.width, 200);
} else {
frame = CGRectMake(0, yPos, self.view.bounds.size.width, self.view.bounds.size.height-yPos);
frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height);
}
self.textView = [[[UITextView alloc] initWithFrame:frame] autorelease];
self.textView.font = [UIFont systemFontOfSize:17];