ongoing-processes: Update DND notification contents
Use new strings proposed in the attached bug to fit the new view. https://screenshot.googleplex.com/A6FAe4o7VpUc55e Bug: b:327483963 Change-Id: I5e4e7be4be296c59bb546ae4b820c8580b36b3fc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5581766 Reviewed-by: Richard Chui <richui@chromium.org> Commit-Queue: Kevin Radtke <kradtke@chromium.org> Reviewed-by: Ahmed Mehfooz <amehfooz@chromium.org> Cr-Commit-Position: refs/heads/main@{#1309409}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
8dc63437bd
commit
d3e35bbed3
ash
@ -7636,13 +7636,10 @@ New install
|
||||
Do Not Disturb is on
|
||||
</message>
|
||||
<message name="IDS_ASH_DO_NOT_DISTURB_NOTIFICATION_DESCRIPTION" desc="Text description used for the notification that shows up when the 'Do Not Disturb' feature is enabled.">
|
||||
Notifications are muted when Do Not Disturb is on
|
||||
</message>
|
||||
<message name="IDS_ASH_DO_NOT_DISTURB_NOTIFICATION_IN_FOCUS_MODE_TITLE" translateable="false" desc="Label used for the notification that shows up when the 'Do Not Disturb' feature is enabled.">
|
||||
Do Not Disturb is on until <ph name="time">$1<ex>1:40 PM</ex></ph>
|
||||
Notifications are muted
|
||||
</message>
|
||||
<message name="IDS_ASH_DO_NOT_DISTURB_NOTIFICATION_IN_FOCUS_MODE_DESCRIPTION" translateable="false" desc="Text description used for the notification that shows up when the 'Do Not Disturb' feature is enabled.">
|
||||
Notifications are muted when in Focus session
|
||||
Notifications are muted until <ph name="time">$1<ex>1:40 PM</ex></ph>
|
||||
</message>
|
||||
<message name="IDS_ASH_DO_NOT_DISTURB_NOTIFICATION_TURN_OFF" desc="Label for a button on the 'Do Not Disturb' notification that turns off 'Do Not Disturb' mode.">
|
||||
Turn off
|
||||
|
@ -1 +1 @@
|
||||
93e864d2b145e07391cb21c1ec991a855da332a2
|
||||
b6a105ab1f88bff494d1821ab063cafe3a76d60c
|
1
ash/ash_strings_grd/IDS_ASH_DO_NOT_DISTURB_NOTIFICATION_IN_FOCUS_MODE_DESCRIPTION.png.sha1
Normal file
1
ash/ash_strings_grd/IDS_ASH_DO_NOT_DISTURB_NOTIFICATION_IN_FOCUS_MODE_DESCRIPTION.png.sha1
Normal file
@ -0,0 +1 @@
|
||||
6f0613b77c5e167784658dfd7b01f707859577d5
|
@ -34,7 +34,7 @@ const char kDoNotDisturbNotifierId[] =
|
||||
"ash.do_not_disturb_notification_controller";
|
||||
|
||||
// Returns true if we need to show specific Focus Mode text in the notification.
|
||||
bool ShowFocusText() {
|
||||
bool ShouldShowFocusModeText() {
|
||||
auto* focus_mode_controller =
|
||||
features::IsFocusModeEnabled() ? FocusModeController::Get() : nullptr;
|
||||
|
||||
@ -50,17 +50,15 @@ bool ShowFocusText() {
|
||||
std::unique_ptr<message_center::Notification> CreateNotification() {
|
||||
// `should_show_focus_text` is true only when the notification needs to be
|
||||
// turned off when the focus session ends.
|
||||
const bool should_show_focus_text = ShowFocusText();
|
||||
const bool should_show_focus_text = ShouldShowFocusModeText();
|
||||
const std::u16string title =
|
||||
l10n_util::GetStringUTF16(IDS_ASH_DO_NOT_DISTURB_NOTIFICATION_TITLE);
|
||||
const std::u16string message =
|
||||
should_show_focus_text
|
||||
? focus_mode_util::GetNotificationTitleForFocusSession(
|
||||
? focus_mode_util::GetNotificationDescriptionForFocusSession(
|
||||
FocusModeController::Get()->GetActualEndTime())
|
||||
: l10n_util::GetStringUTF16(
|
||||
IDS_ASH_DO_NOT_DISTURB_NOTIFICATION_TITLE);
|
||||
const std::u16string message = l10n_util::GetStringUTF16(
|
||||
should_show_focus_text
|
||||
? IDS_ASH_DO_NOT_DISTURB_NOTIFICATION_IN_FOCUS_MODE_DESCRIPTION
|
||||
: IDS_ASH_DO_NOT_DISTURB_NOTIFICATION_DESCRIPTION);
|
||||
IDS_ASH_DO_NOT_DISTURB_NOTIFICATION_DESCRIPTION);
|
||||
|
||||
message_center::RichNotificationData optional_fields;
|
||||
optional_fields.buttons.emplace_back(
|
||||
|
@ -29,11 +29,6 @@ std::u16string GetDoNotDisturbDescription() {
|
||||
IDS_ASH_DO_NOT_DISTURB_NOTIFICATION_DESCRIPTION);
|
||||
}
|
||||
|
||||
std::u16string GetDoNotDisturbInFocusModeDescription() {
|
||||
return l10n_util::GetStringUTF16(
|
||||
IDS_ASH_DO_NOT_DISTURB_NOTIFICATION_IN_FOCUS_MODE_DESCRIPTION);
|
||||
}
|
||||
|
||||
message_center::Notification* GetDoNotDisturbNotification() {
|
||||
return MessageCenter::Get()->FindNotificationById(
|
||||
DoNotDisturbNotificationController::kDoNotDisturbNotificationId);
|
||||
@ -156,7 +151,10 @@ TEST_F(DoNotDisturbNotificationControllerWithFocusModeTest,
|
||||
EXPECT_TRUE(focus_mode_controller->in_focus_session());
|
||||
auto* notification = GetDoNotDisturbNotification();
|
||||
EXPECT_TRUE(notification);
|
||||
EXPECT_EQ(notification->message(), GetDoNotDisturbInFocusModeDescription());
|
||||
const base::Time end_time = focus_mode_controller->GetActualEndTime();
|
||||
EXPECT_EQ(
|
||||
notification->message(),
|
||||
focus_mode_util::GetNotificationDescriptionForFocusSession(end_time));
|
||||
// Check that quiet mode is active, and it was triggered by focus mode.
|
||||
EXPECT_TRUE(message_center->IsQuietMode());
|
||||
EXPECT_EQ(message_center::QuietModeSourceType::kFocusMode,
|
||||
@ -192,8 +190,9 @@ TEST_F(DoNotDisturbNotificationControllerWithFocusModeTest,
|
||||
|
||||
auto* notification = GetDoNotDisturbNotification();
|
||||
EXPECT_TRUE(notification);
|
||||
EXPECT_EQ(notification->title(),
|
||||
focus_mode_util::GetNotificationTitleForFocusSession(end_time1));
|
||||
EXPECT_EQ(
|
||||
notification->message(),
|
||||
focus_mode_util::GetNotificationDescriptionForFocusSession(end_time1));
|
||||
|
||||
// Extend the focus duration.
|
||||
focus_mode_controller->ExtendSessionDuration();
|
||||
@ -202,8 +201,9 @@ TEST_F(DoNotDisturbNotificationControllerWithFocusModeTest,
|
||||
|
||||
notification = GetDoNotDisturbNotification();
|
||||
EXPECT_TRUE(notification);
|
||||
EXPECT_EQ(notification->title(),
|
||||
focus_mode_util::GetNotificationTitleForFocusSession(end_time2));
|
||||
EXPECT_EQ(
|
||||
notification->message(),
|
||||
focus_mode_util::GetNotificationDescriptionForFocusSession(end_time2));
|
||||
|
||||
// End the focus session, and the system DND state will be restored to
|
||||
// `false`.
|
||||
|
@ -75,9 +75,10 @@ std::u16string GetFormattedClockString(const base::Time end_time) {
|
||||
base::kKeepAmPm);
|
||||
}
|
||||
|
||||
std::u16string GetNotificationTitleForFocusSession(const base::Time end_time) {
|
||||
std::u16string GetNotificationDescriptionForFocusSession(
|
||||
const base::Time end_time) {
|
||||
return l10n_util::GetStringFUTF16(
|
||||
IDS_ASH_DO_NOT_DISTURB_NOTIFICATION_IN_FOCUS_MODE_TITLE,
|
||||
IDS_ASH_DO_NOT_DISTURB_NOTIFICATION_IN_FOCUS_MODE_DESCRIPTION,
|
||||
GetFormattedClockString(end_time));
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ ASH_EXPORT std::u16string GetFormattedClockString(const base::Time end_time);
|
||||
|
||||
// Returns a string indicating that do not disturb will be turned off when the
|
||||
// focus session ends at `end_time`.
|
||||
ASH_EXPORT std::u16string GetNotificationTitleForFocusSession(
|
||||
ASH_EXPORT std::u16string GetNotificationDescriptionForFocusSession(
|
||||
const base::Time end_time);
|
||||
|
||||
// Reads the `timer_textfield`'s text and converts it to an integer.
|
||||
|
Reference in New Issue
Block a user