Skip to content

Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more

Added auto update checking once per day + settings to enable / disable it ; addded 'fn' for shortcut modifier ;

altic-dev786b7399247d
diff --git a/Sources/Fluid/AppDelegate.swift b/Sources/Fluid/AppDelegate.swift
index 5fcec476..e1e2b5b5 100644
--- a/Sources/Fluid/AppDelegate.swift
+++ b/Sources/Fluid/AppDelegate.swift
@@ -24,6 +24,9 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// Initialize app settings (dock visibility, etc.)
SettingsStore.shared.initializeAppSettings()
+ // Check for updates automatically if enabled
+ checkForUpdatesAutomatically()
+
// Note: App UI is designed with dark color scheme in mind
// All gradients and effects are optimized for dark mode
}
@@ -62,6 +65,73 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
}
+ // MARK: - Automatic Update Check
+
+ private func checkForUpdatesAutomatically() {
+ // Check if we should perform an automatic update check
+ guard SettingsStore.shared.shouldCheckForUpdates() else {
+ let reason = !SettingsStore.shared.autoUpdateCheckEnabled ? "disabled by user" : "checked recently"
+ DebugLogger.shared.debug("Automatic update check skipped (\(reason))", source: "AppDelegate")
+ return
+ }
+
+ DebugLogger.shared.info("Scheduling automatic update check...", source: "AppDelegate")
+
+ // Delay check slightly to avoid slowing down app launch
+ Task {
+ // Wait 3 seconds after launch before checking
+ try? await Task.sleep(nanoseconds: 3_000_000_000)
+
+ DebugLogger.shared.info("Performing automatic update check for altic-dev/Fluid-oss", source: "AppDelegate")
+
+ do {
+ let result = try await SimpleUpdater.shared.checkForUpdate(owner: "altic-dev", repo: "Fluid-oss")
+
+ // Update the last check date regardless of result
+ await MainActor.run {
+ SettingsStore.shared.updateLastCheckDate()
+ }
+
+ if result.hasUpdate {
+ DebugLogger.shared.info("✅ Update available: \(result.latestVersion)", source: "AppDelegate")
+ // Show update notification on main thread
+ await showUpdateNotification(version: result.latestVersion)
+ } else {
+ DebugLogger.shared.info("✅ App is up to date", source: "AppDelegate")
+ }
+ } catch {
+ // Silently log the error, don't bother the user with failed automatic checks
+ DebugLogger.shared.debug("Automatic update check failed: \(error.localizedDescription)", source: "AppDelegate")
+
+ // Still update last check date to avoid hammering the API on failure
+ await MainActor.run {
+ SettingsStore.shared.updateLastCheckDate()
+ }
+ }
+ }
+ }
+
+ @MainActor
+ private func showUpdateNotification(version: String) {
+ DebugLogger.shared.info("Showing update notification for version \(version)", source: "AppDelegate")
+
+ let alert = NSAlert()
+ alert.messageText = "Update Available"
+ alert.informativeText = "Fluid \(version) is now available. Would you like to install it now?\n\nThe app will restart automatically after installation."
+ alert.alertStyle = .informational
+ alert.addButton(withTitle: "Install Now")
+ alert.addButton(withTitle: "Later")
+
+ let response = alert.runModal()
+
+ if response == .alertFirstButtonReturn {
+ DebugLogger.shared.info("User chose to install update now", source: "AppDelegate")
+ checkForUpdatesManually()
+ } else {
+ DebugLogger.shared.info("User postponed update", source: "AppDelegate")
+ }
+ }
+
private func showUpdateAlert(title: String, message: String) {
let alert = NSAlert()
alert.messageText = title
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swift
index 5b238d43..dd2e6317 100644
--- a/Sources/Fluid/ContentView.swift
+++ b/Sources/Fluid/ContentView.swift
@@ -211,8 +211,8 @@ struct ContentView: View {
}
NSEvent.addLocalMonitorForEvents(matching: [.keyDown, .flagsChanged]) { event in
- let eventModifiers = event.modifierFlags.intersection([.command, .option, .control, .shift])
- let shortcutModifiers = hotkeyShortcut.modifierFlags.intersection([.command, .option, .control, .shift])
+ let eventModifiers = event.modifierFlags.intersection([.function, .command, .option, .control, .shift])
+ let shortcutModifiers = hotkeyShortcut.modifierFlags.intersection([.function, .command, .option, .control, .shift])
DebugLogger.shared.debug("NSEvent \(event.type) keyCode=\(event.keyCode) recordingShortcut=\(isRecordingShortcut)", source: "ContentView")
@@ -284,7 +284,9 @@ struct ContentView: View {
// Modifiers are currently pressed
var actualKeyCode = event.keyCode
- if eventModifiers.contains(.command) {
+ if eventModifiers.contains(.function) {
+ actualKeyCode = 63 // fn key
+ } else if eventModifiers.contains(.command) {
actualKeyCode = (event.keyCode == 55) ? 55 : 54 // 55 = left cmd, 54 = right cmd
} else if eventModifiers.contains(.option) {
actualKeyCode = (event.keyCode == 58) ? 58 : 61 // 58 = left opt, 61 = right opt
@@ -1283,6 +1285,28 @@ struct ContentView: View {
Text("Note: May require app restart to take effect.")
.font(.caption2)
.foregroundStyle(.secondary.opacity(0.7))
+
+ Divider()
+
+ Toggle(isOn: Binding(
+ get: { SettingsStore.shared.autoUpdateCheckEnabled },
+ set: { SettingsStore.shared.autoUpdateCheckEnabled = $0 }
+ )) {
+ VStack(alignment: .leading, spacing: 4) {
+ Text("Automatic Updates")
+ .font(.headline)
+ Text("Check for updates automatically once per day")
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ }
+ }
+ .toggleStyle(.switch)
+
+ if let lastCheck = SettingsStore.shared.lastUpdateCheckDate {
+ Text("Last checked: \(lastCheck.formatted(date: .abbreviated, time: .shortened))")
+ .font(.caption2)
+ .foregroundStyle(.secondary.opacity(0.7))
+ }
}
}
.padding(24)
diff --git a/Sources/Fluid/Persistence/SettingsStore.swift b/Sources/Fluid/Persistence/SettingsStore.swift
index 363e400c..ab24806c 100644
--- a/Sources/Fluid/Persistence/SettingsStore.swift
+++ b/Sources/Fluid/Persistence/SettingsStore.swift
@@ -31,6 +31,8 @@ final class SettingsStore
static let pressAndHoldMode = "PressAndHoldMode"
static let enableStreamingPreview = "EnableStreamingPreview"
static let copyTranscriptionToClipboard = "CopyTranscriptionToClipboard"
+ static let autoUpdateCheckEnabled = "AutoUpdateCheckEnabled"
+ static let lastUpdateCheckDate = "LastUpdateCheckDate"
}
struct SavedProvider: Codable, Identifiable, Hashable
@@ -218,6 +220,46 @@ final class SettingsStore
}
}
+ var autoUpdateCheckEnabled: Bool
+ {
+ get {
+ let value = defaults.object(forKey: Keys.autoUpdateCheckEnabled)
+ return value as? Bool ?? true // Default to enabled
+ }
+ set {
+ defaults.set(newValue, forKey: Keys.autoUpdateCheckEnabled)
+ }
+ }
+
+ var lastUpdateCheckDate: Date?
+ {
+ get {
+ return defaults.object(forKey: Keys.lastUpdateCheckDate) as? Date
+ }
+ set {
+ defaults.set(newValue, forKey: Keys.lastUpdateCheckDate)
+ }
+ }
+
+ // MARK: - Update Check Helper
+
+ func shouldCheckForUpdates() -> Bool {
+ guard autoUpdateCheckEnabled else { return false }
+
+ guard let lastCheck = lastUpdateCheckDate else {
+ // Never checked before, should check
+ return true
+ }
+
+ // Check if more than 24 hours have passed
+ let dayInSeconds: TimeInterval = 24 * 60 * 60
+ return Date().timeIntervalSince(lastCheck) >= dayInSeconds
+ }
+
+ func updateLastCheckDate() {
+ lastUpdateCheckDate = Date()
+ }
+
// MARK: - Private Methods
private func updateLaunchAtStartup(_ enabled: Bool) {
diff --git a/Sources/Fluid/Services/GlobalHotkeyManager.swift b/Sources/Fluid/Services/GlobalHotkeyManager.swift
index 1ae5d937..ae0fda2a 100644
--- a/Sources/Fluid/Services/GlobalHotkeyManager.swift
+++ b/Sources/Fluid/Services/GlobalHotkeyManager.swift
@@ -151,6 +151,7 @@ final class GlobalHotkeyManager: NSObject
let flags = event.flags
var eventModifiers: NSEvent.ModifierFlags = []
+ if flags.contains(.maskSecondaryFn) { eventModifiers.insert(.function) }
if flags.contains(.maskCommand) { eventModifiers.insert(.command) }
if flags.contains(.maskAlternate) { eventModifiers.insert(.option) }
if flags.contains(.maskControl) { eventModifiers.insert(.control) }
@@ -187,7 +188,8 @@ final class GlobalHotkeyManager: NSObject
case .flagsChanged:
guard shortcut.modifierFlags.isEmpty else { break }
- let isModifierPressed = flags.contains(.maskCommand)
+ let isModifierPressed = flags.contains(.maskSecondaryFn)
+ || flags.contains(.maskCommand)
|| flags.contains(.maskAlternate)
|| flags.contains(.maskControl)
|| flags.contains(.maskShift)
@@ -288,8 +290,8 @@ final class GlobalHotkeyManager: NSObject
private func matchesShortcut(keyCode: UInt16, modifiers: NSEvent.ModifierFlags) -> Bool
{
- let relevantModifiers: NSEvent.ModifierFlags = modifiers.intersection([.command, .option, .control, .shift])
- let shortcutModifiers = shortcut.modifierFlags.intersection([.command, .option, .control, .shift])
+ let relevantModifiers: NSEvent.ModifierFlags = modifiers.intersection([.function, .command, .option, .control, .shift])
+ let shortcutModifiers = shortcut.modifierFlags.intersection([.function, .command, .option, .control, .shift])
return keyCode == shortcut.keyCode && relevantModifiers == shortcutModifiers
}
diff --git a/Sources/Fluid/Services/SimpleUpdater.swift b/Sources/Fluid/Services/SimpleUpdater.swift
index 2cf2ef9f..14674c74 100644
--- a/Sources/Fluid/Services/SimpleUpdater.swift
+++ b/Sources/Fluid/Services/SimpleUpdater.swift
@@ -47,6 +47,36 @@ final class SimpleUpdater {
"V4J43B279J"
]
+ // Silent check that returns update info without showing alerts or installing
+ func checkForUpdate(owner: String, repo: String) async throws -> (hasUpdate: Bool, latestVersion: String) {
+ let releasesURL = URL(string: "https://api.github.com/repos/\(owner)/\(repo)/releases")!
+
+ let (data, response) = try await URLSession.shared.data(from: releasesURL)
+ guard let http = response as? HTTPURLResponse, (200..<300).contains(http.statusCode) else {
+ throw SimpleUpdateError.invalidResponse
+ }
+
+ let releases: [GHRelease]
+ do {
+ releases = try JSONDecoder().decode([GHRelease].self, from: data)
+ } catch {
+ throw SimpleUpdateError.jsonDecoding
+ }
+
+ // choose latest non-prerelease release
+ guard let latest = releases.first(where: { !$0.prerelease }) else {
+ throw SimpleUpdateError.noSuitableRelease
+ }
+
+ let currentVersionString = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "0.0.0"
+ let current = parseVersion(currentVersionString)
+ let latestTag = latest.tag_name
+ let latestVersion = parseVersion(latestTag)
+
+ // Return whether update is available
+ return (isVersion(latestVersion, greaterThan: current), latestTag)
+ }
+
func checkAndUpdate(owner: String, repo: String) async throws {
let releasesURL = URL(string: "https://api.github.com/repos/\(owner)/\(repo)/releases")!