From 17761c10ff6495ae49c28cc8dec2dfe0466a4403 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Tue, 26 Apr 2016 12:27:34 +0200 Subject: [PATCH] Dialer: do not show Send logs button in magic popup if logs are not enabled yet --- Classes/DialerView.m | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Classes/DialerView.m b/Classes/DialerView.m index 48c63d7e5..5606ee93f 100644 --- a/Classes/DialerView.m +++ b/Classes/DialerView.m @@ -249,17 +249,19 @@ static UICompositeViewDescription *compositeDescription = nil; [alertView addCancelButtonWithTitle:NSLocalizedString(@"Cancel", nil) block:nil]; - [alertView - addButtonWithTitle:NSLocalizedString(@"Send logs", nil) - block:^{ - NSString *appName = - [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]; - NSString *logsAddress = [mgr lpConfigStringForKey:@"debug_popup_email" withDefault:@""]; - [self presentMailViewWithTitle:appName forRecipients:@[ logsAddress ] attachLogs:true]; - }]; - int debugLevel = [LinphoneManager.instance lpConfigIntForKey:@"debugenable_preference"]; BOOL debugEnabled = (debugLevel >= ORTP_DEBUG && debugLevel < ORTP_ERROR); + + if (debugEnabled) { + [alertView + addButtonWithTitle:NSLocalizedString(@"Send logs", nil) + block:^{ + NSString *appName = + [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]; + NSString *logsAddress = [mgr lpConfigStringForKey:@"debug_popup_email" withDefault:@""]; + [self presentMailViewWithTitle:appName forRecipients:@[ logsAddress ] attachLogs:true]; + }]; + } NSString *actionLog = (debugEnabled ? NSLocalizedString(@"Disable logs", nil) : NSLocalizedString(@"Enable logs", nil)); [alertView