diff --git a/angular.json b/angular.json index 37fafef6a..76480507d 100644 --- a/angular.json +++ b/angular.json @@ -118,7 +118,8 @@ "scripts": [ "node_modules/pdfjs-dist/build/pdf.js", "node_modules/pdfjs-dist/web/pdf_viewer.js", - "node_modules/moment/min/moment.min.js" + "node_modules/moment/min/moment.min.js", + "app/src/assets/scripts/checkMobileDevice.js" ], "vendorChunk": true, "extractLicenses": false, diff --git a/app/src/assets/scripts/checkMobileDevice.js b/app/src/assets/scripts/checkMobileDevice.js new file mode 100644 index 000000000..6c61de7ef --- /dev/null +++ b/app/src/assets/scripts/checkMobileDevice.js @@ -0,0 +1,47 @@ + // const ua = navigator.userAgent.toLowerCase(); + // const isAndroid = ua.indexOf('android') > -1; + // const isIphone = ua.indexOf('iphone') > -1; + + // if (isIphone === true) { + // window.location.href = 'com.alfresco.contentapp://iosamw'; + // setTimeout(() => { + // console.log("iphone"); + // }, 25); + // } else if (isAndroid === true) { + // window.location.href = 'com.alfresco.content.app://androidamw'; + // setTimeout(() => { + // console.log("android"); + // }, 25); + // } + + let ua = navigator.userAgent.toLowerCase(); + let isAndroid = ua.indexOf("android") > -1; // android check + let isIphone = ua.indexOf("iphone") > -1; // ios check + if (isIphone == true) { + let url = window.location.href; + let app = { + launchApp: function() { + setTimeout(function() { + window.location.href = "https://itunes.apple.com/us/app/appname/appid"; + }, 25); + window.location.href = "iosamw://"+url; //which page to open(now from mobile, check its authorization) + }, + openWebApp: function() { + window.location.href = "https://itunes.apple.com/us/app/appname/appid"; + } + }; + app.launchApp(); + } else if (isAndroid== true) { + let app = { + launchApp: function() { + window.location.href = "intent:#Intent;scheme=androidamw;package=com.alfresco.content.app;end"; //which page to open(now from mobile, check its authorization) + // setTimeout(this.openWebApp, 500); + }, + openWebApp: function() { + window.location.href = "https://play.google.com/store/apps/details?id=package"; + } + }; + app.launchApp(); + }else{ + //navigate to website url + } diff --git a/app/src/index.html b/app/src/index.html index 2f9c8c997..dce565858 100644 --- a/app/src/index.html +++ b/app/src/index.html @@ -49,6 +49,9 @@ } +