提交 bef408a8 编写于 作者: Q qiang

chore: build

上级 b6780df2
......@@ -13376,6 +13376,7 @@ const getDeviceInfo = defineSyncApi('getDeviceInfo', () => {
weexGetSystemInfoSync();
const { deviceBrand, deviceModel, osName, osVersion, deviceOrientation, deviceType, } = systemInfo;
const brand = deviceBrand.toLowerCase();
const _osName = osName.toLowerCase();
return {
deviceBrand: brand,
deviceModel,
......@@ -13385,13 +13386,13 @@ const getDeviceInfo = defineSyncApi('getDeviceInfo', () => {
deviceType,
brand,
model: deviceModel,
system: `${osName === 'ios' ? 'iOS' : 'Android'} ${osVersion}`,
platform: osName,
system: `${_osName === 'ios' ? 'iOS' : 'Android'} ${osVersion}`,
platform: _osName,
};
});
const getAppBaseInfo = defineSyncApi('getAppBaseInfo', () => {
weexGetSystemInfoSync();
const { hostPackageName, hostName, osLanguage, hostVersion, hostLanguage, hostTheme, appId, appName, appVersion, appVersionCode, } = systemInfo;
const { hostPackageName, hostName, hostVersion, hostLanguage, hostTheme, appId, appName, appVersion, appVersionCode, } = systemInfo;
return {
SDKVersion: '',
hostSDKVersion: '',
......@@ -13402,7 +13403,7 @@ const getAppBaseInfo = defineSyncApi('getAppBaseInfo', () => {
appVersionCode,
appLanguage: uni.getLocale(),
version: plus.runtime.innerVersion,
language: osLanguage,
language: hostLanguage,
theme: '',
hostPackageName,
hostName,
......@@ -13421,6 +13422,7 @@ const getSystemInfoSync = defineSyncApi('getSystemInfoSync', () => {
const appBaseInfo = getAppBaseInfo();
_initSystemInfo = true;
const { osName, osLanguage, osVersion } = systemInfo;
const _osName = osName.toLowerCase();
const osLanguageSplit = osLanguage.split('-');
const osLanguageSplitLast = osLanguageSplit[osLanguageSplit.length - 1];
let _osLanguage = `${osLanguageSplit[0]}${osLanguageSplitLast ? '-' + osLanguageSplitLast : ''}`;
......@@ -13430,9 +13432,10 @@ const getSystemInfoSync = defineSyncApi('getSystemInfoSync', () => {
uniCompileVersion: __uniConfig.compilerVersion,
uniRuntimeVersion: __uniConfig.compilerVersion,
osLanguage: _osLanguage,
osName: _osName,
};
if (osName === 'ios') {
extraData.romName = osName;
if (_osName === 'ios') {
extraData.romName = _osName;
extraData.romVersion = osVersion;
}
const _systemInfo = extend(systemInfo, windowInfo, deviceInfo, appBaseInfo, extraData);
......
......@@ -10021,20 +10021,6 @@ const getStorageInfoSync = /* @__PURE__ */ defineSyncApi("getStorageInfoSync", (
const getStorageInfo = /* @__PURE__ */ defineAsyncApi("getStorageInfo", (_, { resolve }) => {
resolve(getStorageInfoSync());
});
const UUID_KEY = "__DC_STAT_UUID";
const storage = window.localStorage || window.sessionStorage || {};
let deviceId;
function deviceId$1() {
deviceId = deviceId || storage[UUID_KEY];
if (!deviceId) {
deviceId = Date.now() + "" + Math.floor(Math.random() * 1e7);
try {
storage[UUID_KEY] = deviceId;
} catch (error) {
}
}
return deviceId;
}
let browserInfo;
function initBrowserInfo() {
{
......@@ -10056,8 +10042,8 @@ const getDeviceInfo = /* @__PURE__ */ defineSyncApi("getDeviceInfo", () => {
return {
deviceBrand,
deviceModel,
devicePixelRatio: window.devicePixelRatio,
deviceId: deviceId$1(),
devicePixelRatio: 1,
deviceId: Date.now() + "" + Math.floor(Math.random() * 1e7),
deviceOrientation,
deviceType,
brand,
......
......@@ -624,7 +624,7 @@ const offPushMessage = (fn) => {
}
};
const SYNC_API_RE = /^\$|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const SYNC_API_RE = /^\$|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getDeviceInfo|getAppBaseInfo|getWindowInfo/;
const CONTEXT_API_RE = /^create|Manager$/;
// Context例外情况
const CONTEXT_API_RE_EXC = ['createBLEConnection'];
......@@ -860,13 +860,14 @@ function initGetProvider(providers) {
};
}
function getDeviceBrand(model) {
function _getDeviceBrand(model) {
if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) {
return 'apple';
}
if (/windows/gi.test(model)) {
return 'microsoft';
}
return '';
}
const UUID_KEY = '__DC_STAT_UUID';
let deviceId;
......@@ -895,7 +896,7 @@ function addSafeAreaInsets(fromRes, toRes) {
}
}
function populateParameters(fromRes, toRes) {
const { brand, model, system, language, theme, version, hostName, platform, fontSizeSetting, SDKVersion, pixelRatio, deviceOrientation, environment, } = fromRes;
const { brand = '', model = '', system = '', language = '', theme, version, hostName, platform, fontSizeSetting, SDKVersion, pixelRatio, deviceOrientation, environment, } = fromRes;
const isQuickApp = "mp-alipay".indexOf('quickapp-webview') !== -1;
// osName osVersion
let osName = '';
......@@ -906,31 +907,9 @@ function populateParameters(fromRes, toRes) {
}
let hostVersion = version;
// deviceType
let deviceType = fromRes.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc',
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break;
}
}
}
let deviceType = getGetDeviceType(fromRes, model);
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
}
else {
deviceBrand = getDeviceBrand(deviceBrand);
}
let deviceBrand = getDeviceBrand(brand, model, isQuickApp);
// hostName
let _hostName = hostName || "mp-alipay".split('-')[1]; // mp-jd
_hostName = fromRes.app;
......@@ -976,6 +955,38 @@ function populateParameters(fromRes, toRes) {
browseVersion: undefined,
};
extend(toRes, parameters);
}
function getGetDeviceType(fromRes, model) {
// deviceType
let deviceType = fromRes.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc',
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break;
}
}
}
return deviceType;
}
function getDeviceBrand(brand, model, isQuickApp = false) {
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
}
else {
deviceBrand = _getDeviceBrand(deviceBrand);
}
return deviceBrand;
}
const redirectTo = {};
......
......@@ -624,7 +624,7 @@ const offPushMessage = (fn) => {
}
};
const SYNC_API_RE = /^\$|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const SYNC_API_RE = /^\$|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getDeviceInfo|getAppBaseInfo|getWindowInfo/;
const CONTEXT_API_RE = /^create|Manager$/;
// Context例外情况
const CONTEXT_API_RE_EXC = ['createBLEConnection'];
......@@ -860,13 +860,14 @@ function initGetProvider(providers) {
};
}
function getDeviceBrand(model) {
function _getDeviceBrand(model) {
if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) {
return 'apple';
}
if (/windows/gi.test(model)) {
return 'microsoft';
}
return '';
}
const UUID_KEY = '__DC_STAT_UUID';
let deviceId;
......@@ -895,7 +896,7 @@ function addSafeAreaInsets(fromRes, toRes) {
}
}
function populateParameters(fromRes, toRes) {
const { brand, model, system, language, theme, version, hostName, platform, fontSizeSetting, SDKVersion, pixelRatio, deviceOrientation, environment, } = fromRes;
const { brand = '', model = '', system = '', language = '', theme, version, hostName, platform, fontSizeSetting, SDKVersion, pixelRatio, deviceOrientation, environment, } = fromRes;
const isQuickApp = "mp-baidu".indexOf('quickapp-webview') !== -1;
// osName osVersion
let osName = '';
......@@ -910,15 +911,9 @@ function populateParameters(fromRes, toRes) {
hostVersion = fromRes.swanNativeVersion;
}
// deviceType
let deviceType = fromRes.deviceType || 'phone';
let deviceType = getGetDeviceType(fromRes);
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
}
else {
deviceBrand = getDeviceBrand(deviceBrand);
}
let deviceBrand = getDeviceBrand(brand, model, isQuickApp);
// hostName
let _hostName = hostName || "mp-baidu".split('-')[1]; // mp-jd
{
......@@ -969,6 +964,22 @@ function populateParameters(fromRes, toRes) {
browseVersion: undefined,
};
extend(toRes, parameters);
}
function getGetDeviceType(fromRes, model) {
// deviceType
let deviceType = fromRes.deviceType || 'phone';
return deviceType;
}
function getDeviceBrand(brand, model, isQuickApp = false) {
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
}
else {
deviceBrand = _getDeviceBrand(deviceBrand);
}
return deviceBrand;
}
const getSystemInfo = {
......
......@@ -624,7 +624,7 @@ const offPushMessage = (fn) => {
}
};
const SYNC_API_RE = /^\$|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const SYNC_API_RE = /^\$|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getDeviceInfo|getAppBaseInfo|getWindowInfo/;
const CONTEXT_API_RE = /^create|Manager$/;
// Context例外情况
const CONTEXT_API_RE_EXC = ['createBLEConnection'];
......@@ -860,13 +860,14 @@ function initGetProvider(providers) {
};
}
function getDeviceBrand(model) {
function _getDeviceBrand(model) {
if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) {
return 'apple';
}
if (/windows/gi.test(model)) {
return 'microsoft';
}
return '';
}
const UUID_KEY = '__DC_STAT_UUID';
let deviceId;
......@@ -895,7 +896,7 @@ function addSafeAreaInsets(fromRes, toRes) {
}
}
function populateParameters(fromRes, toRes) {
const { brand, model, system, language, theme, version, hostName, platform, fontSizeSetting, SDKVersion, pixelRatio, deviceOrientation, environment, } = fromRes;
const { brand = '', model = '', system = '', language = '', theme, version, hostName, platform, fontSizeSetting, SDKVersion, pixelRatio, deviceOrientation, environment, } = fromRes;
const isQuickApp = "mp-kuaishou".indexOf('quickapp-webview') !== -1;
// osName osVersion
let osName = '';
......@@ -906,31 +907,9 @@ function populateParameters(fromRes, toRes) {
}
let hostVersion = version;
// deviceType
let deviceType = fromRes.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc',
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break;
}
}
}
let deviceType = getGetDeviceType(fromRes, model);
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
}
else {
deviceBrand = getDeviceBrand(deviceBrand);
}
let deviceBrand = getDeviceBrand(brand, model, isQuickApp);
// hostName
let _hostName = hostName || "mp-kuaishou".split('-')[1]; // mp-jd
{
......@@ -975,6 +954,38 @@ function populateParameters(fromRes, toRes) {
browseVersion: undefined,
};
extend(toRes, parameters);
}
function getGetDeviceType(fromRes, model) {
// deviceType
let deviceType = fromRes.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc',
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break;
}
}
}
return deviceType;
}
function getDeviceBrand(brand, model, isQuickApp = false) {
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
}
else {
deviceBrand = _getDeviceBrand(deviceBrand);
}
return deviceBrand;
}
const getSystemInfo = {
......
......@@ -624,7 +624,7 @@ const offPushMessage = (fn) => {
}
};
const SYNC_API_RE = /^\$|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const SYNC_API_RE = /^\$|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getDeviceInfo|getAppBaseInfo|getWindowInfo/;
const CONTEXT_API_RE = /^create|Manager$/;
// Context例外情况
const CONTEXT_API_RE_EXC = ['createBLEConnection'];
......@@ -887,7 +887,8 @@ function addSafeAreaInsets(fromRes, toRes) {
}
}
function populateParameters(fromRes, toRes) {
const { brand, model, system, language, theme, version, hostName, platform, fontSizeSetting, SDKVersion, pixelRatio, deviceOrientation, environment, } = fromRes;
const { brand = '', model = '', system = '', language = '', theme, version, hostName, platform, fontSizeSetting, SDKVersion, pixelRatio, deviceOrientation, environment, } = fromRes;
const isQuickApp = "mp-lark".indexOf('quickapp-webview') !== -1;
// osName osVersion
let osName = '';
let osVersion = '';
......@@ -897,28 +898,9 @@ function populateParameters(fromRes, toRes) {
}
let hostVersion = version;
// deviceType
let deviceType = fromRes.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc',
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break;
}
}
}
let deviceType = getGetDeviceType(fromRes, model);
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
{
deviceBrand = brand.toLocaleLowerCase();
}
let deviceBrand = getDeviceBrand(brand, model, isQuickApp);
// hostName
let _hostName = hostName || "mp-lark".split('-')[1]; // mp-jd
{
......@@ -963,6 +945,35 @@ function populateParameters(fromRes, toRes) {
browseVersion: undefined,
};
extend(toRes, parameters);
}
function getGetDeviceType(fromRes, model) {
// deviceType
let deviceType = fromRes.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc',
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break;
}
}
}
return deviceType;
}
function getDeviceBrand(brand, model, isQuickApp = false) {
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
{
deviceBrand = brand.toLocaleLowerCase();
}
return deviceBrand;
}
const getSystemInfo = {
......
......@@ -624,7 +624,7 @@ const offPushMessage = (fn) => {
}
};
const SYNC_API_RE = /^\$|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const SYNC_API_RE = /^\$|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getDeviceInfo|getAppBaseInfo|getWindowInfo/;
const CONTEXT_API_RE = /^create|Manager$/;
// Context例外情况
const CONTEXT_API_RE_EXC = ['createBLEConnection'];
......@@ -860,13 +860,14 @@ function initGetProvider(providers) {
};
}
function getDeviceBrand(model) {
function _getDeviceBrand(model) {
if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) {
return 'apple';
}
if (/windows/gi.test(model)) {
return 'microsoft';
}
return '';
}
const UUID_KEY = '__DC_STAT_UUID';
let deviceId;
......@@ -895,7 +896,7 @@ function addSafeAreaInsets(fromRes, toRes) {
}
}
function populateParameters(fromRes, toRes) {
const { brand, model, system, language, theme, version, hostName, platform, fontSizeSetting, SDKVersion, pixelRatio, deviceOrientation, environment, } = fromRes;
const { brand = '', model = '', system = '', language = '', theme, version, hostName, platform, fontSizeSetting, SDKVersion, pixelRatio, deviceOrientation, environment, } = fromRes;
const isQuickApp = "mp-qq".indexOf('quickapp-webview') !== -1;
// osName osVersion
let osName = '';
......@@ -906,31 +907,9 @@ function populateParameters(fromRes, toRes) {
}
let hostVersion = version;
// deviceType
let deviceType = fromRes.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc',
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break;
}
}
}
let deviceType = getGetDeviceType(fromRes, model);
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
}
else {
deviceBrand = getDeviceBrand(deviceBrand);
}
let deviceBrand = getDeviceBrand(brand, model, isQuickApp);
// hostName
let _hostName = hostName || "mp-qq".split('-')[1]; // mp-jd
_hostName = fromRes.AppPlatform;
......@@ -973,6 +952,38 @@ function populateParameters(fromRes, toRes) {
browseVersion: undefined,
};
extend(toRes, parameters);
}
function getGetDeviceType(fromRes, model) {
// deviceType
let deviceType = fromRes.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc',
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break;
}
}
}
return deviceType;
}
function getDeviceBrand(brand, model, isQuickApp = false) {
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
}
else {
deviceBrand = _getDeviceBrand(deviceBrand);
}
return deviceBrand;
}
const getSystemInfo = {
......
......@@ -624,7 +624,7 @@ const offPushMessage = (fn) => {
}
};
const SYNC_API_RE = /^\$|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const SYNC_API_RE = /^\$|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getDeviceInfo|getAppBaseInfo|getWindowInfo/;
const CONTEXT_API_RE = /^create|Manager$/;
// Context例外情况
const CONTEXT_API_RE_EXC = ['createBLEConnection'];
......@@ -887,7 +887,8 @@ function addSafeAreaInsets(fromRes, toRes) {
}
}
function populateParameters(fromRes, toRes) {
const { brand, model, system, language, theme, version, hostName, platform, fontSizeSetting, SDKVersion, pixelRatio, deviceOrientation, environment, } = fromRes;
const { brand = '', model = '', system = '', language = '', theme, version, hostName, platform, fontSizeSetting, SDKVersion, pixelRatio, deviceOrientation, environment, } = fromRes;
const isQuickApp = "mp-toutiao".indexOf('quickapp-webview') !== -1;
// osName osVersion
let osName = '';
let osVersion = '';
......@@ -897,28 +898,9 @@ function populateParameters(fromRes, toRes) {
}
let hostVersion = version;
// deviceType
let deviceType = fromRes.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc',
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break;
}
}
}
let deviceType = getGetDeviceType(fromRes, model);
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
{
deviceBrand = brand.toLocaleLowerCase();
}
let deviceBrand = getDeviceBrand(brand, model, isQuickApp);
// hostName
let _hostName = hostName || "mp-toutiao".split('-')[1]; // mp-jd
{
......@@ -963,6 +945,35 @@ function populateParameters(fromRes, toRes) {
browseVersion: undefined,
};
extend(toRes, parameters);
}
function getGetDeviceType(fromRes, model) {
// deviceType
let deviceType = fromRes.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc',
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break;
}
}
}
return deviceType;
}
function getDeviceBrand(brand, model, isQuickApp = false) {
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
{
deviceBrand = brand.toLocaleLowerCase();
}
return deviceBrand;
}
const getSystemInfo = {
......
......@@ -588,7 +588,7 @@ const offPushMessage = (fn) => {
}
};
const SYNC_API_RE = /^\$|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const SYNC_API_RE = /^\$|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getDeviceInfo|getAppBaseInfo|getWindowInfo/;
const CONTEXT_API_RE = /^create|Manager$/;
// Context例外情况
const CONTEXT_API_RE_EXC = ['createBLEConnection'];
......@@ -824,13 +824,14 @@ function initGetProvider(providers) {
};
}
function getDeviceBrand(model) {
function _getDeviceBrand(model) {
if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) {
return 'apple';
}
if (/windows/gi.test(model)) {
return 'microsoft';
}
return '';
}
const UUID_KEY = '__DC_STAT_UUID';
let deviceId;
......@@ -859,7 +860,7 @@ function addSafeAreaInsets(fromRes, toRes) {
}
}
function populateParameters(fromRes, toRes) {
const { brand, model, system, language, theme, version, hostName, platform, fontSizeSetting, SDKVersion, pixelRatio, deviceOrientation, environment, } = fromRes;
const { brand = '', model = '', system = '', language = '', theme, version, hostName, platform, fontSizeSetting, SDKVersion, pixelRatio, deviceOrientation, environment, } = fromRes;
const isQuickApp = "mp-weixin".indexOf('quickapp-webview') !== -1;
// osName osVersion
let osName = '';
......@@ -870,38 +871,16 @@ function populateParameters(fromRes, toRes) {
}
let hostVersion = version;
// deviceType
let deviceType = fromRes.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc',
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break;
}
}
}
let deviceType = getGetDeviceType(fromRes, model);
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
}
else {
deviceBrand = getDeviceBrand(deviceBrand);
}
let deviceBrand = getDeviceBrand(brand, model, isQuickApp);
// hostName
let _hostName = hostName || "mp-weixin".split('-')[1]; // mp-jd
{
if (environment) {
_hostName = environment;
}
else if (fromRes.host) {
else if (fromRes.host && fromRes.host.env) {
_hostName = fromRes.host.env;
}
}
......@@ -944,6 +923,38 @@ function populateParameters(fromRes, toRes) {
browseVersion: undefined,
};
extend(toRes, parameters);
}
function getGetDeviceType(fromRes, model) {
// deviceType
let deviceType = fromRes.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc',
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break;
}
}
}
return deviceType;
}
function getDeviceBrand(brand, model, isQuickApp = false) {
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
}
else {
deviceBrand = _getDeviceBrand(deviceBrand);
}
return deviceBrand;
}
const getSystemInfo = {
......@@ -998,6 +1009,53 @@ const showActionSheet = {
},
};
const getDeviceInfo = {
returnValue: (fromRes, toRes) => {
const { brand, model } = fromRes;
let deviceType = getGetDeviceType(fromRes, model);
let deviceBrand = getDeviceBrand(brand, model);
useDeviceId()(fromRes, toRes);
extend(toRes, {
deviceType,
deviceBrand,
deviceModel: model,
});
},
};
const getAppBaseInfo = {
returnValue: (fromRes, toRes) => {
const { version, language, SDKVersion, theme } = fromRes;
let _hostName = "mp-weixin".split('-')[1]; // mp-jd
{
if (fromRes.host && fromRes.host.env) {
_hostName = fromRes.host.env;
}
}
extend(toRes, {
hostVersion: version,
hostLanguage: language.replace('_', '-'),
hostName: _hostName,
hostSDKVersion: SDKVersion,
hostTheme: theme,
appId: process.env.UNI_APP_ID,
appName: process.env.UNI_APP_NAME,
appVersion: process.env.UNI_APP_VERSION_NAME,
appVersionCode: process.env.UNI_APP_VERSION_CODE,
});
},
};
const getWindowInfo = {
returnValue: (fromRes, toRes) => {
addSafeAreaInsets(fromRes, toRes);
extend(toRes, {
windowTop: 0,
windowBottom: 0,
});
},
};
const mocks = ['__route__', '__wxExparserNodeId__', '__wxWebviewId__'];
const getProvider = initGetProvider({
......@@ -1039,7 +1097,10 @@ var protocols = /*#__PURE__*/Object.freeze({
previewImage: previewImage,
getSystemInfo: getSystemInfo,
getSystemInfoSync: getSystemInfoSync,
showActionSheet: showActionSheet
showActionSheet: showActionSheet,
getDeviceInfo: getDeviceInfo,
getAppBaseInfo: getAppBaseInfo,
getWindowInfo: getWindowInfo
});
var index = initUni(shims, protocols);
......
......@@ -624,7 +624,7 @@ const offPushMessage = (fn) => {
}
};
const SYNC_API_RE = /^\$|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64/;
const SYNC_API_RE = /^\$|getLocale|setLocale|sendNativeEvent|restoreGlobal|requireGlobal|getCurrentSubNVue|getMenuButtonBoundingClientRect|^report|interceptors|Interceptor$|getSubNVueById|requireNativePlugin|upx2px|hideKeyboard|canIUse|^create|Sync$|Manager$|base64ToArrayBuffer|arrayBufferToBase64|getDeviceInfo|getAppBaseInfo|getWindowInfo/;
const CONTEXT_API_RE = /^create|Manager$/;
// Context例外情况
const CONTEXT_API_RE_EXC = ['createBLEConnection'];
......@@ -860,13 +860,14 @@ function initGetProvider(providers) {
};
}
function getDeviceBrand(model) {
function _getDeviceBrand(model) {
if (/iphone/gi.test(model) || /ipad/gi.test(model) || /mac/gi.test(model)) {
return 'apple';
}
if (/windows/gi.test(model)) {
return 'microsoft';
}
return '';
}
const UUID_KEY = '__DC_STAT_UUID';
let deviceId;
......@@ -895,7 +896,7 @@ function addSafeAreaInsets(fromRes, toRes) {
}
}
function populateParameters(fromRes, toRes) {
const { brand, model, system, language, theme, version, hostName, platform, fontSizeSetting, SDKVersion, pixelRatio, deviceOrientation, environment, } = fromRes;
const { brand = '', model = '', system = '', language = '', theme, version, hostName, platform, fontSizeSetting, SDKVersion, pixelRatio, deviceOrientation, environment, } = fromRes;
const isQuickApp = "quickapp-webview".indexOf('quickapp-webview') !== -1;
// osName osVersion
let osName = '';
......@@ -906,31 +907,9 @@ function populateParameters(fromRes, toRes) {
}
let hostVersion = version;
// deviceType
let deviceType = fromRes.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc',
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break;
}
}
}
let deviceType = getGetDeviceType(fromRes, model);
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
}
else {
deviceBrand = getDeviceBrand(deviceBrand);
}
let deviceBrand = getDeviceBrand(brand, model, isQuickApp);
// hostName
let _hostName = hostName || "quickapp-webview".split('-')[1]; // mp-jd
// deviceOrientation
......@@ -972,6 +951,38 @@ function populateParameters(fromRes, toRes) {
browseVersion: undefined,
};
extend(toRes, parameters);
}
function getGetDeviceType(fromRes, model) {
// deviceType
let deviceType = fromRes.deviceType || 'phone';
{
const deviceTypeMaps = {
ipad: 'pad',
windows: 'pc',
mac: 'pc',
};
const deviceTypeMapsKeys = Object.keys(deviceTypeMaps);
const _model = model.toLocaleLowerCase();
for (let index = 0; index < deviceTypeMapsKeys.length; index++) {
const _m = deviceTypeMapsKeys[index];
if (_model.indexOf(_m) !== -1) {
deviceType = deviceTypeMaps[_m];
break;
}
}
}
return deviceType;
}
function getDeviceBrand(brand, model, isQuickApp = false) {
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
}
else {
deviceBrand = _getDeviceBrand(deviceBrand);
}
return deviceBrand;
}
const getSystemInfo = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册