From dee5de4c1affe18ed8112711091820f9f552e54a Mon Sep 17 00:00:00 2001 From: Malted Date: Sun, 28 Dec 2025 16:42:48 +0000 Subject: [PATCH] fix: add macOS 15 backward compatibility for glassEffect --- MacThrottle.xcodeproj/project.pbxproj | 4 ++-- MacThrottle/Views/AboutView.swift | 28 +++++++++++++++++++-------- MacThrottle/Views/HistoryViews.swift | 21 ++++++++++++++------ 3 files changed, 37 insertions(+), 16 deletions(-) diff --git a/MacThrottle.xcodeproj/project.pbxproj b/MacThrottle.xcodeproj/project.pbxproj index 942f993..c668bd3 100644 --- a/MacThrottle.xcodeproj/project.pbxproj +++ b/MacThrottle.xcodeproj/project.pbxproj @@ -246,7 +246,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 26.0; + MACOSX_DEPLOYMENT_TARGET = 15.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -304,7 +304,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 26.0; + MACOSX_DEPLOYMENT_TARGET = 15.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = macosx; diff --git a/MacThrottle/Views/AboutView.swift b/MacThrottle/Views/AboutView.swift index 81852bc..192da7a 100644 --- a/MacThrottle/Views/AboutView.swift +++ b/MacThrottle/Views/AboutView.swift @@ -3,11 +3,18 @@ import SwiftUI struct AboutView: View { var body: some View { VStack(spacing: 16) { - Image(nsImage: NSImage(named: "AppIcon") ?? NSApp.applicationIconImage) - .resizable() - .frame(width: 128, height: 128) - .cornerRadius(24) - .glassEffect(.regular.interactive(), in: RoundedRectangle(cornerRadius: 24)) + if #available(macOS 26.0, *) { + Image(nsImage: NSImage(named: "AppIcon") ?? NSApp.applicationIconImage) + .resizable() + .frame(width: 128, height: 128) + .cornerRadius(24) + .glassEffect(.regular.interactive(), in: RoundedRectangle(cornerRadius: 24)) + } else { + Image(nsImage: NSImage(named: "AppIcon") ?? NSApp.applicationIconImage) + .resizable() + .frame(width: 128, height: 128) + .cornerRadius(24) + } Text("MacThrottle") .font(.title) @@ -23,9 +30,14 @@ struct AboutView: View { .foregroundStyle(.secondary) if let url = URL(string: "https://github.com/angristan/MacThrottle") { - Link("View on GitHub", destination: url) - .font(.caption) - .glassEffect() + if #available(macOS 26.0, *) { + Link("View on GitHub", destination: url) + .font(.caption) + .glassEffect() + } else { + Link("View on GitHub", destination: url) + .font(.caption) + } } } .padding(32) diff --git a/MacThrottle/Views/HistoryViews.swift b/MacThrottle/Views/HistoryViews.swift index c7162de..10dbfa9 100644 --- a/MacThrottle/Views/HistoryViews.swift +++ b/MacThrottle/Views/HistoryViews.swift @@ -267,12 +267,21 @@ struct HistoryGraphView: View { let timeAgo = Int(Date().timeIntervalSince(entry.timestamp)) let timeStr = timeAgo < 60 ? "\(timeAgo)s ago" : "\(timeAgo / 60)m ago" let fanStr = showFanSpeed ? entry.fanSpeed.map { " • Fan \(Int($0))%" } ?? "" : "" - Text("\(Int(temp))° • \(entry.pressure.displayName)\(fanStr) • \(timeStr)") - .font(.system(size: 8, weight: .medium)) - .padding(.horizontal, 6) - .padding(.vertical, 3) - .glassEffect(.regular, in: RoundedRectangle(cornerRadius: 6)) - .padding(4) + if #available(macOS 26.0, *) { + Text("\(Int(temp))° • \(entry.pressure.displayName)\(fanStr) • \(timeStr)") + .font(.system(size: 8, weight: .medium)) + .padding(.horizontal, 6) + .padding(.vertical, 3) + .glassEffect(.regular, in: RoundedRectangle(cornerRadius: 6)) + .padding(4) + } else { + Text("\(Int(temp))° • \(entry.pressure.displayName)\(fanStr) • \(timeStr)") + .font(.system(size: 8, weight: .medium)) + .padding(.horizontal, 6) + .padding(.vertical, 3) + .background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: 6)) + .padding(4) + } } } }