Skip to content

Commit

Permalink
#1012 Integration mode switch
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizzick committed Aug 28, 2018
1 parent 4eaf3c6 commit cb36066
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Extension/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@
"options_use_optimized_filters": {
"message": "Use optimized filters<span class='sp-table-row-info'>Light filter lists optimized for mobile devices<\/span>"
},
"options_disable_integration_mode": {
"message": "Enable integration mode"
},
"options_popup_update_title": {
"message": "Filters updated successfully"
},
Expand Down
2 changes: 1 addition & 1 deletion Extension/lib/filter/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ adguard.integration = (function (adguard) {
* @returns {boolean}
*/
isEnabled: function () {
return !integrationModeForceDisabled;
return adguard.settings.isIntegrationModeEnabled() && !integrationModeForceDisabled;
},

/**
Expand Down
1 change: 1 addition & 0 deletions Extension/lib/pages/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,7 @@ var Settings = function () {
checkboxes.push(new Checkbox('#showAppUpdatedNotification', userSettings.names.DISABLE_SHOW_APP_UPDATED_NOTIFICATION, {
negate: true
}));
checkboxes.push(new Checkbox('#integrationModeCheckbox', userSettings.names.DISABLE_INTEGRATION_MODE, {negate: true}));

var allowAcceptableAdsCheckbox = document.querySelector("#allowAcceptableAds");
allowAcceptableAdsCheckbox.addEventListener('change', function () {
Expand Down
14 changes: 13 additions & 1 deletion Extension/lib/utils/user-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ adguard.settings = (function (adguard) {
DISABLE_SHOW_CONTEXT_MENU: 'context-menu-disabled',
USE_OPTIMIZED_FILTERS: 'use-optimized-filters',
DEFAULT_WHITE_LIST_MODE: 'default-whitelist-mode',
DISABLE_SHOW_APP_UPDATED_NOTIFICATION: 'show-app-updated-disabled'
DISABLE_SHOW_APP_UPDATED_NOTIFICATION: 'show-app-updated-disabled',
DISABLE_INTEGRATION_MODE: 'integration-mode-disabled'
};

var properties = Object.create(null);
Expand All @@ -61,6 +62,7 @@ adguard.settings = (function (adguard) {
defaults[settings.USE_OPTIMIZED_FILTERS] = adguard.prefs.mobile;
defaults[settings.DISABLE_DETECT_FILTERS] = false;
defaults[settings.DISABLE_SHOW_APP_UPDATED_NOTIFICATION] = false;
defaults[settings.DISABLE_INTEGRATION_MODE] = false;
return defaults;
});
}
Expand Down Expand Up @@ -167,6 +169,14 @@ adguard.settings = (function (adguard) {
setProperty(settings.DISABLE_SHOW_APP_UPDATED_NOTIFICATION, !show, options);
};

var isIntegrationModeEnabled = function () {
return !getProperty(settings.DISABLE_INTEGRATION_MODE);
};

var changeIntegrationModeEnabled = function (show, options) {
setProperty(settings.DISABLE_INTEGRATION_MODE, !show, options);
};

var changeEnableSafebrowsing = function (enabled, options) {
setProperty(settings.DISABLE_SAFEBROWSING, !enabled);

Expand Down Expand Up @@ -252,6 +262,8 @@ adguard.settings = (function (adguard) {
api.isUseOptimizedFiltersEnabled = isUseOptimizedFiltersEnabled;
api.changeUseOptimizedFiltersEnabled = changeUseOptimizedFiltersEnabled;
api.changeDefaultWhiteListMode = changeDefaultWhiteListMode;
api.isIntegrationModeEnabled = isIntegrationModeEnabled;
api.changeIntegrationModeEnabled = changeIntegrationModeEnabled;

return api;

Expand Down
9 changes: 9 additions & 0 deletions Extension/pages/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,15 @@
<input type="checkbox" class="sp-table-row-input" id="useOptimizedFilters"/>
</div>
</li>
<li>
<div>
<div class="opt-name" i18n="options_disable_integration_mode"></div>
<div class="opt-state"></div>
</div>
<div class="opt-state input">
<input type="checkbox" class="sp-table-row-input" id="integrationModeCheckbox"/>
</div>
</li>
<li>
<div class="opt-name" i18n="options_collect_hit_stats"></div>
<div class="opt-state">
Expand Down

0 comments on commit cb36066

Please sign in to comment.