提交 492cb704 编写于 作者: Q qiang

chore: build

上级 5f20eac5
......@@ -6484,7 +6484,7 @@ var serviceContext = (function () {
weexGetSystemInfoSync();
const {
deviceBrand, deviceModel, osName,
osVersion
osVersion, deviceOrientation, deviceType
} = systemInfo;
const brand = deviceBrand.toLowerCase();
......@@ -6492,6 +6492,10 @@ var serviceContext = (function () {
return {
deviceBrand: brand,
deviceModel,
devicePixelRatio: plus.screen.scale,
deviceId: deviceId$1(),
deviceOrientation,
deviceType,
brand,
model: deviceModel,
system: `${osName === 'ios' ? 'iOS' : 'Android'} ${osVersion}`,
......@@ -6502,7 +6506,7 @@ var serviceContext = (function () {
function getAppBaseInfo () {
weexGetSystemInfoSync();
const {
hostPackageName, hostName, osLanguage,
hostPackageName, hostName,
hostVersion, hostLanguage, hostTheme,
appId, appName, appVersion, appVersionCode
} = systemInfo;
......@@ -6517,7 +6521,7 @@ var serviceContext = (function () {
appVersionCode,
appLanguage: uni.getLocale(),
version: plus.runtime.innerVersion,
language: osLanguage,
language: hostLanguage,
theme: '',
hostPackageName,
hostName,
......@@ -6536,11 +6540,12 @@ var serviceContext = (function () {
_initSystemInfo = true;
weexGetSystemInfoSync();
_initSystemInfo = false;
const windowInfo = getWindowInfo();
const deviceInfo = getDeviceInfo();
const appBaseInfo = getAppBaseInfo();
_initSystemInfo = true;
const { osName, osLanguage, osVersion, pixelRatio } = systemInfo;
const { osName, osLanguage, osVersion } = systemInfo;
const osLanguageSplit = osLanguage.split('-');
const osLanguageSplitLast = osLanguageSplit[osLanguageSplit.length - 1];
const _osLanguage = `${osLanguageSplit[0]}${osLanguageSplitLast ? '-' + osLanguageSplitLast : ''}`;
......@@ -6548,8 +6553,6 @@ var serviceContext = (function () {
const extraData = {
errMsg: 'getSystemInfo:ok',
fontSizeSetting: appBaseInfo.hostFontSizeSetting,
devicePixelRatio: pixelRatio,
deviceId: deviceId$1(),
uniCompileVersion: __uniConfig.compilerVersion,
uniRuntimeVersion: __uniConfig.compilerVersion,
osLanguage: _osLanguage
......@@ -6563,7 +6566,7 @@ var serviceContext = (function () {
const _systemInfo = Object.assign(
{},
systemInfo,
getWindowInfo(),
windowInfo,
deviceInfo,
appBaseInfo,
extraData
......
......@@ -636,9 +636,10 @@ function removeStorageSync (key) {
})
}
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 ''
}
function addSafeAreaInsets (result) {
......@@ -655,8 +656,8 @@ function addSafeAreaInsets (result) {
function populateParameters (result) {
const {
brand, model, system,
language, theme, version,
brand = '', model = '', system = '',
language = '', theme, version,
hostName, platform, fontSizeSetting,
SDKVersion, pixelRatio, deviceOrientation,
environment
......@@ -673,31 +674,10 @@ function populateParameters (result) {
let hostVersion = version;
// deviceType
let deviceType = result.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
}
}
}
const deviceType = getGetDeviceType(result, model);
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if ( isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = getDeviceBrand(deviceBrand);
}
const deviceBrand = getDeviceBrand(brand, model, isQuickApp);
// hostName
let _hostName = hostName || "mp-alipay".split('-')[1]; // mp-jd
......@@ -732,7 +712,7 @@ function populateParameters (result) {
osVersion,
hostTheme: theme,
hostVersion,
hostLanguage: language.split('_', '-'),
hostLanguage: language.replace('_', '-'),
hostName: _hostName,
hostSDKVersion: _SDKVersion,
hostFontSizeSetting: fontSizeSetting,
......@@ -750,6 +730,44 @@ function populateParameters (result) {
Object.assign(result, parameters);
}
function getGetDeviceType (result, model) {
let deviceType = result.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
) {
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (
isQuickApp
) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = _getDeviceBrand(deviceBrand);
}
return deviceBrand
}
const UUID_KEY = '__DC_STAT_UUID';
let deviceId;
function addUuid (result) {
......
......@@ -651,9 +651,10 @@ var previewImage = {
}
};
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';
......@@ -684,8 +685,8 @@ function addSafeAreaInsets (result) {
function populateParameters (result) {
const {
brand, model, system,
language, theme, version,
brand = '', model = '', system = '',
language = '', theme, version,
hostName, platform, fontSizeSetting,
SDKVersion, pixelRatio, deviceOrientation,
environment
......@@ -706,15 +707,10 @@ function populateParameters (result) {
}
// deviceType
let deviceType = result.deviceType || 'phone';
const deviceType = getGetDeviceType(result);
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if ( isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = getDeviceBrand(deviceBrand);
}
const deviceBrand = getDeviceBrand(brand, model, isQuickApp);
// hostName
let _hostName = hostName || "mp-baidu".split('-')[1]; // mp-jd
......@@ -750,7 +746,7 @@ function populateParameters (result) {
osVersion,
hostTheme: theme,
hostVersion,
hostLanguage: language.split('_', '-'),
hostLanguage: language.replace('_', '-'),
hostName: _hostName,
hostSDKVersion: _SDKVersion,
hostFontSizeSetting: fontSizeSetting,
......@@ -768,6 +764,28 @@ function populateParameters (result) {
Object.assign(result, parameters);
}
function getGetDeviceType (result, model) {
let deviceType = result.deviceType || 'phone';
return deviceType
}
function getDeviceBrand (
brand,
model,
isQuickApp = false
) {
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (
isQuickApp
) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = _getDeviceBrand(deviceBrand);
}
return deviceBrand
}
var getSystemInfo = {
returnValue: function (result) {
useDeviceId(result);
......
......@@ -480,9 +480,10 @@ var baseApi = /*#__PURE__*/Object.freeze({
interceptors: interceptors
});
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';
......@@ -513,8 +514,8 @@ function addSafeAreaInsets (result) {
function populateParameters (result) {
const {
brand, model, system,
language, theme, version,
brand = '', model = '', system = '',
language = '', theme, version,
hostName, platform, fontSizeSetting,
SDKVersion, pixelRatio, deviceOrientation,
environment
......@@ -534,31 +535,10 @@ function populateParameters (result) {
}
// deviceType
let deviceType = result.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
}
}
}
const deviceType = getGetDeviceType(result, model);
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if ( isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = getDeviceBrand(deviceBrand);
}
const deviceBrand = getDeviceBrand(brand, model, isQuickApp);
// hostName
let _hostName = hostName || "mp-jd".split('-')[1]; // mp-jd
......@@ -591,7 +571,7 @@ function populateParameters (result) {
osVersion,
hostTheme: theme,
hostVersion,
hostLanguage: language.split('_', '-'),
hostLanguage: language.replace('_', '-'),
hostName: _hostName,
hostSDKVersion: _SDKVersion,
hostFontSizeSetting: fontSizeSetting,
......@@ -609,6 +589,44 @@ function populateParameters (result) {
Object.assign(result, parameters);
}
function getGetDeviceType (result, model) {
let deviceType = result.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
) {
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (
isQuickApp
) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = _getDeviceBrand(deviceBrand);
}
return deviceBrand
}
var getSystemInfo = {
returnValue: function (result) {
useDeviceId(result);
......
......@@ -651,9 +651,10 @@ var previewImage = {
}
};
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';
......@@ -684,8 +685,8 @@ function addSafeAreaInsets (result) {
function populateParameters (result) {
const {
brand, model, system,
language, theme, version,
brand = '', model = '', system = '',
language = '', theme, version,
hostName, platform, fontSizeSetting,
SDKVersion, pixelRatio, deviceOrientation,
environment
......@@ -702,31 +703,10 @@ function populateParameters (result) {
let hostVersion = version;
// deviceType
let deviceType = result.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
}
}
}
const deviceType = getGetDeviceType(result, model);
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if ( isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = getDeviceBrand(deviceBrand);
}
const deviceBrand = getDeviceBrand(brand, model, isQuickApp);
// hostName
let _hostName = hostName || "mp-kuaishou".split('-')[1]; // mp-jd
......@@ -760,7 +740,7 @@ function populateParameters (result) {
osVersion,
hostTheme: theme,
hostVersion,
hostLanguage: language.split('_', '-'),
hostLanguage: language.replace('_', '-'),
hostName: _hostName,
hostSDKVersion: _SDKVersion,
hostFontSizeSetting: fontSizeSetting,
......@@ -778,6 +758,44 @@ function populateParameters (result) {
Object.assign(result, parameters);
}
function getGetDeviceType (result, model) {
let deviceType = result.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
) {
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (
isQuickApp
) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = _getDeviceBrand(deviceBrand);
}
return deviceBrand
}
var getSystemInfo = {
returnValue: function (result) {
useDeviceId(result);
......
......@@ -679,12 +679,13 @@ function addSafeAreaInsets (result) {
function populateParameters (result) {
const {
brand, model, system,
language, theme, version,
brand = '', model = '', system = '',
language = '', theme, version,
hostName, platform, fontSizeSetting,
SDKVersion, pixelRatio, deviceOrientation,
environment
} = result;
const isQuickApp = "mp-lark".indexOf('quickapp-webview') !== -1;
// osName osVersion
let osName = '';
......@@ -696,29 +697,10 @@ function populateParameters (result) {
let hostVersion = version;
// deviceType
let deviceType = result.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
}
}
}
const deviceType = getGetDeviceType(result, model);
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
{
deviceBrand = brand.toLocaleLowerCase();
}
const deviceBrand = getDeviceBrand(brand, model, isQuickApp);
// hostName
let _hostName = hostName || "mp-lark".split('-')[1]; // mp-jd
......@@ -752,7 +734,7 @@ function populateParameters (result) {
osVersion,
hostTheme: theme,
hostVersion,
hostLanguage: language.split('_', '-'),
hostLanguage: language.replace('_', '-'),
hostName: _hostName,
hostSDKVersion: _SDKVersion,
hostFontSizeSetting: fontSizeSetting,
......@@ -770,6 +752,39 @@ function populateParameters (result) {
Object.assign(result, parameters);
}
function getGetDeviceType (result, model) {
let deviceType = result.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
) {
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
{
deviceBrand = brand.toLocaleLowerCase();
}
return deviceBrand
}
var getSystemInfo = {
returnValue: function (result) {
useDeviceId(result);
......
......@@ -651,9 +651,10 @@ var previewImage = {
}
};
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';
......@@ -684,8 +685,8 @@ function addSafeAreaInsets (result) {
function populateParameters (result) {
const {
brand, model, system,
language, theme, version,
brand = '', model = '', system = '',
language = '', theme, version,
hostName, platform, fontSizeSetting,
SDKVersion, pixelRatio, deviceOrientation,
environment
......@@ -702,31 +703,10 @@ function populateParameters (result) {
let hostVersion = version;
// deviceType
let deviceType = result.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
}
}
}
const deviceType = getGetDeviceType(result, model);
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if ( isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = getDeviceBrand(deviceBrand);
}
const deviceBrand = getDeviceBrand(brand, model, isQuickApp);
// hostName
let _hostName = hostName || "mp-qq".split('-')[1]; // mp-jd
......@@ -760,7 +740,7 @@ function populateParameters (result) {
osVersion,
hostTheme: theme,
hostVersion,
hostLanguage: language.split('_', '-'),
hostLanguage: language.replace('_', '-'),
hostName: _hostName,
hostSDKVersion: _SDKVersion,
hostFontSizeSetting: fontSizeSetting,
......@@ -778,6 +758,44 @@ function populateParameters (result) {
Object.assign(result, parameters);
}
function getGetDeviceType (result, model) {
let deviceType = result.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
) {
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (
isQuickApp
) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = _getDeviceBrand(deviceBrand);
}
return deviceBrand
}
var getSystemInfo = {
returnValue: function (result) {
useDeviceId(result);
......
......@@ -679,12 +679,13 @@ function addSafeAreaInsets (result) {
function populateParameters (result) {
const {
brand, model, system,
language, theme, version,
brand = '', model = '', system = '',
language = '', theme, version,
hostName, platform, fontSizeSetting,
SDKVersion, pixelRatio, deviceOrientation,
environment
} = result;
const isQuickApp = "mp-toutiao".indexOf('quickapp-webview') !== -1;
// osName osVersion
let osName = '';
......@@ -696,29 +697,10 @@ function populateParameters (result) {
let hostVersion = version;
// deviceType
let deviceType = result.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
}
}
}
const deviceType = getGetDeviceType(result, model);
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
{
deviceBrand = brand.toLocaleLowerCase();
}
const deviceBrand = getDeviceBrand(brand, model, isQuickApp);
// hostName
let _hostName = hostName || "mp-toutiao".split('-')[1]; // mp-jd
......@@ -752,7 +734,7 @@ function populateParameters (result) {
osVersion,
hostTheme: theme,
hostVersion,
hostLanguage: language.split('_', '-'),
hostLanguage: language.replace('_', '-'),
hostName: _hostName,
hostSDKVersion: _SDKVersion,
hostFontSizeSetting: fontSizeSetting,
......@@ -770,6 +752,39 @@ function populateParameters (result) {
Object.assign(result, parameters);
}
function getGetDeviceType (result, model) {
let deviceType = result.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
) {
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
{
deviceBrand = brand.toLocaleLowerCase();
}
return deviceBrand
}
var getSystemInfo = {
returnValue: function (result) {
useDeviceId(result);
......
......@@ -546,9 +546,10 @@ var previewImage = {
}
};
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';
......@@ -579,8 +580,8 @@ function addSafeAreaInsets (result) {
function populateParameters (result) {
const {
brand, model, system,
language, theme, version,
brand = '', model = '', system = '',
language = '', theme, version,
hostName, platform, fontSizeSetting,
SDKVersion, pixelRatio, deviceOrientation,
environment
......@@ -597,38 +598,17 @@ function populateParameters (result) {
let hostVersion = version;
// deviceType
let deviceType = result.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
}
}
}
const deviceType = getGetDeviceType(result, model);
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if ( isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = getDeviceBrand(deviceBrand);
}
const deviceBrand = getDeviceBrand(brand, model, isQuickApp);
// hostName
let _hostName = hostName || "mp-weixin".split('-')[1]; // mp-jd
{
if (environment) {
_hostName = environment;
} else if (result.host) {
} else if (result.host && result.host.env) {
_hostName = result.host.env;
}
}
......@@ -661,7 +641,7 @@ function populateParameters (result) {
osVersion,
hostTheme: theme,
hostVersion,
hostLanguage: language.split('_', '-'),
hostLanguage: language.replace('_', '-'),
hostName: _hostName,
hostSDKVersion: _SDKVersion,
hostFontSizeSetting: fontSizeSetting,
......@@ -679,6 +659,44 @@ function populateParameters (result) {
Object.assign(result, parameters);
}
function getGetDeviceType (result, model) {
let deviceType = result.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
) {
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (
isQuickApp
) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = _getDeviceBrand(deviceBrand);
}
return deviceBrand
}
var getSystemInfo = {
returnValue: function (result) {
useDeviceId(result);
......@@ -695,6 +713,57 @@ var showActionSheet = {
}
};
var getAppBaseInfo = {
returnValue: function (result) {
const { version, language, SDKVersion, theme } = result;
let _hostName = "mp-weixin".split('-')[1]; // mp-jd
{
if (result.host && result.host.env) {
_hostName = result.host.env;
}
}
Object.assign(result, {
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
});
}
};
var getDeviceInfo = {
returnValue: function (result) {
const { brand, model } = result;
const deviceType = getGetDeviceType(result, model);
const deviceBrand = getDeviceBrand(brand, model);
useDeviceId(result);
Object.assign(result, {
deviceType,
deviceBrand,
deviceModel: model
});
}
};
var getWindowInfo = {
returnValue: function (result) {
addSafeAreaInsets(result);
Object.assign(result, {
windowTop: 0,
windowBottom: 0
});
}
};
// import navigateTo from 'uni-helpers/navigate-to'
const protocols = {
......@@ -703,7 +772,10 @@ const protocols = {
previewImage,
getSystemInfo,
getSystemInfoSync: getSystemInfo,
showActionSheet
showActionSheet,
getAppBaseInfo,
getDeviceInfo,
getWindowInfo
};
const todos = [
'vibrate',
......
......@@ -480,9 +480,10 @@ var baseApi = /*#__PURE__*/Object.freeze({
interceptors: interceptors
});
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';
......@@ -513,8 +514,8 @@ function addSafeAreaInsets (result) {
function populateParameters (result) {
const {
brand, model, system,
language, theme, version,
brand = '', model = '', system = '',
language = '', theme, version,
hostName, platform, fontSizeSetting,
SDKVersion, pixelRatio, deviceOrientation,
environment
......@@ -531,31 +532,10 @@ function populateParameters (result) {
let hostVersion = version;
// deviceType
let deviceType = result.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
}
}
}
const deviceType = getGetDeviceType(result, model);
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if ( isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = getDeviceBrand(deviceBrand);
}
const deviceBrand = getDeviceBrand(brand, model, isQuickApp);
// hostName
let _hostName = hostName || "mp-xhs".split('-')[1]; // mp-jd
......@@ -588,7 +568,7 @@ function populateParameters (result) {
osVersion,
hostTheme: theme,
hostVersion,
hostLanguage: language.split('_', '-'),
hostLanguage: language.replace('_', '-'),
hostName: _hostName,
hostSDKVersion: _SDKVersion,
hostFontSizeSetting: fontSizeSetting,
......@@ -606,6 +586,44 @@ function populateParameters (result) {
Object.assign(result, parameters);
}
function getGetDeviceType (result, model) {
let deviceType = result.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
) {
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (
isQuickApp
) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = _getDeviceBrand(deviceBrand);
}
return deviceBrand
}
var getSystemInfo = {
returnValue: function (result) {
useDeviceId(result);
......
......@@ -651,9 +651,10 @@ var previewImage = {
}
};
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';
......@@ -684,8 +685,8 @@ function addSafeAreaInsets (result) {
function populateParameters (result) {
const {
brand, model, system,
language, theme, version,
brand = '', model = '', system = '',
language = '', theme, version,
hostName, platform, fontSizeSetting,
SDKVersion, pixelRatio, deviceOrientation,
environment
......@@ -702,31 +703,10 @@ function populateParameters (result) {
let hostVersion = version;
// deviceType
let deviceType = result.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
}
}
}
const deviceType = getGetDeviceType(result, model);
// deviceModel
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if ( isQuickApp) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = getDeviceBrand(deviceBrand);
}
const deviceBrand = getDeviceBrand(brand, model, isQuickApp);
// hostName
let _hostName = hostName || "quickapp-webview".split('-')[1]; // mp-jd
......@@ -759,7 +739,7 @@ function populateParameters (result) {
osVersion,
hostTheme: theme,
hostVersion,
hostLanguage: language.split('_', '-'),
hostLanguage: language.replace('_', '-'),
hostName: _hostName,
hostSDKVersion: _SDKVersion,
hostFontSizeSetting: fontSizeSetting,
......@@ -777,6 +757,44 @@ function populateParameters (result) {
Object.assign(result, parameters);
}
function getGetDeviceType (result, model) {
let deviceType = result.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
) {
let deviceBrand = model.split(' ')[0].toLocaleLowerCase();
if (
isQuickApp
) {
deviceBrand = brand.toLocaleLowerCase();
} else {
deviceBrand = _getDeviceBrand(deviceBrand);
}
return deviceBrand
}
var getSystemInfo = {
returnValue: function (result) {
useDeviceId(result);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册