Change on the managment of the id when saving on database

This commit is contained in:
henry 2018-04-08 22:44:37 -04:00
parent 3a6f4635b0
commit eb351bfbfa
3 changed files with 5 additions and 3 deletions

View file

@ -112,7 +112,6 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
@Override
public void importAccountFromSeed(CryptoNetAccount account, final Context context) {
if(account instanceof GrapheneAccount) {
final GrapheneAccount grapheneAccount = (GrapheneAccount) account;
@ -123,7 +122,8 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
GrapheneAccount fetch = (GrapheneAccount) answer;
grapheneAccount.setAccountId(fetch.getAccountId());
CrystalDatabase db = CrystalDatabase.getAppDatabase(context);
db.cryptoNetAccountDao().insertCryptoNetAccount(grapheneAccount);
long[] idAccount = db.cryptoNetAccountDao().insertCryptoNetAccount(grapheneAccount);
grapheneAccount.setId(idAccount[0]);
db.grapheneAccountInfoDao().insertGrapheneAccountInfo(new GrapheneAccountInfo(grapheneAccount));
subscribeBitsharesAccount(grapheneAccount.getId(),grapheneAccount.getAccountId(),context);
}

View file

@ -252,6 +252,8 @@ public class FileBackupManager implements FileServiceRequestsListener {
account.setName(validatorRequest.getAccountName());
BitsharesAccountManager bManger = new BitsharesAccountManager();
bManger.importAccountFromSeed(account,request.getContext());
request.setStatus(ImportBackupRequest.StatusCode.SUCCEEDED);
}else{
request.setStatus(ImportBackupRequest.StatusCode.FAILED); //TODO reason couldn't insert seed

View file

@ -187,7 +187,7 @@ public class CryptoNetBalanceViewHolder extends RecyclerView.ViewHolder {
* Binds this view with the data of an element of the list
*/
public void bindTo(final CryptoNetBalance balance) {
if (balance == null){
if (balance == null ){
cryptoNetName.setText("loading...");
} else {
final CryptoNetBalanceViewHolder thisViewHolder = this;