mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-26 13:10:43 +00:00
Fix FeedbackActivity using Navigation Controller
No idea why I couldn't get this simple thing working the other day
This commit is contained in:
parent
eb05becb5b
commit
28b2d802d0
@ -30,20 +30,12 @@
|
|||||||
- (BOOL)canPerformWithActivityItems:(NSArray *)activityItems {
|
- (BOOL)canPerformWithActivityItems:(NSArray *)activityItems {
|
||||||
if ([BITHockeyManager sharedHockeyManager].disableFeedbackManager) return NO;
|
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) {
|
for (UIActivityItemProvider *item in activityItems) {
|
||||||
if ([item isKindOfClass:[UIImage class]]) {
|
if ([item isKindOfClass:[UIImage class]]) {
|
||||||
return YES;
|
return YES;
|
||||||
} else if ([item isKindOfClass:[NSString class]]) {
|
} else if ([item isKindOfClass:[NSString class]]) {
|
||||||
return YES;
|
return YES;
|
||||||
} else if ([item isKindOfClass:[NSString class]]) {
|
} else if ([item isKindOfClass:[NSURL class]]) {
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,9 +58,13 @@
|
|||||||
|
|
||||||
- (UIViewController *)activityViewController {
|
- (UIViewController *)activityViewController {
|
||||||
// TODO: return compose controller with activity content added
|
// TODO: return compose controller with activity content added
|
||||||
BITFeedbackComposeViewController *composeViewController = [[BITHockeyManager sharedHockeyManager].feedbackManager feedbackComposeViewControllerWithDelegate:self];
|
BITFeedbackComposeViewController *composeViewController = [[BITHockeyManager sharedHockeyManager].feedbackManager feedbackComposeViewControllerWithScreenshot:NO delegate:self];
|
||||||
composeViewController.modalPresentationStyle = UIModalPresentationFormSheet;
|
|
||||||
return composeViewController;
|
UINavigationController *navController = [[[UINavigationController alloc] initWithRootViewController: composeViewController] autorelease];
|
||||||
|
navController.modalPresentationStyle = UIModalPresentationFormSheet;
|
||||||
|
navController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
|
||||||
|
|
||||||
|
return navController;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)feedbackComposeViewControllerDidFinish:(BITFeedbackComposeViewController *)composeViewController {
|
-(void)feedbackComposeViewControllerDidFinish:(BITFeedbackComposeViewController *)composeViewController {
|
||||||
|
@ -79,30 +79,7 @@
|
|||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
|
|
||||||
self.view.backgroundColor = [UIColor whiteColor];
|
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.
|
// Do any additional setup after loading the view.
|
||||||
self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
|
self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
|
||||||
target:self
|
target:self
|
||||||
@ -112,15 +89,14 @@
|
|||||||
style:UIBarButtonItemStyleDone
|
style:UIBarButtonItemStyleDone
|
||||||
target:self
|
target:self
|
||||||
action:@selector(sendAction:)] autorelease];
|
action:@selector(sendAction:)] autorelease];
|
||||||
}
|
|
||||||
|
|
||||||
// message input textfield
|
// message input textfield
|
||||||
CGRect frame = CGRectZero;
|
CGRect frame = CGRectZero;
|
||||||
|
|
||||||
if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad) {
|
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 {
|
} 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 = [[[UITextView alloc] initWithFrame:frame] autorelease];
|
||||||
self.textView.font = [UIFont systemFontOfSize:17];
|
self.textView.font = [UIFont systemFontOfSize:17];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user