From 88eeb54cff20b721e5140aeb1dd1778301e92fd6 Mon Sep 17 00:00:00 2001 From: JGibson2019 Date: Fri, 12 Jun 2020 08:43:40 -0700 Subject: [PATCH 01/71] feat(android-setup): prompt-connected-start-testing step UI (#2867) * added everything to the prompt-connected-start-testing-step and updated renderInitializer to allow us to trigger scanning from the android setup view * updated the prompt-connected-start-testing-step test files and snapshots; also made some styling changes to the dialog itself --- .../android-setup/android-setup-types.ts | 1 + .../default-android-setup-components.ts | 2 + .../prompt-connected-start-testing-step.scss | 12 +++ .../prompt-connected-start-testing-step.tsx | 59 +++++++++++++++ src/electron/views/renderer-initializer.ts | 6 ++ .../android-setup-step-props-builder.tsx | 1 + ...android-setup-step-container.test.tsx.snap | 1 + .../detect-devices-step.test.tsx.snap | 1 + .../detect-service-step.test.tsx.snap | 1 + .../installing-service-step.test.tsx.snap | 1 + ...connected-start-testing-step.test.tsx.snap | 75 +++++++++++++++++++ ...ompt-connected-start-testing-step.test.tsx | 70 +++++++++++++++++ 12 files changed, 230 insertions(+) create mode 100644 src/electron/views/device-connect-view/components/android-setup/prompt-connected-start-testing-step.scss create mode 100644 src/electron/views/device-connect-view/components/android-setup/prompt-connected-start-testing-step.tsx create mode 100644 src/tests/unit/tests/electron/views/device-connect-view/components/android-setup/__snapshots__/prompt-connected-start-testing-step.test.tsx.snap create mode 100644 src/tests/unit/tests/electron/views/device-connect-view/components/android-setup/prompt-connected-start-testing-step.test.tsx diff --git a/src/electron/views/device-connect-view/components/android-setup/android-setup-types.ts b/src/electron/views/device-connect-view/components/android-setup/android-setup-types.ts index 55188b3c15b..384d65dfdc6 100644 --- a/src/electron/views/device-connect-view/components/android-setup/android-setup-types.ts +++ b/src/electron/views/device-connect-view/components/android-setup/android-setup-types.ts @@ -20,6 +20,7 @@ export type AndroidSetupPageDeps = { androidSetupStepComponentProvider: AndroidSetupStepComponentProvider; LinkComponent: LinkComponentType; closeApp: () => void; + startTesting: () => void; }; // 'Partial' is used to allow missing step IDs as they get implemented. diff --git a/src/electron/views/device-connect-view/components/android-setup/default-android-setup-components.ts b/src/electron/views/device-connect-view/components/android-setup/default-android-setup-components.ts index 1ff8b5b88d3..071168920ce 100644 --- a/src/electron/views/device-connect-view/components/android-setup/default-android-setup-components.ts +++ b/src/electron/views/device-connect-view/components/android-setup/default-android-setup-components.ts @@ -7,6 +7,7 @@ import { DetectServiceStep } from 'electron/views/device-connect-view/components import { InstallingServiceStep } from 'electron/views/device-connect-view/components/android-setup/installing-service-step'; import { PromptChooseDeviceStep } from 'electron/views/device-connect-view/components/android-setup/prompt-choose-device-step'; import { PromptConnectToDeviceStep } from 'electron/views/device-connect-view/components/android-setup/prompt-connect-to-device-step'; +import { PromptConnectedStartTestingStep } from 'electron/views/device-connect-view/components/android-setup/prompt-connected-start-testing-step'; import { PromptGrantPermissionsStep } from 'electron/views/device-connect-view/components/android-setup/prompt-grant-permissions-step'; import { PromptInstallFailedStep } from 'electron/views/device-connect-view/components/android-setup/prompt-install-failed-step'; import { PromptInstallServiceStep } from 'electron/views/device-connect-view/components/android-setup/prompt-install-service-step'; @@ -23,4 +24,5 @@ export const defaultAndroidSetupComponents: AndroidSetupStepComponentProvider = 'installing-service': InstallingServiceStep, 'detect-devices': DetectDevicesStep, 'detect-service': DetectServiceStep, + 'prompt-connected-start-testing': PromptConnectedStartTestingStep, }; diff --git a/src/electron/views/device-connect-view/components/android-setup/prompt-connected-start-testing-step.scss b/src/electron/views/device-connect-view/components/android-setup/prompt-connected-start-testing-step.scss new file mode 100644 index 00000000000..517cf667a64 --- /dev/null +++ b/src/electron/views/device-connect-view/components/android-setup/prompt-connected-start-testing-step.scss @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +@import '../../../../../common/styles/fonts.scss'; + +.device-description { + margin-top: 16px; + margin-bottom: 16px; +} + +.rescan-button { + margin-top: 16px; +} diff --git a/src/electron/views/device-connect-view/components/android-setup/prompt-connected-start-testing-step.tsx b/src/electron/views/device-connect-view/components/android-setup/prompt-connected-start-testing-step.tsx new file mode 100644 index 00000000000..9dfbf470ee7 --- /dev/null +++ b/src/electron/views/device-connect-view/components/android-setup/prompt-connected-start-testing-step.tsx @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +import { NamedFC } from 'common/react/named-fc'; +import { + DeviceDescription, + DeviceDescriptionProps, +} from 'electron/views/device-connect-view/components/android-setup/device-description'; +import * as styles from 'electron/views/device-connect-view/components/android-setup/prompt-connected-start-testing-step.scss'; +import { Button } from 'office-ui-fabric-react'; +import * as React from 'react'; + +import { AndroidSetupStepLayout, AndroidSetupStepLayoutProps } from './android-setup-step-layout'; +import { CommonAndroidSetupStepProps } from './android-setup-types'; + +export const PromptConnectedStartTestingStep = NamedFC( + 'PromptConnectedStartTestingStep', + (props: CommonAndroidSetupStepProps) => { + const { LinkComponent } = props.deps; + + const onRescanButton = () => { + // To be implemented in future feature work + console.log(`androidSetupActionCreator.rescanDevices()`); + }; + + const layoutProps: AndroidSetupStepLayoutProps = { + headerText: 'Connected and ready to go!', + moreInfoLink: ( + + How do I connect a different device? + + ), + leftFooterButtonProps: { + text: 'Cancel', + onClick: props.deps.androidSetupActionCreator.cancel, + }, + rightFooterButtonProps: { + text: 'Start testing', + disabled: false, + onClick: props.deps.startTesting, + }, + }; + + const descriptionProps: DeviceDescriptionProps = { + ...props.androidSetupStoreData.selectedDevice, + className: styles.deviceDescription, + }; + + return ( + + +