From 6d87dbd9e47fce16726a4605d0f096e6e16e9d4f Mon Sep 17 00:00:00 2001 From: Max Goedjen Date: Thu, 4 Jan 2024 18:16:59 -0800 Subject: [PATCH] Main app --- Sources/Secretive/App.swift | 6 +- Sources/Secretive/Localizable.xcstrings | 117 ++++++++++++++++----- Sources/Secretive/Views/ContentView.swift | 4 +- Sources/Secretive/Views/CopyableView.swift | 4 +- Sources/Secretive/Views/SetupView.swift | 2 +- Sources/Secretive/Views/UpdateView.swift | 10 +- 6 files changed, 103 insertions(+), 40 deletions(-) diff --git a/Sources/Secretive/App.swift b/Sources/Secretive/App.swift index 52faacc..81555ab 100644 --- a/Sources/Secretive/App.swift +++ b/Sources/Secretive/App.swift @@ -45,18 +45,18 @@ struct Secretive: App { } .commands { CommandGroup(after: CommandGroupPlacement.newItem) { - Button("New Secret") { + Button("app_menu_new_secret_button") { showingCreation = true } .keyboardShortcut(KeyboardShortcut(KeyEquivalent("N"), modifiers: [.command, .shift])) } CommandGroup(replacing: .help) { - Button("Help") { + Button("app_menu_help_button") { NSWorkspace.shared.open(Constants.helpURL) } } CommandGroup(after: .help) { - Button("Setup Secretive") { + Button("app_menu_setup_button") { showingSetup = true } } diff --git a/Sources/Secretive/Localizable.xcstrings b/Sources/Secretive/Localizable.xcstrings index 3e9297d..e98301a 100644 --- a/Sources/Secretive/Localizable.xcstrings +++ b/Sources/Secretive/Localizable.xcstrings @@ -10,12 +10,12 @@ "\n\n" : { }, - "✓" : { + "agent_not_running_notice_title" : { "localizations" : { "en" : { "stringUnit" : { "state" : "translated", - "value" : "✓" + "value" : "Secret Agent Is Not Running" } } } @@ -50,6 +50,46 @@ } } }, + "agent_setup_notice_title" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Setup Secretive" + } + } + } + }, + "app_menu_help_button" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Help" + } + } + } + }, + "app_menu_new_secret_button" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "New Secret" + } + } + } + }, + "app_menu_setup_button" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Setup Secretive" + } + } + } + }, "app_not_in_applications_notice_detail_description" : { "localizations" : { "en" : { @@ -294,15 +334,6 @@ } } } - }, - "Help" : { - - }, - "Ignore" : { - - }, - "New Secret" : { - }, "no_secure_storage_description" : { "localizations" : { @@ -333,9 +364,6 @@ } } } - }, - "Release Notes" : { - }, "rename_cancel_button" : { "localizations" : { @@ -366,9 +394,6 @@ } } } - }, - "Secret Agent Is Not Running" : { - }, "secret_detail_md5_fingerprint_label" : { "localizations" : { @@ -429,12 +454,6 @@ } } } - }, - "Secretive %@" : { - - }, - "Setup Secretive" : { - }, "setup_agent_activity_monitor_description" : { "localizations" : { @@ -534,6 +553,16 @@ } } }, + "setup_step_complete_symbol" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "✓" + } + } + } + }, "setup_third_party_faq_link" : { "extractionState" : "manual", "localizations" : { @@ -585,11 +614,45 @@ } } }, - "Title" : { - + "update_ignore_button" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Ignore" + } + } + } }, - "Update" : { - + "update_release_notes_title" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Release Notes" + } + } + } + }, + "update_update_button" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Update" + } + } + } + }, + "update_version_name_%@" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Secretive %1$@" + } + } + } } }, "version" : "1.0" diff --git a/Sources/Secretive/Views/ContentView.swift b/Sources/Secretive/Views/ContentView.swift index f0db277..948ff26 100644 --- a/Sources/Secretive/Views/ContentView.swift +++ b/Sources/Secretive/Views/ContentView.swift @@ -121,9 +121,9 @@ extension ContentView { }, label: { Group { if hasRunSetup && !agentStatusChecker.running { - Text("Secret Agent Is Not Running") + Text("agent_not_running_notice_title") } else { - Text("Setup Secretive") + Text("agent_setup_notice_title") } } .font(.headline) diff --git a/Sources/Secretive/Views/CopyableView.swift b/Sources/Secretive/Views/CopyableView.swift index 145ad63..ff9497e 100644 --- a/Sources/Secretive/Views/CopyableView.swift +++ b/Sources/Secretive/Views/CopyableView.swift @@ -122,9 +122,9 @@ struct CopyableView: View { struct CopyableView_Previews: PreviewProvider { static var previews: some View { Group { - CopyableView(title: "Title", image: Image(systemName: "figure.wave"), text: "Hello world.") + CopyableView(title: "secret_detail_sha256_fingerprint_label", image: Image(systemName: "figure.wave"), text: "Hello world.") .padding() - CopyableView(title: "Title", image: Image(systemName: "figure.wave"), text: "Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. ") + CopyableView(title: "secret_detail_sha256_fingerprint_label", image: Image(systemName: "figure.wave"), text: "Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. Long text. ") .padding() } } diff --git a/Sources/Secretive/Views/SetupView.swift b/Sources/Secretive/Views/SetupView.swift index c1f649c..2cf6e51 100644 --- a/Sources/Secretive/Views/SetupView.swift +++ b/Sources/Secretive/Views/SetupView.swift @@ -61,7 +61,7 @@ struct StepView: View { Circle() .foregroundColor(.green) .frame(width: Constants.circleWidth, height: Constants.circleWidth) - Text("✓") + Text("setup_step_complete_symbol") .foregroundColor(.white) .bold() } else { diff --git a/Sources/Secretive/Views/UpdateView.swift b/Sources/Secretive/Views/UpdateView.swift index afe620e..2476a78 100644 --- a/Sources/Secretive/Views/UpdateView.swift +++ b/Sources/Secretive/Views/UpdateView.swift @@ -9,20 +9,20 @@ struct UpdateDetailView: View { var body: some View { VStack { - Text("Secretive \(update.name)").font(.title) - GroupBox(label: Text("Release Notes")) { + Text("update_version_name_\(update.name)").font(.title) + GroupBox(label: Text("update_release_notes_title")) { ScrollView { attributedBody } } HStack { if !update.critical { - Button("Ignore") { + Button("update_ignore_button") { updater.ignore(release: update) } Spacer() } - Button("Update") { + Button("update_update_button") { NSWorkspace.shared.open(update.html_url) } .keyboardShortcut(.defaultAction) @@ -34,7 +34,7 @@ struct UpdateDetailView: View { } var attributedBody: Text { - var text = Text("") + var text = Text(verbatim: "") for line in update.body.split(whereSeparator: \.isNewline) { let attributed: Text let split = line.split(separator: " ")