mirror of https://github.com/m2049r/xmrwallet.git
Fixup wallet locations (#89)
* create wallets directly in wallet dir, renamed backup dir * new version + notes
This commit is contained in:
parent
2842a4042f
commit
e270b277a5
|
@ -25,11 +25,13 @@ You may lose all your Moneroj if you use this App. Be cautious when spending on
|
||||||
- more sensible error dialogs
|
- more sensible error dialogs
|
||||||
|
|
||||||
### Issues / Pitfalls
|
### Issues / Pitfalls
|
||||||
|
- The backups folder is now called "backups" and not ".backups" - which in most file explorers was a hidden folder
|
||||||
|
- Wallets are now created directly in the "monerujo" folder, and not in the ".new" folder as before
|
||||||
|
- You may want to check the old folders with a file browsing app and delete the ".new" and ".backups" folders AFTER moving neccessary wallet files to the new locations. Or simply make new backups from within Monerujo.
|
||||||
|
- Also note, that on some devices the backups will only be visible on a PC over USB after a reboot of the device (it's an Android bug/feature)
|
||||||
- Created wallets on a private testnet are unusable because the restore height is set to that
|
- Created wallets on a private testnet are unusable because the restore height is set to that
|
||||||
of the "real" testnet. After creating a new wallet, make a **new** one by recovering from the seed.
|
of the "real" testnet. After creating a new wallet, make a **new** one by recovering from the seed.
|
||||||
The official monero client shows the same behaviour.
|
The official monero client shows the same behaviour.
|
||||||
- In rare occasions the monero core code returns a wallet address with corrupted characters -
|
|
||||||
in these cases Monerujo crashes on purpose to make sure nothing bad happens
|
|
||||||
|
|
||||||
### HOW TO BUILD
|
### HOW TO BUILD
|
||||||
No need to build. Binaries are included:
|
No need to build. Binaries are included:
|
||||||
|
|
|
@ -8,8 +8,8 @@ android {
|
||||||
applicationId "com.m2049r.xmrwallet"
|
applicationId "com.m2049r.xmrwallet"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 25
|
targetSdkVersion 25
|
||||||
versionCode 20
|
versionCode 21
|
||||||
versionName "0.8.0.7"
|
versionName "0.8.0.8"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
cmake {
|
||||||
|
|
|
@ -24,6 +24,7 @@ import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.media.MediaScannerConnection;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.StrictMode;
|
import android.os.StrictMode;
|
||||||
|
@ -308,12 +309,14 @@ public class LoginActivity extends AppCompatActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean backupWallet(String walletName) {
|
private boolean backupWallet(String walletName) {
|
||||||
File backupFolder = new File(getStorageRoot(), ".backups");
|
File backupFolder = new File(getStorageRoot(), "backups");
|
||||||
if (!backupFolder.exists()) {
|
if (!backupFolder.exists()) {
|
||||||
if (!backupFolder.mkdir()) {
|
if (!backupFolder.mkdir()) {
|
||||||
Log.e(TAG, "Cannot create backup dir " + backupFolder.getAbsolutePath());
|
Log.e(TAG, "Cannot create backup dir " + backupFolder.getAbsolutePath());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// make folder visible over USB/MTP
|
||||||
|
MediaScannerConnection.scanFile(this, new String[]{backupFolder.toString()}, null, null);
|
||||||
}
|
}
|
||||||
File walletFile = Helper.getWalletFile(LoginActivity.this, walletName);
|
File walletFile = Helper.getWalletFile(LoginActivity.this, walletName);
|
||||||
File backupFile = new File(backupFolder, walletName);
|
File backupFile = new File(backupFolder, walletName);
|
||||||
|
@ -726,26 +729,17 @@ public class LoginActivity extends AppCompatActivity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean doInBackground(Void... params) {
|
protected Boolean doInBackground(Void... params) {
|
||||||
File newWalletFolder = new File(getStorageRoot(), ".new");
|
File newWalletFolder = getStorageRoot();
|
||||||
if (!newWalletFolder.exists()) {
|
|
||||||
if (!newWalletFolder.mkdir()) {
|
|
||||||
Log.e(TAG, "Cannot create new wallet dir " + newWalletFolder.getAbsolutePath());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!newWalletFolder.isDirectory()) {
|
if (!newWalletFolder.isDirectory()) {
|
||||||
Log.e(TAG, "New wallet dir " + newWalletFolder.getAbsolutePath() + "is not a directory");
|
Log.e(TAG, "Wallet dir " + newWalletFolder.getAbsolutePath() + "is not a directory");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
File cacheFile = new File(newWalletFolder, walletName);
|
File cacheFile = new File(newWalletFolder, walletName);
|
||||||
cacheFile.delete();
|
|
||||||
File keysFile = new File(newWalletFolder, walletName + ".keys");
|
File keysFile = new File(newWalletFolder, walletName + ".keys");
|
||||||
keysFile.delete();
|
|
||||||
File addressFile = new File(newWalletFolder, walletName + ".address.txt");
|
File addressFile = new File(newWalletFolder, walletName + ".address.txt");
|
||||||
addressFile.delete();
|
|
||||||
|
|
||||||
if (cacheFile.exists() || keysFile.exists() || addressFile.exists()) {
|
if (cacheFile.exists() || keysFile.exists() || addressFile.exists()) {
|
||||||
Log.e(TAG, "Cannot remove all old wallet files: " + cacheFile.getAbsolutePath());
|
Log.e(TAG, "Some wallet files already exist for " + cacheFile.getAbsolutePath());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -854,15 +848,11 @@ public class LoginActivity extends AppCompatActivity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAccept(final String name, final String password) {
|
public void onAccept(final String name, final String password) {
|
||||||
File newWalletFile = new File(new File(getStorageRoot(), ".new"), name);
|
|
||||||
File walletFolder = getStorageRoot();
|
File walletFolder = getStorageRoot();
|
||||||
File walletFile = new File(walletFolder, name);
|
File walletFile = new File(walletFolder, name);
|
||||||
boolean rc = copyWallet(newWalletFile, walletFile, false);
|
|
||||||
if (rc) {
|
|
||||||
walletFile.delete(); // when recovering wallets, the cache seems corrupt
|
walletFile.delete(); // when recovering wallets, the cache seems corrupt
|
||||||
// TODO: figure out why this is so? Only for a private testnet?
|
// TODO: figure out why this is so? Only for a private testnet?
|
||||||
rc = testWallet(walletFile.getAbsolutePath(), password) == Wallet.Status.Status_Ok;
|
boolean rc = testWallet(walletFile.getAbsolutePath(), password) == Wallet.Status.Status_Ok;
|
||||||
}
|
|
||||||
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
popFragmentStack(GENERATE_STACK);
|
popFragmentStack(GENERATE_STACK);
|
||||||
|
@ -871,7 +861,7 @@ public class LoginActivity extends AppCompatActivity
|
||||||
} else {
|
} else {
|
||||||
Log.e(TAG, "Wallet store failed to " + walletFile.getAbsolutePath());
|
Log.e(TAG, "Wallet store failed to " + walletFile.getAbsolutePath());
|
||||||
Toast.makeText(LoginActivity.this,
|
Toast.makeText(LoginActivity.this,
|
||||||
getString(R.string.generate_wallet_create_failed_2), Toast.LENGTH_LONG).show();
|
getString(R.string.generate_wallet_create_failed), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,8 +100,6 @@
|
||||||
<string name="generate_wallet_creating">Creating wallet</string>
|
<string name="generate_wallet_creating">Creating wallet</string>
|
||||||
<string name="generate_wallet_created">Wallet created</string>
|
<string name="generate_wallet_created">Wallet created</string>
|
||||||
<string name="generate_wallet_create_failed">Wallet create failed</string>
|
<string name="generate_wallet_create_failed">Wallet create failed</string>
|
||||||
<string name="generate_wallet_create_failed_1">Wallet create failed (1/2)</string>
|
|
||||||
<string name="generate_wallet_create_failed_2">Wallet create failed (2/2)</string>
|
|
||||||
<string name="generate_address_placeholder">9tDC52GsMjTNt4dpnRCwAF7ekVBkbkgkXGaMKTcSTpBhGpqkPX56jCNRydLq9oGjbbAQBsZhLfgmTKsntmxRd3TaJFYM2f8</string>
|
<string name="generate_address_placeholder">9tDC52GsMjTNt4dpnRCwAF7ekVBkbkgkXGaMKTcSTpBhGpqkPX56jCNRydLq9oGjbbAQBsZhLfgmTKsntmxRd3TaJFYM2f8</string>
|
||||||
<string name="generate_viewkey_placeholder">e2b99f4cc3d644774c4b118db05f8aa9967583a01ca4d47058c3860af10bd306</string>
|
<string name="generate_viewkey_placeholder">e2b99f4cc3d644774c4b118db05f8aa9967583a01ca4d47058c3860af10bd306</string>
|
||||||
<string name="generate_spendkey_placeholder">300a54208ab0a638a8407a12e3de946da76f5a9ded303338452332ec7755210d</string>
|
<string name="generate_spendkey_placeholder">300a54208ab0a638a8407a12e3de946da76f5a9ded303338452332ec7755210d</string>
|
||||||
|
|
Loading…
Reference in New Issue