Skip to content

Checking shouldLogUserPrivacyConsentErrorMessage for Outcomes#1409

Merged
emawby merged 1 commit intomainfrom
fix/crash_on_unique_outcomes
Aug 13, 2021
Merged

Checking shouldLogUserPrivacyConsentErrorMessage for Outcomes#1409
emawby merged 1 commit intomainfrom
fix/crash_on_unique_outcomes

Conversation

@emawby
Copy link
Copy Markdown
Contributor

@emawby emawby commented Aug 12, 2021

Currently OneSignal crashes if an App sends outcomes or unique outcomes when requires privacy consent is true.
Now we will log an error message and return instead.


This change is Reviewable

@emawby emawby requested review from Jeasmine, jkasten2 and nan-li August 12, 2021 16:28
Copy link
Copy Markdown
Member

@jkasten2 jkasten2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @emawby, @Jeasmine, and @nan-li)


OneSignalSDK/onesignal/src/main/java/com/onesignal/OneSignal.java, line 3293 at r1 (raw file):

      }

      if (shouldLogUserPrivacyConsentErrorMessageForMethodName("sendOutcome()")) {

Failing test that looks related to this changes:
https://app.travis-ci.com/github/OneSignal/OneSignal-Android-SDK/builds/235207484#L2091-L2098

We might have to move this after the taskRemoteController below.

@emawby emawby force-pushed the fix/crash_on_unique_outcomes branch from a2eae09 to e42b17e Compare August 12, 2021 20:08
@emawby emawby force-pushed the fix/crash_on_unique_outcomes branch from e42b17e to f72f6b1 Compare August 12, 2021 20:10
Copy link
Copy Markdown
Contributor Author

@emawby emawby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 of 2 files reviewed, 1 unresolved discussion (waiting on @Jeasmine, @jkasten2, and @nan-li)


OneSignalSDK/onesignal/src/main/java/com/onesignal/OneSignal.java, line 3293 at r1 (raw file):

Previously, jkasten2 (Josh Kasten) wrote…

Failing test that looks related to this changes:
https://app.travis-ci.com/github/OneSignal/OneSignal-Android-SDK/builds/235207484#L2091-L2098

We might have to move this after the taskRemoteController below.

moved it below the queue task block!

@emawby emawby requested a review from jkasten2 August 12, 2021 20:11
Copy link
Copy Markdown
Member

@jkasten2 jkasten2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Jeasmine and @nan-li)

@jkasten2
Copy link
Copy Markdown
Member

Tests failed but seems we have a flaky unrelated test:

com.test.onesignal.GenerateNotificationRunner > shouldContainPayloadWhenOldSummaryNotificationIsOpened FAILED
    java.lang.Exception: Main looper has queued unexecuted runnables. This might be the cause of the test failure. You might need a shadowOf(getMainLooper()).idle() call.
        at org.robolectric.android.internal.AndroidTestEnvironment.checkStateAfterTestFailure(AndroidTestEnvironment.java:502)
        at org.robolectric.RobolectricTestRunner$HelperTestRunner$1.evaluate(RobolectricTestRunner.java:581)
        at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$0(SandboxTestRunner.java:263)
        at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:89)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
        Caused by:
        junit.framework.ComparisonFailure: expected:<UUID[2]> but was:<UUID[1]>
            at junit.framework.Assert.assertEquals(Assert.java:100)
            at junit.framework.Assert.assertEquals(Assert.java:107)
            at com.test.onesignal.GenerateNotificationRunner.shouldContainPayloadWhenOldSummaryNotificationIsOpened(GenerateNotificationRunner.java:346)

@emawby emawby merged commit 5f48f07 into main Aug 13, 2021
@emawby emawby deleted the fix/crash_on_unique_outcomes branch August 13, 2021 17:51
@nan-li nan-li mentioned this pull request Aug 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants