From 8f539e1e458a0237caf61a2c403dfe1f60a5c307 Mon Sep 17 00:00:00 2001 From: funway <> Date: Tue, 10 Nov 2020 20:29:43 +0800 Subject: [PATCH] Add a "check for updates" button on the about view. --- Countdown/Helper/Global.swift | 2 +- .../View/PreferencesView/AboutView.swift | 19 +++++++++++++------ .../PreferencesView/PreferencesView.swift | 2 +- .../View/PreferencesView/SettingsView.swift | 2 +- Countdown/en.lproj/Localizable.strings | 3 ++- Countdown/zh-Hans.lproj/Localizable.strings | 3 ++- 6 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Countdown/Helper/Global.swift b/Countdown/Helper/Global.swift index 67a9653..397d667 100644 --- a/Countdown/Helper/Global.swift +++ b/Countdown/Helper/Global.swift @@ -10,7 +10,7 @@ import Foundation import XCGLogger import SQLite -let _appVerion = "1.1.5" +let _appVerion = "1.1.6" #if DEBUG let appVersion = _appVerion + " (Debug)" #else diff --git a/Countdown/View/PreferencesView/AboutView.swift b/Countdown/View/PreferencesView/AboutView.swift index 4f15712..d92abd3 100644 --- a/Countdown/View/PreferencesView/AboutView.swift +++ b/Countdown/View/PreferencesView/AboutView.swift @@ -13,12 +13,19 @@ struct AboutView: View { var body: some View { VStack(spacing: 10.0) { - HStack(spacing: 10.0) { - Image(nsImage: NSApplication.shared.applicationIconImage).resizable().frame(width: 48, height: 48) + HStack(spacing: 15.0) { + Image(nsImage: NSApplication.shared.applicationIconImage).resizable().frame(width: 64, height: 64) - VStack(alignment: .leading) { + VStack(alignment: .leading, spacing: 3.0) { Text("Countdown").font(Font.system(size: 20, weight: .medium).monospacedDigit()) - Text(NSLocalizedString("About.version", comment: "") + " \(appVersion)").font(Font.system(size: 13, weight: .regular).monospacedDigit()) + + HStack { + Text(NSLocalizedString("About.Version", comment: "") + " \(appVersion)").font(Font.system(size: 13, weight: .regular).monospacedDigit()) + + HyperLinkButton(destination: URL(string: "https://github.com/funway/Countdown/releases")!, label: { + Text(NSLocalizedString("About.Check", comment: "")).font(Font.system(size: 13, weight: .regular).monospacedDigit()) + }) + } } } @@ -54,7 +61,7 @@ struct AboutView: View { Text("😜") } - Divider() + Divider().padding(.vertical, 5) ScrollView { VStack(spacing: 5.0) { @@ -81,6 +88,6 @@ struct AboutView: View { struct AboutView_Previews: PreviewProvider { static var previews: some View { - AboutView() + AboutView().frame(width: 350) } } diff --git a/Countdown/View/PreferencesView/PreferencesView.swift b/Countdown/View/PreferencesView/PreferencesView.swift index 8400b2c..a4f42da 100644 --- a/Countdown/View/PreferencesView/PreferencesView.swift +++ b/Countdown/View/PreferencesView/PreferencesView.swift @@ -25,7 +25,7 @@ struct PreferencesView: View { .padding(.horizontal) } else if (selectedTabIndex == 1) { AboutView() - .frame(height: 320) + .frame(height: 330) .padding(.horizontal) .padding(.bottom, 20) } diff --git a/Countdown/View/PreferencesView/SettingsView.swift b/Countdown/View/PreferencesView/SettingsView.swift index 274da14..87a12ef 100644 --- a/Countdown/View/PreferencesView/SettingsView.swift +++ b/Countdown/View/PreferencesView/SettingsView.swift @@ -105,6 +105,6 @@ struct SettingsView: View { struct SettingsView_Previews: PreviewProvider { static var previews: some View { - SettingsView() + SettingsView().frame(width: 350) } } diff --git a/Countdown/en.lproj/Localizable.strings b/Countdown/en.lproj/Localizable.strings index 9d7a688..9444816 100644 --- a/Countdown/en.lproj/Localizable.strings +++ b/Countdown/en.lproj/Localizable.strings @@ -20,7 +20,8 @@ "Settings.Remind me" = "Remind me:"; "Settings.Sticky note" = "Sticky note:"; -"About.version" = "version"; +"About.Version" = "Version"; +"About.Check" = "Check"; "About.Author" = "Author:"; "About.Donate me with" = "Donate me with"; "About.or" = "or"; diff --git a/Countdown/zh-Hans.lproj/Localizable.strings b/Countdown/zh-Hans.lproj/Localizable.strings index c76f768..226397d 100644 --- a/Countdown/zh-Hans.lproj/Localizable.strings +++ b/Countdown/zh-Hans.lproj/Localizable.strings @@ -20,7 +20,8 @@ "Settings.Remind me" = "εˆ°ζœŸζι†’:"; "Settings.Sticky note" = "摌青便签:"; -"About.version" = "η‰ˆζœ¬"; +"About.Version" = "η‰ˆζœ¬"; +"About.Check" = "ζ£€ζŸ₯"; "About.Author" = "δ½œθ€…:"; "About.Donate me with" = "ζ‰“θ΅δ½œθ€…:"; "About.or" = "ζˆ–";