Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications: Don't display 'acknowledge all' after clicking 'silenc… #1349

Conversation

DanielMcInnes
Copy link
Contributor

…e alarm'

Fixes #1348

onClicked: Global.notifications.acknowledgeAll()
onClicked: {
// break bindings so that color, text and image don't change while fading out
backgroundColor = backgroundColor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this cause problems the next time an alarm or alert occurs, and the binding is required again?

Would it be easier to create two separate buttons, one for alerts and one for alarms?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it does cause problems. Updated as suggested.

@DanielMcInnes DanielMcInnes force-pushed the 1348-notifications-page-when-silence-alarm-is-clicked-the-acknowledge-all-button-is-briefly-displayed branch from 06240a9 to ce6985f Compare July 30, 2024 01:18
@DanielMcInnes DanielMcInnes force-pushed the 1348-notifications-page-when-silence-alarm-is-clicked-the-acknowledge-all-button-is-briefly-displayed branch from ce6985f to 9e1645b Compare July 30, 2024 04:04
right: parent ? parent.rightSideRow.right : undefined
verticalCenter: parent.verticalCenter
}
parent: !!Global.pageManager ? Global.pageManager.statusBar : undefined
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The button used to be parented to Global.pageManager.statusBar.rightSideRow, I had to change to to Global.pageManager.statusBar and anchor it to the RHS of Global.pageManager.statusBar.rightSideRow, as Row doesn't re-layout itself in a timely manner when its children's visibility changes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if other buttons (aside from Display Sleep etc) get added to the rightSideRow?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to add other stuff to rightSideRow, we will have to revisit this. It would depend how the new button is supposed to behave.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about moving the buttons to StatusBar.qml and defining the NotificationButton component inline (like how StatusBarButton is defined there)? That way the buttons are defined directly within the layout in StatusBar.qml, and we wouldn't need awkward alias properties like Global.pageManager.statusBar.rightSideRow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated as suggested.

Copy link
Contributor

@blammit blammit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In mock mode, I pressed Shift+N to generate a new alarm. gui-v2 jumped to the Notifications page and showed the "Silence alarms" button, but then it quickly disappeared and was replaced by "Acknowledge alerts". I think I'd expect "Silence alarms" to take precedence if both alerts and alarms are present.

Also, if I click "Silence alarms" or "Acknowledge alerts", the button jumps slightly to the left before it disappears.

opacity: enabled ? 1 : 0
Behavior on opacity { OpacityAnimator { duration: Theme.animation_toastNotification_fade_duration } }

contentItem: Row {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Button already supports showing an icon and text side-by-side, so it should be possible to do:

NotificationButton {
    icon.source: "qrc:/images/icon_alarm_snooze_24.svg"
    text: "Silence alarm"
}

instead of overriding the contentItem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated as suggested

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has the side effect of the button text color changing while the button is pressed, as per our default Button behaviour. Looks ok to me.

right: parent ? parent.rightSideRow.right : undefined
verticalCenter: parent.verticalCenter
}
parent: !!Global.pageManager ? Global.pageManager.statusBar : undefined
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about moving the buttons to StatusBar.qml and defining the NotificationButton component inline (like how StatusBarButton is defined there)? That way the buttons are defined directly within the layout in StatusBar.qml, and we wouldn't need awkward alias properties like Global.pageManager.statusBar.rightSideRow.

@DanielMcInnes
Copy link
Contributor Author

In mock mode, I pressed Shift+N to generate a new alarm. gui-v2 jumped to the Notifications page and showed the "Silence alarms" button, but then it quickly disappeared and was replaced by "Acknowledge alerts". I think I'd expect "Silence alarms" to take precedence if both alerts and alarms are present.

Also, if I click "Silence alarms" or "Acknowledge alerts", the button jumps slightly to the left before it disappears.

Re. the "Silence alarms" button disappearing and being replaced by "Acknowledge alerts", I saw this as well, it is caused by a timer in the mock NotificationsImpl that sets .../Active to null. If you turn off the timers by pressing 'T', you shouldn't see it any more.

Re. the button jumping slightly to the left, I don't see this. I'm hoping it is caused by the mock timers deactivating alarms - would you mind disabling the mock timers and checking again?

@blammit
Copy link
Contributor

blammit commented Aug 1, 2024

Re. the button jumping slightly to the left, I don't see this. I'm hoping it is caused by the mock timers deactivating alarms - would you mind disabling the mock timers and checking again?

It still occurs. But if it doesn't occur with real alarms on device/wasm, then it LGTM.

@DanielMcInnes DanielMcInnes force-pushed the 1348-notifications-page-when-silence-alarm-is-clicked-the-acknowledge-all-button-is-briefly-displayed branch from e4a941b to 89d9231 Compare August 2, 2024 03:35
@DanielMcInnes
Copy link
Contributor Author

Re. the button jumping slightly to the left, I don't see this. I'm hoping it is caused by the mock timers deactivating alarms - would you mind disabling the mock timers and checking again?

It still occurs. But if it doesn't occur with real alarms on device/wasm, then it LGTM.

I managed to reproduce this on a cerbo. Fixed now.

Copy link
Contributor

@blammit blammit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well, some minor comments. LGTM

}
enabled: notificationButtonsEnabled && !!Global.notifications && Global.notifications.alarm
backgroundColor: Theme.color_critical_background
display: C.AbstractButton.TextBesideIcon
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TextBesideIcon is the default, so this is not needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Rectangle {
anchors.fill: rightSideRow
color: "pink"
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover debug?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugh, whoops.

@@ -14,7 +15,8 @@ Rectangle {

property int leftButton: VenusOS.StatusBar_LeftButton_None
property int rightButton: VenusOS.StatusBar_RightButton_None
property alias rightSideRow: rightSideRow
property bool notificationButtonsEnabled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if the value of notificationButtonsEnabled can just be set from within StatusBar.qml (e.g. if it could find the current page url somehow to check whether it's the NotificationsPage.qml) to avoid needing to set this from MainView.qml and needing the extra property in SwipePageModel. But no big deal either way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated as suggested

@@ -5,6 +5,7 @@

import QtQuick
import QtQuick.Controls as C
import QtQuick.Controls.impl as CP
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@DanielMcInnes DanielMcInnes force-pushed the 1348-notifications-page-when-silence-alarm-is-clicked-the-acknowledge-all-button-is-briefly-displayed branch from 7457eb4 to 09eab2c Compare August 5, 2024 04:36
@DanielMcInnes DanielMcInnes merged commit 6d423dc into main Aug 6, 2024
2 checks passed
@DanielMcInnes DanielMcInnes deleted the 1348-notifications-page-when-silence-alarm-is-clicked-the-acknowledge-all-button-is-briefly-displayed branch August 6, 2024 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Notifications page: When "silence alarm" is clicked, the "Acknowledge all" button is briefly displayed
3 participants