diff --git a/app/build.gradle b/app/build.gradle index bacc2f10..c4d7dac8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "com.m2049r.xmrwallet" minSdkVersion 21 targetSdkVersion 28 - versionCode 201 - versionName "1.12.11 'Caerbannog'" + versionCode 300 + versionName "1.13.0 'ReStart'" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" externalNativeBuild { diff --git a/app/src/main/cpp/monerujo.cpp b/app/src/main/cpp/monerujo.cpp index c511be6c..dc6ac8f7 100644 --- a/app/src/main/cpp/monerujo.cpp +++ b/app/src/main/cpp/monerujo.cpp @@ -785,7 +785,7 @@ Java_com_m2049r_xmrwallet_model_Wallet_getDaemonBlockChainTargetHeight(JNIEnv *e } JNIEXPORT jboolean JNICALL -Java_com_m2049r_xmrwallet_model_Wallet_isSynchronized(JNIEnv *env, jobject instance) { +Java_com_m2049r_xmrwallet_model_Wallet_isSynchronizedJ(JNIEnv *env, jobject instance) { Bitmonero::Wallet *wallet = getHandle(env, instance); return static_cast(wallet->synchronized()); } @@ -909,6 +909,16 @@ Java_com_m2049r_xmrwallet_model_Wallet_refreshAsync(JNIEnv *env, jobject instanc wallet->refreshAsync(); } +//TODO virtual bool rescanBlockchain() = 0; + +//virtual void rescanBlockchainAsync() = 0; +JNIEXPORT void JNICALL +Java_com_m2049r_xmrwallet_model_Wallet_rescanBlockchainAsync(JNIEnv *env, jobject instance) { + Bitmonero::Wallet *wallet = getHandle(env, instance); + wallet->rescanBlockchainAsync(); +} + + //TODO virtual void setAutoRefreshInterval(int millis) = 0; //TODO virtual int autoRefreshInterval() const = 0; diff --git a/app/src/main/java/com/m2049r/xmrwallet/GenerateFragment.java b/app/src/main/java/com/m2049r/xmrwallet/GenerateFragment.java index e1b4603a..0d2e3174 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/GenerateFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/GenerateFragment.java @@ -438,7 +438,7 @@ public class GenerateFragment extends Fragment { height = RestoreHeight.getInstance().getHeight(parser.parse(restoreHeight)); } catch (ParseException ex) { } - if (height <= 0) + if ((height <= 0) && (restoreHeight.length() == 8)) try { // is it a date without dashes? SimpleDateFormat parser = new SimpleDateFormat("yyyyMMdd"); diff --git a/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java b/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java index b8e3429b..0d8572c4 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java +++ b/app/src/main/java/com/m2049r/xmrwallet/WalletActivity.java @@ -217,6 +217,20 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste releaseWakeLock(); } + private void onWalletRescan() { + try { + final WalletFragment walletFragment = (WalletFragment) + getSupportFragmentManager().findFragmentByTag(WalletFragment.class.getName()); + getWallet().rescanBlockchainAsync(); + synced = false; + walletFragment.unsync(); + invalidateOptionsMenu(); + } catch (ClassCastException ex) { + Timber.d(ex.getLocalizedMessage()); + // keep calm and carry on + } + } + @Override protected void onStop() { Timber.d("onStop()"); @@ -243,7 +257,7 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste public boolean onPrepareOptionsMenu(Menu menu) { MenuItem renameItem = menu.findItem(R.id.action_rename); if (renameItem != null) - renameItem.setVisible(hasWallet() && getWallet().isSynchronized()); + renameItem.setEnabled(hasWallet() && getWallet().isSynchronized()); MenuItem streetmodeItem = menu.findItem(R.id.action_streetmode); if (streetmodeItem != null) if (isStreetMode()) { @@ -251,12 +265,18 @@ public class WalletActivity extends BaseActivity implements WalletFragment.Liste } else { streetmodeItem.setIcon(R.drawable.gunther_24dp); } + final MenuItem rescanItem = menu.findItem(R.id.action_rescan); + if (rescanItem != null) + rescanItem.setEnabled(isSynced()); return super.onPrepareOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { + case R.id.action_rescan: + onWalletRescan(); + return true; case R.id.action_info: onWalletDetails(); return true; diff --git a/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java b/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java index 7e214d95..ea8e4aed 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/WalletFragment.java @@ -356,6 +356,14 @@ public class WalletFragment extends Fragment if (isVisible()) enableAccountsList(true); //otherwise it is enabled in onResume() } + public void unsync() { + if (!activityCallback.isWatchOnly()) { + bSend.setVisibility(View.INVISIBLE); + bSend.setEnabled(false); + } + if (isVisible()) enableAccountsList(false); //otherwise it is enabled in onResume() + } + boolean walletLoaded = false; public void onLoaded() { diff --git a/app/src/main/java/com/m2049r/xmrwallet/layout/NodeInfoAdapter.java b/app/src/main/java/com/m2049r/xmrwallet/layout/NodeInfoAdapter.java index 25b7dacf..14d6e0b4 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/layout/NodeInfoAdapter.java +++ b/app/src/main/java/com/m2049r/xmrwallet/layout/NodeInfoAdapter.java @@ -130,9 +130,9 @@ public class NodeInfoAdapter extends RecyclerView.Adapter max)) { + if (nativeAmount == null) { + ok = false; + } else { + try { + double amount = Double.parseDouble(nativeAmount); + if ((amount < min) || (amount > max)) { + ok = false; + } + } catch (NumberFormatException ex) { + // this cannot be + Timber.e(ex.getLocalizedMessage()); ok = false; } - } catch (NumberFormatException ex) { - // this cannot be - Timber.e(ex.getLocalizedMessage()); - ok = false; } if (!ok) { shakeAmountField(); diff --git a/app/src/main/res/drawable/ic_bookmark_24dp.xml b/app/src/main/res/drawable/ic_bookmark_24dp.xml deleted file mode 100644 index cf64e057..00000000 --- a/app/src/main/res/drawable/ic_bookmark_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_bookmark_border_24dp.xml b/app/src/main/res/drawable/ic_bookmark_border_24dp.xml deleted file mode 100644 index 1cae0eb2..00000000 --- a/app/src/main/res/drawable/ic_bookmark_border_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_favorite_24dp.xml b/app/src/main/res/drawable/ic_favorite_24dp.xml new file mode 100644 index 00000000..2cc9234a --- /dev/null +++ b/app/src/main/res/drawable/ic_favorite_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_favorite_border_24dp.xml b/app/src/main/res/drawable/ic_favorite_border_24dp.xml new file mode 100644 index 00000000..ae7b4362 --- /dev/null +++ b/app/src/main/res/drawable/ic_favorite_border_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/item_node.xml b/app/src/main/res/layout/item_node.xml index 85c7a6c2..546acb2b 100644 --- a/app/src/main/res/layout/item_node.xml +++ b/app/src/main/res/layout/item_node.xml @@ -18,7 +18,7 @@ android:padding="12dp" android:background="?android:attr/selectableItemBackgroundBorderless" android:gravity="center" - android:src="@drawable/ic_bookmark_border_24dp" /> + android:src="@drawable/ic_favorite_border_24dp" /> + \ No newline at end of file diff --git a/app/src/main/res/values-cat/strings.xml b/app/src/main/res/values-cat/strings.xml index 41818a3b..67665ca1 100644 --- a/app/src/main/res/values-cat/strings.xml +++ b/app/src/main/res/values-cat/strings.xml @@ -383,4 +383,6 @@ Restablir Alçada Start Monero App on %1$s + + Rescan! diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 45ebe8ce..161677a2 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -386,4 +386,6 @@ Wiederherstellungshöhe Start Monero App on %1$s + + Rescan! diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index bcd1db1b..5598201b 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -385,4 +385,6 @@ Ύψος ανάκτησης Start Monero App on %1$s + + Rescan! diff --git a/app/src/main/res/values-eo/strings.xml b/app/src/main/res/values-eo/strings.xml index a1f32886..27c22218 100644 --- a/app/src/main/res/values-eo/strings.xml +++ b/app/src/main/res/values-eo/strings.xml @@ -385,4 +385,6 @@ Restaŭralteco Start Monero App on %1$s + + Rescan! diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index d593f157..9e361f5c 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -375,4 +375,6 @@ Altura de Restauración Start Monero App on %1$s + + Rescan! diff --git a/app/src/main/res/values-et/strings.xml b/app/src/main/res/values-et/strings.xml index 59cc42bb..583bc5b4 100644 --- a/app/src/main/res/values-et/strings.xml +++ b/app/src/main/res/values-et/strings.xml @@ -383,4 +383,6 @@ Taastamise plokinumber Start Monero App on %1$s + + Rescan! diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 2a33c318..5008abbc 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -389,4 +389,6 @@ Hauteur de restauration Start Monero App on %1$s + + Rescan! diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index fb7b66d3..6293da10 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -387,4 +387,6 @@ Visszaállítási lánchossz Start Monero App on %1$s + + Rescan! diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 0f4e4215..1fde8ac5 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -388,4 +388,6 @@ Altezza di ripristino Start Monero App on %1$s + + Rescan! diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index b5c786f0..c1b7c559 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -394,4 +394,6 @@ Restore Height Start Monero App on %1$s + + Rescan! diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 2c1a8725..44159557 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -385,4 +385,6 @@ Restore Height Start Monero App on %1$s + + Rescan! diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 18960262..b8b916cc 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -385,4 +385,6 @@ Herstelpunt Start Monero App on %1$s + + Rescan! diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 08767a78..8b2f2bf7 100755 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -377,4 +377,6 @@ Restaurar da altura Start Monero App on %1$s + + Rescan! diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 1b3ee7cd..ae58d052 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -389,4 +389,6 @@ Restaurar de Altura Start Monero App on %1$s + + Rescan! diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 8ddd0266..b807a88b 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -385,4 +385,6 @@ Restaurează Monobloc Start Monero App on %1$s + + Rescan! diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 6aace5f0..e2d0a680 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -389,4 +389,6 @@ Восстановить высоту Start Monero App on %1$s + + Rescan! diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 0ed9d81e..d58a705e 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -386,4 +386,6 @@ Výška Start Monero App on %1$s + + Rescan! diff --git a/app/src/main/res/values-sr/strings.xml b/app/src/main/res/values-sr/strings.xml index 84405a59..8e16614c 100644 --- a/app/src/main/res/values-sr/strings.xml +++ b/app/src/main/res/values-sr/strings.xml @@ -385,4 +385,6 @@ Obnovi visinu Start Monero App on %1$s + + Rescan! diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index cdaa367b..829bf46f 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -370,4 +370,6 @@ Återställningshöjd Start Monero App on %1$s + + Rescan! diff --git a/app/src/main/res/values-ua/strings.xml b/app/src/main/res/values-ua/strings.xml index e22ead25..d61c7e0a 100644 --- a/app/src/main/res/values-ua/strings.xml +++ b/app/src/main/res/values-ua/strings.xml @@ -389,4 +389,6 @@ Відновити висоту Запуск Monero додатку через %1$s + + Rescan! diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index c5b5cbfe..05a27e9c 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -307,4 +307,6 @@ Restore Height Start Monero App on %1$s + + Rescan! diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 255fb8e6..918e9dab 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -384,4 +384,6 @@ Restore Height Start Monero App on %1$s + + Rescan! diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index bb1ec18f..a7f8ddba 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -436,4 +436,6 @@ Restore Height Start Monero App on %1$s + + Rescan! diff --git a/build.gradle b/build.gradle index 8bc6524d..aa80df27 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.2' + classpath 'com.android.tools.build:gradle:3.6.1' } } diff --git a/external-libs/monero/include/wallet2_api.h b/external-libs/monero/include/wallet2_api.h index e543a115..9c3df898 100644 --- a/external-libs/monero/include/wallet2_api.h +++ b/external-libs/monero/include/wallet2_api.h @@ -400,8 +400,8 @@ struct WalletListener /** * @brief called by device when passphrase entry is needed */ - virtual optional onDevicePassphraseRequest(bool on_device) { - if (!on_device) throw std::runtime_error("Not supported"); + virtual optional onDevicePassphraseRequest(bool & on_device) { + on_device = true; return optional(); } @@ -879,6 +879,14 @@ struct Wallet */ virtual void disposeTransaction(PendingTransaction * t) = 0; + /*! + * \brief Estimates transaction fee. + * \param destinations Vector consisting of pairs. + * \return Estimated fee. + */ + virtual uint64_t estimateTransactionFee(const std::vector> &destinations, + PendingTransaction::Priority priority) const = 0; + /*! * \brief exportKeyImages - exports key images to file * \param filename @@ -1085,10 +1093,12 @@ struct WalletManager * \param nettype Network type * \param restoreHeight restore from start height * \param kdf_rounds Number of rounds for key derivation function + * \param seed_offset Seed offset passphrase (optional) * \return Wallet instance (Wallet::status() needs to be called to check if recovered successfully) */ virtual Wallet * recoveryWallet(const std::string &path, const std::string &password, const std::string &mnemonic, - NetworkType nettype = MAINNET, uint64_t restoreHeight = 0, uint64_t kdf_rounds = 1) = 0; + NetworkType nettype = MAINNET, uint64_t restoreHeight = 0, uint64_t kdf_rounds = 1, + const std::string &seed_offset = {}) = 0; Wallet * recoveryWallet(const std::string &path, const std::string &password, const std::string &mnemonic, bool testnet = false, uint64_t restoreHeight = 0) // deprecated { @@ -1283,7 +1293,11 @@ struct WalletManager virtual std::string resolveOpenAlias(const std::string &address, bool &dnssec_valid) const = 0; //! checks for an update and returns version, hash and url - static std::tuple checkUpdates(const std::string &software, std::string subdir); + static std::tuple checkUpdates( + const std::string &software, + std::string subdir, + const char *buildtag = nullptr, + const char *current_version = nullptr); }; diff --git a/external-libs/script/monero-fetch.sh b/external-libs/script/monero-fetch.sh index f6650393..d6c23291 100755 --- a/external-libs/script/monero-fetch.sh +++ b/external-libs/script/monero-fetch.sh @@ -7,7 +7,7 @@ source script/env.sh cd $EXTERNAL_LIBS_BUILD_ROOT url="https://github.com/m2049r/monero" -version="release-v0.15-monerujo" +version="release-v0.16.0.0-monerujo" if [ ! -d "monero" ]; then git clone ${url} -b ${version} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 81e24fbe..72ed9979 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sat Nov 09 21:47:30 CET 2019 +#Sat Feb 29 10:39:20 CET 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip