Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup process startup and Settings page continuation #131

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions apps/ios/GuideDogs.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,9 @@
62F7A30C27B6080900C62390 /* InteractiveBeaconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62F7A30B27B6080900C62390 /* InteractiveBeaconView.swift */; };
62F7A30E27B6082A00C62390 /* InteractiveBeaconViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62F7A30D27B6082A00C62390 /* InteractiveBeaconViewModel.swift */; };
6A4891BB2A5E66DE0002D146 /* ExternalNavigationApps.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A4891BA2A5E66DE0002D146 /* ExternalNavigationApps.swift */; };
7FB733C82CE555D500C99D46 /* GeneralSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7FB733C72CE555D500C99D46 /* GeneralSettingsViewController.swift */; };
7FB733CC2CE5570A00C99D46 /* CalloutSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7FB733CB2CE5570A00C99D46 /* CalloutSettingsViewController.swift */; };
7FB733D02CE5575400C99D46 /* TroubleshootingSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7FB733CF2CE5575400C99D46 /* TroubleshootingSettingsViewController.swift */; };
91172A732AD8D56D00E6E8E9 /* CoreGPX in Frameworks */ = {isa = PBXBuildFile; productRef = 91172A722AD8D56D00E6E8E9 /* CoreGPX */; };
914BAAF32AD745E400CB2171 /* DestinationManagerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 914BAAF22AD745E400CB2171 /* DestinationManagerTest.swift */; };
914BAAFD2AD7483300CB2171 /* AudioEngineTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 914BAAFC2AD7483300CB2171 /* AudioEngineTest.swift */; };
Expand Down Expand Up @@ -1582,6 +1585,9 @@
62F7A30B27B6080900C62390 /* InteractiveBeaconView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InteractiveBeaconView.swift; sourceTree = "<group>"; };
62F7A30D27B6082A00C62390 /* InteractiveBeaconViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InteractiveBeaconViewModel.swift; sourceTree = "<group>"; };
6A4891BA2A5E66DE0002D146 /* ExternalNavigationApps.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ExternalNavigationApps.swift; path = Code/App/ExternalNavigationApps.swift; sourceTree = "<group>"; };
7FB733C72CE555D500C99D46 /* GeneralSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralSettingsViewController.swift; sourceTree = "<group>"; };
7FB733CB2CE5570A00C99D46 /* CalloutSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalloutSettingsViewController.swift; sourceTree = "<group>"; };
7FB733CF2CE5575400C99D46 /* TroubleshootingSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TroubleshootingSettingsViewController.swift; sourceTree = "<group>"; };
914BAAF22AD745E400CB2171 /* DestinationManagerTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DestinationManagerTest.swift; sourceTree = "<group>"; };
914BAAFC2AD7483300CB2171 /* AudioEngineTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AudioEngineTest.swift; sourceTree = "<group>"; };
914DEBCD2A3CE6B9007B161C /* UnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UnitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -1902,6 +1908,9 @@
287D3E8C22DE50340084B92B /* StatusTableViewController.swift */,
C30EF61E2089475D00BEA785 /* VoiceSettingsTableViewController.swift */,
B92EA05D27AC80E900127A9A /* SiriShortcutsTableViewController.swift */,
7FB733C72CE555D500C99D46 /* GeneralSettingsViewController.swift */,
7FB733CB2CE5570A00C99D46 /* CalloutSettingsViewController.swift */,
7FB733CF2CE5575400C99D46 /* TroubleshootingSettingsViewController.swift */,
);
name = Settings;
sourceTree = "<group>";
Expand Down Expand Up @@ -5872,6 +5881,7 @@
6202A2A6284A85FD00CC51DF /* LeftAccessoryText.swift in Sources */,
28AA35F026C1E82800CBD680 /* MarkerLoader.swift in Sources */,
B93629B01FCDE25000BAF3A6 /* UIViewController+Extensions.swift in Sources */,
7FB733D02CE5575400C99D46 /* TroubleshootingSettingsViewController.swift in Sources */,
28246D1A21ED372A004C8F09 /* LinkedList.swift in Sources */,
C38841D52268FCC400F6DFA5 /* POI+Similarity.swift in Sources */,
C363227D22DFB6B700715374 /* Heading+Order.swift in Sources */,
Expand Down Expand Up @@ -5961,6 +5971,7 @@
62E8BB2D24AE6BCA00DDBCB4 /* LocationDetailViewController.swift in Sources */,
28F0F9281F86A43000B6A64F /* DestinationTutorialBeaconPage.swift in Sources */,
62791781248EBCA4001D72F3 /* IntersectionDecisionPoint.swift in Sources */,
7FB733C82CE555D500C99D46 /* GeneralSettingsViewController.swift in Sources */,
6249500526FBE26C008D842B /* MarkerEditViewRepresentable.swift in Sources */,
62E2C04D267055BE00F7CBE1 /* WaypointDetail.swift in Sources */,
C37E33B223610A370033D640 /* GeolocationManagerSnoozeDelegate.swift in Sources */,
Expand Down Expand Up @@ -6176,6 +6187,7 @@
B9E63D0B26FE735600CCE4ED /* CloudKeyValueStore+Routes.swift in Sources */,
625F8524243BDAD10085AE05 /* UserActivityManager.swift in Sources */,
624DF68B27BED80C000A634C /* AuthorizationStatus.swift in Sources */,
7FB733CC2CE5570A00C99D46 /* CalloutSettingsViewController.swift in Sources */,
2896378526D70CE7001694C0 /* TableHeaderCell.swift in Sources */,
3153765521FF1DFB008445AD /* CodeableDirection.swift in Sources */,
620BC33F25F2CC98007DBA29 /* HeadphoneMotionManagerStatus.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,21 +380,9 @@
/* Settings title, About Soundscape {NumberedPlaceholder="Soundscape"} */
"settings.about_app" = "About Soundscape";

/* Settings title,General Settings */
"settings.section.general" = "General Settings";

/* Settings title,Units of Measure */
"settings.section.units" = "Units of Measure";

/* Settings title, Troubleshooting */
"settings.section.troubleshooting" = "Troubleshooting";

/* Settings title, About */
"settings.section.about" = "About";

/* Settings title, Telemetry */
"settings.section.telemetry" = "Telemetry";

/* Settings title, Share Usage Data */
"settings.section.share_usage_data" = "Share Usage Data";

Expand All @@ -416,12 +404,47 @@
/* Language display name. %1$@ is a language name, %2$@ is the country name. e.g. "English (United Kingdom)" {NumberedPlaceholder="%1$@", "%2$@"} */
"settings.language.language_name" = "%1$@ (%2$@)";

"menu.manage_callouts.all" = "Allow Callouts";

"menu.manage_callouts.poi" = "Places and Landmarks";

"menu.manage_callouts.mobility" = "Mobility";

"menu.manage_callouts.beacon" = "Distance to the Audio Beacon";

"menu.manage_callouts.shake" = "Repeat Callouts";


//------------------------------------------------------------------------------
// MARK: Settings (Audio)
// MARK: Settings (Sections)
//------------------------------------------------------------------------------

/* Settings title, General settings for the app */
"settings.section.general" = "General settings for the app.";

/* The title for the screen which configures media controls (play/pause/next/etc) related settings */
"settings.audio.media_controls" = "Media Controls";
"settings.audio.media_controls" = "Control how audio interacts with other media.";

/* Settings title, Manage the callouts that help navigate */
"menu.manage_callouts" = "Manage the callouts that help navigate.";

/* Settings title, Settings for including unnamed roads */
"settings.section.street_preview" = "Settings for including unnamed roads.";

/* Settings title, Options for troubleshooting the app */
"settings.section.troubleshooting" = "Options for troubleshooting the app.";

/* Settings title, Information about the app */
"settings.section.about" = "Information about the app.";

/* Settings title, Manage data collection and privacy */
"settings.section.telemetry" = "Manage data collection and privacy.";



//------------------------------------------------------------------------------
// MARK: Settings (Audio)
//------------------------------------------------------------------------------

/* A title for a toggle for an audio setting which determines if the current app's audio will be mixed with others. If ON, this app will output audio which could be played at the same time as other apps that play audio, such as another music player app. */
"settings.audio.mix_with_others.title" = "Enable Media Controls";
Expand Down Expand Up @@ -720,7 +743,7 @@
//------------------------------------------------------------------------------

/* Street Preview, View title, Street Preview is functionality that allows the user to select any location in the world to preview the area at street level in order to familiarise and build a mental map of the space. {NumberedPlaceholder="Soundscape Street Preview"} */
"preview.title" = "Soundscape Street Preview";
"preview.title" = "Street Preview";

/* Text displayed when the current location is not known while previewing */
"preview.current_intersection_unknown.label" = "Current Location Unknown";
Expand Down Expand Up @@ -2150,9 +2173,6 @@
/* Title, Head Tracking Headphones, "head tracking headphones" is a term that refers to headphones which include sensors that track a person's head movements */
"menu.devices" = "Head Tracking Headphones";

/* Title, Manage Callouts */
"menu.manage_callouts" = "Manage Callouts";

/* Title, Help and Tutorials */
"menu.help_and_tutorials" = "Help & Tutorials";

Expand Down
127 changes: 127 additions & 0 deletions apps/ios/GuideDogs/CalloutSettingsViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
import UIKit

class CalloutSettingsViewController: UITableViewController, CalloutSettingsCellViewDelegate {

// MARK: - CalloutSettingsCellViewDelegate
func onCalloutSettingChanged(_ type: CalloutSettingCellType) {
// Handle callout setting changes here
print("Callout setting changed for type: \(type)")
}

private enum CalloutsRow: Int, CaseIterable {
case all = 0
case poi = 1
case mobility = 2
case beacon = 3
case shake = 4
}

private static let cellIdentifiers: [CalloutsRow: String] = [
.all: "allCallouts",
.poi: "poiCallouts",
.mobility: "mobilityCallouts",
.beacon: "beaconCallouts",
.shake: "shakeCallouts"
]

// Properties to store the states of each callout setting
private var automaticCalloutsEnabled = SettingsContext.shared.automaticCalloutsEnabled
private var poiCalloutsEnabled = true
private var mobilityCalloutsEnabled = true
private var beaconCalloutsEnabled = true
private var shakeCalloutsEnabled = false

override func viewDidLoad() {
super.viewDidLoad()
self.title = GDLocalizedString("menu.manage_callouts")

// Register all cell identifiers
for identifier in CalloutSettingsViewController.cellIdentifiers.values {
self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: identifier)
}
}

override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}

override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// Only show additional rows when "Allow Callouts" is enabled
return automaticCalloutsEnabled ? CalloutsRow.allCases.count : 1
}

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
// Determine the row type
guard let rowType = CalloutsRow(rawValue: indexPath.row) else {
return UITableViewCell()
}

// Get the identifier for the row type
let identifier = CalloutSettingsViewController.cellIdentifiers[rowType] ?? "default"
let cell = tableView.dequeueReusableCell(withIdentifier: identifier, for: indexPath)
cell.selectionStyle = .none // Disable selection

// Configure the toggle for each row
let switchView = UISwitch(frame: .zero)
switchView.addTarget(self, action: #selector(toggleCalloutSetting(_:)), for: .valueChanged)
switchView.tag = rowType.rawValue
cell.accessoryView = switchView

// Configure the row content dynamically
switch rowType {
case .all:
cell.textLabel?.text = GDLocalizedString("menu.manage_callouts.all")
switchView.setOn(automaticCalloutsEnabled, animated: true)
case .poi:
cell.textLabel?.text = GDLocalizedString("menu.manage_callouts.poi")
switchView.setOn(poiCalloutsEnabled, animated: true)
case .mobility:
cell.textLabel?.text = GDLocalizedString("menu.manage_callouts.mobility")
switchView.setOn(mobilityCalloutsEnabled, animated: true)
case .beacon:
cell.textLabel?.text = GDLocalizedString("menu.manage_callouts.beacon")
switchView.setOn(beaconCalloutsEnabled, animated: true)
case .shake:
cell.textLabel?.text = GDLocalizedString("menu.manage_callouts.shake")
switchView.setOn(shakeCalloutsEnabled, animated: true)
}

return cell
}

// MARK: - Toggle Actions

@objc private func toggleCalloutSetting(_ sender: UISwitch) {
// Determine which toggle was changed based on its tag
switch CalloutsRow(rawValue: sender.tag) {
case .all:
automaticCalloutsEnabled = sender.isOn
SettingsContext.shared.automaticCalloutsEnabled = sender.isOn
logCalloutToggle(for: "all", state: sender.isOn)
tableView.reloadData() // Refresh table to show/hide rows
case .poi:
poiCalloutsEnabled = sender.isOn
logCalloutToggle(for: "poi", state: sender.isOn)
case .mobility:
mobilityCalloutsEnabled = sender.isOn
logCalloutToggle(for: "mobility", state: sender.isOn)
case .beacon:
beaconCalloutsEnabled = sender.isOn
logCalloutToggle(for: "beacon", state: sender.isOn)
case .shake:
shakeCalloutsEnabled = sender.isOn
logCalloutToggle(for: "shake", state: sender.isOn)
case .none:
break
}
}

// MARK: - Logging Function

private func logCalloutToggle(for type: String, state: Bool) {
let logMessage = "Toggled \(type) callouts to: \(state)"
GDLogActionInfo(logMessage) // Use GDLog for logging
GDATelemetry.track("callout_toggle", with: ["type": type, "state": "\(state)"])
}
}

1 change: 1 addition & 0 deletions apps/ios/GuideDogs/Code/App/Settings/SettingsContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -487,3 +487,4 @@ extension SettingsContext: AutoCalloutSettingsProvider {
}
}
}

Loading