Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Panel and status colors in the theme editor, covering the results, inspector, structure, compare and query plan panes.
- Themes that name a system color for a slot, so the built-in themes keep the system's own contrast settings.
- Reason shown in Settings > Appearance for a theme file that could not be loaded.
- Setting in Settings > General to hide the version and Check for Updates on the Welcome window.
- Install Parquet… in the Export dialog's format menu when the Parquet plugin is not installed.

### Changed
Expand Down
28 changes: 6 additions & 22 deletions TablePro/Models/Settings/GeneralSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import Foundation

/// Startup behavior when app launches
enum StartupBehavior: String, Codable, CaseIterable, Identifiable {
case showWelcome = "showWelcome"
case reopenLast = "reopenLast"
Expand All @@ -20,7 +19,6 @@ enum StartupBehavior: String, Codable, CaseIterable, Identifiable {
}
}

/// App language options
enum AppLanguage: String, Codable, CaseIterable, Identifiable {
case system = "system"
case english = "en"
Expand Down Expand Up @@ -55,39 +53,21 @@ enum AppLanguage: String, Codable, CaseIterable, Identifiable {
}
}

/// General app settings
struct GeneralSettings: Codable, Equatable {
var startupBehavior: StartupBehavior
var language: AppLanguage

/// Query execution timeout in seconds (0 = no limit)
// 0 means no limit
var queryTimeoutSeconds: Int

/// Whether to share anonymous usage analytics
var shareAnalytics: Bool

/// Whether the sidebar shows a Recent section with recently opened tables
var showRecentTables: Bool

/// Whether to show database object comments in the sidebar and data grid headers
var showObjectComments: Bool

/// Whether sidebar rows show a type icon before the object name
var showObjectIcons: Bool

/// Whether the sidebar tree and its database filter list system databases and schemas
var showSystemContainers: Bool

/// Whether a partitioned table lists its partitions in the sidebar and shows how many it holds
var showPartitions: Bool

/// Whether the window shows the workspace rail listing every open connection and database
var showWorkspaceRail: Bool

/// How tall sidebar rows are drawn, following the system Appearance setting unless overridden
var showWelcomeVersionInfo: Bool
var sidebarRowSize: SidebarRowSizePreference

/// How often TablePro checks that an open connection still works
var connectionHealthCheck: ConnectionHealthCheck

static let `default` = GeneralSettings(
Expand All @@ -101,6 +81,7 @@ struct GeneralSettings: Codable, Equatable {
showSystemContainers: false,
showPartitions: true,
showWorkspaceRail: true,
showWelcomeVersionInfo: true,
sidebarRowSize: .matchSystem,
connectionHealthCheck: .every30Seconds
)
Expand All @@ -116,6 +97,7 @@ struct GeneralSettings: Codable, Equatable {
showSystemContainers: Bool = false,
showPartitions: Bool = true,
showWorkspaceRail: Bool = true,
showWelcomeVersionInfo: Bool = true,
sidebarRowSize: SidebarRowSizePreference = .matchSystem,
connectionHealthCheck: ConnectionHealthCheck = .every30Seconds
) {
Expand All @@ -129,6 +111,7 @@ struct GeneralSettings: Codable, Equatable {
self.showSystemContainers = showSystemContainers
self.showPartitions = showPartitions
self.showWorkspaceRail = showWorkspaceRail
self.showWelcomeVersionInfo = showWelcomeVersionInfo
self.sidebarRowSize = sidebarRowSize
self.connectionHealthCheck = connectionHealthCheck
}
Expand All @@ -146,6 +129,7 @@ struct GeneralSettings: Codable, Equatable {
showSystemContainers = container.decodeSetting(.showSystemContainers, default: fallback.showSystemContainers)
showPartitions = container.decodeSetting(.showPartitions, default: fallback.showPartitions)
showWorkspaceRail = container.decodeSetting(.showWorkspaceRail, default: fallback.showWorkspaceRail)
showWelcomeVersionInfo = container.decodeSetting(.showWelcomeVersionInfo, default: fallback.showWelcomeVersionInfo)
sidebarRowSize = container.decodeSetting(.sidebarRowSize, default: fallback.sidebarRowSize)
connectionHealthCheck = container.decodeSetting(.connectionHealthCheck, default: fallback.connectionHealthCheck)
}
Expand Down
80 changes: 80 additions & 0 deletions TablePro/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -161773,6 +161773,46 @@
}
}
},
"Show version and updates on the Welcome window" : {
"localizations" : {
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Afficher la version et les mises à jour dans la fenêtre d’accueil"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
"value" : "시작 윈도우에 버전 및 업데이트 보기"
}
},
"tr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Karşılama penceresinde sürümü ve güncellemeleri göster"
}
},
"vi" : {
"stringUnit" : {
"state" : "translated",
"value" : "Hiện phiên bản và cập nhật trên cửa sổ chào mừng"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "在欢迎窗口显示版本和更新"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "在歡迎視窗顯示版本和更新"
}
}
}
},
"Show Welcome Screen" : {
"localizations" : {
"fr" : {
Expand Down Expand Up @@ -162411,6 +162451,46 @@
}
}
},
"Shows the version and Check for Updates under the app icon. An available update is shown either way." : {
"localizations" : {
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Affiche la version et Rechercher les mises à jour sous l’icône de l’app. Une mise à jour disponible s’affiche dans tous les cas."
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
"value" : "앱 아이콘 아래에 버전과 업데이트 확인을 표시합니다. 사용 가능한 업데이트는 어느 경우에나 표시됩니다."
}
},
"tr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Uygulama simgesinin altında sürümü ve Güncellemeleri Kontrol Et bağlantısını gösterir. Mevcut bir güncelleme her durumda gösterilir."
}
},
"vi" : {
"stringUnit" : {
"state" : "translated",
"value" : "Hiện phiên bản và Kiểm tra cập nhật dưới biểu tượng ứng dụng. Bản cập nhật có sẵn vẫn luôn được hiện."
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "在应用图标下方显示版本和“检查更新”。有可用更新时始终会显示。"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "在 App 圖示下方顯示版本和「檢查更新」。有可用更新時一律會顯示。"
}
}
}
},
"Side" : {
"localizations" : {
"fr" : {
Expand Down
4 changes: 4 additions & 0 deletions TablePro/Views/Settings/GeneralSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ struct GeneralSettingsView: View {
}
}

Toggle("Show version and updates on the Welcome window", isOn: $settings.showWelcomeVersionInfo)
.accessibilityIdentifier("welcome-version-info-toggle")
.help("Shows the version and Check for Updates under the app icon. An available update is shown either way.")

Section("Tabs") {
Toggle("Enable preview tabs", isOn: $tabSettings.enablePreviewTabs)
.help("Single-clicking a table opens a temporary tab that gets replaced on next click.")
Expand Down
33 changes: 24 additions & 9 deletions TablePro/Views/Welcome/WelcomeActionsPanel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
// TablePro
//

import Combine
import SwiftUI

struct WelcomeActionsPanel: View {
@ObservedObject private var licenseManager = LicenseManager.shared
@ObservedObject private var updater = SoftwareUpdater.shared
let onActivateLicense: () -> Void
let onNewConnection: () -> Void
let onOpenFile: () -> Void
Expand All @@ -16,7 +18,12 @@ struct WelcomeActionsPanel: View {
let onImportConnectionsFile: () -> Void
let onOpenProjectFolder: () -> Void

private let updater = SoftwareUpdater.shared
// One key, not the whole manager: the window lives all session and every settings write would redraw it.
@State private var showsVersionInfo = AppSettingsManager.shared.general.showWelcomeVersionInfo

private static let versionInfoSetting = AppSettingsManager.shared.$general
.map(\.showWelcomeVersionInfo)
.removeDuplicates()

/// Captured once, because the stored value is overwritten on the same appearance that reads
/// it. Without the capture the line would replace itself with nothing on the next redraw.
Expand All @@ -35,16 +42,23 @@ struct WelcomeActionsPanel: View {
Text(verbatim: "TablePro")
.font(.title2.weight(.semibold))

Text(String(format: String(localized: "Version %@"), Bundle.main.appVersion))
.font(.callout)
.foregroundStyle(.secondary)
if showsVersionInfo {
Text(String(format: String(localized: "Version %@"), Bundle.main.appVersion))
.font(.callout)
.foregroundStyle(.secondary)
.accessibilityIdentifier("welcome-version-line")
}

Button(updater.checkForUpdatesTitle) {
updater.checkForUpdates()
// A deferred update has its gentle reminder here, so hiding the line never hides that.
if showsVersionInfo || updater.hasPendingUpdate {
Button(updater.checkForUpdatesTitle) {
updater.checkForUpdates()
}
.buttonStyle(.link)
.font(.callout)
.disabled(!updater.canCheckForUpdates)
.accessibilityIdentifier("welcome-check-for-updates-link")
}
.buttonStyle(.link)
.font(.callout)
.disabled(!updater.canCheckForUpdates)

if showsWhatsNew {
Button(String(format: String(localized: "What's New in %@"), Bundle.main.appVersion)) {
Expand Down Expand Up @@ -103,6 +117,7 @@ struct WelcomeActionsPanel: View {
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.onAppear(perform: recordAppVersion)
.onReceive(Self.versionInfoSetting) { showsVersionInfo = $0 }
}

private func recordAppVersion() {
Expand Down
Loading