- Fixed Bitshares account creation validation to only fire event when account is not null
- Now the Service load transactions only when GrapheneAccountInfo is inserted
This commit is contained in:
parent
e2a453478c
commit
71c1df2306
2 changed files with 15 additions and 7 deletions
|
@ -54,7 +54,13 @@ public class ValidateCreateBitsharesAccountRequest extends CryptoNetInfoRequest
|
||||||
|
|
||||||
public void validate(){
|
public void validate(){
|
||||||
if ((this.accountExists != null)){// && (this.account != null)){
|
if ((this.accountExists != null)){// && (this.account != null)){
|
||||||
|
if (this.accountExists == true) {
|
||||||
this._fireOnCarryOutEvent();
|
this._fireOnCarryOutEvent();
|
||||||
|
} else {
|
||||||
|
if (this.account != null){
|
||||||
|
this._fireOnCarryOutEvent();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,15 +126,17 @@ public class CrystalWalletService extends LifecycleService {
|
||||||
final CrystalWalletService thisService = this;
|
final CrystalWalletService thisService = this;
|
||||||
|
|
||||||
final CrystalDatabase db = CrystalDatabase.getAppDatabase(this);
|
final CrystalDatabase db = CrystalDatabase.getAppDatabase(this);
|
||||||
final LiveData<List<CryptoNetAccount>> cryptoNetAccountList = db.cryptoNetAccountDao().getAll();
|
//final LiveData<List<CryptoNetAccount>> cryptoNetAccountList = db.cryptoNetAccountDao().getAll();
|
||||||
cryptoNetAccountList.observe(this, new Observer<List<CryptoNetAccount>>() {
|
final LiveData<List<GrapheneAccountInfo>> grapheneAccountInfoList = db.grapheneAccountInfoDao().getAll();
|
||||||
|
grapheneAccountInfoList.observe(this, new Observer<List<GrapheneAccountInfo>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(@Nullable List<CryptoNetAccount> cryptoNetAccounts) {
|
public void onChanged(@Nullable List<GrapheneAccountInfo> grapheneAccountInfos) {
|
||||||
GrapheneAccount nextGrapheneAccount;
|
GrapheneAccount nextGrapheneAccount;
|
||||||
for(CryptoNetAccount nextAccount : cryptoNetAccountList.getValue()) {
|
for(GrapheneAccountInfo nextGrapheneAccountInfo : grapheneAccountInfos) {
|
||||||
GrapheneAccountInfo grapheneAccountInfo = db.grapheneAccountInfoDao().getByAccountId(nextAccount.getId());
|
CryptoNetAccount nextAccount = db.cryptoNetAccountDao().getById(nextGrapheneAccountInfo.getCryptoNetAccountId());
|
||||||
|
//GrapheneAccountInfo grapheneAccountInfo = db.grapheneAccountInfoDao().getByAccountId(nextAccount.getId());
|
||||||
nextGrapheneAccount = new GrapheneAccount(nextAccount);
|
nextGrapheneAccount = new GrapheneAccount(nextAccount);
|
||||||
nextGrapheneAccount.loadInfo(grapheneAccountInfo);
|
nextGrapheneAccount.loadInfo(nextGrapheneAccountInfo);
|
||||||
|
|
||||||
|
|
||||||
bitsharesAccountManager.loadAccountFromDB(nextGrapheneAccount,thisService);
|
bitsharesAccountManager.loadAccountFromDB(nextGrapheneAccount,thisService);
|
||||||
|
|
Loading…
Reference in a new issue