/*
Function to return the iOS version of the device.
*/

export function getiOSversion() {
    if (/iP(hone|od|ad)/.test(navigator.platform)) {
        // supports iOS 2.0 and later:
        var v = navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);
        return [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)];
    }
}

/*
Function to return true/false if the user agent is a mobile device or not.
*/

export function isMobileDevice() {
    const userAgent = navigator.userAgent;
    return (
        userAgent.includes("Android") ||
        userAgent.includes("Mobile") ||
        userAgent.includes("iPod") ||
        userAgent.includes("iPhone") ||
        userAgent.includes("IEMobile") ||
        userAgent.includes("BlackBerry") ||
        userAgent.includes("webOS")
    );
}

/*
Function to return true/false if the user is using an apple browser on a device.
*/

export function isAppleBrowser() {
    const userAgent = navigator.userAgent;
    return (
        userAgent.includes("iPod") ||
        userAgent.includes("iPad") ||
        userAgent.includes("iPhone") ||
        userAgent.includes("Mac")
    );
}