Search in sources :

Example 1 with AppPrefs

use of org.fdroid.fdroid.data.AppPrefs in project fdroidclient by f-droid.

the class KnownVulnAppListItemController method ignoreVulnerableApp.

private void ignoreVulnerableApp(@NonNull App app) {
    AppPrefs prefs = app.getPrefs(activity);
    prefs.ignoreVulnerabilities = true;
    AppPrefsProvider.Helper.update(activity, app, prefs);
    refreshUpdatesList();
}
Also used : AppPrefs(org.fdroid.fdroid.data.AppPrefs)

Example 2 with AppPrefs

use of org.fdroid.fdroid.data.AppPrefs in project fdroidclient by f-droid.

the class UpdateableAppListItemController method onDismissApp.

@Override
@NonNull
protected DismissResult onDismissApp(@NonNull App app) {
    AppPrefs prefs = app.getPrefs(activity);
    prefs.ignoreThisUpdate = app.suggestedVersionCode;
    // The act of updating here will trigger a re-query of the "can update" apps, so no need to do anything else
    // to update the UI in response to this.
    AppPrefsProvider.Helper.update(activity, app, prefs);
    return new DismissResult(activity.getString(R.string.app_list__dismiss_app_update), false);
}
Also used : DismissResult(org.fdroid.fdroid.views.updates.DismissResult) AppPrefs(org.fdroid.fdroid.data.AppPrefs) NonNull(android.support.annotation.NonNull)

Example 3 with AppPrefs

use of org.fdroid.fdroid.data.AppPrefs in project fdroidclient by f-droid.

the class KnownVulnAppListItemController method setIgnoreVulnerableApp.

private void setIgnoreVulnerableApp(@NonNull App app, boolean ignore) {
    AppPrefs prefs = app.getPrefs(activity);
    prefs.ignoreVulnerabilities = ignore;
    AppPrefsProvider.Helper.update(activity, app, prefs);
    refreshUpdatesList();
}
Also used : AppPrefs(org.fdroid.fdroid.data.AppPrefs)

Example 4 with AppPrefs

use of org.fdroid.fdroid.data.AppPrefs in project fdroidclient by f-droid.

the class UpdateableAppListItemController method onDismissApp.

@Override
protected void onDismissApp(@NonNull final App app, UpdatesAdapter adapter) {
    final AppPrefs prefs = app.getPrefs(activity);
    prefs.ignoreThisUpdate = app.autoInstallVersionCode;
    Snackbar.make(itemView, R.string.app_list__dismiss_app_update, Snackbar.LENGTH_LONG).setAction(R.string.undo, new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            prefs.ignoreThisUpdate = 0;
            AppPrefsProvider.Helper.update(activity, app, prefs);
        }
    }).show();
    // The act of updating here will trigger a re-query of the "can update" apps, so no need to do anything else
    // to update the UI in response to this.
    AppPrefsProvider.Helper.update(activity, app, prefs);
}
Also used : View(android.view.View) AppPrefs(org.fdroid.fdroid.data.AppPrefs)

Example 5 with AppPrefs

use of org.fdroid.fdroid.data.AppPrefs in project fdroidclient by f-droid.

the class AntiFeaturesTest method allVulnerableButIgnored.

@Test
public void allVulnerableButIgnored() {
    install(allVuln, 101);
    List<App> installed = AppProvider.Helper.findInstalledAppsWithKnownVulns(context);
    assertEquals(1, installed.size());
    App app = installed.get(0);
    AppPrefs prefs = app.getPrefs(context);
    prefs.ignoreVulnerabilities = true;
    AppPrefsProvider.Helper.update(context, app, prefs);
    List<App> installedButIgnored = AppProvider.Helper.findInstalledAppsWithKnownVulns(context);
    assertEquals(0, installedButIgnored.size());
}
Also used : App(org.fdroid.fdroid.data.App) AppPrefs(org.fdroid.fdroid.data.AppPrefs) Test(org.junit.Test) FDroidProviderTest(org.fdroid.fdroid.data.FDroidProviderTest)

Aggregations

AppPrefs (org.fdroid.fdroid.data.AppPrefs)5 NonNull (android.support.annotation.NonNull)1 View (android.view.View)1 App (org.fdroid.fdroid.data.App)1 FDroidProviderTest (org.fdroid.fdroid.data.FDroidProviderTest)1 DismissResult (org.fdroid.fdroid.views.updates.DismissResult)1 Test (org.junit.Test)1