diff --git a/NoCameraSound/NoCameraSound.xcodeproj/project.pbxproj b/NoCameraSound/NoCameraSound.xcodeproj/project.pbxproj index 8627d2a..c305983 100644 --- a/NoCameraSound/NoCameraSound.xcodeproj/project.pbxproj +++ b/NoCameraSound/NoCameraSound.xcodeproj/project.pbxproj @@ -14,6 +14,7 @@ 3D16394B295C4ABF006D31D8 /* vm_unaligned_copy_switch_race.c in Sources */ = {isa = PBXBuildFile; fileRef = 3D16394A295C4ABF006D31D8 /* vm_unaligned_copy_switch_race.c */; }; 3D163953295C7029006D31D8 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3D163955295C7029006D31D8 /* Localizable.strings */; }; 3D163959295C7810006D31D8 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3D163958295C7810006D31D8 /* Assets.xcassets */; }; + 3D2342AB295D31BD00A6E40D /* plist in Resources */ = {isa = PBXBuildFile; fileRef = 3D2342AA295D31BD00A6E40D /* plist */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -28,6 +29,7 @@ 3D16394A295C4ABF006D31D8 /* vm_unaligned_copy_switch_race.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vm_unaligned_copy_switch_race.c; sourceTree = ""; }; 3D163954295C7029006D31D8 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = ""; }; 3D163958295C7810006D31D8 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 3D2342AA295D31BD00A6E40D /* plist */ = {isa = PBXFileReference; lastKnownFileType = folder; path = plist; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -69,6 +71,7 @@ 3D163917295B520E006D31D8 /* NoCameraSound.swift */, 3D163919295B5227006D31D8 /* NoCameraSound-Bridging-Header.h */, 3D163958295C7810006D31D8 /* Assets.xcassets */, + 3D2342AA295D31BD00A6E40D /* plist */, 3D16390D295B51DB006D31D8 /* Preview Content */, ); path = NoCameraSound; @@ -143,6 +146,7 @@ buildActionMask = 2147483647; files = ( 3D163953295C7029006D31D8 /* Localizable.strings in Resources */, + 3D2342AB295D31BD00A6E40D /* plist in Resources */, 3D163959295C7810006D31D8 /* Assets.xcassets in Resources */, 3D16390F295B51DB006D31D8 /* Preview Assets.xcassets in Resources */, ); @@ -313,7 +317,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 4.5; + MARKETING_VERSION = 4.6; PRODUCT_BUNDLE_IDENTIFIER = "com.straight-tamago.NoCameraSound"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; @@ -347,7 +351,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 4.5; + MARKETING_VERSION = 4.6; PRODUCT_BUNDLE_IDENTIFIER = "com.straight-tamago.NoCameraSound"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; diff --git a/NoCameraSound/NoCameraSound.xcodeproj/project.xcworkspace/xcuserdata/mini.xcuserdatad/UserInterfaceState.xcuserstate b/NoCameraSound/NoCameraSound.xcodeproj/project.xcworkspace/xcuserdata/mini.xcuserdatad/UserInterfaceState.xcuserstate index 9867538..9d23313 100644 Binary files a/NoCameraSound/NoCameraSound.xcodeproj/project.xcworkspace/xcuserdata/mini.xcuserdatad/UserInterfaceState.xcuserstate and b/NoCameraSound/NoCameraSound.xcodeproj/project.xcworkspace/xcuserdata/mini.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/NoCameraSound/NoCameraSound/ContentView.swift b/NoCameraSound/NoCameraSound/ContentView.swift index e008df4..a0c858e 100644 --- a/NoCameraSound/NoCameraSound/ContentView.swift +++ b/NoCameraSound/NoCameraSound/ContentView.swift @@ -9,13 +9,17 @@ import SwiftUI struct ContentView: View { let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String - @State private var message = "" - @State private var showingAlert = false + @State private var LogMessage = "" + @State private var LogText = "" + @State private var ViewLog = false + @State private var SettingsShowing = false + @State private var ios14Warning = false var body: some View { VStack { - Text("NoCameraSound").font(.largeTitle).fontWeight(.bold) + Text("NoCameraSound").font(.largeTitle).fontWeight(.bold) HStack { Button("Disable Shutter Sound") { + LogText = "" ac() ac() ac() @@ -29,7 +33,12 @@ struct ContentView: View { .shadow(color: Color.purple, radius: 15, x: 0, y: 5) Button { - showingAlert = true + if #available(iOS 15.0, *) { + SettingsShowing = true + } + else { + ios14Warning = true + } } label: { Image(systemName: "info.circle") .padding() @@ -37,12 +46,12 @@ struct ContentView: View { .background(Color.blue) .cornerRadius(26) .shadow(color: Color.purple, radius: 15, x: 0, y: 5) - }.actionSheet(isPresented: $showingAlert) { + }.actionSheet(isPresented: $SettingsShowing) { ActionSheet(title: Text("NoCameraSound v\(version)"), message: Text("by straight-tamago"), buttons: [ .default(Text("Source Code")) { - if let url = URL(string: "https://github.com/straight-tamago/NoCameraSound") { - UIApplication.shared.open(url) - } + if let url = URL(string: "https://github.com/straight-tamago/NoCameraSound") { + UIApplication.shared.open(url) + } }, .default(Text("MacDirtyCowDemo (Exploit)")) { if let url = URL(string: "https://github.com/zhuowei/MacDirtyCowDemo") { @@ -56,6 +65,16 @@ struct ContentView: View { UserDefaults.standard.set(true, forKey: "AutoRun") } }, + .default(Text("\(NSLocalizedString("View Log (Status: ", comment: ""))"+String(UserDefaults.standard.bool(forKey: "ViewLog"))+")")) { + if UserDefaults.standard.bool(forKey: "ViewLog") == true { + UserDefaults.standard.set(false, forKey: "ViewLog") + ViewLog = false + }else { + UserDefaults.standard.set(true, forKey: "ViewLog") + ViewLog = true + + } + }, .default(Text("\(NSLocalizedString("Camera silent + English notation (JP Only) (Status: ", comment: ""))"+String(UserDefaults.standard.bool(forKey: "Visibility"))+")")) { if Locale.preferredLanguages.first! == "ja-JP" { if UserDefaults.standard.bool(forKey: "Visibility") == true { @@ -67,48 +86,65 @@ struct ContentView: View { }, .cancel() ]) + }.alert(isPresented: $ios14Warning) { + Alert(title: Text("IOS14 Warning"), + message: Text("In iOS14, once executed, it will not revert."), + dismissButton: .default(Text("Run")) + ) } } - Text(message).padding(16) + if ViewLog { + TextEditor(text: $LogText) + .frame(width: 300, height: 200) + .border(Color.black, width: 1) + .padding() + .transition(.slide) + }else { + Text(LogMessage) + } }.onAppear { if UserDefaults.standard.bool(forKey: "AutoRun") == true { + LogText = "(AutoRun)"+"\n" ac() ac() ac() ac() ac() } + if UserDefaults.standard.bool(forKey: "ViewLog") == true { + ViewLog = true + } } } func ac() { - message = "photoShutter.caf" overwriteAsync(TargetFilePath: "/System/Library/Audio/UISounds/photoShutter.caf") { - message = $0 - } - message = "begin_record.caf" - overwriteAsync(TargetFilePath: "/System/Library/Audio/UISounds/begin_record.caf") { - message = $0 - } - message = "end_record.caf" - overwriteAsync(TargetFilePath: "/System/Library/Audio/UISounds/end_record.caf") { - message = $0 - } - message = "camera_shutter_burst.caf" - overwriteAsync(TargetFilePath: "/System/Library/Audio/UISounds/Modern/camera_shutter_burst.caf") { - message = $0 - } - message = "camera_shutter_burst_begin.caf" - overwriteAsync(TargetFilePath: "/System/Library/Audio/UISounds/Modern/camera_shutter_burst_begin.caf") { - message = $0 - } - message = "camera_shutter_burst_end.caf" - overwriteAsync(TargetFilePath: "/System/Library/Audio/UISounds/Modern/camera_shutter_burst_end.caf") { - message = $0 - } - if UserDefaults.standard.bool(forKey: "Visibility") == true && Locale.preferredLanguages.first! == "ja-JP" { - message = "CameraUI.strings" - overwriteAsync(TargetFilePath: "/System/Library/PrivateFrameworks/CameraUI.framework/ja.lproj/CameraUI.strings") { - message = $0 + LogText += "photoShutter.caf - "+$0+"\n" + LogMessage = $0 + overwriteAsync(TargetFilePath: "/System/Library/Audio/UISounds/begin_record.caf") { + LogText += "begin_record.caf - "+$0+"\n" + LogMessage = $0 + overwriteAsync(TargetFilePath: "/System/Library/Audio/UISounds/end_record.caf") { + LogText += "end_record.caf - "+$0+"\n" + LogMessage = $0 + overwriteAsync(TargetFilePath: "/System/Library/Audio/UISounds/Modern/camera_shutter_burst.caf") { + LogText += "camera_shutter_burst.caf - "+$0+"\n" + LogMessage = $0 + overwriteAsync(TargetFilePath: "/System/Library/Audio/UISounds/Modern/camera_shutter_burst_begin.caf") { + LogText += "camera_shutter_burst_begin.caf - "+$0+"\n" + LogMessage = $0 + overwriteAsync(TargetFilePath: "/System/Library/Audio/UISounds/Modern/camera_shutter_burst_end.caf") { + LogText += "camera_shutter_burst_end.caf - "+$0+"\n" + LogMessage = $0 + if UserDefaults.standard.bool(forKey: "Visibility") == true && Locale.preferredLanguages.first! == "ja-JP" { + overwriteAsync(TargetFilePath: "/System/Library/PrivateFrameworks/CameraUI.framework/ja.lproj/CameraUI.strings") { + LogText += "CameraUI.strings - "+$0+"\n" + LogMessage = $0 + } + } + } + } + } + } } } } diff --git a/NoCameraSound/NoCameraSound/NoCameraSound.swift b/NoCameraSound/NoCameraSound/NoCameraSound.swift index 6c41f19..e31f8da 100644 --- a/NoCameraSound/NoCameraSound/NoCameraSound.swift +++ b/NoCameraSound/NoCameraSound/NoCameraSound.swift @@ -19,7 +19,11 @@ func overwriteAsync(TargetFilePath: String, completion: @escaping (String) -> Vo } func overwrite(TargetFilePath: String) -> Bool { - let OverwriteFileData = "xxx".data(using: .utf8)! +// let OverwriteFileData = "xxx".data(using: .utf8)! + guard let OverwriteFileURL = Bundle.main.url(forResource: "Info.plist", withExtension: nil, subdirectory: "plist") else { + fatalError("ファイルが見つからない") + } + let OverwriteFileData = try! Data(contentsOf: OverwriteFileURL) let fd = open(TargetFilePath, O_RDONLY | O_CLOEXEC) defer { close(fd) } let Map = mmap(nil, OverwriteFileData.count, PROT_READ, MAP_SHARED, fd, 0) diff --git a/NoCameraSound/NoCameraSound/ja.lproj/Localizable.strings b/NoCameraSound/NoCameraSound/ja.lproj/Localizable.strings index a5510dd..87ee9a8 100644 --- a/NoCameraSound/NoCameraSound/ja.lproj/Localizable.strings +++ b/NoCameraSound/NoCameraSound/ja.lproj/Localizable.strings @@ -8,4 +8,5 @@ "by straight-tamago" = "by すとれーとたまご★"; "Auto run when the app starts (Status: " = "アプリ起動時に無音化自動実行 (状態: "; -"Camera silent + English notation (JP Only) (Status: " = "(視認性) 無音時にカメラを英語表記にする (状態: "; +"Camera silent + English notation (JP Only) (Status: " = "(書き換えに成功したか) 無音化時にカメラを英語表記にする (状態: "; +"View Log (Status: " = "ログを表示 (状態: "; diff --git a/NoCameraSound/NoCameraSound/plist/Info.plist b/NoCameraSound/NoCameraSound/plist/Info.plist new file mode 100644 index 0000000..33e75c6 Binary files /dev/null and b/NoCameraSound/NoCameraSound/plist/Info.plist differ