@mpxjs/api-proxy 2.9.67 → 2.9.69-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/@types/index.d.ts +13 -0
  2. package/package.json +3 -4
  3. package/src/common/js/promisify.js +11 -3
  4. package/src/platform/api/action-sheet/rnActionSheet.jsx +72 -81
  5. package/src/platform/api/app/index.web.js +26 -11
  6. package/src/platform/api/create-intersection-observer/rnIntersectionObserver.js +17 -14
  7. package/src/platform/api/create-selector-query/rnNodesRef.js +1 -6
  8. package/src/platform/api/image/index.ali.js +4 -1
  9. package/src/platform/api/image/index.ios.js +45 -0
  10. package/src/platform/api/image/index.js +4 -1
  11. package/src/platform/api/image/index.web.js +46 -2
  12. package/src/platform/api/modal/rnModal.jsx +8 -9
  13. package/src/platform/api/next-tick/index.ios.js +7 -1
  14. package/src/platform/api/request/index.web.js +2 -3
  15. package/src/platform/api/route/index.ios.js +50 -10
  16. package/src/platform/api/set-navigation-bar/index.ali.js +6 -1
  17. package/src/platform/api/set-navigation-bar/index.ios.js +6 -3
  18. package/src/platform/api/set-navigation-bar/index.js +4 -1
  19. package/src/platform/api/set-navigation-bar/index.web.js +5 -2
  20. package/src/platform/api/setting/index.js +19 -0
  21. package/src/platform/api/storage/index.web.js +1 -1
  22. package/src/platform/api/storage/rnStorage.js +1 -1
  23. package/src/platform/api/system/index.ali.js +7 -1
  24. package/src/platform/api/system/index.ios.js +84 -1
  25. package/src/platform/api/system/index.js +7 -1
  26. package/src/platform/api/system/index.web.js +77 -16
  27. package/src/platform/api/system/rnSystem.js +48 -68
  28. package/src/platform/api/toast/rnToast.jsx +24 -17
  29. package/src/platform/index.js +4 -4
  30. package/LICENSE +0 -433
  31. package/src/platform/api/lifecycle/index.ali.js +0 -9
  32. package/src/platform/api/lifecycle/index.js +0 -7
  33. package/src/platform/api/lifecycle/index.web.js +0 -12
  34. package/src/platform/api/system/rnWindowInfo.js +0 -42
@@ -1,5 +1,6 @@
1
1
  import { successHandle, failHandle } from '../../../common/js'
2
2
  import { parseUrlQuery as parseUrl } from '@mpxjs/utils'
3
+ import { nextTick } from '../next-tick'
3
4
 
4
5
  function getBasePath (navigation) {
5
6
  if (navigation) {
@@ -33,7 +34,12 @@ function resolvePath (relative, base) {
33
34
  return stack.join('/')
34
35
  }
35
36
 
37
+ let toPending = false
36
38
  function navigateTo (options = {}) {
39
+ if (toPending) {
40
+ return
41
+ }
42
+ toPending = true
37
43
  const navigation = Object.values(global.__mpxPagesMap || {})[0]?.[1]
38
44
  const navigationHelper = global.__navigationHelper
39
45
  if (navigation && navigationHelper) {
@@ -49,10 +55,17 @@ function navigateTo (options = {}) {
49
55
  const res = { errMsg: `navigateTo:fail ${msg}` }
50
56
  failHandle(res, options.fail, options.complete)
51
57
  }
58
+ navigationHelper.transitionEndCallback = () => {
59
+ toPending = false
60
+ }
52
61
  }
53
62
  }
54
-
63
+ let redirectPending = false
55
64
  function redirectTo (options = {}) {
65
+ if (redirectPending) {
66
+ return
67
+ }
68
+ redirectPending = true
56
69
  const navigation = Object.values(global.__mpxPagesMap || {})[0]?.[1]
57
70
  const navigationHelper = global.__navigationHelper
58
71
  if (navigation && navigationHelper) {
@@ -68,26 +81,50 @@ function redirectTo (options = {}) {
68
81
  const res = { errMsg: `redirectTo:fail ${msg}` }
69
82
  failHandle(res, options.fail, options.complete)
70
83
  }
84
+ navigationHelper.transitionEndCallback = () => {
85
+ redirectPending = false
86
+ }
71
87
  }
72
88
  }
73
-
89
+ let backPending = false
74
90
  function navigateBack (options = {}) {
91
+ if (backPending) {
92
+ return
93
+ }
94
+ backPending = true
75
95
  const navigation = Object.values(global.__mpxPagesMap || {})[0]?.[1]
76
96
  const navigationHelper = global.__navigationHelper
77
97
  if (navigation && navigationHelper) {
78
- navigation.pop(options.delta || 1)
79
- navigationHelper.lastSuccessCallback = () => {
80
- const res = { errMsg: 'navigateBack:ok' }
81
- successHandle(res, options.success, options.complete)
98
+ const delta = options.delta || 1
99
+ const routeLength = navigation.getState().routes.length
100
+ if (delta >= routeLength && global.__mpx?.config.rnConfig.onAppBack?.(delta - routeLength + 1)) {
101
+ nextTick(() => {
102
+ backPending = false
103
+ const res = { errMsg: 'navigateBack:ok' }
104
+ successHandle(res, options.success, options.complete)
105
+ })
106
+ } else {
107
+ navigation.pop(delta)
108
+ navigationHelper.lastSuccessCallback = () => {
109
+ const res = { errMsg: 'navigateBack:ok' }
110
+ successHandle(res, options.success, options.complete)
111
+ }
112
+ navigationHelper.lastFailCallback = (msg) => {
113
+ const res = { errMsg: `navigateBack:fail ${msg}` }
114
+ failHandle(res, options.fail, options.complete)
115
+ }
82
116
  }
83
- navigationHelper.lastFailCallback = (msg) => {
84
- const res = { errMsg: `navigateBack:fail ${msg}` }
85
- failHandle(res, options.fail, options.complete)
117
+ navigationHelper.transitionEndCallback = () => {
118
+ backPending = false
86
119
  }
87
120
  }
88
121
  }
89
-
122
+ let reLaunchPending = false
90
123
  function reLaunch (options = {}) {
124
+ if (reLaunchPending) {
125
+ return
126
+ }
127
+ reLaunchPending = true
91
128
  const navigation = Object.values(global.__mpxPagesMap || {})[0]?.[1]
92
129
  const navigationHelper = global.__navigationHelper
93
130
  if (navigation && navigationHelper) {
@@ -111,6 +148,9 @@ function reLaunch (options = {}) {
111
148
  const res = { errMsg: `redirectTo:fail ${msg}` }
112
149
  failHandle(res, options.fail, options.complete)
113
150
  }
151
+ navigationHelper.transitionEndCallback = () => {
152
+ reLaunchPending = false
153
+ }
114
154
  }
115
155
  }
116
156
 
@@ -17,7 +17,12 @@ function setNavigationBarColor (options = {}) {
17
17
  return ENV_OBJ.setNavigationBar(options)
18
18
  }
19
19
 
20
+ function hideHomeButton (options = {}) {
21
+ return ENV_OBJ.hideBackHome(options)
22
+ }
23
+
20
24
  export {
21
25
  setNavigationBarTitle,
22
- setNavigationBarColor
26
+ setNavigationBarColor,
27
+ hideHomeButton
23
28
  }
@@ -1,4 +1,4 @@
1
- import { successHandle, failHandle, getFocusedNavigation } from '../../../common/js'
1
+ import { successHandle, failHandle, getFocusedNavigation, envError } from '../../../common/js'
2
2
  import { nextTick } from '../next-tick'
3
3
  function setNavigationBarTitle (options = {}) {
4
4
  const { title = '', success, fail, complete } = options
@@ -7,7 +7,7 @@ function setNavigationBarTitle (options = {}) {
7
7
  failHandle({ errMsg: 'setNavigationBarTitle:fail' }, fail, complete)
8
8
  } else {
9
9
  nextTick(() => {
10
- navigation.setOptions({ headerTitle: title })
10
+ navigation.setOptions({ title })
11
11
  successHandle({ errMsg: 'setNavigationBarTitle:ok' }, success, complete)
12
12
  })
13
13
  }
@@ -31,7 +31,10 @@ function setNavigationBarColor (options = {}) {
31
31
  }
32
32
  }
33
33
 
34
+ const hideHomeButton = envError('hideHomeButton')
35
+
34
36
  export {
35
37
  setNavigationBarTitle,
36
- setNavigationBarColor
38
+ setNavigationBarColor,
39
+ hideHomeButton
37
40
  }
@@ -4,7 +4,10 @@ const setNavigationBarTitle = ENV_OBJ.setNavigationBarTitle || envError('setNavi
4
4
 
5
5
  const setNavigationBarColor = ENV_OBJ.setNavigationBarColor || envError('setNavigationBarColor')
6
6
 
7
+ const hideHomeButton = ENV_OBJ.hideHomeButton || envError('hideHomeButton')
8
+
7
9
  export {
8
10
  setNavigationBarTitle,
9
- setNavigationBarColor
11
+ setNavigationBarColor,
12
+ hideHomeButton
10
13
  }
@@ -1,4 +1,4 @@
1
- import { isBrowser, throwSSRWarning, successHandle } from '../../../common/js'
1
+ import { isBrowser, envError, throwSSRWarning, successHandle } from '../../../common/js'
2
2
 
3
3
  function setNavigationBarTitle (options = {}) {
4
4
  if (!isBrowser) {
@@ -26,7 +26,10 @@ function setNavigationBarColor (options = {}) {
26
26
  successHandle({ errMsg: 'setNavigationBarColor:ok' }, success, complete)
27
27
  }
28
28
 
29
+ const hideHomeButton = envError('hideHomeButton')
30
+
29
31
  export {
30
32
  setNavigationBarTitle,
31
- setNavigationBarColor
33
+ setNavigationBarColor,
34
+ hideHomeButton
32
35
  }
@@ -0,0 +1,19 @@
1
+ import { ENV_OBJ, envError } from '../../../common/js'
2
+
3
+ const getSetting = ENV_OBJ.getSetting || envError('getSetting')
4
+
5
+ const openSetting = ENV_OBJ.openSetting || envError('openSetting')
6
+
7
+ const enableAlertBeforeUnload = ENV_OBJ.enableAlertBeforeUnload || envError('enableAlertBeforeUnload')
8
+
9
+ const disableAlertBeforeUnload = ENV_OBJ.disableAlertBeforeUnload || envError('disableAlertBeforeUnload')
10
+
11
+ const getMenuButtonBoundingClientRect = ENV_OBJ.getMenuButtonBoundingClientRect || envError('getMenuButtonBoundingClientRect')
12
+
13
+ export {
14
+ getSetting,
15
+ openSetting,
16
+ enableAlertBeforeUnload,
17
+ disableAlertBeforeUnload,
18
+ getMenuButtonBoundingClientRect
19
+ }
@@ -69,7 +69,7 @@ function getItem (key) {
69
69
  } catch (e) {
70
70
  }
71
71
 
72
- if (item && typeof item === 'object' && hasOwn(item, 'data')) {
72
+ if (hasOwn(item, 'data')) {
73
73
  return { result: true, data: item.data }
74
74
  } else {
75
75
  return { result: false }
@@ -49,7 +49,7 @@ function getStorage (options = {}) {
49
49
  item = JSON.parse(res)
50
50
  } catch (e) {
51
51
  }
52
- if (item && typeof item === 'object' && hasOwn(item, 'data')) {
52
+ if (hasOwn(item, 'data')) {
53
53
  data = item.data
54
54
  }
55
55
  const result = {
@@ -40,9 +40,15 @@ const getDeviceInfo = function () {
40
40
 
41
41
  const getWindowInfo = ENV_OBJ.getWindowInfo || envError('getWindowInfo')
42
42
 
43
+ const getLaunchOptionsSync = ENV_OBJ.getLaunchOptionsSync || envError('getLaunchOptionsSync')
44
+
45
+ const getEnterOptionsSync = ENV_OBJ.getEnterOptionsSync || envError('getEnterOptionsSync')
46
+
43
47
  export {
44
48
  getSystemInfo,
45
49
  getSystemInfoSync,
46
50
  getDeviceInfo,
47
- getWindowInfo
51
+ getWindowInfo,
52
+ getLaunchOptionsSync,
53
+ getEnterOptionsSync
48
54
  }
@@ -1 +1,84 @@
1
- export * from './rnSystem'
1
+ import DeviceInfo from 'react-native-device-info'
2
+ import { PixelRatio } from 'react-native'
3
+ import { successHandle, failHandle, defineUnsupportedProps } from '../../../common/js'
4
+ import { getWindowInfo, getLaunchOptionsSync, getEnterOptionsSync } from './rnSystem'
5
+
6
+ const getSystemInfoSync = function () {
7
+ const windowInfo = getWindowInfo()
8
+ const { screenWidth, screenHeight } = windowInfo
9
+
10
+ const result = {
11
+ brand: DeviceInfo.getBrand(),
12
+ model: DeviceInfo.getModel(),
13
+ system: `${DeviceInfo.getSystemName()} ${DeviceInfo.getSystemVersion()}`,
14
+ platform: DeviceInfo.isEmulatorSync() ? 'emulator' : DeviceInfo.getSystemName(),
15
+ deviceOrientation: screenWidth > screenHeight ? 'portrait' : 'landscape',
16
+ fontSizeSetting: PixelRatio.getFontScale()
17
+ }
18
+ Object.assign(result, windowInfo)
19
+ defineUnsupportedProps(result, [
20
+ 'language',
21
+ 'version',
22
+ 'SDKVersion',
23
+ 'benchmarkLevel',
24
+ 'albumAuthorized',
25
+ 'cameraAuthorized',
26
+ 'locationAuthorized',
27
+ 'microphoneAuthorized',
28
+ 'notificationAuthorized',
29
+ 'phoneCalendarAuthorized',
30
+ 'host',
31
+ 'enableDebug',
32
+ 'notificationAlertAuthorized',
33
+ 'notificationBadgeAuthorized',
34
+ 'notificationSoundAuthorized',
35
+ 'bluetoothEnabled',
36
+ 'locationEnabled',
37
+ 'wifiEnabled',
38
+ 'locationReducedAccuracy',
39
+ 'theme'
40
+ ])
41
+ return result
42
+ }
43
+
44
+ const getSystemInfo = function (options = {}) {
45
+ const { success, fail, complete } = options
46
+ try {
47
+ const systemInfo = getSystemInfoSync()
48
+ Object.assign(systemInfo, {
49
+ errMsg: 'setStorage:ok'
50
+ })
51
+ successHandle(systemInfo, success, complete)
52
+ } catch (err) {
53
+ const result = {
54
+ errMsg: `getSystemInfo:fail ${err}`
55
+ }
56
+ failHandle(result, fail, complete)
57
+ }
58
+ }
59
+
60
+ const getDeviceInfo = function () {
61
+ const deviceInfo = {}
62
+ if (__mpx_mode__ === 'android') {
63
+ const deviceAbi = DeviceInfo.supported64BitAbisSync() || []
64
+ deviceInfo.deviceAbi = deviceAbi[0] || null
65
+ }
66
+ defineUnsupportedProps(deviceInfo, ['benchmarkLevel', 'abi', 'cpuType'])
67
+ Object.assign(deviceInfo, {
68
+ brand: DeviceInfo.getBrand(),
69
+ model: DeviceInfo.getModel(),
70
+ system: `${DeviceInfo.getSystemName()} ${DeviceInfo.getSystemVersion()}`,
71
+ platform: DeviceInfo.isEmulatorSync() ? 'emulator' : DeviceInfo.getSystemName(),
72
+ memorySize: DeviceInfo.getTotalMemorySync() / (1024 * 1024)
73
+ })
74
+ return deviceInfo
75
+ }
76
+
77
+ export {
78
+ getSystemInfo,
79
+ getSystemInfoSync,
80
+ getDeviceInfo,
81
+ getWindowInfo,
82
+ getLaunchOptionsSync,
83
+ getEnterOptionsSync
84
+ }
@@ -8,9 +8,15 @@ const getDeviceInfo = ENV_OBJ.getDeviceInfo || envError('getDeviceInfo')
8
8
 
9
9
  const getWindowInfo = ENV_OBJ.getWindowInfo || envError('getWindowInfo')
10
10
 
11
+ const getLaunchOptionsSync = ENV_OBJ.getLaunchOptionsSync || envError('getLaunchOptionsSync')
12
+
13
+ const getEnterOptionsSync = ENV_OBJ.getEnterOptionsSync || envError('getEnterOptionsSync')
14
+
11
15
  export {
12
16
  getSystemInfo,
13
17
  getSystemInfoSync,
14
18
  getDeviceInfo,
15
- getWindowInfo
19
+ getWindowInfo,
20
+ getLaunchOptionsSync,
21
+ getEnterOptionsSync
16
22
  }
@@ -1,10 +1,6 @@
1
- import { envError, isBrowser, throwSSRWarning, successHandle } from '../../../common/js'
1
+ import { isBrowser, throwSSRWarning, successHandle } from '../../../common/js'
2
2
 
3
- function getSystemInfoSync () {
4
- if (!isBrowser) {
5
- throwSSRWarning('getSystemInfoSync API is running in non browser environments')
6
- return
7
- }
3
+ const getDeviceInfo = function () {
8
4
  const ua = navigator.userAgent.split('(')[1]?.split(')')[0] || ''
9
5
  const phones = new Map([
10
6
  ['iPhone', /iPhone|iPad|iPod|iOS/i],
@@ -37,20 +33,57 @@ function getSystemInfoSync () {
37
33
  } else {
38
34
  system = `Android ${ua.replace(/^.*Android ([\d.]+);.*$/, '$1')}`
39
35
  }
40
-
41
36
  return {
42
- brand: brand,
37
+ abi: null,
38
+ deviceAbi: null,
39
+ benchmarkLevel: null,
40
+ brand,
43
41
  model: brand,
42
+ system,
43
+ platform: navigator.platform,
44
+ cpuType: null,
45
+ memorySize: null
46
+ }
47
+ }
48
+
49
+ const getWindowInfo = function () {
50
+ return {
44
51
  pixelRatio: window.devicePixelRatio,
45
52
  screenWidth: window.screen.width,
46
53
  screenHeight: window.screen.height,
47
54
  windowWidth: document.documentElement.clientWidth,
48
55
  windowHeight: document.documentElement.clientHeight,
49
56
  statusBarHeight: null,
57
+ safeArea: null,
58
+ screenTop: null
59
+ }
60
+ }
61
+
62
+ function getSystemInfoSync () {
63
+ if (!isBrowser) {
64
+ throwSSRWarning('getSystemInfoSync API is running in non browser environments')
65
+ return
66
+ }
67
+
68
+ const {
69
+ pixelRatio,
70
+ screenWidth,
71
+ screenHeight,
72
+ windowWidth,
73
+ windowHeight,
74
+ statusBarHeight,
75
+ safeArea
76
+ } = getWindowInfo()
77
+ const {
78
+ benchmarkLevel,
79
+ brand,
80
+ model,
81
+ system,
82
+ platform
83
+ } = getDeviceInfo()
84
+ const result = Object.assign({
50
85
  language: navigator.language,
51
86
  version: null,
52
- system,
53
- platform: navigator.platform,
54
87
  fontSizeSetting: null,
55
88
  SDKVersion: null,
56
89
  benchmarkLevel: null,
@@ -64,9 +97,23 @@ function getSystemInfoSync () {
64
97
  notificationSoundAuthorized: null,
65
98
  bluetoothEnabled: null,
66
99
  locationEnabled: null,
67
- wifiEnabled: null,
68
- safeArea: null
69
- }
100
+ wifiEnabled: null
101
+ }, {
102
+ pixelRatio,
103
+ screenWidth,
104
+ screenHeight,
105
+ windowWidth,
106
+ windowHeight,
107
+ statusBarHeight,
108
+ safeArea
109
+ }, {
110
+ benchmarkLevel,
111
+ brand,
112
+ model,
113
+ system,
114
+ platform
115
+ })
116
+ return result
70
117
  }
71
118
 
72
119
  function getSystemInfo (options = {}) {
@@ -79,13 +126,27 @@ function getSystemInfo (options = {}) {
79
126
  successHandle(res, options.success, options.complete)
80
127
  }
81
128
 
82
- const getDeviceInfo = envError('getDeviceInfo')
129
+ const getEnterOptionsSync = function () {
130
+ if (!isBrowser) {
131
+ throwSSRWarning('getEnterOptionsSync API is running in non browser environments')
132
+ return
133
+ }
134
+ return global.__mpxEnterOptions || {}
135
+ }
83
136
 
84
- const getWindowInfo = envError('getWindowInfo')
137
+ const getLaunchOptionsSync = function () {
138
+ if (!isBrowser) {
139
+ throwSSRWarning('getLaunchOptionsSync API is running in non browser environments')
140
+ return
141
+ }
142
+ return global.__mpxEnterOptions || {}
143
+ }
85
144
 
86
145
  export {
87
146
  getSystemInfo,
88
147
  getSystemInfoSync,
89
148
  getDeviceInfo,
90
- getWindowInfo
149
+ getWindowInfo,
150
+ getLaunchOptionsSync,
151
+ getEnterOptionsSync
91
152
  }
@@ -1,83 +1,63 @@
1
- import DeviceInfo from 'react-native-device-info'
2
- import { PixelRatio } from 'react-native'
3
- import { successHandle, failHandle, defineUnsupportedProps } from '../../../common/js'
4
- import { getWindowInfo } from './rnWindowInfo'
1
+ import { PixelRatio, Dimensions } from 'react-native'
2
+ import { initialWindowMetrics } from 'react-native-safe-area-context'
3
+ import { getFocusedNavigation } from '../../../common/js'
5
4
 
6
- const getSystemInfoSync = function () {
7
- const windowInfo = getWindowInfo()
8
- const { screenWidth, screenHeight, safeArea } = windowInfo
5
+ const getWindowInfo = function () {
6
+ const dimensionsScreen = Dimensions.get('screen')
7
+ const navigation = getFocusedNavigation() || {}
8
+ const initialWindowMetricsInset = initialWindowMetrics?.insets || {}
9
+ const navigationInsets = navigation.insets || {}
10
+ const insets = Object.assign(initialWindowMetricsInset, navigationInsets)
11
+ let safeArea = {}
12
+ const { top = 0, bottom = 0, left = 0, right = 0 } = insets
9
13
 
14
+ const screenHeight = __mpx_mode__ === 'ios' ? dimensionsScreen.height : dimensionsScreen.height - bottom // 解决安卓开启屏幕内三建导航安卓把安全区计算进去后产生的影响
15
+ const screenWidth = __mpx_mode__ === 'ios' ? dimensionsScreen.width : dimensionsScreen.width - right
16
+ const layout = navigation.layout || {}
17
+ const layoutHeight = layout.height || 0
18
+ const layoutWidth = layout.width || 0
19
+ const windowHeight = layoutHeight || screenHeight
20
+ try {
21
+ safeArea = {
22
+ left,
23
+ right: screenWidth - right,
24
+ top,
25
+ bottom: screenHeight - bottom,
26
+ height: screenHeight - top - bottom,
27
+ width: screenWidth - left - right
28
+ }
29
+ } catch (error) {
30
+ }
10
31
  const result = {
11
- brand: DeviceInfo.getBrand(),
12
- model: DeviceInfo.getModel(),
13
- system: `${DeviceInfo.getSystemName()} ${DeviceInfo.getSystemVersion()}`,
14
- platform: DeviceInfo.isEmulatorSync() ? 'emulator' : DeviceInfo.getSystemName(),
15
- deviceOrientation: screenWidth > screenHeight ? 'portrait' : 'landscape',
32
+ pixelRatio: PixelRatio.get(),
33
+ windowWidth: layoutWidth || screenWidth,
34
+ windowHeight, // 取不到layout的时候有个兜底
35
+ screenWidth: screenWidth,
36
+ screenHeight: screenHeight,
37
+ screenTop: screenHeight - windowHeight,
16
38
  statusBarHeight: safeArea.top,
17
- fontSizeSetting: PixelRatio.getFontScale(),
18
- ...windowInfo
39
+ safeArea
19
40
  }
20
- defineUnsupportedProps(result, [
21
- 'language',
22
- 'version',
23
- 'SDKVersion',
24
- 'benchmarkLevel',
25
- 'albumAuthorized',
26
- 'cameraAuthorized',
27
- 'locationAuthorized',
28
- 'microphoneAuthorized',
29
- 'notificationAuthorized',
30
- 'phoneCalendarAuthorized',
31
- 'host',
32
- 'enableDebug',
33
- 'notificationAlertAuthorized',
34
- 'notificationBadgeAuthorized',
35
- 'notificationSoundAuthorized',
36
- 'bluetoothEnabled',
37
- 'locationEnabled',
38
- 'wifiEnabled',
39
- 'locationReducedAccuracy',
40
- 'theme'
41
- ])
42
41
  return result
43
42
  }
44
43
 
45
- const getSystemInfo = function (options = {}) {
46
- const { success, fail, complete } = options
47
- try {
48
- const systemInfo = getSystemInfoSync()
49
- Object.assign(systemInfo, {
50
- errMsg: 'setStorage:ok'
51
- })
52
- successHandle(systemInfo, success, complete)
53
- } catch (err) {
54
- const result = {
55
- errMsg: `getSystemInfo:fail ${err}`
56
- }
57
- failHandle(result, fail, complete)
44
+ const getLaunchOptionsSync = function () {
45
+ const options = global.__mpxEnterOptions || {}
46
+ const { path, scene, query } = options
47
+ return {
48
+ path,
49
+ scene,
50
+ query
58
51
  }
59
52
  }
60
53
 
61
- const getDeviceInfo = function () {
62
- const deviceInfo = {}
63
- if (__mpx_mode__ === 'android') {
64
- const deviceAbi = DeviceInfo.supported64BitAbisSync() || []
65
- deviceInfo.deviceAbi = deviceAbi[0] || null
66
- }
67
- defineUnsupportedProps(deviceInfo, ['benchmarkLevel', 'abi', 'cpuType'])
68
- Object.assign(deviceInfo, {
69
- brand: DeviceInfo.getBrand(),
70
- model: DeviceInfo.getModel(),
71
- system: `${DeviceInfo.getSystemName()} ${DeviceInfo.getSystemVersion()}`,
72
- platform: DeviceInfo.isEmulatorSync() ? 'emulator' : DeviceInfo.getSystemName(),
73
- memorySize: DeviceInfo.getTotalMemorySync() / (1024 * 1024)
74
- })
75
- return deviceInfo
54
+ const getEnterOptionsSync = function () {
55
+ const result = getLaunchOptionsSync()
56
+ return result
76
57
  }
77
58
 
78
59
  export {
79
- getSystemInfo,
80
- getSystemInfoSync,
81
- getDeviceInfo,
82
- getWindowInfo
60
+ getWindowInfo,
61
+ getLaunchOptionsSync,
62
+ getEnterOptionsSync
83
63
  }