diff --git a/app/src/main/java/com/keystone/cold/DataRepository.java b/app/src/main/java/com/keystone/cold/DataRepository.java index abdb051b..ea358a77 100644 --- a/app/src/main/java/com/keystone/cold/DataRepository.java +++ b/app/src/main/java/com/keystone/cold/DataRepository.java @@ -170,7 +170,7 @@ public List loadElectrumTxsSync(String coinId) { } public List loadAllTxSync(String coinId) { - return mDb.txDao().loadTxsSync(coinId); + return mDb.txDao().loadTxsSync(coinId, getBelongTo()); } public LiveData loadTx(String txId) { @@ -358,14 +358,14 @@ public Web3TxEntity loadETHTxSync(String txId) { } public List loadETHTxsSync() { - return mDb.ethTxDao().loadETHTxsSync(); + return mDb.ethTxDao().loadETHTxsSync(getBelongTo()); } public List loadETHTxs(int limit, int offset) { - return mDb.ethTxDao().loadETHTxsSync(limit, offset); + return mDb.ethTxDao().loadETHTxsSync(getBelongTo(), limit, offset); } public List loadTxs(String coinId, int limit, int offset) { - return mDb.txDao().loadTxs(coinId, limit, offset); + return mDb.txDao().loadTxs(coinId, getBelongTo(), limit, offset); } } diff --git a/app/src/main/java/com/keystone/cold/db/dao/ETHTxDao.java b/app/src/main/java/com/keystone/cold/db/dao/ETHTxDao.java index b94b1eed..ab560036 100644 --- a/app/src/main/java/com/keystone/cold/db/dao/ETHTxDao.java +++ b/app/src/main/java/com/keystone/cold/db/dao/ETHTxDao.java @@ -29,8 +29,8 @@ @Dao public interface ETHTxDao { - @Query("SELECT * FROM ethtxs ORDER BY timeStamp DESC") - List loadETHTxsSync(); + @Query("SELECT * FROM ethtxs where belongTo = :belongTo ORDER BY timeStamp DESC") + List loadETHTxsSync(String belongTo); @Insert(onConflict = OnConflictStrategy.REPLACE) void insert(Web3TxEntity tx); @@ -41,6 +41,6 @@ public interface ETHTxDao { @Query("DELETE FROM ethtxs WHERE belongTo = 'hidden'") int deleteHidden(); - @Query("SELECT * FROM ethtxs ORDER BY timeStamp DESC LIMIT :limit OFFSET :offset") - List loadETHTxsSync(int limit, int offset); + @Query("SELECT * FROM ethtxs where belongTo = :belongTo ORDER BY timeStamp DESC LIMIT :limit OFFSET :offset") + List loadETHTxsSync(String belongTo, int limit, int offset); } diff --git a/app/src/main/java/com/keystone/cold/db/dao/TxDao.java b/app/src/main/java/com/keystone/cold/db/dao/TxDao.java index fdc3e9b0..84da133d 100644 --- a/app/src/main/java/com/keystone/cold/db/dao/TxDao.java +++ b/app/src/main/java/com/keystone/cold/db/dao/TxDao.java @@ -39,8 +39,8 @@ public interface TxDao { @Query("SELECT * FROM txs where coinId = :coinId and signId = 'electrum_sign_id' ORDER BY timeStamp DESC") List loadElectrumTxsSync(String coinId); - @Query("SELECT * FROM txs where coinId = :coinId") - List loadTxsSync(String coinId); + @Query("SELECT * FROM txs where coinId = :coinId AND belongTo = :belongTo") + List loadTxsSync(String coinId, String belongTo); @Insert(onConflict = OnConflictStrategy.REPLACE) void insert(TxEntity tx); @@ -57,6 +57,6 @@ public interface TxDao { @Query("DELETE FROM txs WHERE belongTo = 'hidden'") int deleteHidden(); - @Query("SELECT * FROM txs where coinId = :coinId ORDER BY timeStamp DESC LIMIT :limit OFFSET :offset") - List loadTxs(String coinId, int limit, int offset); + @Query("SELECT * FROM txs where coinId = :coinId AND belongTo = :belongTo ORDER BY timeStamp DESC LIMIT :limit OFFSET :offset") + List loadTxs(String coinId, String belongTo, int limit, int offset); }