mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 12:39:58 +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) {
|
} catch (ExecutionException | InterruptedException e) {
|
||||||
Log.e(TAG, "Error when checking if worker already exists", 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) {
|
} else if (message.getMessageType() == ChatMessage.MessageType.SINGLE_LINK_GIPHY_MESSAGE) {
|
||||||
messageText.setText("GIPHY");
|
messageText.setText("GIPHY");
|
||||||
DisplayUtils.setClickableString("GIPHY", "https://giphy.com", messageText);
|
DisplayUtils.setClickableString("GIPHY", "https://giphy.com", messageText);
|
||||||
|
@ -103,6 +103,19 @@ public class ChatMessage implements IMessage, MessageContentType, MessageContent
|
|||||||
return false;
|
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
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public String getImageUrl() {
|
public String getImageUrl() {
|
||||||
@ -133,6 +146,11 @@ public class ChatMessage implements IMessage, MessageContentType, MessageContent
|
|||||||
return MessageType.SINGLE_NC_ATTACHMENT_MESSAGE;
|
return MessageType.SINGLE_NC_ATTACHMENT_MESSAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasGeoLocation()) {
|
||||||
|
return MessageType.SINGLE_NC_GEOLOCATION_MESSAGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return TextMatchers.getMessageTypeFromString(getText());
|
return TextMatchers.getMessageTypeFromString(getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,6 +566,7 @@ public class ChatMessage implements IMessage, MessageContentType, MessageContent
|
|||||||
SINGLE_LINK_IMAGE_MESSAGE,
|
SINGLE_LINK_IMAGE_MESSAGE,
|
||||||
SINGLE_LINK_AUDIO_MESSAGE,
|
SINGLE_LINK_AUDIO_MESSAGE,
|
||||||
SINGLE_NC_ATTACHMENT_MESSAGE,
|
SINGLE_NC_ATTACHMENT_MESSAGE,
|
||||||
|
SINGLE_NC_GEOLOCATION_MESSAGE,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SystemMessageType {
|
public enum SystemMessageType {
|
||||||
|
@ -33,6 +33,8 @@ class ChatUtils {
|
|||||||
val type = individualHashMap?.get("type")
|
val type = individualHashMap?.get("type")
|
||||||
if (type == "user" || type == "guest" || type == "call") {
|
if (type == "user" || type == "guest" || type == "call") {
|
||||||
resultMessage = resultMessage?.replace("{$key}", "@" + individualHashMap["name"])
|
resultMessage = resultMessage?.replace("{$key}", "@" + individualHashMap["name"])
|
||||||
|
} else if(type == "geo-location"){
|
||||||
|
resultMessage = individualHashMap.get("name")
|
||||||
} else if (individualHashMap?.containsKey("link") == true) {
|
} else if (individualHashMap?.containsKey("link") == true) {
|
||||||
resultMessage = if (type == "file") {
|
resultMessage = if (type == "file") {
|
||||||
resultMessage?.replace("{$key}", individualHashMap["name"].toString())
|
resultMessage?.replace("{$key}", individualHashMap["name"].toString())
|
||||||
|
Loading…
Reference in New Issue
Block a user