@mpxjs/api-proxy 2.10.16 → 2.10.17-beta.4
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.
- package/@types/index.d.ts +27 -0
- package/package.json +12 -5
- package/src/platform/api/action-sheet/index.ali.js +2 -1
- package/src/platform/api/animation/animation.ali.js +13 -0
- package/src/platform/api/ble-connection/index.ali.js +67 -2
- package/src/platform/api/ble-connection/index.ios.js +861 -0
- package/src/platform/api/ble-connection/index.js +65 -2
- package/src/platform/api/camera/index.ios.js +9 -0
- package/src/platform/api/camera/index.js +7 -0
- package/src/platform/api/camera/rnCamera.js +44 -0
- package/src/platform/api/create-intersection-observer/rnIntersectionObserver.js +3 -0
- package/src/platform/api/device/network/onNetworkStatusChange.js +3 -3
- package/src/platform/api/device/wifi/index.ios.js +236 -0
- package/src/platform/api/device/wifi/index.js +22 -0
- package/src/platform/api/route/index.ios.js +13 -7
- package/src/platform/api/system/index.ios.js +2 -2
- package/src/platform/api/system/rnSystem.js +1 -1
- package/src/platform/index.js +6 -0
- package/LICENSE +0 -433
|
@@ -6,8 +6,71 @@ const createBLEConnection = ENV_OBJ.createBLEConnection || envError('createBLECo
|
|
|
6
6
|
|
|
7
7
|
const onBLEConnectionStateChange = ENV_OBJ.onBLEConnectionStateChange || envError('onBLEConnectionStateChange')
|
|
8
8
|
|
|
9
|
+
const offBLEConnectionStateChange = ENV_OBJ.offBLEConnectionStateChange || envError('offBLEConnectionStateChange')
|
|
10
|
+
|
|
11
|
+
const openBluetoothAdapter = ENV_OBJ.openBluetoothAdapter || envError('openBluetoothAdapter')
|
|
12
|
+
|
|
13
|
+
const closeBluetoothAdapter = ENV_OBJ.closeBluetoothAdapter || envError('closeBluetoothAdapter')
|
|
14
|
+
|
|
15
|
+
const startBluetoothDevicesDiscovery = ENV_OBJ.startBluetoothDevicesDiscovery || envError('startBluetoothDevicesDiscovery')
|
|
16
|
+
|
|
17
|
+
const stopBluetoothDevicesDiscovery = ENV_OBJ.stopBluetoothDevicesDiscovery || envError('stopBluetoothDevicesDiscovery')
|
|
18
|
+
|
|
19
|
+
const onBluetoothDeviceFound = ENV_OBJ.onBluetoothDeviceFound || envError('onBluetoothDeviceFound')
|
|
20
|
+
|
|
21
|
+
const offBluetoothDeviceFound = ENV_OBJ.offBluetoothDeviceFound || envError('offBluetoothDeviceFound')
|
|
22
|
+
|
|
23
|
+
const getConnectedBluetoothDevices = ENV_OBJ.getConnectedBluetoothDevices || envError('getConnectedBluetoothDevices')
|
|
24
|
+
|
|
25
|
+
const getBluetoothAdapterState = ENV_OBJ.getBluetoothAdapterState || envError('getBluetoothAdapterState')
|
|
26
|
+
|
|
27
|
+
const onBluetoothAdapterStateChange = ENV_OBJ.onBluetoothAdapterStateChange || envError('onBluetoothAdapterStateChange')
|
|
28
|
+
|
|
29
|
+
const offBluetoothAdapterStateChange = ENV_OBJ.offBluetoothAdapterStateChange || envError('offBluetoothAdapterStateChange')
|
|
30
|
+
|
|
31
|
+
const getBluetoothDevices = ENV_OBJ.getBluetoothDevices || envError('getBluetoothDevices')
|
|
32
|
+
|
|
33
|
+
const writeBLECharacteristicValue = ENV_OBJ.writeBLECharacteristicValue || envError('writeBLECharacteristicValue')
|
|
34
|
+
|
|
35
|
+
const readBLECharacteristicValue = ENV_OBJ.readBLECharacteristicValue || envError('readBLECharacteristicValue')
|
|
36
|
+
|
|
37
|
+
const notifyBLECharacteristicValueChange = ENV_OBJ.notifyBLECharacteristicValueChange || envError('notifyBLECharacteristicValueChange')
|
|
38
|
+
|
|
39
|
+
const onBLECharacteristicValueChange = ENV_OBJ.onBLECharacteristicValueChange || envError('onBLECharacteristicValueChange')
|
|
40
|
+
|
|
41
|
+
const offBLECharacteristicValueChange = ENV_OBJ.offBLECharacteristicValueChange || envError('offBLECharacteristicValueChange')
|
|
42
|
+
|
|
43
|
+
const setBLEMTU = ENV_OBJ.setBLEMTU || envError('setBLEMTU')
|
|
44
|
+
|
|
45
|
+
const getBLEDeviceRSSI = ENV_OBJ.getBLEDeviceRSSI || envError('getBLEDeviceRSSI')
|
|
46
|
+
|
|
47
|
+
const getBLEDeviceServices = ENV_OBJ.getBLEDeviceServices || envError('getBLEDeviceServices')
|
|
48
|
+
|
|
49
|
+
const getBLEDeviceCharacteristics = ENV_OBJ.getBLEDeviceCharacteristics || envError('getBLEDeviceCharacteristics')
|
|
50
|
+
|
|
9
51
|
export {
|
|
10
|
-
|
|
52
|
+
onBLEConnectionStateChange,
|
|
53
|
+
offBLEConnectionStateChange,
|
|
54
|
+
openBluetoothAdapter,
|
|
55
|
+
closeBluetoothAdapter,
|
|
56
|
+
startBluetoothDevicesDiscovery,
|
|
57
|
+
stopBluetoothDevicesDiscovery,
|
|
58
|
+
onBluetoothDeviceFound,
|
|
59
|
+
offBluetoothDeviceFound,
|
|
60
|
+
getConnectedBluetoothDevices,
|
|
61
|
+
getBluetoothAdapterState,
|
|
62
|
+
onBluetoothAdapterStateChange,
|
|
63
|
+
offBluetoothAdapterStateChange,
|
|
64
|
+
getBluetoothDevices,
|
|
65
|
+
writeBLECharacteristicValue,
|
|
66
|
+
readBLECharacteristicValue,
|
|
67
|
+
notifyBLECharacteristicValueChange,
|
|
68
|
+
onBLECharacteristicValueChange,
|
|
69
|
+
offBLECharacteristicValueChange,
|
|
70
|
+
setBLEMTU,
|
|
71
|
+
getBLEDeviceRSSI,
|
|
72
|
+
getBLEDeviceServices,
|
|
73
|
+
getBLEDeviceCharacteristics,
|
|
11
74
|
createBLEConnection,
|
|
12
|
-
|
|
75
|
+
closeBLEConnection
|
|
13
76
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { noop, getFocusedNavigation } from '@mpxjs/utils'
|
|
2
|
+
|
|
3
|
+
export default class CreateCamera {
|
|
4
|
+
constructor () {
|
|
5
|
+
const navigation = getFocusedNavigation() || {}
|
|
6
|
+
this.camera = navigation.camera || {}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
setZoom (options = {}) {
|
|
10
|
+
const { zoom, success = noop, fail = noop, complete = noop } = options
|
|
11
|
+
try {
|
|
12
|
+
if (this.camera.setZoom) {
|
|
13
|
+
const result = { errMsg: 'setZoom:ok' }
|
|
14
|
+
success(result)
|
|
15
|
+
complete(result)
|
|
16
|
+
this.camera.setZoom(zoom)
|
|
17
|
+
} else {
|
|
18
|
+
const result = {
|
|
19
|
+
errMsg: 'setZoom:fail camera instance not found'
|
|
20
|
+
}
|
|
21
|
+
fail(result)
|
|
22
|
+
complete(result)
|
|
23
|
+
}
|
|
24
|
+
} catch (error) {
|
|
25
|
+
const result = {
|
|
26
|
+
errMsg: 'setZoom:fail ' + (error?.message || '')
|
|
27
|
+
}
|
|
28
|
+
fail(result)
|
|
29
|
+
complete(result)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
takePhoto (options) {
|
|
34
|
+
this.camera?.takePhoto(options)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
startRecord (options) {
|
|
38
|
+
this.camera?.startRecord(options)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
stopRecord (options) {
|
|
42
|
+
this.camera?.stopRecord(options)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -201,6 +201,9 @@ class RNIntersectionObserver {
|
|
|
201
201
|
|
|
202
202
|
// 计算节点的rect信息
|
|
203
203
|
_measureTarget (isInit = false) {
|
|
204
|
+
if (!this.observerRefs || !this.relativeRef) {
|
|
205
|
+
return
|
|
206
|
+
}
|
|
204
207
|
Promise.all([
|
|
205
208
|
this._getReferenceRect(this.observerRefs),
|
|
206
209
|
this._getReferenceRect(this.relativeRef)
|
|
@@ -5,10 +5,10 @@ const oldObserveList = new Set()
|
|
|
5
5
|
|
|
6
6
|
if (isBrowser) {
|
|
7
7
|
window.addEventListener('offline', () => {
|
|
8
|
-
oldObserveList.forEach(fn => fn({ isConnected: false,
|
|
8
|
+
oldObserveList.forEach(fn => fn({ isConnected: false, networkType: 'none' }))
|
|
9
9
|
})
|
|
10
10
|
window.addEventListener('online', () => {
|
|
11
|
-
oldObserveList.forEach(fn => fn({ isConnected: true,
|
|
11
|
+
oldObserveList.forEach(fn => fn({ isConnected: true, networkType: 'unknow' }))
|
|
12
12
|
})
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -22,7 +22,7 @@ export function onNetworkStatusChange (callbackFn) {
|
|
|
22
22
|
const isConnected = navigator.onLine
|
|
23
23
|
callbackFn({
|
|
24
24
|
isConnected,
|
|
25
|
-
|
|
25
|
+
networkType: isConnected ? evt.currentTarget.effectiveType : 'none'
|
|
26
26
|
})
|
|
27
27
|
}
|
|
28
28
|
fnMap.set(callbackFn, proxyCallback)
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { PermissionsAndroid } from 'react-native'
|
|
2
|
+
import { noop, type } from '@mpxjs/utils'
|
|
3
|
+
import mpx from '@mpxjs/core'
|
|
4
|
+
let startWifiReady = false
|
|
5
|
+
const wifiListListeners = []
|
|
6
|
+
|
|
7
|
+
async function requestWifiPermission () {
|
|
8
|
+
const granted = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION, {
|
|
9
|
+
title: 'Location permission is required for WiFi connections',
|
|
10
|
+
message:
|
|
11
|
+
'This app needs location permission as this is required ' +
|
|
12
|
+
'to scan for wifi networks.',
|
|
13
|
+
buttonNegative: 'DENY',
|
|
14
|
+
buttonPositive: 'ALLOW'
|
|
15
|
+
})
|
|
16
|
+
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
|
|
17
|
+
return true
|
|
18
|
+
} else {
|
|
19
|
+
return false
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function startWifi (options = {}) {
|
|
24
|
+
const { success = noop, fail = noop, complete = noop } = options
|
|
25
|
+
if (__mpx_mode__ === 'ios') {
|
|
26
|
+
const result = {
|
|
27
|
+
errMsg: 'startWifi:fail ios system not support, you need to manually go to the Settings to enable wifi'
|
|
28
|
+
}
|
|
29
|
+
fail(result)
|
|
30
|
+
complete(result)
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
const WifiManager = require('react-native-wifi-reborn').default
|
|
34
|
+
let wifiPermission = requestWifiPermission
|
|
35
|
+
if (mpx.config?.rnConfig?.wifiPermission) {
|
|
36
|
+
wifiPermission = mpx.config.rnConfig.wifiPermission
|
|
37
|
+
}
|
|
38
|
+
wifiPermission().then(async () => {
|
|
39
|
+
let enabled
|
|
40
|
+
try {
|
|
41
|
+
enabled = await WifiManager.isEnabled()
|
|
42
|
+
} catch (e) {
|
|
43
|
+
enabled = false
|
|
44
|
+
}
|
|
45
|
+
if (!enabled) {
|
|
46
|
+
const result = {
|
|
47
|
+
errMsg: 'startWifi:fail wifi not turned on',
|
|
48
|
+
errCode: 12005
|
|
49
|
+
}
|
|
50
|
+
fail(result)
|
|
51
|
+
complete(result)
|
|
52
|
+
return
|
|
53
|
+
}
|
|
54
|
+
startWifiReady = true
|
|
55
|
+
const result = {
|
|
56
|
+
errMsg: 'startWifi:success'
|
|
57
|
+
}
|
|
58
|
+
success(result)
|
|
59
|
+
complete(result)
|
|
60
|
+
}).catch((err) => {
|
|
61
|
+
const result = {
|
|
62
|
+
errMsg: 'startWifi:fail ' + (typeof err === 'string' ? err : ''),
|
|
63
|
+
errCode: 12001
|
|
64
|
+
}
|
|
65
|
+
fail(result)
|
|
66
|
+
complete(result)
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function stopWifi (options = {}) {
|
|
71
|
+
const { success = noop, fail = noop, complete = noop } = options
|
|
72
|
+
if (__mpx_mode__ === 'ios') {
|
|
73
|
+
const result = {
|
|
74
|
+
errMsg: 'stopWifi:fail ios system not support, you need to manually go to the Settings to enable wifi'
|
|
75
|
+
}
|
|
76
|
+
fail(result)
|
|
77
|
+
complete(result)
|
|
78
|
+
return
|
|
79
|
+
}
|
|
80
|
+
startWifiReady = false
|
|
81
|
+
wifiListListeners.length = 0
|
|
82
|
+
const result = {
|
|
83
|
+
errMsg: 'stopWifi:success'
|
|
84
|
+
}
|
|
85
|
+
success(result)
|
|
86
|
+
complete(result)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function getWifiList (options = {}) {
|
|
90
|
+
const { success = noop, fail = noop, complete = noop } = options
|
|
91
|
+
if (__mpx_mode__ === 'ios') {
|
|
92
|
+
const result = {
|
|
93
|
+
errMsg: 'getWifiList:fail ios system not support'
|
|
94
|
+
}
|
|
95
|
+
fail(result)
|
|
96
|
+
complete(result)
|
|
97
|
+
return
|
|
98
|
+
}
|
|
99
|
+
if (!startWifiReady) {
|
|
100
|
+
const result = {
|
|
101
|
+
errMsg: 'getWifiList:fail not init startWifi',
|
|
102
|
+
errCode: 12000
|
|
103
|
+
}
|
|
104
|
+
fail(result)
|
|
105
|
+
complete(result)
|
|
106
|
+
return
|
|
107
|
+
}
|
|
108
|
+
const WifiManager = require('react-native-wifi-reborn').default
|
|
109
|
+
WifiManager.reScanAndLoadWifiList().then((res) => {
|
|
110
|
+
const wifiList = res.map(item => {
|
|
111
|
+
return {
|
|
112
|
+
SSID: item.SSID,
|
|
113
|
+
BSSID: item.BSSID,
|
|
114
|
+
frequency: item.frequency,
|
|
115
|
+
signalStrength: 100 + (item.level || 0)
|
|
116
|
+
}
|
|
117
|
+
})
|
|
118
|
+
wifiListListeners.forEach(callback => {
|
|
119
|
+
if (type(callback) === 'Function') {
|
|
120
|
+
callback({ wifiList })
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
const result = {
|
|
124
|
+
errMsg: 'getWifiList:success',
|
|
125
|
+
errno: 0,
|
|
126
|
+
errCode: 0
|
|
127
|
+
}
|
|
128
|
+
success(result)
|
|
129
|
+
complete(result)
|
|
130
|
+
}).catch(() => {
|
|
131
|
+
const result = {
|
|
132
|
+
errMsg: 'getWifiList:fail'
|
|
133
|
+
}
|
|
134
|
+
fail(result)
|
|
135
|
+
complete(result)
|
|
136
|
+
})
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function onGetWifiList (callback) {
|
|
140
|
+
if (!startWifiReady && wifiListListeners.indexOf(callback) > -1) {
|
|
141
|
+
return
|
|
142
|
+
}
|
|
143
|
+
wifiListListeners.push(callback)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function offGetWifiList (callback) {
|
|
147
|
+
if (!startWifiReady) {
|
|
148
|
+
return
|
|
149
|
+
}
|
|
150
|
+
const index = wifiListListeners.indexOf(callback)
|
|
151
|
+
if (index > -1) {
|
|
152
|
+
wifiListListeners.splice(index, 1)
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function getConnectedWifi (options = {}) {
|
|
157
|
+
const { partialInfo = false, success = noop, fail = noop, complete = noop } = options
|
|
158
|
+
|
|
159
|
+
if (!startWifiReady) {
|
|
160
|
+
const result = {
|
|
161
|
+
errMsg: 'getConnectedWifi:fail not init startWifi',
|
|
162
|
+
errCode: 12000
|
|
163
|
+
}
|
|
164
|
+
fail(result)
|
|
165
|
+
complete(result)
|
|
166
|
+
return
|
|
167
|
+
}
|
|
168
|
+
const WifiManager = require('react-native-wifi-reborn').default
|
|
169
|
+
if (partialInfo) {
|
|
170
|
+
WifiManager.getCurrentWifiSSID().then((res) => {
|
|
171
|
+
const wifi = {
|
|
172
|
+
SSID: res,
|
|
173
|
+
BSSID: '', // iOS无法获取BSSID
|
|
174
|
+
signalStrength: 0,
|
|
175
|
+
frequency: 0
|
|
176
|
+
}
|
|
177
|
+
const result = {
|
|
178
|
+
wifi: wifi,
|
|
179
|
+
errMsg: 'getConnectedWifi:ok'
|
|
180
|
+
}
|
|
181
|
+
success(result)
|
|
182
|
+
complete(result)
|
|
183
|
+
}).catch(() => {
|
|
184
|
+
const result = {
|
|
185
|
+
errMsg: 'getConnectedWifi:fail'
|
|
186
|
+
}
|
|
187
|
+
fail(result)
|
|
188
|
+
complete(result)
|
|
189
|
+
})
|
|
190
|
+
} else {
|
|
191
|
+
Promise.all([
|
|
192
|
+
WifiManager.getCurrentWifiSSID().catch(() => null),
|
|
193
|
+
WifiManager.getBSSID().catch(() => ''),
|
|
194
|
+
WifiManager.getCurrentSignalStrength().catch(() => 0),
|
|
195
|
+
WifiManager.getFrequency().catch(() => 0)
|
|
196
|
+
]).then(([ssid, bssid, signalStrength, frequency]) => {
|
|
197
|
+
if (!ssid) {
|
|
198
|
+
const result = {
|
|
199
|
+
errMsg: 'getConnectedWifi:fail'
|
|
200
|
+
}
|
|
201
|
+
fail(result)
|
|
202
|
+
complete(result)
|
|
203
|
+
return
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const wifi = {
|
|
207
|
+
SSID: ssid,
|
|
208
|
+
BSSID: bssid,
|
|
209
|
+
signalStrength: signalStrength,
|
|
210
|
+
frequency: frequency
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const result = {
|
|
214
|
+
wifi: wifi,
|
|
215
|
+
errMsg: 'getConnectedWifi:ok'
|
|
216
|
+
}
|
|
217
|
+
success(result)
|
|
218
|
+
complete(result)
|
|
219
|
+
}).catch(() => {
|
|
220
|
+
const result = {
|
|
221
|
+
errMsg: 'getConnectedWifi:fail'
|
|
222
|
+
}
|
|
223
|
+
fail(result)
|
|
224
|
+
complete(result)
|
|
225
|
+
})
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export {
|
|
230
|
+
startWifi,
|
|
231
|
+
stopWifi,
|
|
232
|
+
getWifiList,
|
|
233
|
+
onGetWifiList,
|
|
234
|
+
offGetWifiList,
|
|
235
|
+
getConnectedWifi
|
|
236
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ENV_OBJ, envError } from '../../../../common/js'
|
|
2
|
+
|
|
3
|
+
const startWifi = ENV_OBJ.startWifi || envError('startWifi')
|
|
4
|
+
|
|
5
|
+
const stopWifi = ENV_OBJ.stopWifi || envError('stopWifi')
|
|
6
|
+
|
|
7
|
+
const getWifiList = ENV_OBJ.getWifiList || envError('getWifiList')
|
|
8
|
+
|
|
9
|
+
const getConnectedWifi = ENV_OBJ.getConnectedWifi || envError('getConnectedWifi')
|
|
10
|
+
|
|
11
|
+
const onGetWifiList = ENV_OBJ.onGetWifiList || envError('onGetWifiList')
|
|
12
|
+
|
|
13
|
+
const offGetWifiList = ENV_OBJ.offGetWifiList || envError('offGetWifiList')
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
startWifi,
|
|
17
|
+
stopWifi,
|
|
18
|
+
getWifiList,
|
|
19
|
+
onGetWifiList,
|
|
20
|
+
offGetWifiList,
|
|
21
|
+
getConnectedWifi
|
|
22
|
+
}
|
|
@@ -14,14 +14,18 @@ function getBasePath (navigation) {
|
|
|
14
14
|
let timerId = null
|
|
15
15
|
function isLock (navigationHelper, type, options) {
|
|
16
16
|
if (navigationHelper.lastSuccessCallback && navigationHelper.lastFailCallback) {
|
|
17
|
-
const
|
|
17
|
+
const { path } = parseUrl(options.url)
|
|
18
|
+
const res = {
|
|
19
|
+
errMsg: `${type}:fail the previous routing event didn't complete`,
|
|
20
|
+
path
|
|
21
|
+
}
|
|
18
22
|
failHandle(res, options.fail, options.complete)
|
|
19
23
|
return true
|
|
20
24
|
}
|
|
21
25
|
clearTimeout(timerId)
|
|
22
26
|
timerId = setTimeout(() => {
|
|
23
27
|
if (navigationHelper.lastSuccessCallback && navigationHelper.lastFailCallback) {
|
|
24
|
-
navigationHelper.lastFailCallback(
|
|
28
|
+
navigationHelper.lastFailCallback(`${type}:fail timeout ${options.url || ''}`)
|
|
25
29
|
navigationHelper.lastFailCallback = null
|
|
26
30
|
}
|
|
27
31
|
}, 1000)
|
|
@@ -39,7 +43,7 @@ function navigateTo (options = {}) {
|
|
|
39
43
|
if (options.events) {
|
|
40
44
|
eventChannel._addListeners(options.events)
|
|
41
45
|
}
|
|
42
|
-
const { path, queryObj } = parseUrl(options.url)
|
|
46
|
+
const { path, queryObj } = parseUrl(options.url, true)
|
|
43
47
|
const basePath = getBasePath(navigation)
|
|
44
48
|
const finalPath = resolvePath(path, basePath).slice(1)
|
|
45
49
|
|
|
@@ -66,7 +70,7 @@ function redirectTo (options = {}) {
|
|
|
66
70
|
return
|
|
67
71
|
}
|
|
68
72
|
if (navigation && navigationHelper) {
|
|
69
|
-
const { path, queryObj } = parseUrl(options.url)
|
|
73
|
+
const { path, queryObj } = parseUrl(options.url, true)
|
|
70
74
|
const basePath = getBasePath(navigation)
|
|
71
75
|
const finalPath = resolvePath(path, basePath).slice(1)
|
|
72
76
|
navigation.replace(finalPath, queryObj)
|
|
@@ -100,8 +104,10 @@ function navigateBack (options = {}) {
|
|
|
100
104
|
}
|
|
101
105
|
if (delta >= routeLength && global.__mpx?.config.rnConfig.onAppBack?.(delta - routeLength + 1)) {
|
|
102
106
|
nextTick(() => {
|
|
103
|
-
navigationHelper.lastSuccessCallback
|
|
104
|
-
|
|
107
|
+
if (navigationHelper.lastSuccessCallback) {
|
|
108
|
+
navigationHelper.lastSuccessCallback()
|
|
109
|
+
navigationHelper.lastSuccessCallback = null
|
|
110
|
+
}
|
|
105
111
|
})
|
|
106
112
|
} else {
|
|
107
113
|
navigation.pop(delta)
|
|
@@ -116,7 +122,7 @@ function reLaunch (options = {}) {
|
|
|
116
122
|
return
|
|
117
123
|
}
|
|
118
124
|
if (navigation && navigationHelper) {
|
|
119
|
-
const { path, queryObj } = parseUrl(options.url)
|
|
125
|
+
const { path, queryObj } = parseUrl(options.url, true)
|
|
120
126
|
const basePath = getBasePath(navigation)
|
|
121
127
|
const finalPath = resolvePath(path, basePath).slice(1)
|
|
122
128
|
navigation.reset({
|
|
@@ -11,7 +11,7 @@ const getSystemInfoSync = function () {
|
|
|
11
11
|
brand: DeviceInfo.getBrand(),
|
|
12
12
|
model: DeviceInfo.getModel(),
|
|
13
13
|
system: `${DeviceInfo.getSystemName()} ${DeviceInfo.getSystemVersion()}`,
|
|
14
|
-
platform: DeviceInfo.isEmulatorSync() ? 'emulator' : DeviceInfo.getSystemName(),
|
|
14
|
+
platform: DeviceInfo.isEmulatorSync() ? 'emulator' : DeviceInfo.getSystemName().toLowerCase(),
|
|
15
15
|
deviceOrientation: screenWidth > screenHeight ? 'portrait' : 'landscape',
|
|
16
16
|
fontSizeSetting: PixelRatio.getFontScale()
|
|
17
17
|
}
|
|
@@ -68,7 +68,7 @@ const getDeviceInfo = function () {
|
|
|
68
68
|
brand: DeviceInfo.getBrand(),
|
|
69
69
|
model: DeviceInfo.getModel(),
|
|
70
70
|
system: `${DeviceInfo.getSystemName()} ${DeviceInfo.getSystemVersion()}`,
|
|
71
|
-
platform: DeviceInfo.isEmulatorSync() ? 'emulator' : DeviceInfo.getSystemName(),
|
|
71
|
+
platform: DeviceInfo.isEmulatorSync() ? 'emulator' : DeviceInfo.getSystemName().toLowerCase(),
|
|
72
72
|
memorySize: DeviceInfo.getTotalMemorySync() / (1024 * 1024)
|
|
73
73
|
})
|
|
74
74
|
return deviceInfo
|
|
@@ -11,7 +11,7 @@ const getWindowInfo = function () {
|
|
|
11
11
|
let safeArea = {}
|
|
12
12
|
const { top = 0, left = 0, bottom = 0, right = 0 } = insets
|
|
13
13
|
const layout = navigation.layout || {}
|
|
14
|
-
const screenHeight = __mpx_mode__ === 'ios' ? dimensionsScreen.height : dimensionsScreen.height - layout.bottomVirtualHeight //
|
|
14
|
+
const screenHeight = __mpx_mode__ === 'ios' ? dimensionsScreen.height : dimensionsScreen.height - (layout.bottomVirtualHeight || 0) // 解决安卓开启屏幕内导航安卓把安全区计算进去后产生的影响
|
|
15
15
|
const screenWidth = __mpx_mode__ === 'ios' ? dimensionsScreen.width : dimensionsScreen.width - right
|
|
16
16
|
const layoutHeight = layout.height || 0
|
|
17
17
|
const layoutWidth = layout.width || 0
|
package/src/platform/index.js
CHANGED
|
@@ -37,6 +37,9 @@ export * from './api/create-selector-query'
|
|
|
37
37
|
// getNetworkType, onNetworkStatusChange, offNetworkStatusChange
|
|
38
38
|
export * from './api/device/network'
|
|
39
39
|
|
|
40
|
+
// startWifi, stopWifi, getWifiList, onGetWifiList, offGetWifiList, getConnectedWifi
|
|
41
|
+
export * from './api/device/wifi'
|
|
42
|
+
|
|
40
43
|
// downloadFile, uploadFile
|
|
41
44
|
export * from './api/file'
|
|
42
45
|
|
|
@@ -119,3 +122,6 @@ export * from './api/keyboard'
|
|
|
119
122
|
|
|
120
123
|
// getSetting, openSetting, enableAlertBeforeUnload, disableAlertBeforeUnload, getMenuButtonBoundingClientRect
|
|
121
124
|
export * from './api/setting'
|
|
125
|
+
|
|
126
|
+
// createCameraContext
|
|
127
|
+
export * from './api/camera'
|