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 @@ ...@@ -69,7 +69,7 @@
<!-- Discovery page --> <!-- 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."> <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>
<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."> <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 Select the device you’d like to share files with
...@@ -113,6 +113,9 @@ ...@@ -113,6 +113,9 @@
<message name="IDS_NEARBY_ACTIONS_CANCEL" desc="Action button text to cancel the current step in the Nearby Share UI."> <message name="IDS_NEARBY_ACTIONS_CANCEL" desc="Action button text to cancel the current step in the Nearby Share UI.">
Cancel Cancel
</message> </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."> <message name="IDS_NEARBY_ACTIONS_CONFIRM" desc="Action button text to confirm a transfer in the Nearby Share UI.">
Confirm Confirm
</message> </message>
...@@ -128,8 +131,8 @@ ...@@ -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."> <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 Can't share
</message> </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."> <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 The device you're sharing with didn't respond. Please try again.
</message> </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."> <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 Not enough disk space
...@@ -137,8 +140,8 @@ ...@@ -137,8 +140,8 @@
<message name="IDS_NEARBY_ERROR_REJECTED" desc="Notify sender that receiver declined the file share."> <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 The device you’re trying to share with did not accept
</message> </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."> <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 Something went wrong. Please try again.
</message> </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."> <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 Time out
......
93c31f041c0e3998f62f5498c463efcac003d13c
\ No newline at end of file
2ee345a76fb36c02485d4dd7afe01e4a44b2fe44 ca62ef5bb132403e22abbe5e03f1f4966fb4d01e
\ No newline at end of file \ No newline at end of file
f38db7627a182411870be8280cf02595d1fd04e5 93c31f041c0e3998f62f5498c463efcac003d13c
\ No newline at end of file \ No newline at end of file
8c1def7ee1cc0e81f4c65b1bfc75404030354276 830d82dfe712b7a3b761710c0948bf25543cd76d
\ No newline at end of file \ No newline at end of file
...@@ -86,7 +86,8 @@ ...@@ -86,7 +86,8 @@
action-button-label="[[getActionButtonLabel_(needsConfirmation_)]]" action-button-label="[[getActionButtonLabel_(needsConfirmation_)]]"
action-button-event-name="accept" action-button-event-name="accept"
cancel-button-label="[[getCancelButtonLabel_(needsConfirmation_)]]" 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="centerContent" slot="content">
<div id="processRow"> <div id="processRow">
<div id="processRowContent"> <div id="processRowContent">
......
...@@ -142,7 +142,8 @@ ...@@ -142,7 +142,8 @@
action-button-event-name="next" action-button-event-name="next"
action-disabled="[[!selectedShareTarget]]" action-disabled="[[!selectedShareTarget]]"
cancel-button-label="$i18n{nearbyShareActionsCancel}" cancel-button-label="$i18n{nearbyShareActionsCancel}"
cancel-button-event-name="close"> cancel-button-event-name="close"
close-only="[[errorTitle_]]">
<div id="centerContent" slot="content"> <div id="centerContent" slot="content">
<cr-lottie animation-url="nearby_share_pulse_animation.json" <cr-lottie animation-url="nearby_share_pulse_animation.json"
autoplay="true"> autoplay="true">
......
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
</div> </div>
<div id="actions"> <div id="actions">
<template is="dom-if" if="[[!closeOnly]]">
<template is="dom-if" if="[[utilityButtonLabel]]"> <template is="dom-if" if="[[utilityButtonLabel]]">
<cr-button id="utilityButton" class="cancel-button" <cr-button id="utilityButton" class="cancel-button"
on-click="onUtilityClick_" aria-label="[[utilityButtonLabel]]"> on-click="onUtilityClick_" aria-label="[[utilityButtonLabel]]">
...@@ -89,6 +90,14 @@ ...@@ -89,6 +90,14 @@
[[actionButtonLabel]] [[actionButtonLabel]]
</cr-button> </cr-button>
</template> </template>
</template>
<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> </div>
</div> </div>
</template> </template>
......
...@@ -21,23 +21,28 @@ Polymer({ ...@@ -21,23 +21,28 @@ Polymer({
type: String, 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: { actionButtonLabel: {
type: String, type: String,
}, },
/** @type {string} */ /** @type {string} */
actionButtonEventName: { actionButtonEventName: {type: String, value: 'action'},
type: String,
value: 'action'
},
actionDisabled: { actionDisabled: {
type: Boolean, type: Boolean,
value: false, 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: { cancelButtonLabel: {
type: String, type: String,
}, },
...@@ -48,7 +53,11 @@ Polymer({ ...@@ -48,7 +53,11 @@ Polymer({
value: 'cancel', 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: { utilityButtonLabel: {
type: String, type: String,
}, },
...@@ -57,7 +66,16 @@ Polymer({ ...@@ -57,7 +66,16 @@ Polymer({
utilityButtonEventName: { utilityButtonEventName: {
type: String, type: String,
value: 'utility', value: 'utility',
} },
/**
* When true, hide all other buttons and show a close button.
* @type {boolean}
* */
closeOnly: {
type: Boolean,
value: false,
},
}, },
/** @private */ /** @private */
...@@ -74,4 +92,9 @@ Polymer({ ...@@ -74,4 +92,9 @@ Polymer({
onUtilityClick_() { onUtilityClick_() {
this.fire(this.utilityButtonEventName); this.fire(this.utilityButtonEventName);
}, },
/** @private */
onCloseClick_() {
this.fire('close');
},
}); });
...@@ -16,6 +16,7 @@ void RegisterNearbySharedStrings(content::WebUIDataSource* data_source) { ...@@ -16,6 +16,7 @@ void RegisterNearbySharedStrings(content::WebUIDataSource* data_source) {
static constexpr webui::LocalizedString kLocalizedStrings[] = { static constexpr webui::LocalizedString kLocalizedStrings[] = {
{"nearbyShareAccountRowLabel", IDS_NEARBY_ACCOUNT_ROW_LABEL}, {"nearbyShareAccountRowLabel", IDS_NEARBY_ACCOUNT_ROW_LABEL},
{"nearbyShareActionsCancel", IDS_NEARBY_ACTIONS_CANCEL}, {"nearbyShareActionsCancel", IDS_NEARBY_ACTIONS_CANCEL},
{"nearbyShareActionsClose", IDS_NEARBY_ACTIONS_CLOSE},
{"nearbyShareActionsConfirm", IDS_NEARBY_ACTIONS_CONFIRM}, {"nearbyShareActionsConfirm", IDS_NEARBY_ACTIONS_CONFIRM},
{"nearbyShareActionsNext", IDS_NEARBY_ACTIONS_NEXT}, {"nearbyShareActionsNext", IDS_NEARBY_ACTIONS_NEXT},
{"nearbyShareActionsReject", IDS_NEARBY_ACTIONS_REJECT}, {"nearbyShareActionsReject", IDS_NEARBY_ACTIONS_REJECT},
......
...@@ -36,6 +36,7 @@ suite('nearby-page-template', function() { ...@@ -36,6 +36,7 @@ suite('nearby-page-template', function() {
assertFalse(isVisible('#utilityButton')); assertFalse(isVisible('#utilityButton'));
assertFalse(isVisible('#actionButton')); assertFalse(isVisible('#actionButton'));
assertFalse(isVisible('#cancelButton')); assertFalse(isVisible('#cancelButton'));
assertFalse(isVisible('#closeButton'));
}); });
test('Everything on', async function() { test('Everything on', async function() {
...@@ -52,6 +53,7 @@ suite('nearby-page-template', function() { ...@@ -52,6 +53,7 @@ suite('nearby-page-template', function() {
assertTrue(isVisible('#utilityButton')); assertTrue(isVisible('#utilityButton'));
assertTrue(isVisible('#actionButton')); assertTrue(isVisible('#actionButton'));
assertTrue(isVisible('#cancelButton')); assertTrue(isVisible('#cancelButton'));
assertFalse(isVisible('#closeButton'));
/** @type {boolean} */ /** @type {boolean} */
let utilityTriggered = false; let utilityTriggered = false;
...@@ -74,4 +76,28 @@ suite('nearby-page-template', function() { ...@@ -74,4 +76,28 @@ suite('nearby-page-template', function() {
element.$$('#actionButton').click(); element.$$('#actionButton').click();
assertTrue(actionTrigger); 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