Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

Bluetooth unavailable message #53

Closed
Closed
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,9 @@
/* Long description of an unknown bluetooth sensor displayed below a representative image on the Learn More page [CHAR_LIMIT=NONE] */
"sensor_desc_second_paragraph_unknown_bluetooth" = "Bluetooth is a wireless technology standard using radio waves to exchange data over short distances from fixed and mobile devices.";

/* Message to display to the user when bluetooth is not on but a bluetooth sensor is in the experiment on Observe [CHAR_LIMIT=200] */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for a bit of clarity, how about:

/* Message to display to the user when Bluetooth is disabled but a Bluetooth sensor is listed in sensor settings because it has been connected in the past.

"bluetooth_not_on_body" = "Cannot connect to external sensor: Bluetooth is disabled. Turn on Bluetooth to connect to your external sensor.";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: We tend to use _message in the key of strings that will be presented to the user in an alert or snackbar. Can you make the key bluetooth_hardware_disabled_message?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes sure will change that.


/* One-sentence description of the accelerometer X sensor [CHAR_LIMIT=100] */
"sensor_desc_short_acc_x" = "The acceleration of the phone to the left and right, in m/s²";

Expand Down
1 change: 1 addition & 0 deletions ScienceJournal/Strings/ScienceJournalStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ extension String {
static public var sensorDescSecondParagraphRotation: String { return "sensor_desc_second_paragraph_rotation".localized }
static public var sensorDescFirstParagraphUnknownBluetooth: String { return "sensor_desc_first_paragraph_unknown_bluetooth".localized }
static public var sensorDescSecondParagraphUnknownBluetooth: String { return "sensor_desc_second_paragraph_unknown_bluetooth".localized }
static public var bluetoothNotOnBody: String { return "bluetooth_not_on_body".localized }
static public var sensorDescShortAccX: String { return "sensor_desc_short_acc_x".localized }
static public var sensorDescShortAccY: String { return "sensor_desc_short_acc_y".localized }
static public var sensorDescShortAccZ: String { return "sensor_desc_short_acc_z".localized }
Expand Down
2 changes: 1 addition & 1 deletion ScienceJournal/UI/SensorSettingsDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ class SensorSettingsDataSource: BLEServiceScannerDelegate {
}

func serviceScannerBluetoothAvailabilityChanged(_ serviceScanner: BLEServiceScanner) {
// TODO: Display message if Bluetooth is unavailable.
delegate?.sensorSettingsDataSourceNeedsRefresh(self)
}

}
3 changes: 3 additions & 0 deletions ScienceJournal/UI/SensorSettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ class SensorSettingsViewController: MaterialHeaderCollectionViewController,
// MARK: - SensorSettingsDataSourceDelegate

func sensorSettingsDataSourceNeedsRefresh(_ dataSource: SensorSettingsDataSource) {
if !dataSource.serviceScanner.isBluetoothAvailable {
showSnackbar(withMessage: String.bluetoothNotOnBody)
}
collectionView?.reloadData()
}

Expand Down