-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat-image-opt
- Loading branch information
Showing
10 changed files
with
162 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,84 @@ | ||
export * from './rnSystem' | ||
import DeviceInfo from 'react-native-device-info' | ||
import { PixelRatio } from 'react-native' | ||
import { successHandle, failHandle, defineUnsupportedProps } from '../../../common/js' | ||
import { getWindowInfo, getLaunchOptionsSync, getEnterOptionsSync } from './rnSystem' | ||
|
||
const getSystemInfoSync = function () { | ||
const windowInfo = getWindowInfo() | ||
const { screenWidth, screenHeight } = windowInfo | ||
|
||
const result = { | ||
brand: DeviceInfo.getBrand(), | ||
model: DeviceInfo.getModel(), | ||
system: `${DeviceInfo.getSystemName()} ${DeviceInfo.getSystemVersion()}`, | ||
platform: DeviceInfo.isEmulatorSync() ? 'emulator' : DeviceInfo.getSystemName(), | ||
deviceOrientation: screenWidth > screenHeight ? 'portrait' : 'landscape', | ||
fontSizeSetting: PixelRatio.getFontScale() | ||
} | ||
Object.assign(result, windowInfo) | ||
defineUnsupportedProps(result, [ | ||
'language', | ||
'version', | ||
'SDKVersion', | ||
'benchmarkLevel', | ||
'albumAuthorized', | ||
'cameraAuthorized', | ||
'locationAuthorized', | ||
'microphoneAuthorized', | ||
'notificationAuthorized', | ||
'phoneCalendarAuthorized', | ||
'host', | ||
'enableDebug', | ||
'notificationAlertAuthorized', | ||
'notificationBadgeAuthorized', | ||
'notificationSoundAuthorized', | ||
'bluetoothEnabled', | ||
'locationEnabled', | ||
'wifiEnabled', | ||
'locationReducedAccuracy', | ||
'theme' | ||
]) | ||
return result | ||
} | ||
|
||
const getSystemInfo = function (options = {}) { | ||
const { success, fail, complete } = options | ||
try { | ||
const systemInfo = getSystemInfoSync() | ||
Object.assign(systemInfo, { | ||
errMsg: 'setStorage:ok' | ||
}) | ||
successHandle(systemInfo, success, complete) | ||
} catch (err) { | ||
const result = { | ||
errMsg: `getSystemInfo:fail ${err}` | ||
} | ||
failHandle(result, fail, complete) | ||
} | ||
} | ||
|
||
const getDeviceInfo = function () { | ||
const deviceInfo = {} | ||
if (__mpx_mode__ === 'android') { | ||
const deviceAbi = DeviceInfo.supported64BitAbisSync() || [] | ||
deviceInfo.deviceAbi = deviceAbi[0] || null | ||
} | ||
defineUnsupportedProps(deviceInfo, ['benchmarkLevel', 'abi', 'cpuType']) | ||
Object.assign(deviceInfo, { | ||
brand: DeviceInfo.getBrand(), | ||
model: DeviceInfo.getModel(), | ||
system: `${DeviceInfo.getSystemName()} ${DeviceInfo.getSystemVersion()}`, | ||
platform: DeviceInfo.isEmulatorSync() ? 'emulator' : DeviceInfo.getSystemName(), | ||
memorySize: DeviceInfo.getTotalMemorySync() / (1024 * 1024) | ||
}) | ||
return deviceInfo | ||
} | ||
|
||
export { | ||
getSystemInfo, | ||
getSystemInfoSync, | ||
getDeviceInfo, | ||
getWindowInfo, | ||
getLaunchOptionsSync, | ||
getEnterOptionsSync | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
packages/api-proxy/src/platform/api/system/rnWindowInfo.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.