Skip to content

Commit

Permalink
Fixed pars bug
Browse files Browse the repository at this point in the history
  • Loading branch information
David Babakhanyan committed Nov 20, 2018
1 parent d11c9a7 commit 81a55db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@

import com.dm.dmnetworking.api_client.base.DMBaseRequestConfig;
import com.dm.dmnetworking.api_client.base.DMLiveDataBag;
import com.dm.dmnetworking.api_client.base.model.progress.FileProgress;
import com.dm.dmnetworking.api_client.constants.DMINetworkingConstants;
import com.dm.dmnetworking.api_client.listeners.DMINetworkListener;
import com.dm.dmnetworking.parser.DMParserConfigs;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.File;
Expand Down Expand Up @@ -67,8 +65,9 @@ private ArrayList<String> getAllShownImagesPath(Activity activity) {

private void init() {

final String url = "http://www.mocky.io/v2/5be14bc13000006300d9a8a5"; //object
// final String url = "http://www.mocky.io/v2/5be14e693000004e00d9a8b3"; //array
// final String url = "http://www.mocky.io/v2/5bf3ee4f3100008f00619a63"; //object
// final String url = "http://www.mocky.io/v2/5bf3eef43100006400619a6c"; //array
final String url = "http://www.mocky.io/v2/5bf3ef643100006800619a6f"; //array deep
// final String url = "http://www.mocky.io/v2/5bcf2bf33300008200c2486a"; //error list
// final String imageUrl = "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Image_created_with_a_mobile_phone.png/220px-Image_created_with_a_mobile_phone.png";

Expand All @@ -78,9 +77,9 @@ private void init() {
// params.put("a", "aaaaa");
// params.put("b", file);

final Map<String,Object> params = new HashMap<>();
params.put("id","2");
params.put("name","John");
final Map<String, Object> params = new HashMap<>();
params.put("id", "2");
params.put("name", "John");


// final JSONObject jsonObject = new JSONObject();
Expand All @@ -96,12 +95,10 @@ private void init() {
.setMethod(DMINetworkingConstants.Method.POST)
.setParams(params)
.setRequestTag("tag")
.setParserConfigs(new DMParserConfigs<>(User.class, "data"))
.setParserConfigs(new DMParserConfigs<>(User.class, "data", "list"))
.setErrorParserConfigs(new DMParserConfigs<>(RequestError.class));




final DMLiveDataBag<User, RequestError> request = ExampleNetworking.getInstance().request(config);

request.getSuccessT().observe(this, userSuccessT -> {
Expand Down Expand Up @@ -145,7 +142,6 @@ private void init() {
});



ExampleNetworking.getInstance().request(config, new DMINetworkListener<User, RequestError>() {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static ParseObject getType(final JSONObject response, final String... jso
JSONObject tempJsonOld;

if (jsonKeys.length > 1) {
for (int i = 0; i < jsonKeys.length - 1; i++) {
for (int i = 0; i < jsonKeys.length; i++) {
final String s = jsonKeys[i];
tempJsonOld = tempJson;

Expand Down

0 comments on commit 81a55db

Please sign in to comment.