diff --git a/Example/Podfile b/Example/Podfile index a24d42b..4b4a79b 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -7,8 +7,8 @@ target 'Example-iOS' do use_frameworks! sharedPods - pod 'SheetyColors' - pod 'AppCenter/Analytics', '1.14.0' + pod 'SheetyColors', '1.0.0' + pod 'AppCenter/Analytics' pod 'Fabric' pod 'Answers' pod 'Firebase/Core' diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 5674c29..67758ed 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,9 +1,9 @@ PODS: - - Answers (1.4.0): - - Fabric (~> 1.8.0) - - AppCenter/Analytics (1.14.0): + - Answers (1.4.1): + - Fabric (~> 1.10.2) + - AppCenter/Analytics (2.4.0): - AppCenter/Core - - AppCenter/Core (1.14.0) + - AppCenter/Core (2.4.0) - Capable (1.0.1): - Capable/Colors (= 1.0.1) - Capable/Features (= 1.0.1) @@ -11,67 +11,79 @@ PODS: - Capable/Colors (1.0.1) - Capable/Features (1.0.1) - Capable/Fonts (1.0.1) - - Fabric (1.8.2) - - Firebase/Core (6.1.0): + - Fabric (1.10.2) + - Firebase/Core (6.9.0): - Firebase/CoreOnly - - FirebaseAnalytics (= 6.0.1) - - Firebase/CoreOnly (6.1.0): - - FirebaseCore (= 6.0.1) - - FirebaseAnalytics (6.0.1): - - FirebaseCore (~> 6.0) - - FirebaseInstanceID (~> 4.1) - - GoogleAppMeasurement (= 6.0.1) + - FirebaseAnalytics (= 6.1.2) + - Firebase/CoreOnly (6.9.0): + - FirebaseCore (= 6.3.0) + - FirebaseAnalytics (6.1.2): + - FirebaseCore (~> 6.3) + - FirebaseInstanceID (~> 4.2) + - GoogleAppMeasurement (= 6.1.2) - GoogleUtilities/AppDelegateSwizzler (~> 6.0) - GoogleUtilities/MethodSwizzler (~> 6.0) - GoogleUtilities/Network (~> 6.0) - "GoogleUtilities/NSData+zlib (~> 6.0)" - nanopb (~> 0.3) - - FirebaseCore (6.0.1): - - GoogleUtilities/Environment (~> 6.0) - - GoogleUtilities/Logger (~> 6.0) - - FirebaseInstanceID (4.1.0): + - FirebaseCore (6.3.0): + - FirebaseCoreDiagnostics (~> 1.0) + - FirebaseCoreDiagnosticsInterop (~> 1.0) + - GoogleUtilities/Environment (~> 6.2) + - GoogleUtilities/Logger (~> 6.2) + - FirebaseCoreDiagnostics (1.1.0): + - FirebaseCoreDiagnosticsInterop (~> 1.0) + - GoogleDataTransportCCTSupport (~> 1.0) + - GoogleUtilities/Environment (~> 6.2) + - GoogleUtilities/Logger (~> 6.2) + - FirebaseCoreDiagnosticsInterop (1.0.0) + - FirebaseInstanceID (4.2.5): - FirebaseCore (~> 6.0) - GoogleUtilities/Environment (~> 6.0) - GoogleUtilities/UserDefaults (~> 6.0) - - GoogleAppMeasurement (6.0.1): + - GoogleAppMeasurement (6.1.2): - GoogleUtilities/AppDelegateSwizzler (~> 6.0) - GoogleUtilities/MethodSwizzler (~> 6.0) - GoogleUtilities/Network (~> 6.0) - "GoogleUtilities/NSData+zlib (~> 6.0)" - nanopb (~> 0.3) - - GoogleUtilities/AppDelegateSwizzler (6.2.0): + - GoogleDataTransport (2.0.0) + - GoogleDataTransportCCTSupport (1.1.0): + - GoogleDataTransport (~> 2.0) + - nanopb + - GoogleUtilities/AppDelegateSwizzler (6.3.1): - GoogleUtilities/Environment - GoogleUtilities/Logger - GoogleUtilities/Network - - GoogleUtilities/Environment (6.2.0) - - GoogleUtilities/Logger (6.2.0): + - GoogleUtilities/Environment (6.3.1) + - GoogleUtilities/Logger (6.3.1): - GoogleUtilities/Environment - - GoogleUtilities/MethodSwizzler (6.2.0): + - GoogleUtilities/MethodSwizzler (6.3.1): - GoogleUtilities/Logger - - GoogleUtilities/Network (6.2.0): + - GoogleUtilities/Network (6.3.1): - GoogleUtilities/Logger - "GoogleUtilities/NSData+zlib" - GoogleUtilities/Reachability - - "GoogleUtilities/NSData+zlib (6.2.0)" - - GoogleUtilities/Reachability (6.2.0): + - "GoogleUtilities/NSData+zlib (6.3.1)" + - GoogleUtilities/Reachability (6.3.1): - GoogleUtilities/Logger - - GoogleUtilities/UserDefaults (6.2.0): + - GoogleUtilities/UserDefaults (6.3.1): - GoogleUtilities/Logger - nanopb (0.3.901): - nanopb/decode (= 0.3.901) - nanopb/encode (= 0.3.901) - nanopb/decode (0.3.901) - nanopb/encode (0.3.901) - - SheetyColors (0.3.1): + - SheetyColors (1.0.0): - Capable/Colors (~> 1.0.0) DEPENDENCIES: - Answers - - AppCenter/Analytics (= 1.14.0) + - AppCenter/Analytics - Capable (from `../`) - Fabric - Firebase/Core - - SheetyColors + - SheetyColors (= 1.0.0) SPEC REPOS: https://github.com/cocoapods/specs.git: @@ -81,8 +93,12 @@ SPEC REPOS: - Firebase - FirebaseAnalytics - FirebaseCore + - FirebaseCoreDiagnostics + - FirebaseCoreDiagnosticsInterop - FirebaseInstanceID - GoogleAppMeasurement + - GoogleDataTransport + - GoogleDataTransportCCTSupport - GoogleUtilities - nanopb - SheetyColors @@ -92,19 +108,23 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - Answers: e7317ccd30e7bf55c3bacfe28adbe2304b082e49 - AppCenter: 02c5efe08d3bbab5421ae41d5f7aa7238906b817 + Answers: 7d5ff1f77fea900eb75032b37b4288482b824055 + AppCenter: 49a9ffe114c00e2bf5374aeda816d47eabf1978a Capable: 49d8637d06ee50dac258757071ea27cbce0e1bf6 - Fabric: d2b22f443ba195d8a7cc204da230977c72733b40 - Firebase: 8d77bb33624ae9b62d745d82ec023de5f70f7e4f - FirebaseAnalytics: 629301c2b9925f3537d4093a17a72751ae5b7084 - FirebaseCore: 66bdef3b310a026880e2a5bc8aa586ab62ce4543 - FirebaseInstanceID: 27bed93a59b6685f5c3e0c028a878a764fd75c33 - GoogleAppMeasurement: 51d8d9ea48f0ca44484d29cfbdef976fbd4fc336 - GoogleUtilities: 996e0db07153674fd1b54b220fda3a3dc3547cba + Fabric: 706c8b8098fff96c33c0db69cbf81f9c551d0d74 + Firebase: 2d750c54cda57d5a6ae31212cfe5cc813c6be7e4 + FirebaseAnalytics: 5d9ccbf46ed25d3ec9304d263f85bddf1e93e2d2 + FirebaseCore: 8b2765c445d40db7137989b7146a3aa3f91b5529 + FirebaseCoreDiagnostics: be4f7a09d02ab305f18de59a470412caddb64c2a + FirebaseCoreDiagnosticsInterop: 6829da2b8d1fc795ff1bd99df751d3788035d2cb + FirebaseInstanceID: 550df9be1f99f751d8fcde3ac342a1e21a0e6c42 + GoogleAppMeasurement: 0ae90be1cc4dad40f4a27fc767ef59fa032ec87b + GoogleDataTransport: c8617c00e4f3eb9418e42ac0e8ac5241a9d555dd + GoogleDataTransportCCTSupport: 9f352523e8785a71f6754f51eeff09f49ec19268 + GoogleUtilities: f895fde57977df4e0233edda0dbeac490e3703b6 nanopb: 2901f78ea1b7b4015c860c2fdd1ea2fee1a18d48 - SheetyColors: 71fc251618928f399503138093229e3ea700b35f + SheetyColors: dbf4b6b427d10f0316a2237b8a00cd8d576466dd -PODFILE CHECKSUM: b6b60cbce08e7b88bb2acc2c5dee948795b58baf +PODFILE CHECKSUM: 281f4c067013ef97112498d527050bb7d1b70f3b COCOAPODS: 1.7.5 diff --git a/Example/Source/iOS/Base.lproj/Main.storyboard b/Example/Source/iOS/Base.lproj/Main.storyboard index 2d16280..a9a5f92 100644 --- a/Example/Source/iOS/Base.lproj/Main.storyboard +++ b/Example/Source/iOS/Base.lproj/Main.storyboard @@ -1,11 +1,9 @@ - - - - + + - + @@ -36,8 +34,8 @@ - - + + @@ -58,21 +56,21 @@ - + - + - + @@ -385,8 +382,8 @@ - - + + @@ -405,12 +402,11 @@ - - - + + - + @@ -510,7 +506,7 @@ - + @@ -519,6 +515,7 @@ + @@ -527,7 +524,7 @@ - + diff --git a/Package.swift b/Package.swift index aa8d372..f87ff13 100644 --- a/Package.swift +++ b/Package.swift @@ -9,8 +9,8 @@ let package = Package( targets: ["Capable"]) ], dependencies: [ - .package(url: "https://github.com/Quick/Quick.git", from: "1.0.0"), - .package(url: "https://github.com/Quick/Nimble.git", from: "7.0.0") + .package(url: "https://github.com/Quick/Quick.git", from: "2.1.0"), + .package(url: "https://github.com/Quick/Nimble.git", from: "8.0.2") ], targets: [ .target( diff --git a/README.md b/README.md index c773ba8..4d20b60 100644 --- a/README.md +++ b/README.md @@ -387,7 +387,7 @@ The following table contains all features that are available AND settable on eac | .boldText | :white_check_mark: | | :white_check_mark: |  :white_check_mark:**\*** | | .closedCaptioning | :white_check_mark: | | :white_check_mark: | | | .darkerSystemColors | :white_check_mark: | | | | -| .differentiateWithoutColor | | :white_check_mark: | | | +| .differentiateWithoutColor | :white_check_mark: | :white_check_mark: | | | | .fullKeyboardAccess | |  :white_check_mark:**\*** | | | | .grayscale | :white_check_mark: | | :white_check_mark: | | | .guidedAccess | :white_check_mark: | | | | @@ -396,12 +396,14 @@ The following table contains all features that are available AND settable on eac | .invertColors | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | .largerText | :white_check_mark: | | |  :white_check_mark:**\*** | | .monoAudio | :white_check_mark: | | :white_check_mark: | | +| .onOffSwitchLabels | :white_check_mark: | | | | | .reduceMotion | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | .reduceTransparency | :white_check_mark: | :white_check_mark: | :white_check_mark: | | | .shakeToUndo | :white_check_mark: | | | | | .speakScreen | :white_check_mark: | | | | | .speakSelection | :white_check_mark: | | | | | .switchControl | :white_check_mark: | :white_check_mark: | :white_check_mark: | | +| .videoAutoplay | :white_check_mark: | | :white_check_mark: | | | .voiceOver | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | *\* Feature status can be read but notifications are not available.* diff --git a/Source/Features/Models/CapableFeature.swift b/Source/Features/Models/CapableFeature.swift index 8ef1404..52f87b7 100644 --- a/Source/Features/Models/CapableFeature.swift +++ b/Source/Features/Models/CapableFeature.swift @@ -22,6 +22,9 @@ public enum CapableFeature: String, CaseIterable { /// Pairing status of a hearing aid. case hearingDevice + /// Displays on/off labels for UISwitch controls. + case onOffSwitchLabels + /// Deletes the last command by shaking the phone. case shakeToUndo @@ -35,9 +38,6 @@ public enum CapableFeature: String, CaseIterable { #if os(OSX) - /// Helps color blind users to differentiate settings differently, e.g. by using shapes rather than colors. - case differentiateWithoutColor - /// Enables users to navigate through items of the screen without having to use a mouse. case fullKeyboardAccess @@ -57,6 +57,9 @@ public enum CapableFeature: String, CaseIterable { /// Merges stereo audio channels to help users that are hard of hearing or deaf in one ear. case monoAudio + /// Allows users who are sensitive to motion to disable automatic video playback. + case videoAutoplay + #endif #if os(iOS) || os(watchOS) @@ -66,6 +69,13 @@ public enum CapableFeature: String, CaseIterable { #endif + #if os(iOS) || os(OSX) + + /// Helps color blind users to differentiate settings differently, e.g. by using shapes rather than colors. + case differentiateWithoutColor + + #endif + #if os(iOS) || os(tvOS) || os(OSX) /// Helps people with low vision, color blindness, or sensitivity to brightness to read the display content. diff --git a/Source/Features/Notifications/Notifications.swift b/Source/Features/Notifications/Notifications.swift index f4ea554..3f1624b 100644 --- a/Source/Features/Notifications/Notifications.swift +++ b/Source/Features/Notifications/Notifications.swift @@ -69,6 +69,11 @@ extension Notifications { if features.contains(.darkerSystemColors) { addObserver(forNotification: UIAccessibility.darkerSystemColorsStatusDidChangeNotification, selector: #selector(self.darkerSystemColorsStatusChanged)) } + if features.contains(.differentiateWithoutColor) { + if #available(iOS 13.0, *) { + addObserver(forNotification: NSNotification.Name(rawValue: UIAccessibility.differentiateWithoutColorDidChangeNotification), selector: #selector(self.differentiateWithoutColorStatusChanged)) + } + } if features.contains(.guidedAccess) { addObserver(forNotification: UIAccessibility.guidedAccessStatusDidChangeNotification, selector: #selector(self.guidedAccessStatusChanged)) } @@ -78,6 +83,11 @@ extension Notifications { if features.contains(.largerText) { addObserver(forNotification: UIContentSizeCategory.didChangeNotification, selector: #selector(self.largerTextStatusChanged)) } + if features.contains(.onOffSwitchLabels) { + if #available(iOS 13.0, *) { + addObserver(forNotification: UIAccessibility.onOffSwitchLabelsDidChangeNotification, selector: #selector(self.onOffSwitchLabelsStatusChanged)) + } + } if features.contains(.shakeToUndo) { addObserver(forNotification: UIAccessibility.shakeToUndoDidChangeNotification, selector: #selector(self.shakeToUndoStatusChanged)) } @@ -116,6 +126,11 @@ extension Notifications { if features.contains(.reduceTransparency) { addObserver(forNotification: UIAccessibility.reduceTransparencyStatusDidChangeNotification, selector: #selector(self.reduceTransparencyStatusChanged)) } + if features.contains(.videoAutoplay) { + if #available(iOS 13.0, tvOS 13.0, *) { + addObserver(forNotification: UIAccessibility.videoAutoplayStatusDidChangeNotification, selector: #selector(self.videoAutoplayStatusChanged)) + } + } if features.contains(.voiceOver) { if #available(iOS 11.0, tvOS 11.0, *) { addObserver(forNotification: UIAccessibility.voiceOverStatusDidChangeNotification, selector: #selector(self.voiceOverStatusChanged)) @@ -197,6 +212,10 @@ extension Notifications { self.postNotification(withFeature: .darkerSystemColors, statusString: self.featureStatusesProvider.isDarkerSystemColorsEnabled.statusString) } + @objc func differentiateWithoutColorStatusChanged() { + self.postNotification(withFeature: .differentiateWithoutColor, statusString: self.featureStatusesProvider.isDifferentiateWithoutColorEnabled.statusString) + } + @objc func guidedAccessStatusChanged() { self.postNotification(withFeature: .guidedAccess, statusString: self.featureStatusesProvider.isGuidedAccessEnabled.statusString) } @@ -209,6 +228,10 @@ extension Notifications { self.postNotification(withFeature: .largerText, statusString: self.featureStatusesProvider.largerTextCatagory.stringValue) } + @objc func onOffSwitchLabelsStatusChanged() { + self.postNotification(withFeature: .onOffSwitchLabels, statusString: self.featureStatusesProvider.isOnOffSwitchLabelsEnabled.statusString) + } + @objc func shakeToUndoStatusChanged() { self.postNotification(withFeature: .shakeToUndo, statusString: self.featureStatusesProvider.isShakeToUndoEnabled.statusString) } @@ -249,6 +272,10 @@ extension Notifications { self.postNotification(withFeature: .reduceTransparency, statusString: self.featureStatusesProvider.isReduceTransparencyEnabled.statusString) } + @objc func videoAutoplayStatusChanged() { + self.postNotification(withFeature: .videoAutoplay, statusString: self.featureStatusesProvider.isVideoAutoplayEnabled.statusString) + } + #endif #if os(iOS) || os(tvOS) || os(OSX) diff --git a/Source/Features/Statuses/FeatureStatusesProvider.swift b/Source/Features/Statuses/FeatureStatusesProvider.swift index d3748aa..13c25c8 100644 --- a/Source/Features/Statuses/FeatureStatusesProvider.swift +++ b/Source/Features/Statuses/FeatureStatusesProvider.swift @@ -29,6 +29,15 @@ class FeatureStatusesProvider: FeatureStatusesProviderProtocol { return UIAccessibility.isDarkerSystemColorsEnabled } + var isDifferentiateWithoutColorEnabled: Bool { + if #available(iOS 13.0, *) { + return UIAccessibility.shouldDifferentiateWithoutColor + } else { + Logger.warning("Unable to determine status for isDifferentiateWithoutColorEnabled since it is only available on iOS 13 or later.") + return false + } + } + var isGuidedAccessEnabled: Bool { return UIAccessibility.isGuidedAccessEnabled } @@ -41,6 +50,15 @@ class FeatureStatusesProvider: FeatureStatusesProviderProtocol { return UIScreen.main.traitCollection.preferredContentSizeCategory } + var isOnOffSwitchLabelsEnabled: Bool { + if #available(iOS 13.0, *) { + return UIAccessibility.isOnOffSwitchLabelsEnabled + } else { + Logger.warning("Unable to determine status for isOnOffSwitchLabelsEnabled since it is only available on iOS 13 or later.") + return false + } + } + var isShakeToUndoEnabled: Bool { return UIAccessibility.isShakeToUndoEnabled } @@ -89,6 +107,15 @@ class FeatureStatusesProvider: FeatureStatusesProviderProtocol { return UIAccessibility.isSwitchControlRunning } + var isVideoAutoplayEnabled: Bool { + if #available(iOS 13.0, tvOS 13.0, *) { + return UIAccessibility.isVideoAutoplayEnabled + } else { + Logger.warning("Unable to determine status for isVideoAutoplayEnabled since it is only available on iOS 13 / tvOS 13 or later.") + return false + } + } + var isVoiceOverEnabled: Bool { return UIAccessibility.isVoiceOverRunning } @@ -189,6 +216,9 @@ class FeatureStatusesProvider: FeatureStatusesProviderProtocol { if feature == .largerText { return !self.largerTextCatagory.isDefault } + if feature == .onOffSwitchLabels { + return self.isOnOffSwitchLabelsEnabled + } if feature == .shakeToUndo { return self.isShakeToUndoEnabled } @@ -211,9 +241,6 @@ class FeatureStatusesProvider: FeatureStatusesProviderProtocol { #if os(OSX) - if feature == .differentiateWithoutColor { - return self.isDifferentiateWithoutColorEnabled - } if feature == .fullKeyboardAccess { return self.isFullKeyboardAccessEnabled } @@ -234,19 +261,28 @@ class FeatureStatusesProvider: FeatureStatusesProviderProtocol { if feature == .monoAudio { return self.isMonoAudioEnabled } + if feature == .videoAutoplay { + return self.isVideoAutoplayEnabled + } #endif - #if os(iOS) || os(tvOS) || os(macOS) + #if os(iOS) || os(OSX) + + if feature == .differentiateWithoutColor { + return self.isDifferentiateWithoutColorEnabled + } + + #endif + + #if os(iOS) || os(tvOS) || os(OSX) if feature == .invertColors { return self.isInvertColorsEnabled } - if feature == .reduceTransparency { return self.isReduceTransparencyEnabled } - if feature == .switchControl { return self.isSwitchControlEnabled } diff --git a/Source/Features/Statuses/FeatureStatusesProviderProtocol.swift b/Source/Features/Statuses/FeatureStatusesProviderProtocol.swift index 732ecb9..e5cc1c2 100644 --- a/Source/Features/Statuses/FeatureStatusesProviderProtocol.swift +++ b/Source/Features/Statuses/FeatureStatusesProviderProtocol.swift @@ -17,6 +17,7 @@ protocol FeatureStatusesProviderProtocol { var isGuidedAccessEnabled: Bool { get } var hearingDevicePairedEar: UIAccessibility.HearingDeviceEar { get } var largerTextCatagory: UIContentSizeCategory { get } + var isOnOffSwitchLabelsEnabled: Bool { get } var isShakeToUndoEnabled: Bool { get } var isSpeakScreenEnabled: Bool { get } var isSpeakSelectionEnabled: Bool { get } @@ -26,6 +27,11 @@ protocol FeatureStatusesProviderProtocol { var isClosedCaptioningEnabled: Bool { get } var isGrayscaleEnabled: Bool { get } var isMonoAudioEnabled: Bool { get } + var isVideoAutoplayEnabled: Bool { get } + #endif + + #if os(iOS) || os(OSX) + var isDifferentiateWithoutColorEnabled: Bool { get } #endif #if os(iOS) || os(tvOS) || os(watchOS) @@ -39,7 +45,6 @@ protocol FeatureStatusesProviderProtocol { #endif #if os(OSX) - var isDifferentiateWithoutColorEnabled: Bool { get } var isFullKeyboardAccessEnabled: Bool { get } var isIncreaseContrastEnabled: Bool { get } #endif diff --git a/Tests/Features/FeatureNotificationsTests.swift b/Tests/Features/FeatureNotificationsTests.swift index af3d9da..9163426 100644 --- a/Tests/Features/FeatureNotificationsTests.swift +++ b/Tests/Features/FeatureNotificationsTests.swift @@ -126,6 +126,17 @@ class FeatureNotificationsTests: QuickSpec { } } + context("when DifferentiateWithoutColor was activated by the user") { + beforeEach { + featureStatusesProviderMock!.differentiateWithoutColor = true + sut!.differentiateWithoutColorStatusChanged() + } + + it("posts a CapableFeatureStatusDidChange notification with the correct FeatureStatus") { + verifyFeatureDidChangeNotificationWasPosted(withFeature: .differentiateWithoutColor, statusString: "enabled") + } + } + context("when GuidedAccess was activated by the user") { beforeEach { featureStatusesProviderMock!.guidedAccessEnabled = true @@ -162,6 +173,17 @@ class FeatureNotificationsTests: QuickSpec { } } + context("when OnOffSwitchLabels was activated by the user") { + beforeEach { + featureStatusesProviderMock!.onOffSwitchLabelsEnabled = true + sut!.onOffSwitchLabelsStatusChanged() + } + + it("posts a CapableFeatureStatusDidChange notification with the correct FeatureStatus") { + verifyFeatureDidChangeNotificationWasPosted(withFeature: .onOffSwitchLabels, statusString: "enabled") + } + } + context("when ShakeToUndo was activated by the user") { beforeEach { featureStatusesProviderMock!.shakeToUndoEnabled = true @@ -335,6 +357,17 @@ class FeatureNotificationsTests: QuickSpec { } } + context("when VideoAutoplay was activated by the user") { + beforeEach { + featureStatusesProviderMock!.videoAutoplayEnabled = true + sut!.videoAutoplayStatusChanged() + } + + it("posts a CapableFeatureStatusDidChange notification with the correct FeatureStatus") { + verifyFeatureDidChangeNotificationWasPosted(withFeature: .videoAutoplay, statusString: "enabled") + } + } + #endif context("when SwitchControl was activated by the user") { diff --git a/Tests/Features/FeatureStatusesProviderTests.swift b/Tests/Features/FeatureStatusesProviderTests.swift index 774a810..2d373e8 100644 --- a/Tests/Features/FeatureStatusesProviderTests.swift +++ b/Tests/Features/FeatureStatusesProviderTests.swift @@ -84,6 +84,16 @@ class FeatureStatusesProviderTests: QuickSpec { } } + context("for OnOffSwitchLabels") { + beforeEach { + sut!.onOffSwitchLabelsEnabled = true + } + + it("returns correct state") { + expect(sut!.isFeatureEnabled(feature: .onOffSwitchLabels)).to(beTrue()) + } + } + context("for ShakeToUndo") { beforeEach { sut!.shakeToUndoEnabled = true @@ -118,16 +128,6 @@ class FeatureStatusesProviderTests: QuickSpec { #if os(OSX) - context("for DifferentiateWithoutColor") { - beforeEach { - sut!.differentiateWithoutColor = true - } - - it("returns correct state") { - expect(sut!.isFeatureEnabled(feature: .differentiateWithoutColor)).to(beTrue()) - } - } - context("for FullKeyboardAccess") { beforeEach { sut!.fullKeyboardAccess = true @@ -192,6 +192,30 @@ class FeatureStatusesProviderTests: QuickSpec { } } + context("for VideoAutoplay") { + beforeEach { + sut!.videoAutoplayEnabled = true + } + + it("returns correct state") { + expect(sut!.isFeatureEnabled(feature: .videoAutoplay)).to(beTrue()) + } + } + + #endif + + #if os(iOS) || os(OSX) + + context("for DifferentiateWithoutColor") { + beforeEach { + sut!.differentiateWithoutColor = true + } + + it("returns correct state") { + expect(sut!.isFeatureEnabled(feature: .differentiateWithoutColor)).to(beTrue()) + } + } + #endif context("for ReduceMotion") { diff --git a/Tests/Features/Mocks/FeatureStatusesProviderMock.swift b/Tests/Features/Mocks/FeatureStatusesProviderMock.swift index 3f5a204..b3cce17 100644 --- a/Tests/Features/Mocks/FeatureStatusesProviderMock.swift +++ b/Tests/Features/Mocks/FeatureStatusesProviderMock.swift @@ -21,6 +21,7 @@ class FeatureStatusesProviderMock: FeatureStatusesProvider { var darkerSystemColorsEnabled = false var guidedAccessEnabled = false var hearingDeviceEar: UIAccessibility.HearingDeviceEar = UIAccessibility.HearingDeviceEar(rawValue: 0) + var onOffSwitchLabelsEnabled = false var shakeToUndoEnabled = false var speakScreenEnabled = false var speakSelectionEnabled = false @@ -28,7 +29,6 @@ class FeatureStatusesProviderMock: FeatureStatusesProvider { #endif #if os(OSX) - var differentiateWithoutColor = false var fullKeyboardAccess = false var increaseContrast = false #endif @@ -38,6 +38,11 @@ class FeatureStatusesProviderMock: FeatureStatusesProvider { var closedCaptioningEnabled = false var grayscaleEnabled = false var monoAudioEnabled = false + var videoAutoplayEnabled = false + #endif + + #if os(iOS) || os(OSX) + var differentiateWithoutColor = false #endif var invertColorsEnabled = false @@ -56,6 +61,10 @@ class FeatureStatusesProviderMock: FeatureStatusesProvider { return self.darkerSystemColorsEnabled } + override var isGuidedAccessEnabled: Bool { + return self.guidedAccessEnabled + } + override var hearingDevicePairedEar: UIAccessibility.HearingDeviceEar { return self.hearingDeviceEar } @@ -64,8 +73,8 @@ class FeatureStatusesProviderMock: FeatureStatusesProvider { return self.textCatagory } - override var isGuidedAccessEnabled: Bool { - return self.guidedAccessEnabled + override var isOnOffSwitchLabelsEnabled: Bool { + return self.onOffSwitchLabelsEnabled } override var isShakeToUndoEnabled: Bool { @@ -84,10 +93,6 @@ class FeatureStatusesProviderMock: FeatureStatusesProvider { #if os(OSX) - override var isDifferentiateWithoutColorEnabled: Bool { - return self.differentiateWithoutColor - } - override var isFullKeyboardAccessEnabled: Bool { return self.fullKeyboardAccess } @@ -116,6 +121,18 @@ class FeatureStatusesProviderMock: FeatureStatusesProvider { return self.monoAudioEnabled } + override var isVideoAutoplayEnabled: Bool { + return self.videoAutoplayEnabled + } + + #endif + + #if os(iOS) || os(OSX) + + override var isDifferentiateWithoutColorEnabled: Bool { + return self.differentiateWithoutColor + } + #endif override var isInvertColorsEnabled: Bool { @@ -147,6 +164,7 @@ class FeatureStatusesProviderMock: FeatureStatusesProvider { self.textCatagory = .accessibilityExtraExtraExtraLarge self.guidedAccessEnabled = true self.hearingDeviceEar = .both + self.onOffSwitchLabelsEnabled = true self.shakeToUndoEnabled = true self.speakScreenEnabled = true self.speakSelectionEnabled = true @@ -155,7 +173,6 @@ class FeatureStatusesProviderMock: FeatureStatusesProvider { #if os(OSX) - self.differentiateWithoutColor = true self.fullKeyboardAccess = true self.increaseContrast = true @@ -167,6 +184,13 @@ class FeatureStatusesProviderMock: FeatureStatusesProvider { self.closedCaptioningEnabled = true self.grayscaleEnabled = true self.monoAudioEnabled = true + self.videoAutoplayEnabled = true + + #endif + + #if os(iOS) || os(OSX) + + self.differentiateWithoutColor = true #endif