Skip to content

Commit 57ddddf

Browse files
authored
replace xmr.to with SideShift.ai (#710)
replace xmr.to with SideShift.ai random bugfixes upgrade gradle & dependencies
1 parent ab60690 commit 57ddddf

File tree

133 files changed

+3371
-3532
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+3371
-3532
lines changed

app/build.gradle

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ android {
77
applicationId "com.m2049r.xmrwallet"
88
minSdkVersion 21
99
targetSdkVersion 29
10-
versionCode 602
11-
versionName "1.16.2 'Karmic Nodes'"
10+
versionCode 702
11+
versionName "1.17.2 'Druk'"
1212
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1313
externalNativeBuild {
1414
cmake {
@@ -56,6 +56,9 @@ android {
5656
debug {
5757
applicationIdSuffix ".debug"
5858
}
59+
applicationVariants.all { variant ->
60+
variant.buildConfigField "String", "ID_A", "\"" + getId("ID_A") + "\""
61+
}
5962
}
6063

6164
externalNativeBuild {
@@ -109,10 +112,16 @@ android {
109112
}
110113
}
111114

115+
def getId(name) {
116+
def Properties props = new Properties()
117+
props.load(new FileInputStream(new File('monerujo.id')))
118+
return props[name]
119+
}
120+
112121
dependencies {
113122
implementation 'androidx.core:core:1.3.2'
114123
implementation 'androidx.appcompat:appcompat:1.2.0'
115-
implementation 'com.google.android.material:material:1.3.0-alpha03'
124+
implementation 'com.google.android.material:material:1.3.0'
116125
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
117126
implementation 'androidx.recyclerview:recyclerview:1.1.0'
118127
implementation 'androidx.cardview:cardview:1.0.0'

app/src/main/java/com/m2049r/levin/scanner/LevinPeer.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright (c) 2018 m2049r
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package com.m2049r.levin.scanner;
218

319
import java.net.InetAddress;

app/src/main/java/com/m2049r/xmrwallet/BaseActivity.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright (c) 2017-2020 m2049r et al.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package com.m2049r.xmrwallet;
218

319
import android.app.PendingIntent;

app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java

Lines changed: 39 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -301,24 +301,21 @@ protected void onCreate(Bundle savedInstanceState) {
301301
setSupportActionBar(toolbar);
302302
getSupportActionBar().setDisplayShowTitleEnabled(false);
303303

304-
toolbar.setOnButtonListener(new Toolbar.OnButtonListener() {
305-
@Override
306-
public void onButton(int type) {
307-
switch (type) {
308-
case Toolbar.BUTTON_BACK:
309-
onBackPressed();
310-
break;
311-
case Toolbar.BUTTON_CLOSE:
312-
finish();
313-
break;
314-
case Toolbar.BUTTON_CREDITS:
315-
CreditsFragment.display(getSupportFragmentManager());
316-
break;
317-
case Toolbar.BUTTON_NONE:
318-
break;
319-
default:
320-
Timber.e("Button " + type + "pressed - how can this be?");
321-
}
304+
toolbar.setOnButtonListener(type -> {
305+
switch (type) {
306+
case Toolbar.BUTTON_BACK:
307+
onBackPressed();
308+
break;
309+
case Toolbar.BUTTON_CLOSE:
310+
finish();
311+
break;
312+
case Toolbar.BUTTON_CREDITS:
313+
CreditsFragment.display(getSupportFragmentManager());
314+
break;
315+
case Toolbar.BUTTON_NONE:
316+
break;
317+
default:
318+
Timber.e("Button " + type + "pressed - how can this be?");
322319
}
323320
});
324321

@@ -366,34 +363,31 @@ public boolean onWalletSelected(String walletName, boolean streetmode) {
366363
public void onWalletDetails(final String walletName) {
367364
Timber.d("details for wallet .%s.", walletName);
368365
if (checkServiceRunning()) return;
369-
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
370-
@Override
371-
public void onClick(DialogInterface dialog, int which) {
372-
switch (which) {
373-
case DialogInterface.BUTTON_POSITIVE:
374-
final File walletFile = Helper.getWalletFile(LoginActivity.this, walletName);
375-
if (WalletManager.getInstance().walletExists(walletFile)) {
376-
Helper.promptPassword(LoginActivity.this, walletName, true, new Helper.PasswordAction() {
377-
@Override
378-
public void act(String walletName, String password, boolean fingerprintUsed) {
379-
if (checkDevice(walletName, password))
380-
startDetails(walletFile, password, GenerateReviewFragment.VIEW_TYPE_DETAILS);
381-
}
382-
383-
@Override
384-
public void fail(String walletName, String password, boolean fingerprintUsed) {
385-
}
386-
});
387-
} else { // this cannot really happen as we prefilter choices
388-
Timber.e("Wallet missing: %s", walletName);
389-
Toast.makeText(LoginActivity.this, getString(R.string.bad_wallet), Toast.LENGTH_SHORT).show();
390-
}
391-
break;
366+
DialogInterface.OnClickListener dialogClickListener = (dialog, which) -> {
367+
switch (which) {
368+
case DialogInterface.BUTTON_POSITIVE:
369+
final File walletFile = Helper.getWalletFile(LoginActivity.this, walletName);
370+
if (WalletManager.getInstance().walletExists(walletFile)) {
371+
Helper.promptPassword(LoginActivity.this, walletName, true, new Helper.PasswordAction() {
372+
@Override
373+
public void act(String walletName1, String password, boolean fingerprintUsed) {
374+
if (checkDevice(walletName1, password))
375+
startDetails(walletFile, password, GenerateReviewFragment.VIEW_TYPE_DETAILS);
376+
}
392377

393-
case DialogInterface.BUTTON_NEGATIVE:
394-
// do nothing
395-
break;
396-
}
378+
@Override
379+
public void fail(String walletName1, String password, boolean fingerprintUsed) {
380+
}
381+
});
382+
} else { // this cannot really happen as we prefilter choices
383+
Timber.e("Wallet missing: %s", walletName);
384+
Toast.makeText(LoginActivity.this, getString(R.string.bad_wallet), Toast.LENGTH_SHORT).show();
385+
}
386+
break;
387+
388+
case DialogInterface.BUTTON_NEGATIVE:
389+
// do nothing
390+
break;
397391
}
398392
};
399393

app/src/main/java/com/m2049r/xmrwallet/ReceiveFragment.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
import com.google.zxing.common.BitMatrix;
5757
import com.google.zxing.qrcode.QRCodeWriter;
5858
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
59+
import com.m2049r.xmrwallet.BuildConfig;
5960
import com.m2049r.xmrwallet.data.BarcodeData;
6061
import com.m2049r.xmrwallet.ledger.LedgerProgressDialog;
6162
import com.m2049r.xmrwallet.model.Wallet;
@@ -468,7 +469,7 @@ private void generateQr() {
468469
Timber.d("CLEARQR");
469470
return;
470471
}
471-
bcData = new BarcodeData(BarcodeData.Asset.XMR, address, null, notes, xmrAmount);
472+
bcData = new BarcodeData(BarcodeData.Asset.XMR, address, notes, xmrAmount);
472473
int size = Math.max(ivQrCode.getWidth(), ivQrCode.getHeight());
473474
Bitmap qr = generate(bcData.getUriString(), size, size);
474475
if (qr != null) {

app/src/main/java/com/m2049r/xmrwallet/TxFragment.java

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,19 @@
1616

1717
package com.m2049r.xmrwallet;
1818

19+
import android.annotation.SuppressLint;
1920
import android.content.Context;
2021
import android.content.Intent;
22+
import android.graphics.Paint;
23+
import android.net.Uri;
2124
import android.os.Bundle;
2225
import android.text.InputType;
2326
import android.view.LayoutInflater;
2427
import android.view.Menu;
2528
import android.view.MenuInflater;
2629
import android.view.View;
2730
import android.view.ViewGroup;
31+
import android.widget.ImageView;
2832
import android.widget.TextView;
2933
import android.widget.Toast;
3034

@@ -77,6 +81,9 @@ public TxFragment() {
7781
private TextView tvTxXmrToKey;
7882
private TextView tvDestinationBtc;
7983
private TextView tvTxAmountBtc;
84+
private TextView tvXmrToSupport;
85+
private TextView tvXmrToKeyLabel;
86+
private ImageView tvXmrToLogo;
8087

8188
@Override
8289
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@@ -88,6 +95,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
8895
tvTxXmrToKey = view.findViewById(R.id.tvTxXmrToKey);
8996
tvDestinationBtc = view.findViewById(R.id.tvDestinationBtc);
9097
tvTxAmountBtc = view.findViewById(R.id.tvTxAmountBtc);
98+
tvXmrToSupport = view.findViewById(R.id.tvXmrToSupport);
99+
tvXmrToKeyLabel = view.findViewById(R.id.tvXmrToKeyLabel);
100+
tvXmrToLogo = view.findViewById(R.id.tvXmrToLogo);
91101

92102
tvAccount = view.findViewById(R.id.tvAccount);
93103
tvAddress = view.findViewById(R.id.tvAddress);
@@ -104,12 +114,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
104114

105115
etTxNotes.setRawInputType(InputType.TYPE_CLASS_TEXT);
106116

107-
tvTxXmrToKey.setOnClickListener(new View.OnClickListener() {
108-
@Override
109-
public void onClick(View v) {
110-
Helper.clipBoardCopy(getActivity(), getString(R.string.label_copy_xmrtokey), tvTxXmrToKey.getText().toString());
111-
Toast.makeText(getActivity(), getString(R.string.message_copy_xmrtokey), Toast.LENGTH_SHORT).show();
112-
}
117+
tvTxXmrToKey.setOnClickListener(v -> {
118+
Helper.clipBoardCopy(getActivity(), getString(R.string.label_copy_xmrtokey), tvTxXmrToKey.getText().toString());
119+
Toast.makeText(getActivity(), getString(R.string.message_copy_xmrtokey), Toast.LENGTH_SHORT).show();
113120
});
114121

115122
Bundle args = getArguments();
@@ -283,12 +290,36 @@ private void show(TransactionInfo info) {
283290
showBtcInfo();
284291
}
285292

293+
@SuppressLint("SetTextI18n")
286294
void showBtcInfo() {
287295
if (userNotes.xmrtoKey != null) {
288296
cvXmrTo.setVisibility(View.VISIBLE);
289-
tvTxXmrToKey.setText(userNotes.xmrtoKey);
297+
String key = userNotes.xmrtoKey;
298+
if ("xmrto".equals(userNotes.xmrtoTag)) { // legacy xmr.to service :(
299+
key = "xmrto-" + key;
300+
}
301+
tvTxXmrToKey.setText(key);
290302
tvDestinationBtc.setText(userNotes.xmrtoDestination);
291303
tvTxAmountBtc.setText(userNotes.xmrtoAmount + " BTC");
304+
switch (userNotes.xmrtoTag) {
305+
case "xmrto":
306+
tvXmrToSupport.setVisibility(View.GONE);
307+
tvXmrToKeyLabel.setVisibility(View.INVISIBLE);
308+
tvXmrToLogo.setImageResource(R.drawable.ic_xmrto_logo);
309+
break;
310+
case "side": // defaults in layout - just add underline
311+
tvXmrToSupport.setPaintFlags(tvXmrToSupport.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
312+
tvXmrToSupport.setOnClickListener(v -> {
313+
Uri uri = Uri.parse("https://sideshift.ai/orders/" + userNotes.xmrtoKey);
314+
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
315+
startActivity(intent);
316+
});
317+
break;
318+
default:
319+
tvXmrToSupport.setVisibility(View.GONE);
320+
tvXmrToKeyLabel.setVisibility(View.INVISIBLE);
321+
tvXmrToLogo.setVisibility(View.GONE);
322+
}
292323
} else {
293324
cvXmrTo.setVisibility(View.GONE);
294325
}

app/src/main/java/com/m2049r/xmrwallet/XmrWalletApplication.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@
1616

1717
package com.m2049r.xmrwallet;
1818

19-
2019
import android.app.Application;
2120
import android.content.Context;
2221
import android.content.res.Configuration;
2322
import android.os.Build;
2423

24+
import com.m2049r.xmrwallet.BuildConfig;
2525
import com.m2049r.xmrwallet.model.NetworkType;
26-
import com.m2049r.xmrwallet.util.DayNightMode;
2726
import com.m2049r.xmrwallet.util.LocaleHelper;
2827
import com.m2049r.xmrwallet.util.NightmodeHelper;
2928

0 commit comments

Comments
 (0)