From 445d8acc3841fbdcb3f37a4ecca456b3463f45df Mon Sep 17 00:00:00 2001 From: m2049r Date: Thu, 14 Feb 2019 23:34:38 +0100 Subject: [PATCH] open on monero: & bitcoin: uri (#532) --- app/src/main/AndroidManifest.xml | 16 +++++++++++ .../com/m2049r/xmrwallet/LoginActivity.java | 27 +++++++++++++++++-- .../com/m2049r/xmrwallet/WalletActivity.java | 9 +++++-- .../m2049r/xmrwallet/dialog/HelpFragment.java | 2 +- .../xmrwallet/fragment/send/SendFragment.java | 21 ++++++++++++++- app/src/main/res/values-de/help.xml | 13 +++++++++ app/src/main/res/values-el/help.xml | 13 +++++++++ app/src/main/res/values-eo/help.xml | 13 +++++++++ app/src/main/res/values-es/help.xml | 13 +++++++++ app/src/main/res/values-et/help.xml | 13 +++++++++ app/src/main/res/values-fr/help.xml | 13 +++++++++ app/src/main/res/values-hu/help.xml | 13 +++++++++ app/src/main/res/values-it/help.xml | 13 +++++++++ app/src/main/res/values-ja/help.xml | 13 +++++++++ app/src/main/res/values-nb/help.xml | 13 +++++++++ app/src/main/res/values-nl/help.xml | 13 +++++++++ app/src/main/res/values-pt-rBR/help.xml | 13 +++++++++ app/src/main/res/values-pt/help.xml | 13 +++++++++ app/src/main/res/values-ro/help.xml | 13 +++++++++ app/src/main/res/values-ru/help.xml | 13 +++++++++ app/src/main/res/values-sk/help.xml | 12 +++++++++ app/src/main/res/values-sv/help.xml | 13 +++++++++ app/src/main/res/values-ua/help.xml | 15 ++++++++++- app/src/main/res/values-zh-rCN/help.xml | 13 +++++++++ app/src/main/res/values-zh-rTW/help.xml | 13 +++++++++ app/src/main/res/values/help.xml | 13 +++++++++ app/src/stagenet/res/values/strings.xml | 2 +- 27 files changed, 343 insertions(+), 8 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 3e067d7..8519522 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -42,6 +42,22 @@ + + + + + + + + + + + + + + + + diff --git a/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java b/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java index 49c2c7d..35f264d 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java +++ b/app/src/main/java/com/m2049r/xmrwallet/LoginActivity.java @@ -269,7 +269,11 @@ public class LoginActivity extends BaseActivity } else { Timber.i("Waiting for permissions"); } - processUsbIntent(getIntent()); + + // try intents + Intent intent = getIntent(); + if (!processUsbIntent(intent)) + processUriIntent(intent); } boolean checkServiceRunning() { @@ -716,6 +720,10 @@ public class LoginActivity extends BaseActivity intent.putExtra(WalletActivity.REQUEST_PW, walletPassword); intent.putExtra(WalletActivity.REQUEST_FINGERPRINT_USED, fingerprintUsed); intent.putExtra(WalletActivity.REQUEST_STREETMODE, streetmode); + if (uri != null) { + intent.putExtra(WalletActivity.REQUEST_URI, uri); + uri = null; // use only once + } startActivity(intent); } @@ -1385,7 +1393,7 @@ public class LoginActivity extends BaseActivity processUsbIntent(intent); } - private void processUsbIntent(Intent intent) { + private boolean processUsbIntent(Intent intent) { String action = intent.getAction(); if (UsbManager.ACTION_USB_DEVICE_ATTACHED.equals(action)) { synchronized (this) { @@ -1398,6 +1406,21 @@ public class LoginActivity extends BaseActivity } } } + return true; + } + return false; + } + + private String uri = null; + + private void processUriIntent(Intent intent) { + String action = intent.getAction(); + if (Intent.ACTION_VIEW.equals(action)) { + synchronized (this) { + uri = intent.getDataString(); + Timber.d("URI Intent %s", uri); + HelpFragment.display(getSupportFragmentManager(), R.string.help_uri); + } } } diff --git a/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java b/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java index 8fa6dea..3d82a9d 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java +++ b/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java @@ -47,6 +47,7 @@ import android.widget.Toast; import com.m2049r.xmrwallet.data.BarcodeData; import com.m2049r.xmrwallet.data.TxData; +import com.m2049r.xmrwallet.data.UserNotes; import com.m2049r.xmrwallet.dialog.CreditsFragment; import com.m2049r.xmrwallet.dialog.HelpFragment; import com.m2049r.xmrwallet.fragment.send.SendAddressWizardFragment; @@ -59,7 +60,6 @@ import com.m2049r.xmrwallet.model.WalletManager; import com.m2049r.xmrwallet.service.WalletService; import com.m2049r.xmrwallet.util.Helper; import com.m2049r.xmrwallet.util.MoneroThreadPoolExecutor; -import com.m2049r.xmrwallet.data.UserNotes; import com.m2049r.xmrwallet.widget.Toolbar; import java.util.ArrayList; @@ -81,6 +81,7 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste public static final String REQUEST_PW = "pw"; public static final String REQUEST_FINGERPRINT_USED = "fingerprint"; public static final String REQUEST_STREETMODE = "streetmode"; + public static final String REQUEST_URI = "uri"; private NavigationView accountsView; private DrawerLayout drawer; @@ -92,6 +93,8 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste private String password; + private String uri = null; + private long streetMode = 0; @Override @@ -191,6 +194,7 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste // we can set the streetmode height AFTER opening the wallet requestStreetMode = extras.getBoolean(REQUEST_STREETMODE); password = extras.getString(REQUEST_PW); + uri = extras.getString(REQUEST_URI); connectWalletService(walletId, password); } else { finish(); @@ -512,7 +516,8 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste @Override public void onSendRequest() { - replaceFragment(new SendFragment(), null, null); + replaceFragment(SendFragment.newInstance(uri), null, null); + uri = null; // only use uri once } @Override diff --git a/app/src/main/java/com/m2049r/xmrwallet/dialog/HelpFragment.java b/app/src/main/java/com/m2049r/xmrwallet/dialog/HelpFragment.java index da4333d..dc2238d 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/dialog/HelpFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/dialog/HelpFragment.java @@ -67,7 +67,7 @@ public class HelpFragment extends DialogFragment { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(view); - builder.setNegativeButton(R.string.about_close, + builder.setNegativeButton(R.string.help_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { diff --git a/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendFragment.java b/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendFragment.java index d01ca43..a05dd23 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/fragment/send/SendFragment.java @@ -38,15 +38,16 @@ import android.widget.EditText; import com.m2049r.xmrwallet.OnBackPressedListener; import com.m2049r.xmrwallet.OnUriScannedListener; import com.m2049r.xmrwallet.R; +import com.m2049r.xmrwallet.WalletActivity; import com.m2049r.xmrwallet.data.BarcodeData; import com.m2049r.xmrwallet.data.PendingTx; import com.m2049r.xmrwallet.data.TxData; import com.m2049r.xmrwallet.data.TxDataBtc; +import com.m2049r.xmrwallet.data.UserNotes; import com.m2049r.xmrwallet.layout.SpendViewPager; import com.m2049r.xmrwallet.model.PendingTransaction; import com.m2049r.xmrwallet.util.Helper; import com.m2049r.xmrwallet.util.Notice; -import com.m2049r.xmrwallet.data.UserNotes; import com.m2049r.xmrwallet.widget.DotBar; import com.m2049r.xmrwallet.widget.Toolbar; @@ -104,6 +105,14 @@ public class SendFragment extends Fragment static private int MAX_FALLBACK = Integer.MAX_VALUE; + public static SendFragment newInstance(String uri) { + SendFragment f = new SendFragment(); + Bundle args = new Bundle(); + args.putString(WalletActivity.REQUEST_URI, uri); + f.setArguments(args); + return f; + } + @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @@ -187,6 +196,16 @@ public class SendFragment extends Fragment etDummy.requestFocus(); Helper.hideKeyboard(getActivity()); + Bundle args = getArguments(); + if (args != null) { + String uri = args.getString(WalletActivity.REQUEST_URI); + Timber.d("URI: %s", uri); + if (uri != null) { + barcodeData = BarcodeData.fromQrCode(uri); + Timber.d("barcodeData: %s", barcodeData != null ? barcodeData.toString() : "null"); + } + } + return view; } diff --git a/app/src/main/res/values-de/help.xml b/app/src/main/res/values-de/help.xml index 78bc5b5..5c4d424 100644 --- a/app/src/main/res/values-de/help.xml +++ b/app/src/main/res/values-de/help.xml @@ -289,4 +289,17 @@ ]]> + + Using a payment link +

You have started monerujo with a payment link. In order to send funds, please do the following:

+

+ 1. Open the wallet you want to spend from
+ 2. Wait until the wallet is synced & the "Give" button appears
+ 3. Touch the "Give" button +

+

The payment details will be filled in. Check them and proceed like for any other transaction.

+ ]]>
+ + Got it! diff --git a/app/src/main/res/values-el/help.xml b/app/src/main/res/values-el/help.xml index fe85009..3a2c5bf 100644 --- a/app/src/main/res/values-el/help.xml +++ b/app/src/main/res/values-el/help.xml @@ -274,4 +274,17 @@ ]]> + + Using a payment link +

You have started monerujo with a payment link. In order to send funds, please do the following:

+

+ 1. Open the wallet you want to spend from
+ 2. Wait until the wallet is synced & the "Give" button appears
+ 3. Touch the "Give" button +

+

The payment details will be filled in. Check them and proceed like for any other transaction.

+ ]]>
+ + Got it! diff --git a/app/src/main/res/values-eo/help.xml b/app/src/main/res/values-eo/help.xml index 745b393..b13f6e3 100644 --- a/app/src/main/res/values-eo/help.xml +++ b/app/src/main/res/values-eo/help.xml @@ -311,4 +311,17 @@ Se vi ne markis nodojn (aŭ se ili ne respondas pri iliaj konektoj), Monerujo direkte petos la pranodojn konservitajn en la kerno de Monero. La skanado haltos kiam 10 foraj nodoj estos trovitaj.

]]> + + Using a payment link +

You have started monerujo with a payment link. In order to send funds, please do the following:

+

+ 1. Open the wallet you want to spend from
+ 2. Wait until the wallet is synced & the "Give" button appears
+ 3. Touch the "Give" button +

+

The payment details will be filled in. Check them and proceed like for any other transaction.

+ ]]>
+ + Got it! diff --git a/app/src/main/res/values-es/help.xml b/app/src/main/res/values-es/help.xml index bc92097..6de85cc 100644 --- a/app/src/main/res/values-es/help.xml +++ b/app/src/main/res/values-es/help.xml @@ -314,4 +314,17 @@ ]]> + + Using a payment link +

You have started monerujo with a payment link. In order to send funds, please do the following:

+

+ 1. Open the wallet you want to spend from
+ 2. Wait until the wallet is synced & the "Give" button appears
+ 3. Touch the "Give" button +

+

The payment details will be filled in. Check them and proceed like for any other transaction.

+ ]]>
+ + Got it! diff --git a/app/src/main/res/values-et/help.xml b/app/src/main/res/values-et/help.xml index f431a57..6ea94e7 100644 --- a/app/src/main/res/values-et/help.xml +++ b/app/src/main/res/values-et/help.xml @@ -306,4 +306,17 @@ ]]> + + Using a payment link +

You have started monerujo with a payment link. In order to send funds, please do the following:

+

+ 1. Open the wallet you want to spend from
+ 2. Wait until the wallet is synced & the "Give" button appears
+ 3. Touch the "Give" button +

+

The payment details will be filled in. Check them and proceed like for any other transaction.

+ ]]>
+ + Got it! diff --git a/app/src/main/res/values-fr/help.xml b/app/src/main/res/values-fr/help.xml index 361bb8f..1f0e11d 100644 --- a/app/src/main/res/values-fr/help.xml +++ b/app/src/main/res/values-fr/help.xml @@ -311,4 +311,17 @@ ]]> + + Using a payment link +

You have started monerujo with a payment link. In order to send funds, please do the following:

+

+ 1. Open the wallet you want to spend from
+ 2. Wait until the wallet is synced & the "Give" button appears
+ 3. Touch the "Give" button +

+

The payment details will be filled in. Check them and proceed like for any other transaction.

+ ]]>
+ + Got it! diff --git a/app/src/main/res/values-hu/help.xml b/app/src/main/res/values-hu/help.xml index 92e0e16..33aaacc 100644 --- a/app/src/main/res/values-hu/help.xml +++ b/app/src/main/res/values-hu/help.xml @@ -296,4 +296,17 @@ ]]> + + Using a payment link +

You have started monerujo with a payment link. In order to send funds, please do the following:

+

+ 1. Open the wallet you want to spend from
+ 2. Wait until the wallet is synced & the "Give" button appears
+ 3. Touch the "Give" button +

+

The payment details will be filled in. Check them and proceed like for any other transaction.

+ ]]>
+ + Got it! diff --git a/app/src/main/res/values-it/help.xml b/app/src/main/res/values-it/help.xml index 6f12b43..9c5690f 100644 --- a/app/src/main/res/values-it/help.xml +++ b/app/src/main/res/values-it/help.xml @@ -293,4 +293,17 @@ ]]> + + Using a payment link +

You have started monerujo with a payment link. In order to send funds, please do the following:

+

+ 1. Open the wallet you want to spend from
+ 2. Wait until the wallet is synced & the "Give" button appears
+ 3. Touch the "Give" button +

+

The payment details will be filled in. Check them and proceed like for any other transaction.

+ ]]>
+ + Got it! diff --git a/app/src/main/res/values-ja/help.xml b/app/src/main/res/values-ja/help.xml index 64f92f1..b0369bc 100644 --- a/app/src/main/res/values-ja/help.xml +++ b/app/src/main/res/values-ja/help.xml @@ -429,4 +429,17 @@ ]]> + + Using a payment link +

You have started monerujo with a payment link. In order to send funds, please do the following:

+

+ 1. Open the wallet you want to spend from
+ 2. Wait until the wallet is synced & the "Give" button appears
+ 3. Touch the "Give" button +

+

The payment details will be filled in. Check them and proceed like for any other transaction.

+ ]]>
+ + Got it! diff --git a/app/src/main/res/values-nb/help.xml b/app/src/main/res/values-nb/help.xml index 45762e5..3fa5e4a 100644 --- a/app/src/main/res/values-nb/help.xml +++ b/app/src/main/res/values-nb/help.xml @@ -294,4 +294,17 @@ ]]> + + Using a payment link +

You have started monerujo with a payment link. In order to send funds, please do the following:

+

+ 1. Open the wallet you want to spend from
+ 2. Wait until the wallet is synced & the "Give" button appears
+ 3. Touch the "Give" button +

+

The payment details will be filled in. Check them and proceed like for any other transaction.

+ ]]>
+ + Got it! diff --git a/app/src/main/res/values-nl/help.xml b/app/src/main/res/values-nl/help.xml index 4c160df..2f397ab 100644 --- a/app/src/main/res/values-nl/help.xml +++ b/app/src/main/res/values-nl/help.xml @@ -222,4 +222,17 @@ ]]> + + Using a payment link +

You have started monerujo with a payment link. In order to send funds, please do the following:

+

+ 1. Open the wallet you want to spend from
+ 2. Wait until the wallet is synced & the "Give" button appears
+ 3. Touch the "Give" button +

+

The payment details will be filled in. Check them and proceed like for any other transaction.

+ ]]>
+ + Got it! diff --git a/app/src/main/res/values-pt-rBR/help.xml b/app/src/main/res/values-pt-rBR/help.xml index 92ac1c1..d44810d 100755 --- a/app/src/main/res/values-pt-rBR/help.xml +++ b/app/src/main/res/values-pt-rBR/help.xml @@ -289,4 +289,17 @@ ]]> + + Using a payment link +

You have started monerujo with a payment link. In order to send funds, please do the following:

+

+ 1. Open the wallet you want to spend from
+ 2. Wait until the wallet is synced & the "Give" button appears
+ 3. Touch the "Give" button +

+

The payment details will be filled in. Check them and proceed like for any other transaction.

+ ]]>
+ + Got it! diff --git a/app/src/main/res/values-pt/help.xml b/app/src/main/res/values-pt/help.xml index 375e90a..269e908 100644 --- a/app/src/main/res/values-pt/help.xml +++ b/app/src/main/res/values-pt/help.xml @@ -297,4 +297,17 @@ ]]> + + Using a payment link +

You have started monerujo with a payment link. In order to send funds, please do the following:

+

+ 1. Open the wallet you want to spend from
+ 2. Wait until the wallet is synced & the "Give" button appears
+ 3. Touch the "Give" button +

+

The payment details will be filled in. Check them and proceed like for any other transaction.

+ ]]>
+ + Got it! diff --git a/app/src/main/res/values-ro/help.xml b/app/src/main/res/values-ro/help.xml index 8fc6f8e..15cabca 100644 --- a/app/src/main/res/values-ro/help.xml +++ b/app/src/main/res/values-ro/help.xml @@ -282,4 +282,17 @@ ]]> + + Using a payment link +

You have started monerujo with a payment link. In order to send funds, please do the following:

+

+ 1. Open the wallet you want to spend from
+ 2. Wait until the wallet is synced & the "Give" button appears
+ 3. Touch the "Give" button +

+

The payment details will be filled in. Check them and proceed like for any other transaction.

+ ]]>
+ + Got it! diff --git a/app/src/main/res/values-ru/help.xml b/app/src/main/res/values-ru/help.xml index 3e9d1f1..d1c80a6 100644 --- a/app/src/main/res/values-ru/help.xml +++ b/app/src/main/res/values-ru/help.xml @@ -300,4 +300,17 @@ ]]> + + Using a payment link +

You have started monerujo with a payment link. In order to send funds, please do the following:

+

+ 1. Open the wallet you want to spend from
+ 2. Wait until the wallet is synced & the "Give" button appears
+ 3. Touch the "Give" button +

+

The payment details will be filled in. Check them and proceed like for any other transaction.

+ ]]>
+ + Got it! diff --git a/app/src/main/res/values-sk/help.xml b/app/src/main/res/values-sk/help.xml index e0dac53..4add68e 100644 --- a/app/src/main/res/values-sk/help.xml +++ b/app/src/main/res/values-sk/help.xml @@ -259,4 +259,16 @@ V prípade, že nemáte žiadne uzly vo svojich záložkách, Monerujo bude skúšať uzly (seed nodes) natvrdo zapísané v kóde Monero. Vyhľadávanie končí ak Monerujo nájde aspoň 10 vzdialených uzlov.

]]> + Using a payment link +

You have started monerujo with a payment link. In order to send funds, please do the following:

+

+ 1. Open the wallet you want to spend from
+ 2. Wait until the wallet is synced & the "Give" button appears
+ 3. Touch the "Give" button +

+

The payment details will be filled in. Check them and proceed like for any other transaction.

+ ]]>
+ + Got it! diff --git a/app/src/main/res/values-sv/help.xml b/app/src/main/res/values-sv/help.xml index a9b3a01..b4314d7 100644 --- a/app/src/main/res/values-sv/help.xml +++ b/app/src/main/res/values-sv/help.xml @@ -277,4 +277,17 @@ ]]> + + Using a payment link +

You have started monerujo with a payment link. In order to send funds, please do the following:

+

+ 1. Open the wallet you want to spend from
+ 2. Wait until the wallet is synced & the "Give" button appears
+ 3. Touch the "Give" button +

+

The payment details will be filled in. Check them and proceed like for any other transaction.

+ ]]>
+ + Got it! diff --git a/app/src/main/res/values-ua/help.xml b/app/src/main/res/values-ua/help.xml index 81a5aae..8862ac5 100644 --- a/app/src/main/res/values-ua/help.xml +++ b/app/src/main/res/values-ua/help.xml @@ -1,4 +1,4 @@ -\" + Створити гаманець - Новий @@ -291,4 +291,17 @@ https://getmonero.org/resources/moneropedia/change.html Monerujo will go straight to the Monero seed nodes hardcoded into Monero. The scan stops when it finds 10 remote nodes in total.

]]>
+ + Using a payment link +

You have started monerujo with a payment link. In order to send funds, please do the following:

+

+ 1. Open the wallet you want to spend from
+ 2. Wait until the wallet is synced & the "Give" button appears
+ 3. Touch the "Give" button +

+

The payment details will be filled in. Check them and proceed like for any other transaction.

+ ]]>
+ + Got it!
diff --git a/app/src/main/res/values-zh-rCN/help.xml b/app/src/main/res/values-zh-rCN/help.xml index 150cbce..4202936 100644 --- a/app/src/main/res/values-zh-rCN/help.xml +++ b/app/src/main/res/values-zh-rCN/help.xml @@ -255,4 +255,17 @@ ]]> + + Using a payment link +

You have started monerujo with a payment link. In order to send funds, please do the following:

+

+ 1. Open the wallet you want to spend from
+ 2. Wait until the wallet is synced & the "Give" button appears
+ 3. Touch the "Give" button +

+

The payment details will be filled in. Check them and proceed like for any other transaction.

+ ]]>
+ + Got it! diff --git a/app/src/main/res/values-zh-rTW/help.xml b/app/src/main/res/values-zh-rTW/help.xml index f0b7004..7ef0965 100644 --- a/app/src/main/res/values-zh-rTW/help.xml +++ b/app/src/main/res/values-zh-rTW/help.xml @@ -224,4 +224,17 @@ 如果你沒有任何書籤節點 (或是書籤節點無法提供它們的連接清單),Monerujo 將會直接從 Monero 內建的種子節點取得清單。 這個掃描功能將會在總共可用節點的數量達到十個後停止。

]]> + + Using a payment link +

You have started monerujo with a payment link. In order to send funds, please do the following:

+

+ 1. Open the wallet you want to spend from
+ 2. Wait until the wallet is synced & the "Give" button appears
+ 3. Touch the "Give" button +

+

The payment details will be filled in. Check them and proceed like for any other transaction.

+ ]]>
+ + Got it! diff --git a/app/src/main/res/values/help.xml b/app/src/main/res/values/help.xml index b619f54..7c36802 100644 --- a/app/src/main/res/values/help.xml +++ b/app/src/main/res/values/help.xml @@ -292,4 +292,17 @@ Monerujo will go straight to the Monero seed nodes hardcoded into Monero. The scan stops when it finds 10 remote nodes in total.

]]> + + Using a payment link +

You have started monerujo with a payment link. In order to send funds, please do the following:

+

+ 1. Open the wallet you want to spend from
+ 2. Wait until the wallet is synced & the "Give" button appears
+ 3. Touch the "Give" button +

+

The payment details will be filled in. Check them and proceed like for any other transaction.

+ ]]>
+ + Got it! diff --git a/app/src/stagenet/res/values/strings.xml b/app/src/stagenet/res/values/strings.xml index 43ca805..c816438 100644 --- a/app/src/stagenet/res/values/strings.xml +++ b/app/src/stagenet/res/values/strings.xml @@ -1,4 +1,4 @@ - Stagenet + monerujo Stagenet \ No newline at end of file