better feedback if forgot to activate browser support

This commit is contained in:
nicolas.dorier
2018-02-13 12:20:56 +09:00
parent cedf8f75e8
commit fd4f4e6aff
5 changed files with 27 additions and 8 deletions

View File

@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework> <TargetFramework>netcoreapp2.0</TargetFramework>
<Version>1.0.1.23</Version> <Version>1.0.1.24</Version>
<NoWarn>NU1701</NoWarn> <NoWarn>NU1701</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@@ -31,7 +31,7 @@
<input asp-for="DerivationScheme" class="form-control" /> <input asp-for="DerivationScheme" class="form-control" />
<span asp-validation-for="DerivationScheme" class="text-danger"></span> <span asp-validation-for="DerivationScheme" class="text-danger"></span>
<p id="no-ledger-info" class="form-text text-muted" style="display: none;"> <p id="no-ledger-info" class="form-text text-muted" style="display: none;">
No ledger wallet detected. If you own one, use chrome, open the app, activates the <a href="https://support.ledgerwallet.com/hc/en-us/articles/115005198565-What-is-the-Browser-support-option-made-for-">Browser support</a>, and refresh this page. No ledger wallet detected. If you own one, use chrome, open the app, activate the <a href="https://support.ledgerwallet.com/hc/en-us/articles/115005198565-What-is-the-Browser-support-option-made-for-">Browser support</a>, and refresh this page.
</p> </p>
<p id="ledger-info" class="form-text text-muted" style="display: none;"> <p id="ledger-info" class="form-text text-muted" style="display: none;">
<span>A ledger wallet is detected, please use our <a id="ledger-info-recommended" href="#">recommended choice</a></span> <span>A ledger wallet is detected, please use our <a id="ledger-info-recommended" href="#">recommended choice</a></span>

View File

@@ -10,7 +10,7 @@
function Write(prefix, type, message) { function Write(prefix, type, message) {
if (type === "error") { if (type === "error") {
$("#no-ledger-info").css("display", "block"); $("#no-ledger-info").css("display", "block");
$("#ledger-info").css("display", "none"); $("#ledger-in fo").css("display", "none");
} }
} }
@@ -34,6 +34,8 @@
bridge.sendCommand("getxpub", "cryptoCode=" + cryptoCode) bridge.sendCommand("getxpub", "cryptoCode=" + cryptoCode)
.catch(function (reason) { Write('check', 'error', reason); }) .catch(function (reason) { Write('check', 'error', reason); })
.then(function (result) { .then(function (result) {
if (!result)
return;
if (result.error) { if (result.error) {
Write('check', 'error', result.error); Write('check', 'error', result.error);
return; return;
@@ -53,9 +55,15 @@
Write('hw', 'error', 'U2F or Websocket are not supported by this browser'); Write('hw', 'error', 'U2F or Websocket are not supported by this browser');
} }
else { else {
bridge.sendCommand('test') bridge.sendCommand('test', null, 5)
.catch(function (reason) { Write('hw', 'error', reason); }) .catch(function (reason) {
if (reason.message === "Sign failed")
reason = "Have you forgot to activate browser support in your ledger app?";
Write('hw', 'error', reason);
})
.then(function (result) { .then(function (result) {
if (!result)
return;
if (result.error) { if (result.error) {
Write('hw', 'error', result.error); Write('hw', 'error', result.error);
} else { } else {

View File

@@ -45,6 +45,8 @@
confirmButton.removeClass("disabled"); confirmButton.removeClass("disabled");
}) })
.then(function (result) { .then(function (result) {
if (!result)
return;
confirmButton.prop("disabled", false); confirmButton.prop("disabled", false);
confirmButton.removeClass("disabled"); confirmButton.removeClass("disabled");
if (result.error) { if (result.error) {
@@ -84,6 +86,8 @@
bridge.sendCommand("getinfo", "cryptoCode=" + cryptoCode) bridge.sendCommand("getinfo", "cryptoCode=" + cryptoCode)
.catch(function (reason) { Write('check', 'error', reason); }) .catch(function (reason) { Write('check', 'error', reason); })
.then(function (result) { .then(function (result) {
if (!result)
return;
if (result.error) { if (result.error) {
Write('check', 'error', result.error); Write('check', 'error', result.error);
return; return;
@@ -104,9 +108,16 @@
Write('hw', 'error', 'U2F or Websocket are not supported by this browser'); Write('hw', 'error', 'U2F or Websocket are not supported by this browser');
} }
else { else {
bridge.sendCommand('test') bridge.sendCommand('test', null, 5)
.catch(function (reason) { Write('hw', 'error', reason); }) .catch(function (reason)
{
if (reason.message === "Sign failed")
reason = "Have you forgot to activate browser support in your ledger app?";
Write('hw', 'error', reason);
})
.then(function (result) { .then(function (result) {
if (!result)
return;
if (result.error) { if (result.error) {
Write('hw', 'error', result.error); Write('hw', 'error', result.error);
} else { } else {

File diff suppressed because one or more lines are too long