Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockSettingsStorage.java

Issue 29379647: Issue 4948 - add possibility to not send data depending on connection properties (Closed)
Patch Set: reverted using latest tools, sergei's comments Created March 15, 2017, 1:59 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 * @param adblockEngine adblock engine 50 * @param adblockEngine adblock engine
51 * @return not null default settings 51 * @return not null default settings
52 */ 52 */
53 public static AdblockSettings getDefaultSettings(AdblockEngine adblockEngine) 53 public static AdblockSettings getDefaultSettings(AdblockEngine adblockEngine)
54 { 54 {
55 AdblockSettings settings = new AdblockSettings(); 55 AdblockSettings settings = new AdblockSettings();
56 56
57 // read actual values from adblock engine 57 // read actual values from adblock engine
58 settings.setAdblockEnabled(adblockEngine.isEnabled()); 58 settings.setAdblockEnabled(adblockEngine.isEnabled());
59 settings.setAcceptableAdsEnabled(adblockEngine.isAcceptableAdsEnabled()); 59 settings.setAcceptableAdsEnabled(adblockEngine.isAcceptableAdsEnabled());
60 String allowedConnectionTypeValue = adblockEngine.getFilterEngine().getAllow edConnectionType();
61 settings.setAllowedConnectionType(ConnectionType.findByValue(allowedConnecti onTypeValue));
60 62
61 // we need to filter out exceptions subscription to show languages subscript ions only 63 // we need to filter out exceptions subscription to show languages subscript ions only
62 Subscription[] listedSubscriptions = adblockEngine.getListedSubscriptions(); 64 Subscription[] listedSubscriptions = adblockEngine.getListedSubscriptions();
63 List<Subscription> subscriptionsWithoutAA = new LinkedList<Subscription>(); 65 List<Subscription> subscriptionsWithoutAA = new LinkedList<Subscription>();
64 String acceptableAdsURL = adblockEngine.getAcceptableAdsSubscriptionURL(); 66 String acceptableAdsURL = adblockEngine.getAcceptableAdsSubscriptionURL();
65 67
66 for (Subscription eachListedSubscription : listedSubscriptions) 68 for (Subscription eachListedSubscription : listedSubscriptions)
67 { 69 {
68 if (!eachListedSubscription.url.equals(acceptableAdsURL)) 70 if (!eachListedSubscription.url.equals(acceptableAdsURL))
69 { 71 {
70 subscriptionsWithoutAA.add(eachListedSubscription); 72 subscriptionsWithoutAA.add(eachListedSubscription);
71 } 73 }
72 } 74 }
73 75
74 settings.setSubscriptions(subscriptionsWithoutAA); 76 settings.setSubscriptions(subscriptionsWithoutAA);
75 77
76 return settings; 78 return settings;
77 } 79 }
78 } 80 }
OLDNEW

Powered by Google App Engine
This is Rietveld