Skip to content

Commit 97ec20e

Browse files
mhartingtonadamdbradley
authored andcommitted
fix(ripple): disable ripple on android 4.4 with chrome
1 parent e80f4cf commit 97ec20e

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

src/config/test/config.spec.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ describe('Config', () => {
3737
expect(config.get('activator')).toEqual('none');
3838
});
3939

40-
it('should set activator setting to ripple for Android Chrome v36 and above on a linux device', () => {
41-
platform.setUserAgent('Mozilla/5.0 (Linux; Android 4.2.2; GT-I9505 Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1650.59 Mobile Safari/537.36');
40+
it('should set activator setting to ripple for Android v5.0 and above using Chrome v36 and above on a linux device', () => {
41+
platform.setUserAgent('Mozilla/5.0 (Linux; Android 5.0; Google Nexus 5 - 5.1.0 - API 22 - 1080x1920 Build/LMY47D) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Crosswalk/22.52.561.4 Mobile Safari/537.36');
4242
platform.setNavigatorPlatform('linux');
4343
platform.setQueryParams(qp);
4444
platform.init();
@@ -47,6 +47,16 @@ describe('Config', () => {
4747
expect(config.get('activator')).toEqual('ripple');
4848
});
4949

50+
it('should set activator setting to none for Android v4.4 and below and Chrome v36 and above on a linux device', () => {
51+
platform.setUserAgent('Mozilla/5.0 (Linux; Android 4.4.2; XT901 Build/KDA20.92-3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Crosswalk/22.52.561.4 Mobile Safari/537.36');
52+
platform.setNavigatorPlatform('linux');
53+
platform.setQueryParams(qp);
54+
platform.init();
55+
config.init(null, qp, platform);
56+
57+
expect(config.get('activator')).toEqual('none');
58+
});
59+
5060
it('should set activator setting to ripple for Android v5.0 and above on a linux device not using Chrome', () => {
5161
platform.setUserAgent('Mozilla/5.0 (Android 5.0; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0');
5262
platform.setNavigatorPlatform('linux');

src/platform/platform-registry.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Platform, PlatformConfig } from './platform';
44
import { windowLoad } from '../util/dom';
55

66

7-
export const PLATFORM_CONFIGS: {[key: string]: PlatformConfig} = {
7+
export const PLATFORM_CONFIGS: { [key: string]: PlatformConfig } = {
88

99
/**
1010
* core
@@ -29,7 +29,7 @@ export const PLATFORM_CONFIGS: {[key: string]: PlatformConfig} = {
2929
let smallest = Math.min(p.width(), p.height());
3030
let largest = Math.max(p.width(), p.height());
3131
return (smallest > 390 && smallest < 520) &&
32-
(largest > 620 && largest < 800);
32+
(largest > 620 && largest < 800);
3333
}
3434
},
3535

@@ -41,7 +41,7 @@ export const PLATFORM_CONFIGS: {[key: string]: PlatformConfig} = {
4141
let smallest = Math.min(p.width(), p.height());
4242
let largest = Math.max(p.width(), p.height());
4343
return (smallest > 460 && smallest < 820) &&
44-
(largest > 780 && largest < 1400);
44+
(largest > 780 && largest < 1400);
4545
}
4646
},
4747

@@ -64,7 +64,11 @@ export const PLATFORM_CONFIGS: {[key: string]: PlatformConfig} = {
6464
let chromeVersion = p.matchUserAgentVersion(/Chrome\/(\d+).(\d+)?/);
6565
if (chromeVersion) {
6666
// linux android device using modern android chrome browser gets ripple
67-
return (parseInt(chromeVersion.major, 10) < 36 ? 'none' : 'ripple');
67+
if (parseInt(chromeVersion.major, 10) < 36 || p.version().major < 5) {
68+
return 'none';
69+
} else {
70+
return 'ripple';
71+
}
6872
}
6973
// linux android device not using chrome browser checks just android's version
7074
if (p.version().major < 5) {

0 commit comments

Comments
 (0)