diff --git a/app/build.gradle b/app/build.gradle index eb8df36f73..fcb69771a5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1173 - versionName "0.11.73" + versionCode 1174 + versionName "0.11.74" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/model/DocumentResponse.java b/app/src/main/java/org/ole/planet/myplanet/model/DocumentResponse.java deleted file mode 100644 index 0acfef1f73..0000000000 --- a/app/src/main/java/org/ole/planet/myplanet/model/DocumentResponse.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.ole.planet.myplanet.model; - -import java.util.List; - -public class DocumentResponse { - private String total_rows; - - private String offset; - - private List rows; - - public String getTotal_rows() { - return total_rows; - } - - public void setTotal_rows(String total_rows) { - this.total_rows = total_rows; - } - - public String getOffset() { - return offset; - } - - public void setOffset(String offset) { - this.offset = offset; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - - @Override - public String toString() { - return "ClassPojo [total_rows = " + total_rows + ", offset = " + offset + ", rows = " + rows + "]"; - } -} diff --git a/app/src/main/java/org/ole/planet/myplanet/model/DocumentResponse.kt b/app/src/main/java/org/ole/planet/myplanet/model/DocumentResponse.kt new file mode 100644 index 0000000000..a98ef26212 --- /dev/null +++ b/app/src/main/java/org/ole/planet/myplanet/model/DocumentResponse.kt @@ -0,0 +1,11 @@ +package org.ole.planet.myplanet.model + +class DocumentResponse { + var total_rows: String? = null + var offset: String? = null + @JvmField + var rows: List? = null + override fun toString(): String { + return "ClassPojo [total_rows = $total_rows, offset = $offset, rows = $rows]" + } +} \ No newline at end of file diff --git a/app/src/main/java/org/ole/planet/myplanet/service/SyncManager.java b/app/src/main/java/org/ole/planet/myplanet/service/SyncManager.java index b790bdf69a..0ef01cad7c 100644 --- a/app/src/main/java/org/ole/planet/myplanet/service/SyncManager.java +++ b/app/src/main/java/org/ole/planet/myplanet/service/SyncManager.java @@ -9,7 +9,6 @@ import com.google.gson.Gson; import com.google.gson.JsonArray; -import com.google.gson.JsonElement; import com.google.gson.JsonNull; import com.google.gson.JsonObject; @@ -191,8 +190,8 @@ private void myLibraryTransactionSync() { mRealm.executeTransaction(realm -> { try { DocumentResponse res = apiInterface.getDocuments(Utilities.getHeader(), Utilities.getUrl() + "/shelf/_all_docs").execute().body(); - for (int i = 0; i < res.getRows().size(); i++) { - shelfDoc = res.getRows().get(i); + for (int i = 0; i < res.rows.size(); i++) { + shelfDoc = res.rows.get(i); populateShelfItems(apiInterface, realm); } } catch (IOException e) { diff --git a/app/src/main/java/org/ole/planet/myplanet/service/TransactionSyncManager.java b/app/src/main/java/org/ole/planet/myplanet/service/TransactionSyncManager.java index d8d2b904ea..464da2a9ce 100644 --- a/app/src/main/java/org/ole/planet/myplanet/service/TransactionSyncManager.java +++ b/app/src/main/java/org/ole/planet/myplanet/service/TransactionSyncManager.java @@ -67,8 +67,8 @@ private static void syncHealthData(RealmUserModel userModel, String header) { try { response = apiInterface.getDocuments(header, Utilities.getUrl() + "/" + table + "/_all_docs").execute(); DocumentResponse ob = (DocumentResponse) response.body(); - if (ob != null && ob.getRows().size() > 0) { - Rows r = ob.getRows().get(0); + if (ob != null && ob.rows.size() > 0) { + Rows r = ob.rows.get(0); JsonObject jsonDoc = apiInterface.getJsonObject(header, Utilities.getUrl() + "/" + table + "/" + r.getId()).execute().body(); userModel.setKey(JsonUtils.getString("key", jsonDoc)); userModel.setIv(JsonUtils.getString("iv", jsonDoc));