File tree Expand file tree Collapse file tree 5 files changed +9
-12
lines changed Expand file tree Collapse file tree 5 files changed +9
-12
lines changed Original file line number Diff line number Diff 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 {
Original file line number Diff line number Diff line change @@ -5,4 +5,4 @@ export enum Browser {
55 Opera = "opera" ,
66 Edge = "edge" ,
77 Other = "other"
8- }
8+ }
Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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 ( ) {
Original file line number Diff line number Diff line change @@ -291,7 +291,6 @@ test('customlink: subscribe: clicked: unsubscribed -> subscribed. https. never s
291291
292292test ( '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 ( ) ;
You can’t perform that action at this time.
0 commit comments