mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 20:19:42 +01:00
add logic for geolocation message
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
965692ce7e
commit
73becd432d
@ -177,7 +177,8 @@ public class MagicPreviewMessageViewHolder extends MessageHolders.IncomingImageM
|
||||
} catch (ExecutionException | InterruptedException e) {
|
||||
Log.e(TAG, "Error when checking if worker already exists", e);
|
||||
}
|
||||
|
||||
} else if (message.getMessageType() == ChatMessage.MessageType.SINGLE_NC_GEOLOCATION_MESSAGE) {
|
||||
Log.d(TAG, "handle geolocation here");
|
||||
} else if (message.getMessageType() == ChatMessage.MessageType.SINGLE_LINK_GIPHY_MESSAGE) {
|
||||
messageText.setText("GIPHY");
|
||||
DisplayUtils.setClickableString("GIPHY", "https://giphy.com", messageText);
|
||||
|
@ -103,6 +103,19 @@ public class ChatMessage implements IMessage, MessageContentType, MessageContent
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean hasGeoLocation() {
|
||||
if (messageParameters != null && messageParameters.size() > 0) {
|
||||
for (String key : messageParameters.keySet()) {
|
||||
Map<String, String> individualHashMap = messageParameters.get(key);
|
||||
if (individualHashMap.get("type").equals("geo-location")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getImageUrl() {
|
||||
@ -133,6 +146,11 @@ public class ChatMessage implements IMessage, MessageContentType, MessageContent
|
||||
return MessageType.SINGLE_NC_ATTACHMENT_MESSAGE;
|
||||
}
|
||||
|
||||
if (hasGeoLocation()) {
|
||||
return MessageType.SINGLE_NC_GEOLOCATION_MESSAGE;
|
||||
}
|
||||
|
||||
|
||||
return TextMatchers.getMessageTypeFromString(getText());
|
||||
}
|
||||
|
||||
@ -548,6 +566,7 @@ public class ChatMessage implements IMessage, MessageContentType, MessageContent
|
||||
SINGLE_LINK_IMAGE_MESSAGE,
|
||||
SINGLE_LINK_AUDIO_MESSAGE,
|
||||
SINGLE_NC_ATTACHMENT_MESSAGE,
|
||||
SINGLE_NC_GEOLOCATION_MESSAGE,
|
||||
}
|
||||
|
||||
public enum SystemMessageType {
|
||||
|
@ -33,6 +33,8 @@ class ChatUtils {
|
||||
val type = individualHashMap?.get("type")
|
||||
if (type == "user" || type == "guest" || type == "call") {
|
||||
resultMessage = resultMessage?.replace("{$key}", "@" + individualHashMap["name"])
|
||||
} else if(type == "geo-location"){
|
||||
resultMessage = individualHashMap.get("name")
|
||||
} else if (individualHashMap?.containsKey("link") == true) {
|
||||
resultMessage = if (type == "file") {
|
||||
resultMessage?.replace("{$key}", individualHashMap["name"].toString())
|
||||
|
Loading…
Reference in New Issue
Block a user