1+ using System ;
12using System . Collections . Generic ;
3+ using System . Collections . ObjectModel ;
24
35namespace PuppeteerSharp . Mobile
46{
57 /// <summary>
68 /// Device descriptors.
79 /// </summary>
8- public class DeviceDescriptors
10+ public static class DeviceDescriptors
911 {
1012 private static readonly Dictionary < DeviceDescriptorName , DeviceDescriptor > Devices = new Dictionary < DeviceDescriptorName , DeviceDescriptor >
1113 {
@@ -152,7 +154,7 @@ public class DeviceDescriptors
152154 [ DeviceDescriptorName . GalaxyS5 ] = new DeviceDescriptor
153155 {
154156 Name = "Galaxy S5" ,
155- UserAgent = "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73 .0.3679 .0 Mobile Safari/537.36" ,
157+ UserAgent = "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75 .0.3765 .0 Mobile Safari/537.36" ,
156158 ViewPort = new ViewPortOptions
157159 {
158160 Width = 360 ,
@@ -166,7 +168,7 @@ public class DeviceDescriptors
166168 [ DeviceDescriptorName . GalaxyS5Landscape ] = new DeviceDescriptor
167169 {
168170 Name = "Galaxy S5 landscape" ,
169- UserAgent = "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73 .0.3679 .0 Mobile Safari/537.36" ,
171+ UserAgent = "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75 .0.3765 .0 Mobile Safari/537.36" ,
170172 ViewPort = new ViewPortOptions
171173 {
172174 Width = 640 ,
@@ -541,6 +543,34 @@ public class DeviceDescriptors
541543 IsLandscape = true
542544 }
543545 } ,
546+ [ DeviceDescriptorName . JioPhone2 ] = new DeviceDescriptor
547+ {
548+ Name = "JioPhone 2" ,
549+ UserAgent = "Mozilla/5.0 (Mobile; LYF/F300B/LYF-F300B-001-01-15-130718-i;Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5" ,
550+ ViewPort = new ViewPortOptions
551+ {
552+ Width = 240 ,
553+ Height = 320 ,
554+ DeviceScaleFactor = 1 ,
555+ IsMobile = true ,
556+ HasTouch = true ,
557+ IsLandscape = false
558+ }
559+ } ,
560+ [ DeviceDescriptorName . JioPhone2Landscape ] = new DeviceDescriptor
561+ {
562+ Name = "JioPhone 2 landscape" ,
563+ UserAgent = "Mozilla/5.0 (Mobile; LYF/F300B/LYF-F300B-001-01-15-130718-i;Android; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5" ,
564+ ViewPort = new ViewPortOptions
565+ {
566+ Width = 320 ,
567+ Height = 240 ,
568+ DeviceScaleFactor = 1 ,
569+ IsMobile = true ,
570+ HasTouch = true ,
571+ IsLandscape = true
572+ }
573+ } ,
544574 [ DeviceDescriptorName . KindleFireHDX ] = new DeviceDescriptor
545575 {
546576 Name = "Kindle Fire HDX" ,
@@ -572,7 +602,7 @@ public class DeviceDescriptors
572602 [ DeviceDescriptorName . LGOptimusL70 ] = new DeviceDescriptor
573603 {
574604 Name = "LG Optimus L70" ,
575- UserAgent = "Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/73 .0.3679 .0 Mobile Safari/537.36" ,
605+ UserAgent = "Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75 .0.3765 .0 Mobile Safari/537.36" ,
576606 ViewPort = new ViewPortOptions
577607 {
578608 Width = 384 ,
@@ -586,7 +616,7 @@ public class DeviceDescriptors
586616 [ DeviceDescriptorName . LGOptimusL70Landscape ] = new DeviceDescriptor
587617 {
588618 Name = "LG Optimus L70 landscape" ,
589- UserAgent = "Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/73 .0.3679 .0 Mobile Safari/537.36" ,
619+ UserAgent = "Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75 .0.3765 .0 Mobile Safari/537.36" ,
590620 ViewPort = new ViewPortOptions
591621 {
592622 Width = 640 ,
@@ -642,7 +672,7 @@ public class DeviceDescriptors
642672 [ DeviceDescriptorName . Nexus10 ] = new DeviceDescriptor
643673 {
644674 Name = "Nexus 10" ,
645- UserAgent = "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73 .0.3679 .0 Safari/537.36" ,
675+ UserAgent = "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75 .0.3765 .0 Safari/537.36" ,
646676 ViewPort = new ViewPortOptions
647677 {
648678 Width = 800 ,
@@ -656,7 +686,7 @@ public class DeviceDescriptors
656686 [ DeviceDescriptorName . Nexus10Landscape ] = new DeviceDescriptor
657687 {
658688 Name = "Nexus 10 landscape" ,
659- UserAgent = "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73 .0.3679 .0 Safari/537.36" ,
689+ UserAgent = "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75 .0.3765 .0 Safari/537.36" ,
660690 ViewPort = new ViewPortOptions
661691 {
662692 Width = 1280 ,
@@ -670,7 +700,7 @@ public class DeviceDescriptors
670700 [ DeviceDescriptorName . Nexus4 ] = new DeviceDescriptor
671701 {
672702 Name = "Nexus 4" ,
673- UserAgent = "Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73 .0.3679 .0 Mobile Safari/537.36" ,
703+ UserAgent = "Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75 .0.3765 .0 Mobile Safari/537.36" ,
674704 ViewPort = new ViewPortOptions
675705 {
676706 Width = 384 ,
@@ -684,7 +714,7 @@ public class DeviceDescriptors
684714 [ DeviceDescriptorName . Nexus4Landscape ] = new DeviceDescriptor
685715 {
686716 Name = "Nexus 4 landscape" ,
687- UserAgent = "Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73 .0.3679 .0 Mobile Safari/537.36" ,
717+ UserAgent = "Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75 .0.3765 .0 Mobile Safari/537.36" ,
688718 ViewPort = new ViewPortOptions
689719 {
690720 Width = 640 ,
@@ -698,7 +728,7 @@ public class DeviceDescriptors
698728 [ DeviceDescriptorName . Nexus5 ] = new DeviceDescriptor
699729 {
700730 Name = "Nexus 5" ,
701- UserAgent = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73 .0.3679 .0 Mobile Safari/537.36" ,
731+ UserAgent = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75 .0.3765 .0 Mobile Safari/537.36" ,
702732 ViewPort = new ViewPortOptions
703733 {
704734 Width = 360 ,
@@ -712,7 +742,7 @@ public class DeviceDescriptors
712742 [ DeviceDescriptorName . Nexus5Landscape ] = new DeviceDescriptor
713743 {
714744 Name = "Nexus 5 landscape" ,
715- UserAgent = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73 .0.3679 .0 Mobile Safari/537.36" ,
745+ UserAgent = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75 .0.3765 .0 Mobile Safari/537.36" ,
716746 ViewPort = new ViewPortOptions
717747 {
718748 Width = 640 ,
@@ -726,7 +756,7 @@ public class DeviceDescriptors
726756 [ DeviceDescriptorName . Nexus5X ] = new DeviceDescriptor
727757 {
728758 Name = "Nexus 5X" ,
729- UserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73 .0.3679 .0 Mobile Safari/537.36" ,
759+ UserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75 .0.3765 .0 Mobile Safari/537.36" ,
730760 ViewPort = new ViewPortOptions
731761 {
732762 Width = 412 ,
@@ -740,7 +770,7 @@ public class DeviceDescriptors
740770 [ DeviceDescriptorName . Nexus5XLandscape ] = new DeviceDescriptor
741771 {
742772 Name = "Nexus 5X landscape" ,
743- UserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73 .0.3679 .0 Mobile Safari/537.36" ,
773+ UserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75 .0.3765 .0 Mobile Safari/537.36" ,
744774 ViewPort = new ViewPortOptions
745775 {
746776 Width = 732 ,
@@ -754,7 +784,7 @@ public class DeviceDescriptors
754784 [ DeviceDescriptorName . Nexus6 ] = new DeviceDescriptor
755785 {
756786 Name = "Nexus 6" ,
757- UserAgent = "Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73 .0.3679 .0 Mobile Safari/537.36" ,
787+ UserAgent = "Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75 .0.3765 .0 Mobile Safari/537.36" ,
758788 ViewPort = new ViewPortOptions
759789 {
760790 Width = 412 ,
@@ -768,7 +798,7 @@ public class DeviceDescriptors
768798 [ DeviceDescriptorName . Nexus6Landscape ] = new DeviceDescriptor
769799 {
770800 Name = "Nexus 6 landscape" ,
771- UserAgent = "Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73 .0.3679 .0 Mobile Safari/537.36" ,
801+ UserAgent = "Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75 .0.3765 .0 Mobile Safari/537.36" ,
772802 ViewPort = new ViewPortOptions
773803 {
774804 Width = 732 ,
@@ -782,7 +812,7 @@ public class DeviceDescriptors
782812 [ DeviceDescriptorName . Nexus6P ] = new DeviceDescriptor
783813 {
784814 Name = "Nexus 6P" ,
785- UserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73 .0.3679 .0 Mobile Safari/537.36" ,
815+ UserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75 .0.3765 .0 Mobile Safari/537.36" ,
786816 ViewPort = new ViewPortOptions
787817 {
788818 Width = 412 ,
@@ -796,7 +826,7 @@ public class DeviceDescriptors
796826 [ DeviceDescriptorName . Nexus6PLandscape ] = new DeviceDescriptor
797827 {
798828 Name = "Nexus 6P landscape" ,
799- UserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73 .0.3679 .0 Mobile Safari/537.36" ,
829+ UserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75 .0.3765 .0 Mobile Safari/537.36" ,
800830 ViewPort = new ViewPortOptions
801831 {
802832 Width = 732 ,
@@ -810,7 +840,7 @@ public class DeviceDescriptors
810840 [ DeviceDescriptorName . Nexus7 ] = new DeviceDescriptor
811841 {
812842 Name = "Nexus 7" ,
813- UserAgent = "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73 .0.3679 .0 Safari/537.36" ,
843+ UserAgent = "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75 .0.3765 .0 Safari/537.36" ,
814844 ViewPort = new ViewPortOptions
815845 {
816846 Width = 600 ,
@@ -824,7 +854,7 @@ public class DeviceDescriptors
824854 [ DeviceDescriptorName . Nexus7Landscape ] = new DeviceDescriptor
825855 {
826856 Name = "Nexus 7 landscape" ,
827- UserAgent = "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73 .0.3679 .0 Safari/537.36" ,
857+ UserAgent = "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75 .0.3765 .0 Safari/537.36" ,
828858 ViewPort = new ViewPortOptions
829859 {
830860 Width = 960 ,
@@ -894,7 +924,7 @@ public class DeviceDescriptors
894924 [ DeviceDescriptorName . Pixel2 ] = new DeviceDescriptor
895925 {
896926 Name = "Pixel 2" ,
897- UserAgent = "Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73 .0.3679 .0 Mobile Safari/537.36" ,
927+ UserAgent = "Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75 .0.3765 .0 Mobile Safari/537.36" ,
898928 ViewPort = new ViewPortOptions
899929 {
900930 Width = 411 ,
@@ -908,7 +938,7 @@ public class DeviceDescriptors
908938 [ DeviceDescriptorName . Pixel2Landscape ] = new DeviceDescriptor
909939 {
910940 Name = "Pixel 2 landscape" ,
911- UserAgent = "Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73 .0.3679 .0 Mobile Safari/537.36" ,
941+ UserAgent = "Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75 .0.3765 .0 Mobile Safari/537.36" ,
912942 ViewPort = new ViewPortOptions
913943 {
914944 Width = 731 ,
@@ -922,7 +952,7 @@ public class DeviceDescriptors
922952 [ DeviceDescriptorName . Pixel2XL ] = new DeviceDescriptor
923953 {
924954 Name = "Pixel 2 XL" ,
925- UserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73 .0.3679 .0 Mobile Safari/537.36" ,
955+ UserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75 .0.3765 .0 Mobile Safari/537.36" ,
926956 ViewPort = new ViewPortOptions
927957 {
928958 Width = 411 ,
@@ -936,7 +966,7 @@ public class DeviceDescriptors
936966 [ DeviceDescriptorName . Pixel2XLLandscape ] = new DeviceDescriptor
937967 {
938968 Name = "Pixel 2 XL landscape" ,
939- UserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73 .0.3679 .0 Mobile Safari/537.36" ,
969+ UserAgent = "Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75 .0.3765 .0 Mobile Safari/537.36" ,
940970 ViewPort = new ViewPortOptions
941971 {
942972 Width = 823 ,
@@ -949,11 +979,17 @@ public class DeviceDescriptors
949979 }
950980 } ;
951981
982+ private static Lazy < IReadOnlyDictionary < DeviceDescriptorName , DeviceDescriptor > > _readOnlyDevices =
983+ new Lazy < IReadOnlyDictionary < DeviceDescriptorName , DeviceDescriptor > > ( ( ) => new ReadOnlyDictionary < DeviceDescriptorName , DeviceDescriptor > ( Devices ) ) ;
984+
985+ internal static IReadOnlyDictionary < DeviceDescriptorName , DeviceDescriptor > ToReadOnly ( ) => _readOnlyDevices . Value ;
986+
952987 /// <summary>
953988 /// Get the specified device description.
954989 /// </summary>
955990 /// <returns>The device descriptor.</returns>
956991 /// <param name="name">Device Name.</param>
992+ [ Obsolete ( "Use Puppeteer.Devices instead" ) ]
957993 public static DeviceDescriptor Get ( DeviceDescriptorName name ) => Devices [ name ] ;
958994 }
959995}
0 commit comments