fix(platform): pass regexp to testNavigatorPlatform

This commit is contained in:
Max Lynch
2015-12-04 11:02:49 -06:00
parent 82e49331b1
commit 2c13de9c7b
2 changed files with 3 additions and 4 deletions

View File

@@ -301,8 +301,7 @@ export class Platform {
* @returns {boolean} TODO
*/
testNavigatorPlatform(navigatorPlatformExpression) {
let rgx = new RegExp(navigatorPlatformExpression, 'i');
return rgx.test(this._bPlt || '');
return navigatorPlatformExpression.test(this._bPlt || '');
}
/**

View File

@@ -52,7 +52,7 @@ Platform.register({
// however, under-powered devices shouldn't use ripple
// if this a linux device, and is using Android Chrome v36 (Android 5.0)
// or above then use ripple, otherwise do not use a ripple effect
if (p.testNavigatorPlatform('linux')) {
if (p.testNavigatorPlatform('/linux/i')) {
let chromeVersion = p.matchUserAgentVersion(/Chrome\/(\d+).(\d+)?/);
if (chromeVersion) {
// linux android device using modern android chrome browser gets ripple
@@ -175,5 +175,5 @@ function isIOSDevice(p) {
// checks navigator.platform to see if it's an actual iOS device
// this does not use the user-agent string because it is often spoofed
// an actual iPad will return true, a chrome dev tools iPad will return false
return p.testNavigatorPlatform(/iphone|ipad|ipod/);
return p.testNavigatorPlatform(/iphone|ipad|ipod/i);
}