Skip to content

Commit

Permalink
disable ledger support (#547)
Browse files Browse the repository at this point in the history
  • Loading branch information
m2049r authored Mar 5, 2019
1 parent 06456e3 commit de8de02
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 26 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.m2049r.xmrwallet"
minSdkVersion 21
targetSdkVersion 28
versionCode 171
versionName "1.11.1 'Chernushka'"
versionCode 172
versionName "1.11.2 'Chernushka'"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
Expand Down
49 changes: 25 additions & 24 deletions app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -1361,30 +1361,31 @@ public void onReceive(Context context, Intent intent) {
};

private void connectLedger(UsbManager usbManager, final UsbDevice usbDevice) {
try {
Ledger.connect(usbManager, usbDevice);
registerDetachReceiver();
onLedgerAction();
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(LoginActivity.this,
getString(R.string.toast_ledger_attached, usbDevice.getProductName()),
Toast.LENGTH_SHORT)
.show();
}
});
} catch (IOException ex) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(LoginActivity.this,
getString(R.string.open_wallet_ledger_missing),
Toast.LENGTH_SHORT)
.show();
}
});
}
if (Ledger.ENABLED)
try {
Ledger.connect(usbManager, usbDevice);
registerDetachReceiver();
onLedgerAction();
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(LoginActivity.this,
getString(R.string.toast_ledger_attached, usbDevice.getProductName()),
Toast.LENGTH_SHORT)
.show();
}
});
} catch (IOException ex) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(LoginActivity.this,
getString(R.string.open_wallet_ledger_missing),
Toast.LENGTH_SHORT)
.show();
}
});
}
}

@Override
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/m2049r/xmrwallet/ledger/Ledger.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import timber.log.Timber;

public class Ledger {
static final public boolean ENABLED = false;
// 5:20 is same as wallet2.cpp::restore()
static public final int LOOKAHEAD_ACCOUNTS = 5;
static public final int LOOKAHEAD_SUBADDRESSES = 20;
Expand All @@ -44,6 +45,7 @@ public class Ledger {
public static final int OK[] = {SW_OK};

public static UsbDevice findDevice(UsbManager usbManager) {
if (!ENABLED) return null;
return BTChipTransportAndroidHID.getDevice(usbManager);
}

Expand Down

0 comments on commit de8de02

Please sign in to comment.