You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix bug for generating notification's android notification ID
* Bug: The private setter was generating a random android notification ID but this private setter is never called. Setters are not triggered in initialization. This resulted in the android notification ID always being zero for every notification.
* The fix: Now we set the random ID in initialization, and make the notification property immutable (a val instead of var) as it is never re-set anyway.
Copy file name to clipboardExpand all lines: OneSignalSDK/onesignal/notifications/src/main/java/com/onesignal/notifications/internal/common/NotificationGenerationJob.kt
+7-15Lines changed: 7 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -7,25 +7,17 @@ import org.json.JSONObject
7
7
importjava.security.SecureRandom
8
8
9
9
classNotificationGenerationJob(
10
-
privatevar_notification:Notification,
10
+
inNotification:Notification,
11
11
varjsonPayload:JSONObject,
12
12
) {
13
-
var notification:Notification
14
-
get() =_notification
15
-
private set(value) {
16
-
// If there is no android ID on the notification coming in, create one either
17
-
// copying from the previous one or generating a new one.
18
-
if (value !=null&&!value!!.hasNotificationId()) {
19
-
val curNotification =_notification
20
-
if (curNotification !=null&& curNotification.hasNotificationId()) {
0 commit comments