Skip to content

Commit d437ccc

Browse files
authored
Merge pull request #232 from smalruby/mesh_extension
Mesh extension
2 parents 99c4f51 + af39ac2 commit d437ccc

File tree

25 files changed

+295
-392
lines changed

25 files changed

+295
-392
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ before_install:
1919
- '[[ $(node -v) =~ ^v9.*$ ]] || npm install -g npm@latest' # skipped when using node 9
2020
install:
2121
- npm --production=false install
22+
- (cd node_modules/scratch-vm && npm --production=false install && $(npm bin)/webpack --colors --bail --silent)
2223
script:
2324
- npm run test:lint
2425
- npm run test:unit

package-lock.json

Lines changed: 80 additions & 212 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@
119119
"scratch-render": "0.1.0-prerelease.20200228152431",
120120
"scratch-storage": "1.3.2",
121121
"scratch-svg-renderer": "0.2.0-prerelease.20200205003400",
122-
"scratch-vm": "0.2.0-prerelease.20200227204654",
123122
"selenium-webdriver": "3.6.0",
124123
"shelljs": "^0.8.3",
125124
"startaudiocontext": "1.2.1",
@@ -150,6 +149,7 @@
150149
}
151150
},
152151
"dependencies": {
153-
"lodash.camelcase": "^4.3.0"
152+
"lodash.camelcase": "^4.3.0",
153+
"scratch-vm": "github:smalruby/scratch-vm#mesh_extension"
154154
}
155155
}

src/components/alerts/alert.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const AlertComponent = ({
5858
id="gui.alerts.lostPeripheralConnection"
5959
values={{
6060
extensionName: (
61-
`${extensionName}`
61+
extensionName
6262
)
6363
}}
6464
/>
@@ -120,7 +120,7 @@ const AlertComponent = ({
120120
AlertComponent.propTypes = {
121121
closeButton: PropTypes.bool,
122122
content: PropTypes.oneOfType([PropTypes.element, PropTypes.string]),
123-
extensionName: PropTypes.string,
123+
extensionName: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
124124
iconSpinner: PropTypes.bool,
125125
iconURL: PropTypes.string,
126126
level: PropTypes.string,

src/components/connection-modal/connected-step.jsx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,24 @@ const ConnectedStep = props => (
1717
className={styles.peripheralActivityIcon}
1818
src={props.connectionIconURL}
1919
/>
20-
<img
21-
className={styles.bluetoothConnectedIcon}
22-
src={bluetoothIcon}
23-
/>
20+
{props.extensionId !== 'mesh' && (
21+
<img
22+
className={styles.bluetoothConnectedIcon}
23+
src={bluetoothIcon}
24+
/>
25+
)}
2426
</div>
2527
</Box>
2628
</Box>
2729
<Box className={styles.bottomArea}>
2830
<Box className={classNames(styles.bottomAreaItem, styles.instructions)}>
29-
<FormattedMessage
30-
defaultMessage="Connected"
31-
description="Message indicating that a device was connected"
32-
id="gui.connection.connected"
33-
/>
31+
{props.connectedMessage || (
32+
<FormattedMessage
33+
defaultMessage="Connected"
34+
description="Message indicating that a device was connected"
35+
id="gui.connection.connected"
36+
/>
37+
)}
3438
</Box>
3539
<Dots
3640
success
@@ -64,7 +68,9 @@ const ConnectedStep = props => (
6468
);
6569

6670
ConnectedStep.propTypes = {
71+
connectedMessage: PropTypes.string,
6772
connectionIconURL: PropTypes.string.isRequired,
73+
extensionId: PropTypes.string.isRequired,
6874
onCancel: PropTypes.func,
6975
onDisconnect: PropTypes.func
7076
};

src/components/connection-modal/connecting-step.jsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ const ConnectingStep = props => (
2020
className={styles.peripheralActivityIcon}
2121
src={props.connectionIconURL}
2222
/>
23-
<img
24-
className={styles.bluetoothConnectingIcon}
25-
src={bluetoothIcon}
26-
/>
23+
{props.extensionId !== 'mesh' && (
24+
<img
25+
className={styles.bluetoothConnectingIcon}
26+
src={bluetoothIcon}
27+
/>
28+
)}
2729
</div>
2830
</Box>
2931
</Box>
@@ -64,6 +66,7 @@ const ConnectingStep = props => (
6466
ConnectingStep.propTypes = {
6567
connectingMessage: PropTypes.node.isRequired,
6668
connectionIconURL: PropTypes.string.isRequired,
69+
extensionId: PropTypes.string.isRequired,
6770
onDisconnect: PropTypes.func
6871
};
6972

src/components/connection-modal/connection-modal.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ const ConnectionModalComponent = props => (
4444
);
4545

4646
ConnectionModalComponent.propTypes = {
47+
connectedMessage: PropTypes.string,
4748
connectingMessage: PropTypes.node.isRequired,
4849
connectionSmallIconURL: PropTypes.string,
4950
connectionTipIconURL: PropTypes.string,
51+
extensionId: PropTypes.string.isRequired,
5052
name: PropTypes.node,
5153
onCancel: PropTypes.func.isRequired,
5254
onHelp: PropTypes.func.isRequired,

src/components/modal/modal.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const ModalComponent = props => (
1919
className={classNames(styles.modalContent, props.className, {
2020
[styles.fullScreen]: props.fullScreen
2121
})}
22-
contentLabel={props.contentLabel}
22+
contentLabel={props.contentLabel.toString()}
2323
overlayClassName={styles.modalOverlay}
2424
onRequestClose={props.onRequestClose}
2525
>

src/containers/alert.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Alert.propTypes = {
7777
closeButton: PropTypes.bool,
7878
content: PropTypes.element,
7979
extensionId: PropTypes.string,
80-
extensionName: PropTypes.string,
80+
extensionName: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
8181
iconSpinner: PropTypes.bool,
8282
iconURL: PropTypes.string,
8383
index: PropTypes.number,

src/containers/connection-modal.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ class ConnectionModal extends React.Component {
2323
this.state = {
2424
extension: extensionData.find(ext => ext.extensionId === props.extensionId),
2525
phase: props.vm.getPeripheralIsConnected(props.extensionId) ?
26-
PHASES.connected : PHASES.scanning
26+
PHASES.connected : PHASES.scanning,
27+
connectedMessage: props.vm.getPeripheralConnectedMessage(props.extensionId)
2728
};
2829
}
2930
componentDidMount () {
@@ -88,7 +89,8 @@ class ConnectionModal extends React.Component {
8889
}
8990
handleConnected () {
9091
this.setState({
91-
phase: PHASES.connected
92+
phase: PHASES.connected,
93+
connectedMessage: this.props.vm.getPeripheralConnectedMessage(this.props.extensionId)
9294
});
9395
analytics.event({
9496
category: 'extensions',
@@ -114,6 +116,7 @@ class ConnectionModal extends React.Component {
114116
extensionId={this.props.extensionId}
115117
name={this.state.extension && this.state.extension.name}
116118
phase={this.state.phase}
119+
connectedMessage={this.state.connectedMessage}
117120
title={this.props.extensionId}
118121
useAutoScan={this.state.extension && this.state.extension.useAutoScan}
119122
vm={this.props.vm}

0 commit comments

Comments
 (0)