QR code fix for hush:
This commit is contained in:
@@ -36,9 +36,5 @@ object DependenciesHolder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val feedbackFile by lazy { FeedbackFile() }
|
|
||||||
|
|
||||||
val feedbackConsole by lazy { FeedbackConsole() }
|
|
||||||
|
|
||||||
val mnemonics by lazy { Mnemonics() }
|
val mnemonics by lazy { Mnemonics() }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package cash.z.ecc.android.ui.scan
|
package cash.z.ecc.android.ui.scan
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import cash.z.ecc.android.di.DependenciesHolder
|
import cash.z.ecc.android.di.DependenciesHolder
|
||||||
import cash.z.ecc.android.sdk.Synchronizer
|
import cash.z.ecc.android.sdk.Synchronizer
|
||||||
@@ -15,10 +16,11 @@ class ScanViewModel : ViewModel() {
|
|||||||
// temporary parse code to allow both plain addresses and those that start with hush:
|
// temporary parse code to allow both plain addresses and those that start with hush:
|
||||||
// TODO: replace with more robust ZIP-321 handling of QR codes
|
// TODO: replace with more robust ZIP-321 handling of QR codes
|
||||||
val address = if (qrCode.startsWith("hush:")) {
|
val address = if (qrCode.startsWith("hush:")) {
|
||||||
qrCode.substring(6, qrCode.indexOf("?").takeUnless { it == -1 } ?: qrCode.length)
|
qrCode.substring(5, qrCode.indexOf("?").takeUnless { it == -1 } ?: qrCode.length)
|
||||||
} else {
|
} else {
|
||||||
qrCode
|
qrCode
|
||||||
}
|
}
|
||||||
|
Log.d("SilentDragon", "address: $address")
|
||||||
return if (synchronizer.validateAddress(address).isNotValid) null else address
|
return if (synchronizer.validateAddress(address).isNotValid) null else address
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package cash.z.ecc.android.ui.setup
|
package cash.z.ecc.android.ui.setup
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.util.Log
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import cash.z.ecc.android.ZcashWalletApp
|
import cash.z.ecc.android.ZcashWalletApp
|
||||||
import cash.z.ecc.android.di.DependenciesHolder
|
import cash.z.ecc.android.di.DependenciesHolder
|
||||||
@@ -91,6 +92,7 @@ class WalletSetupViewModel : ViewModel() {
|
|||||||
* known by this point.
|
* known by this point.
|
||||||
*/
|
*/
|
||||||
private suspend fun loadConfig(): Initializer.Config {
|
private suspend fun loadConfig(): Initializer.Config {
|
||||||
|
|
||||||
twig("Loading config variables")
|
twig("Loading config variables")
|
||||||
var overwriteVks = false
|
var overwriteVks = false
|
||||||
val network = ZcashWalletApp.instance.defaultNetwork
|
val network = ZcashWalletApp.instance.defaultNetwork
|
||||||
@@ -100,6 +102,10 @@ class WalletSetupViewModel : ViewModel() {
|
|||||||
val host = prefs[Const.Pref.SERVER_HOST] ?: Const.Default.Server.HOST
|
val host = prefs[Const.Pref.SERVER_HOST] ?: Const.Default.Server.HOST
|
||||||
val port = prefs[Const.Pref.SERVER_PORT] ?: Const.Default.Server.PORT
|
val port = prefs[Const.Pref.SERVER_PORT] ?: Const.Default.Server.PORT
|
||||||
|
|
||||||
|
Log.d("SilentDragon", "host: $host")
|
||||||
|
|
||||||
|
// TODO: Maybe check server availability here
|
||||||
|
|
||||||
twig("Done loading config variables")
|
twig("Done loading config variables")
|
||||||
return Initializer.Config {
|
return Initializer.Config {
|
||||||
it.importWallet(vk, birthdayHeight, network, LightWalletEndpoint(host, port, true))
|
it.importWallet(vk, birthdayHeight, network, LightWalletEndpoint(host, port, true))
|
||||||
|
|||||||
Reference in New Issue
Block a user