diff --git a/PlayCover/Services/SoundDeviceService.swift b/PlayCover/Services/SoundDeviceService.swift index e6dde41a..34723e43 100644 --- a/PlayCover/Services/SoundDeviceService.swift +++ b/PlayCover/Services/SoundDeviceService.swift @@ -3,8 +3,8 @@ // PlayCover // -import Foundation import SimplyCoreAudio +import SwiftUI class SoundDeviceService { @@ -20,18 +20,18 @@ class SoundDeviceService { if let sampleRate = device?.nominalSampleRate { if sampleRate == 48000.0 || sampleRate == 44100.0 { return } } - - for device in simplyCA.allOutputDevices { - if let sampleRate = device.nominalSampleRate { - if sampleRate == 48000.0 || sampleRate == 44100.0 { - device.isDefaultOutputDevice = true - return - } + DispatchQueue.main.async { + let alert = NSAlert() + alert.messageText = NSLocalizedString("soundAlert.messageText", comment: "") + alert.informativeText = NSLocalizedString("soundAlert.informativeText", comment: "") + alert.addButton(withTitle: NSLocalizedString("OK", comment: "")) + alert.addButton(withTitle: NSLocalizedString("Cancel", comment: "")) + alert.alertStyle = .critical + let response: NSApplication.ModalResponse = alert.runModal() + if response == NSApplication.ModalResponse.alertFirstButtonReturn { + device?.setNominalSampleRate(48000.0) + Log.shared.msg(NSLocalizedString("soundAlert.successText", comment: "")) } } - - Log.shared.msg("No device with sample rate of 48 / 44.1 ghz found! " + - "Please lower sample rate in Audio settings or connect another output audio device." + - " Otherwise crashes are possible!") } } diff --git a/PlayCover/View/AppsView.swift b/PlayCover/View/AppsView.swift index ac8947fb..d5dbb9a3 100644 --- a/PlayCover/View/AppsView.swift +++ b/PlayCover/View/AppsView.swift @@ -7,6 +7,7 @@ import Foundation import SwiftUI import Cocoa +import AppKit struct AppsView: View { @Binding public var bottomPadding: CGFloat @@ -270,9 +271,14 @@ struct ExportView: View { Installer.exportForSideloadly(ipaUrl: uif.ipaUrl!, returnCompletion: { (ipa) in DispatchQueue.main.async { ipa?.showInFinder() - NSWorkspace.shared.open([ipa!], withAppBundleIdentifier: "com.sideloadly.sideloadly", - options: NSWorkspace.LaunchOptions.withErrorPresentation, - additionalEventParamDescriptor: nil, launchIdentifiers: nil) + let configuration = NSWorkspace.OpenConfiguration() + configuration.promptsUserIfNeeded = true + let url = NSWorkspace.shared.urlForApplication(withBundleIdentifier: "com.sideloadly.sideloadly") + if url != nil { + NSWorkspace.shared.open([ipa!], withApplicationAt: url.unsafelyUnwrapped, configuration: configuration) + } else { + Log.shared.error("Could not find Sideloadly!") + } } }) } diff --git a/PlayCover/ViewModel/Log.swift b/PlayCover/ViewModel/Log.swift index d2ecaf5e..7718d8d7 100644 --- a/PlayCover/ViewModel/Log.swift +++ b/PlayCover/ViewModel/Log.swift @@ -12,7 +12,7 @@ class Log: ObservableObject { func error(_ err: Error) { DispatchQueue.main.async { - self.dialog(question: NSLocalizedString("Some error happened!", comment: ""), + self.dialog(question: NSLocalizedString("An Error Occurred!", comment: ""), text: err.localizedDescription, style: NSAlert.Style.critical) } } diff --git a/PlayCover/de.lproj/Localizable.strings b/PlayCover/de.lproj/Localizable.strings index 46a1cd21..2397eb3e 100644 --- a/PlayCover/de.lproj/Localizable.strings +++ b/PlayCover/de.lproj/Localizable.strings @@ -39,3 +39,6 @@ "This .IPA is courrupted.Try to use another .ipa" = "Diese .IPA ist beschädigt.Versuch, eine andere .ipa . zu verwenden"; "You have not performed all instructions! Please, perform all instructions in 'Settings' or watch video in pinned messages." = "Du hast nicht alle Anweisungen ausgeführt! Bitte führe alle Anweisungen unter 'Einstellungen' aus oder schau Dir das Video in den angepinnten Nachrichten an.."; "Get" = "Herunterladen"; +"soundAlert.messageText" = ""; +"soundAlert.informativeText" = ""; +"soundAlert.successText" = ""; diff --git a/PlayCover/en.lproj/Localizable.strings b/PlayCover/en.lproj/Localizable.strings index 819f6088..0f35620e 100644 --- a/PlayCover/en.lproj/Localizable.strings +++ b/PlayCover/en.lproj/Localizable.strings @@ -109,3 +109,6 @@ "It is the one you use to unlock your Mac" = "It is the one you use to unlock your Mac"; "Now, restart the Mac and all is done!" = "Now, restart the Mac and all is done!"; "Important news and announcements" = "Important news and announcements"; +"soundAlert.messageText" = "Incorrect Audio Settings Detected!"; +"soundAlert.informativeText" = "Your current output device does not have a sample rate of 48 or 44.1 KHz! Crashes may occur. Would you like to change your current output device's sample rate to 48 KHz?"; +"soundAlert.successText" = "Current output device sample rate set to 48 KHz"; diff --git a/PlayCover/es.lproj/Localizable.strings b/PlayCover/es.lproj/Localizable.strings index 70609173..6cacb69a 100644 --- a/PlayCover/es.lproj/Localizable.strings +++ b/PlayCover/es.lproj/Localizable.strings @@ -82,7 +82,6 @@ "Screen refresh rate" = "Tasa de refresco de la pantalla"; "Mouse sensivity: %.f" = "Sensibilidad del ratón: %.f"; "Settings reseted to default!" = "¡Se han restablecido los ajustes por defecto!"; -"No device with sample rate of 48 / 44.1 ghz found! Please, lower sample rate in Audio settings or connect another output audio device. Otherwise crashes possible!" = "¡No se ha encontrado ningún dispositivo con una frecuencia de muestreo de 48 / 44.1 ghz! Por favor, baje la frecuencia de muestreo en la configuración de audio o conecte otro dispositivo de salida de audio. De lo contrario, puede que se produzcan errores!"; "Copy logs" = "Copiar logs"; "Notices" = "Notificaciones"; "Having problems logging into apps?" = "¿Tienes problemas para iniciar sesión en las aplicaciones?"; @@ -90,3 +89,6 @@ "If you encounter any errors, restart and repeat the whole process again" = "Si encuentra algún error, reinicie y repita el proceso de nuevo"; "Please, wait current install to finish!" = "Por favor, espere a que la instalación termine!"; "You'll receive ban on this PlayCover version! Call of Duty supported on 0.9.2-0.9.4. PUBG requires higher PlayCover version. Free Fire status is not confirmed. There is one message of ban." = "Su cuenta sera banneada si utiliza esta versión de PlayCover! Call of duty funciona correctamente en las versiones 0.9.2-0.9.4. Mientas que PUBG requiere una versión más reciente. Sobre Free Fire aún no tenemos datos suficientes sin embargo hay una prueba de banneo"; +"soundAlert.messageText" = ""; +"soundAlert.informativeText" = ""; +"soundAlert.successText" = ""; diff --git a/PlayCover/fr.lproj/Localizable.strings b/PlayCover/fr.lproj/Localizable.strings index 1326dd3d..c3b6b9c8 100644 --- a/PlayCover/fr.lproj/Localizable.strings +++ b/PlayCover/fr.lproj/Localizable.strings @@ -91,3 +91,6 @@ "If you encounter any errors, restart and repeat the whole process again" = "Si vous avez des erreurs, redémarrez et répétez le processus encore une fois."; "Please, wait current install to finish!" = "Veuillez attendre que l'installation se termine!"; "You'll receive ban on this PlayCover version! Call of Duty supported on 0.9.2-0.9.4. PUBG requires higher PlayCover version. Free Fire status is not confirmed. There is one message of ban." = "Vous risquez d'être banni sur cette version de PlayCover! Call of Duty est supporté sur les versions 0.9.2-0.9.4. PUBG requiert une version plus récente. Free Fire n'est pas encore confirmé. Il y a un message de ban."; +"soundAlert.messageText" = "Paramètres Audio Incorrects Détectés!"; +"soundAlert.informativeText" = "Votre sortie audio actuelle n'a pas un taux d'échantillonnage de 48 ou 44.1 KHz! Des erreurs peuvent survenir. Voulez-vous changer le taux d'échantillonnage de votre sortie audio actuelle à 48 KHz?"; +"soundAlert.successText" = "Définir le taux d'échantillonnage de votre sortie audio à 48 KHz"; diff --git a/PlayCover/id.lproj/Localizable.strings b/PlayCover/id.lproj/Localizable.strings index abf7b2a0..030b9613 100644 --- a/PlayCover/id.lproj/Localizable.strings +++ b/PlayCover/id.lproj/Localizable.strings @@ -38,3 +38,6 @@ "Make sure you don't disallowed PlayCover to access files in Settings - Secuirity & Privacy" = "Pastikan sudah memberikan ijin akses file untuk Playcover pada Settings - Security & Privacy"; "This .IPA is courrupted.Try to use another .ipa" = ".IPA rusak. Coba gunakan .ipa lain"; "You have not performed all instructions! Please, perform all instructions in 'Settings' or watch video in pinned messages." = "Kamu belum mengikuti semua instruksi, tolong ikuti semua instruksi dengan benar pada 'Settings' atau tonton video tutorial yang kami pin"; +"soundAlert.messageText" = ""; +"soundAlert.informativeText" = ""; +"soundAlert.successText" = ""; diff --git a/PlayCover/it.lproj/Localizable.strings b/PlayCover/it.lproj/Localizable.strings index fd46ff5b..2b0b7471 100644 --- a/PlayCover/it.lproj/Localizable.strings +++ b/PlayCover/it.lproj/Localizable.strings @@ -41,4 +41,6 @@ "To do this you need to reboot, enter into Recovery mode, open Terminal and type" = "Per fare questo hai bisogno di riavviare, entrare in Recovery mode, aprire il Terminale e scrivere"; "App is installed!" = "App installata!"; "Please, check it out in 'My Apps'" = "Per favore, controlla in 'Le mie Apps'"; - +"soundAlert.messageText" = ""; +"soundAlert.informativeText" = ""; +"soundAlert.successText" = ""; diff --git a/PlayCover/ja.lproj/Localizable.strings b/PlayCover/ja.lproj/Localizable.strings index 83393b81..21455d93 100644 --- a/PlayCover/ja.lproj/Localizable.strings +++ b/PlayCover/ja.lproj/Localizable.strings @@ -38,3 +38,6 @@ "Make sure you don't disallowed PlayCover to access files in Settings - Security & Privacy" = "PlayCoverにファイルのアクセスが許可されているか 設定ーセキュリティとプライバシーで確認してください"; "This .IPA is courrupted.Try to use another .ipa" = "この.ipaファイルは壊れています。他の.ipaファイルを使ってみてください。"; "You not performed all instructions! Please, perform all instructions in 'Settings' or watch video in pinned messages." = "マニュアルのすべてのステップが実行されていません。設定にある説明ステップをすべて実行してください。またはディスコードの固定メッセージの動画を観てください。"; +"soundAlert.messageText" = ""; +"soundAlert.informativeText" = ""; +"soundAlert.successText" = ""; diff --git a/PlayCover/ko.lproj/Localizable.strings b/PlayCover/ko.lproj/Localizable.strings index 08f28a9c..6445de59 100644 --- a/PlayCover/ko.lproj/Localizable.strings +++ b/PlayCover/ko.lproj/Localizable.strings @@ -38,3 +38,6 @@ "Make sure you don't disallowed PlayCover to access files in Settings - Secuirity & Privacy" = "설정 - 보안 및 개인 정보 보호 에서 PlayCover의 파일 엑세스 권한을 막지 않았는지 확인해주세요."; "This .IPA is courrupted.Try to use another .ipa" = "이 .ipa 파일은 손상되었습니다. 다른 .ipa 파일을 사용해 주세요."; "You not performed all instructions! Please, perform all instructions in 'Settings' or watch video in pinned messages." = "이 시스템은 설치 가이드를 모두 수행하지 않았습니다! '설정' 탭에 있는 가이드를 보거나, 고정된 메세지의 비디오를 확인 후 모두 수행해 주세요."; +"soundAlert.messageText" = ""; +"soundAlert.informativeText" = ""; +"soundAlert.successText" = ""; diff --git a/PlayCover/ru.lproj/Localizable.strings b/PlayCover/ru.lproj/Localizable.strings index 5253fc4c..58761e6c 100644 --- a/PlayCover/ru.lproj/Localizable.strings +++ b/PlayCover/ru.lproj/Localizable.strings @@ -39,3 +39,6 @@ "You have not performed all instructions! Please, perform all instructions in 'Settings' or watch video in pinned messages." = "Вы не выполнили все инструкции! Пожалуйста, выполните все инструкции в “Настройках” или посмотрите видео в закрепленных сообщениях."; "Get" = "Скачать"; "To do this you need to reboot, enter into Recovery mode, open Terminal and type" = "Чтобы это сделать, перейдите в режим восстановления, откройте Терминал и введите"; +"soundAlert.messageText" = ""; +"soundAlert.informativeText" = ""; +"soundAlert.successText" = ""; diff --git a/PlayCover/vi.lproj/Localizable.strings b/PlayCover/vi.lproj/Localizable.strings index d892923c..35d4e83e 100644 --- a/PlayCover/vi.lproj/Localizable.strings +++ b/PlayCover/vi.lproj/Localizable.strings @@ -41,4 +41,6 @@ "To do this you need to reboot, enter into Recovery mode, open Terminal and type" = "Để thực hiện bước này, khởi động máy Mac của bạn vào chế độ Phục hồi, mở Terminal và gõ"; "App is installed!" = "Ứng dụng đã được cài đặt!"; "Please, check it out in 'My Apps'" = "Vui lòng kiểm tra tại 'Ứng dụng của tôi'"; - +"soundAlert.messageText" = ""; +"soundAlert.informativeText" = ""; +"soundAlert.successText" = ""; diff --git a/PlayCover/zh-Hans.lproj/Localizable.strings b/PlayCover/zh-Hans.lproj/Localizable.strings index c0e0a0dd..3b5ca637 100644 --- a/PlayCover/zh-Hans.lproj/Localizable.strings +++ b/PlayCover/zh-Hans.lproj/Localizable.strings @@ -82,9 +82,11 @@ "Reset settings and keymapping" = "恢复默认设置"; "Settings reseted to default!" = "已重置设置到默认值!"; "Ok" = "OK"; -"No device with sample rate of 48 / 44.1 ghz found! Please, lower sample rate in Audio settings or connect another output audio device. Otherwise crashes possible!" = "No device with sample rate of 48 / 44.1 ghz found! Please, lower sample rate in Audio settings or connect another output audio device. Otherwise crashes possible!"; "Copy logs" = "拷贝日志"; "Notices" = "注意事项"; "PlayCover must be inside Applications folder. Press button to move it." = "PlayCover 必须被放入“应用程序”文件夹中。按下按钮以移动。"; "Please, wait current install to finish!" = "请等待当前应用安装完成!"; "You'll receive ban on this PlayCover version! Call of Duty supported on 0.9.2-0.9.4. PUBG requires higher PlayCover version. Free Fire status is not confirmed. There is one message of ban." = "You'll receive ban on this PlayCover version! Call of Duty supported on 0.9.2-0.9.4. PUBG requires higher PlayCover version. Free Fire status is not confirmed. There is one message of ban."; +"soundAlert.messageText" = ""; +"soundAlert.informativeText" = ""; +"soundAlert.successText" = "";