implementation changes for checking mobile app exists on phone or not and redirect to the browser in case does not exist

This commit is contained in:
Jatin_Chugh
2022-12-22 16:33:48 +05:30
parent 8ba18bb6dc
commit 834c129c8d
3 changed files with 52 additions and 1 deletions

View File

@@ -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,

View File

@@ -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
}

View File

@@ -49,6 +49,9 @@
}
</style>
</head>
<!-- <script src="./assets/scripts/checkMobileDevice.js" type="text/javascript">
</script> -->
<body>
<main>
<app-root>