-
Notifications
You must be signed in to change notification settings - Fork 677
feat(splash-screen): implement launchFadeOutDuration support on iOS #2524
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,20 +9,23 @@ import Capacitor | |
| var config: SplashScreenConfig = SplashScreenConfig() | ||
| var hideTask: Any? | ||
| var isVisible: Bool = false | ||
| var isLaunchSplash: Bool = false | ||
|
|
||
| init(parentView: UIView, config: SplashScreenConfig) { | ||
| self.parentView = parentView | ||
| self.config = config | ||
| } | ||
|
|
||
| public func showOnLaunch() { | ||
| isLaunchSplash = true | ||
| buildViews() | ||
| if self.config.launchShowDuration == 0 { | ||
| return | ||
| } | ||
| var settings = SplashScreenSettings() | ||
| settings.showDuration = config.launchShowDuration | ||
| settings.fadeInDuration = config.launchFadeInDuration | ||
| settings.fadeOutDuration = config.launchFadeOutDuration | ||
| settings.autoHide = config.launchAutoHide | ||
| showSplash(settings: settings, completion: {}, isLaunchSplash: true) | ||
| } | ||
|
|
@@ -32,7 +35,9 @@ import Capacitor | |
| } | ||
|
|
||
| public func hide(settings: SplashScreenSettings) { | ||
| hideSplash(fadeOutDuration: settings.fadeOutDuration, isLaunchSplash: false) | ||
| let fadeOutDuration = self.isLaunchSplash ? config.launchFadeOutDuration : settings.fadeOutDuration | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain the rationale behind this logic? Didn't seem like the equivalent existed on Android but maybe I didn't see right.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On Android (using the Android 12 API), "am I closing the launch splash, so use
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok makes sense, thanks for the detailed explanation! |
||
| self.isLaunchSplash = false | ||
| hideSplash(fadeOutDuration: fadeOutDuration, isLaunchSplash: false) | ||
| } | ||
|
|
||
| private func showSplash(settings: SplashScreenSettings, completion: @escaping () -> Void, isLaunchSplash: Bool) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.