1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-02-01 19:14:35 +02:00

Gh 2062 mac error sound (#2074)

* Fix #2062. Prevent funk error sound in Mac App.

* Update header
This commit is contained in:
Chen-I Lim 2022-01-07 14:30:18 -08:00 committed by GitHub
parent 155bf75718
commit e6b286f056
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 5 deletions

View File

@ -17,6 +17,7 @@
80D6DED9252E13CD00AEED9E /* FocalboardUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80D6DED8252E13CD00AEED9E /* FocalboardUITests.swift */; };
80D6DEEA252E15D100AEED9E /* resources in Resources */ = {isa = PBXBuildFile; fileRef = 80D6DEE9252E15D100AEED9E /* resources */; };
80D6DF18252F9BDE00AEED9E /* AutoSaveWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80D6DF17252F9BDE00AEED9E /* AutoSaveWindowController.swift */; };
80F174B72788C1A2000A9EEA /* CustomWKWebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80F174B62788C1A2000A9EEA /* CustomWKWebView.swift */; };
80F8BF502624E1BB00FF3943 /* WhatsNewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80F8BF4F2624E1BB00FF3943 /* WhatsNewViewController.swift */; };
80F8BF582624EB0C00FF3943 /* Globals.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80F8BF572624EB0C00FF3943 /* Globals.swift */; };
/* End PBXBuildFile section */
@ -57,6 +58,7 @@
80D6DEE9252E15D100AEED9E /* resources */ = {isa = PBXFileReference; lastKnownFileType = folder; path = resources; sourceTree = "<group>"; };
80D6DF17252F9BDE00AEED9E /* AutoSaveWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoSaveWindowController.swift; sourceTree = "<group>"; };
80D6DF1C25324A4F00AEED9E /* Inherit.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Inherit.entitlements; sourceTree = "<group>"; };
80F174B62788C1A2000A9EEA /* CustomWKWebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomWKWebView.swift; sourceTree = "<group>"; };
80F8BF4F2624E1BB00FF3943 /* WhatsNewViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WhatsNewViewController.swift; sourceTree = "<group>"; };
80F8BF572624EB0C00FF3943 /* Globals.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Globals.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
@ -114,6 +116,7 @@
80F8BF572624EB0C00FF3943 /* Globals.swift */,
8014951B261598D600A51700 /* PortUtils.swift */,
80D6DEBC252E13CB00AEED9E /* ViewController.swift */,
80F174B62788C1A2000A9EEA /* CustomWKWebView.swift */,
80F8BF4F2624E1BB00FF3943 /* WhatsNewViewController.swift */,
804E57FB27441B6B008526F0 /* whatsnew.txt */,
80D6DF17252F9BDE00AEED9E /* AutoSaveWindowController.swift */,
@ -298,6 +301,7 @@
files = (
8014951C261598D600A51700 /* PortUtils.swift in Sources */,
80F8BF502624E1BB00FF3943 /* WhatsNewViewController.swift in Sources */,
80F174B72788C1A2000A9EEA /* CustomWKWebView.swift in Sources */,
80F8BF582624EB0C00FF3943 /* Globals.swift in Sources */,
80D6DF18252F9BDE00AEED9E /* AutoSaveWindowController.swift in Sources */,
80D6DEBD252E13CB00AEED9E /* ViewController.swift in Sources */,

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="19529" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18122"/>
<plugIn identifier="com.apple.WebKit2IBPlugin" version="18122"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="19529"/>
<plugIn identifier="com.apple.WebKit2IBPlugin" version="19529"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
@ -685,7 +685,7 @@
<rect key="frame" x="0.0" y="0.0" width="1000" height="600"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<wkWebView wantsLayer="YES" translatesAutoresizingMaskIntoConstraints="NO" id="7ZQ-vZ-SCO">
<wkWebView wantsLayer="YES" translatesAutoresizingMaskIntoConstraints="NO" id="7ZQ-vZ-SCO" customClass="CustomWKWebView" customModule="Focalboard" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="1000" height="600"/>
<wkWebViewConfiguration key="configuration">
<audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>

View File

@ -0,0 +1,19 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import Foundation
import WebKit
class CustomWKWebView : WKWebView {
override func performKeyEquivalent(with event: NSEvent) -> Bool {
if (event.modifierFlags.contains(.command) && event.characters?.lowercased() != "z") ||
event.modifierFlags.contains(.control) ||
event.modifierFlags.contains(.option) {
return super.performKeyEquivalent(with: event)
}
super.performKeyEquivalent(with: event)
// Return true to prevent a "funk" error sound
return true
}
}

View File

@ -9,7 +9,7 @@ class ViewController:
WKUIDelegate,
WKNavigationDelegate,
WKScriptMessageHandler {
@IBOutlet var webView: WKWebView!
@IBOutlet var webView: CustomWKWebView!
private var didLoad = false
private var refreshWebViewOnLoad = true