-
Notifications
You must be signed in to change notification settings - Fork 984
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
(iOS) Dark mode splashscreen storyboard images #808
Conversation
Check for ~dark and ~light suffixes, and include in Contents.json.
@terreng Thank you for your first PR 🥇 This is a great feature. Please check the Travis log, if you can turn the tests green, review is much easier. Looks like some tests need to be changed and/or new tests are needed. |
Thank you for your PR. Just a couple notes, not exactly related to this PR, but when making PRs in general.
You can run local tests on your machine by running I also noticed that you made changes in your fork's master branch for your PR. I would recommend always creating a new branch for your PRs to keep your master branch clean. This isn't a problem right now, but could be later. If you add more commits to your master (maybe for a different PR) those commits will end up in this PR as well and that would not be very desirable. Regarding this PR specifically, I think everything looks good and I'm happy you considered making specifying the appearance optional, which also helps maintain backwards compatibility. As soon as the checks turn green I'll give my 👍 |
Alright, I've updated the failed tests and added three new ones. |
Codecov Report
@@ Coverage Diff @@
## master #808 +/- ##
==========================================
+ Coverage 74.2% 74.28% +0.08%
==========================================
Files 13 13
Lines 1849 1855 +6
==========================================
+ Hits 1372 1378 +6
Misses 477 477
Continue to review full report at Codecov.
|
I think documentation how to use this feature should be part of this PR, too. |
Documentation would have to change for cordova-plugin-splashscreen which isn't a part of this repo. |
Good point. I got confused that the code is part of cordova-ios and not the plugin. |
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.
Did some tests with this and it all looks to work as intended 👍
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.
Code Changes LGTM
This is my first pr so please don't burn me at the stake.
Platforms affected
iOS
Motivation and Context
I wanted to include a dark mode variant of my app's splash screen, but found that Cordova did not yet support this feature. It turns out that it only took a few lines of code, so I figured I'd share it here.
I found this related issue: apache/cordova-plugin-splashscreen#246. It turns out that no changes to the splashscreen plugin are necessary to make it happen.
Description
This enables dark mode storyboard images by allowing you to specify splash images based on appearance (dark or light). It checks for ~dark or ~light suffixes in splash images. If neither is found, they're used as the default. It then adds the variants to Contents.json, and the rest is handled by iOS. Example config.xml:
<splash src="res/screen/ios/Default@3x~iphone~comany.png" />
<splash src="res/screen/ios/Default@3x~iphone~comany~dark.png" />
This pr only adds support for iOS.
Testing
I've tested these changes on an iPhone and everything appears to work as intended. I've updated existing tests and added new ones as appropriate, and all tests pass.
Checklist
(platform)
if this change only applies to one platform (e.g.(android)
)Documentation would need to change over at https://github.com/apache/cordova-plugin-splashscreen/blob/master/README.md.
Thank you.