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-2269, GIS-904: Allow account to trigger dawn hub #673

Merged
merged 9 commits into from Feb 5, 2021
@@ -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)));
@@ -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');
@@ -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;
}
ProTip! Use n and p to navigate between commits in a pull request.