From 1ff2231140b0b431a38aeb2ef4c9c717805b941f Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Thu, 10 Dec 2015 20:43:57 -0600 Subject: [PATCH] fix(platform): fix testNavigatorPlatform regex --- ionic/platform/platform.ts | 6 ++---- ionic/platform/registry.ts | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ionic/platform/platform.ts b/ionic/platform/platform.ts index 0a3b67e3a5..05a2504ce5 100644 --- a/ionic/platform/platform.ts +++ b/ionic/platform/platform.ts @@ -301,10 +301,8 @@ export class Platform { * @returns {boolean} TODO */ testNavigatorPlatform(navigatorPlatformExpression) { - if (navigatorPlatformExpression && this._bPlt) { - let rgx = new RegExp(navigatorPlatformExpression, 'i'); - return rgx.test(this._bPlt); - } + let rgx = new RegExp(navigatorPlatformExpression, 'i'); + return rgx.test(this._bPlt); } /** diff --git a/ionic/platform/registry.ts b/ionic/platform/registry.ts index abf3218527..b8c209e5ee 100644 --- a/ionic/platform/registry.ts +++ b/ionic/platform/registry.ts @@ -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/i)) { + if (p.testNavigatorPlatform('linux')) { 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/i); + return p.testNavigatorPlatform('iphone|ipad|ipod'); }