mirror of
https://github.com/status-im/universal-links-handler.git
synced 2025-02-24 00:28:11 +00:00
39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
(function() {
|
|
function buildPlayStoreUrl() {
|
|
var androidId = $('meta[property="al:android:package"]').attr("content");
|
|
return "https://play.google.com/store/apps/details?id=" + androidId;
|
|
}
|
|
|
|
function buildItunesUrl() {
|
|
var iosId = $('meta[property="al:ios:app_store_id"]').attr("content");
|
|
return "https://itunes.apple.com/app/status-ethereum-anywhere/id" + iosId;
|
|
}
|
|
|
|
function isAndroid(userAgent) {
|
|
return userAgent.toLowerCase().indexOf("android") > -1;
|
|
}
|
|
|
|
function isIOS(userAgent) {
|
|
return userAgent.toLowerCase().indexOf("iphone") > -1;
|
|
}
|
|
|
|
function testFlightURL() {
|
|
return "https://status.im/success";
|
|
}
|
|
|
|
function webURL() {
|
|
return "https://status.im/";
|
|
}
|
|
|
|
$(document).ready(function () {
|
|
var appStoreLink = $('.app-store-link');
|
|
if (isAndroid(navigator.userAgent)) {
|
|
appStoreLink.attr('href', buildPlayStoreUrl());
|
|
} else if (isIOS(navigator.userAgent)) {
|
|
appStoreLink.attr('href', testFlightURL());
|
|
} else {
|
|
appStoreLink.attr('href', webURL());
|
|
}
|
|
});
|
|
}());
|