Skip to content

Commit

Permalink
Issue #1115 - Location quick reply removed
Browse files Browse the repository at this point in the history
  • Loading branch information
nbartels committed Feb 5, 2021
1 parent 6816d40 commit 76ca8b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
14 changes: 1 addition & 13 deletions src/main/lombok/com/restfb/types/send/QuickReply.java
Expand Up @@ -67,24 +67,12 @@ public QuickReply(String title, String payload) {
this.payload = payload;
}

/**
* @deprecated use {@link QuickReply#QuickReply(QuickReplyType)} with {@link QuickReplyType#LOCATION} as parameter instead
*/
@Deprecated
public QuickReply() {
this(QuickReplyType.LOCATION);
}

public QuickReply(QuickReplyType quickReplyType) {
this.contentType = quickReplyType.getContentType();
}

public enum QuickReplyType {
USER_EMAIL, USER_PHONE_NUMBER,
/**
* @TODO: remove after October 29th, 2019
*/
@Deprecated LOCATION;
USER_EMAIL, USER_PHONE_NUMBER;

public String getContentType() {
return name().toLowerCase();
Expand Down
7 changes: 1 addition & 6 deletions src/test/java/com/restfb/types/SendApiTest.java
Expand Up @@ -558,25 +558,20 @@ void messageWithQuickRepliesAndMetadata() {
QuickReply quickReply1 = new QuickReply("title 1", "payload 1");
QuickReply quickReply2 = new QuickReply("title 2", "payload 2");
quickReply2.setImageUrl("http://example.org/test.jpg");
QuickReply quickReply3 = new QuickReply(QuickReply.QuickReplyType.LOCATION);
QuickReply quickReply4 = new QuickReply(QuickReply.QuickReplyType.LOCATION);
quickReply4.setImageUrl("http://example.org/test2.jpg");
QuickReply quickReply5 = new QuickReply(QuickReply.QuickReplyType.USER_EMAIL);
QuickReply quickReply6 = new QuickReply(QuickReply.QuickReplyType.USER_PHONE_NUMBER);
Message message = new Message("message text");
message.setMetadata("metadata payload");
message.addQuickReply(quickReply1);
message.addQuickReply(quickReply2);
message.addQuickReply(quickReply3);
message.addQuickReply(quickReply4);
message.addQuickReply(quickReply5);
message.addQuickReply(quickReply6);

DefaultJsonMapper mapper = new DefaultJsonMapper();
String messageJsonString = mapper.toJson(message, true);

AssertJson.assertEquals(
"{\"text\":\"message text\",\"quick_replies\":[{\"content_type\":\"text\",\"title\":\"title 1\",\"payload\":\"payload 1\"},{\"content_type\":\"text\",\"title\":\"title 2\",\"payload\":\"payload 2\",\"image_url\":\"http://example.org/test.jpg\"},{\"content_type\":\"location\"},{\"content_type\":\"location\",\"image_url\":\"http://example.org/test2.jpg\"},{\"content_type\":\"user_email\"},{\"content_type\":\"user_phone_number\"}],\"metadata\":\"metadata payload\"}",
"{\"text\":\"message text\",\"quick_replies\":[{\"content_type\":\"text\",\"title\":\"title 1\",\"payload\":\"payload 1\"},{\"content_type\":\"text\",\"title\":\"title 2\",\"payload\":\"payload 2\",\"image_url\":\"http://example.org/test.jpg\"},{\"content_type\":\"user_email\"},{\"content_type\":\"user_phone_number\"}],\"metadata\":\"metadata payload\"}",
messageJsonString);
}

Expand Down

0 comments on commit 76ca8b2

Please sign in to comment.