Skip to content

Commit 7161183

Browse files
authored
Merge pull request #13527 from guardian/ph-20250305-1005-ios9
decommission iOS9 sign-in gate check
2 parents 3e94bad + a1b0e85 commit 7161183

File tree

3 files changed

+2
-75
lines changed

3 files changed

+2
-75
lines changed

dotcom-rendering/src/components/SignInGate/displayRule.test.ts

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { incrementDailyArticleCount } from '../../lib/dailyArticleCount';
22
import {
3-
isIOS9,
43
isNPageOrHigherPageView,
54
isValidContentType,
65
isValidSection,
@@ -61,61 +60,6 @@ describe('SignInGate - displayRule methods', () => {
6160
});
6261
});
6362

64-
describe('isIOS9', () => {
65-
// spy on user agent to mock return value
66-
const userAgentGetter = jest.spyOn(
67-
window.navigator,
68-
'userAgent',
69-
'get',
70-
);
71-
72-
test('iphone ios9 is true', () => {
73-
userAgentGetter.mockReturnValueOnce(
74-
'Mozilla/5.0 (iPhone; CPU OS 9_0 like Mac OS X) AppleWebKit/601.1.17 (KHTML, like Gecko) Version/8.0 Mobile/13A175 Safari/600.1.4',
75-
);
76-
expect(isIOS9()).toBe(true);
77-
});
78-
79-
test('ipad ios9 is true', () => {
80-
userAgentGetter.mockReturnValueOnce(
81-
'Mozilla/5.0 (iPad; CPU OS 9_0 like Mac OS X) AppleWebKit/601.1.17 (KHTML, like Gecko) Version/8.0 Mobile/13A175 Safari/600.1.4',
82-
);
83-
expect(isIOS9()).toBe(true);
84-
});
85-
86-
test('ipod ios9 is true', () => {
87-
userAgentGetter.mockReturnValueOnce(
88-
'Mozilla/5.0 (iPod; CPU OS 9_0 like Mac OS X) AppleWebKit/601.1.17 (KHTML, like Gecko) Version/8.0 Mobile/13A175 Safari/600.1.4',
89-
);
90-
expect(isIOS9()).toBe(true);
91-
});
92-
93-
test('iphone not ios9 is false', () => {
94-
userAgentGetter.mockReturnValueOnce(
95-
'Mozilla/5.0 (iPhone; CPU OS 10_3 like Mac OS X) AppleWebKit/601.1.17 (KHTML, like Gecko) Version/8.0 Mobile/13A175 Safari/600.1.4',
96-
);
97-
expect(isIOS9()).toBe(false);
98-
});
99-
100-
test('ipad not ios9 is false', () => {
101-
userAgentGetter.mockReturnValueOnce(
102-
'Mozilla/5.0 (iPad; CPU OS 8_1 like Mac OS X) AppleWebKit/601.1.17 (KHTML, like Gecko) Version/8.0 Mobile/13A175 Safari/600.1.4',
103-
);
104-
expect(isIOS9()).toBe(false);
105-
});
106-
107-
test('ipod not ios9 is false', () => {
108-
userAgentGetter.mockReturnValueOnce(
109-
'Mozilla/5.0 (iPod; CPU OS 7_0 like Mac OS X) AppleWebKit/601.1.17 (KHTML, like Gecko) Version/8.0 Mobile/13A175 Safari/600.1.4',
110-
);
111-
expect(isIOS9()).toBe(false);
112-
});
113-
114-
test('not ios device is false', () => {
115-
expect(isIOS9()).toBe(false);
116-
});
117-
});
118-
11963
describe('isValidContentType', () => {
12064
test('is a valid type - article', () => {
12165
expect(isValidContentType('Article')).toBe(true);

dotcom-rendering/src/components/SignInGate/displayRule.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,6 @@ export const isNPageOrHigherPageView = (n = 2): boolean => {
1717
return count >= n;
1818
};
1919

20-
// determine if the useragent is running iOS 9 (known to be buggy for sign in flow)
21-
export const isIOS9 = (): boolean => {
22-
// get the browser user agent
23-
const ua = navigator.userAgent;
24-
// check useragent if the device is an iOS device
25-
const appleDevice = /(iPhone|iPod|iPad)/i.test(ua);
26-
// check useragent if the os is version 9
27-
const os = /(CPU OS 9_)/i.test(ua);
28-
29-
// if both true, then it's an apple ios 9 device
30-
return appleDevice && os;
31-
};
32-
3320
// hide the sign in gate on article types that are not supported
3421
export const isValidContentType = (contentType: string): boolean => {
3522
// It's safer to definitively *include* types as we
@@ -95,8 +82,7 @@ export const canShowSignInGate = ({
9582
// hide the sign in gate on isPaidContent
9683
!isPaidContent &&
9784
// hide the sign in gate on internal tools preview &&
98-
!isPreview &&
99-
!isIOS9(),
85+
!isPreview,
10086
);
10187

10288
export const canShowSignInGateMandatory: ({
@@ -164,7 +150,6 @@ export const canShowSignInGateWithOffers = ({
164150
!isPaidContent &&
165151
// hide the sign in gate on internal tools preview &&
166152
!isPreview &&
167-
!isIOS9() &&
168153
// hide the sign in gate for AU and US readers
169154
!['AU', ...US_REGION_CODES].includes(currentLocaleCode),
170155
);

dotcom-rendering/src/components/SignInGate/gates/main-control.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { hasUserDismissedGate } from '../dismissGate';
22
import {
3-
isIOS9,
43
isNPageOrHigherPageView,
54
isValidContentType,
65
isValidSection,
@@ -27,8 +26,7 @@ const canShow = ({
2726
// hide the sign in gate on isPaidContent
2827
!isPaidContent &&
2928
// hide the sign in gate on internal tools preview
30-
!isPreview &&
31-
!isIOS9(),
29+
!isPreview,
3230
);
3331

3432
export const signInGateComponent: SignInGateComponent = {

0 commit comments

Comments
 (0)