Skip to content
This repository was archived by the owner on Nov 24, 2020. It is now read-only.

Commit 930f130

Browse files
fix handle sintax - kt android
1 parent 6bed62e commit 930f130

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/target/kt_android.cr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,14 @@ END
270270
client.newCall(request).enqueue(object: Callback {
271271
override fun onFailure(call: Call?, e: IOException?) {
272272
e?.printStackTrace()
273-
Handler(Looper.mainLooper).post {
273+
Handler(Looper.getMainLooper()).post {
274274
callback(Error(ErrorType.Fatal, e?.message ?: "Chamada falhou sem mensagem de erro!"), null)
275275
}
276276
}
277277
278278
override fun onResponse(call: Call?, response: Response?) {
279279
if (response == null || response.code() == 502) {
280-
Handler(Looper.mainLooper).post {
280+
Handler(Looper.getMainLooper()).post {
281281
callback(Error(ErrorType.Fatal, "Erro Fatal (502) - Tente novamente"), null)
282282
}
283283
return
@@ -287,7 +287,7 @@ END
287287
val stringBody = response?.body()?.string()
288288
JSONObject(stringBody)
289289
} catch (e: Exception) {
290-
Handler(Looper.mainLooper).post {
290+
Handler(Looper.getMainLooper()).post {
291291
callback(Error(ErrorType.Fatal, "502 - Tente novamente"), null)
292292
}
293293
null
@@ -302,19 +302,19 @@ END
302302
//TODO Fetch correct error type
303303
val error = Error(ErrorType.valueOf(jsonError.getString("type")), jsonError.getString("message"))
304304
Log.e("API Error", jsonError.getString("type") + " - " + error.message);
305-
Handler(Looper.mainLooper).post {
305+
Handler(Looper.getMainLooper()).post {
306306
callback(error, null)
307307
}
308308
} else {
309-
Handler(Looper.mainLooper).post {
309+
Handler(Looper.getMainLooper()).post {
310310
callback(null, responseBody)
311311
}
312312
}
313313
}
314314
})
315315
} catch (e: JSONException) {
316316
e.printStackTrace()
317-
Handler(Looper.mainLooper).post {
317+
Handler(Looper.getMainLooper()).post {
318318
callback(Error(ErrorType.Fatal, e.message ?: "Erro ao parsear json"), null)
319319
}
320320
}

0 commit comments

Comments
 (0)