File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -23,14 +23,16 @@ import ReactDOM from 'react-dom'
2323import AppInit , { setupSentry } from './AppInit'
2424import './init'
2525import { navigateToPreview } from './modules/Stream/StartPreviewFrame'
26+ import { optedInByLocalhost } from 'browser-services/preview-optin-service'
2627
2728setupSentry ( )
29+
2830; ( async ( ) => {
29- const doesPreferQuery = localStorage . getItem ( 'prefersOldBrowser' ) === 'false'
31+ const optedInToPreview = optedInByLocalhost ( )
3032 try {
3133 const response = await fetch ( './preview/manifest.json' )
3234 if ( response . status === 200 ) {
33- if ( doesPreferQuery ) {
35+ if ( optedInToPreview ) {
3436 navigateToPreview ( )
3537 } else {
3638 localStorage . setItem ( 'previewAvailable' , 'true' )
Original file line number Diff line number Diff line change 1+ const notOptedOutOfPreview = ( ) : boolean => {
2+ const prefersOldBrowser = localStorage . getItem ( 'prefersOldBrowser' )
3+ const doesPreferQuery = prefersOldBrowser === 'false'
4+
5+ return doesPreferQuery || prefersOldBrowser === null
6+ }
7+
8+ export const optedInByLocalhost = ( ) : boolean => {
9+ console . log ( 'notOptedOutOfPreview' , notOptedOutOfPreview ( ) )
10+ console . log ( 'window.location.hostname' , window . location . hostname )
11+ return notOptedOutOfPreview ( ) && window . location . hostname === 'localhost'
12+ }
You can’t perform that action at this time.
0 commit comments