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

App update - updates and edge cases to prevent intrusive update requests

altic-deva54a8c919924
diff --git a/Sources/Fluid/AppDelegate.swift b/Sources/Fluid/AppDelegate.swift
index 41ef378a..c2947594 100644
--- a/Sources/Fluid/AppDelegate.swift
+++ b/Sources/Fluid/AppDelegate.swift
@@ -12,6 +12,7 @@ import SwiftUI
class AppDelegate: NSObject, NSApplicationDelegate {
private var updater: AppUpdater?
+ private var updateCheckTimer: Timer?
func applicationDidFinishLaunching(_ notification: Notification) {
// Initialize AppUpdater for automatic updates
@@ -24,13 +25,36 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// Initialize app settings (dock visibility, etc.)
SettingsStore.shared.initializeAppSettings()
- // Check for updates automatically if enabled
+ // Check for updates automatically if enabled (initial check on launch)
self.checkForUpdatesAutomatically()
+ // Schedule periodic update checks every hour while app is running
+ self.schedulePeriodicUpdateChecks()
+
// Note: App UI is designed with dark color scheme in mind
// All gradients and effects are optimized for dark mode
}
+ func applicationWillTerminate(_ notification: Notification) {
+ // Clean up the update check timer
+ self.updateCheckTimer?.invalidate()
+ self.updateCheckTimer = nil
+ }
+
+ // MARK: - Periodic Update Checks
+
+ private func schedulePeriodicUpdateChecks() {
+ // Schedule a timer to check for updates every hour (3600 seconds)
+ // The actual check logic inside checkForUpdatesAutomatically() handles:
+ // - Whether auto-updates are enabled
+ // - Whether enough time has passed since last check
+ // - Whether the user snoozed the prompt
+ self.updateCheckTimer = Timer.scheduledTimer(withTimeInterval: 3600, repeats: true) { [weak self] _ in
+ DebugLogger.shared.debug("Periodic update check timer fired", source: "AppDelegate")
+ self?.checkForUpdatesAutomatically()
+ }
+ }
+
// MARK: - Manual Update Check
@objc func checkForUpdatesManually() {
@@ -106,9 +130,15 @@ class AppDelegate: NSObject, NSApplicationDelegate {
if result.hasUpdate {
DebugLogger.shared.info("✅ Update available: \(result.latestVersion)", source: "AppDelegate")
- // Show update notification on main thread
- await MainActor.run {
- self.showUpdateNotification(version: result.latestVersion)
+
+ // Check if user snoozed this version (clicked "Later")
+ if SettingsStore.shared.shouldShowUpdatePrompt(forVersion: result.latestVersion) {
+ // Show update notification on main thread
+ await MainActor.run {
+ self.showUpdateNotification(version: result.latestVersion)
+ }
+ } else {
+ DebugLogger.shared.debug("Update prompt snoozed for \(result.latestVersion), skipping notification", source: "AppDelegate")
}
} else {
DebugLogger.shared.info("✅ App is up to date", source: "AppDelegate")
@@ -131,7 +161,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
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.informativeText = "FluidVoice \(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")
@@ -140,9 +170,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
if response == .alertFirstButtonReturn {
DebugLogger.shared.info("User chose to install update now", source: "AppDelegate")
+ SettingsStore.shared.clearUpdateSnooze() // Clear snooze since they're installing
self.checkForUpdatesManually()
} else {
- DebugLogger.shared.info("User postponed update", source: "AppDelegate")
+ DebugLogger.shared.info("User postponed update for 24 hours", source: "AppDelegate")
+ SettingsStore.shared.snoozeUpdatePrompt(forVersion: version)
}
}
diff --git a/Sources/Fluid/Persistence/SettingsStore.swift b/Sources/Fluid/Persistence/SettingsStore.swift
index 7545e95a..30b3ec8b 100644
--- a/Sources/Fluid/Persistence/SettingsStore.swift
+++ b/Sources/Fluid/Persistence/SettingsStore.swift
@@ -39,6 +39,8 @@ final class SettingsStore: ObservableObject {
static let copyTranscriptionToClipboard = "CopyTranscriptionToClipboard"
static let autoUpdateCheckEnabled = "AutoUpdateCheckEnabled"
static let lastUpdateCheckDate = "LastUpdateCheckDate"
+ static let updatePromptSnoozedUntil = "UpdatePromptSnoozedUntil"
+ static let snoozedUpdateVersion = "SnoozedUpdateVersion"
static let playgroundUsed = "PlaygroundUsed"
// Command Mode Keys
@@ -382,15 +384,59 @@ final class SettingsStore: ObservableObject {
return true
}
- // Check if more than 24 hours have passed
- let dayInSeconds: TimeInterval = 24 * 60 * 60
- return Date().timeIntervalSince(lastCheck) >= dayInSeconds
+ // Check if more than 1 hour has passed
+ let hourInSeconds: TimeInterval = 60 * 60
+ return Date().timeIntervalSince(lastCheck) >= hourInSeconds
}
func updateLastCheckDate() {
self.lastUpdateCheckDate = Date()
}
+ // MARK: - Update Prompt Snooze
+
+ /// Date until which update prompts are snoozed (user clicked "Later")
+ var updatePromptSnoozedUntil: Date? {
+ get { self.defaults.object(forKey: Keys.updatePromptSnoozedUntil) as? Date }
+ set { self.defaults.set(newValue, forKey: Keys.updatePromptSnoozedUntil) }
+ }
+
+ /// The version that was snoozed (to allow prompting for newer versions)
+ var snoozedUpdateVersion: String? {
+ get { self.defaults.string(forKey: Keys.snoozedUpdateVersion) }
+ set { self.defaults.set(newValue, forKey: Keys.snoozedUpdateVersion) }
+ }
+
+ /// Check if we should show the update prompt for a given version
+ /// Returns false if user snoozed this version within the last 24 hours
+ func shouldShowUpdatePrompt(forVersion version: String) -> Bool {
+ // If a different (newer) version is available, always show
+ if let snoozedVersion = snoozedUpdateVersion, snoozedVersion != version {
+ return true
+ }
+
+ // Check if snooze period has expired
+ guard let snoozedUntil = updatePromptSnoozedUntil else {
+ return true // Never snoozed, show prompt
+ }
+
+ return Date() >= snoozedUntil
+ }
+
+ /// Snooze update prompts for 24 hours for the given version
+ func snoozeUpdatePrompt(forVersion version: String) {
+ let snoozeUntil = Date().addingTimeInterval(24 * 60 * 60) // 24 hours
+ self.updatePromptSnoozedUntil = snoozeUntil
+ self.snoozedUpdateVersion = version
+ DebugLogger.shared.info("Update prompt snoozed for version \(version) until \(snoozeUntil)", source: "SettingsStore")
+ }
+
+ /// Clear the snooze (e.g., when update is installed)
+ func clearUpdateSnooze() {
+ self.updatePromptSnoozedUntil = nil
+ self.snoozedUpdateVersion = nil
+ }
+
var playgroundUsed: Bool {
get { self.defaults.bool(forKey: Keys.playgroundUsed) }
set { self.defaults.set(newValue, forKey: Keys.playgroundUsed) }
diff --git a/Sources/Fluid/UI/SettingsView.swift b/Sources/Fluid/UI/SettingsView.swift
index f197997b..61aedb2e 100644
--- a/Sources/Fluid/UI/SettingsView.swift
+++ b/Sources/Fluid/UI/SettingsView.swift
@@ -92,7 +92,7 @@ struct SettingsView: View {
VStack(alignment: .leading, spacing: 2) {
Text("Automatic Updates")
.font(.body)
- Text("Check for updates automatically once per day")
+ Text("Check for updates automatically once per hour")
.font(.subheadline)
.foregroundStyle(.secondary)
}