Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
## XX.XX.XX
* The feedback widgets now have transparent backgrounds for a cleaner look.
* Extended the notification button URL handler to allow custom handling of URLs when notification buttons are clicked in the background.
* Added a config method to disable server config in the initialization "disableSDKBehaviorSettings()".

* Deprecated "presentFeedbackWidget(widgetInfo, context, closeButtonText, devCallback)", replaced with "presentFeedbackWidget(widgetInfo, context, devCallback)" in the feedbacks.
* Added a config method to disable server config in the initialization "disableSDKBehaviorSettings()".

## 25.4.0
* ! Minor breaking change ! Removed Secure.ANDROID_ID usage in device id generation. The SDK now exclusively uses random UUIDs for device id generation.
Expand Down
1 change: 0 additions & 1 deletion sdk/src/main/java/ly/count/android/sdk/Countly.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ of this software and associated documentation files (the "Software"), to deal
public class Countly {

private final String DEFAULT_COUNTLY_SDK_VERSION_STRING = "25.4.1-RC2";

/**
* Used as request meta data on every request
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package ly.count.android.sdk.messaging;

import android.content.Context;

public interface CountlyNotificationButtonURLHandler {
/**
* Called when a notification button is clicked.
*
* @param url The URL associated with the button.
* @param context The context in which the button was clicked.
* @return true if the URL was handled, false otherwise.
*/
boolean onClick(String url);
boolean onClick(String url, Context context);
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class CountlyPush {
private static Application.ActivityLifecycleCallbacks callbacks = null;
private static Activity activity = null;

private static CountlyConfigPush countlyConfigPush = null;
protected static CountlyConfigPush countlyConfigPush = null;

static Integer notificationAccentColor = null;

Expand Down Expand Up @@ -554,7 +554,7 @@ public void onClick(DialogInterface dialog, int which) {
msg.recordAction(activity, 0);
dialog.dismiss();

if (countlyConfigPush.notificationButtonURLHandler != null && countlyConfigPush.notificationButtonURLHandler.onClick(msg.link().toString())) {
if (countlyConfigPush.notificationButtonURLHandler != null && countlyConfigPush.notificationButtonURLHandler.onClick(msg.link().toString(), activity)) {
Countly.sharedInstance().L.d("[CountlyPush, displayDialog] Link handled by custom URL handler, skipping default link opening.");
return;
}
Expand Down Expand Up @@ -601,9 +601,9 @@ private static void addButtons(final Context context, final AlertDialog.Builder
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();

boolean isPositiveButtonPressed = (which == DialogInterface.BUTTON_POSITIVE);
if (countlyConfigPush.notificationButtonURLHandler != null && countlyConfigPush.notificationButtonURLHandler.onClick(msg.buttons().get(isPositiveButtonPressed ? 1 : 0).link().toString())) {
if (countlyConfigPush.notificationButtonURLHandler != null && countlyConfigPush.notificationButtonURLHandler.onClick(msg.buttons().get(isPositiveButtonPressed ? 1 : 0).link().toString(), context)) {
Countly.sharedInstance().L.d("[CountlyPush, dialog button onClick] Link handled by custom URL handler, skipping default link opening.");
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ private void performPushAction(Intent activityIntent) {
try {
if (message.link() != null) {
Countly.sharedInstance().L.d("[CountlyPush, CountlyPushActivity] Starting activity with given link. Push body. [" + message.link() + "]");

if (CountlyPush.countlyConfigPush.notificationButtonURLHandler != null && CountlyPush.countlyConfigPush.notificationButtonURLHandler.onClick(message.link().toString(), context)) {
Countly.sharedInstance().L.d("[CountlyPush, CountlyPushActivity] Link handled by custom URL handler, skipping default link opening.");
return;
}

Intent i = new Intent(Intent.ACTION_VIEW, message.link());
i.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY |
Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET |
Expand All @@ -178,6 +184,11 @@ private void performPushAction(Intent activityIntent) {
}
} else {
try {
if (CountlyPush.countlyConfigPush.notificationButtonURLHandler != null && CountlyPush.countlyConfigPush.notificationButtonURLHandler.onClick(message.buttons().get(index - 1).link().toString(), context)) {
Countly.sharedInstance().L.d("[CountlyPush, CountlyPushActivity] Link handled by custom URL handler, skipping default link opening.");
return;
}

Countly.sharedInstance().L.d("[CountlyPush, CountlyPushActivity] Starting activity with given button link. [" + (index - 1) + "] [" + message.buttons().get(index - 1).link() + "]");
Intent i = new Intent(Intent.ACTION_VIEW, message.buttons().get(index - 1).link());
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Expand Down
Loading