mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-10-01 14:41:14 +00:00
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:
@@ -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,
|
||||
|
47
app/src/assets/scripts/checkMobileDevice.js
Normal file
47
app/src/assets/scripts/checkMobileDevice.js
Normal 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
|
||||
}
|
@@ -49,6 +49,9 @@
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<!-- <script src="./assets/scripts/checkMobileDevice.js" type="text/javascript">
|
||||
|
||||
</script> -->
|
||||
<body>
|
||||
<main>
|
||||
<app-root>
|
||||
|
Reference in New Issue
Block a user