From 0c4bdc92a4a251a2cbb98d2f629aff3da8591cbf Mon Sep 17 00:00:00 2001
From: Paul Kaplan <pkaplan@media.mit.edu>
Date: Mon, 9 Jul 2018 13:37:58 -0400
Subject: [PATCH] Add listener for scan timeout to make scanning state
 reachable.

This is not yet implemented in the VM, but will be needed when it is.
---
 src/containers/scanning-step.jsx | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/containers/scanning-step.jsx b/src/containers/scanning-step.jsx
index bdab6c8a6..600eb8da8 100644
--- a/src/containers/scanning-step.jsx
+++ b/src/containers/scanning-step.jsx
@@ -9,6 +9,7 @@ class ScanningStep extends React.Component {
         super(props);
         bindAll(this, [
             'handlePeripheralListUpdate',
+            'handlePeripheralScanTimeout',
             'handleRefresh'
         ]);
         this.state = {
@@ -20,11 +21,18 @@ class ScanningStep extends React.Component {
         this.props.vm.startDeviceScan(this.props.extensionId);
         this.props.vm.on(
             'PERIPHERAL_LIST_UPDATE', this.handlePeripheralListUpdate);
+        this.props.vm.on(
+            'PERIPHERAL_SCAN_TIMEOUT', this.handlePeripheralScanTimeout);
     }
     componentWillUnmount () {
         // @todo: stop the device scan here
         this.props.vm.removeListener(
             'PERIPHERAL_LIST_UPDATE', this.handlePeripheralListUpdate);
+        this.props.vm.removeListener(
+            'PERIPHERAL_SCAN_TIMEOUT', this.handlePeripheralScanTimeout);
+    }
+    handlePeripheralScanTimeout () {
+        this.setState({scanning: false});
     }
     handlePeripheralListUpdate (newList) {
         // TODO: sort peripherals by signal strength? so they don't jump around
-- 
GitLab