Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove setRequiresUserConesnt call when there is no value in the manifest #1527

Merged
merged 2 commits into from
Feb 4, 2022

Conversation

shepherd-l
Copy link
Contributor

@shepherd-l shepherd-l commented Feb 1, 2022

Description

One Line Summary

Remove call to setRequiresUserConesnt when there is no value for PrivacyConsent in the AndroidManifest.

Details

Motivation

Removes error log reported in OneSignal/OneSignal-Android-SDK#1520.

Scope

Effects apps that initialize OneSignal with setRequiresUserConesnt(True) and have no value for PrivacyConsent in the AndroidManifest.

Testing

Manual testing

Tested by opening the app, app built with Android Studio 2021.1 with a fresh install of the OneSignal example app on a Pixel 6 with Android 12.

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
  • I have reviewed this PR myself, ensuring it meets each checklist item

This change is Reviewable

@shepherd-l shepherd-l requested a review from a team February 1, 2022 18:06
@jkasten2
Copy link
Member

jkasten2 commented Feb 1, 2022

Two tested failed:

1

com.test.onesignal.MainOneSignalClassRunner > shouldGetTagsFromServerOnFirstCallAndMergeLocalAndRemote FAILED
    junit.framework.ComparisonFailure: expected:<[value4]> but was:<[RemoteShouldNotOverwriteLocalPending]>
        at junit.framework.Assert.assertEquals(Assert.java:100)
        at junit.framework.Assert.assertEquals(Assert.java:107)
        at com.test.onesignal.MainOneSignalClassRunner.shouldGetTagsFromServerOnFirstCallAndMergeLocalAndRemote(MainOneSignalClassRunner.java:2716)

2

com.test.onesignal.GenerateNotificationRunner > testNotificationWillShowInForegroundHandler_workTimeLongerThanTimeout 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.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)
        Caused by:
        junit.framework.AssertionFailedError: expected:<1> but was:<0>
            at junit.framework.Assert.fail(Assert.java:57)
            at junit.framework.Assert.failNotEquals(Assert.java:329)
            at junit.framework.Assert.assertEquals(Assert.java:78)
            at junit.framework.Assert.assertEquals(Assert.java:234)
            at junit.framework.Assert.assertEquals(Assert.java:241)
            at com.test.onesignal.GenerateNotificationRunner.assertNotificationDbRecords(GenerateNotificationRunner.java:2522)
            at com.test.onesignal.GenerateNotificationRunner.testNotificationWillShowInForegroundHandler_workTimeLongerThanTimeout(GenerateNotificationRunner.java:2421)

These seem unrelated but rerunning test to confirm.

Copy link
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.

Small note on formatting, otherwise the code change itself looks good.
Also I kicked off another run of the tests, they failed due to what looks like flaky tests but did this to confirm that.

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @shepherd-l)


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

         // Read the current privacy consent setting from AndroidManifest.xml
         String requireSetting = bundle.getString("com.onesignal.PrivacyConsent");
         if (requireSetting!=null)

Formatting, should be a space before and after operators. Example:

 if (requireSetting != null)

Copy link
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.

PR looks good to me now! @shepherd-l you an press the "Merge pull request" button.

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


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

Previously, jkasten2 (Josh Kasten) wrote…

Formatting, should be a space before and after operators. Example:

 if (requireSetting != null)

Thanks for cleaning this up!

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