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

Automatically install curated Flatpak updates #1793

Merged
merged 30 commits into from
Jan 6, 2022

Conversation

meisenzahl
Copy link
Member

@meisenzahl meisenzahl commented Dec 12, 2021

Closes #1446

Bildschirmfoto von 2021-12-12 18 04 51

@meisenzahl meisenzahl marked this pull request as ready for review December 12, 2021 17:06
@meisenzahl meisenzahl marked this pull request as draft December 12, 2021 19:27
@meisenzahl
Copy link
Member Author

I tested this in a VM and unfortunately found that the update_available property is not true for packages that have updates available. I'll have another look at this.

@meisenzahl
Copy link
Member Author

Seems to work now:

Peek.2021-12-12.21-12.mp4

@meisenzahl meisenzahl marked this pull request as ready for review December 12, 2021 20:17
@hanaral
Copy link

hanaral commented Dec 13, 2021

I really think that this should be implemented in a backend, where all the current in-app update management could also go (the app is already quite prone to locking up as is when loading updates
Edit: Also it should be off by default at least until the automatic updates can be affected by metered connections or blocklisted on non 'home' networks (a la iOS autoupdates)

@meisenzahl
Copy link
Member Author

AppCenter is already running in the background as io.elementary.appcenter -s. If the package caches update is older than 24 hours, the Flatpak updates would be installed automatically in the background.

I am open to feedback from @elementary/ux on whether the automatically-install-flatpak-updates setting should be enabled by default.

@meisenzahl
Copy link
Member Author

The status of whether the connection is metered can be queried via org.freedesktop.NetworkManager's metered property: https://developer-old.gnome.org/NetworkManager/stable/nm-dbus-types.html#NMMetered

We could implement the logic for this in a follow-up PR.

@hanaral
Copy link

hanaral commented Dec 13, 2021

@meisenzahl I mean that appcenter should manage updates along with installs as a seperate process (not subprocess) as proposed in #1471 (if anyone is willing to implement it)
Good to see a preexisting gsetting for metred connections, it would be even better if there was a allowlist gsetting for networks so it never does autoupdates besides user-set networks

@cassidyjames
Copy link
Contributor

UX wise I agree this should be off by default until we can handle metered connections. At that point I think it would be safe to turn it on by default and/or prompt users to enable it.

If we can distinguish between "automatic" and explicitly-set non-metered (e.g. with NM_METERED_NO) connections, we could choose to do that, but I don't know if that's necessary.

Screenshot from 2021-12-13 11 02 01

@cassidyjames
Copy link
Contributor

Another UX/security question I have: can we restrict automatic updates to curated apps? Automatically updating non-curated apps means apps could update with more sandbox holes that haven't been human-reviewed, which sounds like a bad idea. Otherwise I think we'd need to implement some sort off manual approval process if the Flatpak sandbox changes, which sounds even more complicated.

@meisenzahl
Copy link
Member Author

@cassidyjames yes we could query if the connection was automatically or explicitly configured as metered.

The last push restricts automatic updates to curated apps.

src/MainWindow.vala Outdated Show resolved Hide resolved
Co-authored-by: Cassidy James Blaede <[email protected]>
@cassidyjames cassidyjames requested review from a team December 13, 2021 18:52
src/MainWindow.vala Outdated Show resolved Hide resolved

var menu_button = new Gtk.MenuButton () {
can_focus = false,
image = new Gtk.Image.from_icon_name ("open-menu", Gtk.IconSize.SMALL_TOOLBAR),
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be the large toolbar size, but I know that's gonna require some styling fixes as well since we do weird things with margins/padding in CSS here (I think due to the updates badge overlay). I may have started addressing it in #1230 but I also know that PR is pretty outdated.

Copy link
Member Author

Choose a reason for hiding this comment

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

Any suggestions on how we are going to implement this at this point?

Copy link
Contributor

Choose a reason for hiding this comment

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

@meisenzahl actually in testing, using LARGE_TOOLBAR looks really close; we might just have to tweak the styling here to match other apps; it looks like 3px matches Files, at least, but I'm also not sure how we would get it to scale with the text-size like our rem() sass function in the stylesheet… 🤔 That might be over-thinking it, though, and 3px here might be fine.

.titlebar {
padding-bottom: 0;
padding-top: 0;
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Using LARGE_TOOLBAR and 0.188rem for padding:

Bildschirmfoto von 2021-12-13 20 35 43

@mcclurgm
Copy link

If I may add a UX thought, it may make sense to place the switch at the top of the "Installed" tab, instead of being the only entry under a gear menu.

Since it's about the updates that appear in that tab, to me it's a natural fit there, and not in the home tab where it's also currently visible. That would also make it more visible, so it would kind of implicitly prompt people to enable the setting without adding an explicit dialog.
Having the switch always present may be unnecessary clutter, though.

Co-authored-by: Cassidy James Blaede <[email protected]>
@cassidyjames
Copy link
Contributor

@mcclurgm that might be fair considering it's the only item in that menu, but we've been talking about adding a menu for some time, e.g. for the items in #1230 or even for the refresh/fetch action from #1791. I would be okay moving to a menu in anticipation of those actions.

zeebok
zeebok previously approved these changes Dec 21, 2021
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.

Some naming nits, but this looks pretty good to me.

My only other question is: since we're reading the GSetting multiple times in Client, does it make sense to read it once and cache its value, or is it fine to read it multiple times?

data/io.elementary.appcenter.gschema.xml Outdated Show resolved Hide resolved
src/Core/Client.vala Outdated Show resolved Hide resolved
src/Core/UpdateManager.vala Outdated Show resolved Hide resolved
src/Core/UpdateManager.vala Outdated Show resolved Hide resolved
src/MainWindow.vala Outdated Show resolved Hide resolved
src/MainWindow.vala Outdated Show resolved Hide resolved
src/MainWindow.vala Outdated Show resolved Hide resolved
src/MainWindow.vala Outdated Show resolved Hide resolved
@cassidyjames cassidyjames changed the title Automatically install Flatpak updates Automatically install curated Flatpak updates Jan 6, 2022
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.

I can't confirm this is actually automatically installing curated Flatpak updates. I toggled the setting on, then manually downgraded Dippi (e.g. with flatpak update --commit=b826d7d99eb010f63c60405404363386e66ffcf83b1ce55f0e3fbed8634589e4 com.github.cassidyjames.dippi). AppCenter still shows the update as available, but as far as I can tell, won't install it automatically.

@cassidyjames
Copy link
Contributor

Ah @meisenzahl I see now that this is using the last refresh time to avoid auto updating all the time. That's smart, and by resetting the refresh and restarting AppCenter, I can confirm the update was automatically installed.

@cassidyjames
Copy link
Contributor

Alright, I think I just have one last @elementary/ux question: how do we treat paid apps that were installed for free? Traditionally, we treated these a bit differently to re-prompt the user to pay. Should these be excluded from automatic updates like they're excluded from the "Update All" logic? My inclination is yes, but that makes it harder to explain in the app.

src/MainWindow.vala Outdated Show resolved Hide resolved
src/Core/Client.vala Outdated Show resolved Hide resolved
@cassidyjames cassidyjames enabled auto-merge (squash) January 6, 2022 23:18
@cassidyjames cassidyjames merged commit c94140e into master Jan 6, 2022
@cassidyjames cassidyjames deleted the automatically-install-flatpak-updates branch January 6, 2022 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Automatically install Flatpak updates
5 participants