You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
179 lines
3.6 KiB
179 lines
3.6 KiB
import navigateTo from 'uni-helpers/navigate-to'
|
|
import redirectTo from '../../../mp-weixin/helpers/redirect-to'
|
|
import previewImage from '../../../mp-weixin/helpers/normalize-preview-image'
|
|
|
|
// 不支持的 API 列表
|
|
const todos = [
|
|
'preloadPage',
|
|
'unPreloadPage',
|
|
'loadSubPackage'
|
|
// 'createCameraContext',
|
|
// 'createLivePlayerContext',
|
|
// 'getSavedFileInfo',
|
|
// 'createMapContext',
|
|
// 'onMemoryWarning',
|
|
// 'onGyroscopeChange',
|
|
// 'startGyroscope',
|
|
// 'stopGyroscope',
|
|
// 'setScreenBrightness',
|
|
// 'getScreenBrightness',
|
|
// 'addPhoneContact',
|
|
// 'openBluetoothAdapter',
|
|
// 'startBluetoothDevicesDiscovery',
|
|
// 'onBluetoothDeviceFound',
|
|
// 'stopBluetoothDevicesDiscovery',
|
|
// 'onBluetoothAdapterStateChange',
|
|
// 'getConnectedBluetoothDevices',
|
|
// 'getBluetoothDevices',
|
|
// 'getBluetoothAdapterState',
|
|
// 'closeBluetoothAdapter',
|
|
// 'writeBLECharacteristicValue',
|
|
// 'readBLECharacteristicValue',
|
|
// 'onBLEConnectionStateChange',
|
|
// 'onBLECharacteristicValueChange',
|
|
// 'notifyBLECharacteristicValueChange',
|
|
// 'getBLEDeviceServices',
|
|
// 'getBLEDeviceCharacteristics',
|
|
// 'createBLEConnection',
|
|
// 'closeBLEConnection',
|
|
// 'onBeaconServiceChange',
|
|
// 'onBeaconUpdate',
|
|
// 'getBeacons',
|
|
// 'startBeaconDiscovery',
|
|
// 'stopBeaconDiscovery',
|
|
// 'showNavigationBarLoading',
|
|
// 'hideNavigationBarLoading',
|
|
// 'setTabBarItem',
|
|
// 'setTabBarStyle',
|
|
// 'hideTabBar',
|
|
// 'showTabBar',
|
|
// 'setTabBarBadge',
|
|
// 'removeTabBarBadge',
|
|
// 'showTabBarRedDot',
|
|
// 'hideTabBarRedDot',
|
|
// 'setBackgroundColor',
|
|
// 'setBackgroundTextStyle',
|
|
// 'chooseInvoiceTitle',
|
|
// 'addTemplate',
|
|
// 'deleteTemplate',
|
|
// 'getTemplateLibraryById',
|
|
// 'getTemplateLibraryList',
|
|
// 'getTemplateList',
|
|
// 'sendTemplateMessage',
|
|
// 'setEnableDebug',
|
|
// 'onWindowResize',
|
|
// 'offWindowResize',
|
|
// 'createOffscreenCanvas',
|
|
// 'vibrate'
|
|
]
|
|
|
|
// 存在兼容性的 API 列表
|
|
// 头条小程序自1.35.0+支持canIUses
|
|
const canIUses = [
|
|
// 'createIntersectionObserver',
|
|
// 'getSavedFileList',
|
|
// 'removeSavedFile',
|
|
// 'hideKeyboard',
|
|
// 'getImageInfo',
|
|
// 'createVideoContext',
|
|
// 'onSocketOpen',
|
|
// 'onSocketError',
|
|
// 'sendSocketMessage',
|
|
// 'onSocketMessage',
|
|
// 'closeSocket',
|
|
// 'onSocketClose',
|
|
// 'getExtConfig',
|
|
// 'getExtConfigSync',
|
|
// 'navigateToMiniProgram',
|
|
// 'navigateBackMiniProgram',
|
|
// 'compressImage',
|
|
// 'chooseLocation',
|
|
// 'openDocument',
|
|
// 'onUserCaptureScreen',
|
|
// 'getBackgroundAudioManager',
|
|
// 'setNavigationBarColor',
|
|
]
|
|
|
|
// 需要做转换的 API 列表
|
|
const protocols = {
|
|
chooseImage: {
|
|
args: {
|
|
sizeType: false
|
|
}
|
|
},
|
|
navigateTo,
|
|
redirectTo,
|
|
previewImage,
|
|
connectSocket: {
|
|
args: {
|
|
method: false
|
|
}
|
|
},
|
|
chooseVideo: {
|
|
args: {
|
|
camera: false
|
|
}
|
|
},
|
|
scanCode: {
|
|
args: {
|
|
onlyFromCamera: false,
|
|
scanType: false
|
|
}
|
|
},
|
|
startAccelerometer: {
|
|
args: {
|
|
interval: false
|
|
}
|
|
},
|
|
showToast: {
|
|
args: {
|
|
image: false,
|
|
mask: false
|
|
}
|
|
},
|
|
showLoading: {
|
|
args: {
|
|
mask: false
|
|
}
|
|
},
|
|
showModal: {
|
|
args: {
|
|
cancelColor: false,
|
|
confirmColor: false
|
|
}
|
|
},
|
|
showActionSheet: {
|
|
args: {
|
|
itemColor: false
|
|
}
|
|
},
|
|
login: {
|
|
args: {
|
|
scopes: false,
|
|
timeout: false
|
|
}
|
|
},
|
|
getUserInfo: {
|
|
args: {
|
|
lang: false,
|
|
timeout: false
|
|
}
|
|
},
|
|
requestPayment: {
|
|
name: tt.pay ? 'pay' : 'requestPayment',
|
|
args: {
|
|
orderInfo: tt.pay ? 'orderInfo' : 'data'
|
|
}
|
|
},
|
|
getFileInfo: {
|
|
args: {
|
|
digestAlgorithm: false
|
|
}
|
|
}
|
|
}
|
|
|
|
export {
|
|
protocols,
|
|
todos,
|
|
canIUses
|
|
}
|
|
|