提交 83a053b2 编写于 作者: D DCloud_LXH

feat(app): getAppAuthorizeSetting、getSystemSetting

上级 bb155edc
......@@ -41,6 +41,8 @@ export * from './protocols/device/ibeacon'
export * from './protocols/device/brightness'
export * from './protocols/device/soterAuthentication'
export * from './protocols/device/scanCode'
export * from './protocols/device/getSystemSetting'
export * from './protocols/device/getAppAuthorizeSetting'
export * from './protocols/storage/storage'
......
export const API_GET_APP_AUTHORIZE_SETTING = 'getAppAuthorizeSetting'
export type API_TYPE_GET_APP_AUTHORIZE_SETTING =
typeof uni.getAppAuthorizeSetting
export const API_GET_SYSTEM_SETTING = 'getSystemSetting'
export type API_TYPE_GET_SYSTEM_SETTING = typeof uni.getSystemSetting
import {
API_GET_APP_AUTHORIZE_SETTING,
API_TYPE_GET_APP_AUTHORIZE_SETTING,
defineSyncApi,
} from '@dcloudio/uni-api'
export const getAppAuthorizeSetting =
defineSyncApi<API_TYPE_GET_APP_AUTHORIZE_SETTING>(
API_GET_APP_AUTHORIZE_SETTING,
() => {
const { getAppAuthorizeSetting } = weex.requireModule('plus')
let appAuthorizeSetting =
getAppAuthorizeSetting() as ReturnType<API_TYPE_GET_APP_AUTHORIZE_SETTING>
try {
if (typeof appAuthorizeSetting === 'string')
appAuthorizeSetting = JSON.parse(appAuthorizeSetting)
} catch (error) {}
return appAuthorizeSetting
}
)
import {
API_GET_SYSTEM_SETTING,
API_TYPE_GET_SYSTEM_SETTING,
defineSyncApi,
} from '@dcloudio/uni-api'
export const getSystemSetting = defineSyncApi<API_TYPE_GET_SYSTEM_SETTING>(
API_GET_SYSTEM_SETTING,
() => {
const { getSystemSetting } = weex.requireModule('plus')
let systemSetting =
getSystemSetting() as ReturnType<API_TYPE_GET_SYSTEM_SETTING>
try {
if (typeof systemSetting === 'string')
systemSetting = JSON.parse(systemSetting)
} catch (error) {}
return systemSetting
}
)
......@@ -24,6 +24,8 @@ export * from './device/scanCode'
export * from './device/theme'
export * from './device/brightness'
export * from './device/getWindowInfo'
export * from './device/getSystemSetting'
export * from './device/getAppAuthorizeSetting'
export * from './media/getImageInfo'
export * from './media/getVideoInfo'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册