Moved navigation inside of Android Device
Summary: It makes more sense for the navigation ability to be inside the Device's class instead of scattered throughout the rest of the app. I have moved the Android navigation logic inside the AndroidDevice and added a function stub to BaseDevice. I also encoded the URI as an initial safeguard to injection attacks via adb, but will remove this altogether once I enable navigation through the socket connection. Reviewed By: jknoxville Differential Revision: D16182374 fbshipit-source-id: be3c6d1cfcbe293583edada1f77c023965dfd12c
This commit is contained in:
committed by
Facebook Github Bot
parent
ee5091c742
commit
222676eb44
@@ -28,9 +28,8 @@ const DropdownButton = styled(Button)({
|
|||||||
class LocationsButton extends Component<Props> {
|
class LocationsButton extends Component<Props> {
|
||||||
goToLocation = (location: string) => {
|
goToLocation = (location: string) => {
|
||||||
const {selectedDevice} = this.props;
|
const {selectedDevice} = this.props;
|
||||||
if (selectedDevice instanceof AndroidDevice) {
|
if (selectedDevice != null) {
|
||||||
const shellCommand = `am start ${location}`;
|
selectedDevice.navigateToLocation(location);
|
||||||
selectedDevice.adb.shell(selectedDevice.serial, shellCommand);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -97,4 +97,9 @@ export default class AndroidDevice extends BaseDevice {
|
|||||||
[...this.logEntries],
|
[...this.logEntries],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
navigateToLocation(location: string) {
|
||||||
|
const shellCommand = `am start ${encodeURI(location)}`;
|
||||||
|
this.adb.shell(this.serial, shellCommand);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,6 +139,10 @@ export default class BaseDevice {
|
|||||||
throw new Error('unimplemented');
|
throw new Error('unimplemented');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
navigateToLocation(location: string) {
|
||||||
|
throw new Error('unimplemented');
|
||||||
|
}
|
||||||
|
|
||||||
archive(): ?ArchivedDevice {
|
archive(): ?ArchivedDevice {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user