diff --git a/app/components/Views/BrowserTab/index.js b/app/components/Views/BrowserTab/index.js index 92d62ca26c1..5ac95ecb645 100644 --- a/app/components/Views/BrowserTab/index.js +++ b/app/components/Views/BrowserTab/index.js @@ -753,9 +753,12 @@ export class BrowserTab extends PureComponent { : `'${Networks[this.props.networkType].networkId}'` ); + const analyticsEnabled = Analytics.getEnabled(); + const homepageScripts = ` window.__mmFavorites = ${JSON.stringify(this.props.bookmarks)}; - window.__mmSearchEngine="${this.props.searchEngine}"; + window.__mmSearchEngine = "${this.props.searchEngine}"; + window.__mmMetametrics = ${analyticsEnabled}; `; await this.setState({ entryScriptWeb3: updatedentryScriptWeb3 + SPA_urlChangeListener, homepageScripts }); @@ -850,9 +853,12 @@ export class BrowserTab extends PureComponent { } refreshHomeScripts() { + const analyticsEnabled = Analytics.getEnabled(); + const homepageScripts = ` window.__mmFavorites = ${JSON.stringify(this.props.bookmarks)}; window.__mmSearchEngine="${this.props.searchEngine}"; + window.__mmMetametrics = ${analyticsEnabled}; window.postMessage('updateFavorites', '*'); `; this.setState({ homepageScripts }, () => { @@ -1161,9 +1167,12 @@ export class BrowserTab extends PureComponent { Logger.error('Error adding to spotlight', e); } } + const analyticsEnabled = Analytics.getEnabled(); + const homepageScripts = ` window.__mmFavorites = ${JSON.stringify(this.props.bookmarks)}; window.__mmSearchEngine="${this.props.searchEngine}"; + window.__mmMetametrics = ${analyticsEnabled}; `; this.setState({ homepageScripts }); } diff --git a/app/util/browserScripts.js b/app/util/browserScripts.js index 71ff8116a86..d9fc50ad0bf 100644 --- a/app/util/browserScripts.js +++ b/app/util/browserScripts.js @@ -73,26 +73,6 @@ export const JS_WINDOW_INFORMATION = ` })(); `; -export const JS_WINDOW_INFORMATION_HEIGHT = os => ` - (function () { - ${getWindowInformation} - ${ - os === 'ios' - ? `setTimeout(() => { - const height = Math.max(document.documentElement.clientHeight, document.documentElement.scrollHeight, document.body.clientHeight, document.body.scrollHeight); - window.ReactNativeWebView && window.ReactNativeWebView.postMessage(JSON.stringify( - { - type: 'GET_HEIGHT', - payload: { - height: height - } - })) - }, 500)` - : '' - } - })(); -`; - export const JS_DESELECT_TEXT = `if (window.getSelection) {window.getSelection().removeAllRanges();} else if (document.selection) {document.selection.empty();}`;