diff --git a/Bitcoin Monitoring.xcodeproj/project.pbxproj b/Bitcoin Monitoring.xcodeproj/project.pbxproj index 93e8c5f..112b608 100644 --- a/Bitcoin Monitoring.xcodeproj/project.pbxproj +++ b/Bitcoin Monitoring.xcodeproj/project.pbxproj @@ -254,7 +254,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; - CODE_SIGN_ENTITLEMENTS = Bitcoin-Monitoring/Resources/BitcoinMonitoring.entitlements; + CODE_SIGN_ENTITLEMENTS = "Bitcoin-Monitoring/Resources/BitcoinMonitoring.entitlements"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; @@ -274,7 +274,7 @@ ); MACOSX_DEPLOYMENT_TARGET = 13.5; MARKETING_VERSION = 1.1.1; - PRODUCT_BUNDLE_IDENTIFIER = com.mark.bitcoin-monitoring; + PRODUCT_BUNDLE_IDENTIFIER = "com.mark.bitcoin-monitoring"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; @@ -287,7 +287,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; - CODE_SIGN_ENTITLEMENTS = Bitcoin-Monitoring/Resources/BitcoinMonitoring.entitlements; + CODE_SIGN_ENTITLEMENTS = "Bitcoin-Monitoring/Resources/BitcoinMonitoring.entitlements"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; @@ -307,7 +307,7 @@ ); MACOSX_DEPLOYMENT_TARGET = 13.5; MARKETING_VERSION = 1.1.1; - PRODUCT_BUNDLE_IDENTIFIER = com.mark.bitcoin-monitoring; + PRODUCT_BUNDLE_IDENTIFIER = "com.mark.bitcoin-monitoring"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; diff --git a/Bitcoin-Monitoring/Resources/alarm.mp3 b/Bitcoin-Monitoring/Resources/alarm.mp3 new file mode 100755 index 0000000..19fa20c Binary files /dev/null and b/Bitcoin-Monitoring/Resources/alarm.mp3 differ diff --git a/Bitcoin-Monitoring/Views/AboutWindowView.swift b/Bitcoin-Monitoring/Views/AboutWindowView.swift index a065d49..8ec94c5 100644 --- a/Bitcoin-Monitoring/Views/AboutWindowView.swift +++ b/Bitcoin-Monitoring/Views/AboutWindowView.swift @@ -7,6 +7,7 @@ import SwiftUI import Foundation +import AVFoundation /** * 代理认证URLSessionDelegate @@ -107,6 +108,9 @@ struct AboutWindowView: View { @State private var showingUpdateAlert = false @State private var updateAlertMessage = "" + // 音频播放器 + @State private var audioPlayer: AVAudioPlayer? + var body: some View { VStack(spacing: 20) { // 应用图标和标题区域 @@ -240,6 +244,7 @@ struct AboutWindowView: View { self.showingUpdateAlert = true case .orderedAscending: self.updateAlertMessage = "🆕 发现新版本!\n当前版本:\(self.appVersion)\n最新版本:\(latestVersion)\n\n点击确定后将打开GitHub发布页面。" + self.playAlarmSound() // 播放提示音 self.showingUpdateAlert = true case .orderedDescending: self.updateAlertMessage = "🎉 您已使用最新版本!\n当前版本:\(self.appVersion)" @@ -448,6 +453,32 @@ struct AboutWindowView: View { NSWorkspace.shared.open(url) print("✅ 已在浏览器中打开发布页面: \(releasePageURL)") } + + /** + * 播放提示音 + * 播放Resources目录中的alarm.mp3文件 + */ + private func playAlarmSound() { + guard let audioPath = Bundle.main.path(forResource: "alarm", ofType: "mp3") else { + print("❌ 无法找到alarm.mp3文件") + return + } + + let audioURL = URL(fileURLWithPath: audioPath) + + do { + // 创建音频播放器 - 这个方法可能抛出错误 + let player = try AVAudioPlayer(contentsOf: audioURL) + self.audioPlayer = player + player.prepareToPlay() + + // 播放音频 + player.play() + print("✅ 已播放更新提示音") + } catch { + print("❌ 播放提示音失败: \(error.localizedDescription)") + } + } } /**