commit
492555ef6c
4 changed files with 17 additions and 6 deletions
|
@ -147,7 +147,7 @@
|
|||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/hint_text_size"
|
||||
app:typeface="@string/font_roboto_regular"
|
||||
tools:text="@string/expire_in" />
|
||||
tools:text="@string/expire_at" />
|
||||
|
||||
<net.osmand.telegram.ui.views.TextViewEx
|
||||
android:id="@+id/ending_in_first_part"
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<string name="send_my_location">Send my location</string>
|
||||
<string name="gps_and_location">GPS & location</string>
|
||||
<string name="sharing_time">Sharing time</string>
|
||||
<string name="expire_in">Expire at</string>
|
||||
<string name="expire_at">Expire at</string>
|
||||
<string name="stop_sharing_all">Sharing is enabled (disable)</string>
|
||||
<string name="turn_off_location_sharing">Turn off location sharing</string>
|
||||
<string name="open_osmand">Open OsmAnd</string>
|
||||
|
|
|
@ -31,6 +31,7 @@ class TelegramHelper private constructor() {
|
|||
private const val DEVICE_PREFIX = "Device: "
|
||||
private const val LOCATION_PREFIX = "Location: "
|
||||
private const val LAST_LOCATION_PREFIX = "Last location: "
|
||||
private const val UPDATED_PREFIX = "Updated: "
|
||||
|
||||
private const val FEW_SECONDS_AGO = "few seconds ago"
|
||||
private const val SECONDS_AGO_SUFFIX = " seconds ago"
|
||||
|
@ -796,7 +797,11 @@ class TelegramHelper private constructor() {
|
|||
}
|
||||
|
||||
private fun TdApi.Message.isAppropriate(): Boolean {
|
||||
if (isOutgoing || isChannelPost) {
|
||||
if (isChannelPost) {
|
||||
return false
|
||||
}
|
||||
val isOsmAndBot = isOsmAndBot(senderUserId) || isOsmAndBot(viaBotUserId)
|
||||
if (isOutgoing && !isOsmAndBot) {
|
||||
return false
|
||||
}
|
||||
val lastEdited = Math.max(date, editDate)
|
||||
|
@ -806,8 +811,7 @@ class TelegramHelper private constructor() {
|
|||
val content = content
|
||||
return when (content) {
|
||||
is TdApi.MessageLocation -> true
|
||||
is TdApi.MessageText -> (isOsmAndBot(senderUserId) || isOsmAndBot(viaBotUserId))
|
||||
&& content.text.text.startsWith(DEVICE_PREFIX)
|
||||
is TdApi.MessageText -> (isOsmAndBot) && content.text.text.startsWith(DEVICE_PREFIX)
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
@ -870,6 +874,13 @@ class TelegramHelper private constructor() {
|
|||
}
|
||||
}
|
||||
}
|
||||
s.startsWith(UPDATED_PREFIX) -> {
|
||||
if (res.lastUpdated == 0) {
|
||||
val updatedStr = s.removePrefix(UPDATED_PREFIX)
|
||||
val updatedS = updatedStr.substring(0, updatedStr.indexOf("("))
|
||||
res.lastUpdated = (parseTime(updatedS.trim()) / 1000).toInt()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return res
|
||||
|
|
|
@ -591,7 +591,7 @@ class MyLocationTabFragment : Fragment(), TelegramListener {
|
|||
|
||||
holder.stopSharingDescr?.apply {
|
||||
visibility = getStopSharingVisibility(expiresIn)
|
||||
text = "${getText(R.string.expire_in)}:"
|
||||
text = getText(R.string.expire_at)
|
||||
}
|
||||
|
||||
holder.stopSharingFirstPart?.apply {
|
||||
|
|
Loading…
Reference in a new issue