From bc4aa0f772db610b5f3a832515ec80a74bbccc54 Mon Sep 17 00:00:00 2001 From: m2049r Date: Mon, 29 May 2023 17:01:07 +0200 Subject: [PATCH] Feature v0.18.2.2 (#900) * add Ledger Stax * update block heights * reestimate restore height only for mainnet * upgrade to gradle 8.0.1 * upgrade dependencies --- app/build.gradle | 8 +++---- .../m2049r/xmrwallet/GenerateFragment.java | 23 +++++++++++-------- .../m2049r/xmrwallet/model/WalletManager.java | 2 +- .../m2049r/xmrwallet/util/RestoreHeight.java | 14 +++++++++++ app/src/main/res/xml/usb_device_filter.xml | 4 ++++ build.gradle | 2 +- external-libs/VERSION | 2 +- gradle.properties | 3 +++ gradle/wrapper/gradle-wrapper.properties | 2 +- 9 files changed, 42 insertions(+), 18 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index fa8cb0c0eb..f03c323ff4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "com.m2049r.xmrwallet" minSdkVersion 21 targetSdkVersion 31 - versionCode 3130 - versionName "3.1.3 'Fluorine Fermi'" + versionCode 3200 + versionName "3.2.0 'Decoy Selection'" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" externalNativeBuild { cmake { @@ -123,7 +123,7 @@ static def getId(name) { dependencies { implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0")) - implementation 'androidx.core:core:1.10.0' + implementation 'androidx.core:core:1.10.1' implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.recyclerview:recyclerview:1.3.0' @@ -132,7 +132,7 @@ dependencies { implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.preference:preference:1.2.0' - implementation 'com.google.android.material:material:1.8.0' + implementation 'com.google.android.material:material:1.9.0' implementation 'me.dm7.barcodescanner:zxing:1.9.8' implementation "com.squareup.okhttp3:okhttp:4.9.3" diff --git a/app/src/main/java/com/m2049r/xmrwallet/GenerateFragment.java b/app/src/main/java/com/m2049r/xmrwallet/GenerateFragment.java index 46215829c7..57df4b1a10 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/GenerateFragment.java +++ b/app/src/main/java/com/m2049r/xmrwallet/GenerateFragment.java @@ -43,6 +43,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.textfield.TextInputLayout; +import com.m2049r.xmrwallet.model.NetworkType; import com.m2049r.xmrwallet.model.Wallet; import com.m2049r.xmrwallet.model.WalletManager; import com.m2049r.xmrwallet.util.FingerprintHelper; @@ -344,21 +345,23 @@ private long getHeight() { String restoreHeight = etWalletRestoreHeight.getEditText().getText().toString().trim(); if (restoreHeight.isEmpty()) return -1; - try { - // is it a date? - SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd"); - parser.setLenient(false); - height = RestoreHeight.getInstance().getHeight(parser.parse(restoreHeight)); - } catch (ParseException ignored) { - } - if ((height < 0) && (restoreHeight.length() == 8)) + if (WalletManager.getInstance().getNetworkType() == NetworkType.NetworkType_Mainnet) { try { - // is it a date without dashes? - SimpleDateFormat parser = new SimpleDateFormat("yyyyMMdd"); + // is it a date? + SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd"); parser.setLenient(false); height = RestoreHeight.getInstance().getHeight(parser.parse(restoreHeight)); } catch (ParseException ignored) { } + if ((height < 0) && (restoreHeight.length() == 8)) + try { + // is it a date without dashes? + SimpleDateFormat parser = new SimpleDateFormat("yyyyMMdd"); + parser.setLenient(false); + height = RestoreHeight.getInstance().getHeight(parser.parse(restoreHeight)); + } catch (ParseException ignored) { + } + } if (height < 0) try { // or is it a height? diff --git a/app/src/main/java/com/m2049r/xmrwallet/model/WalletManager.java b/app/src/main/java/com/m2049r/xmrwallet/model/WalletManager.java index 97ed886b8f..71f3e124b5 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/model/WalletManager.java +++ b/app/src/main/java/com/m2049r/xmrwallet/model/WalletManager.java @@ -93,7 +93,7 @@ public Wallet createWallet(File aFile, String password, String language, long he long walletHandle = createWalletJ(aFile.getAbsolutePath(), password, language, getNetworkType().getValue()); Wallet wallet = new Wallet(walletHandle); manageWallet(wallet); - if (wallet.getStatus().isOk()) { + if (wallet.getStatus().isOk() && (wallet.getNetworkType() == NetworkType.NetworkType_Mainnet)) { // (Re-)Estimate restore height based on what we know final long oldHeight = wallet.getRestoreHeight(); // Go back 4 days if we don't have a precise restore height diff --git a/app/src/main/java/com/m2049r/xmrwallet/util/RestoreHeight.java b/app/src/main/java/com/m2049r/xmrwallet/util/RestoreHeight.java index 00e595219c..7f03cc1487 100644 --- a/app/src/main/java/com/m2049r/xmrwallet/util/RestoreHeight.java +++ b/app/src/main/java/com/m2049r/xmrwallet/util/RestoreHeight.java @@ -139,6 +139,20 @@ static public RestoreHeight getInstance() { blockheight.put("2022-01-01", 2527316L); blockheight.put("2022-02-01", 2549605L); blockheight.put("2022-03-01", 2569711L); + blockheight.put("2022-04-01", 2591995L); + blockheight.put("2022-05-01", 2613603L); + blockheight.put("2022-06-01", 2635840L); + blockheight.put("2022-07-01", 2657395L); + blockheight.put("2022-08-01", 2679705L); + blockheight.put("2022-09-01", 2701991L); + blockheight.put("2022-10-01", 2723607L); + blockheight.put("2022-11-01", 2745899L); + blockheight.put("2022-12-01", 2767427L); + blockheight.put("2023-01-01", 2789763L); + blockheight.put("2023-02-01", 2811996L); + blockheight.put("2023-03-01", 2832118L); + blockheight.put("2023-04-01", 2854365L); + blockheight.put("2023-05-01", 2875972L); } public long getHeight(String date) { diff --git a/app/src/main/res/xml/usb_device_filter.xml b/app/src/main/res/xml/usb_device_filter.xml index cc448ce1f6..f6e935d30e 100644 --- a/app/src/main/res/xml/usb_device_filter.xml +++ b/app/src/main/res/xml/usb_device_filter.xml @@ -16,4 +16,8 @@ product-id="5" vendor-id="11415" /> + + \ No newline at end of file diff --git a/build.gradle b/build.gradle index e7ec15b151..5c6eb2fca0 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:7.2.2' + classpath 'com.android.tools.build:gradle:8.0.1' } } diff --git a/external-libs/VERSION b/external-libs/VERSION index 442ed87b80..20a30d37e1 100644 --- a/external-libs/VERSION +++ b/external-libs/VERSION @@ -1 +1 @@ -MONERUJO_monero master with monero release-v0.18.1.0-monerujo +MONERUJO_monero feature_v0.18.2.2 with monero release-v0.18.2.2-monerujo diff --git a/gradle.properties b/gradle.properties index bfa2b6974d..17726b9e3e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,3 +18,6 @@ org.gradle.jvmargs=-Xmx2048m android.useAndroidX=true android.enableJetifier=true +android.defaults.buildfeatures.buildconfig=true +android.nonTransitiveRClass=false +android.nonFinalResIds=false diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 669386b870..3a02907943 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists