From 9beb2e423e52248d4efd79c8e0369829d8509fac Mon Sep 17 00:00:00 2001 From: Christoph Hagen Date: Mon, 2 May 2022 23:24:48 +0200 Subject: [PATCH] Improve key screen layout --- Sesame/HistoryListItem.swift | 4 ++-- Sesame/KeyView.swift | 29 +++++++++++++++-------------- Sesame/SingleKeyView.swift | 6 ++++-- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/Sesame/HistoryListItem.swift b/Sesame/HistoryListItem.swift index 27a620b..483d892 100644 --- a/Sesame/HistoryListItem.swift +++ b/Sesame/HistoryListItem.swift @@ -29,10 +29,10 @@ struct HistoryListItem: View { return startText } let diff = Int(rCounter) - Int(sentCounter) - guard diff != 1 else { + guard diff != 1 && diff != 0 else { return startText } - return startText + "→\(rCounter)" + return startText + " (\(diff))" } var timeOffsetText: String { diff --git a/Sesame/KeyView.swift b/Sesame/KeyView.swift index 1e001ba..fd0f6f1 100644 --- a/Sesame/KeyView.swift +++ b/Sesame/KeyView.swift @@ -9,20 +9,21 @@ struct KeyView: View { var isCompensatingDaylightTime: Bool var body: some View { - GeometryReader { geo in - VStack(alignment: .leading, spacing: 16) { - ForEach(KeyManagement.KeyType.allCases) { keyType in - SingleKeyView( - keyManager: $keyManager, - type: keyType) - } - Toggle(isOn: $isCompensatingDaylightTime) { - Text("Compensate daylight savings time") - } - Text("If the remote has daylight savings time wrongly set, then the time validation will fail. Use this option to send messages with adjusted timestamps. Warning: Incorrect use of this option will allow replay attacks.") - .font(.caption) - }.padding() - } + ScrollView { + VStack(alignment: .leading, spacing: 8) { + ForEach(KeyManagement.KeyType.allCases) { keyType in + SingleKeyView( + keyManager: $keyManager, + type: keyType) + } + Toggle(isOn: $isCompensatingDaylightTime) { + Text("Compensate daylight savings time") + } + Text("If the remote has daylight savings time wrongly set, then the time validation will fail. Use this option to send messages with adjusted timestamps. Warning: Incorrect use of this option will allow replay attacks.") + .font(.caption) + .foregroundColor(.secondary) + }.padding() + } } } diff --git a/Sesame/SingleKeyView.swift b/Sesame/SingleKeyView.swift index 28d59c1..06e5413 100644 --- a/Sesame/SingleKeyView.swift +++ b/Sesame/SingleKeyView.swift @@ -45,13 +45,15 @@ struct SingleKeyView: View { keyManager.generate(type) needRefresh.toggle() } - .padding() + .padding([.horizontal, .bottom]) + .padding(.top, 4) Button(type.usesHashing ? "Copy hash" : "Copy") { UIPasteboard.general.string = copyText } .disabled(!hasKey) - .padding() + .padding([.horizontal, .bottom]) + .padding(.top, 4) Spacer() } }