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/app/dawn-hub/Views/OnboardingView/OnboardingViewContainer.jsx b/app/dawn-hub/Views/OnboardingView/OnboardingViewContainer.jsx index 0c86c1414..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,8 +50,10 @@ class OnboardingViewContainer extends Component { sendMountActions: false, }; - const { history } = this.props; - history.push(`/${ONBOARDING}/${WELCOME}`); + 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'); diff --git a/src/background.js b/src/background.js index 8df4c44af..4df14fa92 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; @@ -308,7 +313,17 @@ function handleAccountPages(name, callback) { .then(data => callback(data)) .catch(err => callback(err)); return true; - + case 'accountPage.openSearchSelection': + (async() => { + await globals.BROWSER_INFO_READY; + if (BROWSER_INFO.name === 'ghostery_desktop') { + utils.openNewTab({ + url: chrome.runtime.getURL(`./app/templates/dawn_hub.html?dontReroute=true#${ONBOARDING}/${CHOOSE_DEFAULT_SEARCH}`), + become_active: true + }); + } + })(); + return true; default: return false; }