Compare commits

...

6 Commits

Author SHA1 Message Date
-
6296cc349f implement wallet name suggestion 2025-01-11 17:31:18 +01:00
-
60c46e7289 change layouts of wallet and account views 2025-01-11 17:08:36 +01:00
-
54486770f6 fix HomeActivity starting multiple activities when finishing 2025-01-11 16:48:19 +01:00
-
320f3f3146 fix #58 2025-01-11 16:36:56 +01:00
-
16be4da12b various fixes for dialogs 2025-01-11 15:08:40 +01:00
-
dce2242386 use https for some nodes 2025-01-11 14:51:24 +01:00
17 changed files with 116 additions and 84 deletions

View File

@ -42,6 +42,8 @@ class HomeActivity : MoneroActivity() {
private lateinit var frozenBalanceTextView: TextView
private lateinit var lockedBalanceTextView: TextView
private var isFinishing: Boolean = false
private val transactionInfoAdapter: TransactionInfoAdapter = TransactionInfoAdapter(false, object : TransactionInfoAdapter.Listener {
override fun onClickTransaction(txInfo: TransactionInfo) {
val intent = Intent(this@HomeActivity, TransactionActivity::class.java)
@ -212,15 +214,23 @@ class HomeActivity : MoneroActivity() {
stop()
}
override fun finish() {
// When HomeActivity is finishing, we should (once!) start either WalletActivity or StartActivity
if (!isFinishing) {
isFinishing = true
if (PreferenceUtils.isMultiAccountMode(this@HomeActivity)) {
startActivity(Intent(this@HomeActivity, WalletActivity::class.java))
} else {
startActivity(Intent(this@HomeActivity, StartActivity::class.java))
}
}
super.finish()
}
private fun stop() {
Timber.d("Stopping")
walletService?.closeWallet()
finish()
if (PreferenceUtils.isMultiAccountMode(this@HomeActivity)) {
startActivity(Intent(this@HomeActivity, WalletActivity::class.java))
} else {
startActivity(Intent(this@HomeActivity, StartActivity::class.java))
}
}
private fun displayEmptyHistory(

View File

@ -27,6 +27,7 @@ import org.monfluo.wallet.fragment.dialog.NodeSelectionBottomSheetDialog
import org.monfluo.wallet.listener.NodeSelectionDialogListenerAdapter
import org.monfluo.wallet.livedata.combineLiveDatas
import org.monfluo.wallet.model.Wallet
import org.monfluo.wallet.model.WalletManager
import org.monfluo.wallet.util.Constants
import org.monfluo.wallet.util.Helper
import org.monfluo.wallet.util.PreferenceUtils
@ -83,7 +84,7 @@ class OnboardingActivity : WalletOpeningActivity() {
val node = PreferenceUtils.getOrSetDefaultNode(this, DefaultNode.defaultNode())
selectNodeButton.text = getString(R.string.node_button_text, node.name)
walletNameEditText.setText(Constants.DEFAULT_WALLET_NAME)
walletNameEditText.setText(getWalletNameSuggestion())
bindListeners()
bindObservers()
@ -210,7 +211,6 @@ class OnboardingActivity : WalletOpeningActivity() {
val listener = object : NodeSelectionDialogListenerAdapter(
activity = this,
nodes = nodes,
) {
override fun trySelectNode(
self: NodeSelectionBottomSheetDialog,
@ -261,6 +261,21 @@ class OnboardingActivity : WalletOpeningActivity() {
)
}
}
private fun getWalletNameSuggestion(): String {
val walletRoot = Helper.getWalletRoot(this)
if (!WalletManager.instance.walletExists(walletRoot.resolve(Constants.DEFAULT_WALLET_NAME))) {
return Constants.DEFAULT_WALLET_NAME
}
for (i in 2 until Int.MAX_VALUE) {
val name = Constants.DEFAULT_WALLET_NAME + i
if (!WalletManager.instance.walletExists(walletRoot.resolve(name))) {
return name
}
}
Timber.e("User managed to create 2^31-3 wallets, giving up on finding a good wallet name")
return Constants.DEFAULT_WALLET_NAME
}
}
internal class OnboardingViewModel : ViewModel() {
@ -348,7 +363,7 @@ internal class OnboardingViewModel : ViewModel() {
}
return
} else {
org.monfluo.wallet.model.WalletManager.instance.createWalletPolyseed(
WalletManager.instance.createWalletPolyseed(
walletFile,
passphrase,
offset,
@ -359,7 +374,7 @@ internal class OnboardingViewModel : ViewModel() {
val tmpWalletFile =
File(activity.applicationInfo.dataDir, walletName + "_tmp")
val tmpWallet = createTempWallet(tmpWalletFile) //we do this to get seed, then recover wallet so we can use seed offset
wallet = org.monfluo.wallet.model.WalletManager.instance.recoveryWallet(
wallet = WalletManager.instance.recoveryWallet(
walletFile,
passphrase,
tmpWallet.getSeed(""),
@ -384,14 +399,14 @@ internal class OnboardingViewModel : ViewModel() {
restoreHeight = restoreHeightText.toLong()
}
if (seedTypeValue == SeedType.POLYSEED) {
wallet = org.monfluo.wallet.model.WalletManager.instance.recoveryWalletPolyseed(
wallet = WalletManager.instance.recoveryWalletPolyseed(
walletFile,
passphrase,
walletSeed,
offset
)
} else if (seedTypeValue == SeedType.LEGACY) {
wallet = org.monfluo.wallet.model.WalletManager.instance.recoveryWallet(
wallet = WalletManager.instance.recoveryWallet(
walletFile,
passphrase,
walletSeed,
@ -441,7 +456,7 @@ internal class OnboardingViewModel : ViewModel() {
}
private fun createTempWallet(tmpWalletFile: File): Wallet {
return org.monfluo.wallet.model.WalletManager.instance.createWallet(
return WalletManager.instance.createWallet(
tmpWalletFile,
"",
Constants.MNEMONIC_LANGUAGE,

View File

@ -131,7 +131,6 @@ class SettingsActivity : MoneroActivity() {
val listener = object : NodeSelectionDialogListenerAdapter(
activity = this,
nodes = nodes,
) {
override fun trySelectNode(
self: NodeSelectionBottomSheetDialog,

View File

@ -2,8 +2,8 @@ package org.monfluo.wallet
import android.content.Intent
import android.os.Bundle
import androidx.activity.OnBackPressedCallback
import org.monfluo.wallet.fragment.dialog.PasswordBottomSheetDialog
import org.monfluo.wallet.model.WalletManager
import org.monfluo.wallet.util.Constants
import org.monfluo.wallet.util.Helper
import org.monfluo.wallet.util.PreferenceUtils
@ -17,7 +17,7 @@ class StartActivity : WalletOpeningActivity() {
setVisible(false)
val isMultiWalletMode = PreferenceUtils.isMultiWalletMode(this)
val walletPaths = org.monfluo.wallet.model.WalletManager.instance.findWallets(Helper.getWalletRoot(this).absolutePath)
val walletPaths = WalletManager.instance.findWallets(Helper.getWalletRoot(this).absolutePath)
if (walletPaths.isEmpty()) {
Timber.d("No wallets found, launching onboarding activity")
val onboardingActivityIntent = Intent(this, OnboardingActivity::class.java)

View File

@ -7,6 +7,7 @@ import android.widget.Button
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import org.monfluo.wallet.fragment.dialog.PasswordBottomSheetDialog
import org.monfluo.wallet.model.WalletManager
import org.monfluo.wallet.util.Helper
import org.monfluo.wallet.util.acitivity.WalletOpeningActivity
@ -23,7 +24,7 @@ class WalletActivity : WalletOpeningActivity() {
createWalletButton = findViewById(R.id.create_or_import_wallet)
walletRecyclerView = findViewById(R.id.wallet_list_recyclerview)
val walletPaths = org.monfluo.wallet.model.WalletManager.instance.findWallets(Helper.getWalletRoot(this).absolutePath)
val walletPaths = WalletManager.instance.findWallets(Helper.getWalletRoot(this).absolutePath)
adapter = WalletAdapter(walletPaths, object : WalletAdapter.AccountAdapterListener {
override fun onWalletSelected(walletPath: String) {
val passwordDialog = PasswordBottomSheetDialog(walletPath, false, object : PasswordBottomSheetDialog.Listener {

View File

@ -18,9 +18,9 @@ package org.monfluo.wallet.data
enum class DefaultNode(val value: Node) {
MONERUJO(Node("monerujo", "nodex.monerujo.io:18081", null, null)),
SETHFORPRIVACY(Node("sethforprivacy", "node.sethforprivacy.com:18089", null, null)),
SETHFORPRIVACY(Node("sethforprivacy (https)", "https://node.sethforprivacy.com", null, null)),
RUCKNIUM(Node("Rucknium", "rucknium.me:18081", null, null)),
STACKWALLET(Node("StackWallet", "monero.stackwallet.com:18081", null, null)),
STACKWALLET(Node("StackWallet (https)", "https://monero.stackwallet.com:18081", null, null)),
CAKEWALLET(Node("CakeWallet", "xmr-node.cakewallet.com:18081", null, null)),
HASHVAULT(Node("Hashvault", "nodes.hashvault.pro:18081", null, null)),
MONERUJO_ONION(Node("monerujo.onion", "monerujods7mbghwe6cobdr6ujih6c22zu5rl7zshmizz2udf7v7fsad.onion:18081", null, null)),

View File

@ -32,7 +32,7 @@ class AddNodeBottomSheetDialog(val listener: AddNodeListener) : BottomSheetDialo
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.bottom_sheet_dialog_add_node, null)
return inflater.inflate(R.layout.bottom_sheet_dialog_add_node, container)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@ -71,7 +71,7 @@ class AddNodeBottomSheetDialog(val listener: AddNodeListener) : BottomSheetDialo
addNodeButton.setOnClickListener {
val name = nodeNameEditText.text.toString()
var address = addressEditText.text.toString()
val address = addressEditText.text.toString()
val username = usernameEditText.text.toString().ifBlank { null }
val password = passwordEditText.text.toString().ifBlank { null }
val trusted = trustedDaemonCheckbox.isChecked

View File

@ -33,7 +33,7 @@ class EditNodeBottomSheetDialog(val listener: EditNodeListener, val node: Node)
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.bottom_sheet_dialog_edit_node, null)
return inflater.inflate(R.layout.bottom_sheet_dialog_edit_node, container)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@ -84,7 +84,7 @@ class EditNodeBottomSheetDialog(val listener: EditNodeListener, val node: Node)
doneEditingButton.setOnClickListener {
val name = nodeNameEditText.text.toString()
var address = addressEditText.text.toString()
val address = addressEditText.text.toString()
val username = usernameEditText.text.toString().ifBlank { null }
val password = passwordEditText.text.toString().ifBlank { null }
val trusted = trustedDaemonCheckbox.isChecked

View File

@ -28,7 +28,7 @@ class NodeSelectionBottomSheetDialog(
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.bottom_sheet_dialog_node_selection, null)
return inflater.inflate(R.layout.bottom_sheet_dialog_node_selection, container)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@ -52,6 +52,8 @@ class NodeSelectionBottomSheetDialog(
}
}
fun getNodes(): List<Node> = nodes
fun setNodes(nodes: List<Node>) {
this.nodes = nodes
adapter.setNodes(nodes)

View File

@ -8,15 +8,14 @@ import android.widget.Button
import android.widget.EditText
import android.widget.ImageButton
import android.widget.Toast
import androidx.activity.OnBackPressedCallback
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import org.monfluo.wallet.R
import org.monfluo.wallet.model.WalletManager
import org.monfluo.wallet.util.Helper.getClipBoardText
import timber.log.Timber
class PasswordBottomSheetDialog(
private val walletPath: String,
preventGoingBack: Boolean,
private val preventGoingBack: Boolean,
private val listener: Listener,
) : BottomSheetDialogFragment() {
@ -24,10 +23,6 @@ class PasswordBottomSheetDialog(
private lateinit var unlockButton: Button
private lateinit var pastePasswordImageButton: ImageButton
init {
isCancelable = !preventGoingBack
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
@ -42,6 +37,12 @@ class PasswordBottomSheetDialog(
pastePasswordImageButton = view.findViewById(R.id.paste_password_imagebutton)
bindListeners()
if (preventGoingBack) {
dialog?.setOnDismissListener {
requireActivity().finish()
}
}
}
private fun bindListeners() {
@ -62,7 +63,7 @@ class PasswordBottomSheetDialog(
}
private fun checkPassword(walletPassword: String): Boolean {
return org.monfluo.wallet.model.WalletManager.instance.verifyWalletPasswordOnly(
return WalletManager.instance.verifyWalletPasswordOnly(
"$walletPath.keys",
walletPassword
)

View File

@ -11,7 +11,6 @@ import timber.log.Timber
abstract class NodeSelectionDialogListenerAdapter(
private val activity: FragmentActivity,
private var nodes: List<Node>,
) : NodeSelectionBottomSheetDialog.NodeSelectionDialogListener {
abstract fun trySelectNode(self: NodeSelectionBottomSheetDialog, node: Node): Boolean
@ -23,13 +22,15 @@ abstract class NodeSelectionDialogListenerAdapter(
}
final override fun onEditNode(self: NodeSelectionBottomSheetDialog, node: Node) {
val nodeSelectionBottomSheetDialog = self
val listener = object : EditNodeBottomSheetDialog.EditNodeListener {
override fun onDeleteNode(self: EditNodeBottomSheetDialog, node: Node) {
val newNodes = nodes.toMutableList()
val newNodes = nodeSelectionBottomSheetDialog.getNodes().toMutableList()
newNodes.remove(node)
PreferenceUtils.setNodes(activity, newNodes).fold(
{
Toast.makeText(activity, "Node delete", Toast.LENGTH_SHORT).show()
nodeSelectionBottomSheetDialog.setNodes(newNodes)
self.dismiss()
},
{
@ -44,10 +45,11 @@ abstract class NodeSelectionDialogListenerAdapter(
oldNode: Node,
newNode: Node,
) {
val newNodes = nodes.map { node -> if (node != oldNode) node else newNode }
val newNodes = nodeSelectionBottomSheetDialog.getNodes().map { node -> if (node != oldNode) node else newNode }
PreferenceUtils.setNodes(activity, newNodes).fold(
{
Toast.makeText(activity, "Node saved", Toast.LENGTH_SHORT).show()
nodeSelectionBottomSheetDialog.setNodes(newNodes)
self.dismiss()
},
{
@ -67,6 +69,7 @@ abstract class NodeSelectionDialogListenerAdapter(
val nodeSelectionBottomSheetDialog = self
val addNodeDialog = AddNodeBottomSheetDialog(object : AddNodeBottomSheetDialog.AddNodeListener {
override fun onAddNode(self: AddNodeBottomSheetDialog, node: Node) {
val nodes = nodeSelectionBottomSheetDialog.getNodes()
if (nodes.any { it.name == node.name }) {
Timber.i("Failed to add nodes due to node with the same name already existing")
Toast.makeText(activity, "Node with this name already exists", Toast.LENGTH_SHORT).show()
@ -75,8 +78,8 @@ abstract class NodeSelectionDialogListenerAdapter(
newNodes.add(node)
PreferenceUtils.setNodes(activity, newNodes).fold(
{
nodeSelectionBottomSheetDialog.setNodes(newNodes)
Timber.i("New node ${node.name} added successfully")
nodeSelectionBottomSheetDialog.setNodes(newNodes)
Toast.makeText(activity, "Node added", Toast.LENGTH_SHORT).show()
self.dismiss()
},

View File

@ -206,7 +206,7 @@ class Wallet(private val handle: Long, val info: WalletInfo, private var account
external fun store(path: String?): Boolean
fun close(): Boolean {
disposePendingTransaction()
return org.monfluo.wallet.model.WalletManager.instance.closeJ(this)
return WalletManager.instance.closeJ(this)
}
external fun getFilename(): String
@ -469,7 +469,7 @@ class Wallet(private val handle: Long, val info: WalletInfo, private var account
external fun isPaymentIdValid(payment_id: String): Boolean
fun isAddressValid(address: String): Boolean {
return org.monfluo.wallet.model.WalletManager.instance.networkType.value.let {
return WalletManager.instance.networkType.value.let {
isAddressValid(
address,
it

View File

@ -22,13 +22,13 @@ import java.util.Calendar
import java.util.Locale
class WalletManager {
val networkType = org.monfluo.wallet.model.NetworkType.NetworkType_Mainnet
val networkType = NetworkType.NetworkType_Mainnet
fun createWallet(aFile: File, password: String, language: String, height: Long): org.monfluo.wallet.model.Wallet {
fun createWallet(aFile: File, password: String, language: String, height: Long): Wallet {
val walletHandle = createWalletJ(aFile.absolutePath, password, language, networkType.value)
val wallet = org.monfluo.wallet.model.Wallet(
val wallet = Wallet(
walletHandle,
org.monfluo.wallet.model.WalletInfo(aFile, password)
WalletInfo(aFile, password)
)
if (wallet.status.isOk) {
// (Re-)Estimate restore height based on what we know
@ -47,7 +47,7 @@ class WalletManager {
return wallet
}
external fun findWallets(path: String): List<String> // this does not work - some error in boost
external fun findWallets(path: String): List<String>
private external fun createWalletJ(
path: String,
password: String,
@ -60,7 +60,7 @@ class WalletManager {
password: String,
passphrase: String,
language: String
): org.monfluo.wallet.model.Wallet {
): Wallet {
val walletHandle = createWalletPolyseedJ(
aFile.absolutePath,
password,
@ -68,9 +68,9 @@ class WalletManager {
language,
networkType.value
)
val wallet = org.monfluo.wallet.model.Wallet(
val wallet = Wallet(
walletHandle,
org.monfluo.wallet.model.WalletInfo(aFile, password)
WalletInfo(aFile, password)
)
if (wallet.status.isOk) {
wallet.setPassword(password) // this rewrites the keys file (which contains the restore height)
@ -87,11 +87,11 @@ class WalletManager {
): Long
//TODO virtual bool checkPayment(const std::string &address, const std::string &txid, const std::string &txkey, const std::string &daemon_address, uint64_t &received, uint64_t &height, std::string &error) const = 0;
fun openWallet(path: String, password: String): org.monfluo.wallet.model.Wallet {
fun openWallet(path: String, password: String): Wallet {
val walletHandle = openWalletJ(path, password, networkType.value)
val wallet = org.monfluo.wallet.model.Wallet(
val wallet = Wallet(
walletHandle,
org.monfluo.wallet.model.WalletInfo(File(path), password)
WalletInfo(File(path), password)
)
return wallet
}
@ -101,15 +101,15 @@ class WalletManager {
aFile: File, password: String,
mnemonic: String, offset: String,
restoreHeight: Long
): org.monfluo.wallet.model.Wallet {
): Wallet {
val walletHandle = recoveryWalletJ(
aFile.absolutePath, password,
mnemonic, offset,
networkType.value, restoreHeight
)
val wallet = org.monfluo.wallet.model.Wallet(
val wallet = Wallet(
walletHandle,
org.monfluo.wallet.model.WalletInfo(aFile, password)
WalletInfo(aFile, password)
)
return wallet
}
@ -123,15 +123,15 @@ class WalletManager {
fun recoveryWalletPolyseed(
aFile: File, password: String,
mnemonic: String, offset: String
): org.monfluo.wallet.model.Wallet {
): Wallet {
val walletHandle = recoveryWalletPolyseedJ(
aFile.absolutePath, password,
mnemonic, offset,
networkType.value
)
val wallet = org.monfluo.wallet.model.Wallet(
val wallet = Wallet(
walletHandle,
org.monfluo.wallet.model.WalletInfo(aFile, password)
WalletInfo(aFile, password)
)
return wallet
}
@ -145,15 +145,15 @@ class WalletManager {
fun createWalletWithKeys(
aFile: File, password: String, language: String, restoreHeight: Long,
addressString: String, viewKeyString: String, spendKeyString: String
): org.monfluo.wallet.model.Wallet {
): Wallet {
val walletHandle = createWalletFromKeysJ(
aFile.absolutePath, password,
language, networkType.value, restoreHeight,
addressString, viewKeyString, spendKeyString
)
val wallet = org.monfluo.wallet.model.Wallet(
val wallet = Wallet(
walletHandle,
org.monfluo.wallet.model.WalletInfo(aFile, password)
WalletInfo(aFile, password)
)
return wallet
}
@ -176,7 +176,7 @@ class WalletManager {
subaddressLookahead: String
): Long
external fun closeJ(wallet: org.monfluo.wallet.model.Wallet?): Boolean
external fun closeJ(wallet: Wallet?): Boolean
fun walletExists(aFile: File): Boolean {
return walletExists(aFile.absolutePath)
@ -214,7 +214,7 @@ class WalletManager {
external fun resolveOpenAlias(address: String?, dnssec_valid: Boolean): String?
external fun setProxyJ(address: String?): Boolean
inner class WalletInfo(wallet: File) : Comparable<org.monfluo.wallet.model.WalletManager.WalletInfo> {
inner class WalletInfo(wallet: File) : Comparable<WalletManager.WalletInfo> {
private val path: File
private val name: String
@ -223,7 +223,7 @@ class WalletManager {
name = wallet.name
}
override fun compareTo(other: org.monfluo.wallet.model.WalletManager.WalletInfo): Int {
override fun compareTo(other: WalletManager.WalletInfo): Int {
return name.lowercase(Locale.getDefault())
.compareTo(other.name.lowercase(Locale.getDefault()))
}
@ -238,16 +238,16 @@ class WalletManager {
var LOGLEVEL_TRACE = 3
var LOGLEVEL_MAX = 4
val instance: org.monfluo.wallet.model.WalletManager
get() = synchronized(org.monfluo.wallet.model.WalletManager::class.java) {
return@synchronized org.monfluo.wallet.model.WalletManager()
val instance: WalletManager
get() = synchronized(WalletManager::class.java) {
return@synchronized WalletManager()
}
fun addressPrefix(networkType: org.monfluo.wallet.model.NetworkType): String {
fun addressPrefix(networkType: NetworkType): String {
return when (networkType) {
org.monfluo.wallet.model.NetworkType.NetworkType_Testnet -> "9A-"
org.monfluo.wallet.model.NetworkType.NetworkType_Mainnet -> "4-"
org.monfluo.wallet.model.NetworkType.NetworkType_Stagenet -> "5-"
NetworkType.NetworkType_Testnet -> "9A-"
NetworkType.NetworkType_Mainnet -> "4-"
NetworkType.NetworkType_Stagenet -> "5-"
}
}

View File

@ -14,6 +14,7 @@ import org.monfluo.wallet.model.PendingTransaction
import org.monfluo.wallet.model.Wallet
import org.monfluo.wallet.model.Wallet.Companion.NEW_ACCOUNT_NAME
import org.monfluo.wallet.model.WalletListener
import org.monfluo.wallet.model.WalletManager
import org.monfluo.wallet.util.TransactionDestination
import timber.log.Timber
import java.util.concurrent.ArrayBlockingQueue
@ -161,9 +162,9 @@ class WalletService : Service(), WalletListener, DefaultLifecycleObserver {
daemonTrusted: Boolean,
proxy: String
) {
org.monfluo.wallet.model.WalletManager.instance.setProxyJ(proxy)
org.monfluo.wallet.model.WalletManager.instance.setDaemonAddressJ(daemonAddress)
val wallet = org.monfluo.wallet.model.WalletManager.instance.openWallet(walletName, walletPassword)
WalletManager.instance.setProxyJ(proxy)
WalletManager.instance.setDaemonAddressJ(daemonAddress)
val wallet = WalletManager.instance.openWallet(walletName, walletPassword)
Timber.i("Initializing wallet with daemon address = $daemonAddress, daemon username = $daemonUsername, daemon password = ${"*".repeat(daemonPassword.length)}, proxy = $proxy")
wallet.initJ(daemonAddress, 0, daemonUsername, daemonPassword, proxy)
wallet.setTrustedDaemon(daemonTrusted)
@ -191,8 +192,8 @@ class WalletService : Service(), WalletListener, DefaultLifecycleObserver {
daemonTrusted: Boolean,
proxy: String
) {
org.monfluo.wallet.model.WalletManager.instance.setProxyJ(proxy)
org.monfluo.wallet.model.WalletManager.instance.setDaemonAddressJ(daemonAddress)
WalletManager.instance.setProxyJ(proxy)
WalletManager.instance.setDaemonAddressJ(daemonAddress)
walletRef.get()?.let { wallet ->
Timber.i("Re-initializing wallet with daemon address = $daemonAddress, daemon username = $daemonUsername, daemon password = ${"*".repeat(daemonPassword.length)}, proxy = $proxy")
wallet.initJ(daemonAddress, 0, daemonUsername, daemonPassword, proxy)
@ -205,9 +206,11 @@ class WalletService : Service(), WalletListener, DefaultLifecycleObserver {
}
private fun handleFetchDaemonHeight() {
val newHeight = org.monfluo.wallet.model.WalletManager.instance.getBlockchainHeight()
val newHeight = WalletManager.instance.getBlockchainHeight()
if (newHeight > 0) {
daemonHeight.set(newHeight)
} else {
Timber.w("Fetched blockchain height is 0")
}
forEachObserver {
it.onBlockchainHeightFetched(newHeight)
@ -265,7 +268,7 @@ class WalletService : Service(), WalletListener, DefaultLifecycleObserver {
}
private fun handleSetProxy(value: String) {
val success = org.monfluo.wallet.model.WalletManager.instance.setProxyJ(value)
val success = WalletManager.instance.setProxyJ(value)
// we assume that if setting proxy for daemon was successful,
// then setting proxy for wallet must have been successful as well
walletRef.get()?.setProxy(value)

Binary file not shown.

After

Width:  |  Height:  |  Size: 937 B

View File

@ -11,6 +11,7 @@
android:id="@+id/account_item_account_textview"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:ellipsize="middle"
android:paddingTop="4dp"
android:paddingBottom="4dp"
@ -19,10 +20,10 @@
android:textColor="@color/oled_addressListColor"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@id/address_label_textview"
app:layout_constraintBottom_toBottomOf="@+id/address_label_textview"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintStart_toEndOf="@+id/address_label_textview"
app:layout_constraintTop_toTopOf="@+id/address_label_textview" />
<TextView
android:id="@+id/address_label_textview"
@ -37,7 +38,7 @@
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/address_item_address_textview" />
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/address_amount_textview"

View File

@ -8,13 +8,10 @@
android:paddingEnd="8dp">
<ImageView
android:id="@+id/monero_qr_imageview2"
android:id="@+id/wallet_imageview"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_marginStart="4dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:src="@drawable/ic_monero"
android:src="@drawable/wallet"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
@ -33,7 +30,7 @@
android:text="Label"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/monero_qr_imageview2"
app:layout_constraintStart_toEndOf="@+id/wallet_imageview"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>