manager for validateimport

This commit is contained in:
henry 2017-10-02 22:49:17 -04:00
parent eb2029049a
commit da293143ea
2 changed files with 44 additions and 0 deletions

View file

@ -41,4 +41,20 @@ public class ValidateImportBitsharesAccountRequest extends CryptoNetInfoRequest
this._fireOnCarryOutEvent(); this._fireOnCarryOutEvent();
} }
} }
public String getAccountName() {
return accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public String getMnemonic() {
return mnemonic;
}
public void setMnemonic(String mnemonic) {
this.mnemonic = mnemonic;
}
} }

View file

@ -1,5 +1,8 @@
package cy.agorise.crystalwallet.manager; package cy.agorise.crystalwallet.manager;
import cy.agorise.crystalwallet.apigenerator.ApiRequest;
import cy.agorise.crystalwallet.apigenerator.ApiRequestListener;
import cy.agorise.crystalwallet.apigenerator.GrapheneApiGenerator;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequest; import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequest;
import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestsListener; import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestsListener;
import cy.agorise.crystalwallet.cryptonetinforequests.ValidateImportBitsharesAccountRequest; import cy.agorise.crystalwallet.cryptonetinforequests.ValidateImportBitsharesAccountRequest;
@ -28,6 +31,31 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
@Override @Override
public void onNewRequest(CryptoNetInfoRequest request) { public void onNewRequest(CryptoNetInfoRequest request) {
if (request instanceof ValidateImportBitsharesAccountRequest){ if (request instanceof ValidateImportBitsharesAccountRequest){
final ValidateImportBitsharesAccountRequest importRequest = (ValidateImportBitsharesAccountRequest) request;
ApiRequest checkAccountName = new ApiRequest(0, new ApiRequestListener() {
@Override
public void success(Object answer, int idPetition) {
ApiRequest getAccountInfo = new ApiRequest(1,new ApiRequestListener(){
@Override
public void success(Object answer, int idPetition) {
//TODO compare keys
}
@Override
public void fail(int idPetition) {
importRequest._fireOnCarryOutEvent();
}
});
GrapheneApiGenerator.getAccountById((String)answer,getAccountInfo);
}
@Override
public void fail(int idPetition) {
importRequest._fireOnCarryOutEvent();
}
});
GrapheneApiGenerator.getAccountIdByName(importRequest.getAccountName(),checkAccountName);
} }
} }
} }