Commit 8e105b16 authored by Curt Clemens's avatar Curt Clemens Committed by Chromium LUCI CQ

[Nearby] Add "Please try again" to error strings, add blue close button

Some error states are best resolved by trying again, so add that
message to those error strings.

On error, replace the white "Cancel" button with a blue "Close" button
to help indicate that the process is finished and closing the dialog
is the only way forward.

Also update the info string on the discovery page.

Bug: 1148581
Change-Id: Id8070de2fdc59a56a7d83d2196bc288452e558b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2570337
Commit-Queue: Curt Clemens <cclem@google.com>
Reviewed-by: default avatarJames Vecore <vecore@google.com>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834525}
parent 937900aa
......@@ -69,7 +69,7 @@
<!-- Discovery page -->
<message name="IDS_NEARBY_DISCOVERY_PAGE_INFO" desc="Help text on how to use the Nearby Share feature. Explains how to enable it on a nearby Chromebook to share with it.">
Make sure both devices are unlocked, close together, and have Bluetooth turned on. If you’re sharing with a Chromebook, make sure it has Nearby Sharing turned on (open the status area by selecting the time, then select Nearby Share). <ph name="LINK_BEGIN">&lt;a&gt;</ph>Learn more<ph name="LINK_END">&lt;/a&gt;</ph>
Make sure both devices are unlocked, close together, and have Bluetooth turned on. If you’re sharing with a Chromebook not in your contacts, make sure it has Nearby visibility turned on (open the status area by selecting the time, then select Nearby visibility). <ph name="LINK_BEGIN">&lt;a&gt;</ph>Learn more<ph name="LINK_END">&lt;/a&gt;</ph>
</message>
<message name="IDS_NEARBY_DISCOVERY_PAGE_SUBTITLE" desc="Subtitle of the Nearby Share device discovery page. This is where users select a device to share files with.">
Select the device you’d like to share files with
......@@ -113,6 +113,9 @@
<message name="IDS_NEARBY_ACTIONS_CANCEL" desc="Action button text to cancel the current step in the Nearby Share UI.">
Cancel
</message>
<message name="IDS_NEARBY_ACTIONS_CLOSE" desc="Action button text to close the dialog. Shown when the process is complete or failed due to error.">
Close
</message>
<message name="IDS_NEARBY_ACTIONS_CONFIRM" desc="Action button text to confirm a transfer in the Nearby Share UI.">
Confirm
</message>
......@@ -128,8 +131,8 @@
<message name="IDS_NEARBY_ERROR_CANT_SHARE" desc="Notify user that the file wasn't able to be shared. Generic title text for displaying errors to the user. To be shown next to more specific error text.">
Can't share
</message>
<message name="IDS_NEARBY_ERROR_NO_RESPONSE" desc="Notify user that the file share failed because the receiver neither accepted nor declined the share.">
The device you're sharing with didn't respond
<message name="IDS_NEARBY_ERROR_NO_RESPONSE" desc="Notify user that the file share failed because the receiver neither accepted nor declined the share. Suggest trying again.">
The device you're sharing with didn't respond. Please try again.
</message>
<message name="IDS_NEARBY_ERROR_NOT_ENOUGH_SPACE" desc="Notify user that the file can't be shared because there isn't enough disk space to store it. Displayed as a subtitle under a more generic file-couldn't-be-shared message.">
Not enough disk space
......@@ -137,8 +140,8 @@
<message name="IDS_NEARBY_ERROR_REJECTED" desc="Notify sender that receiver declined the file share.">
The device you’re trying to share with did not accept
</message>
<message name="IDS_NEARBY_ERROR_SOMETHING_WRONG" desc="Generic error text shown when the reason for the failure is unknown or too technical to explain.">
Something went wrong
<message name="IDS_NEARBY_ERROR_SOMETHING_WRONG" desc="Generic error text shown when the reason for the failure is unknown or too technical to explain. Suggest trying again.">
Something went wrong. Please try again.
</message>
<message name="IDS_NEARBY_ERROR_TIME_OUT" desc="Notify user that the file share failed because something didn't happen in time, e.g. the receiver neither accepted nor declined the share. Generic title text to be shown next to more specific error text describing the situation.">
Time out
......
93c31f041c0e3998f62f5498c463efcac003d13c
\ No newline at end of file
2ee345a76fb36c02485d4dd7afe01e4a44b2fe44
\ No newline at end of file
ca62ef5bb132403e22abbe5e03f1f4966fb4d01e
\ No newline at end of file
f38db7627a182411870be8280cf02595d1fd04e5
\ No newline at end of file
93c31f041c0e3998f62f5498c463efcac003d13c
\ No newline at end of file
8c1def7ee1cc0e81f4c65b1bfc75404030354276
\ No newline at end of file
830d82dfe712b7a3b761710c0948bf25543cd76d
\ No newline at end of file
......@@ -86,7 +86,8 @@
action-button-label="[[getActionButtonLabel_(needsConfirmation_)]]"
action-button-event-name="accept"
cancel-button-label="[[getCancelButtonLabel_(needsConfirmation_)]]"
cancel-button-event-name="[[getCancelEventName_(needsConfirmation_)]]">
cancel-button-event-name="[[getCancelEventName_(needsConfirmation_)]]"
close-only="[[errorTitle_]]">
<div id="centerContent" slot="content">
<div id="processRow">
<div id="processRowContent">
......
......@@ -142,7 +142,8 @@
action-button-event-name="next"
action-disabled="[[!selectedShareTarget]]"
cancel-button-label="$i18n{nearbyShareActionsCancel}"
cancel-button-event-name="close">
cancel-button-event-name="close"
close-only="[[errorTitle_]]">
<div id="centerContent" slot="content">
<cr-lottie animation-url="nearby_share_pulse_animation.json"
autoplay="true">
......
......@@ -70,23 +70,32 @@
</div>
<div id="actions">
<template is="dom-if" if="[[utilityButtonLabel]]">
<cr-button id="utilityButton" class="cancel-button"
on-click="onUtilityClick_" aria-label="[[utilityButtonLabel]]">
[[utilityButtonLabel]]
</cr-button>
</template>
<template is="dom-if" if="[[cancelButtonLabel]]">
<cr-button id="cancelButton" class="cancel-button"
on-click="onCancelClick_" aria-label="[[cancelButtonLabel]]">
[[cancelButtonLabel]]
</cr-button>
<template is="dom-if" if="[[!closeOnly]]">
<template is="dom-if" if="[[utilityButtonLabel]]">
<cr-button id="utilityButton" class="cancel-button"
on-click="onUtilityClick_" aria-label="[[utilityButtonLabel]]">
[[utilityButtonLabel]]
</cr-button>
</template>
<template is="dom-if" if="[[cancelButtonLabel]]">
<cr-button id="cancelButton" class="cancel-button"
on-click="onCancelClick_" aria-label="[[cancelButtonLabel]]">
[[cancelButtonLabel]]
</cr-button>
</template>
<template is="dom-if" if="[[actionButtonLabel]]">
<cr-button id="actionButton" class="action-button"
on-click="onActionClick_" disabled="[[actionDisabled]]"
aria-label="[[actionButtonLabel]]">
[[actionButtonLabel]]
</cr-button>
</template>
</template>
<template is="dom-if" if="[[actionButtonLabel]]">
<cr-button id="actionButton" class="action-button"
on-click="onActionClick_" disabled="[[actionDisabled]]"
aria-label="[[actionButtonLabel]]">
[[actionButtonLabel]]
<template is="dom-if" if="[[closeOnly]]">
<cr-button id="closeButton" class="action-button"
on-click="onCloseClick_"
aria-label="$i18n{nearbyShareActionsClose}">
$i18n{nearbyShareActionsClose}
</cr-button>
</template>
</div>
......
......@@ -21,23 +21,28 @@ Polymer({
type: String,
},
/** @type {?string} */
/**
* Text to show on the action button. If either this is falsey, or if
* |closeOnly| is true, then the action button is hidden.
* @type {?string}
* */
actionButtonLabel: {
type: String,
},
/** @type {string} */
actionButtonEventName: {
type: String,
value: 'action'
},
actionButtonEventName: {type: String, value: 'action'},
actionDisabled: {
type: Boolean,
value: false,
},
/** @type {?string} */
/**
* Text to show on the cancel button. If either this is falsey, or if
* |closeOnly| is true, then the cancel button is hidden.
* @type {?string}
* */
cancelButtonLabel: {
type: String,
},
......@@ -48,7 +53,11 @@ Polymer({
value: 'cancel',
},
/** @type {?string} */
/**
* Text to show on the utility button. If either this is falsey, or if
* |closeOnly| is true, then the utility button is hidden.
* @type {?string}
* */
utilityButtonLabel: {
type: String,
},
......@@ -57,7 +66,16 @@ Polymer({
utilityButtonEventName: {
type: String,
value: 'utility',
}
},
/**
* When true, hide all other buttons and show a close button.
* @type {boolean}
* */
closeOnly: {
type: Boolean,
value: false,
},
},
/** @private */
......@@ -74,4 +92,9 @@ Polymer({
onUtilityClick_() {
this.fire(this.utilityButtonEventName);
},
/** @private */
onCloseClick_() {
this.fire('close');
},
});
......@@ -16,6 +16,7 @@ void RegisterNearbySharedStrings(content::WebUIDataSource* data_source) {
static constexpr webui::LocalizedString kLocalizedStrings[] = {
{"nearbyShareAccountRowLabel", IDS_NEARBY_ACCOUNT_ROW_LABEL},
{"nearbyShareActionsCancel", IDS_NEARBY_ACTIONS_CANCEL},
{"nearbyShareActionsClose", IDS_NEARBY_ACTIONS_CLOSE},
{"nearbyShareActionsConfirm", IDS_NEARBY_ACTIONS_CONFIRM},
{"nearbyShareActionsNext", IDS_NEARBY_ACTIONS_NEXT},
{"nearbyShareActionsReject", IDS_NEARBY_ACTIONS_REJECT},
......
......@@ -36,6 +36,7 @@ suite('nearby-page-template', function() {
assertFalse(isVisible('#utilityButton'));
assertFalse(isVisible('#actionButton'));
assertFalse(isVisible('#cancelButton'));
assertFalse(isVisible('#closeButton'));
});
test('Everything on', async function() {
......@@ -52,6 +53,7 @@ suite('nearby-page-template', function() {
assertTrue(isVisible('#utilityButton'));
assertTrue(isVisible('#actionButton'));
assertTrue(isVisible('#cancelButton'));
assertFalse(isVisible('#closeButton'));
/** @type {boolean} */
let utilityTriggered = false;
......@@ -74,4 +76,28 @@ suite('nearby-page-template', function() {
element.$$('#actionButton').click();
assertTrue(actionTrigger);
});
test('Close only', async function() {
element.title = 'title';
element.subTitle = 'subTitle';
element.utilityButtonLabel = 'utility';
element.cancelButtonLabel = 'cancel';
element.actionButtonLabel = 'action';
element.closeOnly = true;
await test_util.waitAfterNextRender(element);
assertEquals('title', element.$$('#pageTitle').innerHTML.trim());
assertEquals('subTitle', element.$$('#pageSubTitle').innerHTML.trim());
assertFalse(isVisible('#utilityButton'));
assertFalse(isVisible('#actionButton'));
assertFalse(isVisible('#cancelButton'));
assertTrue(isVisible('#closeButton'));
/** @type {boolean} */
let closeTrigger = false;
element.addEventListener('close', () => closeTrigger = true);
element.$$('#closeButton').click();
assertTrue(closeTrigger);
});
});
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