Skip to content

Commit

Permalink
fix(splash): Make splash launch delay timeout zero to speed up capaci…
Browse files Browse the repository at this point in the history
…tor boot
  • Loading branch information
mlynch committed May 5, 2020
1 parent 21c320c commit b29346b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion android/capacitor/src/main/java/com/getcapacitor/Splash.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public interface SplashListener {

public static final String CONFIG_KEY_PREFIX = "plugins.SplashScreen.";

public static final int DEFAULT_LAUNCH_SHOW_DURATION = 3000;
public static final int DEFAULT_LAUNCH_SHOW_DURATION = 0;
public static final int DEFAULT_FADE_IN_DURATION = 200;
public static final int DEFAULT_FADE_OUT_DURATION = 200;
public static final int DEFAULT_SHOW_DURATION = 3000;
Expand Down Expand Up @@ -168,6 +168,11 @@ private static void buildViews(Context c) {
public static void showOnLaunch(final BridgeActivity a) {
Integer duration = Config.getInt(CONFIG_KEY_PREFIX + "launchShowDuration", DEFAULT_LAUNCH_SHOW_DURATION);
Boolean autohide = Config.getBoolean(CONFIG_KEY_PREFIX + "launchAutoHide", DEFAULT_AUTO_HIDE);

if (duration == 0) {
return;
}

show(a, duration, 0, DEFAULT_FADE_OUT_DURATION, autohide, null, true);
}

Expand Down
6 changes: 5 additions & 1 deletion ios/Capacitor/Capacitor/Plugins/SplashScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class CAPSplashScreenPlugin: CAPPlugin {
var hideTask: Any?
var isVisible: Bool = false

let launchShowDuration = 3000
let launchShowDuration = 0
let launchAutoHide = true

let defaultFadeInDuration = 200
Expand Down Expand Up @@ -115,6 +115,10 @@ public class CAPSplashScreenPlugin: CAPPlugin {
let launchSpinnerStyleConfig = getConfigValue("iosSpinnerStyle") as? String ?? nil
let launchSpinnerColorConfig = getConfigValue("spinnerColor") as? String ?? nil

if launchShowDurationConfig == 0 {
return
}

let view = bridge.viewController.view
view?.addSubview(imageView)

Expand Down

0 comments on commit b29346b

Please sign in to comment.