From c2575c7ab8c3f258c71c8f43e0303e123b661a6e Mon Sep 17 00:00:00 2001 From: Javier Varona Date: Sat, 24 Nov 2018 22:08:14 -0400 Subject: [PATCH] - Fixed duplicated transactions by inserting new primary key yo crypto_coin_transaction --- .../cy/agorise/crystalwallet/dao/CrystalDatabase.java | 8 ++++---- .../crystalwallet/fragments/SendTransactionFragment.java | 8 ++++---- .../crystalwallet/models/CryptoCoinTransaction.java | 6 +++++- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/dao/CrystalDatabase.java b/app/src/main/java/cy/agorise/crystalwallet/dao/CrystalDatabase.java index 1b224ec..b9e47cf 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/dao/CrystalDatabase.java +++ b/app/src/main/java/cy/agorise/crystalwallet/dao/CrystalDatabase.java @@ -72,10 +72,10 @@ public abstract class CrystalDatabase extends RoomDatabase { Room.databaseBuilder(context, CrystalDatabase.class, "CrystalWallet.db") .allowMainThreadQueries() - .addMigrations(MIGRATION_2_3) - .addMigrations(MIGRATION_3_4) - .addMigrations(MIGRATION_4_5) - .addMigrations(MIGRATION_5_6) + //.addMigrations(MIGRATION_2_3) + //.addMigrations(MIGRATION_3_4) + //.addMigrations(MIGRATION_4_5) + //.addMigrations(MIGRATION_5_6) .build(); } return instance; diff --git a/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java b/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java index bc7805a..3ce8135 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java +++ b/app/src/main/java/cy/agorise/crystalwallet/fragments/SendTransactionFragment.java @@ -680,14 +680,14 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat /* * If exists mode scurity show it and valide events in case of success or fail * */ -/* CrystalSecurityMonitor.getInstance(this.getActivity()).callPasswordRequest(this.getActivity(), new OnResponse() { + CrystalSecurityMonitor.getInstance(this.getActivity()).callPasswordRequest(this.getActivity(), new OnResponse() { @Override public void onSuccess() { /* * Show loading dialog * */ -/* crystalDialog = new CrystalDialog((Activity) getContext()); + crystalDialog = new CrystalDialog((Activity) getContext()); crystalDialog.setText("Sending"); crystalDialog.progress(); crystalDialog.show(); @@ -699,8 +699,8 @@ public class SendTransactionFragment extends DialogFragment implements UIValidat public void onFailed() { } - });*/ - CryptoNetInfoRequests.getInstance().addRequest(sendRequest); + }); + //CryptoNetInfoRequests.getInstance().addRequest(sendRequest); } } diff --git a/app/src/main/java/cy/agorise/crystalwallet/models/CryptoCoinTransaction.java b/app/src/main/java/cy/agorise/crystalwallet/models/CryptoCoinTransaction.java index 4b06ee4..3259d75 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/models/CryptoCoinTransaction.java +++ b/app/src/main/java/cy/agorise/crystalwallet/models/CryptoCoinTransaction.java @@ -20,9 +20,13 @@ import cy.agorise.crystalwallet.enums.CryptoCoin; */ @Entity( tableName="crypto_coin_transaction", + primaryKeys = { + + }, indices={ @Index(value={"account_id"}), - @Index(value={"id_currency"}) + @Index(value={"id_currency"}), + @Index(value={"date", "account_id", "id_currency", "from", "to"},unique=true) }, foreignKeys = { @ForeignKey(