From 48db0b53d65ec008908814bc9e6a95b62796f6b6 Mon Sep 17 00:00:00 2001 From: Frank Chiarulli Jr Date: Mon, 1 Feb 2021 18:11:18 -0500 Subject: [PATCH 1/5] allow account to open onboarding search selection page --- app/content-scripts/account_pages.js | 1 + src/background.js | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/content-scripts/account_pages.js b/app/content-scripts/account_pages.js index 22e057cb7..5a960108d 100644 --- a/app/content-scripts/account_pages.js +++ b/app/content-scripts/account_pages.js @@ -35,6 +35,7 @@ const AccountPagesContentScript = (function(window) { 'accountPage.getUser', 'accountPage.getUserSubscriptionData', 'accountPage.logout', + 'accountPage.openSearchSelection' ]; const _initialize = function() { _listeners.forEach(name => window.addEventListener(name, () => sendMessage(name))); diff --git a/src/background.js b/src/background.js index 5c5fce5cb..69d321466 100644 --- a/src/background.js +++ b/src/background.js @@ -308,7 +308,12 @@ function handleAccountPages(name, callback) { .then(data => callback(data)) .catch(err => callback(err)); return true; - + case 'accountPage.openSearchSelection': + utils.openNewTab({ + url: chrome.runtime.getURL('./app/templates/dawn_hub.html#onboarding/3'), + become_active: true + }); + return true; default: return false; } From 4ee48b4300c32e7e107d386ee9097f5523dfccb2 Mon Sep 17 00:00:00 2001 From: Frank Chiarulli Jr Date: Tue, 2 Feb 2021 10:41:32 -0500 Subject: [PATCH 2/5] only trigger hub if within dawn --- src/background.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/background.js b/src/background.js index 69d321466..856ab3163 100644 --- a/src/background.js +++ b/src/background.js @@ -309,10 +309,15 @@ function handleAccountPages(name, callback) { .catch(err => callback(err)); return true; case 'accountPage.openSearchSelection': - utils.openNewTab({ - url: chrome.runtime.getURL('./app/templates/dawn_hub.html#onboarding/3'), - become_active: true - }); + (async() => { + await globals.BROWSER_INFO_READY; + if (BROWSER_INFO.name === 'ghostery_desktop') { + utils.openNewTab({ + url: chrome.runtime.getURL('./app/templates/dawn_hub.html#onboarding/3'), + become_active: true + }); + } + })(); return true; default: return false; From 82099cca5e7dcb6e333c85313b3e790f0f49473d Mon Sep 17 00:00:00 2001 From: Frank Chiarulli Jr Date: Tue, 2 Feb 2021 11:56:16 -0500 Subject: [PATCH 3/5] dont force redirect user to the begining of oboarding --- app/dawn-hub/Views/OnboardingView/OnboardingViewContainer.jsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/dawn-hub/Views/OnboardingView/OnboardingViewContainer.jsx b/app/dawn-hub/Views/OnboardingView/OnboardingViewContainer.jsx index 0c86c1414..0cacba93c 100644 --- a/app/dawn-hub/Views/OnboardingView/OnboardingViewContainer.jsx +++ b/app/dawn-hub/Views/OnboardingView/OnboardingViewContainer.jsx @@ -49,9 +49,6 @@ class OnboardingViewContainer extends Component { sendMountActions: false, }; - const { history } = this.props; - history.push(`/${ONBOARDING}/${WELCOME}`); - // TODO verify what document title we should use const title = t('ghostery_dawn_onboarding_page_title'); window.document.title = title; From 4d527a268e55ca9c7082dce349a2a68d55f81b39 Mon Sep 17 00:00:00 2001 From: Frank Chiarulli Jr Date: Tue, 2 Feb 2021 11:58:31 -0500 Subject: [PATCH 4/5] use constants --- src/background.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/background.js b/src/background.js index 856ab3163..50c3fe530 100644 --- a/src/background.js +++ b/src/background.js @@ -49,6 +49,11 @@ import { _getJSONAPIErrorsObject } from './utils/api'; import importCliqzSettings from './utils/cliqzSettingImport'; import { sendCliqzModuleCounts } from './utils/cliqzModulesData'; +import { + ONBOARDING, + CHOOSE_DEFAULT_SEARCH +} from '../app/dawn-hub/Views/OnboardingView/OnboardingConstants'; + // For debug purposes, provide Access to the internals of `ghostery-common` // module from Developer Tools Console. window.CLIQZ = cliqz; @@ -313,7 +318,7 @@ function handleAccountPages(name, callback) { await globals.BROWSER_INFO_READY; if (BROWSER_INFO.name === 'ghostery_desktop') { utils.openNewTab({ - url: chrome.runtime.getURL('./app/templates/dawn_hub.html#onboarding/3'), + url: chrome.runtime.getURL(`./app/templates/dawn_hub.html#${ONBOARDING}/${CHOOSE_DEFAULT_SEARCH}`), become_active: true }); } From ff3d70c85340109d2601c6d17c1cf46d378a3a21 Mon Sep 17 00:00:00 2001 From: Frank Chiarulli Jr Date: Thu, 4 Feb 2021 14:18:20 -0500 Subject: [PATCH 5/5] add dontReroute param --- .../Views/OnboardingView/OnboardingViewContainer.jsx | 6 ++++++ src/background.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/dawn-hub/Views/OnboardingView/OnboardingViewContainer.jsx b/app/dawn-hub/Views/OnboardingView/OnboardingViewContainer.jsx index 0cacba93c..045de387e 100644 --- a/app/dawn-hub/Views/OnboardingView/OnboardingViewContainer.jsx +++ b/app/dawn-hub/Views/OnboardingView/OnboardingViewContainer.jsx @@ -36,6 +36,7 @@ import { } from './OnboardingConstants'; const justInstalled = (QueryString.parse(window.location.search).justInstalled === 'true') || false; +const dontReroute = (QueryString.parse(window.location.search).dontReroute === 'true') || false; /** * @class Wrap the root onboarding flow view of the Dawn Hub @@ -49,6 +50,11 @@ class OnboardingViewContainer extends Component { sendMountActions: false, }; + if (!dontReroute) { + const { history } = this.props; + history.push(`/${ONBOARDING}/${WELCOME}`); + } + // TODO verify what document title we should use const title = t('ghostery_dawn_onboarding_page_title'); window.document.title = title; diff --git a/src/background.js b/src/background.js index 50c3fe530..38cfcdf3f 100644 --- a/src/background.js +++ b/src/background.js @@ -318,7 +318,7 @@ function handleAccountPages(name, callback) { await globals.BROWSER_INFO_READY; if (BROWSER_INFO.name === 'ghostery_desktop') { utils.openNewTab({ - url: chrome.runtime.getURL(`./app/templates/dawn_hub.html#${ONBOARDING}/${CHOOSE_DEFAULT_SEARCH}`), + url: chrome.runtime.getURL(`./app/templates/dawn_hub.html?dontReroute=true#${ONBOARDING}/${CHOOSE_DEFAULT_SEARCH}`), become_active: true }); }