Comparing version 0.3.1 to 0.3.2
68
index.js
@@ -278,18 +278,27 @@ const axios = require('axios') | ||
defineDeviceAndNav () { | ||
if (!this.isMobile.any()) { | ||
window.location = this.data_deep_links.data.link | ||
setTimeout(() => { | ||
if (window.confirm(`Oops, seems you do not have crypto-wallet! Would you like to get one or open on mobile?`)) { | ||
window.location = `${env.qrCodeRedirect}?params=${JSON.stringify({ | ||
let focusMissedByUs = false | ||
const nav = { | ||
default: () => { | ||
focusMissedByUs = true | ||
window.location = this.data_deep_links.data.link | ||
}, | ||
share: () => { | ||
focusMissedByUs = true | ||
navigator.share({ | ||
title: 'Pay with Crypttp', | ||
text: btoa(JSON.stringify({ | ||
id: this.tx_params.merchant_id, | ||
params: this.deeplink_params | ||
})}` | ||
} | ||
}, 5000) | ||
})) | ||
}) | ||
} | ||
} | ||
else { | ||
window.location = this.data_deep_links.data.link | ||
setTimeout(() => { | ||
window.onfocus = function () { | ||
if (focusMissedByUs) { | ||
window.onfocus = function () {} | ||
focusMissedByUs = false | ||
if (window.confirm(`Oops, seems you do not have crypto-wallet! Would you like to get one or open on mobile?`)) { | ||
@@ -301,4 +310,35 @@ window.location = `${env.qrCodeRedirect}?params=${JSON.stringify({ | ||
} | ||
}, 3000) | ||
} | ||
} | ||
if (this.data_deep_links.data.link.split(":")[0] == "bitcoin") | ||
nav.default() | ||
else { | ||
if (!this.isMobile.any()) { | ||
if (navigator.appVersion.indexOf("Mac") != -1) | ||
try { | ||
nav.share() | ||
} | ||
catch (e) { | ||
nav.default() | ||
} | ||
else | ||
nav.default() | ||
} | ||
else { | ||
if (this.isMobile.Android()) | ||
nav.default() | ||
else if (this.isMobile.iOS()) | ||
try { | ||
nav.share() | ||
} | ||
catch (e) { | ||
nav.default() | ||
} | ||
} | ||
} | ||
} | ||
@@ -305,0 +345,0 @@ |
{ | ||
"name": "crypttp", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Module to call APIs of crypttp powered by alemey", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18324
426