mirror of
https://github.com/m2049r/xmrwallet
synced 2025-09-06 02:27:11 +02:00
Compare commits
37 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
16ff779ebc | ||
![]() |
6b7bb164f4 | ||
![]() |
da1d4ea1bf | ||
![]() |
d5a967f690 | ||
![]() |
de8de02f9f | ||
![]() |
06456e33e4 | ||
![]() |
d97b36aa44 | ||
![]() |
8fa06e5b37 | ||
![]() |
8d95de828b | ||
![]() |
93a7be0452 | ||
![]() |
25c8ec1229 | ||
![]() |
0bf0444dce | ||
![]() |
b74f9c6bd7 | ||
![]() |
f843bb1685 | ||
![]() |
7d9d49c29e | ||
![]() |
4ca9328949 | ||
![]() |
08b5a87f19 | ||
![]() |
445d8acc38 | ||
![]() |
9385ac8c31 | ||
![]() |
4c7ebd8402 | ||
![]() |
67f3c5f948 | ||
![]() |
cd67a7e2bf | ||
![]() |
fa5fe313ea | ||
![]() |
ed4957a3cc | ||
![]() |
3e0eeebd51 | ||
![]() |
0d213a1eb4 | ||
![]() |
39d048fd5e | ||
![]() |
1a5d2d0399 | ||
![]() |
028057a672 | ||
![]() |
909ff8ca5e | ||
![]() |
ffd61e4495 | ||
![]() |
003dee382e | ||
![]() |
be0498c67d | ||
![]() |
06227a4a83 | ||
![]() |
4409087bd0 | ||
![]() |
965e52d8a5 | ||
![]() |
beba0f497b |
@@ -3,11 +3,13 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
working_directory: ~/code
|
working_directory: ~/code
|
||||||
docker:
|
docker:
|
||||||
- image: bitriseio/android-ndk
|
- image: circleci/android:api-28-ndk
|
||||||
environment:
|
environment:
|
||||||
JVM_OPTS: -Xmx3200m
|
JVM_OPTS: -Xmx3200m
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
|
- run: yes | sdkmanager --licenses || exit 0
|
||||||
|
- run: yes | sdkmanager --update || exit 0
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
|
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
|
||||||
- run:
|
- run:
|
||||||
|
3
.idea/.gitignore
generated
vendored
3
.idea/.gitignore
generated
vendored
@@ -1,3 +0,0 @@
|
|||||||
workspace.xml
|
|
||||||
markdown-*
|
|
||||||
misc.xml
|
|
1
.idea/.name
generated
1
.idea/.name
generated
@@ -1 +0,0 @@
|
|||||||
xmrwallet
|
|
22
.idea/compiler.xml
generated
22
.idea/compiler.xml
generated
@@ -1,22 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="CompilerConfiguration">
|
|
||||||
<resourceExtensions />
|
|
||||||
<wildcardResourcePatterns>
|
|
||||||
<entry name="!?*.java" />
|
|
||||||
<entry name="!?*.form" />
|
|
||||||
<entry name="!?*.class" />
|
|
||||||
<entry name="!?*.groovy" />
|
|
||||||
<entry name="!?*.scala" />
|
|
||||||
<entry name="!?*.flex" />
|
|
||||||
<entry name="!?*.kt" />
|
|
||||||
<entry name="!?*.clj" />
|
|
||||||
<entry name="!?*.aj" />
|
|
||||||
</wildcardResourcePatterns>
|
|
||||||
<annotationProcessing>
|
|
||||||
<profile default="true" name="Default" enabled="false">
|
|
||||||
<processorPath useClasspath="true" />
|
|
||||||
</profile>
|
|
||||||
</annotationProcessing>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
3
.idea/copyright/profiles_settings.xml
generated
3
.idea/copyright/profiles_settings.xml
generated
@@ -1,3 +0,0 @@
|
|||||||
<component name="CopyrightManager">
|
|
||||||
<settings default="" />
|
|
||||||
</component>
|
|
19
.idea/gradle.xml
generated
19
.idea/gradle.xml
generated
@@ -1,19 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="GradleSettings">
|
|
||||||
<option name="linkedExternalProjectsSettings">
|
|
||||||
<GradleProjectSettings>
|
|
||||||
<option name="disableWrapperSourceDistributionNotification" value="true" />
|
|
||||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
|
||||||
<option name="modules">
|
|
||||||
<set>
|
|
||||||
<option value="$PROJECT_DIR$" />
|
|
||||||
<option value="$PROJECT_DIR$/app" />
|
|
||||||
</set>
|
|
||||||
</option>
|
|
||||||
<option name="resolveModulePerSourceSet" value="false" />
|
|
||||||
</GradleProjectSettings>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
9
.idea/modules.xml
generated
9
.idea/modules.xml
generated
@@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/xmrwallet.iml" filepath="$PROJECT_DIR$/xmrwallet.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
12
.idea/runConfigurations.xml
generated
12
.idea/runConfigurations.xml
generated
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="RunConfigurationProducerService">
|
|
||||||
<option name="ignoredProducers">
|
|
||||||
<set>
|
|
||||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
|
||||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
|
||||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
|
||||||
</set>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
6
.idea/vcs.xml
generated
6
.idea/vcs.xml
generated
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@@ -7,8 +7,8 @@ android {
|
|||||||
applicationId "com.m2049r.xmrwallet"
|
applicationId "com.m2049r.xmrwallet"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 162
|
versionCode 173
|
||||||
versionName "1.10.12 'Node-O-matiC'"
|
versionName "1.11.3 'Chernushka'"
|
||||||
|
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
@@ -113,10 +113,16 @@ dependencies {
|
|||||||
implementation 'dnsjava:dnsjava:2.1.8'
|
implementation 'dnsjava:dnsjava:2.1.8'
|
||||||
implementation 'org.jitsi:dnssecjava:1.1.3'
|
implementation 'org.jitsi:dnssecjava:1.1.3'
|
||||||
implementation 'org.slf4j:slf4j-nop:1.7.25'
|
implementation 'org.slf4j:slf4j-nop:1.7.25'
|
||||||
|
implementation 'com.github.brnunes:swipeablerecyclerview:1.0.2'
|
||||||
|
|
||||||
|
// https://mvnrepository.com/artifact/com.github.aelstad/keccakj
|
||||||
|
implementation 'com.github.aelstad:keccakj:1.1.0'
|
||||||
|
|
||||||
|
|
||||||
testImplementation "junit:junit:$rootProject.ext.junitVersion"
|
testImplementation "junit:junit:$rootProject.ext.junitVersion"
|
||||||
testImplementation "org.mockito:mockito-all:$rootProject.ext.mockitoVersion"
|
testImplementation "org.mockito:mockito-all:$rootProject.ext.mockitoVersion"
|
||||||
testImplementation "com.squareup.okhttp3:mockwebserver:$rootProject.ext.okHttpVersion"
|
testImplementation "com.squareup.okhttp3:mockwebserver:$rootProject.ext.okHttpVersion"
|
||||||
testImplementation 'org.json:json:20140107'
|
testImplementation 'org.json:json:20180813'
|
||||||
testImplementation 'net.jodah:concurrentunit:0.4.2'
|
testImplementation 'net.jodah:concurrentunit:0.4.4'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -26,14 +26,14 @@
|
|||||||
android:configChanges="orientation|keyboardHidden"
|
android:configChanges="orientation|keyboardHidden"
|
||||||
android:label="@string/wallet_activity_name"
|
android:label="@string/wallet_activity_name"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="behind" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".LoginActivity"
|
android:name=".LoginActivity"
|
||||||
android:configChanges="orientation|keyboardHidden"
|
android:configChanges="orientation|keyboardHidden"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:screenOrientation="portrait">
|
android:screenOrientation="locked">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
@@ -42,6 +42,22 @@
|
|||||||
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
|
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
|
||||||
</intent-filter>
|
</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
|
<meta-data
|
||||||
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
|
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
|
||||||
android:resource="@xml/usb_device_filter" />
|
android:resource="@xml/usb_device_filter" />
|
||||||
@@ -52,5 +68,15 @@
|
|||||||
android:description="@string/service_description"
|
android:description="@string/service_description"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:label="Monero Wallet Service" />
|
android:label="Monero Wallet Service" />
|
||||||
|
|
||||||
|
<provider
|
||||||
|
android:name="android.support.v4.content.FileProvider"
|
||||||
|
android:authorities="${applicationId}.fileprovider"
|
||||||
|
android:exported="false"
|
||||||
|
android:grantUriPermissions="true">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
|
android:resource="@xml/filepaths" />
|
||||||
|
</provider>
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
@@ -43,6 +43,9 @@ Copyright (c) 2014 Dushyanth Maguluru
|
|||||||
<h3>AndroidLicensesPage (https://github.com/adamsp/AndroidLicensesPage)</h3>
|
<h3>AndroidLicensesPage (https://github.com/adamsp/AndroidLicensesPage)</h3>
|
||||||
Copyright (c) 2013 Adam Speakman
|
Copyright (c) 2013 Adam Speakman
|
||||||
|
|
||||||
|
<h3>SwipeableRecyclerView (https://github.com/brnunes/SwipeableRecyclerView)</h3>
|
||||||
|
Copyright (c) 2015 Bruno R. Nunes
|
||||||
|
|
||||||
<h3>Apache License, Version 2.0, January 2004</h3>
|
<h3>Apache License, Version 2.0, January 2004</h3>
|
||||||
http://www.apache.org/licenses/<br/>
|
http://www.apache.org/licenses/<br/>
|
||||||
<br/>
|
<br/>
|
||||||
|
@@ -442,12 +442,6 @@ Java_com_m2049r_xmrwallet_model_WalletManager_findWallets(JNIEnv *env, jobject i
|
|||||||
return cpp2java(env, walletPaths);
|
return cpp2java(env, walletPaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL
|
|
||||||
Java_com_m2049r_xmrwallet_model_WalletManager_getErrorString(JNIEnv *env, jobject instance) {
|
|
||||||
Bitmonero::Wallet *wallet = getHandle<Bitmonero::Wallet>(env, instance);
|
|
||||||
return env->NewStringUTF(wallet->errorString().c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO virtual bool checkPayment(const std::string &address, const std::string &txid, const std::string &txkey, const std::string &daemon_address, uint64_t &received, uint64_t &height, std::string &error) const = 0;
|
//TODO virtual bool checkPayment(const std::string &address, const std::string &txid, const std::string &txkey, const std::string &daemon_address, uint64_t &received, uint64_t &height, std::string &error) const = 0;
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
|
@@ -60,14 +60,14 @@ enum {
|
|||||||
HASH_DATA_AREA = 136
|
HASH_DATA_AREA = 136
|
||||||
};
|
};
|
||||||
|
|
||||||
void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int prehashed);
|
void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int prehashed, uint64_t height);
|
||||||
|
|
||||||
inline void slow_hash(const void *data, const size_t length, char *hash) {
|
inline void slow_hash(const void *data, const size_t length, char *hash) {
|
||||||
cn_slow_hash(data, length, hash, 0 /* variant */, 0/*prehashed*/);
|
cn_slow_hash(data, length, hash, 0 /*variant*/, 0 /*prehashed*/, 0 /*height*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void slow_hash_broken(const void *data, char *hash, int variant) {
|
inline void slow_hash_broken(const void *data, char *hash, int variant) {
|
||||||
cn_slow_hash(data, 200 /*sizeof(union hash_state)*/, hash, variant, 1 /*prehashed*/);
|
cn_slow_hash(data, 200 /*sizeof(union hash_state)*/, hash, variant, 1 /*prehashed*/, 0 /*height*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@@ -173,10 +173,10 @@ public class LevinReader {
|
|||||||
|
|
||||||
// this should be in LittleEndianDataInputStream because it has little
|
// this should be in LittleEndianDataInputStream because it has little
|
||||||
// endian logic
|
// endian logic
|
||||||
private long readRest(int firstByte, int bytes) throws IOException {
|
private long readRest(final int firstByte, final int bytes) throws IOException {
|
||||||
long result = firstByte;
|
long result = firstByte;
|
||||||
for (int i = 0; i < bytes; i++) {
|
for (int i = 1; i < bytes + 1; i++) {
|
||||||
result = result + (in.readUnsignedByte() << 8);
|
result = result + (((long) in.readUnsignedByte()) << (8 * i));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.m2049r.xmrwallet;
|
package com.m2049r.xmrwallet;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
@@ -33,6 +34,7 @@ import android.view.Menu;
|
|||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
@@ -45,6 +47,7 @@ import com.m2049r.xmrwallet.util.FingerprintHelper;
|
|||||||
import com.m2049r.xmrwallet.util.Helper;
|
import com.m2049r.xmrwallet.util.Helper;
|
||||||
import com.m2049r.xmrwallet.util.KeyStoreHelper;
|
import com.m2049r.xmrwallet.util.KeyStoreHelper;
|
||||||
import com.m2049r.xmrwallet.util.RestoreHeight;
|
import com.m2049r.xmrwallet.util.RestoreHeight;
|
||||||
|
import com.m2049r.xmrwallet.util.ledger.Monero;
|
||||||
import com.m2049r.xmrwallet.widget.Toolbar;
|
import com.m2049r.xmrwallet.widget.Toolbar;
|
||||||
import com.nulabinc.zxcvbn.Strength;
|
import com.nulabinc.zxcvbn.Strength;
|
||||||
import com.nulabinc.zxcvbn.Zxcvbn;
|
import com.nulabinc.zxcvbn.Zxcvbn;
|
||||||
@@ -95,7 +98,6 @@ public class GenerateFragment extends Fragment {
|
|||||||
etWalletRestoreHeight = view.findViewById(R.id.etWalletRestoreHeight);
|
etWalletRestoreHeight = view.findViewById(R.id.etWalletRestoreHeight);
|
||||||
bGenerate = view.findViewById(R.id.bGenerate);
|
bGenerate = view.findViewById(R.id.bGenerate);
|
||||||
|
|
||||||
etWalletMnemonic.getEditText().setRawInputType(InputType.TYPE_CLASS_TEXT);
|
|
||||||
etWalletAddress.getEditText().setRawInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
etWalletAddress.getEditText().setRawInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
||||||
etWalletViewKey.getEditText().setRawInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
etWalletViewKey.getEditText().setRawInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
||||||
etWalletSpendKey.getEditText().setRawInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
etWalletSpendKey.getEditText().setRawInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
||||||
@@ -241,9 +243,7 @@ public class GenerateFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
etWalletAddress.setVisibility(View.VISIBLE);
|
etWalletAddress.setVisibility(View.VISIBLE);
|
||||||
etWalletAddress.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener()
|
etWalletAddress.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||||
|
|
||||||
{
|
|
||||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER) && (event.getAction() == KeyEvent.ACTION_DOWN))
|
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER) && (event.getAction() == KeyEvent.ACTION_DOWN))
|
||||||
|| (actionId == EditorInfo.IME_ACTION_NEXT)) {
|
|| (actionId == EditorInfo.IME_ACTION_NEXT)) {
|
||||||
@@ -275,9 +275,7 @@ public class GenerateFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
if (type.equals(TYPE_KEY)) {
|
if (type.equals(TYPE_KEY)) {
|
||||||
etWalletSpendKey.setVisibility(View.VISIBLE);
|
etWalletSpendKey.setVisibility(View.VISIBLE);
|
||||||
etWalletSpendKey.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener()
|
etWalletSpendKey.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||||
|
|
||||||
{
|
|
||||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||||
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER) && (event.getAction() == KeyEvent.ACTION_DOWN))
|
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER) && (event.getAction() == KeyEvent.ACTION_DOWN))
|
||||||
|| (actionId == EditorInfo.IME_ACTION_NEXT)) {
|
|| (actionId == EditorInfo.IME_ACTION_NEXT)) {
|
||||||
@@ -304,9 +302,7 @@ public class GenerateFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
bGenerate.setOnClickListener(new View.OnClickListener()
|
bGenerate.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Helper.hideKeyboard(getActivity());
|
Helper.hideKeyboard(getActivity());
|
||||||
@@ -617,4 +613,80 @@ public class GenerateFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
super.onCreateOptionsMenu(menu, inflater);
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AlertDialog ledgerDialog = null;
|
||||||
|
|
||||||
|
public void convertLedgerSeed() {
|
||||||
|
if (ledgerDialog != null) return;
|
||||||
|
final Activity activity = getActivity();
|
||||||
|
View promptsView = getLayoutInflater().inflate(R.layout.prompt_ledger_seed, null);
|
||||||
|
android.app.AlertDialog.Builder alertDialogBuilder = new android.app.AlertDialog.Builder(activity);
|
||||||
|
alertDialogBuilder.setView(promptsView);
|
||||||
|
|
||||||
|
final TextInputLayout etSeed = promptsView.findViewById(R.id.etSeed);
|
||||||
|
final TextInputLayout etPassphrase = promptsView.findViewById(R.id.etPassphrase);
|
||||||
|
|
||||||
|
etSeed.getEditText().addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
if (etSeed.getError() != null) {
|
||||||
|
etSeed.setError(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start,
|
||||||
|
int count, int after) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start,
|
||||||
|
int before, int count) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
alertDialogBuilder
|
||||||
|
.setCancelable(false)
|
||||||
|
.setPositiveButton(getString(R.string.label_ok), null)
|
||||||
|
.setNegativeButton(getString(R.string.label_cancel),
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
Helper.hideKeyboardAlways(activity);
|
||||||
|
etWalletMnemonic.getEditText().getText().clear();
|
||||||
|
dialog.cancel();
|
||||||
|
ledgerDialog = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ledgerDialog = alertDialogBuilder.create();
|
||||||
|
|
||||||
|
ledgerDialog.setOnShowListener(new DialogInterface.OnShowListener() {
|
||||||
|
@Override
|
||||||
|
public void onShow(DialogInterface dialog) {
|
||||||
|
Button button = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE);
|
||||||
|
button.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
String ledgerSeed = etSeed.getEditText().getText().toString();
|
||||||
|
String ledgerPassphrase = etPassphrase.getEditText().getText().toString();
|
||||||
|
String moneroSeed = Monero.convert(ledgerSeed, ledgerPassphrase);
|
||||||
|
if (moneroSeed != null) {
|
||||||
|
etWalletMnemonic.getEditText().setText(moneroSeed);
|
||||||
|
ledgerDialog.dismiss();
|
||||||
|
ledgerDialog = null;
|
||||||
|
} else {
|
||||||
|
etSeed.setError(getString(R.string.bad_ledger_seed));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// set FLAG_SECURE to prevent screenshots in Release Mode
|
||||||
|
if (!(BuildConfig.DEBUG && BuildConfig.FLAVOR_type.equals("alpha"))) {
|
||||||
|
ledgerDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
ledgerDialog.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -33,6 +33,7 @@ import android.view.Menu;
|
|||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
@@ -620,6 +621,11 @@ public class GenerateReviewFragment extends Fragment {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// set FLAG_SECURE to prevent screenshots in Release Mode
|
||||||
|
if (!(BuildConfig.DEBUG && BuildConfig.FLAVOR_type.equals("alpha"))) {
|
||||||
|
openDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
|
||||||
|
}
|
||||||
|
|
||||||
return openDialog;
|
return openDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -269,7 +269,11 @@ public class LoginActivity extends BaseActivity
|
|||||||
} else {
|
} else {
|
||||||
Timber.i("Waiting for permissions");
|
Timber.i("Waiting for permissions");
|
||||||
}
|
}
|
||||||
processUsbIntent(getIntent());
|
|
||||||
|
// try intents
|
||||||
|
Intent intent = getIntent();
|
||||||
|
if (!processUsbIntent(intent))
|
||||||
|
processUriIntent(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean checkServiceRunning() {
|
boolean checkServiceRunning() {
|
||||||
@@ -716,6 +720,10 @@ public class LoginActivity extends BaseActivity
|
|||||||
intent.putExtra(WalletActivity.REQUEST_PW, walletPassword);
|
intent.putExtra(WalletActivity.REQUEST_PW, walletPassword);
|
||||||
intent.putExtra(WalletActivity.REQUEST_FINGERPRINT_USED, fingerprintUsed);
|
intent.putExtra(WalletActivity.REQUEST_FINGERPRINT_USED, fingerprintUsed);
|
||||||
intent.putExtra(WalletActivity.REQUEST_STREETMODE, streetmode);
|
intent.putExtra(WalletActivity.REQUEST_STREETMODE, streetmode);
|
||||||
|
if (uri != null) {
|
||||||
|
intent.putExtra(WalletActivity.REQUEST_URI, uri);
|
||||||
|
uri = null; // use only once
|
||||||
|
}
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1221,6 +1229,12 @@ public class LoginActivity extends BaseActivity
|
|||||||
case R.id.action_language:
|
case R.id.action_language:
|
||||||
onChangeLocale();
|
onChangeLocale();
|
||||||
return true;
|
return true;
|
||||||
|
case R.id.action_ledger_seed:
|
||||||
|
Fragment f = getSupportFragmentManager().findFragmentById(R.id.fragment_container);
|
||||||
|
if (f instanceof GenerateFragment) {
|
||||||
|
((GenerateFragment) f).convertLedgerSeed();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
default:
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
@@ -1353,30 +1367,31 @@ public class LoginActivity extends BaseActivity
|
|||||||
};
|
};
|
||||||
|
|
||||||
private void connectLedger(UsbManager usbManager, final UsbDevice usbDevice) {
|
private void connectLedger(UsbManager usbManager, final UsbDevice usbDevice) {
|
||||||
try {
|
if (Ledger.ENABLED)
|
||||||
Ledger.connect(usbManager, usbDevice);
|
try {
|
||||||
registerDetachReceiver();
|
Ledger.connect(usbManager, usbDevice);
|
||||||
onLedgerAction();
|
registerDetachReceiver();
|
||||||
runOnUiThread(new Runnable() {
|
onLedgerAction();
|
||||||
@Override
|
runOnUiThread(new Runnable() {
|
||||||
public void run() {
|
@Override
|
||||||
Toast.makeText(LoginActivity.this,
|
public void run() {
|
||||||
getString(R.string.toast_ledger_attached, usbDevice.getProductName()),
|
Toast.makeText(LoginActivity.this,
|
||||||
Toast.LENGTH_SHORT)
|
getString(R.string.toast_ledger_attached, usbDevice.getProductName()),
|
||||||
.show();
|
Toast.LENGTH_SHORT)
|
||||||
}
|
.show();
|
||||||
});
|
}
|
||||||
} catch (IOException ex) {
|
});
|
||||||
runOnUiThread(new Runnable() {
|
} catch (IOException ex) {
|
||||||
@Override
|
runOnUiThread(new Runnable() {
|
||||||
public void run() {
|
@Override
|
||||||
Toast.makeText(LoginActivity.this,
|
public void run() {
|
||||||
getString(R.string.open_wallet_ledger_missing),
|
Toast.makeText(LoginActivity.this,
|
||||||
Toast.LENGTH_SHORT)
|
getString(R.string.open_wallet_ledger_missing),
|
||||||
.show();
|
Toast.LENGTH_SHORT)
|
||||||
}
|
.show();
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1385,7 +1400,7 @@ public class LoginActivity extends BaseActivity
|
|||||||
processUsbIntent(intent);
|
processUsbIntent(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processUsbIntent(Intent intent) {
|
private boolean processUsbIntent(Intent intent) {
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
if (UsbManager.ACTION_USB_DEVICE_ATTACHED.equals(action)) {
|
if (UsbManager.ACTION_USB_DEVICE_ATTACHED.equals(action)) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
@@ -1398,6 +1413,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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -32,6 +32,7 @@ import android.view.Menu;
|
|||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@@ -505,6 +506,10 @@ public class NodeFragment extends Fragment
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// set FLAG_SECURE to prevent screenshots in Release Mode
|
||||||
|
if (!(BuildConfig.DEBUG && BuildConfig.FLAVOR_type.equals("alpha"))) {
|
||||||
|
editDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
|
||||||
|
}
|
||||||
|
|
||||||
etNodePass.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
etNodePass.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||||
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
||||||
|
@@ -17,19 +17,28 @@
|
|||||||
package com.m2049r.xmrwallet;
|
package com.m2049r.xmrwallet;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
|
import android.net.Uri;
|
||||||
import android.nfc.NfcManager;
|
import android.nfc.NfcManager;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
import android.support.design.widget.TextInputLayout;
|
import android.support.design.widget.TextInputLayout;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.content.FileProvider;
|
||||||
|
import android.support.v4.view.MenuItemCompat;
|
||||||
|
import android.support.v7.widget.ShareActionProvider;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
@@ -56,6 +65,9 @@ import com.m2049r.xmrwallet.util.MoneroThreadPoolExecutor;
|
|||||||
import com.m2049r.xmrwallet.widget.ExchangeView;
|
import com.m2049r.xmrwallet.widget.ExchangeView;
|
||||||
import com.m2049r.xmrwallet.widget.Toolbar;
|
import com.m2049r.xmrwallet.widget.Toolbar;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -69,8 +81,8 @@ public class ReceiveFragment extends Fragment {
|
|||||||
private TextInputLayout etNotes;
|
private TextInputLayout etNotes;
|
||||||
private ExchangeView evAmount;
|
private ExchangeView evAmount;
|
||||||
private TextView tvQrCode;
|
private TextView tvQrCode;
|
||||||
private ImageView qrCode;
|
private ImageView ivQrCode;
|
||||||
private ImageView qrCodeFull;
|
private ImageView ivQrCodeFull;
|
||||||
private EditText etDummy;
|
private EditText etDummy;
|
||||||
private ImageButton bCopyAddress;
|
private ImageButton bCopyAddress;
|
||||||
private Button bSubaddress;
|
private Button bSubaddress;
|
||||||
@@ -97,9 +109,9 @@ public class ReceiveFragment extends Fragment {
|
|||||||
tvAddress = view.findViewById(R.id.tvAddress);
|
tvAddress = view.findViewById(R.id.tvAddress);
|
||||||
etNotes = view.findViewById(R.id.etNotes);
|
etNotes = view.findViewById(R.id.etNotes);
|
||||||
evAmount = view.findViewById(R.id.evAmount);
|
evAmount = view.findViewById(R.id.evAmount);
|
||||||
qrCode = view.findViewById(R.id.qrCode);
|
ivQrCode = view.findViewById(R.id.qrCode);
|
||||||
tvQrCode = view.findViewById(R.id.tvQrCode);
|
tvQrCode = view.findViewById(R.id.tvQrCode);
|
||||||
qrCodeFull = view.findViewById(R.id.qrCodeFull);
|
ivQrCodeFull = view.findViewById(R.id.qrCodeFull);
|
||||||
etDummy = view.findViewById(R.id.etDummy);
|
etDummy = view.findViewById(R.id.etDummy);
|
||||||
bCopyAddress = view.findViewById(R.id.bCopyAddress);
|
bCopyAddress = view.findViewById(R.id.bCopyAddress);
|
||||||
bSubaddress = view.findViewById(R.id.bSubaddress);
|
bSubaddress = view.findViewById(R.id.bSubaddress);
|
||||||
@@ -178,25 +190,25 @@ public class ReceiveFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
qrCode.setOnClickListener(new View.OnClickListener() {
|
ivQrCode.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Helper.hideKeyboard(getActivity());
|
Helper.hideKeyboard(getActivity());
|
||||||
etDummy.requestFocus();
|
etDummy.requestFocus();
|
||||||
if (qrValid) {
|
if (qrValid) {
|
||||||
qrCodeFull.setImageBitmap(((BitmapDrawable) qrCode.getDrawable()).getBitmap());
|
ivQrCodeFull.setImageBitmap(((BitmapDrawable) ivQrCode.getDrawable()).getBitmap());
|
||||||
qrCodeFull.setVisibility(View.VISIBLE);
|
ivQrCodeFull.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
evAmount.doExchange();
|
evAmount.doExchange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
qrCodeFull.setOnClickListener(new View.OnClickListener() {
|
ivQrCodeFull.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
qrCodeFull.setImageBitmap(null);
|
ivQrCodeFull.setImageBitmap(null);
|
||||||
qrCodeFull.setVisibility(View.GONE);
|
ivQrCodeFull.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -228,6 +240,81 @@ public class ReceiveFragment extends Fragment {
|
|||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setHasOptionsMenu(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ShareActionProvider shareActionProvider;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreateOptionsMenu(Menu menu, final MenuInflater inflater) {
|
||||||
|
inflater.inflate(R.menu.receive_menu, menu);
|
||||||
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
|
|
||||||
|
// Locate MenuItem with ShareActionProvider
|
||||||
|
MenuItem item = menu.findItem(R.id.menu_item_share);
|
||||||
|
|
||||||
|
// Fetch and store ShareActionProvider
|
||||||
|
shareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(item);
|
||||||
|
|
||||||
|
shareActionProvider.setOnShareTargetSelectedListener(new ShareActionProvider.OnShareTargetSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onShareTargetSelected(ShareActionProvider shareActionProvider, Intent intent) {
|
||||||
|
saveQrCode(); // save it only if we need it
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setShareIntent() {
|
||||||
|
if (shareActionProvider != null) {
|
||||||
|
if (qrValid) {
|
||||||
|
shareActionProvider.setShareIntent(getShareIntent());
|
||||||
|
} else {
|
||||||
|
shareActionProvider.setShareIntent(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveQrCode() {
|
||||||
|
if (!qrValid) throw new IllegalStateException("trying to save null qr code!");
|
||||||
|
|
||||||
|
File cachePath = new File(getActivity().getCacheDir(), "images");
|
||||||
|
if (!cachePath.exists())
|
||||||
|
if (!cachePath.mkdirs()) throw new IllegalStateException("cannot create images folder");
|
||||||
|
File png = new File(cachePath, "QR.png");
|
||||||
|
try {
|
||||||
|
FileOutputStream stream = new FileOutputStream(png);
|
||||||
|
Bitmap qrBitmap = ((BitmapDrawable) ivQrCode.getDrawable()).getBitmap();
|
||||||
|
qrBitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
|
||||||
|
stream.close();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
Timber.e(ex);
|
||||||
|
// make sure we don't share an old qr code
|
||||||
|
if (!png.delete()) throw new IllegalStateException("cannot delete old qr code");
|
||||||
|
// if we manage to delete it, the URI points to nothing and the user gets a toast with the error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Intent getShareIntent() {
|
||||||
|
File imagePath = new File(getActivity().getCacheDir(), "images");
|
||||||
|
File png = new File(imagePath, "QR.png");
|
||||||
|
Uri contentUri = FileProvider.getUriForFile(getActivity(),
|
||||||
|
"com.m2049r.xmrwallet.fileprovider", png);
|
||||||
|
if (contentUri != null) {
|
||||||
|
Intent shareIntent = new Intent();
|
||||||
|
shareIntent.setAction(Intent.ACTION_SEND);
|
||||||
|
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); // temp permission for receiving app to read this file
|
||||||
|
shareIntent.setDataAndType(contentUri, getActivity().getContentResolver().getType(contentUri));
|
||||||
|
shareIntent.putExtra(Intent.EXTRA_STREAM, contentUri);
|
||||||
|
shareIntent.putExtra(Intent.EXTRA_TEXT, bcData.getUriString());
|
||||||
|
return shareIntent;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
void enableSubaddressButton(boolean enable) {
|
void enableSubaddressButton(boolean enable) {
|
||||||
bSubaddress.setEnabled(enable);
|
bSubaddress.setEnabled(enable);
|
||||||
if (enable) {
|
if (enable) {
|
||||||
@@ -242,23 +329,23 @@ public class ReceiveFragment extends Fragment {
|
|||||||
Toast.makeText(getActivity(), getString(R.string.message_copy_address), Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), getString(R.string.message_copy_address), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean qrValid = true;
|
private boolean qrValid = false;
|
||||||
|
|
||||||
void clearQR() {
|
void clearQR() {
|
||||||
if (qrValid) {
|
if (qrValid) {
|
||||||
qrCode.setImageBitmap(null);
|
ivQrCode.setImageBitmap(null);
|
||||||
qrValid = false;
|
qrValid = false;
|
||||||
|
setShareIntent();
|
||||||
if (isLoaded)
|
if (isLoaded)
|
||||||
tvQrCode.setVisibility(View.VISIBLE);
|
tvQrCode.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setQR(Bitmap qr) {
|
void setQR(Bitmap qr) {
|
||||||
qrCode.setImageBitmap(qr);
|
ivQrCode.setImageBitmap(qr);
|
||||||
qrValid = true;
|
qrValid = true;
|
||||||
|
setShareIntent();
|
||||||
tvQrCode.setVisibility(View.GONE);
|
tvQrCode.setVisibility(View.GONE);
|
||||||
Helper.hideKeyboard(getActivity());
|
|
||||||
etDummy.requestFocus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -392,7 +479,7 @@ public class ReceiveFragment extends Fragment {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bcData = new BarcodeData(BarcodeData.Asset.XMR, address, null, notes, xmrAmount);
|
bcData = new BarcodeData(BarcodeData.Asset.XMR, address, null, notes, xmrAmount);
|
||||||
int size = Math.min(qrCode.getHeight(), qrCode.getWidth());
|
int size = Math.max(ivQrCode.getWidth(), ivQrCode.getHeight());
|
||||||
Bitmap qr = generate(bcData.getUriString(), size, size);
|
Bitmap qr = generate(bcData.getUriString(), size, size);
|
||||||
if (qr != null) {
|
if (qr != null) {
|
||||||
setQR(qr);
|
setQR(qr);
|
||||||
@@ -422,8 +509,8 @@ public class ReceiveFragment extends Fragment {
|
|||||||
Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.RGB_565);
|
Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.RGB_565);
|
||||||
bitmap = addLogo(bitmap);
|
bitmap = addLogo(bitmap);
|
||||||
return bitmap;
|
return bitmap;
|
||||||
} catch (WriterException e) {
|
} catch (WriterException ex) {
|
||||||
e.printStackTrace();
|
Timber.e(ex);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@ public abstract class SecureActivity extends AppCompatActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
// set FLAG_SECURE to prevent screenshots in Release Mode
|
// set FLAG_SECURE to prevent screenshots in Release Mode
|
||||||
if (!BuildConfig.DEBUG && !BuildConfig.FLAVOR_type.equals("alpha")) {
|
if (!(BuildConfig.DEBUG && BuildConfig.FLAVOR_type.equals("alpha"))) {
|
||||||
getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE);
|
getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,7 @@ import com.m2049r.xmrwallet.model.TransactionInfo;
|
|||||||
import com.m2049r.xmrwallet.model.Transfer;
|
import com.m2049r.xmrwallet.model.Transfer;
|
||||||
import com.m2049r.xmrwallet.model.Wallet;
|
import com.m2049r.xmrwallet.model.Wallet;
|
||||||
import com.m2049r.xmrwallet.util.Helper;
|
import com.m2049r.xmrwallet.util.Helper;
|
||||||
import com.m2049r.xmrwallet.util.UserNotes;
|
import com.m2049r.xmrwallet.data.UserNotes;
|
||||||
import com.m2049r.xmrwallet.widget.Toolbar;
|
import com.m2049r.xmrwallet.widget.Toolbar;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
@@ -47,6 +47,7 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import com.m2049r.xmrwallet.data.BarcodeData;
|
import com.m2049r.xmrwallet.data.BarcodeData;
|
||||||
import com.m2049r.xmrwallet.data.TxData;
|
import com.m2049r.xmrwallet.data.TxData;
|
||||||
|
import com.m2049r.xmrwallet.data.UserNotes;
|
||||||
import com.m2049r.xmrwallet.dialog.CreditsFragment;
|
import com.m2049r.xmrwallet.dialog.CreditsFragment;
|
||||||
import com.m2049r.xmrwallet.dialog.HelpFragment;
|
import com.m2049r.xmrwallet.dialog.HelpFragment;
|
||||||
import com.m2049r.xmrwallet.fragment.send.SendAddressWizardFragment;
|
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.service.WalletService;
|
||||||
import com.m2049r.xmrwallet.util.Helper;
|
import com.m2049r.xmrwallet.util.Helper;
|
||||||
import com.m2049r.xmrwallet.util.MoneroThreadPoolExecutor;
|
import com.m2049r.xmrwallet.util.MoneroThreadPoolExecutor;
|
||||||
import com.m2049r.xmrwallet.util.UserNotes;
|
|
||||||
import com.m2049r.xmrwallet.widget.Toolbar;
|
import com.m2049r.xmrwallet.widget.Toolbar;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
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_PW = "pw";
|
||||||
public static final String REQUEST_FINGERPRINT_USED = "fingerprint";
|
public static final String REQUEST_FINGERPRINT_USED = "fingerprint";
|
||||||
public static final String REQUEST_STREETMODE = "streetmode";
|
public static final String REQUEST_STREETMODE = "streetmode";
|
||||||
|
public static final String REQUEST_URI = "uri";
|
||||||
|
|
||||||
private NavigationView accountsView;
|
private NavigationView accountsView;
|
||||||
private DrawerLayout drawer;
|
private DrawerLayout drawer;
|
||||||
@@ -92,6 +93,8 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
|
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
|
private String uri = null;
|
||||||
|
|
||||||
private long streetMode = 0;
|
private long streetMode = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -144,6 +147,9 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
} else {
|
} else {
|
||||||
streetMode = 0;
|
streetMode = 0;
|
||||||
}
|
}
|
||||||
|
final WalletFragment walletFragment = (WalletFragment)
|
||||||
|
getSupportFragmentManager().findFragmentByTag(WalletFragment.class.getName());
|
||||||
|
if (walletFragment != null) walletFragment.resetDismissedTransactions();
|
||||||
updateAccountsBalance();
|
updateAccountsBalance();
|
||||||
forceUpdate();
|
forceUpdate();
|
||||||
}
|
}
|
||||||
@@ -188,6 +194,7 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
// we can set the streetmode height AFTER opening the wallet
|
// we can set the streetmode height AFTER opening the wallet
|
||||||
requestStreetMode = extras.getBoolean(REQUEST_STREETMODE);
|
requestStreetMode = extras.getBoolean(REQUEST_STREETMODE);
|
||||||
password = extras.getString(REQUEST_PW);
|
password = extras.getString(REQUEST_PW);
|
||||||
|
uri = extras.getString(REQUEST_URI);
|
||||||
connectWalletService(walletId, password);
|
connectWalletService(walletId, password);
|
||||||
} else {
|
} else {
|
||||||
finish();
|
finish();
|
||||||
@@ -286,7 +293,6 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
showNet();
|
showNet();
|
||||||
}
|
}
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onEnableStreetMode() {
|
private void onEnableStreetMode() {
|
||||||
@@ -510,7 +516,8 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSendRequest() {
|
public void onSendRequest() {
|
||||||
replaceFragment(new SendFragment(), null, null);
|
replaceFragment(SendFragment.newInstance(uri), null, null);
|
||||||
|
uri = null; // only use uri once
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -956,8 +963,6 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste
|
|||||||
}
|
}
|
||||||
if (!processed || (onUriScannedListener == null)) {
|
if (!processed || (onUriScannedListener == null)) {
|
||||||
Toast.makeText(this, getString(R.string.nfc_tag_read_what), Toast.LENGTH_LONG).show();
|
Toast.makeText(this, getString(R.string.nfc_tag_read_what), Toast.LENGTH_LONG).show();
|
||||||
} else {
|
|
||||||
Toast.makeText(this, getString(R.string.nfc_tag_read_success), Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -38,6 +38,7 @@ import android.widget.ProgressBar;
|
|||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.github.brnunes.swipeablerecyclerview.SwipeableRecyclerViewTouchListener;
|
||||||
import com.m2049r.xmrwallet.layout.TransactionInfoAdapter;
|
import com.m2049r.xmrwallet.layout.TransactionInfoAdapter;
|
||||||
import com.m2049r.xmrwallet.model.TransactionInfo;
|
import com.m2049r.xmrwallet.model.TransactionInfo;
|
||||||
import com.m2049r.xmrwallet.model.Wallet;
|
import com.m2049r.xmrwallet.model.Wallet;
|
||||||
@@ -73,6 +74,12 @@ public class WalletFragment extends Fragment
|
|||||||
|
|
||||||
private Spinner sCurrency;
|
private Spinner sCurrency;
|
||||||
|
|
||||||
|
private List<String> dismissedTransactions = new ArrayList<>();
|
||||||
|
|
||||||
|
public void resetDismissedTransactions() {
|
||||||
|
dismissedTransactions.clear();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -116,9 +123,44 @@ public class WalletFragment extends Fragment
|
|||||||
|
|
||||||
RecyclerView recyclerView = view.findViewById(R.id.list);
|
RecyclerView recyclerView = view.findViewById(R.id.list);
|
||||||
|
|
||||||
this.adapter = new TransactionInfoAdapter(getActivity(), this);
|
adapter = new TransactionInfoAdapter(getActivity(), this);
|
||||||
recyclerView.setAdapter(adapter);
|
recyclerView.setAdapter(adapter);
|
||||||
|
|
||||||
|
SwipeableRecyclerViewTouchListener swipeTouchListener =
|
||||||
|
new SwipeableRecyclerViewTouchListener(recyclerView,
|
||||||
|
new SwipeableRecyclerViewTouchListener.SwipeListener() {
|
||||||
|
@Override
|
||||||
|
public boolean canSwipeLeft(int position) {
|
||||||
|
return activityCallback.isStreetMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canSwipeRight(int position) {
|
||||||
|
return activityCallback.isStreetMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismissedBySwipeLeft(RecyclerView recyclerView, int[] reverseSortedPositions) {
|
||||||
|
for (int position : reverseSortedPositions) {
|
||||||
|
dismissedTransactions.add(adapter.getItem(position).hash);
|
||||||
|
adapter.removeItem(position);
|
||||||
|
}
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDismissedBySwipeRight(RecyclerView recyclerView, int[] reverseSortedPositions) {
|
||||||
|
for (int position : reverseSortedPositions) {
|
||||||
|
dismissedTransactions.add(adapter.getItem(position).hash);
|
||||||
|
adapter.removeItem(position);
|
||||||
|
}
|
||||||
|
adapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
recyclerView.addOnItemTouchListener(swipeTouchListener);
|
||||||
|
|
||||||
|
|
||||||
bSend.setOnClickListener(new View.OnClickListener() {
|
bSend.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@@ -294,7 +336,9 @@ public class WalletFragment extends Fragment
|
|||||||
Timber.d("StreetHeight=%d", streetHeight);
|
Timber.d("StreetHeight=%d", streetHeight);
|
||||||
for (TransactionInfo info : wallet.getHistory().getAll()) {
|
for (TransactionInfo info : wallet.getHistory().getAll()) {
|
||||||
Timber.d("TxHeight=%d", info.blockheight);
|
Timber.d("TxHeight=%d", info.blockheight);
|
||||||
if (info.isPending || (info.blockheight >= streetHeight)) list.add(info);
|
if ((info.isPending || (info.blockheight >= streetHeight))
|
||||||
|
&& !dismissedTransactions.contains(info.hash))
|
||||||
|
list.add(info);
|
||||||
}
|
}
|
||||||
adapter.setInfos(list);
|
adapter.setInfos(list);
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
|
@@ -21,7 +21,10 @@ import android.net.Uri;
|
|||||||
import com.m2049r.xmrwallet.model.Wallet;
|
import com.m2049r.xmrwallet.model.Wallet;
|
||||||
import com.m2049r.xmrwallet.util.BitcoinAddressValidator;
|
import com.m2049r.xmrwallet.util.BitcoinAddressValidator;
|
||||||
import com.m2049r.xmrwallet.util.OpenAliasHelper;
|
import com.m2049r.xmrwallet.util.OpenAliasHelper;
|
||||||
|
import com.m2049r.xmrwallet.util.PaymentProtocolHelper;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -37,9 +40,10 @@ public class BarcodeData {
|
|||||||
public static final String OA_XMR_ASSET = "xmr";
|
public static final String OA_XMR_ASSET = "xmr";
|
||||||
public static final String OA_BTC_ASSET = "btc";
|
public static final String OA_BTC_ASSET = "btc";
|
||||||
|
|
||||||
static final String BTC_SCHEME = "bitcoin:";
|
static final String BTC_SCHEME = "bitcoin";
|
||||||
static final String BTC_DESCRIPTION = "message";
|
static final String BTC_DESCRIPTION = "message";
|
||||||
static final String BTC_AMOUNT = "amount";
|
static final String BTC_AMOUNT = "amount";
|
||||||
|
static final String BTC_BIP70_PARM = "r";
|
||||||
|
|
||||||
public enum Asset {
|
public enum Asset {
|
||||||
XMR, BTC
|
XMR, BTC
|
||||||
@@ -48,7 +52,8 @@ public class BarcodeData {
|
|||||||
public enum Security {
|
public enum Security {
|
||||||
NORMAL,
|
NORMAL,
|
||||||
OA_NO_DNSSEC,
|
OA_NO_DNSSEC,
|
||||||
OA_DNSSEC
|
OA_DNSSEC,
|
||||||
|
BIP70
|
||||||
}
|
}
|
||||||
|
|
||||||
final public Asset asset;
|
final public Asset asset;
|
||||||
@@ -58,57 +63,44 @@ public class BarcodeData {
|
|||||||
final public String amount;
|
final public String amount;
|
||||||
final public String description;
|
final public String description;
|
||||||
final public Security security;
|
final public Security security;
|
||||||
|
final public String bip70;
|
||||||
|
|
||||||
public BarcodeData(Asset asset, String address) {
|
public BarcodeData(Asset asset, String address) {
|
||||||
this.asset = asset;
|
this(asset, address, null, null, null, null, Security.NORMAL);
|
||||||
this.address = address;
|
|
||||||
amount = null;
|
|
||||||
paymentId = null;
|
|
||||||
addressName = null;
|
|
||||||
description = null;
|
|
||||||
this.security = Security.NORMAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BarcodeData(Asset asset, String address, String amount) {
|
public BarcodeData(Asset asset, String address, String amount) {
|
||||||
this.asset = asset;
|
this(asset, address, null, null, null, amount, Security.NORMAL);
|
||||||
this.address = address;
|
}
|
||||||
this.amount = amount;
|
|
||||||
paymentId = null;
|
public BarcodeData(Asset asset, String address, String amount, String description, Security security) {
|
||||||
addressName = null;
|
this(asset, address, null, null, description, amount, security);
|
||||||
description = null;
|
|
||||||
this.security = Security.NORMAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BarcodeData(Asset asset, String address, String paymentId, String amount) {
|
public BarcodeData(Asset asset, String address, String paymentId, String amount) {
|
||||||
this.asset = asset;
|
this(asset, address, null, paymentId, null, amount, Security.NORMAL);
|
||||||
this.address = address;
|
|
||||||
this.paymentId = paymentId;
|
|
||||||
this.amount = amount;
|
|
||||||
addressName = null;
|
|
||||||
description = null;
|
|
||||||
this.security = Security.NORMAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BarcodeData(Asset asset, String address, String paymentId, String description, String amount) {
|
public BarcodeData(Asset asset, String address, String paymentId, String description, String amount) {
|
||||||
this.asset = asset;
|
this(asset, address, null, paymentId, description, amount, Security.NORMAL);
|
||||||
this.address = address;
|
|
||||||
this.paymentId = paymentId;
|
|
||||||
this.description = description;
|
|
||||||
this.amount = amount;
|
|
||||||
addressName = null;
|
|
||||||
this.security = Security.NORMAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BarcodeData(Asset asset, String address, String addressName, String paymentId, String description, String amount, Security sec) {
|
public BarcodeData(Asset asset, String address, String addressName, String paymentId, String description, String amount, Security security) {
|
||||||
|
this(asset, address, addressName, null, paymentId, description, amount, security);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BarcodeData(Asset asset, String address, String addressName, String bip70, String paymentId, String description, String amount, Security security) {
|
||||||
this.asset = asset;
|
this.asset = asset;
|
||||||
this.address = address;
|
this.address = address;
|
||||||
|
this.bip70 = bip70;
|
||||||
this.addressName = addressName;
|
this.addressName = addressName;
|
||||||
this.paymentId = paymentId;
|
this.paymentId = paymentId;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
this.security = sec;
|
this.security = security;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Uri getUri() {
|
public Uri getUri() {
|
||||||
return Uri.parse(getUriString());
|
return Uri.parse(getUriString());
|
||||||
}
|
}
|
||||||
@@ -146,6 +138,10 @@ public class BarcodeData {
|
|||||||
if (bcData == null) {
|
if (bcData == null) {
|
||||||
bcData = parseBitcoinUri(qrCode);
|
bcData = parseBitcoinUri(qrCode);
|
||||||
}
|
}
|
||||||
|
// check for btc payment uri (like bitpay)
|
||||||
|
if (bcData == null) {
|
||||||
|
bcData = parseBitcoinPaymentUrl(qrCode);
|
||||||
|
}
|
||||||
// check for naked btc address
|
// check for naked btc address
|
||||||
if (bcData == null) {
|
if (bcData == null) {
|
||||||
bcData = parseBitcoinNaked(qrCode);
|
bcData = parseBitcoinNaked(qrCode);
|
||||||
@@ -228,19 +224,28 @@ public class BarcodeData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// bitcoin:mpQ84J43EURZHkCnXbyQ4PpNDLLBqdsMW2?amount=0.01
|
// bitcoin:mpQ84J43EURZHkCnXbyQ4PpNDLLBqdsMW2?amount=0.01
|
||||||
static public BarcodeData parseBitcoinUri(String uri) {
|
// bitcoin:?r=https://bitpay.com/i/xxx
|
||||||
Timber.d("parseBitcoinUri=%s", uri);
|
static public BarcodeData parseBitcoinUri(String uriString) {
|
||||||
|
Timber.d("parseBitcoinUri=%s", uriString);
|
||||||
|
|
||||||
if (uri == null) return null;
|
if (uriString == null) return null;
|
||||||
|
URI uri;
|
||||||
|
try {
|
||||||
|
uri = new URI(uriString);
|
||||||
|
} catch (URISyntaxException ex) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (!uri.isOpaque() ||
|
||||||
|
!uri.getScheme().equals(BTC_SCHEME)) return null;
|
||||||
|
|
||||||
if (!uri.startsWith(BTC_SCHEME)) return null;
|
String[] parts = uri.getRawSchemeSpecificPart().split("[?]");
|
||||||
|
if ((parts.length <= 0) || (parts.length > 2)) {
|
||||||
String noScheme = uri.substring(BTC_SCHEME.length());
|
Timber.d("invalid number of parts %d", parts.length);
|
||||||
Uri bitcoin = Uri.parse(noScheme);
|
return null;
|
||||||
|
}
|
||||||
Map<String, String> parms = new HashMap<>();
|
Map<String, String> parms = new HashMap<>();
|
||||||
String query = bitcoin.getQuery();
|
if (parts.length == 2) {
|
||||||
if (query != null) {
|
String[] args = parts[1].split("&");
|
||||||
String[] args = query.split("&");
|
|
||||||
for (String arg : args) {
|
for (String arg : args) {
|
||||||
String[] namevalue = arg.split("=");
|
String[] namevalue = arg.split("=");
|
||||||
if (namevalue.length == 0) {
|
if (namevalue.length == 0) {
|
||||||
@@ -250,10 +255,26 @@ public class BarcodeData {
|
|||||||
namevalue.length > 1 ? Uri.decode(namevalue[1]) : "");
|
namevalue.length > 1 ? Uri.decode(namevalue[1]) : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String address = bitcoin.getPath();
|
|
||||||
String description = parms.get(BTC_DESCRIPTION);
|
String description = parms.get(BTC_DESCRIPTION);
|
||||||
|
String address = parts[0]; // no need to decode as there can bo no special characters
|
||||||
|
if (address.isEmpty()) { // possibly a BIP72 uri
|
||||||
|
String bip70 = parms.get(BTC_BIP70_PARM);
|
||||||
|
if (bip70 == null) {
|
||||||
|
Timber.d("no address and can't find pp url");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (!PaymentProtocolHelper.isHttp(bip70)) {
|
||||||
|
Timber.d("[%s] is not http url", bip70);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new BarcodeData(BarcodeData.Asset.BTC, null, null, bip70, null, description, null, Security.NORMAL);
|
||||||
|
}
|
||||||
|
if (!BitcoinAddressValidator.validate(address)) {
|
||||||
|
Timber.d("BTC address (%s) invalid", address);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
String amount = parms.get(BTC_AMOUNT);
|
String amount = parms.get(BTC_AMOUNT);
|
||||||
if (amount != null) {
|
if ((amount != null) && (!amount.isEmpty())) {
|
||||||
try {
|
try {
|
||||||
Double.parseDouble(amount);
|
Double.parseDouble(amount);
|
||||||
} catch (NumberFormatException ex) {
|
} catch (NumberFormatException ex) {
|
||||||
@@ -261,11 +282,22 @@ public class BarcodeData {
|
|||||||
return null; // we have an amount but its not a number!
|
return null; // we have an amount but its not a number!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!BitcoinAddressValidator.validate(address)) {
|
return new BarcodeData(BarcodeData.Asset.BTC, address, null, description, amount);
|
||||||
Timber.d("address invalid");
|
}
|
||||||
|
|
||||||
|
// https://bitpay.com/invoice?id=xxx
|
||||||
|
// https://bitpay.com/i/KbMdd4EhnLXSbpWGKsaeo6
|
||||||
|
static public BarcodeData parseBitcoinPaymentUrl(String url) {
|
||||||
|
Timber.d("parseBitcoinUri=%s", url);
|
||||||
|
|
||||||
|
if (url == null) return null;
|
||||||
|
|
||||||
|
if (!PaymentProtocolHelper.isHttp(url)) {
|
||||||
|
Timber.d("[%s] is not http url", url);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new BarcodeData(BarcodeData.Asset.BTC, address, null, description, amount);
|
|
||||||
|
return new BarcodeData(Asset.BTC, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
static public BarcodeData parseBitcoinNaked(String address) {
|
static public BarcodeData parseBitcoinNaked(String address) {
|
||||||
|
@@ -20,9 +20,6 @@ import android.os.Parcel;
|
|||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
import com.m2049r.xmrwallet.model.PendingTransaction;
|
import com.m2049r.xmrwallet.model.PendingTransaction;
|
||||||
import com.m2049r.xmrwallet.util.UserNotes;
|
|
||||||
|
|
||||||
import timber.log.Timber;
|
|
||||||
|
|
||||||
// https://stackoverflow.com/questions/2139134/how-to-send-an-object-from-one-android-activity-to-another-using-intents
|
// https://stackoverflow.com/questions/2139134/how-to-send-an-object-from-one-android-activity-to-another-using-intents
|
||||||
public class TxData implements Parcelable {
|
public class TxData implements Parcelable {
|
||||||
|
@@ -18,12 +18,11 @@ package com.m2049r.xmrwallet.data;
|
|||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
|
|
||||||
import com.m2049r.xmrwallet.model.PendingTransaction;
|
|
||||||
|
|
||||||
public class TxDataBtc extends TxData {
|
public class TxDataBtc extends TxData {
|
||||||
|
|
||||||
private String xmrtoUuid;
|
private String xmrtoUuid;
|
||||||
private String btcAddress;
|
private String btcAddress;
|
||||||
|
private String bip70;
|
||||||
private double btcAmount;
|
private double btcAmount;
|
||||||
|
|
||||||
public TxDataBtc() {
|
public TxDataBtc() {
|
||||||
@@ -50,6 +49,14 @@ public class TxDataBtc extends TxData {
|
|||||||
this.btcAddress = btcAddress;
|
this.btcAddress = btcAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getBip70() {
|
||||||
|
return bip70;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBip70(String bip70) {
|
||||||
|
this.bip70 = bip70;
|
||||||
|
}
|
||||||
|
|
||||||
public double getBtcAmount() {
|
public double getBtcAmount() {
|
||||||
return btcAmount;
|
return btcAmount;
|
||||||
}
|
}
|
||||||
@@ -63,6 +70,7 @@ public class TxDataBtc extends TxData {
|
|||||||
super.writeToParcel(out, flags);
|
super.writeToParcel(out, flags);
|
||||||
out.writeString(xmrtoUuid);
|
out.writeString(xmrtoUuid);
|
||||||
out.writeString(btcAddress);
|
out.writeString(btcAddress);
|
||||||
|
out.writeString(bip70);
|
||||||
out.writeDouble(btcAmount);
|
out.writeDouble(btcAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,16 +89,19 @@ public class TxDataBtc extends TxData {
|
|||||||
super(in);
|
super(in);
|
||||||
xmrtoUuid = in.readString();
|
xmrtoUuid = in.readString();
|
||||||
btcAddress = in.readString();
|
btcAddress = in.readString();
|
||||||
|
bip70 = in.readString();
|
||||||
btcAmount = in.readDouble();
|
btcAmount = in.readDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(",xmrtoUuid:");
|
sb.append(",xmrtoUuid:");
|
||||||
sb.append(xmrtoUuid);
|
sb.append(xmrtoUuid);
|
||||||
sb.append(",btcAddress:");
|
sb.append(",btcAddress:");
|
||||||
sb.append(btcAddress);
|
sb.append(btcAddress);
|
||||||
|
sb.append(",bip70:");
|
||||||
|
sb.append(bip70);
|
||||||
sb.append(",btcAmount:");
|
sb.append(",btcAmount:");
|
||||||
sb.append(btcAmount);
|
sb.append(btcAmount);
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.m2049r.xmrwallet.util;
|
package com.m2049r.xmrwallet.data;
|
||||||
|
|
||||||
import com.m2049r.xmrwallet.xmrto.api.QueryOrderStatus;
|
import com.m2049r.xmrwallet.xmrto.api.QueryOrderStatus;
|
||||||
|
|
@@ -67,7 +67,7 @@ public class HelpFragment extends DialogFragment {
|
|||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
builder.setView(view);
|
builder.setView(view);
|
||||||
builder.setNegativeButton(R.string.about_close,
|
builder.setNegativeButton(R.string.help_ok,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
@@ -22,11 +22,11 @@ import android.content.Context;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.WindowManager;
|
||||||
import android.widget.FrameLayout;
|
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.m2049r.xmrwallet.BuildConfig;
|
||||||
import com.m2049r.xmrwallet.R;
|
import com.m2049r.xmrwallet.R;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@@ -62,9 +62,6 @@ public class ProgressDialog extends AlertDialog {
|
|||||||
pbBar = view.findViewById(R.id.pbBar);
|
pbBar = view.findViewById(R.id.pbBar);
|
||||||
tvProgress = view.findViewById(R.id.tvProgress);
|
tvProgress = view.findViewById(R.id.tvProgress);
|
||||||
setView(view);
|
setView(view);
|
||||||
//setTitle("blabla");
|
|
||||||
//super.setMessage("bubbu");
|
|
||||||
// view.invalidate();
|
|
||||||
setIndeterminate(indeterminate);
|
setIndeterminate(indeterminate);
|
||||||
if (maxValue > 0) {
|
if (maxValue > 0) {
|
||||||
setMax(maxValue);
|
setMax(maxValue);
|
||||||
@@ -78,6 +75,11 @@ public class ProgressDialog extends AlertDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
// set FLAG_SECURE to prevent screenshots in Release Mode
|
||||||
|
if (!(BuildConfig.DEBUG && BuildConfig.FLAVOR_type.equals("alpha"))) {
|
||||||
|
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProgress(int value, int max) {
|
public void setProgress(int value, int max) {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -120,6 +120,15 @@ public class SendBtcAmountWizardFragment extends SendWizardFragment {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setBip70Mode() {
|
||||||
|
TxDataBtc txDataBtc = (TxDataBtc) sendListener.getTxData();
|
||||||
|
if (txDataBtc.getBip70() != null) {
|
||||||
|
numberPad.setVisibility(View.INVISIBLE);
|
||||||
|
} else {
|
||||||
|
numberPad.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
double maxBtc = 0;
|
double maxBtc = 0;
|
||||||
double minBtc = 0;
|
double minBtc = 0;
|
||||||
|
|
||||||
@@ -141,12 +150,13 @@ public class SendBtcAmountWizardFragment extends SendWizardFragment {
|
|||||||
tvFunds.setText(getString(R.string.send_available,
|
tvFunds.setText(getString(R.string.send_available,
|
||||||
getString(R.string.unknown_amount)));
|
getString(R.string.unknown_amount)));
|
||||||
}
|
}
|
||||||
if ((evAmount.getAmount() == null) || evAmount.getAmount().isEmpty()) {
|
final BarcodeData data = sendListener.popBarcodeData();
|
||||||
final BarcodeData data = sendListener.popBarcodeData();
|
if (data != null) {
|
||||||
if ((data != null) && (data.amount != null)) {
|
if (data.amount != null) {
|
||||||
evAmount.setAmount(data.amount);
|
evAmount.setAmount(data.amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setBip70Mode();
|
||||||
callXmrTo();
|
callXmrTo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user