@@ -1977,6 +1977,7 @@ private static boolean openURLFromNotification(Context context, JSONArray dataAr
1977
1977
int jsonArraySize = dataArray .length ();
1978
1978
1979
1979
boolean urlOpened = false ;
1980
+ boolean launchUrlSuppress = "true" .equals (OSUtils .getManifestMeta (context , "com.onesignal.suppressLaunchURLs" ));
1980
1981
1981
1982
for (int i = 0 ; i < jsonArraySize ; i ++) {
1982
1983
try {
@@ -1988,7 +1989,7 @@ private static boolean openURLFromNotification(Context context, JSONArray dataAr
1988
1989
1989
1990
if (customJSON .has ("u" )) {
1990
1991
String url = customJSON .optString ("u" , null );
1991
- if (url != null ) {
1992
+ if (url != null && ! launchUrlSuppress ) {
1992
1993
OSUtils .openURLInBrowser (url );
1993
1994
urlOpened = true ;
1994
1995
}
@@ -2149,15 +2150,13 @@ public void run() {
2149
2150
2150
2151
boolean urlOpened = false ;
2151
2152
boolean defaultOpenActionDisabled = "DISABLE" .equals (OSUtils .getManifestMeta (context , "com.onesignal.NotificationOpened.DEFAULT" ));
2152
- boolean launchUrlSuppress = "true" .equals (OSUtils .getManifestMeta (context , "com.onesignal.suppressLaunchURLs" ));
2153
2153
2154
- if (!defaultOpenActionDisabled && ! launchUrlSuppress )
2154
+ if (!defaultOpenActionDisabled )
2155
2155
urlOpened = openURLFromNotification (context , data );
2156
2156
2157
- logger .debug ("handleNotificationOpen from context: " + context + " with fromAlert: " + fromAlert + " urlOpened: " + urlOpened + " defaultOpenActionDisabled: " + defaultOpenActionDisabled
2158
- + " launchUrlSuppress: " + defaultOpenActionDisabled );
2157
+ logger .debug ("handleNotificationOpen from context: " + context + " with fromAlert: " + fromAlert + " urlOpened: " + urlOpened + " defaultOpenActionDisabled: " + defaultOpenActionDisabled );
2159
2158
// Check if the notification click should lead to a DIRECT session
2160
- if (shouldInitDirectSessionFromNotificationOpen (context , fromAlert , urlOpened , defaultOpenActionDisabled , launchUrlSuppress )) {
2159
+ if (shouldInitDirectSessionFromNotificationOpen (context , fromAlert , urlOpened , defaultOpenActionDisabled )) {
2161
2160
applicationOpenedByNotification (notificationId );
2162
2161
}
2163
2162
@@ -2194,11 +2193,10 @@ static boolean startOrResumeApp(Activity inContext) {
2194
2193
* 5. App is coming from the background
2195
2194
* 6. App open/resume intent exists
2196
2195
*/
2197
- private static boolean shouldInitDirectSessionFromNotificationOpen (Activity context , boolean fromAlert , boolean urlOpened , boolean defaultOpenActionDisabled , boolean launchUrlSuppress ) {
2196
+ private static boolean shouldInitDirectSessionFromNotificationOpen (Activity context , boolean fromAlert , boolean urlOpened , boolean defaultOpenActionDisabled ) {
2198
2197
return !fromAlert
2199
2198
&& !urlOpened
2200
2199
&& !defaultOpenActionDisabled
2201
- && !launchUrlSuppress
2202
2200
&& !inForeground
2203
2201
&& startOrResumeApp (context );
2204
2202
}
0 commit comments