diff --git a/src/components/connection-modal/auto-scanning-step.jsx b/src/components/connection-modal/auto-scanning-step.jsx
index 272b267a8..ed024706a 100644
--- a/src/components/connection-modal/auto-scanning-step.jsx
+++ b/src/components/connection-modal/auto-scanning-step.jsx
@@ -9,9 +9,11 @@ import Dots from './dots.jsx';
import closeIcon from '../close-button/icon--close.svg';
-import radarIcon from './icons/searching.png';
-import bluetoothIcon from './icons/bluetooth-white.svg';
import backIcon from './icons/back.svg';
+import bluetoothIcon from './icons/bluetooth-white.svg';
+import enterUpdateIcon from './icons/enter-update.svg';
+import radarIcon from './icons/searching.png';
+import warningIcon from './icons/warning.svg';
import styles from './connection-modal.css';
@@ -21,8 +23,13 @@ const PHASES = keyMirror({
notfound: null
});
-const AutoScanningStep = props => (
-
+const AutoScanningStep = props => {
+ // Offer to update both during scan and after a failed scan, as long there's an update function.
+ // It's possible the scan will find "some" device but not the desired device,
+ // so don't limit the update offer to just the PHASES.notfound case.
+ const showUpdate = !!(props.onUpdatePeripheral &&
+ (props.phase === PHASES.pressbutton || props.phase === PHASES.notfound));
+ return (
- }
)}
-
+ {(props.scanning || props.peripheralList.length > 0) && (
+ // Show this message if we're still scanning OR if we've found devices
+
+ )}
+ {showUpdate && (
+ // Show this message if we're done scanning AND we can update
+ // Note that it's possible the list includes devices but does not include the desired device,
+ // so don't limit this message to the (props.peripheralList.length === 0) case
+
+ )}
-
+
+
+ {showUpdate && (
+
+ )}
+
-
-);
+ );
+};
ScanningStep.propTypes = {
connectionSmallIconURL: PropTypes.string,
diff --git a/src/components/connection-modal/update-peripheral-step.jsx b/src/components/connection-modal/update-peripheral-step.jsx
index 934e84dc7..78f144c63 100644
--- a/src/components/connection-modal/update-peripheral-step.jsx
+++ b/src/components/connection-modal/update-peripheral-step.jsx
@@ -7,10 +7,12 @@ import bindAll from 'lodash.bindall';
import keyMirror from 'keymirror';
import Box from '../box/box.jsx';
-import Dots from './dots.jsx';
import backIcon from './icons/back.svg';
+import sendUpdateIcon from './icons/send-update.svg';
+import sendUpdateGlyph from './icons/send-update-white.svg';
import styles from './connection-modal.css';
+import ProgressRingComponent from '../progress-ring/progress-ring.jsx';
/** @enum{string} UPDATE_ACTIVITY */
const UPDATE_ACTIVITY = keyMirror({
@@ -32,7 +34,7 @@ class UpdatePeripheralStep extends React.Component {
activity: UPDATE_ACTIVITY.getReady,
/** @type {number} */
- progress: 0,
+ progressPercentage: 0,
/** @type {Error?} */
err: null,
@@ -51,7 +53,10 @@ class UpdatePeripheralStep extends React.Component {
});
try {
const res = await this.props.onSendPeripheralUpdate(progress => {
- this.setState({progress});
+ // On my computer, I get a progress update every 0.005% or so.
+ // Rendering the progress ring is a little expensive, so filtering updates here reduces the CPU load.
+ // Updating every 1% doesn't look very smooth, but 0.5% (1/200) looks good to me.
+ this.setState({progressPercentage: Math.floor(progress * 200) / 2});
});
this.setState({
activity: UPDATE_ACTIVITY.results,
@@ -67,49 +72,61 @@ class UpdatePeripheralStep extends React.Component {
renderGetReady () {
return (
-
-
-
-
- {
- // The instructions for getting the peripheral ready for the update process will vary depending on
- // the peripheral. Should we get this from the extension somehow?
- }
-
-
-
-
+
+
+
+ {'1'}
+
+
+ {
+ // The instructions for getting the peripheral ready for the update process will vary
+ // depending on the peripheral. Should we get this from the extension somehow?
+ }
+
+
+
+
+ {'2'}
+
+
+
+ );
}
renderSendUpdate () {
return (
-