@@ -498,7 +498,7 @@ function detectDeviceImpl(
498498 userAgentData ?: NavigatorUAData
499499) : BuiltinHandlerName | undefined {
500500 logger . debug (
501- 'detectDeviceImpl() [userAgent:%s , userAgentData:%o]' ,
501+ 'detectDeviceImpl() [userAgent:"%s" , userAgentData:%o]' ,
502502 userAgent ,
503503 userAgentData
504504 ) ;
@@ -508,59 +508,89 @@ function detectDeviceImpl(
508508 userAgentData
509509 ) ;
510510
511- if ( chromiumMajorVersion && chromiumMajorVersion >= 111 ) {
512- logger . debug ( 'detectDeviceImpl() | using Chrome111 handler' ) ;
511+ if ( chromiumMajorVersion ) {
512+ if ( chromiumMajorVersion >= 111 ) {
513+ logger . debug ( 'detectDeviceImpl() | using Chrome111 handler' ) ;
513514
514- return 'Chrome111' ;
515- } else if ( chromiumMajorVersion && chromiumMajorVersion >= 74 ) {
516- logger . debug ( 'detectDeviceImpl() | using Chrome74 handler' ) ;
515+ return 'Chrome111' ;
516+ } else if ( chromiumMajorVersion >= 74 ) {
517+ logger . debug ( 'detectDeviceImpl() | using Chrome74 handler' ) ;
517518
518- return 'Chrome74' ;
519+ return 'Chrome74' ;
520+ } else {
521+ logger . warn (
522+ 'detectDeviceImpl() | unsupported Chromium based browser/version'
523+ ) ;
524+
525+ return undefined ;
526+ }
519527 }
520528
521529 const firefoxMajorVersion = getFirefoxMajorVersion ( userAgent ) ;
522530
523- if ( firefoxMajorVersion && firefoxMajorVersion >= 120 ) {
524- logger . debug ( 'detectDeviceImpl() | using Firefox120 handler' ) ;
531+ if ( firefoxMajorVersion ) {
532+ if ( firefoxMajorVersion >= 120 ) {
533+ logger . debug ( 'detectDeviceImpl() | using Firefox120 handler' ) ;
525534
526- return 'Firefox120' ;
535+ return 'Firefox120' ;
536+ } else {
537+ logger . warn ( 'detectDeviceImpl() | unsupported Firefox browser/version' ) ;
538+
539+ return undefined ;
540+ }
527541 }
528542
529543 const macOSWebKitMajorVersion = getMacOSWebKitMajorVersion ( userAgent ) ;
530544
531- if ( macOSWebKitMajorVersion && macOSWebKitMajorVersion >= 605 ) {
532- logger . debug ( 'detectDeviceImpl() | using Safari12 handler' ) ;
545+ if ( macOSWebKitMajorVersion ) {
546+ if ( macOSWebKitMajorVersion >= 605 ) {
547+ logger . debug ( 'detectDeviceImpl() | using Safari12 handler' ) ;
548+
549+ return 'Safari12' ;
550+ } else {
551+ logger . warn (
552+ 'detectDeviceImpl() | unsupported desktop Safari browser/version'
553+ ) ;
533554
534- return 'Safari12' ;
555+ return undefined ;
556+ }
535557 }
536558
537559 const iOSWebKitMajorVersion = getIOSWebKitMajorVersion ( userAgent ) ;
538560
539- if ( iOSWebKitMajorVersion && iOSWebKitMajorVersion >= 605 ) {
540- logger . debug ( 'detectDeviceImpl() | using Safari12 handler' ) ;
561+ if ( iOSWebKitMajorVersion ) {
562+ if ( iOSWebKitMajorVersion >= 605 ) {
563+ logger . debug ( 'detectDeviceImpl() | using Safari12 handler' ) ;
564+
565+ return 'Safari12' ;
566+ } else {
567+ logger . warn (
568+ 'detectDeviceImpl() | unsupported iOS Safari based browser/version'
569+ ) ;
541570
542- return 'Safari12' ;
571+ return undefined ;
572+ }
543573 }
544574
545575 if ( isReactNative ( ) ) {
546576 if (
547- typeof RTCPeerConnection === 'undefined' ||
548- typeof RTCRtpTransceiver = == 'undefined'
577+ typeof RTCPeerConnection !== 'undefined' &&
578+ typeof RTCRtpTransceiver ! == 'undefined'
549579 ) {
580+ logger . debug ( 'detectDeviceImpl() | using ReactNative106 handler' ) ;
581+
582+ return 'ReactNative106' ;
583+ } else {
550584 logger . warn (
551585 'detectDeviceImpl() | unsupported react-native-webrtc version without RTCPeerConnection or RTCRtpTransceiver, forgot to call registerGlobals() on it?'
552586 ) ;
553587
554588 return undefined ;
555589 }
556-
557- logger . debug ( 'detectDeviceImpl() | using ReactNative106 handler' ) ;
558-
559- return 'ReactNative106' ;
560590 }
561591
562592 logger . warn (
563- 'detectDeviceImpl() | device not supported [userAgent:%s , userAgentData:%o]' ,
593+ 'detectDeviceImpl() | device not supported [userAgent:"%s" , userAgentData:%o]' ,
564594 userAgent ,
565595 userAgentData
566596 ) ;
0 commit comments