You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
601 B
29 lines
601 B
/** |
|
* 获取系统信息 |
|
*/ |
|
|
|
let systemInfo = null |
|
|
|
export const getSystemInfo = (isForce) => { |
|
if (!systemInfo || isForce) { |
|
try { |
|
systemInfo = wx.getSystemInfoSync() |
|
} catch(e) { /* Ignore */ } |
|
} |
|
|
|
return systemInfo |
|
} |
|
|
|
// iPhoneX 竖屏安全区域 |
|
export const safeAreaInset = { |
|
top: 88, // StatusBar & NavBar |
|
left: 0, |
|
right: 0, |
|
bottom: 34, // Home Indicator |
|
} |
|
|
|
const isIPhoneX = ({ model, platform }) => { |
|
return /iPhone X/.test(model) && platform === 'ios' |
|
} |
|
|
|
export const checkIPhoneX = (isForce) => isIPhoneX(getSystemInfo(isForce))
|
|
|