Skip to content

Commit

Permalink
Keep just the changes necessary for this feature
Browse files Browse the repository at this point in the history
  • Loading branch information
steinbro committed Sep 15, 2024
1 parent 39eea13 commit ff98534
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 170 deletions.

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -1597,10 +1597,10 @@
"callouts.audio_beacon.info" = "Updates about distance to the audio beacon when it's set";

/* Shake callouts */
"callouts.shake_callouts" = "Enable Shake Callouts";
"callouts.shake_callouts" = "Repeat Callouts";

/* Shake callouts info */
"callouts.shake_callouts.info" = "Allow callouts to be repeated by shaking the device";
"callouts.shake_callouts.info" = "Shake the device to repeat the last callout";

/* Callouts Title, Automatic Callouts */
"callouts.automatic_callouts" = "Automatic Callouts";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ struct POICallout: POICalloutProtocol {
self.includeDistance = includeDistance
self.includePrefixSound = includePrefixSound
}

/// Sounds to callout
func sounds(for location: CLLocation?, isRepeat: Bool, automotive: Bool = false) -> Sounds {
guard let location = location ?? self.location, let poi = poi else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import CoreLocation

struct ExplorationModeToggled: UserInitiatedEvent { //code handled when one of the four bottom buttons are pressed
struct ExplorationModeToggled: UserInitiatedEvent {
let sender: AnyObject?
let mode: ExplorationGenerator.Mode
let requiredMarkerKeys: [String]
Expand All @@ -25,7 +25,7 @@ struct ExplorationModeToggled: UserInitiatedEvent { //code handled when one of t
/// this mode are finished playing after having toggled a mode on
init(_ mode: ExplorationGenerator.Mode, sender: AnyObject? = nil, requiredMarkerKeys: [String] = [], logContext: String? = nil, completion: ((Bool) -> Void)? = nil) {
self.mode = mode
self.sender = sender //obtained from function call
self.sender = sender
self.requiredMarkerKeys = requiredMarkerKeys
self.completionHandler = completion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,29 +336,30 @@ extension CalloutStateMachine {
} else {
sounds = callout.sounds(for: strongSelf.geo?.location, automotive: strongSelf.motionActivityContext.isInVehicle)
}

strongSelf.audioEngine.play(sounds) { (success) in
calloutGroup.delegate?.calloutFinished(callout, completed: success)

guard strongSelf.currentState != State.stopping.rawValue else {
GDLogVerbose(.stateMachine, "Callout interrupted. Stopping...")
strongSelf.stateMachine.fireEvent(.stopped)
calloutGroup.onComplete?(false)
return
}

guard strongSelf.currentState != State.off.rawValue else {
GDLogVerbose(.stateMachine, "Callouts immediately interrupted. Cleaning up...")
calloutGroup.onComplete?(false)
return
}

guard success else {
GDLogVerbose(.stateMachine, "Callout did not finish playing successfully. Terminating state machine...")
calloutGroup.onComplete?(false)
strongSelf.stateMachine.fireEvent(.failed)
return
}

strongSelf.stateMachine.fireEvent(.delayCalloutAnnounced)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class CalloutButtonPanelViewController: UIViewController {

// MARK: `IBAction`

@IBAction private func onLocateTouchUpInside(_ sender: AnyObject?) { //Triggered when user clicks 'My Location' on main menu
@IBAction private func onLocateTouchUpInside(_ sender: AnyObject?) {
updateAnimation(locateImageView, locateAnimation, true)

let completion: (Bool) -> Void = { [weak self] _ in
Expand All @@ -146,7 +146,7 @@ class CalloutButtonPanelViewController: UIViewController {
AppContext.process(event)
}

@IBAction private func onOrientateTouchUpInside(_ sender: AnyObject?) { //Triggered when user clicks 'Around Me'
@IBAction private func onOrientateTouchUpInside(_ sender: AnyObject?) {
updateAnimation(orientateImageView, orientateAnimation, true)

AppContext.process(ExplorationModeToggled(.aroundMe, sender: sender, logContext: logContext) { [weak self] _ in
Expand All @@ -162,7 +162,7 @@ class CalloutButtonPanelViewController: UIViewController {
})
}

@IBAction private func onLookAheadTouchUpInside(_ sender: AnyObject?) { //Triggered when user clicks 'Ahead of Me'
@IBAction private func onLookAheadTouchUpInside(_ sender: AnyObject?) {
updateAnimation(exploreImageView, exploreAnimation, true)

AppContext.process(ExplorationModeToggled(.aheadOfMe, sender: sender, logContext: logContext) { [weak self] _ in
Expand All @@ -178,7 +178,7 @@ class CalloutButtonPanelViewController: UIViewController {
})
}

@IBAction private func onMarkedPointsTouchUpInside(_ sender: AnyObject?) { //Triggered when user clicks 'Nearby Markers'
@IBAction private func onMarkedPointsTouchUpInside(_ sender: AnyObject?) {
updateAnimation(markedPointImageView, markedPointsAnimation, true)

AppContext.process(ExplorationModeToggled(.nearbyMarkers, sender: sender, logContext: logContext) { [weak self] _ in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protocol SearchResultsTableViewControllerDelegate: LocationActionDelegate {
var isAccessibilityActionsEnabled: Bool { get }
}

class SearchResultsTableViewController: UITableViewController{
class SearchResultsTableViewController: UITableViewController {

typealias ListItem = ListItemTableViewCellConfigurator.ListItem

Expand Down Expand Up @@ -148,7 +148,7 @@ class SearchResultsTableViewController: UITableViewController{

return poi
})

let selectionDataSource = TableViewDataSource(header: nil, models: selections.asListItemWithoutIndex, cellConfigurator: configurator)
let calloutDataSource = TableViewDataSource(header: GDLocalizedString("poi_screen.header.recent.callouts"), models: callouts.asListItemWithoutIndex, cellConfigurator: configurator)

Expand Down
Loading

0 comments on commit ff98534

Please sign in to comment.