Localize the debug log UI.

pull/1/head
Matthew Chen 7 years ago
parent a617724da7
commit 94b5dfb1b5

@ -30,37 +30,54 @@
[self submitLogsWithCompletion:^(NSError *error, NSString *urlString) { [self submitLogsWithCompletion:^(NSError *error, NSString *urlString) {
if (!error) { if (!error) {
UIAlertController *alert = [UIAlertController UIAlertController *alert = [UIAlertController
alertControllerWithTitle:@"One More Step" alertControllerWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_TITLE", @"Title of the debug log alert.")
message:@"What would you like to do with the link to your debug log?" message:NSLocalizedString(
@"DEBUG_LOG_ALERT_MESSAGE", @"Message of the debug log alert.")
preferredStyle:UIAlertControllerStyleAlert]; preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"Email Support" [alert
style:UIAlertActionStyleDefault addAction:[UIAlertAction
handler:^(UIAlertAction *_Nonnull action) { actionWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_EMAIL",
[Pastelog.sharedManager submitEmail:urlString]; @"Label for the 'email debug log' option of the the debug log alert.")
}]]; style:UIAlertActionStyleDefault
[alert addAction:[UIAlertAction actionWithTitle:@"Copy Link" handler:^(UIAlertAction *_Nonnull action) {
style:UIAlertActionStyleDefault [Pastelog.sharedManager submitEmail:urlString];
handler:^(UIAlertAction *_Nonnull action) { }]];
UIPasteboard *pb = [UIPasteboard generalPasteboard]; [alert addAction:[UIAlertAction
[pb setString:urlString]; actionWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_COPY_LINK",
}]]; @"Label for the 'copy link' option of the the debug log alert.")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *_Nonnull action) {
UIPasteboard *pb = [UIPasteboard generalPasteboard];
[pb setString:urlString];
}]];
#ifdef DEBUG #ifdef DEBUG
[alert addAction:[UIAlertAction actionWithTitle:@"Send to Self" [alert addAction:[UIAlertAction
style:UIAlertActionStyleDefault actionWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_SEND_TO_SELF",
handler:^(UIAlertAction *_Nonnull action) { @"Label for the 'send to self' option of the the debug log alert.")
[Pastelog.sharedManager sendToSelf:urlString]; style:UIAlertActionStyleDefault
}]]; handler:^(UIAlertAction *_Nonnull action) {
[Pastelog.sharedManager sendToSelf:urlString];
}]];
#endif #endif
[alert addAction:[UIAlertAction actionWithTitle:@"Open a Bug Report" [alert addAction:
style:UIAlertActionStyleCancel [UIAlertAction
handler:^(UIAlertAction *_Nonnull action) { actionWithTitle:NSLocalizedString(@"DEBUG_LOG_ALERT_OPTION_BUG_REPORT",
[Pastelog.sharedManager prepareRedirection:urlString]; @"Label for the 'Open a Bug Report' option of the the debug log alert.")
}]]; style:UIAlertActionStyleCancel
handler:^(UIAlertAction *_Nonnull action) {
[Pastelog.sharedManager prepareRedirection:urlString];
}]];
UIViewController *presentingViewController UIViewController *presentingViewController
= UIApplication.sharedApplication.frontmostViewControllerIgnoringAlerts; = UIApplication.sharedApplication.frontmostViewControllerIgnoringAlerts;
[presentingViewController presentViewController:alert animated:NO completion:nil]; [presentingViewController presentViewController:alert animated:NO completion:nil];
} else{ } else{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Failed to submit debug log" message:error.localizedDescription delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; UIAlertView *alertView =
[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"DEBUG_LOG_FAILURE_ALERT_TITLE",
@"Title of the alert indicating the debug log upload failed.")
message:error.localizedDescription
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil, nil];
[alertView show]; [alertView show];
} }
}]; }];
@ -74,9 +91,11 @@
[self sharedManager].block = block; [self sharedManager].block = block;
[self sharedManager].loadingAlert = [UIAlertController alertControllerWithTitle:@"Sending debug log..." [self sharedManager].loadingAlert =
message:nil [UIAlertController alertControllerWithTitle:NSLocalizedString(@"DEBUG_LOG_ACTIVITY_INDICATOR",
preferredStyle:UIAlertControllerStyleAlert]; @"Message indicating that the debug log is being uploaded.")
message:nil
preferredStyle:UIAlertControllerStyleAlert];
UIViewController *presentingViewController = UIApplication.sharedApplication.frontmostViewControllerIgnoringAlerts; UIViewController *presentingViewController = UIApplication.sharedApplication.frontmostViewControllerIgnoringAlerts;
[presentingViewController presentViewController:[self sharedManager].loadingAlert animated:NO completion:nil]; [presentingViewController presentViewController:[self sharedManager].loadingAlert animated:NO completion:nil];
@ -209,12 +228,13 @@
[pb setString:url]; [pb setString:url];
UIAlertController *alert = UIAlertController *alert =
[UIAlertController alertControllerWithTitle:@"GitHub redirection" [UIAlertController alertControllerWithTitle:NSLocalizedString(@"DEBUG_LOG_GITHUB_ISSUE_ALERT_TITLE",
message:@"The gist link was copied in your clipboard. You are about to be " @"Title of the alert before redirecting to Github Issues.")
@"redirected to the GitHub issue list." message:NSLocalizedString(@"DEBUG_LOG_GITHUB_ISSUE_ALERT_MESSAGE",
@"Message of the alert before redirecting to Github Issues.")
preferredStyle:UIAlertControllerStyleAlert]; preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction [alert addAction:[UIAlertAction
actionWithTitle:@"OK" actionWithTitle:NSLocalizedString(@"OK", @"")
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *_Nonnull action) { handler:^(UIAlertAction *_Nonnull action) {
[UIApplication.sharedApplication [UIApplication.sharedApplication

@ -421,6 +421,36 @@
/* Title shown while the app is updating its database. */ /* Title shown while the app is updating its database. */
"DATABASE_VIEW_OVERLAY_TITLE" = "Updating Database"; "DATABASE_VIEW_OVERLAY_TITLE" = "Updating Database";
/* Message indicating that the debug log is being uploaded. */
"DEBUG_LOG_ACTIVITY_INDICATOR" = "Sending debug log...";
/* Message of the debug log alert. */
"DEBUG_LOG_ALERT_MESSAGE" = "What would you like to do with the link to your debug log?";
/* Label for the 'Open a Bug Report' option of the the debug log alert. */
"DEBUG_LOG_ALERT_OPTION_BUG_REPORT" = "Open a Bug Report";
/* Label for the 'copy link' option of the the debug log alert. */
"DEBUG_LOG_ALERT_OPTION_COPY_LINK" = "Copy Link";
/* Label for the 'email debug log' option of the the debug log alert. */
"DEBUG_LOG_ALERT_OPTION_EMAIL" = "Email Support";
/* Label for the 'send to self' option of the the debug log alert. */
"DEBUG_LOG_ALERT_OPTION_SEND_TO_SELF" = "Send to Self";
/* Title of the debug log alert. */
"DEBUG_LOG_ALERT_TITLE" = "One More Step";
/* Title of the alert indicating the debug log upload failed. */
"DEBUG_LOG_FAILURE_ALERT_TITLE" = "Failed to submit debug log";
/* Message of the alert before redirecting to Github Issues. */
"DEBUG_LOG_GITHUB_ISSUE_ALERT_MESSAGE" = "The gist link was copied in your clipboard. You are about to be redirected to the GitHub issue list.";
/* Title of the alert before redirecting to Github Issues. */
"DEBUG_LOG_GITHUB_ISSUE_ALERT_TITLE" = "GitHub redirection";
/* {{Short Date}} when device last communicated with Signal Server. */ /* {{Short Date}} when device last communicated with Signal Server. */
"DEVICE_LAST_ACTIVE_AT_LABEL" = "Last active: %@"; "DEVICE_LAST_ACTIVE_AT_LABEL" = "Last active: %@";

Loading…
Cancel
Save