general: appstore build stuff
This commit is contained in:
@@ -193,8 +193,10 @@ class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
|
||||
window.backgroundColor = .clear
|
||||
window.contentView = NSHostingView(rootView: content)
|
||||
window.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary]
|
||||
window.acceptsMouseMovedEvents = !requiresFocus
|
||||
window.ignoresMouseEvents = !requiresFocus
|
||||
|
||||
// Allow mouse events for all reminders (needed for dismiss button)
|
||||
window.acceptsMouseMovedEvents = true
|
||||
window.ignoresMouseEvents = false
|
||||
|
||||
let windowController = NSWindowController(window: window)
|
||||
windowController.showWindow(nil)
|
||||
|
||||
@@ -6,10 +6,5 @@
|
||||
<true/>
|
||||
<key>com.apple.security.network.client</key>
|
||||
<true/>
|
||||
<key>com.apple.security.temporary-exception.mach-lookup.global-name</key>
|
||||
<array>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)-spks</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)-spki</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -12,6 +12,15 @@ struct GazeApp: App {
|
||||
@NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
|
||||
@StateObject private var settingsManager = SettingsManager.shared
|
||||
|
||||
init() {
|
||||
// Handle test launch arguments
|
||||
if TestingEnvironment.shouldSkipOnboarding {
|
||||
SettingsManager.shared.settings.hasCompletedOnboarding = true
|
||||
} else if TestingEnvironment.shouldResetOnboarding {
|
||||
SettingsManager.shared.settings.hasCompletedOnboarding = false
|
||||
}
|
||||
}
|
||||
|
||||
var body: some Scene {
|
||||
// Onboarding window (only shown when not completed)
|
||||
WindowGroup {
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>LSUIElement</key>
|
||||
<true/>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
@@ -18,15 +22,5 @@
|
||||
<string>$(MARKETING_VERSION)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2026 Mike Freno. All rights reserved.</string>
|
||||
<key>SUPublicEDKey</key>
|
||||
<string>Z2RmohI1y2bgeGQQUDqO9F0HNF2AzFotOt8CwGB6VJM=</string>
|
||||
<key>SUFeedURL</key>
|
||||
<string>https://freno.me/api/Gaze/appcast.xml</string>
|
||||
<key>SUEnableAutomaticChecks</key>
|
||||
<true/>
|
||||
<key>SUScheduledCheckInterval</key>
|
||||
<integer>86400</integer>
|
||||
<key>SUEnableInstallerLauncherService</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -7,24 +7,31 @@
|
||||
|
||||
import Combine
|
||||
import Foundation
|
||||
#if !APPSTORE
|
||||
import Sparkle
|
||||
#endif
|
||||
|
||||
@MainActor
|
||||
class UpdateManager: NSObject, ObservableObject {
|
||||
static let shared = UpdateManager()
|
||||
|
||||
#if !APPSTORE
|
||||
private var updaterController: SPUStandardUpdaterController?
|
||||
private var automaticallyChecksObservation: NSKeyValueObservation?
|
||||
private var lastCheckDateObservation: NSKeyValueObservation?
|
||||
#endif
|
||||
|
||||
@Published var automaticallyChecksForUpdates = false
|
||||
@Published var lastUpdateCheckDate: Date?
|
||||
|
||||
private override init() {
|
||||
super.init()
|
||||
#if !APPSTORE
|
||||
setupUpdater()
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !APPSTORE
|
||||
private func setupUpdater() {
|
||||
updaterController = SPUStandardUpdaterController(
|
||||
startingUpdater: true,
|
||||
@@ -57,17 +64,24 @@ class UpdateManager: NSObject, ObservableObject {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
func checkForUpdates() {
|
||||
#if !APPSTORE
|
||||
guard let updater = updaterController?.updater else {
|
||||
print("Updater not initialized")
|
||||
return
|
||||
}
|
||||
updater.checkForUpdates()
|
||||
#else
|
||||
print("Updates are managed by the App Store")
|
||||
#endif
|
||||
}
|
||||
|
||||
deinit {
|
||||
#if !APPSTORE
|
||||
automaticallyChecksObservation?.invalidate()
|
||||
lastCheckDateObservation?.invalidate()
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,13 +101,15 @@ struct LookAwayReminderView: View {
|
||||
}
|
||||
|
||||
private func startCountdown() {
|
||||
timer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { _ in
|
||||
let timer = Timer(timeInterval: 1.0, repeats: true) { [self] _ in
|
||||
if remainingSeconds > 0 {
|
||||
remainingSeconds -= 1
|
||||
} else {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
RunLoop.current.add(timer, forMode: .common)
|
||||
self.timer = timer
|
||||
}
|
||||
|
||||
private func dismiss() {
|
||||
|
||||
@@ -101,13 +101,15 @@ struct UserTimerOverlayReminderView: View {
|
||||
}
|
||||
|
||||
private func startCountdown() {
|
||||
countdownTimer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { _ in
|
||||
let timer = Timer(timeInterval: 1.0, repeats: true) { [self] _ in
|
||||
if remainingSeconds > 0 {
|
||||
remainingSeconds -= 1
|
||||
} else {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
RunLoop.current.add(timer, forMode: .common)
|
||||
countdownTimer = timer
|
||||
}
|
||||
|
||||
private func dismiss() {
|
||||
|
||||
Reference in New Issue
Block a user