@mpxjs/api-proxy 2.9.53 → 2.9.59
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 +7 -7
- package/package.json +20 -4
- package/src/common/js/promisify.js +3 -1
- package/src/common/js/utils.js +13 -1
- package/src/common/js/web.js +0 -12
- package/src/platform/api/action-sheet/ActionSheet.js +3 -7
- package/src/platform/api/action-sheet/index.android.js +1 -0
- package/src/platform/api/action-sheet/index.ios.js +1 -0
- package/src/platform/api/action-sheet/rnActionSheet.jsx +127 -0
- package/src/platform/api/app/index.android.js +1 -0
- package/src/platform/api/app/index.ios.js +1 -0
- package/src/platform/api/app/index.web.js +5 -4
- package/src/platform/api/clipboard-data/rnClipboard.js +5 -5
- package/src/platform/api/create-intersection-observer/IntersectionObserver.js +5 -5
- package/src/platform/api/create-selector-query/index.android.js +1 -0
- package/src/platform/api/create-selector-query/index.ios.js +9 -0
- package/src/platform/api/create-selector-query/rnNodesRef.js +262 -0
- package/src/platform/api/create-selector-query/rnSelectQuery.js +43 -0
- package/src/platform/api/device/network/getNetworkType.js +4 -4
- package/src/platform/api/device/network/rnNetwork.js +3 -3
- package/src/platform/api/image/Preview.js +3 -3
- package/src/platform/api/location/index.ali.js +31 -0
- package/src/platform/api/location/index.android.js +1 -0
- package/src/platform/api/location/index.ios.js +31 -0
- package/src/platform/api/location/index.js +13 -0
- package/src/platform/api/location/index.web.js +36 -0
- package/src/platform/api/make-phone-call/rnMakePhone.js +3 -3
- package/src/platform/api/modal/Modal.js +12 -15
- package/src/platform/api/modal/index.android.js +1 -0
- package/src/platform/api/modal/index.ios.js +1 -0
- package/src/platform/api/modal/rnModal.jsx +149 -0
- package/src/platform/api/next-tick/index.android.js +1 -0
- package/src/platform/api/next-tick/index.ios.js +1 -0
- package/src/platform/api/page-scroll-to/index.web.js +3 -3
- package/src/platform/api/pull-down/index.web.js +5 -5
- package/src/platform/api/request/index.web.js +3 -6
- package/src/platform/api/route/index.ios.js +9 -9
- package/src/platform/api/route/index.web.js +15 -18
- package/src/platform/api/screen-brightness/index.android.js +1 -0
- package/src/platform/api/screen-brightness/index.ios.js +1 -0
- package/src/platform/api/screen-brightness/rnScreenBrightness.js +53 -0
- package/src/platform/api/set-navigation-bar/index.android.js +1 -0
- package/src/platform/api/set-navigation-bar/index.ios.js +41 -0
- package/src/platform/api/set-navigation-bar/index.web.js +3 -3
- package/src/platform/api/socket/SocketTask.js +7 -17
- package/src/platform/api/socket/index.web.js +3 -3
- package/src/platform/api/storage/index.web.js +11 -12
- package/src/platform/api/storage/rnStorage.js +12 -12
- package/src/platform/api/system/index.web.js +2 -2
- package/src/platform/api/system/rnSystem.js +3 -3
- package/src/platform/api/tab-bar/index.web.js +9 -9
- package/src/platform/api/toast/Toast.js +3 -3
- package/src/platform/api/toast/error.png +0 -0
- package/src/platform/api/toast/index.android.js +1 -0
- package/src/platform/api/toast/index.ios.js +1 -0
- package/src/platform/api/toast/rnToast.jsx +189 -0
- package/src/platform/api/toast/success.png +0 -0
- package/src/platform/index.js +3 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { successHandle, failHandle, isTabBarPage, throwSSRWarning, isBrowser } from '../../../common/js'
|
|
2
2
|
import { EventChannel } from '../event-channel'
|
|
3
3
|
|
|
4
4
|
let routeCount = 0
|
|
@@ -12,8 +12,7 @@ function redirectTo (options = {}) {
|
|
|
12
12
|
if (router) {
|
|
13
13
|
if (isTabBarPage(options.url, router)) {
|
|
14
14
|
const res = { errMsg: 'redirectTo:fail can not redirectTo a tabBar page' }
|
|
15
|
-
|
|
16
|
-
return Promise.reject(res)
|
|
15
|
+
failHandle(res, options.fail, options.complete)
|
|
17
16
|
}
|
|
18
17
|
router.__mpxAction = { type: 'redirect' }
|
|
19
18
|
if (routeCount === 0 && router.currentRoute.query.routeCount) routeCount = router.currentRoute.query.routeCount
|
|
@@ -26,11 +25,11 @@ function redirectTo (options = {}) {
|
|
|
26
25
|
},
|
|
27
26
|
() => {
|
|
28
27
|
const res = { errMsg: 'redirectTo:ok' }
|
|
29
|
-
|
|
28
|
+
successHandle(res, options.success, options.complete)
|
|
30
29
|
},
|
|
31
30
|
err => {
|
|
32
31
|
const res = { errMsg: `redirectTo:fail ${err}` }
|
|
33
|
-
|
|
32
|
+
failHandle(res, options.fail, options.complete)
|
|
34
33
|
}
|
|
35
34
|
)
|
|
36
35
|
}
|
|
@@ -45,8 +44,7 @@ function navigateTo (options = {}) {
|
|
|
45
44
|
if (router) {
|
|
46
45
|
if (isTabBarPage(options.url, router)) {
|
|
47
46
|
const res = { errMsg: 'navigateTo:fail can not navigateTo a tabBar page' }
|
|
48
|
-
|
|
49
|
-
return Promise.reject(res)
|
|
47
|
+
failHandle(res, options.fail, options.complete)
|
|
50
48
|
}
|
|
51
49
|
const eventChannel = new EventChannel()
|
|
52
50
|
router.__mpxAction = {
|
|
@@ -66,11 +64,11 @@ function navigateTo (options = {}) {
|
|
|
66
64
|
},
|
|
67
65
|
() => {
|
|
68
66
|
const res = { errMsg: 'navigateTo:ok', eventChannel }
|
|
69
|
-
|
|
67
|
+
successHandle(res, options.success, options.complete)
|
|
70
68
|
},
|
|
71
69
|
err => {
|
|
72
70
|
const res = { errMsg: `navigateTo:fail ${err}` }
|
|
73
|
-
|
|
71
|
+
failHandle(res, options.fail, options.complete)
|
|
74
72
|
}
|
|
75
73
|
)
|
|
76
74
|
}
|
|
@@ -94,7 +92,7 @@ function navigateBack (options = {}) {
|
|
|
94
92
|
}
|
|
95
93
|
router.go(-delta)
|
|
96
94
|
const res = { errMsg: 'navigateBack:ok' }
|
|
97
|
-
|
|
95
|
+
successHandle(res, options.success, options.complete)
|
|
98
96
|
}
|
|
99
97
|
}
|
|
100
98
|
|
|
@@ -127,16 +125,16 @@ function reLaunch (options = {}) {
|
|
|
127
125
|
},
|
|
128
126
|
() => {
|
|
129
127
|
const res = { errMsg: 'reLaunch:ok' }
|
|
130
|
-
|
|
128
|
+
successHandle(res, options.success, options.complete)
|
|
131
129
|
},
|
|
132
130
|
err => {
|
|
133
131
|
const res = { errMsg: `reLaunch:fail ${err}` }
|
|
134
|
-
|
|
132
|
+
failHandle(res, options.fail, options.complete)
|
|
135
133
|
}
|
|
136
134
|
)
|
|
137
135
|
}
|
|
138
136
|
const res = { errMsg: 'reLaunch:ok' }
|
|
139
|
-
|
|
137
|
+
successHandle(res, options.success, options.complete)
|
|
140
138
|
}
|
|
141
139
|
}
|
|
142
140
|
|
|
@@ -152,8 +150,7 @@ function switchTab (options = {}) {
|
|
|
152
150
|
if (toRoute.path !== currentRoute.path) {
|
|
153
151
|
if (!isTabBarPage(options.url, router)) {
|
|
154
152
|
const res = { errMsg: 'switchTab:fail can not switch to no-tabBar page!' }
|
|
155
|
-
|
|
156
|
-
return Promise.reject(res)
|
|
153
|
+
failHandle(res, options.fail, options.complete)
|
|
157
154
|
}
|
|
158
155
|
router.__mpxAction = {
|
|
159
156
|
type: 'switch',
|
|
@@ -171,17 +168,17 @@ function switchTab (options = {}) {
|
|
|
171
168
|
},
|
|
172
169
|
() => {
|
|
173
170
|
const res = { errMsg: 'switchTab:ok' }
|
|
174
|
-
|
|
171
|
+
successHandle(res, options.success, options.complete)
|
|
175
172
|
},
|
|
176
173
|
err => {
|
|
177
174
|
const res = { errMsg: `switchTab:fail ${err}` }
|
|
178
|
-
|
|
175
|
+
failHandle(res, options.fail, options.complete)
|
|
179
176
|
}
|
|
180
177
|
)
|
|
181
178
|
}
|
|
182
179
|
}
|
|
183
180
|
const res = { errMsg: 'switchTab:ok' }
|
|
184
|
-
|
|
181
|
+
successHandle(res, options.success, options.complete)
|
|
185
182
|
}
|
|
186
183
|
}
|
|
187
184
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './rnScreenBrightness'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './rnScreenBrightness'
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// import * as Brightness from 'expo-brightness'
|
|
2
|
+
import { successHandle, failHandle } from '../../../common/js'
|
|
3
|
+
//
|
|
4
|
+
// function getScreenBrightness (options) {
|
|
5
|
+
// const { success, fail, complete } = options
|
|
6
|
+
// Brightness.getBrightnessAsync().then(value => {
|
|
7
|
+
// const result = {
|
|
8
|
+
// errMsg: 'getScreenBrightness:ok',
|
|
9
|
+
// value
|
|
10
|
+
// }
|
|
11
|
+
// successHandle(result, success, complete)
|
|
12
|
+
// }).catch(() => {
|
|
13
|
+
// const result = {
|
|
14
|
+
// errMsg: 'getScreenBrightness:fail'
|
|
15
|
+
// }
|
|
16
|
+
// failHandle(result, fail, complete)
|
|
17
|
+
// })
|
|
18
|
+
// }
|
|
19
|
+
//
|
|
20
|
+
// function setScreenBrightness (options) {
|
|
21
|
+
// const { value, success, fail, complete } = options
|
|
22
|
+
// Brightness.setBrightnessAsync(value).then(() => {
|
|
23
|
+
// const result = {
|
|
24
|
+
// errMsg: 'setScreenBrightness:ok'
|
|
25
|
+
// }
|
|
26
|
+
// successHandle(result, success, complete)
|
|
27
|
+
// }).catch(() => {
|
|
28
|
+
// const result = {
|
|
29
|
+
// errMsg: 'setScreenBrightness:fail'
|
|
30
|
+
// }
|
|
31
|
+
// failHandle(result, fail, complete)
|
|
32
|
+
// })
|
|
33
|
+
// }
|
|
34
|
+
|
|
35
|
+
function getScreenBrightness (options) {
|
|
36
|
+
const { success, complete } = options
|
|
37
|
+
const result = {
|
|
38
|
+
errMsg: 'getScreenBrightness:ok'
|
|
39
|
+
}
|
|
40
|
+
successHandle(result, success, complete)
|
|
41
|
+
}
|
|
42
|
+
function setScreenBrightness (options) {
|
|
43
|
+
const { fail, complete } = options
|
|
44
|
+
const result = {
|
|
45
|
+
errMsg: 'setScreenBrightness:fail'
|
|
46
|
+
}
|
|
47
|
+
failHandle(result, fail, complete)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export {
|
|
51
|
+
getScreenBrightness,
|
|
52
|
+
setScreenBrightness
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './index.ios'
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { successHandle, failHandle } from '../../../common/js'
|
|
2
|
+
|
|
3
|
+
function getFocusedNavigation () {
|
|
4
|
+
for (const key in global.__mpxPagesMap) {
|
|
5
|
+
const navigation = global.__mpxPagesMap[key]?.[1]
|
|
6
|
+
if (navigation && navigation.isFocused()) {
|
|
7
|
+
return navigation
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function setNavigationBarTitle (options = {}) {
|
|
12
|
+
const { title = '', success, fail, complete } = options
|
|
13
|
+
const navigation = getFocusedNavigation()
|
|
14
|
+
if (!(navigation && navigation.setOptions)) {
|
|
15
|
+
failHandle({ errMsg: 'setNavigationBarTitle:fail' }, fail, complete)
|
|
16
|
+
} else {
|
|
17
|
+
navigation.setOptions({ headerTitle: title })
|
|
18
|
+
successHandle({ errMsg: 'setNavigationBarTitle:ok' }, success, complete)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function setNavigationBarColor (options = {}) {
|
|
23
|
+
const { frontColor = '', backgroundColor = '', success, fail, complete } = options
|
|
24
|
+
const navigation = getFocusedNavigation()
|
|
25
|
+
if (!(navigation && navigation.setOptions)) {
|
|
26
|
+
failHandle({ errMsg: 'setNavigationBarColor:fail' }, fail, complete)
|
|
27
|
+
} else {
|
|
28
|
+
navigation.setOptions({
|
|
29
|
+
headerStyle: {
|
|
30
|
+
backgroundColor: backgroundColor
|
|
31
|
+
},
|
|
32
|
+
headerTintColor: frontColor
|
|
33
|
+
})
|
|
34
|
+
successHandle({ errMsg: 'setNavigationBarColor:ok' }, success, complete)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
setNavigationBarTitle,
|
|
40
|
+
setNavigationBarColor
|
|
41
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isBrowser, throwSSRWarning,
|
|
1
|
+
import { isBrowser, throwSSRWarning, successHandle } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
function setNavigationBarTitle (options = {}) {
|
|
4
4
|
if (!isBrowser) {
|
|
@@ -10,7 +10,7 @@ function setNavigationBarTitle (options = {}) {
|
|
|
10
10
|
document.title = title
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
successHandle({ errMsg: 'setNavigationBarTitle:ok' }, success, complete)
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
function setNavigationBarColor (options = {}) {
|
|
@@ -23,7 +23,7 @@ function setNavigationBarColor (options = {}) {
|
|
|
23
23
|
meta.setAttribute('name', 'theme-color')
|
|
24
24
|
meta.setAttribute('content', backgroundColor)
|
|
25
25
|
document.head.appendChild(meta)
|
|
26
|
-
|
|
26
|
+
successHandle({ errMsg: 'setNavigationBarColor:ok' }, success, complete)
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { successHandle, failHandle } from '../../../common/js'
|
|
2
2
|
import { type } from '@mpxjs/utils'
|
|
3
3
|
|
|
4
4
|
const socketTasks = new Set()
|
|
@@ -44,20 +44,14 @@ class SocketTask {
|
|
|
44
44
|
const { data = '', success, fail, complete } = options
|
|
45
45
|
if (typeof data !== 'string' || type(data) !== 'ArrayBuffer') {
|
|
46
46
|
const res = { errMsg: 'sendSocketMessage:fail Unsupported data type' }
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
if (this._socket.readyState === 1) {
|
|
47
|
+
failHandle(res, fail, complete)
|
|
48
|
+
} else if (this._socket.readyState === 1) {
|
|
51
49
|
this._socket.send(data)
|
|
52
50
|
const res = { errMsg: 'sendSocketMessage:ok' }
|
|
53
|
-
|
|
54
|
-
return Promise.resolve(res)
|
|
51
|
+
successHandle(res, success, complete)
|
|
55
52
|
} else {
|
|
56
53
|
const res = { errMsg: 'sendSocketMessage:fail' }
|
|
57
|
-
|
|
58
|
-
if (!fail) {
|
|
59
|
-
return Promise.reject(res)
|
|
60
|
-
}
|
|
54
|
+
failHandle(res, fail, complete)
|
|
61
55
|
}
|
|
62
56
|
}
|
|
63
57
|
|
|
@@ -70,14 +64,10 @@ class SocketTask {
|
|
|
70
64
|
try {
|
|
71
65
|
this._socket.close()
|
|
72
66
|
const res = { errMsg: 'closeSocket:ok' }
|
|
73
|
-
|
|
74
|
-
return Promise.resolve(res)
|
|
67
|
+
successHandle(res, success, complete)
|
|
75
68
|
} catch (err) {
|
|
76
69
|
const res = { errMsg: `closeSocket:fail ${err}` }
|
|
77
|
-
|
|
78
|
-
if (!fail) {
|
|
79
|
-
return Promise.reject(res)
|
|
80
|
-
}
|
|
70
|
+
failHandle(res, fail, complete)
|
|
81
71
|
}
|
|
82
72
|
}
|
|
83
73
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { warn,
|
|
1
|
+
import { warn, successHandle, failHandle, isBrowser, throwSSRWarning } from '../../../common/js'
|
|
2
2
|
import SocketTask from './SocketTask'
|
|
3
3
|
|
|
4
4
|
function connectSocket (options = { url: '' }) {
|
|
@@ -10,10 +10,10 @@ function connectSocket (options = { url: '' }) {
|
|
|
10
10
|
|
|
11
11
|
try {
|
|
12
12
|
const socketTask = new SocketTask(url, protocols)
|
|
13
|
-
|
|
13
|
+
successHandle({ errMsg: 'connectSocket:ok' }, success, complete)
|
|
14
14
|
return socketTask
|
|
15
15
|
} catch (e) {
|
|
16
|
-
|
|
16
|
+
failHandle({ errMsg: `connectSocket:fail ${e}` }, fail, complete)
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { webHandleSuccess, webHandleFail, isBrowser, throwSSRWarning } from '../../../common/js'
|
|
1
|
+
import { successHandle, failHandle, isBrowser, throwSSRWarning } from '../../../common/js'
|
|
3
2
|
import { hasOwn } from '@mpxjs/utils'
|
|
4
3
|
|
|
5
4
|
function setStorage (options = {}) {
|
|
@@ -13,10 +12,10 @@ function setStorage (options = {}) {
|
|
|
13
12
|
setStorageSync(key, data)
|
|
14
13
|
|
|
15
14
|
const res = { errMsg: 'setStorage:ok' }
|
|
16
|
-
|
|
15
|
+
successHandle(res, success, complete)
|
|
17
16
|
} catch (err) {
|
|
18
17
|
const res = { errMsg: `setStorage:fail ${err}` }
|
|
19
|
-
|
|
18
|
+
failHandle(res, fail, complete)
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
21
|
|
|
@@ -45,10 +44,10 @@ function getStorage (options = {}) {
|
|
|
45
44
|
|
|
46
45
|
if (result) {
|
|
47
46
|
const res = { errMsg: 'getStorage:ok', data: data }
|
|
48
|
-
|
|
47
|
+
successHandle(res, success, complete)
|
|
49
48
|
} else {
|
|
50
49
|
const res = { errMsg: 'getStorage:fail', data: null }
|
|
51
|
-
|
|
50
|
+
failHandle(res, fail, complete)
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
53
|
|
|
@@ -88,10 +87,10 @@ function getStorageInfo (options = {}) {
|
|
|
88
87
|
const info = getStorageInfoSync()
|
|
89
88
|
|
|
90
89
|
const res = Object.assign({}, { errMsg: 'getStorageInfo:ok' }, info)
|
|
91
|
-
|
|
90
|
+
successHandle(res, success, complete)
|
|
92
91
|
} catch (err) {
|
|
93
92
|
const res = { errMsg: `getStorageInfo:fail ${err}` }
|
|
94
|
-
|
|
93
|
+
failHandle(res, fail, complete)
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
96
|
|
|
@@ -118,10 +117,10 @@ function removeStorage (options = { key: '' }) {
|
|
|
118
117
|
removeStorageSync(key)
|
|
119
118
|
|
|
120
119
|
const res = { errMsg: 'removeStorage:ok' }
|
|
121
|
-
|
|
120
|
+
successHandle(res, success, complete)
|
|
122
121
|
} catch (err) {
|
|
123
122
|
const res = { errMsg: `removeStorage:fail ${err}` }
|
|
124
|
-
|
|
123
|
+
failHandle(res, fail, complete)
|
|
125
124
|
}
|
|
126
125
|
}
|
|
127
126
|
|
|
@@ -144,10 +143,10 @@ function clearStorage (options = {}) {
|
|
|
144
143
|
clearStorageSync()
|
|
145
144
|
|
|
146
145
|
const res = { errMsg: 'clearStorage:ok' }
|
|
147
|
-
|
|
146
|
+
successHandle(res, success, complete)
|
|
148
147
|
} catch (err) {
|
|
149
148
|
const res = { errMsg: `clearStorage:fail ${err}` }
|
|
150
|
-
|
|
149
|
+
failHandle(res, fail, complete)
|
|
151
150
|
}
|
|
152
151
|
}
|
|
153
152
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import AsyncStorage from '@react-native-async-storage/async-storage'
|
|
2
|
+
import { envError, successHandle, failHandle, defineUnsupportedProps } from '../../../common/js'
|
|
2
3
|
import { hasOwn } from '@mpxjs/utils'
|
|
3
|
-
import { envError, webHandleSuccess, webHandleFail, defineUnsupportedProps } from '../../../common/js'
|
|
4
4
|
function setStorage (options) {
|
|
5
5
|
const { key, data, success, fail, complete } = options
|
|
6
6
|
let obj = {}
|
|
@@ -14,13 +14,13 @@ function setStorage (options) {
|
|
|
14
14
|
const result = {
|
|
15
15
|
errMsg: `setStorage:fail ${err}`
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
failHandle(result, fail, complete)
|
|
18
18
|
return
|
|
19
19
|
}
|
|
20
20
|
const result = {
|
|
21
21
|
errMsg: 'setStorage:ok'
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
successHandle(result, success, complete)
|
|
24
24
|
})
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -32,7 +32,7 @@ function getStorage (options) {
|
|
|
32
32
|
const result = {
|
|
33
33
|
errMsg: 'getStorage:fail parameter error: parameter.key should be String instead of Undefined;'
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
failHandle(result, fail, complete)
|
|
36
36
|
return
|
|
37
37
|
}
|
|
38
38
|
AsyncStorage.getItem(key, (err, res) => {
|
|
@@ -40,7 +40,7 @@ function getStorage (options) {
|
|
|
40
40
|
const result = {
|
|
41
41
|
errMsg: `getStorage:fail ${err || 'data not found'}`
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
failHandle(result, fail, complete)
|
|
44
44
|
return
|
|
45
45
|
}
|
|
46
46
|
let item
|
|
@@ -56,7 +56,7 @@ function getStorage (options) {
|
|
|
56
56
|
errMsg: 'getStorage:ok',
|
|
57
57
|
data
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
successHandle(result, success, complete)
|
|
60
60
|
})
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -69,7 +69,7 @@ function getStorageInfo (options) {
|
|
|
69
69
|
const result = {
|
|
70
70
|
errMsg: `getStorage:fail ${err}`
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
failHandle(result, fail, complete)
|
|
73
73
|
return
|
|
74
74
|
}
|
|
75
75
|
const result = {
|
|
@@ -77,7 +77,7 @@ function getStorageInfo (options) {
|
|
|
77
77
|
errMsg: 'getStorageInfo:ok'
|
|
78
78
|
}
|
|
79
79
|
defineUnsupportedProps(result, ['currentSize', 'limitSize'])
|
|
80
|
-
|
|
80
|
+
successHandle(result, success, complete)
|
|
81
81
|
})
|
|
82
82
|
}
|
|
83
83
|
|
|
@@ -90,13 +90,13 @@ function removeStorage (options) {
|
|
|
90
90
|
const result = {
|
|
91
91
|
errMsg: `removeStorage:fail ${err}`
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
failHandle(result, fail, complete)
|
|
94
94
|
return
|
|
95
95
|
}
|
|
96
96
|
const result = {
|
|
97
97
|
errMsg: 'removeStorage:ok'
|
|
98
98
|
}
|
|
99
|
-
|
|
99
|
+
successHandle(result, success, complete)
|
|
100
100
|
})
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -111,13 +111,13 @@ function clearStorage (options) {
|
|
|
111
111
|
const result = {
|
|
112
112
|
errMsg: `clearStorage:fail ${err}`
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
failHandle(result, fail, complete)
|
|
115
115
|
return
|
|
116
116
|
}
|
|
117
117
|
const result = {
|
|
118
118
|
errMsg: 'clearStorage:ok'
|
|
119
119
|
}
|
|
120
|
-
|
|
120
|
+
successHandle(result, success, complete)
|
|
121
121
|
})
|
|
122
122
|
}
|
|
123
123
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { envError, isBrowser, throwSSRWarning,
|
|
1
|
+
import { envError, isBrowser, throwSSRWarning, successHandle } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
function getSystemInfoSync () {
|
|
4
4
|
if (!isBrowser) {
|
|
@@ -76,7 +76,7 @@ function getSystemInfo (options = {}) {
|
|
|
76
76
|
}
|
|
77
77
|
const info = getSystemInfoSync()
|
|
78
78
|
const res = Object.assign({ errMsg: 'getSystemInfo:ok' }, info)
|
|
79
|
-
|
|
79
|
+
successHandle(res, options.success, options.complete)
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
const getDeviceInfo = envError('getDeviceInfo')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import DeviceInfo from 'react-native-device-info'
|
|
2
2
|
import { Platform, PixelRatio, Dimensions, StatusBar } from 'react-native'
|
|
3
3
|
import { initialWindowMetrics } from 'react-native-safe-area-context'
|
|
4
|
-
import {
|
|
4
|
+
import { successHandle, failHandle, defineUnsupportedProps } from '../../../common/js'
|
|
5
5
|
|
|
6
6
|
const getWindowInfo = function () {
|
|
7
7
|
const dimensionsWindow = Dimensions.get('window')
|
|
@@ -84,12 +84,12 @@ const getSystemInfo = function (options) {
|
|
|
84
84
|
Object.assign(systemInfo, {
|
|
85
85
|
errMsg: 'setStorage:ok'
|
|
86
86
|
})
|
|
87
|
-
|
|
87
|
+
successHandle(systemInfo, success, complete)
|
|
88
88
|
} catch (err) {
|
|
89
89
|
const result = {
|
|
90
90
|
errMsg: `getSystemInfo:fail ${err}`
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
failHandle(result, fail, complete)
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { successHandle, failHandle } from '../../../common/js'
|
|
2
2
|
import { hasOwn } from '@mpxjs/utils'
|
|
3
3
|
import Vue from 'vue'
|
|
4
4
|
|
|
@@ -21,9 +21,9 @@ function setTabBarStyle (options = {}) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
if (resolved) {
|
|
24
|
-
|
|
24
|
+
successHandle(resolved, options.success, options.complete)
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
failHandle(rejected, options.fail, options.complete)
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
function setTabBarItem (options = {}) {
|
|
@@ -50,9 +50,9 @@ function setTabBarItem (options = {}) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
if (resolved) {
|
|
53
|
-
|
|
53
|
+
successHandle(resolved, options.success, options.complete)
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
failHandle(rejected, options.fail, options.complete)
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
function showTabBar (options = {}) {
|
|
@@ -66,9 +66,9 @@ function showTabBar (options = {}) {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
if (resolved) {
|
|
69
|
-
|
|
69
|
+
successHandle(resolved, options.success, options.complete)
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
failHandle(rejected, options.fail, options.complete)
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
function hideTabBar (options = {}) {
|
|
@@ -82,9 +82,9 @@ function hideTabBar (options = {}) {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
if (resolved) {
|
|
85
|
-
|
|
85
|
+
successHandle(resolved, options.success, options.complete)
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
failHandle(rejected, options.fail, options.complete)
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { successHandle, createDom, getRootElement } from '../../../common/js'
|
|
2
2
|
import '../../../common/stylus/Toast.styl'
|
|
3
3
|
import '../../../common/stylus/Loading.styl'
|
|
4
4
|
|
|
@@ -74,7 +74,7 @@ export default class Toast {
|
|
|
74
74
|
opts.duration >= 0 && this.hide({ duration: opts.duration }, type)
|
|
75
75
|
|
|
76
76
|
const errMsg = type === 'loading' ? 'showLoading:ok' : 'showToast:ok'
|
|
77
|
-
|
|
77
|
+
successHandle({ errMsg }, opts.success, opts.complete)
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
hide (options = {}, type) {
|
|
@@ -82,7 +82,7 @@ export default class Toast {
|
|
|
82
82
|
|
|
83
83
|
const duration = options.duration || 0
|
|
84
84
|
const errMsg = type === 'loading' ? 'hideLoading:ok' : 'hideToast:ok'
|
|
85
|
-
|
|
85
|
+
successHandle({ errMsg }, options.success, options.complete)
|
|
86
86
|
|
|
87
87
|
if (this.hideTimer) {
|
|
88
88
|
clearTimeout(this.hideTimer)
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './rnToast'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './rnToast'
|