From bc1f9421664f9ef6d42de00cbf6c8ab85be0140a Mon Sep 17 00:00:00 2001 From: Chumva Date: Wed, 3 Oct 2018 13:14:55 +0300 Subject: [PATCH] Add log to OsmandApiUtils --- .../src/net/osmand/telegram/utils/AndroidNetworkUtils.kt | 4 ++-- .../src/net/osmand/telegram/utils/OsmandApiUtils.kt | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/OsmAnd-telegram/src/net/osmand/telegram/utils/AndroidNetworkUtils.kt b/OsmAnd-telegram/src/net/osmand/telegram/utils/AndroidNetworkUtils.kt index 89a78e1c14..928ccc4905 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/utils/AndroidNetworkUtils.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/utils/AndroidNetworkUtils.kt @@ -27,6 +27,7 @@ object AndroidNetworkUtils { return try { sendRequest(urlText) } catch (e: Exception) { + log.error(e.message, e) null } } @@ -54,8 +55,7 @@ object AndroidNetworkUtils { val responseBody = StringBuilder() responseBody.setLength(0) if (inputStream != null) { - val bufferedInput = - BufferedReader(InputStreamReader(inputStream, "UTF-8")) + val bufferedInput = BufferedReader(InputStreamReader(inputStream, "UTF-8")) var s = bufferedInput.readLine() var first = true while (s != null) { diff --git a/OsmAnd-telegram/src/net/osmand/telegram/utils/OsmandApiUtils.kt b/OsmAnd-telegram/src/net/osmand/telegram/utils/OsmandApiUtils.kt index 36ec57c642..be10f8f601 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/utils/OsmandApiUtils.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/utils/OsmandApiUtils.kt @@ -1,5 +1,6 @@ package net.osmand.telegram.utils +import net.osmand.PlatformUtil import net.osmand.telegram.TelegramApplication import net.osmand.telegram.TelegramSettings import org.json.JSONException @@ -7,6 +8,8 @@ import org.json.JSONObject object OsmandApiUtils { + private val log = PlatformUtil.getLog(OsmandApiUtils::class.java) + fun updateSharingDevices(app: TelegramApplication, userId: Int) { AndroidNetworkUtils.sendRequestAsync( "https://osmand.net/device/send-devices?uid=$userId", @@ -36,7 +39,7 @@ object OsmandApiUtils { list.add(deviceBot) } } catch (e: JSONException) { - + log.error(e.message, e) } return list }