,
+ val total : Long,
)
data class ParseResult (
@@ -321,10 +322,6 @@ class ExecuteSendFromOrchard {
println("\nPropose:")
println(proposeJson)
- val sendProgressJson: String = uniffi.zingo.executeCommand("sendprogress", "")
- println("\nSend progress:")
- println(sendProgressJson)
-
val confirmJson: String = uniffi.zingo.executeCommand("confirm", "")
println("\nConfirm Txid:")
println(confirmJson)
@@ -371,7 +368,7 @@ class UpdateCurrentPriceAndValueTransfersFromSeed {
println("\nSync:")
println(syncJson)
- val valueTranfersJson: String = uniffi.zingo.getValueTransfers()
+ val valueTranfersJson: String = uniffi.zingo.getValueTransfers("50")
println("\nValue Transfers:")
println(valueTranfersJson)
val valueTranfers: ValueTransfers = mapper.readValue(valueTranfersJson)
@@ -425,7 +422,7 @@ class ExecuteSaplingBalanceFromSeed {
println("\nSync:")
println(syncJson)
- val valueTranfersJson: String = uniffi.zingo.getValueTransfers()
+ val valueTranfersJson: String = uniffi.zingo.getValueTransfers("50")
println("\nValue Transfers:")
println(valueTranfersJson)
diff --git a/android/app/src/debug/java/org/ZingoLabs/Zingo/ReactNativeFlipper.java b/android/app/src/debug/java/org/ZingoLabs/Zingo/ReactNativeFlipper.java
deleted file mode 100644
index b5d6d12a0..000000000
--- a/android/app/src/debug/java/org/ZingoLabs/Zingo/ReactNativeFlipper.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the LICENSE file in the root
- * directory of this source tree.
- */
-package org.ZingoLabs.Zingo;
-
-import android.content.Context;
-import com.facebook.flipper.android.AndroidFlipperClient;
-import com.facebook.flipper.android.utils.FlipperUtils;
-import com.facebook.flipper.core.FlipperClient;
-import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
-import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
-import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
-import com.facebook.flipper.plugins.inspector.DescriptorMapping;
-import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
-import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
-import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
-import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
-import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
-import com.facebook.react.ReactInstanceManager;
-import com.facebook.react.bridge.ReactContext;
-import com.facebook.react.modules.network.NetworkingModule;
-import okhttp3.OkHttpClient;
-
-public class ReactNativeFlipper {
- public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
- if (FlipperUtils.shouldEnableFlipper(context)) {
- final FlipperClient client = AndroidFlipperClient.getInstance(context);
-
- client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
- client.addPlugin(new ReactFlipperPlugin());
- client.addPlugin(new DatabasesFlipperPlugin(context));
- client.addPlugin(new SharedPreferencesFlipperPlugin(context));
- client.addPlugin(CrashReporterPlugin.getInstance());
-
- NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
- NetworkingModule.setCustomClientBuilder(
- new NetworkingModule.CustomClientBuilder() {
- @Override
- public void apply(OkHttpClient.Builder builder) {
- builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
- }
- });
- client.addPlugin(networkFlipperPlugin);
- client.start();
-
- // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
- // Hence we run if after all native modules have been initialized
- ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
- if (reactContext == null) {
- reactInstanceManager.addReactInstanceEventListener(
- new ReactInstanceManager.ReactInstanceEventListener() {
- @Override
- public void onReactContextInitialized(ReactContext reactContext) {
- reactInstanceManager.removeReactInstanceEventListener(this);
- reactContext.runOnNativeModulesQueueThread(
- new Runnable() {
- @Override
- public void run() {
- client.addPlugin(new FrescoFlipperPlugin());
- }
- });
- }
- });
- } else {
- client.addPlugin(new FrescoFlipperPlugin());
- }
- }
- }
-}
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index fc523b090..36a877314 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -5,7 +5,6 @@
-
@@ -25,7 +24,7 @@
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:screenOrientation="portrait"
- android:windowSoftInputMode="adjustResize"
+ android:windowSoftInputMode="adjustPan"
android:exported="true"
tools:ignore="LockedOrientationActivity">
@@ -37,8 +36,8 @@
-
-
+
+
diff --git a/android/app/src/main/java/org/ZingoLabs/Zingo/BackgroundSyncWorker.kt b/android/app/src/main/java/org/ZingoLabs/Zingo/BackgroundSyncWorker.kt
index efe8a3579..c52dc3e34 100644
--- a/android/app/src/main/java/org/ZingoLabs/Zingo/BackgroundSyncWorker.kt
+++ b/android/app/src/main/java/org/ZingoLabs/Zingo/BackgroundSyncWorker.kt
@@ -32,6 +32,7 @@ import kotlin.time.DurationUnit
import kotlin.time.toDuration
import kotlin.time.toJavaDuration
import org.ZingoLabs.Zingo.Constants.*
+import java.io.FileInputStream
class BackgroundSyncWorker(context: Context, workerParams: WorkerParameters) : Worker(context, workerParams) {
@@ -107,7 +108,7 @@ class BackgroundSyncWorker(context: Context, workerParams: WorkerParameters) : W
private fun loadWalletFile(rpcModule: RPCModule) {
// I have to init from wallet file in order to do the sync
// and I need to read the settings.json to find the server & chain type
- MainApplication.getAppContext()?.openFileInput("settings.json")?.use { file ->
+ MainApplication.getAppContext()?.openFileInput("settings.json")?.use { file: FileInputStream ->
val settingsBytes = file.readBytes()
file.close()
val settingsString = settingsBytes.toString(Charsets.UTF_8)
@@ -160,7 +161,7 @@ class BackgroundSyncWorker(context: Context, workerParams: WorkerParameters) : W
class BSCompanion {
companion object {
- private const val taskID = "Zingo_Processing_Task_ID"
+ private const val TASKID = "Zingo_Processing_Task_ID"
private val SYNC_PERIOD = 24.hours
private val SYNC_DAY_SHIFT = 1.days // Move to tomorrow
private val SYNC_START_TIME_HOURS = 3.hours // Start around 3 a.m. at night
@@ -189,13 +190,13 @@ class BSCompanion {
Log.i("SCHEDULING_TASK", "Enqueuing the background task - Background")
WorkManager.getInstance(reactContext)
.enqueueUniquePeriodicWork(
- taskID,
- ExistingPeriodicWorkPolicy.REPLACE,
+ TASKID,
+ ExistingPeriodicWorkPolicy.UPDATE,
workRequest
)
Log.i("SCHEDULING_TASK", "Task info ${WorkManager.getInstance(reactContext).getWorkInfosForUniqueWork(
- taskID).get()}")
+ TASKID).get()}")
}
private fun calculateTargetTimeDifference(): Duration {
@@ -236,7 +237,7 @@ class BSCompanion {
Log.i("SCHEDULING_TASK", "Cancel background Task")
WorkManager.getInstance(reactContext)
- .cancelUniqueWork(taskID)
+ .cancelUniqueWork(TASKID)
}
}
diff --git a/android/app/src/main/java/org/ZingoLabs/Zingo/MainActivity.kt b/android/app/src/main/java/org/ZingoLabs/Zingo/MainActivity.kt
index 8851807c0..4900d77a5 100644
--- a/android/app/src/main/java/org/ZingoLabs/Zingo/MainActivity.kt
+++ b/android/app/src/main/java/org/ZingoLabs/Zingo/MainActivity.kt
@@ -4,7 +4,7 @@ import android.os.Bundle
import android.util.Log
import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
-import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint
+import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate
class MainActivity : ReactActivity() {
@@ -14,19 +14,19 @@ class MainActivity : ReactActivity() {
*/
private var isStarting = true
- override fun getMainComponentName(): String {
- return "Zingo"
- }
+
+ override fun getMainComponentName(): String = "Zingo"
+
override fun onCreate(savedInstanceState: Bundle?) {
Log.i("ON_CREATE", "Starting main activity")
super.onCreate(null)
}
- override fun createReactActivityDelegate(): ReactActivityDelegate? {
+ override fun createReactActivityDelegate(): ReactActivityDelegate {
return DefaultReactActivityDelegate(
this,
mainComponentName, // If you opted-in for the New Architecture, we enable the Fabric Renderer.
- DefaultNewArchitectureEntryPoint.fabricEnabled
+ fabricEnabled
)
}
override fun onPause() {
diff --git a/android/app/src/main/java/org/ZingoLabs/Zingo/MainApplication.kt b/android/app/src/main/java/org/ZingoLabs/Zingo/MainApplication.kt
index 543f51b85..ce15bf6db 100644
--- a/android/app/src/main/java/org/ZingoLabs/Zingo/MainApplication.kt
+++ b/android/app/src/main/java/org/ZingoLabs/Zingo/MainApplication.kt
@@ -1,43 +1,40 @@
package org.ZingoLabs.Zingo
import android.app.Application
-import android.content.Context
-import com.facebook.react.*
-import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint
+import com.facebook.react.PackageList
+import com.facebook.react.ReactApplication
+import com.facebook.react.ReactHost
+import com.facebook.react.ReactNativeHost
+import com.facebook.react.ReactPackage
+import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
+import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.soloader.SoLoader
+import android.content.Context
import java.lang.ref.WeakReference
-
class MainApplication : Application(), ReactApplication {
- private val mReactNativeHost: ReactNativeHost = object : DefaultReactNativeHost(this) {
- override fun getUseDeveloperSupport(): Boolean {
- return BuildConfig.DEBUG
- }
-
- override fun getPackages(): List {
- // Packages that cannot be autolinked yet can be added manually here, for example:
- // packages.add(new MyReactNativePackage());
- val packages: MutableList = PackageList(this).packages
-
- packages.add(RPCPackage())
- return packages
- }
-
- override fun getJSMainModuleName(): String {
- return "index"
- }
-
- override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
+ override val reactNativeHost: ReactNativeHost =
+ object : DefaultReactNativeHost(this) {
+ override fun getPackages(): List =
+ PackageList(this).packages.apply {
+ // Packages that cannot be autolinked yet can be added manually here, for example:
+ // add(MyReactNativePackage())
+ add(RPCPackage())
+ }
+
+ override fun getJSMainModuleName(): String = "index"
+
+ override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
+ override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
}
-
- override fun getReactNativeHost(): ReactNativeHost {
- return mReactNativeHost
- }
-
+
+ override val reactHost: ReactHost
+ get() = getDefaultReactHost(this.applicationContext, reactNativeHost)
+
override fun onCreate() {
super.onCreate()
context = WeakReference(applicationContext)
@@ -46,7 +43,7 @@ class MainApplication : Application(), ReactApplication {
SoLoader.init(this, false)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
- DefaultNewArchitectureEntryPoint.load()
+ load()
}
}
diff --git a/android/app/src/main/java/org/ZingoLabs/Zingo/RPCModule.kt b/android/app/src/main/java/org/ZingoLabs/Zingo/RPCModule.kt
index 7518c4049..733cec0ee 100644
--- a/android/app/src/main/java/org/ZingoLabs/Zingo/RPCModule.kt
+++ b/android/app/src/main/java/org/ZingoLabs/Zingo/RPCModule.kt
@@ -7,11 +7,9 @@ import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReactContextBaseJavaModule
import com.facebook.react.bridge.ReactMethod
import com.facebook.react.bridge.Promise
-
import java.io.File
import java.io.FileNotFoundException
import java.io.IOException
-import kotlin.concurrent.thread
import org.ZingoLabs.Zingo.Constants.*
import kotlinx.coroutines.*
@@ -434,16 +432,12 @@ class RPCModule internal constructor(private val reactContext: ReactApplicationC
saveWalletFile()
}
- withContext(Dispatchers.Main) {
- promise.resolve(resp)
- }
+ promise.resolve(resp)
} catch (e: Exception) {
val errorMessage = "Error: executing command '$cmd': ${e.localizedMessage}"
Log.e("MAIN", errorMessage, e)
- withContext(Dispatchers.Main) {
- promise.resolve(errorMessage)
- }
+ promise.resolve(errorMessage)
}
}
}
@@ -454,16 +448,12 @@ class RPCModule internal constructor(private val reactContext: ReactApplicationC
try {
val result = saveWalletFile()
- withContext(Dispatchers.Main) {
- promise.resolve(result)
- }
+ promise.resolve(result)
} catch (e: Exception) {
val errorMessage = "Error: saving wallet: ${e.localizedMessage}"
Log.e("MAIN", errorMessage, e)
- withContext(Dispatchers.Main) {
- promise.resolve(errorMessage)
- }
+ promise.resolve(errorMessage)
}
}
}
@@ -474,16 +464,12 @@ class RPCModule internal constructor(private val reactContext: ReactApplicationC
try {
val result = saveWalletBackupFile()
- withContext(Dispatchers.Main) {
- promise.resolve(result)
- }
+ promise.resolve(result)
} catch (e: Exception) {
val errorMessage = "Error: saving wallet backup: ${e.localizedMessage}"
Log.e("MAIN", errorMessage, e)
- withContext(Dispatchers.Main) {
- promise.resolve(errorMessage)
- }
+ promise.resolve(errorMessage)
}
}
}
@@ -495,15 +481,12 @@ class RPCModule internal constructor(private val reactContext: ReactApplicationC
uniffi.zingo.initLogging()
val resp = uniffi.zingo.getLatestBlockServer(server)
- withContext(Dispatchers.Main) {
- promise.resolve(resp)
- }
+ promise.resolve(resp)
} catch (e: Exception) {
val errorMessage = "Error: getting latest block: ${e.localizedMessage}"
Log.e("MAIN", errorMessage, e)
- withContext(Dispatchers.Main) {
- promise.resolve(errorMessage)
- }
+
+ promise.resolve(errorMessage)
}
}
}
@@ -515,15 +498,12 @@ class RPCModule internal constructor(private val reactContext: ReactApplicationC
uniffi.zingo.initLogging()
val resp = uniffi.zingo.getDeveloperDonationAddress()
- withContext(Dispatchers.Main) {
- promise.resolve(resp)
- }
+ promise.resolve(resp)
} catch (e: Exception) {
val errorMessage = "Error: getting donation address: ${e.localizedMessage}"
Log.e("MAIN", errorMessage, e)
- withContext(Dispatchers.Main) {
- promise.resolve(errorMessage)
- }
+
+ promise.resolve(errorMessage)
}
}
}
@@ -535,35 +515,29 @@ class RPCModule internal constructor(private val reactContext: ReactApplicationC
uniffi.zingo.initLogging()
val resp = uniffi.zingo.getZenniesForZingoDonationAddress()
- withContext(Dispatchers.Main) {
- promise.resolve(resp)
- }
+ promise.resolve(resp)
} catch (e: Exception) {
val errorMessage = "Error: getting Zennies donation address: ${e.localizedMessage}"
Log.e("MAIN", errorMessage, e)
- withContext(Dispatchers.Main) {
- promise.resolve(errorMessage)
- }
+
+ promise.resolve(errorMessage)
}
}
}
@ReactMethod
- fun getValueTransfersList(promise: Promise) {
+ fun getValueTransfersList(items: String, promise: Promise) {
CoroutineScope(Dispatchers.IO).launch {
try {
uniffi.zingo.initLogging()
- val resp = uniffi.zingo.getValueTransfers()
+ val resp = uniffi.zingo.getValueTransfers(items)
- withContext(Dispatchers.Main) {
- promise.resolve(resp)
- }
+ promise.resolve(resp)
} catch (e: Exception) {
val errorMessage = "Error: getting value transfers list: ${e.localizedMessage}"
Log.e("MAIN", errorMessage, e)
- withContext(Dispatchers.Main) {
- promise.resolve(errorMessage)
- }
+
+ promise.resolve(errorMessage)
}
}
}
@@ -575,15 +549,12 @@ class RPCModule internal constructor(private val reactContext: ReactApplicationC
uniffi.zingo.initLogging()
val resp = uniffi.zingo.getTransactionSummaries()
- withContext(Dispatchers.Main) {
- promise.resolve(resp)
- }
+ promise.resolve(resp)
} catch (e: Exception) {
val errorMessage = "Error: getting transaction summaries list: ${e.localizedMessage}"
Log.e("MAIN", errorMessage, e)
- withContext(Dispatchers.Main) {
- promise.resolve(errorMessage)
- }
+
+ promise.resolve(errorMessage)
}
}
}
@@ -595,15 +566,11 @@ class RPCModule internal constructor(private val reactContext: ReactApplicationC
uniffi.zingo.initLogging()
val resp = uniffi.zingo.setCryptoDefaultProviderToRing()
- withContext(Dispatchers.Main) {
- promise.resolve(resp)
- }
+ promise.resolve(resp)
} catch (e: Exception) {
val errorMessage = "Error: setting crypto default provider: ${e.localizedMessage}"
Log.e("MAIN", errorMessage, e)
- withContext(Dispatchers.Main) {
- promise.resolve(errorMessage)
- }
+ promise.resolve(errorMessage)
}
}
}
diff --git a/android/build.gradle b/android/build.gradle
index 7cfaa3e4a..04ce3f5e0 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -6,20 +6,22 @@ buildscript {
minSdkVersion = 24
compileSdkVersion = 34
targetSdkVersion = 34
- ndkVersion = "24.0.8215888"
- kotlinVersion = '1.8.20'
+ ndkVersion = "25.2.9519653"
+ kotlinVersion = '1.8.22'
}
repositories {
google()
mavenCentral()
}
dependencies {
- classpath('com.android.tools.build:gradle:8.2.1')
- classpath("com.facebook.react:react-native-gradle-plugin")
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
+ classpath('com.android.tools.build:gradle:8.3.2')
+ classpath("com.facebook.react:react-native-gradle-plugin")
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin"
}
}
+apply plugin: "com.facebook.react.rootproject"
+
allprojects {
repositories {
google()
diff --git a/android/gradle.properties b/android/gradle.properties
index 63747fd0e..d4c32ecae 100644
--- a/android/gradle.properties
+++ b/android/gradle.properties
@@ -26,9 +26,6 @@ android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
-# Version of flipper SDK to use with React Native
-FLIPPER_VERSION=0.182.0
-
# Use this property to specify which architecture you want to build.
# You can also override it from the CLI using
# ./gradlew -PreactNativeArchitectures=x86_64
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
index 8612e3f67..9cbf3239c 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,7 @@
+#Fri Jan 24 19:05:10 MST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/android/gradlew b/android/gradlew
index 2fe81a7d9..43304d37e 100755
--- a/android/gradlew
+++ b/android/gradlew
@@ -37,15 +37,13 @@ while [ -h "$PRG" ] ; do
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
+APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
-
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@@ -98,10 +96,13 @@ location of your Java installation."
fi
else
JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
+ fi
fi
# Increase the maximum file descriptors if we can.
@@ -177,6 +178,9 @@ save () {
}
APP_ARGS=`save "$@"`
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
diff --git a/app/AppState/AppContextLoaded.ts b/app/AppState/AppContextLoaded.ts
index f897078ca..af2074287 100644
--- a/app/AppState/AppContextLoaded.ts
+++ b/app/AppState/AppContextLoaded.ts
@@ -3,7 +3,6 @@ import { StackScreenProps } from '@react-navigation/stack';
import TotalBalanceClass from './classes/TotalBalanceClass';
import AddressClass from './classes/AddressClass';
import SendPageStateClass from './classes/SendPageStateClass';
-import SendProgressClass from './classes/SendProgressClass';
import ReceivePageStateClass from './classes/ReceivePageStateClass';
import WalletSettingsClass from './classes/WalletSettingsClass';
import AddressBookFileClass from './classes/AddressBookFileClass';
@@ -39,9 +38,13 @@ export default interface AppContextLoaded {
// List of all T and Z and O value transfers
valueTransfers: ValueTransferType[] | null;
+ valueTransfersFetchItems: number;
+ valueTransfersTotal: number | null;
// List of messages
messages: ValueTransferType[] | null;
+ messagesFetchItems: number;
+ messagesTotal: number | null;
// The state of the send page
sendPageState: SendPageStateClass;
@@ -58,14 +61,11 @@ export default interface AppContextLoaded {
// syncing Info about the status of the process
syncingStatus: SyncingStatusClass;
- // Build progress from Tx
- sendProgress: SendProgressClass;
-
// wallet recovery info
wallet: WalletType;
// active UA in the wallet
- uaAddress: string;
+ uOrchardAddress: string;
// zec price in USD from internet
zecPrice: ZecPriceType;
diff --git a/app/AppState/classes/AddressBookFileClass.ts b/app/AppState/classes/AddressBookFileClass.ts
index 20f2c8287..98907b4d9 100644
--- a/app/AppState/classes/AddressBookFileClass.ts
+++ b/app/AppState/classes/AddressBookFileClass.ts
@@ -1,9 +1,11 @@
export default class AddressBookFileClass {
label: string;
address: string;
+ uOrchardAddress?: string;
- constructor(label: string, address: string) {
+ constructor(label: string, address: string, uOrchardAddress?: string) {
this.label = label;
this.address = address;
+ this.uOrchardAddress = uOrchardAddress;
}
}
diff --git a/app/AppState/classes/AddressClass.ts b/app/AppState/classes/AddressClass.ts
index b6183b731..0e096d747 100644
--- a/app/AppState/classes/AddressClass.ts
+++ b/app/AppState/classes/AddressClass.ts
@@ -1,13 +1,13 @@
import { AddressKindEnum } from '../enums/AddressKindEnum';
export default class AddressClass {
- uaAddress: string;
+ uOrchardAddress: string;
address: string;
addressKind: AddressKindEnum;
receivers: string;
- constructor(uaAddress: string, address: string, addressKind: AddressKindEnum, receivers: string) {
- this.uaAddress = uaAddress;
+ constructor(uOrchardAddress: string, address: string, addressKind: AddressKindEnum, receivers: string) {
+ this.uOrchardAddress = uOrchardAddress;
this.address = address;
this.addressKind = addressKind;
this.receivers = receivers;
diff --git a/app/AppState/classes/SendProgressClass.ts b/app/AppState/classes/SendProgressClass.ts
deleted file mode 100644
index e3b7e71e7..000000000
--- a/app/AppState/classes/SendProgressClass.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-export default class SendProgressClass {
- sendInProgress: boolean;
- progress: number;
- total: number;
- etaSeconds: number | string;
-
- constructor(progress: number, total: number, etaSeconds: number | string) {
- this.sendInProgress = false;
- this.progress = progress;
- this.total = total;
- this.etaSeconds = etaSeconds;
- }
-}
diff --git a/app/AppState/const/GlobalConst.ts b/app/AppState/const/GlobalConst.ts
index 347e22be9..81e34dff7 100644
--- a/app/AppState/const/GlobalConst.ts
+++ b/app/AppState/const/GlobalConst.ts
@@ -21,4 +21,5 @@ export const GlobalConst = {
background: '@background',
keyKeyChain: 'ZINGO_SEED_BIRTHDAY',
serviceKeyChain: 'ZINGO',
+ replyTo: '\nReply to: \n',
};
diff --git a/app/AppState/enums/CommandAddressesEnum.ts b/app/AppState/enums/CommandAddressesEnum.ts
new file mode 100644
index 000000000..af25d21bd
--- /dev/null
+++ b/app/AppState/enums/CommandAddressesEnum.ts
@@ -0,0 +1,5 @@
+export enum CommandAddressesEnum {
+ full = '',
+ shielded = 'shielded',
+ orchard = 'orchard',
+}
diff --git a/app/AppState/enums/CommandEnum.ts b/app/AppState/enums/CommandEnum.ts
index a28df940d..53139feb8 100644
--- a/app/AppState/enums/CommandEnum.ts
+++ b/app/AppState/enums/CommandEnum.ts
@@ -1,5 +1,4 @@
export enum CommandEnum {
- sendprogress = 'sendprogress',
changeserver = 'changeserver',
walletKind = 'wallet_kind',
interruptSyncAfterBatch = 'interrupt_sync_after_batch',
diff --git a/app/AppState/enums/FilterEnum.ts b/app/AppState/enums/FilterEnum.ts
new file mode 100644
index 000000000..9b614ea59
--- /dev/null
+++ b/app/AppState/enums/FilterEnum.ts
@@ -0,0 +1,5 @@
+export enum FilterEnum {
+ all = 'all',
+ contacts = 'contacts',
+ noContacts = 'no contacts',
+}
diff --git a/app/AppState/enums/ShieldedEnum.ts b/app/AppState/enums/ShieldedEnum.ts
new file mode 100644
index 000000000..71b15499f
--- /dev/null
+++ b/app/AppState/enums/ShieldedEnum.ts
@@ -0,0 +1,6 @@
+export enum ShieldedEnum {
+ uFull = 'uFull',
+ uOrchardSapling = 'uOrchardSapling',
+ uOrchard = 'uOrchard',
+ sapling = 'sapling',
+}
diff --git a/app/AppState/index.js b/app/AppState/index.js
index 9974673bf..0572c9079 100644
--- a/app/AppState/index.js
+++ b/app/AppState/index.js
@@ -2,7 +2,6 @@ import AddressClass from './classes/AddressClass';
import AddressBookFileClass from './classes/AddressBookFileClass';
import ReceivePageStateClass from './classes/ReceivePageStateClass';
import SendPageStateClass from './classes/SendPageStateClass';
-import SendProgressClass from './classes/SendProgressClass';
import SettingsFileClass from './classes/SettingsFileClass';
import SyncingStatusClass from './classes/SyncingStatusClass';
import ToAddrClass from './classes/ToAddrClass';
@@ -22,6 +21,7 @@ import ZecPriceType from './types/ZecPriceType';
import SecurityType from './types/SecurityType';
import ServerUrisType from './types/ServerUrisType';
import ValueTransferType from './types/ValueTransferType';
+import ContactType from './types/ContactType';
import { CommandEnum } from './enums/CommandEnum';
import { AddressBookActionEnum } from './enums/AddressBookActionEnum';
@@ -51,6 +51,7 @@ import { PrivacyLevelFromEnum } from './enums/PrivacyLevelFromEnum';
import { SecurityTypeEnum } from './enums/SecurityTypeEnum';
import { EventListenerEnum } from './enums/EventListenerEnum';
import { ValueTransferKindEnum } from './enums/ValueTransferKindEnum';
+import { FilterEnum } from './enums/FilterEnum';
import { GlobalConst } from './const/GlobalConst';
@@ -68,7 +69,6 @@ export {
AddressBookFileClass,
ReceivePageStateClass,
SendPageStateClass,
- SendProgressClass,
SettingsFileClass,
SyncingStatusClass,
ToAddrClass,
@@ -87,6 +87,7 @@ export {
SecurityType,
ServerUrisType,
ValueTransferType,
+ ContactType,
CommandEnum,
AddressBookActionEnum,
MenuItemEnum,
@@ -115,5 +116,6 @@ export {
SecurityTypeEnum,
EventListenerEnum,
ValueTransferKindEnum,
+ FilterEnum,
GlobalConst,
};
diff --git a/app/AppState/types/ContactType.ts b/app/AppState/types/ContactType.ts
new file mode 100644
index 000000000..2fcc990bd
--- /dev/null
+++ b/app/AppState/types/ContactType.ts
@@ -0,0 +1,15 @@
+import { RPCValueTransfersStatusEnum } from '../../rpc/enums/RPCValueTransfersStatusEnum';
+import { ValueTransferKindEnum } from '../enums/ValueTransferKindEnum';
+
+export default interface ContactType {
+ address: string;
+
+ // last message
+ time: number;
+ memos: string[];
+ confirmations: number;
+ status?: RPCValueTransfersStatusEnum;
+ kind?: ValueTransferKindEnum;
+
+ // eslint-disable-next-line semi
+}
diff --git a/app/AppState/types/ValueTransferType.ts b/app/AppState/types/ValueTransferType.ts
index aa7c785d4..638c5b1c3 100644
--- a/app/AppState/types/ValueTransferType.ts
+++ b/app/AppState/types/ValueTransferType.ts
@@ -4,7 +4,7 @@ import { RPCValueTransfersStatusEnum } from '../../rpc/enums/RPCValueTransfersSt
export default interface ValueTransferType {
txid: string;
- kind?: ValueTransferKindEnum; // like kind
+ kind: ValueTransferKindEnum;
fee?: number;
confirmations: number;
time: number;
diff --git a/app/LoadedApp/LoadedApp.tsx b/app/LoadedApp/LoadedApp.tsx
index 0dbade6e0..90e7c9adf 100644
--- a/app/LoadedApp/LoadedApp.tsx
+++ b/app/LoadedApp/LoadedApp.tsx
@@ -34,7 +34,6 @@ import {
InfoType,
ToAddrClass,
SyncingStatusClass,
- SendProgressClass,
WalletSettingsClass,
AddressClass,
ZecPriceType,
@@ -273,10 +272,35 @@ export default function LoadedApp(props: LoadedAppProps) {
}
// adding `Zenny Tips` address always.
- const ab = await AddressBookFileImpl.writeAddressBookItem(
+ let ab = await AddressBookFileImpl.writeAddressBookItem(
translate('zenny-tips-ab') as string,
await Utils.getZenniesDonationAddress(server.chainName),
+ '',
);
+
+ // reply-to change, from full UA to only orchard UA.
+ // we need to calculate the only orchard UA for all the
+ // contacts with a full UA stored in the Address Book.
+ // We need to identify the old transaction memos (with full UA)
+ // and we need to idenfify the new transaction memos (with only orchard UA)
+
+ // if some contact don't have the new field: `uOrchardAddress` then
+ // the App have to create and calculate it if needed.
+ const toUpdate = ab.filter((a: AddressBookFileClass) => !a.hasOwnProperty('uOrchardAddress'));
+ console.log('Address Book -> TO UPDATE', toUpdate);
+ if (toUpdate.length > 0) {
+ for (let i = 0; i < toUpdate.length; i++) {
+ const a = toUpdate[i];
+ const validAddress: { isValid: boolean; onlyOrchardUA: string } = await Utils.isValidAddress(
+ a.address,
+ server.chainName,
+ );
+ if (validAddress.isValid) {
+ //ab = await AddressBookFileImpl.removeAddressBookItem(a.label, a.address);
+ ab = await AddressBookFileImpl.writeAddressBookItem(a.label, a.address, validAddress.onlyOrchardUA);
+ }
+ }
+ }
setAddressBook(ab);
setLoading(false);
@@ -384,16 +408,19 @@ export class LoadedAppClass extends Component {
+ setValueTransfersList = async (valueTransfers: ValueTransferType[], valueTransfersTotal: number) => {
const basicFirstViewSeed = (await SettingsFileImpl.readSettings()).basicFirstViewSeed;
// only for basic mode
if (this.state.mode === ModeEnum.basic) {
@@ -793,7 +818,7 @@ export class LoadedAppClass extends Component 0 && vtNew[0].confirmations > 0) {
let message: string = '';
let title: string = '';
- if (vtNew[0].kind === ValueTransferKindEnum.Received) {
+ if (vtNew[0].kind === ValueTransferKindEnum.Received && vtNew[0].amount > 0) {
message =
(this.state.translate('loadedapp.incoming-funds') as string) +
(this.state.translate('history.received') as string) +
@@ -823,7 +848,7 @@ export class LoadedAppClass extends Component 0) {
message =
(this.state.translate('loadedapp.valuetransfer-confirmed') as string) +
(this.state.translate('history.memotoself') as string) +
@@ -835,7 +860,7 @@ export class LoadedAppClass extends Component 0) {
message =
(this.state.translate('loadedapp.valuetransfer-confirmed') as string) +
(this.state.translate('history.sendtoself') as string) +
@@ -847,20 +872,18 @@ export class LoadedAppClass extends Component 0) {
+ // not so sure about this `kind`...
+ // I guess the wallet is receiving some refund from a TEX sent.
message =
- (this.state.translate('loadedapp.valuetransfer-confirmed') as string) +
- (this.state.translate('history.rejection') as string) +
- (vtNew[0].fee
- ? ((' ' + this.state.translate('send.fee')) as string) +
- ' ' +
- Utils.parseNumberFloatToStringLocale(vtNew[0].fee, 8) +
- ' ' +
- this.state.info.currencyName
- : '');
- title = this.state.translate('loadedapp.send-menu') as string;
- } else if (vtNew[0].kind === ValueTransferKindEnum.Shield) {
+ (this.state.translate('loadedapp.incoming-funds') as string) +
+ (this.state.translate('history.received') as string) +
+ ' ' +
+ Utils.parseNumberFloatToStringLocale(vtNew[0].amount, 8) +
+ ' ' +
+ this.state.info.currencyName;
+ title = this.state.translate('loadedapp.receive-menu') as string;
+ } else if (vtNew[0].kind === ValueTransferKindEnum.Shield && vtNew[0].amount > 0) {
message =
(this.state.translate('loadedapp.incoming-funds') as string) +
(this.state.translate('history.shield') as string) +
@@ -869,7 +892,7 @@ export class LoadedAppClass extends Component 0) {
message =
(this.state.translate('loadedapp.payment-made') as string) +
(this.state.translate('history.sent') as string) +
@@ -879,7 +902,9 @@ export class LoadedAppClass extends Component Likely Reverted by the server
if (vtNew.length === 0) {
@@ -897,31 +922,47 @@ export class LoadedAppClass extends Component {
- this.setState({ valueTransfers, somePending: pending > 0 });
+ this.setState({
+ valueTransfers,
+ somePending: pending > 0,
+ valueTransfersTotal,
+ });
},
pending === 0 ? 250 : 0,
);
}
};
- setMessagesList = (messages: ValueTransferType[]) => {
- if (!isEqual(this.state.messages, messages)) {
+ setValueTransfersFetchItems = (items: number) => {
+ this.setState({
+ valueTransfersFetchItems: items,
+ });
+ };
+
+ setMessagesList = (messages: ValueTransferType[], messagesTotal: number) => {
+ if (!isEqual(this.state.messages, messages) || this.state.messagesTotal !== messagesTotal) {
//console.log('fetch messages');
- this.setState({ messages });
+ this.setState({ messages, messagesTotal });
}
};
+ setMessagesFetchItems = (items: number) => {
+ this.setState({
+ messagesFetchItems: items,
+ });
+ };
+
setAllAddresses = (addresses: AddressClass[]) => {
if (!isEqual(this.state.addresses, addresses)) {
//console.log('fetch addresses');
this.setState({ addresses });
}
if (addresses.length > 0) {
- if (this.state.uaAddress !== addresses[0].uaAddress) {
- this.setState({ uaAddress: addresses[0].uaAddress });
+ if (this.state.uOrchardAddress !== addresses[0].uOrchardAddress) {
+ this.setState({ uOrchardAddress: addresses[0].uOrchardAddress });
}
} else {
- this.setState({ uaAddress: '' });
+ this.setState({ uOrchardAddress: '' });
}
};
@@ -963,13 +1004,6 @@ export class LoadedAppClass extends Component {
- if (!isEqual(this.state.sendProgress, sendProgress)) {
- //console.log('fetch send progress');
- this.setState({ sendProgress });
- }
- };
-
setInfo = (info: InfoType) => {
if (!isEqual(this.state.info, info)) {
//console.log('fetch info');
@@ -995,18 +1029,20 @@ export class LoadedAppClass extends Component void): Promise => {
+ sendTransaction = async (): Promise => {
try {
// Construct a sendJson from the sendPage state
- const { sendPageState, uaAddress, addresses, server, donation } = this.state;
+ const { sendPageState, uOrchardAddress, addresses, server, donation } = this.state;
const sendJson = await Utils.getSendManyJSON(
sendPageState,
- uaAddress,
+ uOrchardAddress,
addresses ? addresses : ([] as AddressClass[]),
server,
donation,
);
- const txid = await this.rpc.sendTransaction(sendJson, setSendProgress);
+ //const start = Date.now();
+ const txid = await this.rpc.sendTransaction(sendJson);
+ //console.log('&&&&&&&&&&&&&& send tx', Date.now() - start);
return txid;
} catch (err) {
@@ -1015,13 +1051,13 @@ export class LoadedAppClass extends Component {
- await this.rpc.refresh(false);
+ doRefresh = () => {
+ this.rpc.refreshSync(false);
};
doRescan = async () => {
await this.rpc.stopSyncProcess();
- this.rpc.refresh(false, true);
+ this.rpc.refreshSync(false, true);
};
toggleMenuDrawer = () => {
@@ -1198,7 +1234,7 @@ export class LoadedAppClass extends Component {
- await this.rpc.clearTimers();
- };
-
- configure = async () => {
- await this.rpc.configure();
- };
-
onClickOKChangeWallet = async (state: any) => {
const { server } = this.state;
@@ -1540,10 +1568,6 @@ export class LoadedAppClass extends Component {
- this.setState({ uaAddress });
- };
-
syncingStatusMoreInfoOnClick = async () => {
await this.fetchWallet();
this.setState({ syncReportModalVisible: true });
@@ -1625,7 +1649,7 @@ export class LoadedAppClass extends Component
{mode === ModeEnum.advanced ||
- (!!valueTransfers && valueTransfers.length > 0) ||
+ (!!valueTransfersTotal && valueTransfersTotal > 0) ||
(!readOnly && !!totalBalance && totalBalance.spendableOrchard + totalBalance.spendablePrivate > 0) ? (
)}
@@ -2046,7 +2076,6 @@ export class LoadedAppClass extends Component
)}
@@ -2066,10 +2093,10 @@ export class LoadedAppClass extends Component
{() => (
)}
@@ -2082,15 +2109,20 @@ export class LoadedAppClass extends Component
)}
) : (
<>
- {valueTransfers === null || addresses === null || totalBalance === null ? (
+ {valueTransfersTotal === null || addresses === null || totalBalance === null ? (
) : (
{() => (
)}
diff --git a/app/LoadedApp/components/ComputingTxContent.tsx b/app/LoadedApp/components/ComputingTxContent.tsx
index 036c56da9..63fd00957 100644
--- a/app/LoadedApp/components/ComputingTxContent.tsx
+++ b/app/LoadedApp/components/ComputingTxContent.tsx
@@ -5,7 +5,6 @@ import { useTheme } from '@react-navigation/native';
import RegText from '../../../components/Components/RegText';
import { ThemeType } from '../../types';
-import CircularProgress from '../../../components/Components/CircularProgress';
import { ContextAppLoaded } from '../../context';
import Header from '../../../components/Header';
import moment from 'moment';
@@ -15,7 +14,7 @@ import 'moment/locale/ru';
const ComputingTxContent: React.FunctionComponent = () => {
const context = useContext(ContextAppLoaded);
- const { sendProgress: progress, translate, language } = context;
+ const { translate, language } = context;
const { colors } = useTheme() as unknown as ThemeType;
moment.locale(language);
@@ -43,27 +42,7 @@ const ComputingTxContent: React.FunctionComponent = () => {
height: '70%',
}}>
{translate('loadedapp.computingtx') as string}
- {progress && progress.sendInProgress ? (
- <>
- {`${translate('loadedapp.step')} ${progress.progress} ${translate(
- 'loadedapp.of',
- )} ${progress.total}`}
- {`${translate('loadedapp.eta')} ${progress.etaSeconds} ${translate(
- 'loadedapp.sec',
- )}`}
-
- >
- ) : (
- <>
-
- >
- )}
+
{translate('wait') as string}