Repo // Change the buzz() trigger with certain NSAlert instances.

This commit is contained in:
ShikiSuen 2022-10-24 15:17:07 +08:00
parent 3ca7410316
commit d263719e64
3 changed files with 3 additions and 3 deletions

View File

@ -230,6 +230,7 @@ extension SessionCtl {
resetInputHandler()
if !PrefMgr.shared.cassetteEnabled, !LMMgr.checkCassettePathValidity(PrefMgr.shared.cassettePath) {
DispatchQueue.main.async {
IMEApp.buzz()
let alert = NSAlert(error: NSLocalizedString("Path invalid or file access error.", comment: ""))
alert.informativeText = NSLocalizedString(
"Please reconfigure the cassette path to a valid one before enabling this mode.", comment: ""
@ -240,7 +241,6 @@ extension SessionCtl {
PrefMgr.shared.cassetteEnabled = false
}
NSApp.setActivationPolicy(.accessory)
IMEApp.buzz()
}
return
}

View File

@ -109,6 +109,7 @@ struct VwrPrefPaneCassette: View {
isOn: $selCassetteEnabled.onChange {
if selCassetteEnabled, !LMMgr.checkCassettePathValidity(PrefMgr.shared.cassettePath) {
if let window = CtlPrefUI.shared.controller.window {
IMEApp.buzz()
let alert = NSAlert(error: NSLocalizedString("Path invalid or file access error.", comment: ""))
alert.informativeText = NSLocalizedString(
"Please reconfigure the cassette path to a valid one before enabling this mode.", comment: ""
@ -118,7 +119,6 @@ struct VwrPrefPaneCassette: View {
PrefMgr.shared.cassetteEnabled = false
selCassetteEnabled = false
}
IMEApp.buzz()
}
} else {
PrefMgr.shared.cassetteEnabled = selCassetteEnabled

View File

@ -283,6 +283,7 @@ class CtlPrefWindow: NSWindowController {
@IBAction func onToggleCassetteMode(_: Any) {
if PrefMgr.shared.cassetteEnabled, !LMMgr.checkCassettePathValidity(PrefMgr.shared.cassettePath) {
if let window = window {
IMEApp.buzz()
let alert = NSAlert(error: NSLocalizedString("Path invalid or file access error.", comment: ""))
alert.informativeText = NSLocalizedString(
"Please reconfigure the cassette path to a valid one before enabling this mode.", comment: ""
@ -291,7 +292,6 @@ class CtlPrefWindow: NSWindowController {
LMMgr.resetCassettePath()
PrefMgr.shared.cassetteEnabled = false
}
IMEApp.buzz()
}
} else {
LMMgr.loadCassetteData()