Commit 5328402b authored by Aral Balkan's avatar Aral Balkan

Added VoiceOverStatus.

parent 0301ff0a
......@@ -49,6 +49,7 @@
A78DAE921A817000009FDB15 /* blackUnderlineTemplate@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A78DAE911A817000009FDB15 /* blackUnderlineTemplate@2x.png */; };
A78DAE941A82320B009FDB15 /* SetupHandleTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = A78DAE931A82320B009FDB15 /* SetupHandleTextField.swift */; };
A79C8B8A1A8CC7F300F1948A /* NSNotificationCenterExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A79C8B891A8CC7F300F1948A /* NSNotificationCenterExtensions.swift */; };
A79C8B951A8CDF3300F1948A /* VoiceOverStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = A79C8B941A8CDF3300F1948A /* VoiceOverStatus.swift */; };
A7A14C631A82560000586EAD /* StepOneView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7A14C621A82560000586EAD /* StepOneView.swift */; };
A7A14C651A8277C300586EAD /* SetupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7A14C641A8277C300586EAD /* SetupView.swift */; };
A7A14C691A83A9C100586EAD /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A7A14C6B1A83A9C100586EAD /* InfoPlist.strings */; };
......@@ -142,6 +143,7 @@
A78DAE911A817000009FDB15 /* blackUnderlineTemplate@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "blackUnderlineTemplate@2x.png"; sourceTree = "<group>"; };
A78DAE931A82320B009FDB15 /* SetupHandleTextField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SetupHandleTextField.swift; sourceTree = "<group>"; };
A79C8B891A8CC7F300F1948A /* NSNotificationCenterExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSNotificationCenterExtensions.swift; sourceTree = "<group>"; };
A79C8B941A8CDF3300F1948A /* VoiceOverStatus.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VoiceOverStatus.swift; sourceTree = "<group>"; };
A7A14C621A82560000586EAD /* StepOneView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StepOneView.swift; sourceTree = "<group>"; };
A7A14C641A8277C300586EAD /* SetupView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SetupView.swift; sourceTree = "<group>"; };
A7A14C661A83A43900586EAD /* tr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = tr; path = tr.lproj/Main.strings; sourceTree = "<group>"; };
......@@ -374,6 +376,7 @@
A78DAE781A7FCA46009FDB15 /* Libraries — Objective C */ = {
isa = PBXGroup;
children = (
A79C8B931A8CDEF600F1948A /* source.ind.ie */,
A7A14C761A83FBA600586EAD /* github.com/damienromito/NSString-Matcher */,
A78DAE7A1A7FCA60009FDB15 /* NoodleCustomImageRep.h */,
A78DAE7B1A7FCA60009FDB15 /* NoodleCustomImageRep.m */,
......@@ -393,6 +396,15 @@
name = "Images for testing";
sourceTree = "<group>";
};
A79C8B931A8CDEF600F1948A /* source.ind.ie */ = {
isa = PBXGroup;
children = (
A79C8B891A8CC7F300F1948A /* NSNotificationCenterExtensions.swift */,
A79C8B941A8CDF3300F1948A /* VoiceOverStatus.swift */,
);
name = source.ind.ie;
sourceTree = "<group>";
};
A7A14C761A83FBA600586EAD /* github.com/damienromito/NSString-Matcher */ = {
isa = PBXGroup;
children = (
......@@ -407,7 +419,6 @@
children = (
A74CC65F1A668A6E0083B288 /* Helpers */,
A74C9EEA1A6688880083B288 /* Communication */,
A7E7D7D41A616B85003501C1 /* Extensions */,
A7E7D7AC1A616AE1003501C1 /* User interface */,
);
name = Classes;
......@@ -494,14 +505,6 @@
name = Placeholder;
sourceTree = "<group>";
};
A7E7D7D41A616B85003501C1 /* Extensions */ = {
isa = PBXGroup;
children = (
A79C8B891A8CC7F300F1948A /* NSNotificationCenterExtensions.swift */,
);
name = Extensions;
sourceTree = "<group>";
};
A7EF9AFC1A6167CC004009E1 /* Storyboards */ = {
isa = PBXGroup;
children = (
......@@ -684,6 +687,7 @@
A79C8B8A1A8CC7F300F1948A /* NSNotificationCenterExtensions.swift in Sources */,
A70634B81A63112600A75BC0 /* SetupStepViewController.swift in Sources */,
A74C9EEF1A6688D30083B288 /* Websocket.swift in Sources */,
A79C8B951A8CDF3300F1948A /* VoiceOverStatus.swift in Sources */,
A74C9EE91A65B55C0083B288 /* PreferencesKeyboardShortcutsViewController.swift in Sources */,
A78DAE761A7FC9BE009FDB15 /* ProfileImageComponentViewController.swift in Sources */,
A7E7D7BB1A616B1E003501C1 /* ConversationsViewController.swift in Sources */,
......
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Voice Over Status and Detection
// ===============================
//
// Enables VoiceOver status to be queried and observed on OS X.
//
// Usage:
// ------
//
// * For updates, listen to the NSAccessibilityVoiceOverStatusChanged notification.
// The userInfo dictionary will have the current status in the IsVoiceOverRunning key.
//
// * You can also call the NSAccessibilityIsVoiceOverRunning() function to get the
// current status of VoiceOver.
//
// (These mirror the UIAccessibilityVoiceOverStatusChanged notification
// and UIAccessibilityIsVoiceOverRunning() function on iOS.)
//
// Copyright © 2015 Aral Balkan. Released with ♥ by Ind.ie under the MIT License.
//
////////////////////////////////////////////////////////////////////////////////////////////////////
import Cocoa
// MARK: - Public API
public let NSAccessibilityVoiceOverStatusChanged:String = "NSAccessibilityVoiceOverStatusChanged"
public let IsVoiceOverRunning:String = "IsVoiceOverRunning"
public func NSAccessibilityIsVoiceOverRunning() -> Bool
{
return VoiceOver.isRunning
}
// MARK: - Internal
struct VoiceOver
{
// We can default to false as the app will receive an initial notification if VoiceOver is on.
// (And no notification, leaving it in the false state, if not.)
static var isRunning:Bool = false
}
// MARK: - Extension
extension NSApplication
{
override public func accessibilitySetValue(value: AnyObject?, forAttribute attribute: String)
{
if attribute == "AXEnhancedUserInterface"
{
if let value = value as? Int
{
VoiceOver.isRunning = (value == 1)
NSNotificationCenter.defaultCenter().postNotificationName(NSAccessibilityVoiceOverStatusChanged, object: self, userInfo: [IsVoiceOverRunning:VoiceOver.isRunning])
}
}
super.accessibilitySetOverrideValue(value, forAttribute: attribute)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment