open on monero: & bitcoin: uri (#532)

This commit is contained in:
m2049r 2019-02-14 23:34:38 +01:00 committed by GitHub
parent 9385ac8c31
commit 445d8acc38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 343 additions and 8 deletions

View File

@ -42,6 +42,22 @@
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.VIEW" />
<data android:scheme="monero" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.VIEW" />
<data android:scheme="bitcoin" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/usb_device_filter" />

View File

@ -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);
}
}
}

View File

@ -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

View File

@ -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) {

View File

@ -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;
}

View File

@ -289,4 +289,17 @@
]]></string>
<!-- Note for translators: new/changed text also in help_send -->
<string name="help_uri"><![CDATA[
<h1>Using a payment link</h1>
<p>You have started monerujo with a payment link. In order to send funds, please do the following:</p>
<p>
1. Open the wallet you want to spend from<br>
2. Wait until the wallet is synced &amp; the "Give" button appears<br>
3. Touch the "Give" button
</p>
<p>The payment details will be filled in. Check them and proceed like for any other transaction.</p>
]]></string>
<string name="help_ok">Got it!</string> <!-- Note: "Got it" as in "I understand this" -->
</resources>

View File

@ -274,4 +274,17 @@
]]></string>
<!-- Note for translators: new/changed text also in help_send -->
<string name="help_uri"><![CDATA[
<h1>Using a payment link</h1>
<p>You have started monerujo with a payment link. In order to send funds, please do the following:</p>
<p>
1. Open the wallet you want to spend from<br>
2. Wait until the wallet is synced &amp; the "Give" button appears<br>
3. Touch the "Give" button
</p>
<p>The payment details will be filled in. Check them and proceed like for any other transaction.</p>
]]></string>
<string name="help_ok">Got it!</string> <!-- Note: "Got it" as in "I understand this" -->
</resources>

View File

@ -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.</p>
]]></string>
<string name="help_uri"><![CDATA[
<h1>Using a payment link</h1>
<p>You have started monerujo with a payment link. In order to send funds, please do the following:</p>
<p>
1. Open the wallet you want to spend from<br>
2. Wait until the wallet is synced &amp; the "Give" button appears<br>
3. Touch the "Give" button
</p>
<p>The payment details will be filled in. Check them and proceed like for any other transaction.</p>
]]></string>
<string name="help_ok">Got it!</string> <!-- Note: "Got it" as in "I understand this" -->
</resources>

View File

@ -314,4 +314,17 @@
]]></string>
<!-- Note for translators: new/changed text also in help_send -->
<string name="help_uri"><![CDATA[
<h1>Using a payment link</h1>
<p>You have started monerujo with a payment link. In order to send funds, please do the following:</p>
<p>
1. Open the wallet you want to spend from<br>
2. Wait until the wallet is synced &amp; the "Give" button appears<br>
3. Touch the "Give" button
</p>
<p>The payment details will be filled in. Check them and proceed like for any other transaction.</p>
]]></string>
<string name="help_ok">Got it!</string> <!-- Note: "Got it" as in "I understand this" -->
</resources>

View File

@ -306,4 +306,17 @@
]]></string>
<!-- Note for translators: new/changed text also in help_send -->
<string name="help_uri"><![CDATA[
<h1>Using a payment link</h1>
<p>You have started monerujo with a payment link. In order to send funds, please do the following:</p>
<p>
1. Open the wallet you want to spend from<br>
2. Wait until the wallet is synced &amp; the "Give" button appears<br>
3. Touch the "Give" button
</p>
<p>The payment details will be filled in. Check them and proceed like for any other transaction.</p>
]]></string>
<string name="help_ok">Got it!</string> <!-- Note: "Got it" as in "I understand this" -->
</resources>

View File

@ -311,4 +311,17 @@
]]></string>
<!-- Note for translators: new/changed text also in help_send -->
<string name="help_uri"><![CDATA[
<h1>Using a payment link</h1>
<p>You have started monerujo with a payment link. In order to send funds, please do the following:</p>
<p>
1. Open the wallet you want to spend from<br>
2. Wait until the wallet is synced &amp; the "Give" button appears<br>
3. Touch the "Give" button
</p>
<p>The payment details will be filled in. Check them and proceed like for any other transaction.</p>
]]></string>
<string name="help_ok">Got it!</string> <!-- Note: "Got it" as in "I understand this" -->
</resources>

View File

@ -296,4 +296,17 @@
]]></string>
<!-- Note for translators: new/changed text also in help_send -->
<string name="help_uri"><![CDATA[
<h1>Using a payment link</h1>
<p>You have started monerujo with a payment link. In order to send funds, please do the following:</p>
<p>
1. Open the wallet you want to spend from<br>
2. Wait until the wallet is synced &amp; the "Give" button appears<br>
3. Touch the "Give" button
</p>
<p>The payment details will be filled in. Check them and proceed like for any other transaction.</p>
]]></string>
<string name="help_ok">Got it!</string> <!-- Note: "Got it" as in "I understand this" -->
</resources>

View File

@ -293,4 +293,17 @@
]]></string>
<!-- Note for translators: new/changed text also in help_send -->
<string name="help_uri"><![CDATA[
<h1>Using a payment link</h1>
<p>You have started monerujo with a payment link. In order to send funds, please do the following:</p>
<p>
1. Open the wallet you want to spend from<br>
2. Wait until the wallet is synced &amp; the "Give" button appears<br>
3. Touch the "Give" button
</p>
<p>The payment details will be filled in. Check them and proceed like for any other transaction.</p>
]]></string>
<string name="help_ok">Got it!</string> <!-- Note: "Got it" as in "I understand this" -->
</resources>

View File

@ -429,4 +429,17 @@
]]></string>
<!-- Note for translators: new/changed text also in help_send -->
<string name="help_uri"><![CDATA[
<h1>Using a payment link</h1>
<p>You have started monerujo with a payment link. In order to send funds, please do the following:</p>
<p>
1. Open the wallet you want to spend from<br>
2. Wait until the wallet is synced &amp; the "Give" button appears<br>
3. Touch the "Give" button
</p>
<p>The payment details will be filled in. Check them and proceed like for any other transaction.</p>
]]></string>
<string name="help_ok">Got it!</string> <!-- Note: "Got it" as in "I understand this" -->
</resources>

View File

@ -294,4 +294,17 @@
]]></string>
<!-- Note for translators: new/changed text also in help_send -->
<string name="help_uri"><![CDATA[
<h1>Using a payment link</h1>
<p>You have started monerujo with a payment link. In order to send funds, please do the following:</p>
<p>
1. Open the wallet you want to spend from<br>
2. Wait until the wallet is synced &amp; the "Give" button appears<br>
3. Touch the "Give" button
</p>
<p>The payment details will be filled in. Check them and proceed like for any other transaction.</p>
]]></string>
<string name="help_ok">Got it!</string> <!-- Note: "Got it" as in "I understand this" -->
</resources>

View File

@ -222,4 +222,17 @@
]]></string>
<!-- Note for translators: new/changed text also in help_send -->
<string name="help_uri"><![CDATA[
<h1>Using a payment link</h1>
<p>You have started monerujo with a payment link. In order to send funds, please do the following:</p>
<p>
1. Open the wallet you want to spend from<br>
2. Wait until the wallet is synced &amp; the "Give" button appears<br>
3. Touch the "Give" button
</p>
<p>The payment details will be filled in. Check them and proceed like for any other transaction.</p>
]]></string>
<string name="help_ok">Got it!</string> <!-- Note: "Got it" as in "I understand this" -->
</resources>

View File

@ -289,4 +289,17 @@
]]></string>
<!-- Note for translators: new/changed text also in help_send -->
<string name="help_uri"><![CDATA[
<h1>Using a payment link</h1>
<p>You have started monerujo with a payment link. In order to send funds, please do the following:</p>
<p>
1. Open the wallet you want to spend from<br>
2. Wait until the wallet is synced &amp; the "Give" button appears<br>
3. Touch the "Give" button
</p>
<p>The payment details will be filled in. Check them and proceed like for any other transaction.</p>
]]></string>
<string name="help_ok">Got it!</string> <!-- Note: "Got it" as in "I understand this" -->
</resources>

View File

@ -297,4 +297,17 @@
]]></string>
<!-- Note for translators: new/changed text also in help_send -->
<string name="help_uri"><![CDATA[
<h1>Using a payment link</h1>
<p>You have started monerujo with a payment link. In order to send funds, please do the following:</p>
<p>
1. Open the wallet you want to spend from<br>
2. Wait until the wallet is synced &amp; the "Give" button appears<br>
3. Touch the "Give" button
</p>
<p>The payment details will be filled in. Check them and proceed like for any other transaction.</p>
]]></string>
<string name="help_ok">Got it!</string> <!-- Note: "Got it" as in "I understand this" -->
</resources>

View File

@ -282,4 +282,17 @@
]]></string>
<!-- Note for translators: new/changed text also in help_send -->
<string name="help_uri"><![CDATA[
<h1>Using a payment link</h1>
<p>You have started monerujo with a payment link. In order to send funds, please do the following:</p>
<p>
1. Open the wallet you want to spend from<br>
2. Wait until the wallet is synced &amp; the "Give" button appears<br>
3. Touch the "Give" button
</p>
<p>The payment details will be filled in. Check them and proceed like for any other transaction.</p>
]]></string>
<string name="help_ok">Got it!</string> <!-- Note: "Got it" as in "I understand this" -->
</resources>

View File

@ -300,4 +300,17 @@
]]></string>
<!-- Note for translators: new/changed text also in help_send -->
<string name="help_uri"><![CDATA[
<h1>Using a payment link</h1>
<p>You have started monerujo with a payment link. In order to send funds, please do the following:</p>
<p>
1. Open the wallet you want to spend from<br>
2. Wait until the wallet is synced &amp; the "Give" button appears<br>
3. Touch the "Give" button
</p>
<p>The payment details will be filled in. Check them and proceed like for any other transaction.</p>
]]></string>
<string name="help_ok">Got it!</string> <!-- Note: "Got it" as in "I understand this" -->
</resources>

View File

@ -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.</p>
]]></string>
<string name="help_uri"><![CDATA[
<h1>Using a payment link</h1>
<p>You have started monerujo with a payment link. In order to send funds, please do the following:</p>
<p>
1. Open the wallet you want to spend from<br>
2. Wait until the wallet is synced &amp; the "Give" button appears<br>
3. Touch the "Give" button
</p>
<p>The payment details will be filled in. Check them and proceed like for any other transaction.</p>
]]></string>
<string name="help_ok">Got it!</string> <!-- Note: "Got it" as in "I understand this" -->
</resources>

View File

@ -277,4 +277,17 @@
]]></string>
<!-- Note for translators: new/changed text also in help_send -->
<string name="help_uri"><![CDATA[
<h1>Using a payment link</h1>
<p>You have started monerujo with a payment link. In order to send funds, please do the following:</p>
<p>
1. Open the wallet you want to spend from<br>
2. Wait until the wallet is synced &amp; the "Give" button appears<br>
3. Touch the "Give" button
</p>
<p>The payment details will be filled in. Check them and proceed like for any other transaction.</p>
]]></string>
<string name="help_ok">Got it!</string> <!-- Note: "Got it" as in "I understand this" -->
</resources>

View File

@ -1,4 +1,4 @@
\"<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="help_create_new"><![CDATA[
<h1>Створити гаманець - Новий</h1>
@ -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.</p>
]]></string>
<string name="help_uri"><![CDATA[
<h1>Using a payment link</h1>
<p>You have started monerujo with a payment link. In order to send funds, please do the following:</p>
<p>
1. Open the wallet you want to spend from<br>
2. Wait until the wallet is synced &amp; the "Give" button appears<br>
3. Touch the "Give" button
</p>
<p>The payment details will be filled in. Check them and proceed like for any other transaction.</p>
]]></string>
<string name="help_ok">Got it!</string> <!-- Note: "Got it" as in "I understand this" -->
</resources>

View File

@ -255,4 +255,17 @@
]]></string>
<!-- Note for translators: new/changed text also in help_send -->
<string name="help_uri"><![CDATA[
<h1>Using a payment link</h1>
<p>You have started monerujo with a payment link. In order to send funds, please do the following:</p>
<p>
1. Open the wallet you want to spend from<br>
2. Wait until the wallet is synced &amp; the "Give" button appears<br>
3. Touch the "Give" button
</p>
<p>The payment details will be filled in. Check them and proceed like for any other transaction.</p>
]]></string>
<string name="help_ok">Got it!</string> <!-- Note: "Got it" as in "I understand this" -->
</resources>

View File

@ -224,4 +224,17 @@
如果你沒有任何書籤節點 (或是書籤節點無法提供它們的連接清單)Monerujo 將會直接從 Monero 內建的種子節點取得清單。
這個掃描功能將會在總共可用節點的數量達到十個後停止。</p>
]]></string>
<string name="help_uri"><![CDATA[
<h1>Using a payment link</h1>
<p>You have started monerujo with a payment link. In order to send funds, please do the following:</p>
<p>
1. Open the wallet you want to spend from<br>
2. Wait until the wallet is synced &amp; the "Give" button appears<br>
3. Touch the "Give" button
</p>
<p>The payment details will be filled in. Check them and proceed like for any other transaction.</p>
]]></string>
<string name="help_ok">Got it!</string> <!-- Note: "Got it" as in "I understand this" -->
</resources>

View File

@ -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.</p>
]]></string>
<string name="help_uri"><![CDATA[
<h1>Using a payment link</h1>
<p>You have started monerujo with a payment link. In order to send funds, please do the following:</p>
<p>
1. Open the wallet you want to spend from<br>
2. Wait until the wallet is synced &amp; the "Give" button appears<br>
3. Touch the "Give" button
</p>
<p>The payment details will be filled in. Check them and proceed like for any other transaction.</p>
]]></string>
<string name="help_ok">Got it!</string> <!-- Note: "Got it" as in "I understand this" -->
</resources>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" translatable="false">Stagenet</string>
<string name="app_name" translatable="false">monerujo Stagenet</string>
</resources>