Commit a0ca3193 authored by Gordon Seto's avatar Gordon Seto Committed by Chromium LUCI CQ

[CrOS Settings] Implement UI for confirmation code page.

Add UI for confirmation code page and installing profile using a
confirmation code.

Screenshot:
https://screenshot.googleplex.com/BECB5ziR3vFEt6a.png

Bug: 1093185
Change-Id: Iec4fcfb08f501495b640834e404f34dc69b5f9db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2616733
Commit-Queue: Gordon Seto <gordonseto@google.com>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarAzeem Arshad <azeemarshad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841742}
parent 84673ad1
...@@ -360,6 +360,12 @@ ...@@ -360,6 +360,12 @@
<message name="IDS_CELLULAR_SETUP_CLOSE_EID_POPUP_BUTTON_LABEL" desc="A11y and tooltip label for EID and QR code popup close button when viewing EID and QR code popup"> <message name="IDS_CELLULAR_SETUP_CLOSE_EID_POPUP_BUTTON_LABEL" desc="A11y and tooltip label for EID and QR code popup close button when viewing EID and QR code popup">
Close EID and QR code popup Close EID and QR code popup
</message> </message>
<message name="IDS_CELLULAR_SETUP_ESIM_PAGE_CONFIRMATION_CODE_MESSAGE" desc="Message, prompting the user to enter the confirmation code to activate an eSIM profile.">
Please enter your confirmation code for <ph name="PROFILE_NAME">$1<ex>Google Fi</ex></ph>.
</message>
<message name="IDS_CELLULAR_SETUP_ESIM_PAGE_CONFIRMATION_CODE_INPUT" desc="Label for the input used to enter the confirmation code to activate an eSIM profile.">
Confirmation code
</message>
<!-- Upgrade notifications --> <!-- Upgrade notifications -->
<message name="IDS_RELAUNCH_REQUIRED_TITLE_DAYS" desc="The title of a dialog that tells users the device must be restarted within two or more days."> <message name="IDS_RELAUNCH_REQUIRED_TITLE_DAYS" desc="The title of a dialog that tells users the device must be restarted within two or more days.">
......
010932e9ce938b6970f3c0c11b363376d1168b0d
\ No newline at end of file
010932e9ce938b6970f3c0c11b363376d1168b0d
\ No newline at end of file
...@@ -69,7 +69,11 @@ constexpr webui::LocalizedString kLocalizedStringsWithoutPlaceholders[] = { ...@@ -69,7 +69,11 @@ constexpr webui::LocalizedString kLocalizedStringsWithoutPlaceholders[] = {
{"eidPopupTitle", IDS_CELLULAR_SETUP_EID_POPUP_TITLE}, {"eidPopupTitle", IDS_CELLULAR_SETUP_EID_POPUP_TITLE},
{"eidPopupDescription", IDS_CELLULAR_SETUP_EID_POPUP_DESCRIPTION}, {"eidPopupDescription", IDS_CELLULAR_SETUP_EID_POPUP_DESCRIPTION},
{"closeEidPopupButtonLabel", {"closeEidPopupButtonLabel",
IDS_CELLULAR_SETUP_CLOSE_EID_POPUP_BUTTON_LABEL}}; IDS_CELLULAR_SETUP_CLOSE_EID_POPUP_BUTTON_LABEL},
{"confirmationCodeMessage",
IDS_CELLULAR_SETUP_ESIM_PAGE_CONFIRMATION_CODE_MESSAGE},
{"confirmationCodeInput",
IDS_CELLULAR_SETUP_ESIM_PAGE_CONFIRMATION_CODE_INPUT}}; // namespace
struct NamedBoolean { struct NamedBoolean {
const char* name; const char* name;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
// #import {setESimManagerRemoteForTesting} from 'chrome://resources/cr_components/chromeos/cellular_setup/mojo_interface_provider.m.js'; // #import {setESimManagerRemoteForTesting} from 'chrome://resources/cr_components/chromeos/cellular_setup/mojo_interface_provider.m.js';
// #import {ButtonState} from 'chrome://resources/cr_components/chromeos/cellular_setup/cellular_types.m.js'; // #import {ButtonState} from 'chrome://resources/cr_components/chromeos/cellular_setup/cellular_types.m.js';
// #import {ESimPageName} from 'chrome://resources/cr_components/chromeos/cellular_setup/esim_flow_ui.m.js'; // #import {ESimPageName} from 'chrome://resources/cr_components/chromeos/cellular_setup/esim_flow_ui.m.js';
// #import {assertTrue} from '../../../chai_assert.js'; // #import {assertEquals, assertTrue} from '../../../chai_assert.js';
// #import {FakeESimManagerRemote} from './fake_esim_manager_remote.m.js'; // #import {FakeESimManagerRemote} from './fake_esim_manager_remote.m.js';
// #import {FakeCellularSetupDelegate} from './fake_cellular_setup_delegate.m.js'; // #import {FakeCellularSetupDelegate} from './fake_cellular_setup_delegate.m.js';
// clang-format on // clang-format on
...@@ -18,6 +18,12 @@ ...@@ -18,6 +18,12 @@
suite('CrComponentsEsimFlowUiTest', function() { suite('CrComponentsEsimFlowUiTest', function() {
let eSimPage; let eSimPage;
let eSimManagerRemote; let eSimManagerRemote;
let ironPages;
let profileLoadingPage;
let profileDiscoveryPage;
let activationCodePage;
let confirmationCodePage;
let finalPage;
async function flushAsync() { async function flushAsync() {
Polymer.dom.flush(); Polymer.dom.flush();
...@@ -34,11 +40,24 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -34,11 +40,24 @@ suite('CrComponentsEsimFlowUiTest', function() {
eSimPage.initSubflow(); eSimPage.initSubflow();
document.body.appendChild(eSimPage); document.body.appendChild(eSimPage);
Polymer.dom.flush(); Polymer.dom.flush();
ironPages = eSimPage.$$('iron-pages');
profileLoadingPage = eSimPage.$$('#profileLoadingPage');
profileDiscoveryPage = eSimPage.$$('#profileDiscoveryPage');
activationCodePage = eSimPage.$$('#activationCodePage');
confirmationCodePage = eSimPage.$$('#confirmationCodePage');
finalPage = eSimPage.$$('#finalPage');
assertTrue(!!profileLoadingPage);
assertTrue(!!profileDiscoveryPage);
assertTrue(!!activationCodePage);
assertTrue(!!confirmationCodePage);
assertTrue(!!finalPage);
}); });
function assertSelectedPage(pageName, page) { function assertSelectedPage(pageName, page) {
assertTrue(eSimPage.selectedESimPageName_ === pageName); assertEquals(ironPages.selected, pageName);
assertTrue(eSimPage.selectedESimPageName_ === page.id); assertEquals(ironPages.selected, page.id);
} }
test('No eSIM profile flow invalid activation code', async function() { test('No eSIM profile flow invalid activation code', async function() {
...@@ -48,14 +67,6 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -48,14 +67,6 @@ suite('CrComponentsEsimFlowUiTest', function() {
chromeos.cellularSetup.mojom.ProfileInstallResult chromeos.cellularSetup.mojom.ProfileInstallResult
.kErrorInvalidActivationCode); .kErrorInvalidActivationCode);
const profileLoadingPage = eSimPage.$$('#profileLoadingPage');
const activationCodePage = eSimPage.$$('#activationCodePage');
const finalPage = eSimPage.$$('#finalPage');
assertTrue(!!profileLoadingPage);
assertTrue(!!activationCodePage);
assertTrue(!!finalPage);
// Loading page should be showing. // Loading page should be showing.
assertSelectedPage( assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage); cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage);
...@@ -87,14 +98,6 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -87,14 +98,6 @@ suite('CrComponentsEsimFlowUiTest', function() {
test('No eSIM profile flow valid activation code', async function() { test('No eSIM profile flow valid activation code', async function() {
eSimManagerRemote.addEuiccForTest(0); eSimManagerRemote.addEuiccForTest(0);
const profileLoadingPage = eSimPage.$$('#profileLoadingPage');
const activationCodePage = eSimPage.$$('#activationCodePage');
const finalPage = eSimPage.$$('#finalPage');
assertTrue(!!profileLoadingPage);
assertTrue(!!activationCodePage);
assertTrue(!!finalPage);
// Loading page should be showing. // Loading page should be showing.
assertSelectedPage( assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage); cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage);
...@@ -120,14 +123,61 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -120,14 +123,61 @@ suite('CrComponentsEsimFlowUiTest', function() {
assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage); assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage);
}); });
test('Single eSIM profile flow successful install', async function() { test(
eSimManagerRemote.addEuiccForTest(1); 'No eSIM profile flow valid activation code confirmation code required successful install',
async function() {
eSimManagerRemote.addEuiccForTest(0);
const availableEuiccs = await eSimManagerRemote.getAvailableEuiccs();
availableEuiccs.euiccs[0].setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult
.kErrorNeedsConfirmationCode);
const profileLoadingPage = eSimPage.$$('#profileLoadingPage'); // Loading page should be showing.
const finalPage = eSimPage.$$('#finalPage'); assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage);
assertTrue(!!profileLoadingPage); await flushAsync();
assertTrue(!!finalPage);
// Should now be at the activation code page.
assertSelectedPage(
cellular_setup.ESimPageName.ACTIVATION_CODE, activationCodePage);
// Insert an activation code.
activationCodePage.$$('#activationCode').value = 'ACTIVATION_CODE';
// Next button should now be enabled.
assertTrue(
eSimPage.buttonState.next ===
cellularSetup.ButtonState.SHOWN_AND_ENABLED);
eSimPage.navigateForward();
await flushAsync();
// Confirmation code page should be showing.
assertSelectedPage(
cellular_setup.ESimPageName.CONFIRMATION_CODE,
confirmationCodePage);
availableEuiccs.euiccs[0].setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess);
confirmationCodePage.$$('#confirmationCode').value =
'CONFIRMATION_CODE';
// Next button should now be enabled.
assertTrue(
eSimPage.buttonState.next ===
cellularSetup.ButtonState.SHOWN_AND_ENABLED);
eSimPage.navigateForward();
await flushAsync();
// Should go to final page.
assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage);
});
test('Single eSIM profile flow successful install', async function() {
eSimManagerRemote.addEuiccForTest(1);
// Loading page should be showing. // Loading page should be showing.
assertSelectedPage( assertSelectedPage(
...@@ -147,12 +197,6 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -147,12 +197,6 @@ suite('CrComponentsEsimFlowUiTest', function() {
profileList.profiles[0].setProfileInstallResultForTest( profileList.profiles[0].setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult.kFailure); chromeos.cellularSetup.mojom.ProfileInstallResult.kFailure);
const profileLoadingPage = eSimPage.$$('#profileLoadingPage');
const finalPage = eSimPage.$$('#finalPage');
assertTrue(!!profileLoadingPage);
assertTrue(!!finalPage);
// Loading page should be showing. // Loading page should be showing.
assertSelectedPage( assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage); cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage);
...@@ -164,43 +208,47 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -164,43 +208,47 @@ suite('CrComponentsEsimFlowUiTest', function() {
assertTrue(!!finalPage.$$('.error')); assertTrue(!!finalPage.$$('.error'));
}); });
test('Single eSIM profile flow confirmation code required', async function() { test(
eSimManagerRemote.addEuiccForTest(1); 'Single eSIM profile flow confirmation code required successful install',
const availableEuiccs = await eSimManagerRemote.getAvailableEuiccs(); async function() {
const profileList = await availableEuiccs.euiccs[0].getProfileList(); eSimManagerRemote.addEuiccForTest(1);
profileList.profiles[0].setProfileInstallResultForTest( const availableEuiccs = await eSimManagerRemote.getAvailableEuiccs();
chromeos.cellularSetup.mojom.ProfileInstallResult const profileList = await availableEuiccs.euiccs[0].getProfileList();
.kErrorNeedsConfirmationCode); profileList.profiles[0].setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult
.kErrorNeedsConfirmationCode);
const profileLoadingPage = eSimPage.$$('#profileLoadingPage'); // Loading page should be showing.
const confirmationCodePage = eSimPage.$$('#confirmationCodePage'); assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage);
assertTrue(!!profileLoadingPage); await flushAsync();
assertTrue(!!confirmationCodePage);
// Loading page should be showing. // Confirmation code page should be showing.
assertSelectedPage( assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage); cellular_setup.ESimPageName.CONFIRMATION_CODE,
confirmationCodePage);
await flushAsync(); profileList.profiles[0].setProfileInstallResultForTest(
chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess);
confirmationCodePage.$$('#confirmationCode').value =
'CONFIRMATION_CODE';
// Confirmation code page should be showing. // Next button should now be enabled.
assertSelectedPage( assertTrue(
cellular_setup.ESimPageName.CONFIRMATION_CODE, confirmationCodePage); eSimPage.buttonState.next ===
}); cellularSetup.ButtonState.SHOWN_AND_ENABLED);
test('Multiple eSIM profiles skip discovery flow', async function() { eSimPage.navigateForward();
eSimManagerRemote.addEuiccForTest(2);
const profileLoadingPage = eSimPage.$$('#profileLoadingPage'); await flushAsync();
const profileDiscoveryPage = eSimPage.$$('#profileDiscoveryPage');
const activationCodePage = eSimPage.$$('#activationCodePage');
const finalPage = eSimPage.$$('#finalPage');
assertTrue(!!profileLoadingPage); // Should go to final page.
assertTrue(!!profileDiscoveryPage); assertSelectedPage(cellular_setup.ESimPageName.FINAL, finalPage);
assertTrue(!!activationCodePage); });
assertTrue(!!finalPage);
test('Multiple eSIM profiles skip discovery flow', async function() {
eSimManagerRemote.addEuiccForTest(2);
// Loading page should be showing. // Loading page should be showing.
assertSelectedPage( assertSelectedPage(
...@@ -240,16 +288,6 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -240,16 +288,6 @@ suite('CrComponentsEsimFlowUiTest', function() {
test('Multiple eSIM profiles select flow', async function() { test('Multiple eSIM profiles select flow', async function() {
eSimManagerRemote.addEuiccForTest(2); eSimManagerRemote.addEuiccForTest(2);
const profileLoadingPage = eSimPage.$$('#profileLoadingPage');
const profileDiscoveryPage = eSimPage.$$('#profileDiscoveryPage');
const activationCodePage = eSimPage.$$('#activationCodePage');
const finalPage = eSimPage.$$('#finalPage');
assertTrue(!!profileLoadingPage);
assertTrue(!!profileDiscoveryPage);
assertTrue(!!activationCodePage);
assertTrue(!!finalPage);
// Loading page should be showing. // Loading page should be showing.
assertSelectedPage( assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage); cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage);
...@@ -292,14 +330,6 @@ suite('CrComponentsEsimFlowUiTest', function() { ...@@ -292,14 +330,6 @@ suite('CrComponentsEsimFlowUiTest', function() {
chromeos.cellularSetup.mojom.ProfileInstallResult chromeos.cellularSetup.mojom.ProfileInstallResult
.kErrorNeedsConfirmationCode); .kErrorNeedsConfirmationCode);
const profileLoadingPage = eSimPage.$$('#profileLoadingPage');
const profileDiscoveryPage = eSimPage.$$('#profileDiscoveryPage');
const confirmationCodePage = eSimPage.$$('#confirmationCodePage');
assertTrue(!!profileLoadingPage);
assertTrue(!!profileDiscoveryPage);
assertTrue(!!confirmationCodePage);
// Loading page should be showing. // Loading page should be showing.
assertSelectedPage( assertSelectedPage(
cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage); cellular_setup.ESimPageName.PROFILE_LOADING, profileLoadingPage);
......
...@@ -38,6 +38,7 @@ generate_grd("build_grdp") { ...@@ -38,6 +38,7 @@ generate_grd("build_grdp") {
"chromeos/cellular_setup/psim_2x.png", "chromeos/cellular_setup/psim_2x.png",
"chromeos/cellular_setup/esim_1x.png", "chromeos/cellular_setup/esim_1x.png",
"chromeos/cellular_setup/esim_2x.png", "chromeos/cellular_setup/esim_2x.png",
"chromeos/cellular_setup/default_esim_profile.svg",
"chromeos/network/cellular_0_with_x.svg", "chromeos/network/cellular_0_with_x.svg",
"chromeos/network/cellular_0.svg", "chromeos/network/cellular_0.svg",
"chromeos/network/cellular_1.svg", "chromeos/network/cellular_1.svg",
......
...@@ -6,11 +6,43 @@ ...@@ -6,11 +6,43 @@
<dom-module id="confirmation-code-page"> <dom-module id="confirmation-code-page">
<template> <template>
<style include="iron-flex"> <style include="iron-flex">
[slot='page-body'] {
margin-top: -20px;
}
#details {
align-items: center;
color: var(--cr-primary-text-color);
display: flex;
margin-bottom: 40px;
margin-top: 60px;
}
#profileImage {
margin-inline-end: 16px;
}
#confirmationCode {
margin-inline-end: 16px;
}
</style> </style>
<base-page> <base-page>
<div slot="page-body" class="layout horizontal center-center"> <div slot="page-body">
<!-- TODO(crbug.com/1093185): Create UI for confirmation code page. --> <!-- TODO(crbug.com/1093185): Handle activation code case where
Please enter your confirmation code for [[getProfileName_(profileProperties_)]]. we don't have profileProperties_. -->
<div id="description">[[getMessage_(profileProperties_)]]</div>
<div id="details">
<!-- TODO(crbug.com/1093185): Update with real profile image. -->
<img id="profileImage" src="default_esim_profile.svg">
<div>
[[getProfileName_(profileProperties_)]]
</div>
</div>
<cr-input id="confirmationCode"
label="[[i18n('confirmationCodeInput')]]"
value="{{confirmationCode}}"
aria-describedby="description">
</cr-input>
</div> </div>
</base-page> </base-page>
</template> </template>
......
...@@ -21,6 +21,11 @@ Polymer({ ...@@ -21,6 +21,11 @@ Polymer({
observer: 'onProfileChanged_', observer: 'onProfileChanged_',
}, },
confirmationCode: {
type: String,
notify: true,
},
/** /**
* @type {?chromeos.cellularSetup.mojom.ESimProfileProperties} * @type {?chromeos.cellularSetup.mojom.ESimProfileProperties}
* @private * @private
...@@ -42,6 +47,18 @@ Polymer({ ...@@ -42,6 +47,18 @@ Polymer({
}); });
}, },
/**
* @return {string}
* @private
*/
getMessage_() {
const profileName = this.getProfileName_();
if (!profileName) {
return '';
}
return this.i18n('confirmationCodeMessage', profileName);
},
/** /**
* @return {string} * @return {string}
* @private * @private
......
<svg width="31" height="20" viewBox="0 0 31 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M4 2a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h23a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H4zm7.704 10.915h-3.55V6.18h-1.36V14h4.91v-1.085zm4.254-5.64h2.438V6.18h-6.203v1.095h2.417V14h1.348V7.275zm4.823 3.234h3.212V9.435h-3.212v-2.16h3.717V6.18h-5.076V14h5.114v-1.085H20.78v-2.406z" fill="#5F6368"/></svg>
\ No newline at end of file
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
show-error="{{showError_}}"> show-error="{{showError_}}">
</activation-code-page> </activation-code-page>
<confirmation-code-page id="confirmationCodePage" <confirmation-code-page id="confirmationCodePage"
confirmation-code="{{confirmationCode_}}"
profile="[[selectedProfile_]]"> profile="[[selectedProfile_]]">
</confirmation-code-page> </confirmation-code-page>
<final-page <final-page
......
...@@ -88,6 +88,13 @@ cr.define('cellular_setup', function() { ...@@ -88,6 +88,13 @@ cr.define('cellular_setup', function() {
type: String, type: String,
value: '', value: '',
}, },
/** @private */
confirmationCode_: {
type: String,
value: '',
observer: 'onConfirmationCodeUpdated_',
},
}, },
/** /**
...@@ -162,6 +169,7 @@ cr.define('cellular_setup', function() { ...@@ -162,6 +169,7 @@ cr.define('cellular_setup', function() {
* response * response
*/ */
handleProfileInstallResponse_(response) { handleProfileInstallResponse_(response) {
// TODO(crbug.com/1093185) Handle error during confirmation code page.
this.showError_ = response.result !== this.showError_ = response.result !==
chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess; chromeos.cellularSetup.mojom.ProfileInstallResult.kSuccess;
if (response.result === if (response.result ===
...@@ -224,11 +232,11 @@ cr.define('cellular_setup', function() { ...@@ -224,11 +232,11 @@ cr.define('cellular_setup', function() {
cancel: this.delegate.shouldShowCancelButton() ? cancel: this.delegate.shouldShowCancelButton() ?
cellularSetup.ButtonState.SHOWN_AND_ENABLED : cellularSetup.ButtonState.SHOWN_AND_ENABLED :
cellularSetup.ButtonState.HIDDEN, cellularSetup.ButtonState.HIDDEN,
done: cellularSetup.ButtonState.SHOWN_AND_ENABLED, done: cellularSetup.ButtonState.HIDDEN,
next: cellularSetup.ButtonState.HIDDEN, // TODO(crbug.com/1093185) Add a "Confirm" button state.
next: cellularSetup.ButtonState.SHOWN_BUT_DISABLED,
tryAgain: cellularSetup.ButtonState.HIDDEN, tryAgain: cellularSetup.ButtonState.HIDDEN,
skipDiscovery: cellularSetup.ButtonState.HIDDEN, skipDiscovery: cellularSetup.ButtonState.HIDDEN,
// TODO(crbug.com/1093185) Add a "Confirm" button state.
}; };
break; break;
case ESimUiState.PROFILE_SELECTION: case ESimUiState.PROFILE_SELECTION:
...@@ -285,6 +293,20 @@ cr.define('cellular_setup', function() { ...@@ -285,6 +293,20 @@ cr.define('cellular_setup', function() {
} }
}, },
/** @private */
onConfirmationCodeUpdated_() {
// TODO(crbug.com/1093185) Change this to updating a "Confirm" button's
// state.
if (this.confirmationCode_) {
this.set(
'buttonState.next', cellularSetup.ButtonState.SHOWN_AND_ENABLED);
} else {
this.set(
'buttonState.next', cellularSetup.ButtonState.SHOWN_BUT_DISABLED);
}
},
/** SubflowBehavior override */
navigateForward() { navigateForward() {
switch (this.state_) { switch (this.state_) {
case ESimUiState.ACTIVATION_CODE_ENTRY: case ESimUiState.ACTIVATION_CODE_ENTRY:
...@@ -297,12 +319,25 @@ cr.define('cellular_setup', function() { ...@@ -297,12 +319,25 @@ cr.define('cellular_setup', function() {
break; break;
case ESimUiState.PROFILE_SELECTION: case ESimUiState.PROFILE_SELECTION:
if (this.selectedProfile_) { if (this.selectedProfile_) {
// Assume installing the profile doesn't require a confirmation
// code, send an empty string.
this.selectedProfile_.installProfile('').then( this.selectedProfile_.installProfile('').then(
this.handleProfileInstallResponse_.bind(this)); this.handleProfileInstallResponse_.bind(this));
} else { } else {
this.state_ = ESimUiState.ACTIVATION_CODE_ENTRY; this.state_ = ESimUiState.ACTIVATION_CODE_ENTRY;
} }
break; break;
case ESimUiState.CONFIRMATION_CODE_ENTRY:
if (this.selectedProfile_) {
this.selectedProfile_.installProfile(this.confirmationCode_)
.then(this.handleProfileInstallResponse_.bind(this));
} else {
this.euicc_
.installProfileFromActivationCode(
this.activationCode_, this.confirmationCode_)
.then(this.handleProfileInstallResponse_.bind(this));
}
break;
default: default:
assertNotReached(); assertNotReached();
break; break;
...@@ -311,6 +346,7 @@ cr.define('cellular_setup', function() { ...@@ -311,6 +346,7 @@ cr.define('cellular_setup', function() {
/** /**
* @returns {boolean} true if backward navigation was handled * @returns {boolean} true if backward navigation was handled
* SubflowBehavior override
*/ */
attemptBackwardNavigation() { attemptBackwardNavigation() {
// TODO(crbug.com/1093185): Handle state when camera is used // TODO(crbug.com/1093185): Handle state when camera is used
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment