diff --git a/ControlRoom/Localizable.xcstrings b/ControlRoom/Localizable.xcstrings index 1890873..ba30c9c 100644 --- a/ControlRoom/Localizable.xcstrings +++ b/ControlRoom/Localizable.xcstrings @@ -1826,6 +1826,16 @@ } } }, + "Show Slow Animations" : { + "localizations" : { + "ar" : { + "stringUnit" : { + "state" : "translated", + "value" : "أظهر رسوم متحركة بطيئة" + } + } + } + }, "Show system apps" : { "localizations" : { "ar" : { diff --git a/ControlRoom/Simulator UI/ControlScreens/OverridesView.swift b/ControlRoom/Simulator UI/ControlScreens/OverridesView.swift index 46e8579..9f74805 100644 --- a/ControlRoom/Simulator UI/ControlScreens/OverridesView.swift +++ b/ControlRoom/Simulator UI/ControlScreens/OverridesView.swift @@ -25,6 +25,7 @@ struct OverridesView: View { @State private var enhanceTextLegibility = false @State private var showButtonShapes = false + @State private var showSlowAnimations = false @State private var showOnOffLabels = false @State private var reduceTransparency = false @State private var increaseContrast = false @@ -95,6 +96,7 @@ struct OverridesView: View { Toggle("Bold Text", isOn: $enhanceTextLegibility.onChange(setEnhanceTextLegibility)) Toggle("Button Shapes", isOn: $showButtonShapes.onChange(setShowButtonShapes)) + Toggle("Show Slow Animations", isOn: $showSlowAnimations.onChange(setSlowAnimations)) Toggle("On/Off Labels", isOn: $showOnOffLabels.onChange(setShowOnOffLabels)) Toggle("Reduce Transparency", isOn: $reduceTransparency.onChange(setReduceTransparency)) Toggle("Increase Contrast", isOn: $increaseContrast.onChange(setIncreaseContrast)) @@ -141,6 +143,18 @@ struct OverridesView: View { SimCtl.setContentSize(simulator.udid, contentSize: contentSize) } + func sendDarvinNotification(key: String, value: Bool) { + // Slow animations are toggled via a Darwin notification state inside the simulator: + // set the state with `notifyutil -s`, then post it with `-p` so running apps pick it up. + let name = "com.apple.UIKit." + key + _ = Process.execute("/usr/bin/xcrun", arguments: ["simctl", "spawn", simulator.id, "notifyutil", "-s", name, value ? "1" : "0"]) + _ = Process.execute("/usr/bin/xcrun", arguments: ["simctl", "spawn", simulator.id, "notifyutil", "-p", name]) + } + + func setSlowAnimations() { + sendDarvinNotification(key: "SimulatorSlowMotionAnimationState", value: showSlowAnimations) + } + // Updates the simulator's accessibility setting for a particular key. // Example call: xcrun simctl spawn booted defaults write com.apple.Accessibility EnhancedTextLegibilityEnabled -bool FALSE func updateAccessibility(key: String, value: Bool) { diff --git a/README.md b/README.md index 32144c2..6033848 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ Control Room is packed with features to help you develop apps more effectively, - Controlling status of WiFi, cellular service, and battery. - Opening the data folder for your app, or editing your `UserDefaults` entries. - Overriding dark or light mode, language, accessibility options, and Dynamic Type content size. +- Activating slow animations in the simulator. This sadly does not work on a real device. - Picking a custom user location from anywhere in the world. - Starting, stopping, installing, and removing apps. - Sending test push notifications or triggering deep links.