@mpxjs/api-proxy 2.10.4-beta.3 → 2.10.4-beta.6
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 +5 -0
- package/package.json +1 -1
- package/src/platform/api/image/index.ali.js +6 -3
- package/src/platform/api/image/index.ios.js +4 -1
- package/src/platform/api/image/index.js +4 -1
- package/src/platform/api/image/index.web.js +4 -1
- package/src/platform/api/location/index.ali.js +15 -3
- package/src/platform/api/location/index.ios.js +13 -1
- package/src/platform/api/location/index.js +13 -1
- package/src/platform/api/location/index.web.js +13 -1
- package/src/platform/api/system/index.ali.js +36 -2
- package/src/platform/api/toast/rnToast.jsx +3 -7
- package/src/platform/index.js +2 -2
package/@types/index.d.ts
CHANGED
|
@@ -121,12 +121,17 @@ export const enableAlertBeforeUnload: WechatMiniprogram.Wx['enableAlertBeforeUnl
|
|
|
121
121
|
export const disableAlertBeforeUnload: WechatMiniprogram.Wx['disableAlertBeforeUnload']
|
|
122
122
|
export const getMenuButtonBoundingClientRect: WechatMiniprogram.Wx['getMenuButtonBoundingClientRect']
|
|
123
123
|
export const getImageInfo: WechatMiniprogram.Wx['getImageInfo']
|
|
124
|
+
export const chooseMedia: WechatMiniprogram.Wx['chooseMedia']
|
|
124
125
|
export const vibrateShort: WechatMiniprogram.Wx['vibrateShort']
|
|
125
126
|
export const vibrateLong: WechatMiniprogram.Wx['vibrateLong']
|
|
126
127
|
export const getExtConfig: WechatMiniprogram.Wx['getExtConfig']
|
|
127
128
|
export const getExtConfigSync: WechatMiniprogram.Wx['getExtConfigSync']
|
|
128
129
|
export const openLocation: WechatMiniprogram.Wx['openLocation']
|
|
129
130
|
export const chooseLocation: WechatMiniprogram.Wx['chooseLocation']
|
|
131
|
+
export const onLocationChange: WechatMiniprogram.Wx['onLocationChange']
|
|
132
|
+
export const offLocationChange: WechatMiniprogram.Wx['offLocationChange']
|
|
133
|
+
export const startLocationUpdate: WechatMiniprogram.Wx['startLocationUpdate']
|
|
134
|
+
export const stopLocationUpdate: WechatMiniprogram.Wx['stopLocationUpdate']
|
|
130
135
|
|
|
131
136
|
declare const install: (...args: any) => any
|
|
132
137
|
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ENV_OBJ, changeOpts, handleSuccess } from '../../../common/js'
|
|
1
|
+
import { ENV_OBJ, changeOpts, handleSuccess, envError } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
function previewImage (options = {}) {
|
|
4
4
|
const opts = changeOpts(options)
|
|
@@ -30,10 +30,13 @@ function compressImage (options = {}) {
|
|
|
30
30
|
return ENV_OBJ.compressImage(opts)
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
const getImageInfo = ENV_OBJ.getImageInfo
|
|
33
|
+
const getImageInfo = ENV_OBJ.getImageInfo || envError('getImageInfo')
|
|
34
|
+
|
|
35
|
+
const chooseMedia = envError('chooseMedia')
|
|
34
36
|
|
|
35
37
|
export {
|
|
36
38
|
previewImage,
|
|
37
39
|
compressImage,
|
|
38
|
-
getImageInfo
|
|
40
|
+
getImageInfo,
|
|
41
|
+
chooseMedia
|
|
39
42
|
}
|
|
@@ -6,8 +6,11 @@ const compressImage = ENV_OBJ.compressImage || envError('compressImage')
|
|
|
6
6
|
|
|
7
7
|
const getImageInfo = ENV_OBJ.getImageInfo || envError('getImageInfo')
|
|
8
8
|
|
|
9
|
+
const chooseMedia = ENV_OBJ.chooseMedia || envError('chooseMedia')
|
|
10
|
+
|
|
9
11
|
export {
|
|
10
12
|
previewImage,
|
|
11
13
|
compressImage,
|
|
12
|
-
getImageInfo
|
|
14
|
+
getImageInfo,
|
|
15
|
+
chooseMedia
|
|
13
16
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ENV_OBJ, changeOpts, handleSuccess, defineUnsupportedProps } from '../../../common/js'
|
|
1
|
+
import { ENV_OBJ, changeOpts, handleSuccess, defineUnsupportedProps, envError } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
function getLocation (options = {}) {
|
|
4
4
|
const opts = Object.assign(options, {
|
|
@@ -22,10 +22,22 @@ function openLocation (options = {}) {
|
|
|
22
22
|
return ENV_OBJ.openLocation(opts)
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
const chooseLocation = ENV_OBJ.chooseLocation
|
|
25
|
+
const chooseLocation = ENV_OBJ.chooseLocation || envError('chooseLocation')
|
|
26
|
+
|
|
27
|
+
const onLocationChange = envError('onLocationChange')
|
|
28
|
+
|
|
29
|
+
const offLocationChange = envError('offLocationChange')
|
|
30
|
+
|
|
31
|
+
const startLocationUpdate = envError('startLocationUpdate')
|
|
32
|
+
|
|
33
|
+
const stopLocationUpdate = envError('stopLocationUpdate')
|
|
26
34
|
|
|
27
35
|
export {
|
|
28
36
|
getLocation,
|
|
29
37
|
openLocation,
|
|
30
|
-
chooseLocation
|
|
38
|
+
chooseLocation,
|
|
39
|
+
onLocationChange,
|
|
40
|
+
offLocationChange,
|
|
41
|
+
startLocationUpdate,
|
|
42
|
+
stopLocationUpdate
|
|
31
43
|
}
|
|
@@ -24,8 +24,20 @@ const openLocation = envError('openLocation')
|
|
|
24
24
|
|
|
25
25
|
const chooseLocation = envError('chooseLocation')
|
|
26
26
|
|
|
27
|
+
const onLocationChange = envError('onLocationChange')
|
|
28
|
+
|
|
29
|
+
const offLocationChange = envError('offLocationChange')
|
|
30
|
+
|
|
31
|
+
const startLocationUpdate = envError('startLocationUpdate')
|
|
32
|
+
|
|
33
|
+
const stopLocationUpdate = envError('stopLocationUpdate')
|
|
34
|
+
|
|
27
35
|
export {
|
|
28
36
|
getLocation,
|
|
29
37
|
openLocation,
|
|
30
|
-
chooseLocation
|
|
38
|
+
chooseLocation,
|
|
39
|
+
onLocationChange,
|
|
40
|
+
offLocationChange,
|
|
41
|
+
startLocationUpdate,
|
|
42
|
+
stopLocationUpdate
|
|
31
43
|
}
|
|
@@ -6,8 +6,20 @@ const openLocation = ENV_OBJ.openLocation || envError('openLocation')
|
|
|
6
6
|
|
|
7
7
|
const chooseLocation = ENV_OBJ.chooseLocation || envError('chooseLocation')
|
|
8
8
|
|
|
9
|
+
const onLocationChange = ENV_OBJ.onLocationChange || envError('onLocationChange')
|
|
10
|
+
|
|
11
|
+
const offLocationChange = ENV_OBJ.offLocationChange || envError('offLocationChange')
|
|
12
|
+
|
|
13
|
+
const startLocationUpdate = ENV_OBJ.startLocationUpdate || envError('startLocationUpdate')
|
|
14
|
+
|
|
15
|
+
const stopLocationUpdate = ENV_OBJ.stopLocationUpdate || envError('stopLocationUpdate')
|
|
16
|
+
|
|
9
17
|
export {
|
|
10
18
|
getLocation,
|
|
11
19
|
openLocation,
|
|
12
|
-
chooseLocation
|
|
20
|
+
chooseLocation,
|
|
21
|
+
onLocationChange,
|
|
22
|
+
offLocationChange,
|
|
23
|
+
startLocationUpdate,
|
|
24
|
+
stopLocationUpdate
|
|
13
25
|
}
|
|
@@ -29,8 +29,20 @@ const openLocation = envError('openLocation')
|
|
|
29
29
|
|
|
30
30
|
const chooseLocation = envError('chooseLocation')
|
|
31
31
|
|
|
32
|
+
const onLocationChange = envError('onLocationChange')
|
|
33
|
+
|
|
34
|
+
const offLocationChange = envError('offLocationChange')
|
|
35
|
+
|
|
36
|
+
const startLocationUpdate = envError('startLocationUpdate')
|
|
37
|
+
|
|
38
|
+
const stopLocationUpdate = envError('stopLocationUpdate')
|
|
39
|
+
|
|
32
40
|
export {
|
|
33
41
|
getLocation,
|
|
34
42
|
openLocation,
|
|
35
|
-
chooseLocation
|
|
43
|
+
chooseLocation,
|
|
44
|
+
onLocationChange,
|
|
45
|
+
offLocationChange,
|
|
46
|
+
startLocationUpdate,
|
|
47
|
+
stopLocationUpdate
|
|
36
48
|
}
|
|
@@ -33,12 +33,46 @@ function getSystemInfoSync () {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
const getDeviceInfo = function () {
|
|
36
|
-
|
|
36
|
+
let res
|
|
37
|
+
if (ENV_OBJ.canIUse('getDeviceBaseInfo')) {
|
|
38
|
+
res = ENV_OBJ.getDeviceBaseInfo()
|
|
39
|
+
} else {
|
|
40
|
+
const systemInfo = getSystemInfoSync()
|
|
41
|
+
res = {
|
|
42
|
+
abi: systemInfo.abi || null,
|
|
43
|
+
benchmarkLevel: systemInfo.benchmarkLevel || null,
|
|
44
|
+
brand: systemInfo.brand,
|
|
45
|
+
model: systemInfo.model,
|
|
46
|
+
system: systemInfo.system,
|
|
47
|
+
platform: systemInfo.platform,
|
|
48
|
+
memorySize: systemInfo.memorySize || null
|
|
49
|
+
}
|
|
50
|
+
}
|
|
37
51
|
defineUnsupportedProps(res, ['deviceAbi', 'benchmarkLevel', 'cpuType'])
|
|
38
52
|
return res
|
|
39
53
|
}
|
|
40
54
|
|
|
41
|
-
const getWindowInfo =
|
|
55
|
+
const getWindowInfo = function () {
|
|
56
|
+
let res
|
|
57
|
+
if (ENV_OBJ.canIUse('getWindowInfo')) {
|
|
58
|
+
res = ENV_OBJ.getWindowInfo()
|
|
59
|
+
} else {
|
|
60
|
+
const systemInfo = getSystemInfoSync()
|
|
61
|
+
res = {
|
|
62
|
+
pixelRatio: systemInfo.pixelRatio,
|
|
63
|
+
screenWidth: systemInfo.screenWidth,
|
|
64
|
+
screenHeight: systemInfo.screenHeight,
|
|
65
|
+
windowWidth: systemInfo.windowWidth,
|
|
66
|
+
windowHeight: systemInfo.windowHeight,
|
|
67
|
+
statusBarHeight: systemInfo.statusBarHeight,
|
|
68
|
+
safeArea: systemInfo.safeArea || null,
|
|
69
|
+
screenTop: systemInfo.screenTop || null
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return res
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// const getWindowInfo = ENV_OBJ.getWindowInfo || envError('getWindowInfo')
|
|
42
76
|
|
|
43
77
|
const getLaunchOptionsSync = ENV_OBJ.getLaunchOptionsSync || envError('getLaunchOptionsSync')
|
|
44
78
|
|
|
@@ -32,8 +32,7 @@ const styles = StyleSheet.create({
|
|
|
32
32
|
alignItems: 'center'
|
|
33
33
|
},
|
|
34
34
|
toastHasIcon: {
|
|
35
|
-
|
|
36
|
-
width: 120
|
|
35
|
+
width: 140
|
|
37
36
|
},
|
|
38
37
|
toastImg: {
|
|
39
38
|
width: 40,
|
|
@@ -46,8 +45,6 @@ const styles = StyleSheet.create({
|
|
|
46
45
|
color: '#ffffff',
|
|
47
46
|
fontSize: 12,
|
|
48
47
|
lineHeight: 18,
|
|
49
|
-
height: 18,
|
|
50
|
-
overflow: 'hidden',
|
|
51
48
|
marginTop: 10
|
|
52
49
|
}
|
|
53
50
|
})
|
|
@@ -80,7 +77,7 @@ function showToast (options = {}) {
|
|
|
80
77
|
ToastView = <View style={[styles.toastWrap, { pointerEvents }]}>
|
|
81
78
|
<View style={[styles.toastContent, styles.toastHasIcon]}>
|
|
82
79
|
<Image style={ styles.toastImg } source={{ uri: image || iconImg[icon] }}></Image>
|
|
83
|
-
{ title ? <Text style={styles.toastText}>{title}</Text> : null }
|
|
80
|
+
{ title ? <Text numberOfLines={2} style={styles.toastText}>{title}</Text> : null }
|
|
84
81
|
</View>
|
|
85
82
|
</View>
|
|
86
83
|
} else if (icon === 'loading') {
|
|
@@ -91,7 +88,7 @@ function showToast (options = {}) {
|
|
|
91
88
|
size='small'
|
|
92
89
|
color='#eee'
|
|
93
90
|
/>
|
|
94
|
-
{ title ? <Text style={styles.toastText}>{title}</Text> : null }
|
|
91
|
+
{ title ? <Text numberOfLines={2} style={styles.toastText}>{title}</Text> : null }
|
|
95
92
|
</View>
|
|
96
93
|
</View>
|
|
97
94
|
} else {
|
|
@@ -102,7 +99,6 @@ function showToast (options = {}) {
|
|
|
102
99
|
...styles.toastText,
|
|
103
100
|
...(icon === 'none'
|
|
104
101
|
? {
|
|
105
|
-
height: 'auto',
|
|
106
102
|
marginTop: 0
|
|
107
103
|
}
|
|
108
104
|
: {})
|
package/src/platform/index.js
CHANGED
|
@@ -43,7 +43,7 @@ export * from './api/file'
|
|
|
43
43
|
// getUserInfo
|
|
44
44
|
export * from './api/get-user-info'
|
|
45
45
|
|
|
46
|
-
// previewImage, compressImage, getImageInfo
|
|
46
|
+
// previewImage, compressImage, getImageInfo, chooseMedia
|
|
47
47
|
export * from './api/image'
|
|
48
48
|
|
|
49
49
|
// login
|
|
@@ -105,7 +105,7 @@ export * from './api/video'
|
|
|
105
105
|
// onWindowResize, offWindowResize
|
|
106
106
|
export * from './api/window'
|
|
107
107
|
|
|
108
|
-
// getLocation, openLocation, chooseLocation
|
|
108
|
+
// getLocation, openLocation, chooseLocation, onLocationChange, offLocationChange, startLocationUpdate, stopLocationUpdate
|
|
109
109
|
export * from './api/location'
|
|
110
110
|
|
|
111
111
|
// getExtConfig, getExtConfigSync
|