From f4cd351353207bf781c4ea806b092e1dbc1fa52a Mon Sep 17 00:00:00 2001 From: Evelyn Eastmond <evhan55@gmail.com> Date: Tue, 28 Aug 2018 15:33:20 -0400 Subject: [PATCH] Beginning refactor: changing 'device' to 'peripheral', shortening some function names, etc. --- src/containers/auto-scanning-step.jsx | 2 +- src/containers/connection-modal.jsx | 4 ++-- src/containers/scanning-step.jsx | 4 ++-- src/lib/blocks.js | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/containers/auto-scanning-step.jsx b/src/containers/auto-scanning-step.jsx index f8c0360a3..e5cdf457d 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.startDeviceScan(this.props.extensionId); + this.props.vm.scan(this.props.extensionId); this.setState({ phase: PHASES.pressbutton }); diff --git a/src/containers/connection-modal.jsx b/src/containers/connection-modal.jsx index 276d4f72a..9471ccc96 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.getPeripheralIsConnected(props.extensionId) ? + phase: props.vm.isConnected(props.extensionId) ? PHASES.connected : PHASES.scanning }; } @@ -52,7 +52,7 @@ class ConnectionModal extends React.Component { } handleCancel () { // If we're not connected to a device, close the websocket so we stop scanning. - if (!this.props.vm.getPeripheralIsConnected(this.props.extensionId)) { + if (!this.props.vm.isConnected(this.props.extensionId)) { this.props.vm.disconnectExtensionSession(this.props.extensionId); } this.props.onCancel(); diff --git a/src/containers/scanning-step.jsx b/src/containers/scanning-step.jsx index 07595d526..f83a7d3f2 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.startDeviceScan(this.props.extensionId); + this.props.vm.scan(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.startDeviceScan(this.props.extensionId); + this.props.vm.scan(this.props.extensionId); this.setState({ scanning: true, deviceList: [] diff --git a/src/lib/blocks.js b/src/lib/blocks.js index f6b78b68e..5896760ea 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.getPeripheralIsConnected(extensionId)) { + if (vm.isConnected(extensionId)) { return ScratchBlocks.StatusButtonState.READY; } return ScratchBlocks.StatusButtonState.NOT_READY; -- GitLab