Commit 7a1137be authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Update RoomListPresenter.kt

parent 68f894ca
...@@ -6,6 +6,7 @@ import android.util.Log ...@@ -6,6 +6,7 @@ import android.util.Log
import chat.rocket.android.R import chat.rocket.android.R
import chat.rocket.android.api.rest.RestApiHelper import chat.rocket.android.api.rest.RestApiHelper
import chat.rocket.android.helper.OkHttpHelper import chat.rocket.android.helper.OkHttpHelper
import chat.rocket.android.helper.UrlHelper
import chat.rocket.core.SyncState import chat.rocket.core.SyncState
import chat.rocket.core.models.Message import chat.rocket.core.models.Message
import chat.rocket.core.models.User import chat.rocket.core.models.User
...@@ -182,8 +183,6 @@ class RoomListPresenter(val context: Context, val view: RoomListContract.View): ...@@ -182,8 +183,6 @@ class RoomListPresenter(val context: Context, val view: RoomListContract.View):
override fun onResponse(call: Call, response: Response) { override fun onResponse(call: Call, response: Response) {
if (response.isSuccessful) { if (response.isSuccessful) {
val jSONObject = JSONObject(response.body()?.string()) val jSONObject = JSONObject(response.body()?.string())
Log.i("REST", "= " + jSONObject)
val filesJSONArray = jSONObject.get("files") as JSONArray val filesJSONArray = jSONObject.get("files") as JSONArray
val filesJSONArrayLength = filesJSONArray.length() val filesJSONArrayLength = filesJSONArray.length()
...@@ -199,7 +198,9 @@ class RoomListPresenter(val context: Context, val view: RoomListContract.View): ...@@ -199,7 +198,9 @@ class RoomListPresenter(val context: Context, val view: RoomListContract.View):
} }
val pathJSONArrayLength = pathJSONArray.length() val pathJSONArrayLength = pathJSONArray.length()
val dataSet = ArrayList<String>(pathJSONArrayLength) val dataSet = ArrayList<String>(pathJSONArrayLength)
(0 until pathJSONArrayLength).mapTo(dataSet) { pathJSONArray.get(it).toString() } (0 until pathJSONArrayLength).mapTo(dataSet) {
UrlHelper.getUrlForFile(pathJSONArray.get(it).toString(), userId, token)
}
mainHandler.post { view.showFileList(dataSet) } mainHandler.post { view.showFileList(dataSet) }
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment