From 9c25f2dd8f9f73e1cc0bf042fb802da6add47887 Mon Sep 17 00:00:00 2001 From: Chumva Date: Mon, 6 Aug 2018 16:15:15 +0300 Subject: [PATCH] improve time parsing for text locations --- .../src/net/osmand/telegram/helpers/TelegramHelper.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt b/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt index f1913fea90..94ad769631 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt @@ -761,8 +761,8 @@ class TelegramHelper private constructor() { val locStr = s.removePrefix(LOCATION_PREFIX) try { val (latS, lonS) = locStr.split(" ") - val updatedS = locStr.substring(locStr.indexOf("(") + 1, locStr.indexOf(")")) - val timeSecs = parseTime(updatedS) + val updatedS = locStr.substring(locStr.indexOf("("), locStr.length) + val timeSecs = parseTime(updatedS.removePrefix("(").removeSuffix(")")) res.lat = latS.dropLast(1).toDouble() res.lon = lonS.toDouble() res.editDate = (System.currentTimeMillis() / 1000 - timeSecs).toInt()