From 466155270ba0b356ffb1938f5bcccbaf1a6f7e20 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Sat, 26 Nov 2016 21:16:15 +0200 Subject: [PATCH] layout: split "First Last " GPG user ID for readability --- firmware/layout2.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/firmware/layout2.c b/firmware/layout2.c index ca20dbbcce..971b7f9f9b 100644 --- a/firmware/layout2.c +++ b/firmware/layout2.c @@ -305,10 +305,12 @@ void layoutSignIdentity(const IdentityType *identity, const char *challenge) char row_hostport[64 + 6 + 1]; char row_user[64 + 8 + 1]; + bool is_gpg = (strcmp(identity->proto, "gpg") == 0); + if (identity->has_proto && identity->proto[0]) { if (strcmp(identity->proto, "https") == 0) { strlcpy(row_proto, "Web sign in to:", sizeof(row_proto)); - } else if (strcmp(identity->proto, "gpg") == 0) { + } else if (is_gpg) { strlcpy(row_proto, "GPG sign for:", sizeof(row_proto)); } else { strlcpy(row_proto, identity->proto, sizeof(row_proto)); @@ -337,6 +339,21 @@ void layoutSignIdentity(const IdentityType *identity, const char *challenge) row_user[0] = 0; } + if (is_gpg) { + // Split "First Last " into 2 lines: + // "First Last" + // "first@last.com" + char *email_start = strchr(row_hostport, '<'); + if (email_start) { + strlcpy(row_user, email_start + 1, sizeof(row_user)); + *email_start = 0; + char *email_end = strchr(row_user, '>'); + if (email_end) { + *email_end = 0; + } + } + } + layoutDialogSwipe(&bmp_icon_question, "Cancel", "Confirm", "Do you want to sign in?", row_proto[0] ? row_proto : NULL,