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

Clean up welcome and notification details compose views #1902

Merged
merged 2 commits into from Nov 11, 2021

Conversation

dshokouhi
Copy link
Member

Summary

Start to use better compose methods to follow along with #1895

Also adds preview for notification details

Also adding a vertical scroll modifier to the columns in case the screen is small

Screenshots

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

Any other notes

Comment on lines 34 to 36
val notificationItem = rememberSaveable {
NotificationData(notification.received, notification.message, notification.data)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

So I'm not sure we need the rememberSaveable here?

Copy link
Member Author

Choose a reason for hiding this comment

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

rememberSaveable will retain when the UI is redrawn like when the orientation changes.

https://developer.android.com/jetpack/compose/state#restore-ui-state

I think I added this in the first PR we made to pass in the state? I can remove it if you like

Copy link
Collaborator

Choose a reason for hiding this comment

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

You only need the remember and rememberSavable if the state only exists inside the compose function. Since the data is coming from outside the compose function we don't need to save it there.

@JBassett JBassett merged commit 55a9c51 into home-assistant:master Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants