mirror of
https://codeberg.org/anoncontributorxmr/mysu.git
synced 2024-11-25 00:42:32 +00:00
Haven't gotten many I2P nodes to work, though not many people seem to run public ones. My private one syncs
This commit is contained in:
parent
c23879f3b6
commit
2977a5d05d
9 changed files with 33 additions and 18 deletions
|
@ -19,6 +19,7 @@ package net.mynero.wallet.adapter;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -109,6 +110,18 @@ public class NodeSelectionAdapter extends RecyclerView.Adapter<NodeSelectionAdap
|
|||
nodeNameTextView.setText(node.getName());
|
||||
nodeAddressTextView.setText(node.getAddress());
|
||||
|
||||
ImageView nodeAnonymityNetworkImageView = itemView.findViewById(R.id.anonymity_network_imageview);
|
||||
|
||||
if(node.isOnion()) {
|
||||
nodeAnonymityNetworkImageView.setVisibility(View.VISIBLE);
|
||||
nodeAnonymityNetworkImageView.setImageResource(R.drawable.tor);
|
||||
} else if(node.isI2P()) {
|
||||
nodeAnonymityNetworkImageView.setVisibility(View.VISIBLE);
|
||||
nodeAnonymityNetworkImageView.setImageResource(R.drawable.i2p);
|
||||
} else {
|
||||
nodeAnonymityNetworkImageView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
itemView.setOnLongClickListener(view -> {
|
||||
if(match) {
|
||||
Toast.makeText(itemView.getContext(), itemView.getResources().getString(R.string.cant_edit_current_node), Toast.LENGTH_SHORT).show();
|
||||
|
|
|
@ -244,10 +244,7 @@ public class Node {
|
|||
if (!username.isEmpty() && !password.isEmpty()) {
|
||||
sb.append(username).append(":").append(password).append("@");
|
||||
}
|
||||
sb.append(host);
|
||||
if(!isI2P()) {
|
||||
sb.append(":").append(rpcPort);
|
||||
}
|
||||
sb.append(host).append(":").append(rpcPort);
|
||||
sb.append("/");
|
||||
switch (networkType) {
|
||||
case NetworkType_Mainnet:
|
||||
|
@ -270,14 +267,6 @@ public class Node {
|
|||
}
|
||||
|
||||
public String getAddress() {
|
||||
String port = "";
|
||||
if(!isI2P()) {
|
||||
port = ":" + rpcPort;
|
||||
}
|
||||
return getHost() + port;
|
||||
}
|
||||
|
||||
public String getDaemonAddress() {
|
||||
return getHost() + ":" + rpcPort;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public class AddNodeBottomSheetDialog extends BottomSheetDialogFragment {
|
|||
String address = nodeParts[0];
|
||||
int port = Integer.parseInt(nodeParts[1]);
|
||||
String newNodeString = address + ":" + port + "/mainnet/" + name;
|
||||
boolean validAddress = Patterns.IP_ADDRESS.matcher(address).matches() || Patterns.DOMAIN_NAME.matcher(address).matches();
|
||||
boolean validAddress = Patterns.IP_ADDRESS.matcher(address).matches() || Patterns.DOMAIN_NAME.matcher(address).matches() || address.endsWith(".b32.i2p");
|
||||
if (validAddress) {
|
||||
String nodesArray = PrefService.getInstance().getString(Constants.PREF_CUSTOM_NODES, "[]");
|
||||
JSONArray jsonArray = new JSONArray(nodesArray);
|
||||
|
|
|
@ -186,7 +186,7 @@ public class OnboardingFragment extends Fragment {
|
|||
wallet = WalletManager.getInstance().recoveryWallet(walletFile, walletPassword, tmpWallet.getSeed(""), offset, restoreHeight);
|
||||
} else {
|
||||
if (!checkMnemonic(walletSeed)) {
|
||||
Toast.makeText(mainActivity, getString(R.string.invalid_mnemonic_code), Toast.LENGTH_SHORT).show();
|
||||
mainActivity.runOnUiThread(() -> Toast.makeText(mainActivity, getString(R.string.invalid_mnemonic_code), Toast.LENGTH_SHORT).show());
|
||||
return;
|
||||
}
|
||||
if (!restoreHeightText.isEmpty()) {
|
||||
|
|
|
@ -258,7 +258,7 @@ public class WalletManager {
|
|||
// this should not be called on the main thread as it connects to the node (and takes a long time)
|
||||
public void setDaemon(Node node) {
|
||||
if (node != null) {
|
||||
this.daemonAddress = node.getDaemonAddress();
|
||||
this.daemonAddress = node.getAddress();
|
||||
if (networkType != node.getNetworkType())
|
||||
throw new IllegalArgumentException("network type does not match");
|
||||
this.daemonUsername = node.getUsername();
|
||||
|
|
|
@ -85,7 +85,9 @@ public class MoneroHandlerThread extends Thread implements WalletListener {
|
|||
|
||||
@Override
|
||||
public void newBlock(long height) {
|
||||
refresh(false);
|
||||
if(height % 100 == 0) {
|
||||
refresh(false);
|
||||
}
|
||||
BlockchainService.getInstance().setDaemonHeight(wallet.isSynchronized() ? height : 0);
|
||||
}
|
||||
|
||||
|
|
BIN
app/src/main/res/drawable/i2p.png
Normal file
BIN
app/src/main/res/drawable/i2p.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.9 KiB |
BIN
app/src/main/res/drawable/tor.png
Normal file
BIN
app/src/main/res/drawable/tor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
|
@ -6,14 +6,25 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:padding="8dp"
|
||||
android:layout_marginBottom="8dp">
|
||||
<ImageView
|
||||
android:id="@+id/anonymity_network_imageview"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@drawable/ic_fingerprint"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/node_uri_textview"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/node_name_textview"/>
|
||||
<TextView
|
||||
android:id="@+id/node_name_textview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Node Name"
|
||||
android:layout_marginStart="8dp"
|
||||
android:textStyle="bold"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/anonymity_network_imageview"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/node_uri_textview"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
|
Loading…
Reference in a new issue