mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Fix ApplePay device detection for edge cases.
This commit is contained in:
parent
5bcb047e3a
commit
206db76887
2 changed files with 25 additions and 5 deletions
|
@ -98,11 +98,24 @@ return array(
|
|||
return false;
|
||||
}
|
||||
}
|
||||
foreach ( PropertiesDictionary::ALLOWED_USER_AGENTS as $allowed_agent ) {
|
||||
if ( strpos( $user_agent, $allowed_agent ) !== false ) {
|
||||
return true;
|
||||
|
||||
$browser_allowed = false;
|
||||
foreach ( PropertiesDictionary::ALLOWED_USER_BROWSERS as $allowed_browser ) {
|
||||
if ( strpos( $user_agent, $allowed_browser ) !== false ) {
|
||||
$browser_allowed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$device_allowed = false;
|
||||
foreach ( PropertiesDictionary::ALLOWED_USER_DEVICES as $allowed_devices ) {
|
||||
if ( strpos( $user_agent, $allowed_devices ) !== false ) {
|
||||
$device_allowed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $browser_allowed && $device_allowed;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
|
|
@ -13,8 +13,15 @@ namespace WooCommerce\PayPalCommerce\Applepay\Assets;
|
|||
* Class PropertiesDictionary
|
||||
*/
|
||||
class PropertiesDictionary {
|
||||
public const DISALLOWED_USER_AGENTS = array( 'Chrome' );
|
||||
public const ALLOWED_USER_AGENTS = array( 'Safari', 'Macintosh', 'iPhone', 'iPad', 'iPod' );
|
||||
public const DISALLOWED_USER_AGENTS = array(
|
||||
'Chrome/',
|
||||
'CriOS/', // Chrome on iOS.
|
||||
'Firefox/',
|
||||
'OPR/', // Opera.
|
||||
'Edg/', // Edge.
|
||||
);
|
||||
public const ALLOWED_USER_BROWSERS = array( 'Safari' );
|
||||
public const ALLOWED_USER_DEVICES = array( 'Macintosh', 'iPhone', 'iPad', 'iPod' );
|
||||
|
||||
public const BILLING_CONTACT_INVALID = 'billing Contact Invalid';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue