Skip to content

Commit 32826b5

Browse files
rgomezpjkasten2
authored andcommitted
trailing spaces, refactored requiresUserInteraction to use returns
1 parent c547387 commit 32826b5

File tree

5 files changed

+9
-12
lines changed

5 files changed

+9
-12
lines changed

src/context/browser/helpers/EnvironmentInfoHelper.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class EnvironmentInfoHelper {
3838
if (typeof window.safari !== "undefined") {
3939
return true;
4040
}
41-
41+
4242
return isMacOSSafariInIframe();
4343
}
4444

@@ -53,25 +53,23 @@ export class EnvironmentInfoHelper {
5353
private static isUsingSubscriptionWorkaround(): boolean {
5454
return OneSignalUtils.isUsingSubscriptionWorkaround();
5555
}
56-
56+
5757
private static supportsServiceWorkers(): boolean {
58-
return (navigator && 'serviceWorker' in navigator);
58+
return (window.navigator && 'serviceWorker' in window.navigator);
5959
}
6060

6161
private static requiresUserInteraction(): boolean {
62-
let requiresUserInteraction = false;
63-
6462
// Firefox 72+ requires user-interaction
6563
if (this.getBrowser() === "firefox" && this.getBrowserVersion() >= 72) {
66-
requiresUserInteraction = true;
64+
return true;
6765
}
6866

6967
// Safari 12.1+ requires user-interaction
7068
if (this.getBrowser() === "safari" && this.getBrowserVersion() >= 12.1) {
71-
requiresUserInteraction = true;
69+
return true;
7270
}
7371

74-
return requiresUserInteraction;
72+
return false;
7573
}
7674

7775
private static getOsVersion(): string|number {

src/context/browser/models/Browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ export enum Browser {
55
Opera = "opera",
66
Edge = "edge",
77
Other = "other"
8-
}
8+
}

src/context/browser/models/EnvironmentInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ export interface EnvironmentInfo {
88
isUsingSubscriptionWorkaround: boolean;
99
isBrowserAndSupportsServiceWorkers: boolean;
1010
requiresUserInteraction: boolean;
11-
osVersion: string|number;
11+
osVersion: string|number;
1212
}

test/support/sdk/TestEnvironment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ export class TestEnvironment {
307307

308308
static overrideEnvironmentInfo(envInfo: Partial<EnvironmentInfo> = {}) {
309309
global.OneSignal.environmentInfo = { ...global.OneSignal.environmentInfo, ...envInfo };
310-
}
310+
}
311311

312312
// This allows detailed error printing of test that fails due to missing network mock or other reasons.
313313
static addUnhandledRejectionHandler() {

test/unit/prompts/CustomLink.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,6 @@ test('customlink: subscribe: clicked: unsubscribed -> subscribed. https. never s
291291

292292
test('customlink: subscribe: clicked: unsubscribed -> subscribed. http. never subscribed.', async t => {
293293
TestEnvironment.overrideEnvironmentInfo({requiresUserInteraction: false});
294-
295294
sandbox.stub(OneSignal, 'privateIsPushNotificationsEnabled').returns(false);
296295
sandbox.stub(OneSignal, 'setSubscription').resolves();
297296
const registerSpy = sandbox.stub(OneSignal, 'registerForPushNotifications').resolves();

0 commit comments

Comments
 (0)