Skip to content

Commit 3e6fa6b

Browse files
owopsjunteng.zjt
andauthored
Fix platform (#112)
* fix platform regix test ua to lowercase * version plus * android platform regix fix Co-authored-by: junteng.zjt <[email protected]>
1 parent fac67ca commit 3e6fa6b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/device/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "universal-device",
33
"author": "rax",
4-
"version": "2.3.0",
4+
"version": "2.3.1",
55
"license": "BSD-3-Clause",
66
"main": "lib/index.js",
77
"files": [

packages/device/src/web/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
function getPlatform() {
22
const platform = navigator.platform;
33
if (platform) {
4-
if (/(iphone|ipod|ipad)/.test(navigator.userAgent)) return 'iOS';
5-
if (/android/.test(navigator.userAgent)) return 'Android';
4+
if (/(iphone|ipod|ipad)/.test(navigator.userAgent.toLowerCase())) return 'iOS';
5+
if (/android/.test(navigator.userAgent.toLowerCase())) return 'Android';
66
return platform;
77
}
88
return;

0 commit comments

Comments
 (0)