Skip to content

Commit

Permalink
Only ask for non-curated approval on installations, not updates (#1254)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmhewitt authored Apr 14, 2020
1 parent c69c2f0 commit caa2e08
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
8 changes: 8 additions & 0 deletions data/io.elementary.appcenter.appdata.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
</p>
</description>
<releases>
<release version="3.2.5" date="2020-04-28" urgency="medium">

This comment has been minimized.

Copy link
@decathorpe

decathorpe Apr 16, 2020

Contributor

Please don't set future release dates, it breaks my CI builds on fedora due to the mandatory appdata validation with appstream-glib:

$ appstream-util validate-relax --nonet PATH_TO_INSTALLED.appdata.xml
? attribute-invalid     : <release> timestamp is in the future

This comment has been minimized.

Copy link
@cassidyjames

cassidyjames Apr 16, 2020

Contributor

Ah, yeah, we usually just do today's date. Sorry I missed this in the review. I also wonder if we should get an AppStream validate GitHub Action running so we don't hit this again?

This comment has been minimized.

Copy link
@cassidyjames

cassidyjames Apr 16, 2020

Contributor
<description>
<p>Fixes</p>
<ul>
<li>AppCenter no longer prompts for approval to update non-curated apps</li>
</ul>
</description>
</release>
<release version="3.2.4" date="2020-04-08" urgency="medium">
<description>
<p>Fixes</p>
Expand Down
19 changes: 15 additions & 4 deletions src/Widgets/AppContainers/AbstractAppContainer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@ namespace AppCenter {
action_button_revealer.add (action_button);

action_button.download_requested.connect (() => {
if (install_approved (package) == true) {
if (install_approved ()) {
action_clicked.begin ();
}
});

action_button.payment_requested.connect ((amount) => {
if (install_approved (package) == true) {
if (install_approved ()) {
show_stripe_dialog (amount);
}
});
Expand Down Expand Up @@ -459,10 +459,16 @@ namespace AppCenter {
});
}

private bool install_approved (AppCenterCore.Package package) {
private bool install_approved () {
bool approved = true;

if (App.settings.get_boolean ("non-curated-warning") == true && !(package.is_native || is_os_updates)) {
var curated_dialog_allowed = App.settings.get_boolean ("non-curated-warning");
var app_installed = package.state != AppCenterCore.Package.State.NOT_INSTALLED;
var app_curated = package.is_native || is_os_updates;

// Only show the curated dialog if the user has left them enabled, the app isn't installed
// and it isn't a curated app
if (curated_dialog_allowed && !app_installed && !app_curated) {
approved = false;

non_curated_warning = new Widgets.NonCuratedWarningDialog (this.package_name.label);
Expand All @@ -487,6 +493,11 @@ namespace AppCenter {

non_curated_warning.run ();
non_curated_warning.destroy ();

// If the install has been rejected at this stage, return early
if (!approved) {
return false;
}
}

if (App.settings.get_boolean ("content-warning") == true && package.is_explicit) {
Expand Down

0 comments on commit caa2e08

Please sign in to comment.