Skip to content

Commit

Permalink
Added deprecation to features not supported by facebook for Europe. see
Browse files Browse the repository at this point in the history
  • Loading branch information
taidopurason committed Dec 9, 2020
1 parent 168d43f commit d48cbe2
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void start(@NonNull XatkitBot xatkitBot, @NonNull Configuration configura
throw new RestHandlerException(HttpStatus.SC_FORBIDDEN, "Mode is not 'subscribe'");
}
if (!token.equals(verifyToken)) {
throw new RestHandlerException(HttpStatus.SC_FORBIDDEN, "Token does not match verify token.");
throw new RestHandlerException(HttpStatus.SC_FORBIDDEN, "Received token does not match the verify token.");
}
return new StringEntity(challenge, StandardCharsets.UTF_8);
}));
Expand All @@ -73,6 +73,8 @@ public MessengerResponse markSeen(@NonNull StateContext context) {

/**
* Send an action. Actions: "mark_seen", "typing_on" or "typing_off".
* Sender actions "typing_on" and "typing_off" won't be supported by Facebook for European users
* since 16th of December 2020.
*
* @param context the current {@link StateContext}
* @param senderAction the {@link SenderAction}
Expand All @@ -93,6 +95,9 @@ public MessengerResponse sendAction(@NonNull StateContext context, @NonNull Send
* If a request is successfully sent returns a {@link MessengerResponse}.
* If an error response is received from Facebook throws a {@link MessengerException}
* If an unknown error is encountered throws a {@link XatkitException}
* <p>
* Media/attachment (audio, video, files) other than images
* won't be supported by Facebook for European users since 16th of December 2020.
*
* @param context the current {@link StateContext}
* @param file the {@link File}
Expand All @@ -108,6 +113,9 @@ public MessengerResponse uploadFile(@NonNull StateContext context, File file) {
* If a request is successfully sent returns a {@link MessengerResponse}.
* If an error response is received from Facebook throws a {@link MessengerException}
* If an unknown error is encountered throws a {@link XatkitException}
* <p>
* Media/attachment (audio, video, files) other than images
* won't be supported by Facebook for European users since 16th of December 2020.
*
* @param context the current {@link StateContext}
* @param attachmentId id of the attachment to be sent.
Expand All @@ -127,6 +135,9 @@ public MessengerResponse sendFile(@NonNull StateContext context, @NonNull String
* Sends {@link File}. If the {@link File} doesn't have an attachment_id, then uploads the file and adds an attachment_id to it.
* Otherwise assumes that the attachment_id of the file is correct and uses it to send the file.
* Calls {@link #sendFile(StateContext, File, boolean)}
* <p>
* Media/attachment (audio, video, files) other than images
* won't be supported by Facebook for European users since 16th of December 2020.
*
* @param context the current {@link StateContext}
* @param file the {@link File}
Expand All @@ -142,6 +153,9 @@ public MessengerResponse sendFile(@NonNull StateContext context, @NonNull File f
* Sends the {@link File}. If the {@link File} doesn't have an attachment_id, then uploads the file and adds an attachment_id to it.
* If reupload is true, always uploads the file, otherwise assumes that the attachment_id present in the {@link File} is correct.
* Calls {@link #sendFile(StateContext, String, Attachment.AttachmentType)}.
* <p>
* Media/attachment (audio, video, files) other than images
* won't be supported by Facebook for European users since 16th of December 2020.
*
* @param context the current {@link StateContext}
* @param file the {@link File}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,44 @@ public class MessengerUtils {

/**
* Create intent from reaction if true, otherwise use events. Value type: boolean
* Won't be supported by Facebook for European users since 16th of December 2020.
*/
@Deprecated
public static final String INTENT_FROM_REACTION = MESSENGER_CONTEXT + "intent_from_reaction";
/**
* If true use reaction text to create an intent otherwise uses emoji. Value type: boolean
* Requires INTENT_FROM_REACTION to be true to work.
* Won't be supported by Facebook for European users since 16th of December 2020.
*/
@Deprecated
public static final String USE_REACTION_TEXT = MESSENGER_CONTEXT + "use_reaction_text";


/**
* Whether to handle reactions or not. Value type: boolean
* Won't be supported by Facebook for European users since 16th of December 2020.
*/
@Deprecated
public static final String HANDLE_REACTIONS_KEY = MESSENGER_CONTEXT + "handle_reactions";
/**
* Whether to handle deliveries or not. Value type: boolean
* Won't be supported by Facebook for European users since 16th of December 2020.
*/
@Deprecated
public static final String HANDLE_DELIVERIES_KEY = MESSENGER_CONTEXT + "handle_deliveries";
/**
* Whether to handle reads or not. Value type: boolean
* Won't be supported by Facebook for European users since 16th of December 2020.
*/
@Deprecated
public static final String HANDLE_READ_KEY = MESSENGER_CONTEXT + "handle_read";

// EXPERIMENTAL FEATURES
/**
* If true automatically marks received messages as seen. Value type: boolean
*/
public static final String AUTO_MARK_SEEN_KEY = MESSENGER_CONTEXT + "auto_seen";

public static final String NATURALIZE_TEXT = MESSENGER_CONTEXT + "naturalize_text";

// INTENT PLATFORM DATA KEYS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@ public class Attachment {

// TODO: Support files and templates as well
public enum AttachmentType {
@Deprecated
@SerializedName("audio")
audio,
@Deprecated
@SerializedName("video")
video,
@SerializedName("image")
image,
@SerializedName("template")
template,
@Deprecated
@SerializedName("file")
file
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@

/**
* Actions that can be sent to Facebook.
* Sender actions "typing_on" and "typing_off" won't be supported by Facebook for European users
* since 16th of December 2020.
*
* @see Messaging
*/
public enum SenderAction {
@Deprecated
@SerializedName("typing_on")
typingOn,
@Deprecated
@SerializedName("typing_off")
typingOff,
@SerializedName("mark_seen")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* Used for creating templates with buttons.
* Only Android and iOS support by Facebook for European users since 16th of December 2020.
*/
@Deprecated
public class ButtonTemplatePayload extends TemplatePayload {
@Getter
private final String text; //UTF-8 encoded 640 character limit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Used for creating Generic Templates.
* Only Android and iOS support by Facebook for European users since 16th of December 2020.
*/
@Deprecated
public class GenericTemplatePayload extends TemplatePayload {
@SerializedName(value = "image_aspect_ratio")
@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* Used for creating Media Templates.
* Only Android and iOS support by Facebook for European users since 16th of December 2020.
*/
@Deprecated
public class MediaTemplatePayload extends TemplatePayload {
@Getter
private final List<MediaElement> elements; // Maximum size is 1
Expand Down

0 comments on commit d48cbe2

Please sign in to comment.