This commit is contained in:
Javier Varona 2018-05-13 21:25:34 -04:00
commit 17dfc3e074
2 changed files with 77 additions and 0 deletions

View file

@ -23,6 +23,7 @@ import cy.agorise.crystalwallet.models.seed.BIP39;
import cy.agorise.crystalwallet.requestmanagers.CryptoNetEquivalentRequest; import cy.agorise.crystalwallet.requestmanagers.CryptoNetEquivalentRequest;
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequest; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequest;
import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestsListener; import cy.agorise.crystalwallet.requestmanagers.CryptoNetInfoRequestsListener;
import cy.agorise.crystalwallet.requestmanagers.ValidateBitsharesLTMUpgradeRequest;
import cy.agorise.crystalwallet.requestmanagers.ValidateBitsharesSendRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateBitsharesSendRequest;
import cy.agorise.crystalwallet.requestmanagers.ValidateCreateBitsharesAccountRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateCreateBitsharesAccountRequest;
import cy.agorise.crystalwallet.requestmanagers.ValidateExistBitsharesAccountRequest; import cy.agorise.crystalwallet.requestmanagers.ValidateExistBitsharesAccountRequest;
@ -227,6 +228,8 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
this.getEquivalentValue((CryptoNetEquivalentRequest) request); this.getEquivalentValue((CryptoNetEquivalentRequest) request);
}else if (request instanceof ValidateCreateBitsharesAccountRequest){ }else if (request instanceof ValidateCreateBitsharesAccountRequest){
this.validateCreateAccount((ValidateCreateBitsharesAccountRequest) request); this.validateCreateAccount((ValidateCreateBitsharesAccountRequest) request);
}else if (request instanceof ValidateBitsharesLTMUpgradeRequest){
this.validateLTMAccountUpgrade((ValidateBitsharesLTMUpgradeRequest) request);
}else{ }else{
//TODO not implemented //TODO not implemented
System.out.println("Error request not implemented " + request.getClass().getName()); System.out.println("Error request not implemented " + request.getClass().getName());
@ -436,6 +439,15 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
} }
/**
* Broadcast a transaction request
*/
private void validateLTMAccountUpgrade(final ValidateBitsharesLTMUpgradeRequest sendRequest) {
//TODO check internet, server connection
sendRequest.setStatus(ValidateBitsharesLTMUpgradeRequest.StatusCode.PETITION_FAILED);
CrystalDatabase db = CrystalDatabase.getAppDatabase(sendRequest.getContext());
}
/** /**
* Returns the account info from a graphene id * Returns the account info from a graphene id
* @param grapheneId The graphene id of the account * @param grapheneId The graphene id of the account

View file

@ -0,0 +1,65 @@
package cy.agorise.crystalwallet.requestmanagers;
import android.content.Context;
import cy.agorise.crystalwallet.enums.CryptoCoin;
import cy.agorise.crystalwallet.models.GrapheneAccount;
/**
* Class used to make a send amount request.
*
* Created by henry on 8/10/2017.
*/
public class ValidateBitsharesLTMUpgradeRequest extends CryptoNetInfoRequest {
/**
* The status code of this request
*/
public enum StatusCode{
NOT_STARTED,
SUCCEEDED,
NO_INTERNET,
NO_SERVER_CONNECTION,
NO_ASSET_INFO_DB,
NO_ASSET_INFO,
NO_FUNDS,
PETITION_FAILED
}
// The app context
private Context mContext;
// The source account used to transfer fund from
private GrapheneAccount mSourceAccount;
// The state of this request
private StatusCode status = StatusCode.NOT_STARTED;
public ValidateBitsharesLTMUpgradeRequest(Context context, GrapheneAccount sourceAccount) {
super(CryptoCoin.BITSHARES);
this.mContext = context;
this.mSourceAccount = sourceAccount;
}
public Context getContext() {
return mContext;
}
public GrapheneAccount getSourceAccount() {
return mSourceAccount;
}
public void validate(){
if ((this.status != StatusCode.NOT_STARTED)){
this._fireOnCarryOutEvent();
}
}
public void setStatus(StatusCode code){
this.status = code;
this.validate();
}
public StatusCode getStatus() {
return status;
}
}