From 9b201714198e0bdc05ef62ea6e137b617bda4175 Mon Sep 17 00:00:00 2001
From: Evelyn Eastmond <evhan55@gmail.com>
Date: Tue, 28 Aug 2018 16:06:00 -0400
Subject: [PATCH] Continuing refactoring: renaming things back to be more
 verbose, adding JSDocs.

---
 src/containers/auto-scanning-step.jsx |  2 +-
 src/containers/connection-modal.jsx   | 10 +++++-----
 src/containers/scanning-step.jsx      |  4 ++--
 src/lib/blocks.js                     |  2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/containers/auto-scanning-step.jsx b/src/containers/auto-scanning-step.jsx
index e5cdf457d..4987290b1 100644
--- a/src/containers/auto-scanning-step.jsx
+++ b/src/containers/auto-scanning-step.jsx
@@ -58,7 +58,7 @@ class AutoScanningStep extends React.Component {
     }
     handleStartScan () {
         this.bindPeripheralUpdates();
-        this.props.vm.scan(this.props.extensionId);
+        this.props.vm.scanForPeripheral(this.props.extensionId);
         this.setState({
             phase: PHASES.pressbutton
         });
diff --git a/src/containers/connection-modal.jsx b/src/containers/connection-modal.jsx
index 9471ccc96..b81c0d36f 100644
--- a/src/containers/connection-modal.jsx
+++ b/src/containers/connection-modal.jsx
@@ -17,7 +17,7 @@ class ConnectionModal extends React.Component {
             'handleHelp'
         ]);
         this.state = {
-            phase: props.vm.isConnected(props.extensionId) ?
+            phase: props.vm.getPeripheralIsConnected(props.extensionId) ?
                 PHASES.connected : PHASES.scanning
         };
     }
@@ -35,7 +35,7 @@ class ConnectionModal extends React.Component {
         });
     }
     handleConnecting (peripheralId) {
-        this.props.vm.connectToPeripheral(this.props.extensionId, peripheralId);
+        this.props.vm.connectPeripheral(this.props.extensionId, peripheralId);
         this.setState({
             phase: PHASES.connecting
         });
@@ -47,13 +47,13 @@ class ConnectionModal extends React.Component {
     }
     handleDisconnect () {
         this.props.onStatusButtonUpdate(this.props.extensionId, 'not ready');
-        this.props.vm.disconnectExtensionSession(this.props.extensionId);
+        this.props.vm.disconnectPeripheral(this.props.extensionId);
         this.props.onCancel();
     }
     handleCancel () {
         // If we're not connected to a device, close the websocket so we stop scanning.
-        if (!this.props.vm.isConnected(this.props.extensionId)) {
-            this.props.vm.disconnectExtensionSession(this.props.extensionId);
+        if (!this.props.vm.getPeripheralIsConnected(this.props.extensionId)) {
+            this.props.vm.disconnectPeripheral(this.props.extensionId);
         }
         this.props.onCancel();
     }
diff --git a/src/containers/scanning-step.jsx b/src/containers/scanning-step.jsx
index f83a7d3f2..d01b5e60c 100644
--- a/src/containers/scanning-step.jsx
+++ b/src/containers/scanning-step.jsx
@@ -18,7 +18,7 @@ class ScanningStep extends React.Component {
         };
     }
     componentDidMount () {
-        this.props.vm.scan(this.props.extensionId);
+        this.props.vm.scanForPeripheral(this.props.extensionId);
         this.props.vm.on(
             'PERIPHERAL_LIST_UPDATE', this.handlePeripheralListUpdate);
         this.props.vm.on(
@@ -45,7 +45,7 @@ class ScanningStep extends React.Component {
         this.setState({deviceList: peripheralArray});
     }
     handleRefresh () {
-        this.props.vm.scan(this.props.extensionId);
+        this.props.vm.scanForPeripheral(this.props.extensionId);
         this.setState({
             scanning: true,
             deviceList: []
diff --git a/src/lib/blocks.js b/src/lib/blocks.js
index 5896760ea..f6b78b68e 100644
--- a/src/lib/blocks.js
+++ b/src/lib/blocks.js
@@ -209,7 +209,7 @@ export default function (vm) {
     };
 
     ScratchBlocks.FlyoutExtensionCategoryHeader.getExtensionState = function (extensionId) {
-        if (vm.isConnected(extensionId)) {
+        if (vm.getPeripheralIsConnected(extensionId)) {
             return ScratchBlocks.StatusButtonState.READY;
         }
         return ScratchBlocks.StatusButtonState.NOT_READY;
-- 
GitLab