From ca722b88944904c3819c20efc2726002889c112e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20B=C3=B6ttger?= Date: Fri, 16 May 2025 13:19:01 +0200 Subject: [PATCH] Logs instead of prints --- NearDrop/AudioManager.swift | 4 ++-- NearDrop/SelfTest/ActiveNetworkInterface.swift | 2 +- NearDrop/SelfTest/ApIsolation6Tester.swift | 2 +- NearDrop/SettingsView.swift | 8 +++----- NearDrop/TutorialView.swift | 6 +++--- NearbyShare/InboundNearbyConnection.swift | 4 ++-- QuickDrop.xcodeproj/project.pbxproj | 8 ++++---- 7 files changed, 16 insertions(+), 18 deletions(-) diff --git a/NearDrop/AudioManager.swift b/NearDrop/AudioManager.swift index de180ee..0e513b6 100644 --- a/NearDrop/AudioManager.swift +++ b/NearDrop/AudioManager.swift @@ -12,7 +12,7 @@ class AudioManager { static func playSound() { guard let soundURL = Bundle.main.url(forResource: "timeIsNow", withExtension: "mp3") else { - print("Sound file not found") + log("Sound file not found") return } @@ -20,7 +20,7 @@ class AudioManager { audioPlayer = try AVAudioPlayer(contentsOf: soundURL) audioPlayer?.play() } catch { - print("Error playing sound: \(error.localizedDescription)") + log("Error playing sound: \(error.localizedDescription)") } } } diff --git a/NearDrop/SelfTest/ActiveNetworkInterface.swift b/NearDrop/SelfTest/ActiveNetworkInterface.swift index 2e0a61f..8ee44f7 100644 --- a/NearDrop/SelfTest/ActiveNetworkInterface.swift +++ b/NearDrop/SelfTest/ActiveNetworkInterface.swift @@ -20,7 +20,7 @@ func getActiveNetworkInterface() -> String? { do { try process.run() } catch { - print("Failed to run process: \(error)") + log("Failed to run process: \(error)") return nil } diff --git a/NearDrop/SelfTest/ApIsolation6Tester.swift b/NearDrop/SelfTest/ApIsolation6Tester.swift index 8e4cbb7..84ddc51 100644 --- a/NearDrop/SelfTest/ApIsolation6Tester.swift +++ b/NearDrop/SelfTest/ApIsolation6Tester.swift @@ -49,7 +49,7 @@ class IPv6DeviceScanner { do { try process.run() } catch { - print("Failed to run ping6: \(error)") + log("Failed to run ping6: \(error)") completion([]) } } diff --git a/NearDrop/SettingsView.swift b/NearDrop/SettingsView.swift index b997fd5..e4c4859 100644 --- a/NearDrop/SettingsView.swift +++ b/NearDrop/SettingsView.swift @@ -48,7 +48,7 @@ struct SettingsView: View { let url = try URL(resolvingBookmarkData: saveFolderPath, options: [], relativeTo: nil, bookmarkDataIsStale: &isStale) return url.lastPathComponent // Returns the folder path as a string } catch { - print("Failed to resolve bookmark: \(error)") + log("Failed to resolve bookmark: \(error)") } } return nil // No saved folder @@ -63,15 +63,13 @@ struct SettingsView: View { if panel.runModal() == .OK, let url = panel.urls.first { do { - print("Selected folder: \(url)") + log("Selected folder: \(url)") let bookmarkData = try url.bookmarkData(options: .withSecurityScope, includingResourceValuesForKeys: nil, relativeTo: nil) - print(bookmarkData) - UserDefaults.standard.set(bookmarkData, forKey: UserDefaultsKeys.saveFolderBookmark.rawValue) } catch { - print("Failed to save security-scoped bookmark: \(error)") + log("Failed to save security-scoped bookmark: \(error)") } } } diff --git a/NearDrop/TutorialView.swift b/NearDrop/TutorialView.swift index 6acd866..19ea929 100644 --- a/NearDrop/TutorialView.swift +++ b/NearDrop/TutorialView.swift @@ -110,12 +110,12 @@ struct LargeAppIconView: View { .padding(.top, 50) .onTapGesture { taps += 1 - print("Clicked \(taps) times") + log("Clicked \(taps) times") if taps == 5 { sendLoggingString() - print("Copied log to clipboard") + log("Copied log to clipboard") taps = 0 } @@ -147,7 +147,7 @@ func sendLoggingString() { func sendEmailWithAttachment(fileURL: URL, recipients: [String], subject: String) { guard let emailService = NSSharingService(named: .composeEmail) else { - print("No email service available") + log("No email service available") return } diff --git a/NearbyShare/InboundNearbyConnection.swift b/NearbyShare/InboundNearbyConnection.swift index f749de1..7bf6e48 100644 --- a/NearbyShare/InboundNearbyConnection.swift +++ b/NearbyShare/InboundNearbyConnection.swift @@ -533,11 +533,11 @@ public class SaveFilesManager { return url } } else { - print("Bookmark is stale, using default downloads folder.") + log("Bookmark is stale, using default downloads folder.") } } catch { - print("Failed to resolve bookmark: \(error), using default downloads folder.") + log("Failed to resolve bookmark: \(error), using default downloads folder.") } } diff --git a/QuickDrop.xcodeproj/project.pbxproj b/QuickDrop.xcodeproj/project.pbxproj index 916e76e..5d3ccd1 100644 --- a/QuickDrop.xcodeproj/project.pbxproj +++ b/QuickDrop.xcodeproj/project.pbxproj @@ -707,7 +707,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = ShareExtension/ShareExtension.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; - "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = "${SHARED_BUILD}"; @@ -739,7 +739,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = ShareExtension/ShareExtension.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; - "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = "${SHARED_BUILD}"; @@ -899,7 +899,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = NearDrop/NearDrop.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; - "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = "${SHARED_BUILD}"; @@ -938,7 +938,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = NearDrop/NearDrop.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; - "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = "${SHARED_BUILD}";