Fixing problem with the de-serialization procedure of the 'get_full_accounts' API call response

This commit is contained in:
Nelson R. Perez 2018-09-06 23:46:42 -05:00
parent 39048b1096
commit 0437919bb8
2 changed files with 4 additions and 1 deletions

View file

@ -160,7 +160,7 @@ public class DeserializationMap {
mGsonMap.put(GetAccountHistoryByOperations.class, getAccountHistoryByOperationsGson); mGsonMap.put(GetAccountHistoryByOperations.class, getAccountHistoryByOperationsGson);
// GetFullAccounts // GetFullAccounts
mClassMap.put(GetFullAccounts.class, FullAccountDetails.class); mClassMap.put(GetFullAccounts.class, List.class);
Gson getFullAccountsGson = new GsonBuilder() Gson getFullAccountsGson = new GsonBuilder()
.registerTypeAdapter(FullAccountDetails.class, new FullAccountDetails.FullAccountDeserializer()) .registerTypeAdapter(FullAccountDetails.class, new FullAccountDetails.FullAccountDeserializer())
.registerTypeAdapter(Authority.class, new Authority.AuthorityDeserializer()) .registerTypeAdapter(Authority.class, new Authority.AuthorityDeserializer())

View file

@ -377,6 +377,7 @@ public class PerformCallActivity extends ConnectedActivity {
long start = Long.parseLong(param3.getText().toString()); long start = Long.parseLong(param3.getText().toString());
long limit = Long.parseLong(param4.getText().toString()); long limit = Long.parseLong(param4.getText().toString());
long id = mNetworkService.sendMessage(new GetAccountHistoryByOperations(account, operationTypes, start, limit), GetAccountHistoryByOperations.REQUIRED_API); long id = mNetworkService.sendMessage(new GetAccountHistoryByOperations(account, operationTypes, start, limit), GetAccountHistoryByOperations.REQUIRED_API);
responseMap.put(id, mRPC);
}catch(NumberFormatException e){ }catch(NumberFormatException e){
Toast.makeText(this, getString(R.string.error_number_format), Toast.LENGTH_SHORT).show(); Toast.makeText(this, getString(R.string.error_number_format), Toast.LENGTH_SHORT).show();
Log.e(TAG,"NumberFormatException while trying to read arguments for 'get_account_history_by_operations'. Msg: "+e.getMessage()); Log.e(TAG,"NumberFormatException while trying to read arguments for 'get_account_history_by_operations'. Msg: "+e.getMessage());
@ -387,6 +388,7 @@ public class PerformCallActivity extends ConnectedActivity {
ArrayList<String> accounts = new ArrayList<>(); ArrayList<String> accounts = new ArrayList<>();
accounts.addAll(Arrays.asList(param1.getText().toString().split(","))); accounts.addAll(Arrays.asList(param1.getText().toString().split(",")));
long id = mNetworkService.sendMessage(new GetFullAccounts(accounts, false), GetFullAccounts.REQUIRED_API); long id = mNetworkService.sendMessage(new GetFullAccounts(accounts, false), GetFullAccounts.REQUIRED_API);
responseMap.put(id, mRPC);
} }
/** /**
@ -411,6 +413,7 @@ public class PerformCallActivity extends ConnectedActivity {
case RPC.CALL_GET_ACCOUNT_BY_NAME: case RPC.CALL_GET_ACCOUNT_BY_NAME:
case RPC.CALL_GET_LIMIT_ORDERS: case RPC.CALL_GET_LIMIT_ORDERS:
case RPC.CALL_GET_ACCOUNT_HISTORY_BY_OPERATIONS: case RPC.CALL_GET_ACCOUNT_HISTORY_BY_OPERATIONS:
case RPC.CALL_GET_FULL_ACCOUNTS:
mResponseView.setText(mResponseView.getText() + gson.toJson(response, JsonRpcResponse.class) + "\n"); mResponseView.setText(mResponseView.getText() + gson.toJson(response, JsonRpcResponse.class) + "\n");
break; break;
default: default: