Skip to content

Commit e280c0a

Browse files
committed
Fix testNotificationExtensionServiceOverridePropertiesWithSummaryApi17 test
* Test was failing due to SDK version check; this check was only applying to IAMs notifications. Move the check to inAppMessagePreviewHandled
1 parent 886977e commit e280c0a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

OneSignalSDK/onesignal/src/main/java/com/onesignal/NotificationBundleProcessor.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,6 @@ static int processJobForDisplay(OSNotificationController notificationController,
168168
}
169169

170170
private static boolean shouldDisplayNotification(OSNotificationGenerationJob notificationJob) {
171-
// Validate that the current Android device is Android 4.4 or higher
172-
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR2)
173-
return false;
174-
175-
// Otherwise, this is a normal notification and should be shown
176171
return notificationJob.hasExtender() || isStringNotEmpty(notificationJob.getJsonPayload().optString("alert"));
177172
}
178173

OneSignalSDK/onesignal/src/main/java/com/onesignal/OSInAppMessagePreviewHandler.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.onesignal;
22

33
import android.content.Context;
4+
import android.os.Build;
45
import android.os.Bundle;
56

67
import androidx.annotation.Nullable;
@@ -21,7 +22,7 @@ static boolean inAppMessagePreviewHandled(Context context, Bundle bundle) {
2122
// If app is in focus display the IAMs preview now
2223
if (OneSignal.isAppActive()) {
2324
OneSignal.getInAppMessageController().displayPreviewMessage(previewUUID);
24-
} else {
25+
} else if (shouldDisplayNotification()) {
2526
OSNotificationGenerationJob generationJob = new OSNotificationGenerationJob(context, pushPayloadJson);
2627
GenerateNotification.displayIAMPreviewNotification(generationJob);
2728
}
@@ -48,4 +49,9 @@ static String inAppPreviewPushUUID(JSONObject payload) {
4849
return additionalData.optString(IAM_PREVIEW_KEY);
4950
return null;
5051
}
52+
53+
private static boolean shouldDisplayNotification() {
54+
// Validate that the current Android device is Android 4.4 or higher
55+
return Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2;
56+
}
5157
}

0 commit comments

Comments
 (0)