Skip to content

Commit

Permalink
Add iphone family devices (#1784)
Browse files Browse the repository at this point in the history
* Ignore vscode user conf folder

* Add iPhone descriptors

Co-authored-by: ccarmona <carlos.carmona@williamhill.com>
  • Loading branch information
carmonac and carmonac committed Jul 16, 2021
1 parent b4db427 commit ad28b6f
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,6 @@ demos/PuppeteerSharpPdfDemo/google.pdf
demos/PuppeteerSharpPdfDemo/.local-chromium/
docs/
samples/PupppeterSharpAspNetFrameworkSample/PupppeterSharpAspNetFrameworkSample/App_Data/

# Visual Studio Code user config directory
.vscode/
32 changes: 32 additions & 0 deletions lib/PuppeteerSharp/Mobile/DeviceDescriptorName.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,38 @@ public enum DeviceDescriptorName
/// </summary>
IPhoneXLandscape,
/// <summary>
/// iPhone XR
/// </summary>
IPhoneXR,
/// <summary>
/// iPhone XR landscape
/// </summary>
IPhoneXRLandscape,
/// <summary>
/// iPhone 11 landscape
/// </summary>
IPhone11,
/// <summary>
/// iPhone 11 landscape
/// </summary>
IPhone11Landscape,
/// <summary>
/// iPhone 11 Pro
/// </summary>
IPhone11Pro,
/// <summary>
/// iPhone 11 Pro landscape
/// </summary>
IPhone11ProLandscape,
/// <summary>
/// iPhone 11 Pro Max
/// </summary>
IPhone11ProMax,
/// <summary>
/// iPhone 11 Pro Max landscape
/// </summary>
IPhone11ProMaxLandscape,
/// <summary>
/// JioPhone 2
/// </summary>
JioPhone2,
Expand Down
118 changes: 115 additions & 3 deletions lib/PuppeteerSharp/Mobile/DeviceDescriptors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,37 @@ public static class DeviceDescriptors
},
[DeviceDescriptorName.IPhoneX] = new DeviceDescriptor
{
Name = "iPhone XR",
Name = "iPhone X",
UserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1",
ViewPort = new ViewPortOptions
{
Width = 375,
Height = 812,
DeviceScaleFactor = 3,
IsMobile = true,
HasTouch = true,
IsLandscape = false
}
},
[DeviceDescriptorName.IPhoneXLandscape] = new DeviceDescriptor
{
Name = "iPhone X landscape",
UserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1",
ViewPort = new ViewPortOptions
{
Width = 812,
Height = 375,
DeviceScaleFactor = 3,
IsMobile = true,
HasTouch = true,
IsLandscape = true
}
},
[DeviceDescriptorName.IPhoneXR] = new DeviceDescriptor
{
Name = "iPhone XR",
UserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1",
ViewPort = new ViewPortOptions
{
Width = 414,
Height = 896,
Expand All @@ -529,10 +557,94 @@ public static class DeviceDescriptors
IsLandscape = false
}
},
[DeviceDescriptorName.IPhoneXLandscape] = new DeviceDescriptor
[DeviceDescriptorName.IPhoneXRLandscape] = new DeviceDescriptor
{
Name = "iPhone XR landscape",
UserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1",
UserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1",
ViewPort = new ViewPortOptions
{
Width = 896,
Height = 414,
DeviceScaleFactor = 3,
IsMobile = true,
HasTouch = true,
IsLandscape = true
}
},
[DeviceDescriptorName.IPhone11] = new DeviceDescriptor
{
Name = "iPhone 11",
UserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Mobile/15E148 Safari/604.1",
ViewPort = new ViewPortOptions
{
Width = 414,
Height = 896,
DeviceScaleFactor = 3,
IsMobile = true,
HasTouch = true,
IsLandscape = false
}
},
[DeviceDescriptorName.IPhone11Landscape] = new DeviceDescriptor
{
Name = "iPhone 11 landscape",
UserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Mobile/15E148 Safari/604.1",
ViewPort = new ViewPortOptions
{
Width = 896,
Height = 414,
DeviceScaleFactor = 3,
IsMobile = true,
HasTouch = true,
IsLandscape = true
}
},
[DeviceDescriptorName.IPhone11Pro] = new DeviceDescriptor
{
Name = "iPhone 11 Pro",
UserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Mobile/15E148 Safari/604.1",
ViewPort = new ViewPortOptions
{
Width = 375,
Height = 812,
DeviceScaleFactor = 3,
IsMobile = true,
HasTouch = true,
IsLandscape = false
}
},
[DeviceDescriptorName.IPhone11ProLandscape] = new DeviceDescriptor
{
Name = "iPhone 11 Pro landscape",
UserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Mobile/15E148 Safari/604.1",
ViewPort = new ViewPortOptions
{
Width = 812,
Height = 375,
DeviceScaleFactor = 3,
IsMobile = true,
HasTouch = true,
IsLandscape = true
}
},
[DeviceDescriptorName.IPhone11ProMax] = new DeviceDescriptor
{
Name = "iPhone 11 Pro Max",
UserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Mobile/15E148 Safari/604.1",
ViewPort = new ViewPortOptions
{
Width = 414,
Height = 896,
DeviceScaleFactor = 3,
IsMobile = true,
HasTouch = true,
IsLandscape = false
}
},
[DeviceDescriptorName.IPhone11ProMaxLandscape] = new DeviceDescriptor
{
Name = "iPhone 11 Pro Max landscape",
UserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Mobile/15E148 Safari/604.1",
ViewPort = new ViewPortOptions
{
Width = 896,
Expand Down

0 comments on commit ad28b6f

Please sign in to comment.