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

Throw toast when app is installed #1456

Merged
merged 17 commits into from
Dec 18, 2020

Conversation

meisenzahl
Copy link
Member

Closes #1455

Bildschirmfoto von 2020-12-09 19-38-34

src/Application.vala Outdated Show resolved Hide resolved
Co-authored-by: Cassidy James Blaede <[email protected]>
src/Application.vala Outdated Show resolved Hide resolved
@meisenzahl meisenzahl marked this pull request as ready for review December 9, 2020 19:19
@cassidyjames
Copy link
Contributor

cassidyjames commented Dec 9, 2020

Screenshot from list view

Screenshot from 2020-12-09 12-46-56

cassidyjames
cassidyjames previously approved these changes Dec 9, 2020
Copy link
Contributor

@cassidyjames cassidyjames left a comment

Choose a reason for hiding this comment

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

UX approval from me. My only open question is if it would make sense to suppress the toast on the app's own app info view (since it's redundant with the existing "Open" button that gets revealed), but that's not a blocker for me.

@cassidyjames cassidyjames requested a review from a team December 9, 2020 19:52
@meisenzahl meisenzahl marked this pull request as draft December 9, 2020 20:06
@meisenzahl
Copy link
Member Author

I will look into hiding the toast on the app's own app info view.

Copy link
Contributor

@donadigo donadigo left a comment

Choose a reason for hiding this comment

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

I have one issue.

var toast = main_window.toast;
toast.title = _("“%s” has been installed").printf (package.get_name ());

toast.send_notification ();
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be better to handle sending the toast and saving the package reference inside MainWindow, instead of trying to expose last_installed_package in Application and then accessing it back in MainWindow.

Simply declare a private AppCenterCore.Package? last_installed_package member and a public void send_installed_toast (AppCenterCore.Package package) method in MainWindow and manage sending the toast there instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

I now also need selected_package in AppCenter.App to check if a Toast should be sent.

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean sure, but that didn't resolve my issue. The toast is still half managed in Application and MainWindow at the same time. And there's also no need to store selected_package globaly inside Application. Notice how MainWindow actually calls show_package and return_clicked where this property could be set within MainWindow as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for your feedback. I have refactored that except for selected_package.

The show_package call in MainWindow is not the same as in View.

Copy link
Member Author

Choose a reason for hiding this comment

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

I refactored it using a signal.

@donadigo thanks for being persistent 😃 The code looks much cleaner now 👍

@meisenzahl meisenzahl marked this pull request as ready for review December 9, 2020 20:36
Copy link
Contributor

@cassidyjames cassidyjames left a comment

Choose a reason for hiding this comment

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

Again, UX-wise this meets my approval. 😄 But I'd like to see a re-review from @elementary/desktop-developers or @donadigo.

@cassidyjames cassidyjames requested a review from a team December 9, 2020 23:10
Copy link
Member

@danirabbit danirabbit left a comment

Choose a reason for hiding this comment

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

Just a few inline comments. Otherwise, looks pretty clean to me :)

src/MainWindow.vala Outdated Show resolved Hide resolved
src/MainWindow.vala Outdated Show resolved Hide resolved
try {
last_installed_package.launch ();
} catch (Error e) {
warning ("Failed to launch %s: %s".printf (last_installed_package.get_name (), e.message));
Copy link
Member

Choose a reason for hiding this comment

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

Hm, I wonder if this should throw a dialog. If a user clicked the open button and then nothing happened, that seems bad. Thoughts @cassidyjames?

Copy link
Member Author

Choose a reason for hiding this comment

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

For reference: This code is mostly a copy from AbstractAppContainer.launch_package_app()

Copy link
Contributor

Choose a reason for hiding this comment

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

@danrabbit I'm indifferent. It probably makes sense to do what we do in other instances in AppCenter, and then we can file an issue to throw a dialog on failure.

src/MainWindow.vala Show resolved Hide resolved
src/MainWindow.vala Outdated Show resolved Hide resolved
donadigo
donadigo previously approved these changes Dec 18, 2020
Copy link
Contributor

@donadigo donadigo left a comment

Choose a reason for hiding this comment

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

Code looks good now.

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.

Throw toast when app is installed
4 participants