diff --git a/src/chrome/LocationsButton.js b/src/chrome/LocationsButton.js index dd88b6cc2..4834091df 100644 --- a/src/chrome/LocationsButton.js +++ b/src/chrome/LocationsButton.js @@ -28,9 +28,8 @@ const DropdownButton = styled(Button)({ class LocationsButton extends Component { goToLocation = (location: string) => { const {selectedDevice} = this.props; - if (selectedDevice instanceof AndroidDevice) { - const shellCommand = `am start ${location}`; - selectedDevice.adb.shell(selectedDevice.serial, shellCommand); + if (selectedDevice != null) { + selectedDevice.navigateToLocation(location); } }; diff --git a/src/devices/AndroidDevice.js b/src/devices/AndroidDevice.js index 974bdc6a1..9db48fedc 100644 --- a/src/devices/AndroidDevice.js +++ b/src/devices/AndroidDevice.js @@ -97,4 +97,9 @@ export default class AndroidDevice extends BaseDevice { [...this.logEntries], ); } + + navigateToLocation(location: string) { + const shellCommand = `am start ${encodeURI(location)}`; + this.adb.shell(this.serial, shellCommand); + } } diff --git a/src/devices/BaseDevice.js b/src/devices/BaseDevice.js index 62bdc000e..928270611 100644 --- a/src/devices/BaseDevice.js +++ b/src/devices/BaseDevice.js @@ -139,6 +139,10 @@ export default class BaseDevice { throw new Error('unimplemented'); } + navigateToLocation(location: string) { + throw new Error('unimplemented'); + } + archive(): ?ArchivedDevice { return null; }