//设备检测(移动|PC)
export const deviceDetection = () => {
    let isMobile = null;
    const sUserAgent: any = navigator.userAgent.toLowerCase();
    const bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
    const bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
    const bIsMidp = sUserAgent.match(/midp/i) == "midp";
    const bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
    const bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
    const bIsAndroid = sUserAgent.match(/android/i) == "android";
    const bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
    const bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
    // const trident = sUserAgent.indexOf("Trident") > -1;
    // const presto = sUserAgent.indexOf("Presto") > -1; //opera内核
    // const webKit = sUserAgent.indexOf("AppleWebKit") > -1; //苹果、谷歌内核
    // const gecko = sUserAgent.indexOf("Gecko") > -1 && sUserAgent.indexOf("KHTML") == -1; //火狐内核
    // const mobile = !!sUserAgent.match(/AppleWebKit.*Mobile.*/); //是否为移动终端
    // const ios = !!sUserAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
    // const android = sUserAgent.indexOf("Android") > -1 || sUserAgent.indexOf("Adr") > -1; //android终端
    // const iPhone = sUserAgent.indexOf("iPhone") > -1; //是否为iPhone或者QQHD浏览器
    // const iPad = sUserAgent.indexOf("iPad") > -1; //是否iPad
    // const webApp = sUserAgent.indexOf("Safari") == -1; //是否web应该程序，没有头部与底部
    // const weixin = sUserAgent.indexOf("MicroMessenger") > -1; //是否微信 （2015-01-22新增）
    // const qq = sUserAgent.match(/\sQQ/i) == " qq"; //是否QQ
    // const isBaidu = sUserAgent.indexOf("baiduboxapp") !== -1; //是否为百度浏览器
    // const isqqBrowser = sUserAgent.indexOf("mqqbrowser") !== -1; //是否为qq浏览器
    // const isWxBrowser = sUserAgent.indexOf("micromessenger") !== -1; //是否为微信浏览器
    // const isUc = sUserAgent.indexOf("ucbrowser") !== -1; //是否为uc浏览器

    if (
        bIsIpad ||
        bIsIphoneOs ||
        bIsMidp ||
        bIsUc7 ||
        bIsUc ||
        bIsAndroid ||
        bIsCE ||
        bIsWM
        //||
        // trident ||
        // presto ||
        // webKit ||
        // gecko ||
        // mobile ||
        // ios ||
        // android ||
        // iPhone ||
        // iPad ||
        // webApp ||
        // weixin ||
        // qq ||
        // isBaidu ||
        // isqqBrowser ||
        // isWxBrowser ||
        // isUc
    ) {
        isMobile = true;
    } else {
        isMobile = false;
    }
    return isMobile;
};
