diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index b43af6ce2..3f1111e70 100644 Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ diff --git a/.idea/caches/gradle_models.ser b/.idea/caches/gradle_models.ser index 5a63940c2..d2002741a 100644 Binary files a/.idea/caches/gradle_models.ser and b/.idea/caches/gradle_models.ser differ diff --git a/app/build.gradle b/app/build.gradle index da99e5171..99a824fca 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId = 'com.wagerrwallet' minSdkVersion 23 targetSdkVersion 28 - versionCode 249 - versionName "249" + versionCode 250 + versionName "250" multiDexEnabled true // Similar to other properties in the defaultConfig block, diff --git a/app/src/main/java/com/wagerrwallet/presenter/entities/TxUiHolder.java b/app/src/main/java/com/wagerrwallet/presenter/entities/TxUiHolder.java index 79abafd2d..689781075 100644 --- a/app/src/main/java/com/wagerrwallet/presenter/entities/TxUiHolder.java +++ b/app/src/main/java/com/wagerrwallet/presenter/entities/TxUiHolder.java @@ -53,6 +53,7 @@ public class TxUiHolder { private int txSize; public TxMetaData metaData; private BetEntity betEntity; + private BetResultEntity betResultEntity; private String teamSearchDescription; private TxUiHolder() { @@ -77,12 +78,16 @@ public TxUiHolder(long timeStamp, int blockHeight, byte[] hash, String txReverse this.txSize = txSize; this.isCoinbase = isCoinbase; betEntity = null; + betResultEntity = null; this.teamSearchDescription = ""; } public BetEntity getBetEntity() { return betEntity;} public void setBetEntity( BetEntity be ) { betEntity=be; } + public BetResultEntity getBetResultEntity() { return betResultEntity;} + public void setBetResultEntity( BetResultEntity br ) { betResultEntity=br; } + public int getBlockHeight() { return blockHeight; } diff --git a/app/src/main/java/com/wagerrwallet/tools/adapter/EventListAdapter.java b/app/src/main/java/com/wagerrwallet/tools/adapter/EventListAdapter.java index 1167ce875..5383a8959 100644 --- a/app/src/main/java/com/wagerrwallet/tools/adapter/EventListAdapter.java +++ b/app/src/main/java/com/wagerrwallet/tools/adapter/EventListAdapter.java @@ -251,7 +251,9 @@ public void filter(final long[] switches, boolean bNotify, String query) { // team match boolean matchesTeam = item.getTxHomeTeam().toLowerCase().contains(lowerQuery) || item.getTxAwayTeam().toLowerCase().contains(lowerQuery); - if ( matchesTeam ) { + boolean matchesEventId = Utils.isInteger(lowerQuery) && item.getEventID()==Integer.parseInt(lowerQuery); + + if ( matchesTeam || matchesEventId ) { if (switchesON == 0) { filteredList.add(item); } else { diff --git a/app/src/main/java/com/wagerrwallet/tools/adapter/TransactionListAdapter.java b/app/src/main/java/com/wagerrwallet/tools/adapter/TransactionListAdapter.java index bd0029f75..f268d43b3 100644 --- a/app/src/main/java/com/wagerrwallet/tools/adapter/TransactionListAdapter.java +++ b/app/src/main/java/com/wagerrwallet/tools/adapter/TransactionListAdapter.java @@ -260,6 +260,7 @@ else if (confirms == 3) BetResultTxDataStore brds = BetResultTxDataStore.getInstance(mContext); BetResultEntity br = brds.getByBlockHeight(mContext, wallet.getIso(mContext), item.getBlockHeight() - 1); if (br != null) { + item.setBetResultEntity( br ); eventID = br.getEventID(); EventTxUiHolder ev = BetEventTxDataStore.getInstance(mContext).getTransactionByEventId(mContext, "wgr", eventID); if (ev != null) { @@ -406,11 +407,14 @@ private void filter(final String query, final boolean[] switches, final boolean[ item = backUpFeed.get(i); boolean matchesHash = item.getTxHashHexReversed() != null && item.getTxHashHexReversed().toLowerCase().contains(lowerQuery); boolean matchesAddress = item.getToRecipient(wallet, false).toLowerCase().contains(lowerQuery) || item.getToRecipient(wallet, true).toLowerCase().contains(lowerQuery); - boolean matchesMemo = item.metaData != null && item.metaData.comment != null && item.metaData.comment.toLowerCase().contains(lowerQuery); + //boolean matchesMemo = item.metaData != null && item.metaData.comment != null && item.metaData.comment.toLowerCase().contains(lowerQuery); // team match boolean matchesTeam = !item.getTeamSearchDescription().isEmpty() && item.getTeamSearchDescription().toLowerCase().contains(lowerQuery); + boolean matchesEventId = Utils.isInteger(lowerQuery) && + ((item.getBetEntity()!=null) && item.getBetEntity().getEventID()==Integer.parseInt(lowerQuery) // bets + || (item.getBetResultEntity()!=null) && item.getBetResultEntity().getEventID()==Integer.parseInt(lowerQuery) ); // payouts - if (matchesHash || matchesAddress || matchesMemo || matchesTeam ) { + if (matchesHash || matchesAddress || matchesTeam || matchesEventId) { if (switchesON == 0) { filteredList.add(item); } else { diff --git a/app/src/main/java/com/wagerrwallet/tools/sqlite/BetEventTxDataStore.java b/app/src/main/java/com/wagerrwallet/tools/sqlite/BetEventTxDataStore.java index e12864620..5ad6a1b65 100644 --- a/app/src/main/java/com/wagerrwallet/tools/sqlite/BetEventTxDataStore.java +++ b/app/src/main/java/com/wagerrwallet/tools/sqlite/BetEventTxDataStore.java @@ -102,12 +102,13 @@ public BetEventEntity putTransaction(Context app, String iso, BetEventEntity tra try { database = openDatabase(); BetEventEntity transactionEntity1 = getTxByHash(app,iso, transactionEntity.getTxHash()); + BetEventEntity transactionEntity2 = getByEventIdLowerHeight(app,iso, transactionEntity.getEventID(), transactionEntity.getBlockheight()); if (transactionEntity1==null) { ContentValues values = new ContentValues(); + values.put(BRSQLiteHelper.BETX_COLUMN_ID, transactionEntity.getTxHash()); values.put(BRSQLiteHelper.BETX_TYPE, transactionEntity.getType().getNumber()); values.put(BRSQLiteHelper.BETX_VERSION, transactionEntity.getVersion()); - values.put(BRSQLiteHelper.BETX_EVENTID, transactionEntity.getEventID()); values.put(BRSQLiteHelper.BETX_EVENT_TIMESTAMP, transactionEntity.getEventTimestamp()); values.put(BRSQLiteHelper.BETX_SPORT, transactionEntity.getSportID()); values.put(BRSQLiteHelper.BETX_TOURNAMENT, transactionEntity.getTournamentID()); @@ -124,7 +125,18 @@ public BetEventEntity putTransaction(Context app, String iso, BetEventEntity tra values.put(BRSQLiteHelper.BETX_ISO, iso.toUpperCase()); database.beginTransaction(); - database.insert(BRSQLiteHelper.BETX_TABLE_NAME, null, values); + + // request, we may receive correction txs + if (transactionEntity2!=null) { + database.update(BRSQLiteHelper.BETX_TABLE_NAME, values, BRSQLiteHelper.BETX_EVENTID + "=? AND " + BRSQLiteHelper.TX_ISO + "=?", + new String[]{String.valueOf(transactionEntity.getEventID()), iso.toUpperCase()} ); + } + else { + values.put(BRSQLiteHelper.BETX_EVENTID, transactionEntity.getEventID()); + database.insert(BRSQLiteHelper.BETX_TABLE_NAME, null, values); + } + + cursor = database.query(BRSQLiteHelper.BETX_TABLE_NAME, allColumns, BRSQLiteHelper.BETX_EVENTID + "=? AND " + BRSQLiteHelper.TX_ISO + "=?", new String[]{String.valueOf(transactionEntity.getEventID()), iso.toUpperCase()}, null, null, null); @@ -265,7 +277,7 @@ public boolean updateTotalsMarket(Context app, String iso, BetEventEntity transa return ret; } - public BetEventEntity getById(Context app, String iso, int eventID) { + public BetEventEntity getByEventIdLowerHeight(Context app, String iso, long eventID, long blockHeight) { Cursor cursor = null; BetEventEntity transactionEntity1 = null; try { @@ -273,8 +285,8 @@ public BetEventEntity getById(Context app, String iso, int eventID) { database = openDatabase(); cursor = database.query(BRSQLiteHelper.BETX_TABLE_NAME, - allColumns, BRSQLiteHelper.BETX_EVENTID + "=? AND " + BRSQLiteHelper.TX_ISO + "=?", - new String[]{ String.valueOf(eventID), iso.toUpperCase()},null,null,null); + allColumns, BRSQLiteHelper.BETX_EVENTID + "=? AND " + BRSQLiteHelper.TX_ISO + "=? AND " + BRSQLiteHelper.TX_BLOCK_HEIGHT + " '9') { + return false; + } + } + return true; + } } \ No newline at end of file