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

Add useragent check to provide message to mobile users #101

Merged
merged 2 commits into from
Mar 30, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add useragent check to provide message to mobile users
  • Loading branch information
jamesfiltness committed Mar 30, 2017
commit 90496e1f5e8788d223ebd1f846deee56f361fce9
24 changes: 20 additions & 4 deletions app/components/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,18 @@ export class App extends React.Component {
});
}

render() {
isMobile() {
const userAgent = navigator.userAgent || navigator.vendor || window.opera;

// Windows Phone must come first because its UA also contains "Android"
if (/windows phone/i.test(userAgent) || /android/i.test(userAgent) || (/iPhone|iPod/.test(userAgent) && !window.MSStream)) {
return true;
}

return false;
}

renderApp() {
const {
dispatch,
artists,
Expand All @@ -69,8 +80,9 @@ export class App extends React.Component {
data-href="https://www.facebook.com/zuck"
data-layout="button"
data-size="large"
></div>
<div className="header__container">
>
</div>
<div className="header__container">
<h1 className="header__title">
<Link
className="header__title-link"
Expand Down Expand Up @@ -110,7 +122,11 @@ export class App extends React.Component {
<PlayQueueTools />
</div>
</div>
);
)
}

render() {
return this.isMobile() ? <p>Dont work on no mobile</p> : this.renderApp();
}
}

Expand Down