-
Notifications
You must be signed in to change notification settings - Fork 369
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
Feat/notification accent color dark mode #1370
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 6 of 6 files at r1.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @emawby and @Jeasmine)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one! As a recommendation, you might want to use the squash and merge option since we might not want some commits in the git history.
OneSignalSDK/unittest/src/test/java/com/test/onesignal/GenerateNotificationRunner.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @nan-li)
OneSignalSDK/onesignal/src/main/java/com/onesignal/GenerateNotification.java, line 942 at r1 (raw file):
return new BigInteger(defaultColor, 16); } } catch (Throwable t) {} // Can throw a parse error parse error.
Nit typo in the comment
OneSignalSDK/unittest/src/test/java/com/test/onesignal/GenerateNotificationRunner.java, line 2336 at r1 (raw file):
@Test @Config(shadows = { ShadowResources.class }) public void shouldUseManifestIconAccentColor() throws Exception {
Great job on these unit tests!
Modified files: - GenerateNotification.java - OneSignalPackagePrivateHelper.java Created file: - ShadowResources.java Added 4 unit tests for accent colors in GenerateNotificationRunner.java: - shouldUseDarkIconAccentColorInDarkMode_hasMetaData - shouldUseDayIconAccentColorInDayMode - shouldUseManifestIconAccentColor - shouldUseBgacAccentColor_hasMetaData Added resources to unittest app
c6a5c0b
to
3371d8d
Compare
I recall the build didn't fail when I first made the pull request. I then did squash my misc. commits into 1 commit, which I'm wondering if it is a problem. |
This test failed.
Re-running tests as it could be a flaky test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 4 of 6 files reviewed, 1 unresolved discussion (waiting on @Jeasmine and @jkasten2)
There was a problem hiding this 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 r2.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Jeasmine)
Issue
Notification accent color set in
strings.xml
invalues-night
folder were not being used when a device is in dark mode. The color was set in the manifest metadatacom.onesignal.NotificationAccentColor.DEFAULT
and did not seem to grab the night values.Solution
Get the resource string directly in
GenerateNotification.getAccentColor()
. Users will need to put<string name="onesignal_notification_accent_color">
in their resources instead of in the manifest. Documentation will need to be updated as well.Tests
The following tests were written in
GenerateNotificationRunner.java
:In order to test, I removed the
private
keyword from getAccentColor().This change is