diff --git a/apps/ios/GuideDogs/Assets/Localization/en-GB.lproj/Localizable.strings b/apps/ios/GuideDogs/Assets/Localization/en-GB.lproj/Localizable.strings index 7628c488..c6441fcc 100644 Binary files a/apps/ios/GuideDogs/Assets/Localization/en-GB.lproj/Localizable.strings and b/apps/ios/GuideDogs/Assets/Localization/en-GB.lproj/Localizable.strings differ diff --git a/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings b/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings index 4bc110c9..46a811c7 100644 --- a/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings +++ b/apps/ios/GuideDogs/Assets/Localization/en-US.lproj/Localizable.strings @@ -1596,6 +1596,12 @@ /* Callouts Information, Updates about didtance to the audio beacon when it's set */ "callouts.audio_beacon.info" = "Updates about distance to the audio beacon when it's set"; +/* Shake callouts */ +"callouts.shake_callouts" = "Repeat Callouts"; + +/* Shake callouts info */ +"callouts.shake_callouts.info" = "Shake the device to repeat the last callout"; + /* Callouts Title, Automatic Callouts */ "callouts.automatic_callouts" = "Automatic Callouts"; diff --git a/apps/ios/GuideDogs/Code/App/Settings/SettingsContext.swift b/apps/ios/GuideDogs/Code/App/Settings/SettingsContext.swift index 9aa4b925..fcef35a3 100644 --- a/apps/ios/GuideDogs/Code/App/Settings/SettingsContext.swift +++ b/apps/ios/GuideDogs/Code/App/Settings/SettingsContext.swift @@ -12,6 +12,7 @@ import CoreLocation extension Notification.Name { static let automaticCalloutsEnabledChanged = Notification.Name("GDAAutomaticCalloutsChanged") + static let shakeCalloutsEnabledChanged = Notification.Name("GDAShakeCalloutsChanged") static let autoCalloutCategorySenseChanged = Notification.Name("GDAAutomaticCalloutSenseChanged") static let beaconVolumeChanged = Notification.Name("GDABeaconVolumeChanged") static let ttsVolumeChanged = Notification.Name("GDATTSVolumeChanged") @@ -42,6 +43,7 @@ class SettingsContext { fileprivate static let useOldBeacon = "GDASettingsUseOldBeacon" fileprivate static let playBeaconStartEndMelody = "GDAPlayBeaconStartEndMelody" fileprivate static let automaticCalloutsEnabled = "GDASettingsAutomaticCalloutsEnabled" + fileprivate static let shakeCalloutsEnabled = "GDASettingsShakeCalloutsEnabled" fileprivate static let sensePlace = "GDASettingsPlaceSenseEnabled" fileprivate static let senseLandmark = "GDASettingsLandmarkSenseEnabled" fileprivate static let senseMobility = "GDASettingsMobilitySenseEnabled" @@ -96,6 +98,7 @@ class SettingsContext { Keys.useOldBeacon: false, Keys.playBeaconStartEndMelody: false, Keys.automaticCalloutsEnabled: true, + Keys.shakeCalloutsEnabled: true, Keys.sensePlace: true, Keys.senseLandmark: true, Keys.senseMobility: true, @@ -402,6 +405,16 @@ extension SettingsContext: AutoCalloutSettingsProvider { } } + var shakeCalloutsEnabled: Bool { + get { + return userDefaults.bool(forKey: Keys.shakeCalloutsEnabled) + } + set(newValue) { + userDefaults.set(newValue, forKey: Keys.shakeCalloutsEnabled) + NotificationCenter.default.post(name: .shakeCalloutsEnabledChanged, object: self, userInfo: [Keys.enabled: newValue]) + } + } + var placeSenseEnabled: Bool { get { return userDefaults.bool(forKey: Keys.sensePlace) diff --git a/apps/ios/GuideDogs/Code/Visual UI/Controls/Settings/CalloutSettingsCellView.swift b/apps/ios/GuideDogs/Code/Visual UI/Controls/Settings/CalloutSettingsCellView.swift index 11e5c4b3..8b6d0925 100644 --- a/apps/ios/GuideDogs/Code/Visual UI/Controls/Settings/CalloutSettingsCellView.swift +++ b/apps/ios/GuideDogs/Code/Visual UI/Controls/Settings/CalloutSettingsCellView.swift @@ -13,7 +13,7 @@ protocol CalloutSettingsCellViewDelegate: AnyObject { } internal enum CalloutSettingCellType { - case all, poi, mobility, beacon + case all, poi, mobility, beacon, shake } class CalloutSettingsCellView: UITableViewCell { @@ -42,6 +42,8 @@ class CalloutSettingsCellView: UITableViewCell { case .beacon: settingSwitch.isOn = SettingsContext.shared.destinationSenseEnabled return + case .shake: + settingSwitch.isOn = SettingsContext.shared.shakeCalloutsEnabled } } } @@ -92,6 +94,9 @@ class CalloutSettingsCellView: UITableViewCell { SettingsContext.shared.destinationSenseEnabled = isOn log(["destination"]) return + case .shake: + SettingsContext.shared.shakeCalloutsEnabled = isOn + GDATelemetry.track("settings.shake_callouts", value: isOn.description) } } } diff --git a/apps/ios/GuideDogs/Code/Visual UI/View Controllers/Launch/LaunchHelper.swift b/apps/ios/GuideDogs/Code/Visual UI/View Controllers/Launch/LaunchHelper.swift index 19a0e500..90bc48dc 100644 --- a/apps/ios/GuideDogs/Code/Visual UI/View Controllers/Launch/LaunchHelper.swift +++ b/apps/ios/GuideDogs/Code/Visual UI/View Controllers/Launch/LaunchHelper.swift @@ -161,6 +161,20 @@ extension UIWindow { open override func motionEnded(_ motion: UIEvent.EventSubtype, with event: UIEvent?) { super.motionEnded(motion, with: event) + if(motion == .motionShake && SettingsContext.shared.shakeCalloutsEnabled){ + + guard let callout = AppContext.shared.calloutHistory.callouts.last else { + return + } + + AppContext.process(RepeatCalloutEvent(callout: callout) { (_) in + }) + + return + } + + + // We use the shake motion to pause and resume a GPX simulation guard FeatureFlag.isEnabled(.developerTools), motion == .motionShake, diff --git a/apps/ios/GuideDogs/Code/Visual UI/View Controllers/Settings/SettingsViewController.swift b/apps/ios/GuideDogs/Code/Visual UI/View Controllers/Settings/SettingsViewController.swift index 8d01aea4..ffd31035 100644 --- a/apps/ios/GuideDogs/Code/Visual UI/View Controllers/Settings/SettingsViewController.swift +++ b/apps/ios/GuideDogs/Code/Visual UI/View Controllers/Settings/SettingsViewController.swift @@ -27,6 +27,7 @@ class SettingsViewController: BaseTableViewController { case poi = 1 case mobility = 2 case beacon = 3 + case shake = 4 } private static let cellIdentifiers: [IndexPath: String] = [ @@ -43,6 +44,7 @@ class SettingsViewController: BaseTableViewController { IndexPath(row: CalloutsRow.poi.rawValue, section: Section.callouts.rawValue): "poiCallouts", IndexPath(row: CalloutsRow.mobility.rawValue, section: Section.callouts.rawValue): "mobilityCallouts", IndexPath(row: CalloutsRow.beacon.rawValue, section: Section.callouts.rawValue): "beaconCallouts", + IndexPath(row: CalloutsRow.shake.rawValue, section: Section.callouts.rawValue): "shakeCallouts", IndexPath(row: 0, section: Section.streetPreview.rawValue): "streetPreview", IndexPath(row: 0, section: Section.troubleshooting.rawValue): "troubleshooting", @@ -53,7 +55,8 @@ class SettingsViewController: BaseTableViewController { private static let collapsibleCalloutIndexPaths: [IndexPath] = [ IndexPath(row: CalloutsRow.poi.rawValue, section: Section.callouts.rawValue), IndexPath(row: CalloutsRow.mobility.rawValue, section: Section.callouts.rawValue), - IndexPath(row: CalloutsRow.beacon.rawValue, section: Section.callouts.rawValue) + IndexPath(row: CalloutsRow.beacon.rawValue, section: Section.callouts.rawValue), + IndexPath(row: CalloutsRow.shake.rawValue, section: Section.callouts.rawValue) ] // MARK: Properties @@ -82,7 +85,7 @@ class SettingsViewController: BaseTableViewController { switch sectionType { case .general: return 6 case .audio: return 1 - case .callouts: return SettingsContext.shared.automaticCalloutsEnabled ? 4 : 1 + case .callouts: return SettingsContext.shared.automaticCalloutsEnabled ? 5 : 1 case .streetPreview: return 1 case .troubleshooting: return 1 case .about: return 1 @@ -108,6 +111,7 @@ class SettingsViewController: BaseTableViewController { case .poi: cell.type = .poi case .mobility: cell.type = .mobility case .beacon: cell.type = .beacon + case .shake: cell.type = .shake } } diff --git a/apps/ios/GuideDogs/Code/Visual UI/Views/Settings.storyboard b/apps/ios/GuideDogs/Code/Visual UI/Views/Settings.storyboard index 2cf722f6..ebc77e8f 100644 --- a/apps/ios/GuideDogs/Code/Visual UI/Views/Settings.storyboard +++ b/apps/ios/GuideDogs/Code/Visual UI/Views/Settings.storyboard @@ -1,7 +1,9 @@ - + + - + + @@ -10,26 +12,26 @@ - - + + - + - + - + - + - + - + - + - + @@ -133,14 +135,14 @@ - + - + - + - + - + @@ -218,10 +220,10 @@ - + - + - + @@ -266,10 +268,10 @@ - + - + - + @@ -314,10 +316,10 @@ - + - + - + @@ -361,15 +363,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1097,8 +1182,8 @@ - - + +