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
Copy file name to clipboardExpand all lines: OneSignalSDK/onesignal/core/src/main/java/com/onesignal/user/internal/operations/impl/executors/LoginUserOperationExecutor.kt
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -66,6 +66,13 @@ internal class LoginUserOperationExecutor(
66
66
loginUserOp:LoginUserOperation,
67
67
operations:List<Operation>,
68
68
): 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 isCreateSubscriptionOperation|| it isTransferSubscriptionOperation }
73
+
if (!containsSubscriptionOperation && loginUserOp.externalId ==null) {
Copy file name to clipboardExpand all lines: OneSignalSDK/onesignal/core/src/test/java/com/onesignal/user/internal/operations/LoginUserOperationExecutorTests.kt
+66-6Lines changed: 66 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,16 @@ class LoginUserOperationExecutorTests : FunSpec({
39
39
val localSubscriptionId2 = "local-subscriptionId2"
40
40
val remoteSubscriptionId1 = "remote-subscriptionId1"
41
41
val remoteSubscriptionId2 = "remote-subscriptionId2"
42
+
val createSubscriptionOperation =
43
+
CreateSubscriptionOperation(
44
+
appId,
45
+
localOneSignalId,
46
+
"subscriptionId1",
47
+
SubscriptionType.PUSH,
48
+
true,
49
+
"pushToken1",
50
+
SubscriptionStatus.SUBSCRIBED,
51
+
)
42
52
43
53
test("login anonymous user successfully creates user") {
44
54
// Given
@@ -58,7 +68,7 @@ class LoginUserOperationExecutorTests : FunSpec({
58
68
val loginUserOperationExecutor =
59
69
LoginUserOperationExecutor(
60
70
mockIdentityOperationExecutor,
61
-
MockHelper.applicationService(),
71
+
AndroidMockHelper.applicationService(),
62
72
MockHelper.deviceService(),
63
73
mockUserBackendService,
64
74
mockIdentityModelStore,
@@ -67,7 +77,11 @@ class LoginUserOperationExecutorTests : FunSpec({
67
77
MockHelper.configModelStore(),
68
78
MockHelper.languageContext(),
69
79
)
70
-
val operations = listOf<Operation>(LoginUserOperation(appId, localOneSignalId, null, null))
0 commit comments