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

GH-2258: Preserve user onboarding settings #681

Merged
merged 10 commits into from Mar 15, 2021

Remove recommendedChoices

  • Loading branch information
leuryr committed Mar 11, 2021
commit fe4c852fd5bbc44609cd1c2959dfb3f9a6384f74
@@ -34,7 +34,6 @@ class BlockSettingsView extends Component {
constructor(props) {
super(props);
this.state = {
recommendedChoices: false,
kindsOfTrackers: null,
enable_ad_block: null,
enable_anti_tracking: null,
@@ -83,15 +82,13 @@ class BlockSettingsView extends Component {
toggleRecommendedChoices = (value) => {
if (value === true) {
this.setState({
recommendedChoices: true,
enable_ad_block: true,
kindsOfTrackers: BLOCKING_POLICY_RECOMMENDED,
enable_anti_tracking: true,
enable_smart_block: true
});
} else {
this.setState({
recommendedChoices: false,
enable_ad_block: null,
kindsOfTrackers: null,
enable_anti_tracking: null,
@@ -204,10 +201,12 @@ class BlockSettingsView extends Component {

render() {
const {
recommendedChoices, enable_ad_block, kindsOfTrackers, enable_anti_tracking, enable_smart_block
enable_ad_block, kindsOfTrackers, enable_anti_tracking, enable_smart_block
} = this.state;
const { actions } = this.props;
const { logout } = actions;

const recommendedChoicesActive = this.recommendedChoicesActive();
return (
<Fragment>
<div className="BlockSettingsView__relativeContainer">
@@ -225,10 +224,10 @@ class BlockSettingsView extends Component {
<div className="BlockSettingsView_checkboxBlock">
<ToggleCheckbox
className="BlockSettingsView_checkbox"
checked={this.recommendedChoicesActive()}
onChange={() => this.toggleRecommendedChoices(!recommendedChoices)}
checked={recommendedChoicesActive}
onChange={() => this.toggleRecommendedChoices(!recommendedChoicesActive)}
/>
<div className="BlockSettingsView_checkboxLabel" onClick={() => this.toggleRecommendedChoices(!recommendedChoices)}>{t('ghostery_dawn_onboarding_recommended_choices')}</div>
<div className="BlockSettingsView_checkboxLabel" onClick={() => this.toggleRecommendedChoices(!recommendedChoicesActive)}>{t('ghostery_dawn_onboarding_recommended_choices')}</div>
</div>
<ol>
{this.renderQuestion(t('ghostery_dawn_onboarding_question_block_ads'))}
ProTip! Use n and p to navigate between commits in a pull request.