- Hotfixes for 0.4.7 for editing nodes
- Better IPv6 address handling in node settings
This commit is contained in:
pokkst 2023-12-02 20:35:33 -06:00
parent c8ed32e5b0
commit c64dbfdfec
No known key found for this signature in database
GPG Key ID: EC4FAAA66859FAA4
8 changed files with 18 additions and 13 deletions

View File

@ -9,8 +9,8 @@ android {
applicationId "net.mynero.wallet" applicationId "net.mynero.wallet"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 34 targetSdkVersion 34
versionCode 40700 versionCode 40701
versionName "0.4.7 'Fluorine Fermi'" versionName "0.4.7.1 'Fluorine Fermi'"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild { externalNativeBuild {
cmake { cmake {

View File

@ -91,6 +91,9 @@ public class AddNodeBottomSheetDialog extends BottomSheetDialogFragment {
jsonObject.put("password", pass); jsonObject.put("password", pass);
} }
if (nodeAddr.contains(":") && !nodeAddr.startsWith("[") && !nodeAddr.endsWith("]"))
nodeAddr = "[" + nodeAddr + "]";
jsonObject.put("host", nodeAddr); jsonObject.put("host", nodeAddr);
jsonObject.put("rpcPort", Integer.parseInt(portString)); jsonObject.put("rpcPort", Integer.parseInt(portString));
jsonObject.put("network", "mainnet"); jsonObject.put("network", "mainnet");

View File

@ -35,7 +35,7 @@ import timber.log.Timber;
public class EditNodeBottomSheetDialog extends BottomSheetDialogFragment { public class EditNodeBottomSheetDialog extends BottomSheetDialogFragment {
public EditNodeListener listener = null; public EditNodeListener listener = null;
public JSONObject nodeJson = null; public Node node = null;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@ -54,7 +54,6 @@ public class EditNodeBottomSheetDialog extends BottomSheetDialogFragment {
EditText passwordEditText = view.findViewById(R.id.password_edittext); EditText passwordEditText = view.findViewById(R.id.password_edittext);
ImageButton pastePasswordImageButton = view.findViewById(R.id.paste_password_imagebutton); ImageButton pastePasswordImageButton = view.findViewById(R.id.paste_password_imagebutton);
Node node = Node.fromJson(nodeJson);
if(node == null) return; if(node == null) return;
addressEditText.setText(node.getHost()); addressEditText.setText(node.getHost());
portEditText.setText(""+node.getRpcPort()); portEditText.setText(""+node.getRpcPort());
@ -87,7 +86,7 @@ public class EditNodeBottomSheetDialog extends BottomSheetDialogFragment {
addPasteListener(view, passwordEditText, R.id.paste_password_imagebutton); addPasteListener(view, passwordEditText, R.id.paste_password_imagebutton);
deleteNodeButton.setOnClickListener(view1 -> { deleteNodeButton.setOnClickListener(view1 -> {
listener.onNodeDeleted(Node.fromJson(nodeJson)); listener.onNodeDeleted(node);
dismiss(); dismiss();
}); });
doneEditingButton.setOnClickListener(view1 -> { doneEditingButton.setOnClickListener(view1 -> {
@ -114,12 +113,15 @@ public class EditNodeBottomSheetDialog extends BottomSheetDialogFragment {
jsonObject.put("password", pass); jsonObject.put("password", pass);
} }
if (nodeAddr.contains(":") && !nodeAddr.startsWith("[") && !nodeAddr.endsWith("]"))
nodeAddr = "[" + nodeAddr + "]";
jsonObject.put("host", nodeAddr); jsonObject.put("host", nodeAddr);
jsonObject.put("rpcPort", Integer.parseInt(portString)); jsonObject.put("rpcPort", Integer.parseInt(portString));
jsonObject.put("network", "mainnet"); jsonObject.put("network", "mainnet");
jsonObject.put("name", nodeName); jsonObject.put("name", nodeName);
listener.onNodeEdited(Node.fromJson(nodeJson), Node.fromJson(jsonObject)); listener.onNodeEdited(node, Node.fromJson(jsonObject));
dismiss(); dismiss();
} catch (JSONException e) { } catch (JSONException e) {
throw new RuntimeException(e); throw new RuntimeException(e);

View File

@ -114,7 +114,7 @@ public class NodeSelectionBottomSheetDialog extends BottomSheetDialogFragment im
@Override @Override
public boolean onSelectEditNode(Node node) { public boolean onSelectEditNode(Node node) {
if (listener != null) { if (listener != null) {
listener.onClickedEditNode(node.toJson()); listener.onClickedEditNode(node);
} }
dismiss(); dismiss();
return true; return true;
@ -122,7 +122,7 @@ public class NodeSelectionBottomSheetDialog extends BottomSheetDialogFragment im
public interface NodeSelectionDialogListener { public interface NodeSelectionDialogListener {
void onNodeSelected(); void onNodeSelected();
void onClickedEditNode(JSONObject nodeJson); void onClickedEditNode(Node node);
void onClickedAddNode(); void onClickedAddNode();
} }
} }

View File

@ -285,7 +285,7 @@ public class OnboardingFragment extends Fragment implements NodeSelectionBottomS
} }
@Override @Override
public void onClickedEditNode(JSONObject nodeJson) { } public void onClickedEditNode(Node node) { }
@Override @Override
public void onClickedAddNode() { public void onClickedAddNode() {

View File

@ -248,10 +248,10 @@ public class SettingsFragment extends Fragment implements PasswordBottomSheetDia
} }
@Override @Override
public void onClickedEditNode(JSONObject nodeJson) { public void onClickedEditNode(Node node) {
EditNodeBottomSheetDialog editNodeDialog = new EditNodeBottomSheetDialog(); EditNodeBottomSheetDialog editNodeDialog = new EditNodeBottomSheetDialog();
editNodeDialog.listener = this; editNodeDialog.listener = this;
editNodeDialog.nodeJson = nodeJson; editNodeDialog.node = node;
editNodeDialog.show(getActivity().getSupportFragmentManager(), "edit_node_dialog"); editNodeDialog.show(getActivity().getSupportFragmentManager(), "edit_node_dialog");
} }

View File

@ -63,7 +63,7 @@
android:background="@drawable/edittext_bg" android:background="@drawable/edittext_bg"
android:hint="@string/node_address_hint" android:hint="@string/node_address_hint"
android:inputType="text" android:inputType="text"
android:digits="-QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890.:" android:digits="QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890.:-[]"
app:layout_constraintBottom_toTopOf="@id/username_edittext" app:layout_constraintBottom_toTopOf="@id/username_edittext"
app:layout_constraintEnd_toStartOf="@id/node_port_edittext" app:layout_constraintEnd_toStartOf="@id/node_port_edittext"
app:layout_constraintStart_toStartOf="parent" /> app:layout_constraintStart_toStartOf="parent" />

View File

@ -63,7 +63,7 @@
android:background="@drawable/edittext_bg" android:background="@drawable/edittext_bg"
android:hint="@string/node_address_hint" android:hint="@string/node_address_hint"
android:inputType="text" android:inputType="text"
android:digits="-QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890.:" android:digits="QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890.:-[]"
app:layout_constraintBottom_toTopOf="@id/username_edittext" app:layout_constraintBottom_toTopOf="@id/username_edittext"
app:layout_constraintEnd_toStartOf="@id/node_port_edittext" app:layout_constraintEnd_toStartOf="@id/node_port_edittext"
app:layout_constraintStart_toStartOf="parent" /> app:layout_constraintStart_toStartOf="parent" />