提交 a5f0a378 编写于 作者: fxy060608's avatar fxy060608

chore: build

上级 697894dc
import Log from "android.util.Log";
export default function log(tag: string, msg: string) {
Log.e(tag, msg);
}
......@@ -22,7 +22,7 @@ open class TestModule : UniModule() {
data["code"] = "success456";
return data;
}
override open fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {
if (requestCode == TestModule.REQUEST_CODE && data.hasExtra("respond")) {
log(this.TAG, "原生页面返回----" + data.getStringExtra("respond"));
}
......
{"version":3,"sources":["/Users/fxy/Documents/projects/GitHub/uni-app/uni-app-next/packages/playground/uts/nativeplugins/test-uniplugin/android/src/io/dcloud/uniplugin/TestModule.uts"],"names":["TestModule","UniModule","TAG","UniJSMethod","uiThread","testAsyncFunc","options","callback","log","data","JSONObject","invoke","testSyncFunc","onActivityResult","requestCode","resultCode","REQUEST_CODE","hasExtra","getStringExtra"],"mappings":"AAAA;AAAA,OAAmB,sBAAwB,CAAC;AAC5C,OAAuB,+BAAiC,CAAC;AACzD,OAAsB,yCAA2C,CAAC;AAClE,OAAwB,+CAAiD,CAAC;AAC1E,OAA0B,6CAA+C,CAAC;AAC1E,OAAgB,2BAAO,CAAC;AACT,WAAMA,UAAU,GAASC,SAAS,EAAE;IACjDC,SAAAA,GAAG,GAAG,YAAY,CAAC;IAGnB,CAACC,WAAW,CAAC,CAAEC,QAAQ,GAAE,IAAI,CAAE,CAAC;IAAA,SAChCC,aAAa,CAACC,OAAmB,EAAV,UAAU,EAAEC,QAAwB,EAAb,aAAa,CAAA,EAAE;QAC3DC,GAAG,CAAC,IAAI,CAACN,GAAG,EAAE,yBAAyB,CAAC,CAAC;QACzC,IAAIK,QAAQ,IAAI,IAAI,EAAE;YACpB,IAAME,IAAI,GAAG,AAAIC,UAAU,EAAE,AAAC;YAC9BD,IAAI,CAAC,MAAM,CAAC,GAAG,cAAc,CAAC;YAC9BF,QAAQ,CAACI,MAAM,CAACF,IAAI,CAAC,CAAC;;;IAI1B,CAACN,WAAW,CAAC,CAAEC,QAAQ,GAAE,KAAK,CAAE,CAAC;IAAA,SACjCQ,YAAY,CAACN,OAAmB,EAAV,UAAU,GAAG,UAAU,CAAC;QAC5C,IAAMG,IAAI,GAAG,AAAIC,UAAU,EAAE,AAAC;QAC9BD,IAAI,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC;QAC5B,OAAOA,IAAI,CAAC;;IAEd,kBAASI,gBAAgB,CAACC,WAAgB,EAAH,GAAG,EAAEC,UAAe,EAAH,GAAG,EAAEN,IAAY,EAAN,MAAM,EAAE;QACzE,IAAIK,WAAW,IAAId,UAAU,CAACgB,YAAY,IAAIP,IAAI,CAACQ,QAAQ,CAAC,SAAS,CAAC,EAAE;YACtET,GAAG,CAAC,IAAI,CAACN,GAAG,EAAE,wBAAY,GAAGO,IAAI,CAACS,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC;;QAC9D,MAAM;YACL,KAAK,CAACL,gBAAgB,CAACC,WAAW,EAAEC,UAAU,EAAEN,IAAI,CAAC,CAAC;;;;QAtB1D,IAAOO,YAAY,GAAG,IAAI,CAAC;;CAyB5B"}
\ No newline at end of file
{"version":3,"sources":["/Users/fxy/Documents/projects/GitHub/uni-app/uni-app-next/packages/playground/uts/nativeplugins/test-uniplugin/android/src/io/dcloud/uniplugin/TestModule.uts"],"names":["TestModule","UniModule","TAG","UniJSMethod","uiThread","testAsyncFunc","options","callback","log","data","JSONObject","invoke","testSyncFunc","onActivityResult","requestCode","resultCode","REQUEST_CODE","hasExtra","getStringExtra"],"mappings":"AAAA;AAAA,OAAmB,sBAAwB,CAAC;AAC5C,OAAuB,+BAAiC,CAAC;AACzD,OAAsB,yCAA2C,CAAC;AAClE,OAAwB,+CAAiD,CAAC;AAC1E,OAA0B,6CAA+C,CAAC;AAC1E,OAAgB,2BAAO,CAAC;AACT,WAAMA,UAAU,GAASC,SAAS,EAAE;IACjDC,SAAAA,GAAG,GAAG,YAAY,CAAC;IAGnB,CAACC,WAAW,CAAC,CAAEC,QAAQ,GAAE,IAAI,CAAE,CAAC;IAAA,SAChCC,aAAa,CAACC,OAAmB,EAAV,UAAU,EAAEC,QAAwB,EAAb,aAAa,CAAA,EAAE;QAC3DC,GAAG,CAAC,IAAI,CAACN,GAAG,EAAE,yBAAyB,CAAC,CAAC;QACzC,IAAIK,QAAQ,IAAI,IAAI,EAAE;YACpB,IAAME,IAAI,GAAG,AAAIC,UAAU,EAAE,AAAC;YAC9BD,IAAI,CAAC,MAAM,CAAC,GAAG,cAAc,CAAC;YAC9BF,QAAQ,CAACI,MAAM,CAACF,IAAI,CAAC,CAAC;;;IAI1B,CAACN,WAAW,CAAC,CAAEC,QAAQ,GAAE,KAAK,CAAE,CAAC;IAAA,SACjCQ,YAAY,CAACN,OAAmB,EAAV,UAAU,GAAG,UAAU,CAAC;QAC5C,IAAMG,IAAI,GAAG,AAAIC,UAAU,EAAE,AAAC;QAC9BD,IAAI,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC;QAC5B,OAAOA,IAAI,CAAC;;IAEd,aAASI,gBAAgB,CAACC,WAAgB,EAAH,GAAG,EAAEC,UAAe,EAAH,GAAG,EAAEN,IAAY,EAAN,MAAM,EAAE;QACzE,IAAIK,WAAW,IAAId,UAAU,CAACgB,YAAY,IAAIP,IAAI,CAACQ,QAAQ,CAAC,SAAS,CAAC,EAAE;YACtET,GAAG,CAAC,IAAI,CAACN,GAAG,EAAE,wBAAY,GAAGO,IAAI,CAACS,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC;;QAC9D,MAAM;YACL,KAAK,CAACL,gBAAgB,CAACC,WAAW,EAAEC,UAAU,EAAEN,IAAI,CAAC,CAAC;;;;QAtB1D,IAAOO,YAAY,GAAG,IAAI,CAAC;;CAyB5B"}
\ No newline at end of file
{"version":3,"sources":["/Users/fxy/Documents/projects/GitHub/uni-app/uni-app-next/packages/playground/uts/nativeplugins/test-uniplugin/android/src/io/dcloud/uniplugin/log.uts"],"names":["log","tag","msg","Log","e"],"mappings":";AAAA,OAAgB,gBAAkB,CAAC;AACpB,IAASA,GAAG,CAACC,GAAW,EAAN,MAAM,EAAEC,GAAW,EAAN,MAAM,EAAE;IACpDC,GAAG,CAACC,CAAC,CAACH,GAAG,EAAEC,GAAG,CAAC,CAAC"}
\ No newline at end of file
{"version":3,"sources":["/Users/fxy/Documents/projects/GitHub/uni-app/uni-app-next/packages/playground/uts/nativeplugins/test-uniplugin/android/src/io/dcloud/uniplugin/log.uts"],"names":["log","tag","msg","Log","e"],"mappings":"AAAA;AAAA,OAAgB,gBAAkB,CAAC;AACpB,IAASA,GAAG,CAACC,GAAW,EAAN,MAAM,EAAEC,GAAW,EAAN,MAAM,EAAE;IACpDC,GAAG,CAACC,CAAC,CAACH,GAAG,EAAEC,GAAG,CAAC,CAAC"}
\ No newline at end of file
package test;
import android.util.Log;
fun log(tag: String, msg: String) {
Log.e(tag, msg);
}
{"version":3,"sources":["/Users/fxy/Documents/projects/GitHub/uni-app/uni-app-next/packages/playground/uts/nativeplugins/test-uniplugin/android/src/test.uts"],"names":["log","tag","msg","Log","e"],"mappings":";AAAA,OAAgB,gBAAkB,CAAC;AACpB,IAASA,GAAG,CAACC,GAAW,EAAN,MAAM,EAAEC,GAAW,EAAN,MAAM,EAAE;IACpDC,GAAG,CAACC,CAAC,CAACH,GAAG,EAAEC,GAAG,CAAC,CAAC"}
\ No newline at end of file
......@@ -24,24 +24,9 @@ interface OnPushClickCallback {
let cid: string | undefined
let cidErrMsg: string | undefined
function normalizePushMessage(type: 'receive' | 'click', message: unknown) {
function normalizePushMessage(message: unknown) {
try {
const res = JSON.parse(message as string) as Record<string, any>
if (type === 'receive') {
if (res.payload) {
if (res.aps) {
res.payload.aps = res.aps
}
return res.payload
}
} else if (type === 'click') {
delete res.type
delete res.__UUID__
delete res.appid
if (res.aps && res.aps.alert) {
res.title = res.aps.alert.title
}
}
return JSON.parse(message as string) as Record<string, any>
} catch (e: any) {}
return message
}
......@@ -64,14 +49,14 @@ export function invokePushCallback(
onPushMessageCallbacks.forEach((callback) => {
callback({
type: 'receive',
data: normalizePushMessage('receive', args.message),
data: normalizePushMessage(args.message),
})
})
} else if (args.type === 'click') {
onPushMessageCallbacks.forEach((callback) => {
callback({
type: 'click',
data: normalizePushMessage('click', args.message),
data: normalizePushMessage(args.message),
})
})
}
......
......@@ -11057,25 +11057,9 @@ const getLaunchOptionsSync = defineSyncApi(API_GET_LAUNCH_OPTIONS_SYNC, () => {
let cid;
let cidErrMsg;
function normalizePushMessage(type, message) {
function normalizePushMessage(message) {
try {
const res = JSON.parse(message);
if (type === 'receive') {
if (res.payload) {
if (res.aps) {
res.payload.aps = res.aps;
}
return res.payload;
}
}
else if (type === 'click') {
delete res.type;
delete res.__UUID__;
delete res.appid;
if (res.aps && res.aps.alert) {
res.title = res.aps.alert.title;
}
}
return JSON.parse(message);
}
catch (e) { }
return message;
......@@ -11094,7 +11078,7 @@ function invokePushCallback(args) {
onPushMessageCallbacks.forEach((callback) => {
callback({
type: 'receive',
data: normalizePushMessage('receive', args.message),
data: normalizePushMessage(args.message),
});
});
}
......@@ -11102,7 +11086,7 @@ function invokePushCallback(args) {
onPushMessageCallbacks.forEach((callback) => {
callback({
type: 'click',
data: normalizePushMessage('click', args.message),
data: normalizePushMessage(args.message),
});
});
}
......@@ -13020,6 +13004,12 @@ const canIUse = defineSyncApi(API_CAN_I_USE, (schema) => {
return false;
}, CanIUseProtocol);
let deviceId;
function deviceId$1 () {
deviceId = deviceId || plus.device.uuid;
return deviceId;
}
const isIOS = plus.os.name === 'iOS';
let config;
/**
......@@ -13282,12 +13272,6 @@ function getStatusBarStyle() {
return style;
}
let deviceId;
function deviceId$1 () {
deviceId = deviceId || plus.device.uuid;
return deviceId;
}
function getScreenInfo() {
// 好像开发时刷新,偶发的 plus.screen.getCurrentSize 为 undefined
const { resolutionWidth, resolutionHeight } = plus.screen.getCurrentSize() || {
......@@ -13299,13 +13283,8 @@ function getScreenInfo() {
screenHeight: Math.round(resolutionHeight),
};
}
const getSystemInfoSync = defineSyncApi('getSystemInfoSync', () => {
const { getSystemInfoSync } = weex.requireModule('plus');
const info = getSystemInfoSync();
const { deviceBrand, deviceModel, osName, osVersion, osLanguage } = info;
const brand = deviceBrand.toLowerCase();
const _osName = osName.toLowerCase();
const ios = _osName === 'ios';
const getWindowInfo = defineSyncApi('getWindowInfo', () => {
const ios = plus.os.name.toLowerCase() === 'ios';
const { screenWidth, screenHeight } = getScreenInfo();
const statusBarHeight = getStatusbarHeight();
let safeAreaInsets;
......@@ -13365,22 +13344,13 @@ const getSystemInfoSync = defineSyncApi('getSystemInfoSync', () => {
width: windowWidth - safeAreaInsets.left - safeAreaInsets.right,
height: windowHeightReal - safeAreaInsets.top - safeAreaInsets.bottom,
};
return extend({
brand: brand,
model: deviceModel,
return {
pixelRatio: plus.screen.scale,
screenWidth,
screenHeight,
windowWidth,
windowHeight,
statusBarHeight,
language: osLanguage,
system: `${osName} ${osVersion}`,
version: plus.runtime.innerVersion,
platform: _osName,
SDKVersion: '',
windowTop,
windowBottom,
safeArea,
safeAreaInsets: {
top: safeAreaInsets.top,
......@@ -13388,11 +13358,87 @@ const getSystemInfoSync = defineSyncApi('getSystemInfoSync', () => {
bottom: safeAreaInsets.bottom,
left: safeAreaInsets.left,
},
deviceId: deviceId$1(),
}, info, {
windowTop,
windowBottom,
screenTop: screenHeight - windowHeight,
};
});
let systemInfo;
let _initSystemInfo = true;
function weexGetSystemInfoSync() {
if (!_initSystemInfo)
return;
const { getSystemInfoSync } = weex.requireModule('plus');
systemInfo = getSystemInfoSync();
}
const getDeviceInfo = defineSyncApi('getDeviceInfo', () => {
weexGetSystemInfoSync();
const { deviceBrand, deviceModel, osName, osVersion } = systemInfo;
const brand = deviceBrand.toLowerCase();
return {
deviceBrand: brand,
osName: _osName,
});
deviceModel,
brand,
model: deviceModel,
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;
return {
SDKVersion: '',
hostSDKVersion: '',
enableDebug: false,
appId,
appName,
appVersion,
appVersionCode,
appLanguage: uni.getLocale(),
version: plus.runtime.innerVersion,
language: osLanguage,
theme: '',
hostPackageName,
hostName,
hostVersion,
hostLanguage,
hostTheme,
hostFontSizeSetting: undefined,
};
});
const getSystemInfoSync = defineSyncApi('getSystemInfoSync', () => {
_initSystemInfo = true;
weexGetSystemInfoSync();
_initSystemInfo = false;
const windowInfo = getWindowInfo();
const deviceInfo = getDeviceInfo();
const appBaseInfo = getAppBaseInfo();
_initSystemInfo = true;
const { osName, osLanguage, osVersion } = systemInfo;
const { pixelRatio } = windowInfo;
const osLanguageSplit = osLanguage.split('-');
const osLanguageSplitLast = osLanguageSplit[osLanguageSplit.length - 1];
let _osLanguage = `${osLanguageSplit[0]}${osLanguageSplitLast ? '-' + osLanguageSplitLast : ''}`;
let extraData = {
errMsg: 'getSystemInfo:ok',
fontSizeSetting: appBaseInfo.hostFontSizeSetting,
devicePixelRatio: pixelRatio,
deviceId: deviceId$1(),
uniCompileVersion: __uniConfig.compilerVersion,
uniRuntimeVersion: __uniConfig.compilerVersion,
osLanguage: _osLanguage,
};
if (osName === 'ios') {
extraData.romName = osName;
extraData.romVersion = osVersion;
}
const _systemInfo = extend(windowInfo, systemInfo, deviceInfo, appBaseInfo, extraData);
delete _systemInfo.screenTop;
delete _systemInfo.enableDebug;
delete _systemInfo.theme;
return _systemInfo;
});
const getSystemInfo = defineAsyncApi('getSystemInfo', (_, { resolve }) => {
return resolve(getSystemInfoSync());
......@@ -19039,6 +19085,8 @@ var uni$1 = {
removeSavedFile: removeSavedFile,
openDocument: openDocument,
canIUse: canIUse,
getDeviceInfo: getDeviceInfo,
getAppBaseInfo: getAppBaseInfo,
getSystemInfoSync: getSystemInfoSync,
getSystemInfo: getSystemInfo,
onCompassChange: onCompassChange,
......@@ -19091,6 +19139,7 @@ var uni$1 = {
getScreenBrightness: getScreenBrightness,
setScreenBrightness: setScreenBrightness,
setKeepScreenOn: setKeepScreenOn,
getWindowInfo: getWindowInfo,
getImageInfo: getImageInfo,
getVideoInfo: getVideoInfo,
previewImage: previewImage,
......
......@@ -17,5 +17,8 @@
"bugs": {
"url": "https://github.com/dcloudio/uni-app/issues"
},
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da"
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
"dependencies": {
"@dcloudio/uni-shared": "3.0.0-alpha-3041020220516004"
}
}
......@@ -905,6 +905,13 @@ function getRealPath(filePath) {
}
return filePath;
}
const ua = navigator.userAgent;
const isAndroid = /* @__PURE__ */ /android/i.test(ua);
const isIOS = /* @__PURE__ */ /iphone|ipad|ipod/i.test(ua);
const isWindows = /* @__PURE__ */ ua.match(/Windows NT ([\d|\d.\d]*)/i);
const isMac = /* @__PURE__ */ /Macintosh|Mac/i.test(ua);
const isLinux = /* @__PURE__ */ /Linux|X11/i.test(ua);
const isIPadOS = isMac && navigator.maxTouchPoints > 0;
const HTTP_METHODS = [
"GET",
"OPTIONS",
......@@ -10021,6 +10028,234 @@ const getStorageInfoSync = /* @__PURE__ */ defineSyncApi("getStorageInfoSync", (
const getStorageInfo = /* @__PURE__ */ defineAsyncApi("getStorageInfo", (_, { resolve }) => {
resolve(getStorageInfoSync());
});
function IEVersion() {
const userAgent = navigator.userAgent;
const isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1;
const isEdge = userAgent.indexOf("Edge") > -1 && !isIE;
const isIE11 = userAgent.indexOf("Trident") > -1 && userAgent.indexOf("rv:11.0") > -1;
if (isIE) {
const reIE = new RegExp("MSIE (\\d+\\.\\d+);");
reIE.test(userAgent);
const fIEVersion = parseFloat(RegExp.$1);
if (fIEVersion > 6) {
return fIEVersion;
} else {
return 6;
}
} else if (isEdge) {
return -1;
} else if (isIE11) {
return 11;
} else {
return -1;
}
}
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";
}
}
function getBrowserInfo() {
let osname;
let osversion = "0";
let model = "";
let deviceType = "phone";
const language = navigator.language;
if (isIOS) {
osname = "iOS";
const osversionFind = ua.match(/OS\s([\w_]+)\slike/);
if (osversionFind) {
osversion = osversionFind[1].replace(/_/g, ".");
}
const modelFind = ua.match(/\(([a-zA-Z]+);/);
if (modelFind) {
model = modelFind[1];
}
} else if (isAndroid) {
osname = "Android";
const osversionFind = ua.match(/Android[\s/]([\w\.]+)[;\s]/);
if (osversionFind) {
osversion = osversionFind[1];
}
const infoFind = ua.match(/\((.+?)\)/);
const infos = infoFind ? infoFind[1].split(";") : ua.split(" ");
const otherInfo = [
/\bAndroid\b/i,
/\bLinux\b/i,
/\bU\b/i,
/^\s?[a-z][a-z]$/i,
/^\s?[a-z][a-z]-[a-z][a-z]$/i,
/\bwv\b/i,
/\/[\d\.,]+$/,
/^\s?[\d\.,]+$/,
/\bBrowser\b/i,
/\bMobile\b/i
];
for (let i = 0; i < infos.length; i++) {
const info = infos[i];
if (info.indexOf("Build") > 0) {
model = info.split("Build")[0].trim();
break;
}
let other;
for (let o = 0; o < otherInfo.length; o++) {
if (otherInfo[o].test(info)) {
other = true;
break;
}
}
if (!other) {
model = info.trim();
break;
}
}
} else if (isIPadOS) {
model = "iPad";
osname = "iOS";
deviceType = "pad";
osversion = typeof window.BigInt === "function" ? "14.0" : "13.0";
} else if (isWindows || isMac || isLinux) {
model = "PC";
osname = "PC";
deviceType = "pc";
osversion = "0";
let osversionFind = ua.match(/\((.+?)\)/)[1];
if (isWindows) {
osname = "Windows";
switch (isWindows[1]) {
case "5.1":
osversion = "XP";
break;
case "6.0":
osversion = "Vista";
break;
case "6.1":
osversion = "7";
break;
case "6.2":
osversion = "8";
break;
case "6.3":
osversion = "8.1";
break;
case "10.0":
osversion = "10";
break;
}
const framework = osversionFind && osversionFind.match(/[Win|WOW]([\d]+)/);
if (framework) {
osversion += ` x${framework[1]}`;
}
} else if (isMac) {
osname = "Mac";
const _osversion = osversionFind && osversionFind.match(/Mac OS X (.+)/) || "";
if (osversion) {
osversion = _osversion[1].replace(/_/g, ".");
if (osversion.indexOf(";") !== -1) {
osversion = osversion.split(";")[0];
}
}
} else if (isLinux) {
osname = "Linux";
const _osversion = osversionFind && osversionFind.match(/Linux (.*)/) || "";
if (_osversion) {
osversion = _osversion[1];
if (osversion.indexOf(";") !== -1) {
osversion = osversion.split(";")[0];
}
}
}
} else {
osname = "Other";
osversion = "0";
deviceType = "other";
}
const system = `${osname} ${osversion}`;
const platform = osname.toLocaleLowerCase();
let browserName = "";
let browseVersion = String(IEVersion());
if (browseVersion !== "-1") {
browserName = "IE";
} else {
const browseVendors = ["Version", "Firefox", "Chrome", "Edge{0,1}"];
const vendors = ["Safari", "Firefox", "Chrome", "Edge"];
for (let index2 = 0; index2 < browseVendors.length; index2++) {
const vendor = browseVendors[index2];
const reg = new RegExp(`(${vendor})/(\\S*)\\b`);
if (reg.test(ua)) {
browserName = vendors[index2];
browseVersion = ua.match(reg)[2];
}
}
}
let deviceBrand = "";
if (model) {
const _model = model.toLocaleLowerCase();
deviceBrand = getDeviceBrand(_model) || getDeviceBrand(osname.toLocaleLowerCase()) || _model.split(" ")[0];
}
let deviceOrientation = "portrait";
const orientation = typeof window.screen.orientation === "undefined" ? window.orientation : window.screen.orientation.angle;
deviceOrientation = Math.abs(orientation) === 90 ? "landscape" : "portrait";
return {
deviceBrand,
deviceModel: model,
deviceOrientation,
brand: deviceBrand,
model,
system,
platform,
browserName: browserName.toLocaleLowerCase(),
browseVersion,
language,
deviceType,
ua,
osname,
osversion,
theme: ""
};
}
let browserInfo;
function initBrowserInfo() {
browserInfo = getBrowserInfo();
}
const getDeviceInfo = /* @__PURE__ */ defineSyncApi("getDeviceInfo", () => {
initBrowserInfo();
const { deviceBrand, deviceModel, brand, model, platform, system } = browserInfo;
return {
deviceBrand,
deviceModel,
brand,
model,
system,
platform
};
});
const getAppBaseInfo = /* @__PURE__ */ defineSyncApi("getAppBaseInfo", () => {
initBrowserInfo();
const { theme, browserName, browseVersion, language } = browserInfo;
return {
SDKVersion: "",
hostSDKVersion: "",
enableDebug: false,
hostPackageName: "",
hostFontSizeSetting: void 0,
language,
hostName: browserName,
hostVersion: browseVersion,
hostTheme: theme,
hostLanguage: language,
theme,
appId: __uniConfig.appId,
appName: __uniConfig.appName,
appVersion: __uniConfig.appVersion,
appVersionCode: __uniConfig.appVersionCode,
appLanguage: uni.getLocale(),
version: __uniConfig.appVersion
};
});
const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", () => {
{
return {
......@@ -10096,6 +10331,8 @@ var api = /* @__PURE__ */ Object.defineProperty({
clearStorage,
getStorageInfoSync,
getStorageInfo,
getDeviceInfo,
getAppBaseInfo,
getSystemInfoSync
}, Symbol.toStringTag, { value: "Module" });
const uni$1 = api;
......@@ -11212,7 +11449,9 @@ exports.WebView = index$d;
exports.clearStorage = clearStorage;
exports.clearStorageSync = clearStorageSync;
exports.getApp = getApp$1;
exports.getAppBaseInfo = getAppBaseInfo;
exports.getCurrentPages = getCurrentPages$1;
exports.getDeviceInfo = getDeviceInfo;
exports.getRealPath = getRealPath;
exports.getStorage = getStorage;
exports.getStorageInfo = getStorageInfo;
......
......@@ -4564,24 +4564,9 @@ const getLaunchOptionsSync = /* @__PURE__ */ defineSyncApi(API_GET_LAUNCH_OPTION
});
let cid;
let cidErrMsg;
function normalizePushMessage(type, message) {
function normalizePushMessage(message) {
try {
const res = JSON.parse(message);
if (type === "receive") {
if (res.payload) {
if (res.aps) {
res.payload.aps = res.aps;
}
return res.payload;
}
} else if (type === "click") {
delete res.type;
delete res.__UUID__;
delete res.appid;
if (res.aps && res.aps.alert) {
res.title = res.aps.alert.title;
}
}
return JSON.parse(message);
} catch (e2) {
}
return message;
......@@ -4595,14 +4580,14 @@ function invokePushCallback(args) {
onPushMessageCallbacks.forEach((callback) => {
callback({
type: "receive",
data: normalizePushMessage("receive", args.message)
data: normalizePushMessage(args.message)
});
});
} else if (args.type === "click") {
onPushMessageCallbacks.forEach((callback) => {
callback({
type: "click",
data: normalizePushMessage("click", args.message)
data: normalizePushMessage(args.message)
});
});
}
......@@ -16340,20 +16325,12 @@ function getDeviceBrand(model) {
return "microsoft";
}
}
const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", () => {
const pixelRatio2 = window.devicePixelRatio;
const screenFix = getScreenFix();
const landscape = isLandscape(screenFix);
const screenWidth = getScreenWidth(screenFix, landscape);
const screenHeight = getScreenHeight(screenFix, landscape);
const windowWidth = getWindowWidth(screenWidth);
let windowHeight = window.innerHeight;
const language = navigator.language;
const statusBarHeight = out.top;
function getBrowserInfo() {
let osname;
let osversion;
let osversion = "0";
let model = "";
let deviceType = "phone";
const language = navigator.language;
if (isIOS$1) {
osname = "iOS";
const osversionFind = ua.match(/OS\s([\w_]+)\slike/);
......@@ -16441,18 +16418,18 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
}
} else if (isMac) {
osname = "Mac";
osversion = osversionFind && osversionFind.match(/Mac OS X (.+)/) || "";
const _osversion = osversionFind && osversionFind.match(/Mac OS X (.+)/) || "";
if (osversion) {
osversion = osversion[1].replace(/_/g, ".");
osversion = _osversion[1].replace(/_/g, ".");
if (osversion.indexOf(";") !== -1) {
osversion = osversion.split(";")[0];
}
}
} else if (isLinux) {
osname = "Linux";
osversion = osversionFind && osversionFind.match(/Linux (.*)/) || "";
if (osversion) {
osversion = osversion[1];
const _osversion = osversionFind && osversionFind.match(/Linux (.*)/) || "";
if (_osversion) {
osversion = _osversion[1];
if (osversion.indexOf(";") !== -1) {
osversion = osversion.split(";")[0];
}
......@@ -16465,17 +16442,6 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
}
const system = `${osname} ${osversion}`;
const platform = osname.toLocaleLowerCase();
const safeArea = {
left: out.left,
right: windowWidth - out.right,
top: out.top,
bottom: windowHeight - out.bottom,
width: windowWidth - out.left - out.right,
height: windowHeight - out.top - out.bottom
};
const { top: windowTop, bottom: windowBottom } = getWindowOffset();
windowHeight -= windowTop;
windowHeight -= windowBottom;
let browserName = "";
let browseVersion = String(IEVersion());
if (browseVersion !== "-1") {
......@@ -16497,6 +16463,47 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
const _model = model.toLocaleLowerCase();
deviceBrand = getDeviceBrand(_model) || getDeviceBrand(osname.toLocaleLowerCase()) || _model.split(" ")[0];
}
let deviceOrientation = "portrait";
const orientation = typeof window.screen.orientation === "undefined" ? window.orientation : window.screen.orientation.angle;
deviceOrientation = Math.abs(orientation) === 90 ? "landscape" : "portrait";
return {
deviceBrand,
deviceModel: model,
deviceOrientation,
brand: deviceBrand,
model,
system,
platform,
browserName: browserName.toLocaleLowerCase(),
browseVersion,
language,
deviceType,
ua,
osname,
osversion,
theme: ""
};
}
const getWindowInfo = /* @__PURE__ */ defineSyncApi("getWindowInfo", () => {
const pixelRatio2 = window.devicePixelRatio;
const screenFix = getScreenFix();
const landscape = isLandscape(screenFix);
const screenWidth = getScreenWidth(screenFix, landscape);
const screenHeight = getScreenHeight(screenFix, landscape);
const windowWidth = getWindowWidth(screenWidth);
let windowHeight = window.innerHeight;
const statusBarHeight = out.top;
const safeArea = {
left: out.left,
right: windowWidth - out.right,
top: out.top,
bottom: windowHeight - out.bottom,
width: windowWidth - out.left - out.right,
height: windowHeight - out.top - out.bottom
};
const { top: windowTop, bottom: windowBottom } = getWindowOffset();
windowHeight -= windowTop;
windowHeight -= windowBottom;
return {
windowTop,
windowBottom,
......@@ -16505,13 +16512,7 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
pixelRatio: pixelRatio2,
screenWidth,
screenHeight,
language,
statusBarHeight,
system,
platform,
deviceBrand,
deviceType,
model,
safeArea,
safeAreaInsets: {
top: out.top,
......@@ -16519,30 +16520,91 @@ const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", ()
bottom: out.bottom,
left: out.left
},
version: __uniConfig.appVersion,
screenTop: screenHeight - windowHeight
};
});
let browserInfo;
let _initBrowserInfo = true;
function initBrowserInfo() {
if (!_initBrowserInfo)
return;
browserInfo = getBrowserInfo();
}
const getDeviceInfo = /* @__PURE__ */ defineSyncApi("getDeviceInfo", () => {
initBrowserInfo();
const { deviceBrand, deviceModel, brand, model, platform, system } = browserInfo;
return {
deviceBrand,
deviceModel,
brand,
model,
system,
platform
};
});
const getAppBaseInfo = /* @__PURE__ */ defineSyncApi("getAppBaseInfo", () => {
initBrowserInfo();
const { theme, browserName, browseVersion, language } = browserInfo;
return {
SDKVersion: "",
deviceId: deviceId$1(),
ua,
uniPlatform: "web",
browserName,
browseVersion,
osLanguage: language,
osName: osname.toLocaleLowerCase(),
osVersion: osversion,
hostSDKVersion: "",
enableDebug: false,
hostPackageName: "",
hostFontSizeSetting: void 0,
language,
hostName: browserName,
hostVersion: browseVersion,
hostTheme: theme,
hostLanguage: language,
uniCompileVersion: __uniConfig.compilerVersion,
uniRuntimeVersion: __uniConfig.compilerVersion,
theme,
appId: __uniConfig.appId,
appName: __uniConfig.appName,
appVersion: __uniConfig.appVersion,
appVersionCode: __uniConfig.appVersionCode,
hostName: browserName,
hostVersion: browseVersion,
osTheme: "",
hostTheme: "",
hostPackageName: ""
appLanguage: uni.getLocale(),
version: __uniConfig.appVersion
};
});
const getSystemInfoSync = /* @__PURE__ */ defineSyncApi("getSystemInfoSync", () => {
_initBrowserInfo = true;
initBrowserInfo();
_initBrowserInfo = false;
const windowInfo = getWindowInfo();
const deviceInfo = getDeviceInfo();
const appBaseInfo = getAppBaseInfo();
_initBrowserInfo = true;
const {
ua: ua2,
deviceType,
browserName,
browseVersion,
osname,
osversion,
deviceOrientation
} = browserInfo;
const { pixelRatio: pixelRatio2 } = windowInfo;
const systemInfo = extend(windowInfo, deviceInfo, appBaseInfo, {
ua: ua2,
deviceType,
browserName,
browseVersion,
deviceId: deviceId$1(),
devicePixelRatio: pixelRatio2,
deviceOrientation,
uniPlatform: "web",
uniCompileVersion: __uniConfig.compilerVersion,
uniRuntimeVersion: __uniConfig.compilerVersion,
fontSizeSetting: appBaseInfo.hostFontSizeSetting,
osName: osname.toLocaleLowerCase(),
osVersion: osversion,
osLanguage: void 0,
osTheme: void 0
});
delete systemInfo.screenTop;
delete systemInfo.enableDebug;
delete systemInfo.theme;
return systemInfo;
});
const getSystemInfo = /* @__PURE__ */ defineAsyncApi("getSystemInfo", (_args, { resolve }) => {
return resolve(getSystemInfoSync());
});
......@@ -20242,6 +20304,8 @@ var api = /* @__PURE__ */ Object.defineProperty({
createInnerAudioContext,
makePhoneCall,
getSystemInfo,
getDeviceInfo,
getAppBaseInfo,
getSystemInfoSync,
onNetworkStatusChange,
offNetworkStatusChange,
......@@ -20258,6 +20322,7 @@ var api = /* @__PURE__ */ Object.defineProperty({
vibrateLong,
getClipboardData,
setClipboardData,
getWindowInfo,
setStorageSync,
setStorage,
getStorageSync,
......@@ -22463,4 +22528,4 @@ var index = /* @__PURE__ */ defineSystemComponent({
return openBlock(), createBlock("div", clazz, [loadingVNode]);
}
});
export { $emit, $off, $on, $once, index$8 as Ad, index$7 as AdContentPage, index$6 as AdDraw, index$1 as AsyncErrorComponent, index as AsyncLoadingComponent, index$y as Button, index$5 as Camera, index$w as Canvas, index$u as Checkbox, index$v as CheckboxGroup, index$a as CoverImage, index$b as CoverView, index$t as Editor, index$A as Form, index$s as Icon, index$r as Image, Input, index$z as Label, LayoutComponent, index$4 as LivePlayer, index$3 as LivePusher, Map$1 as Map, MovableArea, MovableView, index$q as Navigator, index$2 as PageComponent, index$9 as Picker, PickerView, PickerViewColumn, index$p as Progress, index$n as Radio, index$o as RadioGroup, ResizeSensor, index$m as RichText, ScrollView, index$l as Slider, Swiper, SwiperItem, index$k as Switch, index$j as Text, index$i as Textarea, UniServiceJSBridge$1 as UniServiceJSBridge, UniViewJSBridge$1 as UniViewJSBridge, index$e as Video, index$h as View, index$d as WebView, addInterceptor, addPhoneContact, arrayBufferToBase64, base64ToArrayBuffer, canIUse, canvasGetImageData, canvasPutImageData, canvasToTempFilePath, chooseFile, chooseImage, chooseLocation, chooseVideo, clearStorage, clearStorageSync, closePreviewImage, closeSocket, connectSocket, createAnimation$1 as createAnimation, createCameraContext, createCanvasContext, createInnerAudioContext, createIntersectionObserver, createLivePlayerContext, createMapContext, createMediaQueryObserver, createSelectorQuery, createVideoContext, cssBackdropFilter, cssConstant, cssEnv, cssVar, downloadFile, getApp$1 as getApp, getClipboardData, getCurrentPages$1 as getCurrentPages, getEnterOptionsSync, getFileInfo, getImageInfo, getLaunchOptionsSync, getLeftWindowStyle, getLocale, getLocation, getNetworkType, getProvider, getPushCid, getRealPath, getRecorderManager, getRightWindowStyle, getSavedFileInfo, getSavedFileList, getScreenBrightness, getSelectedTextRange$1 as getSelectedTextRange, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, getSystemInfo, getSystemInfoSync, getTopWindowStyle, getVideoInfo, hideKeyboard, hideLeftWindow, hideLoading, hideNavigationBarLoading, hideRightWindow, hideTabBar, hideTabBarRedDot, hideToast, hideTopWindow, interceptors, invokePushCallback, loadFontFace, login, makePhoneCall, navigateBack, navigateTo, offAccelerometerChange, offAppHide, offAppShow, offCompassChange, offError, offNetworkStatusChange, offPageNotFound, offPushMessage, offUnhandledRejection, offWindowResize, onAccelerometerChange, onAppHide, onAppShow, onCompassChange, onError, onGyroscopeChange, onLocaleChange, onMemoryWarning, onNetworkStatusChange, onPageNotFound, onPushMessage, onSocketClose, onSocketError, onSocketMessage, onSocketOpen, onTabBarMidButtonTap, onUnhandledRejection, onUserCaptureScreen, onWindowResize, openDocument, openLocation, pageScrollTo, index$f as plugin, preloadPage, previewImage, reLaunch, redirectTo, removeInterceptor, removeSavedFileInfo, removeStorage, removeStorageSync, removeTabBarBadge, request, saveFile, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, sendSocketMessage, setClipboardData, setKeepScreenOn, setLeftWindowStyle, setLocale, setNavigationBarColor, setNavigationBarTitle, setPageMeta, setRightWindowStyle, setScreenBrightness, setStorage, setStorageSync, setTabBarBadge, setTabBarItem, setTabBarStyle, setTopWindowStyle, setupApp, setupPage, setupWindow, showActionSheet, showLeftWindow, showLoading, showModal, showNavigationBarLoading, showRightWindow, showTabBar, showTabBarRedDot, showToast, showTopWindow, startAccelerometer, startCompass, startGyroscope, startPullDownRefresh, stopAccelerometer, stopCompass, stopGyroscope, stopPullDownRefresh, switchTab, uni$1 as uni, uploadFile, upx2px, useI18n, useTabBar, vibrateLong, vibrateShort };
export { $emit, $off, $on, $once, index$8 as Ad, index$7 as AdContentPage, index$6 as AdDraw, index$1 as AsyncErrorComponent, index as AsyncLoadingComponent, index$y as Button, index$5 as Camera, index$w as Canvas, index$u as Checkbox, index$v as CheckboxGroup, index$a as CoverImage, index$b as CoverView, index$t as Editor, index$A as Form, index$s as Icon, index$r as Image, Input, index$z as Label, LayoutComponent, index$4 as LivePlayer, index$3 as LivePusher, Map$1 as Map, MovableArea, MovableView, index$q as Navigator, index$2 as PageComponent, index$9 as Picker, PickerView, PickerViewColumn, index$p as Progress, index$n as Radio, index$o as RadioGroup, ResizeSensor, index$m as RichText, ScrollView, index$l as Slider, Swiper, SwiperItem, index$k as Switch, index$j as Text, index$i as Textarea, UniServiceJSBridge$1 as UniServiceJSBridge, UniViewJSBridge$1 as UniViewJSBridge, index$e as Video, index$h as View, index$d as WebView, addInterceptor, addPhoneContact, arrayBufferToBase64, base64ToArrayBuffer, canIUse, canvasGetImageData, canvasPutImageData, canvasToTempFilePath, chooseFile, chooseImage, chooseLocation, chooseVideo, clearStorage, clearStorageSync, closePreviewImage, closeSocket, connectSocket, createAnimation$1 as createAnimation, createCameraContext, createCanvasContext, createInnerAudioContext, createIntersectionObserver, createLivePlayerContext, createMapContext, createMediaQueryObserver, createSelectorQuery, createVideoContext, cssBackdropFilter, cssConstant, cssEnv, cssVar, downloadFile, getApp$1 as getApp, getAppBaseInfo, getClipboardData, getCurrentPages$1 as getCurrentPages, getDeviceInfo, getEnterOptionsSync, getFileInfo, getImageInfo, getLaunchOptionsSync, getLeftWindowStyle, getLocale, getLocation, getNetworkType, getProvider, getPushCid, getRealPath, getRecorderManager, getRightWindowStyle, getSavedFileInfo, getSavedFileList, getScreenBrightness, getSelectedTextRange$1 as getSelectedTextRange, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, getSystemInfo, getSystemInfoSync, getTopWindowStyle, getVideoInfo, getWindowInfo, hideKeyboard, hideLeftWindow, hideLoading, hideNavigationBarLoading, hideRightWindow, hideTabBar, hideTabBarRedDot, hideToast, hideTopWindow, interceptors, invokePushCallback, loadFontFace, login, makePhoneCall, navigateBack, navigateTo, offAccelerometerChange, offAppHide, offAppShow, offCompassChange, offError, offNetworkStatusChange, offPageNotFound, offPushMessage, offUnhandledRejection, offWindowResize, onAccelerometerChange, onAppHide, onAppShow, onCompassChange, onError, onGyroscopeChange, onLocaleChange, onMemoryWarning, onNetworkStatusChange, onPageNotFound, onPushMessage, onSocketClose, onSocketError, onSocketMessage, onSocketOpen, onTabBarMidButtonTap, onUnhandledRejection, onUserCaptureScreen, onWindowResize, openDocument, openLocation, pageScrollTo, index$f as plugin, preloadPage, previewImage, reLaunch, redirectTo, removeInterceptor, removeSavedFileInfo, removeStorage, removeStorageSync, removeTabBarBadge, request, saveFile, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, sendSocketMessage, setClipboardData, setKeepScreenOn, setLeftWindowStyle, setLocale, setNavigationBarColor, setNavigationBarTitle, setPageMeta, setRightWindowStyle, setScreenBrightness, setStorage, setStorageSync, setTabBarBadge, setTabBarItem, setTabBarStyle, setTopWindowStyle, setupApp, setupPage, setupWindow, showActionSheet, showLeftWindow, showLoading, showModal, showNavigationBarLoading, showRightWindow, showTabBar, showTabBarRedDot, showToast, showTopWindow, startAccelerometer, startCompass, startGyroscope, startPullDownRefresh, stopAccelerometer, stopCompass, stopGyroscope, stopPullDownRefresh, switchTab, uni$1 as uni, uploadFile, upx2px, useI18n, useTabBar, vibrateLong, vibrateShort };
......@@ -540,25 +540,9 @@ const $emit = defineSyncApi(API_EMIT, (name, ...args) => {
let cid;
let cidErrMsg;
function normalizePushMessage(type, message) {
function normalizePushMessage(message) {
try {
const res = JSON.parse(message);
if (type === 'receive') {
if (res.payload) {
if (res.aps) {
res.payload.aps = res.aps;
}
return res.payload;
}
}
else if (type === 'click') {
delete res.type;
delete res.__UUID__;
delete res.appid;
if (res.aps && res.aps.alert) {
res.title = res.aps.alert.title;
}
}
return JSON.parse(message);
}
catch (e) { }
return message;
......@@ -577,7 +561,7 @@ function invokePushCallback(args) {
onPushMessageCallbacks.forEach((callback) => {
callback({
type: 'receive',
data: normalizePushMessage('receive', args.message),
data: normalizePushMessage(args.message),
});
});
}
......@@ -585,7 +569,7 @@ function invokePushCallback(args) {
onPushMessageCallbacks.forEach((callback) => {
callback({
type: 'click',
data: normalizePushMessage('click', args.message),
data: normalizePushMessage(args.message),
});
});
}
......@@ -911,7 +895,7 @@ function addSafeAreaInsets(fromRes, toRes) {
}
}
function populateParameters(fromRes, toRes) {
const { brand, model, system, language, theme, version, hostName = '', platform, } = 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 = '';
......@@ -948,8 +932,17 @@ function populateParameters(fromRes, toRes) {
deviceBrand = getDeviceBrand(deviceBrand);
}
// hostName
let _hostName = hostName; // mp-jd
let _hostName = hostName || "mp-alipay".split('-')[1]; // mp-jd
_hostName = fromRes.app;
// deviceOrientation
let _deviceOrientation = deviceOrientation; // 仅 微信 百度 支持
// devicePixelRatio
let _devicePixelRatio = pixelRatio;
// SDKVersion
let _SDKVersion = SDKVersion;
{
_SDKVersion = my.SDKVersion;
}
// wx.getAccountInfoSync
const parameters = {
appId: process.env.UNI_APP_ID,
......@@ -962,19 +955,25 @@ function populateParameters(fromRes, toRes) {
deviceBrand,
deviceModel: model,
deviceType,
devicePixelRatio: _devicePixelRatio,
deviceOrientation: _deviceOrientation,
osName: osName.toLocaleLowerCase(),
osVersion,
osLanguage: language,
osTheme: theme,
hostTheme: theme,
hostVersion,
hostLanguage: language,
hostLanguage: language.split('_', '-'),
hostName: _hostName,
hostSDKVersion: _SDKVersion,
hostFontSizeSetting: fontSizeSetting,
windowTop: 0,
windowBottom: 0,
// TODO
ua: '',
hostPackageName: '',
browserName: '',
browseVersion: '',
osLanguage: undefined,
osTheme: undefined,
ua: undefined,
hostPackageName: undefined,
browserName: undefined,
browseVersion: undefined,
};
extend(toRes, parameters);
}
......
Promise.resolve().then(() => {
plus.push.setAutoNotification && plus.push.setAutoNotification(false);
const info = plus.push.getClientInfo();
if (info.clientid) {
// @ts-expect-error
......
Promise.resolve().then(() => {
plus.push.setAutoNotification && plus.push.setAutoNotification(false)
const info = plus.push.getClientInfo()
if (info.clientid) {
// @ts-expect-error
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册