-
Notifications
You must be signed in to change notification settings - Fork 1k
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(splashscreen): Added backgroundColor to Splash Screen plugin. #1649
Conversation
@mlynch I have managed to add backgroundColor support for iOS. I renamed the configuration key to |
showSplash(showDuration: showDuration, fadeInDuration: fadeInDuration, fadeOutDuration: fadeOutDuration, autoHide: autoHide, completion: { | ||
call.success() | ||
}, isLaunchSplash: false) | ||
let backgroundColor = call.get("backgroundColor", String.self) |
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.
It should be like this:
let backgroundColor = call.get("backgroundColor", String.self) | |
let backgroundColor = getConfigValue("backgroundColor") as? String ?? nil |
call.get is to get the value from the plugin call, not from the capacitor.config.json
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.
OK, I have changed it according to your suggestion.
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.
Added a comment.
Also you should rebase with master as your other PR for the spinner created a lot of conflicts.
Something went wrong with the rebase, looks like you didn't pull latest changes. |
Maybe I forgot to include all of the files. I am doing that now. Hopefully that works. |
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.
Looks good to me
In cases where you use a different scale type, e.g. CENTER_INSIDE, it is possible that the splash image is smaller than the view itself. The missing parts around the splash image will then be transparent and showing the background of the app. You can now override this by specifying a background color (similar to the cordova splash screen plugin). The value is a simple
#RGB
or#ARGB
value.@mlynch Thank you for your feedback. I am not sure if this config key makes sense on iOS, as it handles splash screens differently. It is necessary on Android because you can change the scale type and it may happen that not the full screen is covered by the splash screen. In those cases, it requires the background color to cover those areas or they will be transparent and showing off the web app which looks ugly.
Basically, I am just following the practice from the Cordova splash screen plugin.