Authored by ccbikai(👎🏻🍜)

Merge branch 'feature/openapp' into gray

... ... @@ -17,21 +17,28 @@ const getAppPath = () => {
const u = navigator.userAgent;
const isFromYOHO = /m\.yohobuy\.com/i.test(document.referrer);
const isiOS = /(iPhone|iPad|iPod|iOS)/i.test(u); // ios终端
const isAndroid = /Android/i.test(u); // android终端
const iOSVersion = parseInt(u.match(/OS (\d+)_(\d+)_?(\d+)?/i)[1], 10);
// const isAndroid = /Android/i.test(u); // android终端
// const iOSVersion = parseInt(u.match(/OS (\d+)_(\d+)_?(\d+)?/i)[1], 10);
/*
2.13 日要求,暂时不管通用链接,所有情况都尝试唤起 App
isAndroid || iOSVersion < 9 将来配合 通用链接使用
*/
if (!isFromYOHO) {
if (!isFromYOHO && (isAndroid || iOSVersion < 9 || qs.openapp)) {
let appPath = getAppPath();
let ifr;
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_H5_AWAKE_APP',
param: JSON.stringify({
PAGE_NAME: encodeURIComponent(document.title),
PAGE_URL: encodeURIComponent(location.href)
})
}, true);
}
if (window._hmt && window._hmt.push) {
window._hmt.push(['_trackEvent', 'H5唤起APP', isiOS ? 'Apple' : 'Android', document.title, location.href]);
}
if (isiOS) {
window.location.href = appPath;
} else {
... ...