Skip to content

Commit 28e1e24

Browse files
committed
fix: Login request without subscription now returns FAIL_NORETRY
fix
1 parent 3ad85b2 commit 28e1e24

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/user/internal/operations/impl/executors/LoginUserOperationExecutor.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ internal class LoginUserOperationExecutor(
6666
loginUserOp: LoginUserOperation,
6767
operations: List<Operation>,
6868
): ExecutionResponse {
69+
// Handle a bad state that can happen in User Model 5.1.27 or earlier versions that old Login
70+
// request is not removed after processing if app is force-closed within the PostCreateDelay.
71+
// Anonymous Login being processed alone will surely be rejected, so we need to drop the request
72+
val containsSubscriptionOperation = operations.any { it is CreateSubscriptionOperation || it is TransferSubscriptionOperation }
73+
if (!containsSubscriptionOperation && loginUserOp.externalId == null) {
74+
return ExecutionResponse(ExecutionResult.FAIL_NORETRY)
75+
}
6976
if (loginUserOp.existingOnesignalId == null || loginUserOp.externalId == null) {
7077
// When there is no existing user to attempt to associate with the externalId provided, we go right to
7178
// createUser. If there is no externalId provided this is an insert, if there is this will be an

0 commit comments

Comments
 (0)