-
Notifications
You must be signed in to change notification settings - Fork 352
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
Adding advertisement tile for the new browser ui #1978
Changes from 1 commit
90f6a4d
b304944
93dcfa1
40ee890
d2bb86e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,4 +24,19 @@ import AppInit, { setupSentry } from './AppInit' | |
import './init' | ||
|
||
setupSentry() | ||
ReactDOM.render(<AppInit />, document.getElementById('mount')) | ||
;(async () => { | ||
const doesPreferQuery = localStorage.getItem('prefersOldBrowser') === 'false' | ||
|
||
const response = await fetch('/preview/manifest.json') | ||
if (response.status === 200) { | ||
if (doesPreferQuery) { | ||
window.location.pathname = '/preview/' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the bundled Browser case, the preview will be on So this would not work for bundled browser There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is so true. I've also realised while testing that switching back to browser removes the whole path, instead of just removing the preview(i remember i've tested it but probably did not test it appropriately :/ ) But I can create another pr to fix the query side. Changed this one to add preview to the current path. |
||
} else { | ||
localStorage.setItem('previewAvailable', 'true') | ||
} | ||
} else { | ||
localStorage.setItem('previewAvailable', 'false') | ||
} | ||
|
||
ReactDOM.render(<AppInit />, document.getElementById('mount')) | ||
})() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
fetch
can throw, so I think it'd be good with try { } catch { } hereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also needs to be
fetch('./preview/manifest.json')
to handle the bundled case where it's under/browser/preview
. And also to handle if users have set up their own custom hosting!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect point, changed it accordingly!