-
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
Set the background colour as an xcasset color set #896
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.
Unit Test Error
Failures:
1) prepare after plugin add Test 001 : should not overwrite plugin metadata added by "addPlugin"
Message:
Error: ENOENT: no such file or directory, open '/tmp/cordova-ios/tests/spec/unit/fixtures/dummyProj/platforms/ios/SampleApp/Images.xcassets/BackgroundColor.colorset/Contents.json'
Stack:
error properties: Object({ errno: -2, syscall: 'open', code: 'ENOENT', path: '/tmp/cordova-ios/tests/spec/unit/fixtures/dummyProj/platforms/ios/SampleApp/Images.xcassets/BackgroundColor.colorset/Contents.json' })
Error: ENOENT: no such file or directory, open '/tmp/cordova-ios/tests/spec/unit/fixtures/dummyProj/platforms/ios/SampleApp/Images.xcassets/BackgroundColor.colorset/Contents.json'
at Object.openSync (fs.js:461:3)
at Object.writeFileSync (fs.js:1387:35)
at updateBackgroundColor (/tmp/cordova-ios/bin/templates/scripts/cordova/lib/prepare.js:88:838)
at /tmp/cordova-ios/bin/templates/scripts/cordova/lib/prepare.js:22:326
Manual Testing
navigator.splashscreen.show()
has an unexpected behaviour.
It will fade into what I presume to be the SplashScreen but it only shows a white screen.
navigator.splashscreen.hide()
works as expected.
Fades back into the application.
Trying to take a snapshot of the view doesn't seem to result in the image actually being present in the snapshot, but we can just render the view itself from the storyboard file. However, we do need to make sure that we don't allow the view to grow in size, otherwise it will expand to the size of the image instead of remaining the size of the screen bounds.
Codecov Report
@@ Coverage Diff @@
## master #896 +/- ##
==========================================
+ Coverage 74.40% 74.48% +0.08%
==========================================
Files 13 13
Lines 1676 1713 +37
==========================================
+ Hits 1247 1276 +29
- Misses 429 437 +8
Continue to review full report at Codecov.
|
@erisu Thanks for catching that. I've fixed the missing test fixture, and also added a second commit to address the SplashScreen being blank. It should work as intended now 😁 |
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.
I re-reviewed & now it LGTM 👍
- ran
npm t
- ran
cordova platform add
- ran
cordova build
- ran simulator
- tested
navigator.splashscreen.show()
- tested
navigator.splashscreen.hide()
Platforms affected
iOS
Motivation and Context
Resolves #890 where the splashscreen UIView defaults to a transparent background if no
BackgroundColor
preference is specified in config.xml.Description
Add a named color set to Images.xcassets named
BackgroundColor
which defaults to the system background colour (respecting dark mode). On prepare, it will be set to the value specified in config.xml. Set the LaunchScreen Storyboard to use that as the background colour, and also ensure the WebView and SplashScreen UIView also use it as the background colour.This also hypothetically opens the door for people to (via
<resource-file>
tags) provide their own color set content with different values for different devices or different light/dark modes. Caveat that this is not in the realm of supported Cordova behaviour, and we do not make any guarantees about this working.If you're embedding the Cordova ViewController in another app or otherwise don't have a
BackgroundColor
color set in xcassets, it will fallback to white.Testing
BackgroundColor
preference parsing in prepare.spec.jsChecklist