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
recover from invalid Operations missing onesignalId
* When uncaching an Operation that is not login-related, check for the existence of onesignalId.
* Note: The login-related Operations should still have onesignalId but they can be sent without it. It is also less likely for onesignalId to be null based on when these Operations are created.
* This is to remedy a rare case that an Operation could be missing the onesignalId, which would continuously cause crashes when the Operation is processed. The particular reported Operation is an UpdateSubscriptionOperation.
Copy file name to clipboardExpand all lines: OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/internal/operations/impl/OperationModelStore.kt
+31-2Lines changed: 31 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -38,8 +38,7 @@ internal class OperationModelStore(prefs: IPreferencesService) : ModelStore<Oper
38
38
returnnull
39
39
}
40
40
41
-
if (!jsonObject.has(Operation::name.name)) {
42
-
Logging.error("jsonObject must have '${Operation::name.name}' attribute")
41
+
if (!isValidOperation(jsonObject)) {
43
42
returnnull
44
43
}
45
44
@@ -69,4 +68,34 @@ internal class OperationModelStore(prefs: IPreferencesService) : ModelStore<Oper
69
68
70
69
return operation
71
70
}
71
+
72
+
/**
73
+
* Checks if a JSONObject is a valid Operation. Contains a check for onesignalId.
74
+
* This is a rare case that a cached Operation is missing the onesignalId,
75
+
* which would continuously cause crashes when the Operation is processed.
76
+
*
77
+
* @param jsonObject The [JSONObject] that represents an Operation
0 commit comments