Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JsonProperty is not working as intended. Needed to revert txid to low… #130

Merged
merged 1 commit into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private void setupTransactions() {
btn.setTooltip(new Tooltip(transaction.getCategory()));

btn.setOnAction(e -> {
browser.navigateTransaction(transaction.getTxId());
browser.navigateTransaction(transaction.getTxid());
});

FontIcon fontIcon = new FontIcon("fas-wallet");
Expand Down Expand Up @@ -144,20 +144,21 @@ private void setupTransactions() {
btn.setOnAction(e -> {
final Clipboard cb = Clipboard.getSystemClipboard();
final ClipboardContent content = new ClipboardContent();
content.putString(transaction.getTxId());
content.putString(transaction.getTxid());
System.out.println("transaction.getTxid() " + transaction.getTxid());
cb.setContent(content);
if (SystemUtils.IS_OS_MAC_OSX) {
Notifications
.create()
.title("Transaction copied to clipboard")
.text(transaction.getTxId())
.text(transaction.getTxid())
.position(Pos.TOP_RIGHT)
.showInformation();
} else {
Notifications
.create()
.title("Transaction copied to clipboard")
.text(transaction.getTxId())
.text(transaction.getTxid())
.showInformation();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ private void setupWalletTransactions() {
btn.setTooltip(new Tooltip(transaction.getCategory()));

btn.setOnAction(e -> {
browser.navigateTransaction(transaction.getTxId());
browser.navigateTransaction(transaction.getTxid());
});

FontIcon fontIcon = new FontIcon("fas-wallet");
Expand Down Expand Up @@ -237,21 +237,21 @@ private void setupWalletTransactions() {
final Clipboard cb = Clipboard.getSystemClipboard();
final ClipboardContent content = new ClipboardContent();

content.putString(transaction.getTxId());
content.putString(transaction.getTxid());
cb.setContent(content);

if (SystemUtils.IS_OS_MAC_OSX) {
Notifications
.create()
.title("Transaction copied to clipboard")
.text(transaction.getTxId())
.text(transaction.getTxid())
.position(Pos.TOP_RIGHT)
.showInformation();
} else {
Notifications
.create()
.title("Transaction copied to clipboard")
.text(transaction.getTxId())
.text(transaction.getTxid())
.showInformation();
}
});
Expand Down
12 changes: 7 additions & 5 deletions fx/src/main/java/org/unigrid/janus/model/Transaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ of the License (see COPYING and COPYING.addendum).

package org.unigrid.janus.model;

import com.fasterxml.jackson.annotation.JsonProperty;
//import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.List;
import java.util.Objects;
Expand All @@ -43,13 +43,15 @@ public class Transaction {
private String generatedfrom;
private List<Transaction> parts;

@JsonProperty("txid")
private String txId;
// TODO this doesnt work
// had to revert for now to get a hotfix released
//@JsonProperty("txid")
private String txid;

public boolean hasPart(Transaction transaction) {
boolean result = false;

if (txId.equals(transaction.txId) && Objects.nonNull(parts)) {
if (txid.equals(transaction.txid) && Objects.nonNull(parts)) {
for (Transaction t : parts) {
if ((t.address.equals(transaction.address)) && (t.category.equals(transaction.category))
&& (t.amount == transaction.amount) && (t.time == transaction.time)) {
Expand Down Expand Up @@ -78,7 +80,7 @@ public boolean addPart(Transaction trans) {

public Transaction convertToMultiPart() {
final Transaction transaction = new Transaction(account, address, "multipart", amount, time);
transaction.setTxId(txId);
transaction.setTxid(txid);
transaction.addPart(this);

return transaction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,16 @@ public int loadNewTransactions() {
public int isDuplicate(Transaction transaction, boolean beginning) {
int result = -1;

if (transaction.getTxId() == null) {
if (transaction.getTxid() == null) {
return -1;
}

try {
int index = 0;

for (Transaction t : transactions) {
if (t.getTxId() != null && transaction.getTxId() != null) {
if (t.getTxId().equals(transaction.getTxId())) {
if (t.getTxid() != null && transaction.getTxid() != null) {
if (t.getTxid().equals(transaction.getTxid())) {
result = index;
break;
}
Expand All @@ -120,7 +120,7 @@ public Transaction getMultiPart(Transaction transaction, boolean beginning) {

for (Transaction t : this.transactions) {
if (t.getCategory().equals("multipart")
&& t.getTxId().equals(transaction.getTxId())) {
&& t.getTxid().equals(transaction.getTxid())) {
result = t;
break;
}
Expand Down