improve time parsing for text locations

This commit is contained in:
Chumva 2018-08-06 16:15:15 +03:00
parent a2bc710c00
commit 9c25f2dd8f

View file

@ -761,8 +761,8 @@ class TelegramHelper private constructor() {
val locStr = s.removePrefix(LOCATION_PREFIX) val locStr = s.removePrefix(LOCATION_PREFIX)
try { try {
val (latS, lonS) = locStr.split(" ") val (latS, lonS) = locStr.split(" ")
val updatedS = locStr.substring(locStr.indexOf("(") + 1, locStr.indexOf(")")) val updatedS = locStr.substring(locStr.indexOf("("), locStr.length)
val timeSecs = parseTime(updatedS) val timeSecs = parseTime(updatedS.removePrefix("(").removeSuffix(")"))
res.lat = latS.dropLast(1).toDouble() res.lat = latS.dropLast(1).toDouble()
res.lon = lonS.toDouble() res.lon = lonS.toDouble()
res.editDate = (System.currentTimeMillis() / 1000 - timeSecs).toInt() res.editDate = (System.currentTimeMillis() / 1000 - timeSecs).toInt()