@capacitor/splash-screen 4.0.0-beta.2 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [4.0.0](https://github.com/ionic-team/capacitor-plugins/compare/4.0.0-beta.2...4.0.0) (2022-07-27)
7
+
8
+
9
+ ### Features
10
+
11
+ * **splash-screen:** Use Android 12 Splash Screen API ([#1011](https://github.com/ionic-team/capacitor-plugins/issues/1011)) ([79185ad](https://github.com/ionic-team/capacitor-plugins/commit/79185adf76bc4ff4bae1be5ec5b5881cfbe748b1))
12
+
13
+
14
+
15
+
16
+
6
17
  # [4.0.0-beta.2](https://github.com/ionic-team/capacitor-plugins/compare/4.0.0-beta.0...4.0.0-beta.2) (2022-07-08)
7
18
 
8
19
  **Note:** Version bump only for package @capacitor/splash-screen
package/README.md CHANGED
@@ -19,13 +19,13 @@ await SplashScreen.hide();
19
19
 
20
20
  // Show the splash for an indefinite amount of time:
21
21
  await SplashScreen.show({
22
- autoHide: false
22
+ autoHide: false,
23
23
  });
24
24
 
25
25
  // Show the splash for two seconds and then automatically hide it:
26
26
  await SplashScreen.show({
27
27
  showDuration: 2000,
28
- autoHide: true
28
+ autoHide: true,
29
29
  });
30
30
  ```
31
31
 
@@ -37,7 +37,6 @@ If you want to be sure the splash screen never disappears before your app is rea
37
37
 
38
38
  If, instead, you want to show the splash screen for a fixed amount of time, set `launchShowDuration` in your [Capacitor configuration file](https://capacitorjs.com/docs/config).
39
39
 
40
-
41
40
  ## Background Color
42
41
 
43
42
  In certain conditions, especially if the splash screen does not fully cover the device screen, it might happen that the app screen is visible around the corners (due to transparency). Instead of showing a transparent color, you can set a `backgroundColor` to cover those areas.
@@ -51,6 +50,7 @@ If you want to show a spinner on top of the splash screen, set `showSpinner` to
51
50
  You can customize the appearance of the spinner with the following configuration.
52
51
 
53
52
  For Android, `androidSpinnerStyle` has the following options:
53
+
54
54
  - `horizontal`
55
55
  - `small`
56
56
  - `large` (default)
@@ -59,6 +59,7 @@ For Android, `androidSpinnerStyle` has the following options:
59
59
  - `largeInverse`
60
60
 
61
61
  For iOS, `iosSpinnerStyle` has the following options:
62
+
62
63
  - `large` (default)
63
64
  - `small`
64
65
 
@@ -71,21 +72,21 @@ To set the color of the spinner use `spinnerColor`, values are either `#RRGGBB`
71
72
 
72
73
  These config values are available:
73
74
 
74
- | Prop | Type | Description | Default | Since |
75
- | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------- | ----- |
76
- | **`launchShowDuration`** | <code>number</code> | How long to show the launch splash screen when autoHide is enabled (in ms) | <code>500</code> | 1.0.0 |
77
- | **`launchAutoHide`** | <code>boolean</code> | Whether to auto hide the splash after launchShowDuration. | <code>true</code> | 1.0.0 |
78
- | **`backgroundColor`** | <code>string</code> | Color of the background of the Splash Screen in hex format, #RRGGBB or #RRGGBBAA. Doesn't work if `useDialog` is true. | | 1.0.0 |
79
- | **`androidSplashResourceName`** | <code>string</code> | Name of the resource to be used as Splash Screen. Only available on Android. | <code>splash</code> | 1.0.0 |
80
- | **`androidScaleType`** | <code>'CENTER' \| 'CENTER_CROP' \| 'CENTER_INSIDE' \| 'FIT_CENTER' \| 'FIT_END' \| 'FIT_START' \| 'FIT_XY' \| 'MATRIX'</code> | The [ImageView.ScaleType](https://developer.android.com/reference/android/widget/ImageView.ScaleType) used to scale the Splash Screen image. Doesn't work if `useDialog` is true. Only available on Android. | <code>FIT_XY</code> | 1.0.0 |
81
- | **`showSpinner`** | <code>boolean</code> | Show a loading spinner on the Splash Screen. Doesn't work if `useDialog` is true. | | 1.0.0 |
82
- | **`androidSpinnerStyle`** | <code>'horizontal' \| 'small' \| 'large' \| 'inverse' \| 'smallInverse' \| 'largeInverse'</code> | Style of the Android spinner. Doesn't work if `useDialog` is true. | <code>large</code> | 1.0.0 |
83
- | **`iosSpinnerStyle`** | <code>'small' \| 'large'</code> | Style of the iOS spinner. Doesn't work if `useDialog` is true. Only available on iOS. | <code>large</code> | 1.0.0 |
84
- | **`spinnerColor`** | <code>string</code> | Color of the spinner in hex format, #RRGGBB or #RRGGBBAA. Doesn't work if `useDialog` is true. | | 1.0.0 |
85
- | **`splashFullScreen`** | <code>boolean</code> | Hide the status bar on the Splash Screen. Only available on Android. | | 1.0.0 |
86
- | **`splashImmersive`** | <code>boolean</code> | Hide the status bar and the software navigation buttons on the Splash Screen. Only available on Android. | | 1.0.0 |
87
- | **`layoutName`** | <code>string</code> | If `useDialog` is set to true, configure the Dialog layout. If `useDialog` is not set or false, use a layout instead of the ImageView. Only available on Android. | | 1.1.0 |
88
- | **`useDialog`** | <code>boolean</code> | Use a Dialog instead of an ImageView. If `layoutName` is not configured, it will use a layout that uses the splash image as background. Only available on Android. | | 1.1.0 |
75
+ | Prop | Type | Description | Default | Since |
76
+ | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ----- |
77
+ | **`launchShowDuration`** | <code>number</code> | How long to show the launch splash screen when autoHide is enabled (in ms) | <code>500</code> | 1.0.0 |
78
+ | **`launchAutoHide`** | <code>boolean</code> | Whether to auto hide the splash after launchShowDuration. | <code>true</code> | 1.0.0 |
79
+ | **`backgroundColor`** | <code>string</code> | Color of the background of the Splash Screen in hex format, #RRGGBB or #RRGGBBAA. Doesn't work if `useDialog` is true or on launch when using the Android 12 API. | | 1.0.0 |
80
+ | **`androidSplashResourceName`** | <code>string</code> | Name of the resource to be used as Splash Screen. Doesn't work on launch when using the Android 12 API. Only available on Android. | <code>splash</code> | 1.0.0 |
81
+ | **`androidScaleType`** | <code>'CENTER' \| 'CENTER_CROP' \| 'CENTER_INSIDE' \| 'FIT_CENTER' \| 'FIT_END' \| 'FIT_START' \| 'FIT_XY' \| 'MATRIX'</code> | The [ImageView.ScaleType](https://developer.android.com/reference/android/widget/ImageView.ScaleType) used to scale the Splash Screen image. Doesn't work if `useDialog` is true or on launch when using the Android 12 API. Only available on Android. | <code>FIT_XY</code> | 1.0.0 |
82
+ | **`showSpinner`** | <code>boolean</code> | Show a loading spinner on the Splash Screen. Doesn't work if `useDialog` is true on launch when using the Android 12 API. | | 1.0.0 |
83
+ | **`androidSpinnerStyle`** | <code>'horizontal' \| 'small' \| 'large' \| 'inverse' \| 'smallInverse' \| 'largeInverse'</code> | Style of the Android spinner. Doesn't work if `useDialog` is true on launch when using the Android 12 API. | <code>large</code> | 1.0.0 |
84
+ | **`iosSpinnerStyle`** | <code>'small' \| 'large'</code> | Style of the iOS spinner. Doesn't work if `useDialog` is true. Only available on iOS. | <code>large</code> | 1.0.0 |
85
+ | **`spinnerColor`** | <code>string</code> | Color of the spinner in hex format, #RRGGBB or #RRGGBBAA. Doesn't work if `useDialog` is true on launch when using the Android 12 API. | | 1.0.0 |
86
+ | **`splashFullScreen`** | <code>boolean</code> | Hide the status bar on the Splash Screen. Doesn't work on launch when using the Android 12 API. Only available on Android. | | 1.0.0 |
87
+ | **`splashImmersive`** | <code>boolean</code> | Hide the status bar and the software navigation buttons on the Splash Screen. Doesn't work on launch when using the Android 12 API. Only available on Android. | | 1.0.0 |
88
+ | **`layoutName`** | <code>string</code> | If `useDialog` is set to true, configure the Dialog layout. If `useDialog` is not set or false, use a layout instead of the ImageView. Doesn't work on launch when using the Android 12 API. Only available on Android. | | 1.1.0 |
89
+ | **`useDialog`** | <code>boolean</code> | Use a Dialog instead of an ImageView. If `layoutName` is not configured, it will use a layout that uses the splash image as background. Doesn't work on launch when using the Android 12 API. Only available on Android. | | 1.1.0 |
89
90
 
90
91
  ### Examples
91
92
 
@@ -155,6 +156,36 @@ To use splash screen images named something other than `splash.png`, set `androi
155
156
  </style>
156
157
  ```
157
158
 
159
+ ### Android 12 Splash Screen API
160
+
161
+ _**This only affects the launch splash screen and is not used when utilizing the programmatic `show()` method.**_
162
+
163
+ To enable the new recommended **[Android 12 Splash Screen API](https://developer.android.com/guide/topics/ui/splash-screen)** in SDK Versions 30 or below:
164
+
165
+ _This is enabled by default and required for SDK version 31+._
166
+
167
+ - Add `$coreSplashScreenVersion` to the `variables.gradle` file.
168
+ _See Variables Section for more information_
169
+
170
+ - Add `implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"` in the dependencies section of `/android/app/build.gradle`.
171
+
172
+ - In `android/app/src/main/res/values/styles.xml`, edit the theme `parent` attribute on the Applications's MainActivity Theme to `Theme.SplashScreen` and add desired options to the theme.
173
+
174
+ ```xml
175
+ <style name="AppTheme.NoActionBarLaunch" parent="Theme.SplashScreen">
176
+ <item name="android:background">@drawable/splash</item>
177
+ </style>
178
+ ```
179
+
180
+ **NOTE**: Some issues may exist on SDK >= 31 when using the new API for the splash screen, which pertain to the splash screen only showing when launched from the launcher icon.
181
+ **[Google Issue Tracker](https://issuetracker.google.com/issues/205021357)**
182
+
183
+ ## Variables
184
+
185
+ This plugin will use the following project variables (defined in your app's `variables.gradle` file):
186
+
187
+ `$coreSplashScreenVersion` version of `androidx.core:core-splashscreen:$coreSplashScreenVersion` (default: `1.0.0-rc01`)
188
+
158
189
  ## Example Guides
159
190
 
160
191
  [Adding Your Own Icons and Splash Screen Images &#8250;](https://www.joshmorony.com/adding-icons-splash-screens-launch-images-to-capacitor-projects/)
@@ -3,6 +3,7 @@ ext {
3
3
  androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
4
4
  androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
5
5
  androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
6
+ coreSplashScreenVersion = project.hasProperty('coreSplashScreenVersion') ? rootProject.ext.coreSplashScreenVersion : '1.0.0-rc01'
6
7
  }
7
8
 
8
9
  buildscript {
@@ -54,4 +55,5 @@ dependencies {
54
55
  testImplementation "junit:junit:$junitVersion"
55
56
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
56
57
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
58
+ implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
57
59
  }
@@ -1,6 +1,8 @@
1
1
  package com.capacitorjs.plugins.splashscreen;
2
2
 
3
3
  import android.animation.Animator;
4
+ import android.animation.AnimatorListenerAdapter;
5
+ import android.animation.ObjectAnimator;
4
6
  import android.app.Activity;
5
7
  import android.app.Dialog;
6
8
  import android.content.Context;
@@ -11,7 +13,13 @@ import android.graphics.drawable.Animatable;
11
13
  import android.graphics.drawable.Drawable;
12
14
  import android.graphics.drawable.LayerDrawable;
13
15
  import android.os.Handler;
14
- import android.view.*;
16
+ import android.view.Gravity;
17
+ import android.view.LayoutInflater;
18
+ import android.view.View;
19
+ import android.view.ViewGroup;
20
+ import android.view.ViewTreeObserver;
21
+ import android.view.ViewTreeObserver.OnPreDrawListener;
22
+ import android.view.WindowManager;
15
23
  import android.view.animation.LinearInterpolator;
16
24
  import android.widget.FrameLayout;
17
25
  import android.widget.ImageView;
@@ -32,7 +40,9 @@ public class SplashScreen {
32
40
  private boolean isVisible = false;
33
41
  private boolean isHiding = false;
34
42
  private Context context;
43
+ private View content;
35
44
  private SplashScreenConfig config;
45
+ private OnPreDrawListener onPreDrawListener;
36
46
 
37
47
  SplashScreen(Context context, SplashScreenConfig config) {
38
48
  this.context = context;
@@ -51,6 +61,17 @@ public class SplashScreen {
51
61
  SplashScreenSettings settings = new SplashScreenSettings();
52
62
  settings.setShowDuration(config.getLaunchShowDuration());
53
63
  settings.setAutoHide(config.isLaunchAutoHide());
64
+
65
+ // Method can fail if styles are incorrectly set...
66
+ // If it fails, log error & fallback to old method
67
+ try {
68
+ showWithAndroid12API(activity, settings);
69
+ return;
70
+ } catch (Exception e) {
71
+ Logger.warn("Android 12 Splash API failed... using previous method.");
72
+ this.onPreDrawListener = null;
73
+ }
74
+
54
75
  settings.setFadeInDuration(config.getLaunchFadeInDuration());
55
76
  if (config.isUsingDialog()) {
56
77
  showDialog(activity, settings, null, true);
@@ -59,6 +80,82 @@ public class SplashScreen {
59
80
  }
60
81
  }
61
82
 
83
+ /**
84
+ * Show the Splash Screen using the Android 12 API (31+)
85
+ * Uses Compat Library for backwards compatibility
86
+ *
87
+ * @param activity
88
+ * @param settings Settings used to show the Splash Screen
89
+ */
90
+ private void showWithAndroid12API(final AppCompatActivity activity, final SplashScreenSettings settings) {
91
+ if (activity == null || activity.isFinishing()) return;
92
+
93
+ activity.runOnUiThread(
94
+ () -> {
95
+ androidx.core.splashscreen.SplashScreen windowSplashScreen = androidx.core.splashscreen.SplashScreen.installSplashScreen(
96
+ activity
97
+ );
98
+ windowSplashScreen.setKeepOnScreenCondition(() -> isVisible || isHiding);
99
+
100
+ // Set Fade Out Animation
101
+ windowSplashScreen.setOnExitAnimationListener(
102
+ windowSplashScreenView -> {
103
+ final ObjectAnimator fadeAnimator = ObjectAnimator.ofFloat(windowSplashScreenView.getView(), View.ALPHA, 1f, 0f);
104
+ fadeAnimator.setInterpolator(new LinearInterpolator());
105
+ fadeAnimator.setDuration(settings.getFadeOutDuration());
106
+
107
+ fadeAnimator.addListener(
108
+ new AnimatorListenerAdapter() {
109
+ @Override
110
+ public void onAnimationEnd(Animator animation) {
111
+ isHiding = false;
112
+ windowSplashScreenView.remove();
113
+ }
114
+ }
115
+ );
116
+
117
+ fadeAnimator.start();
118
+
119
+ isHiding = true;
120
+ isVisible = false;
121
+ }
122
+ );
123
+
124
+ // Set Pre Draw Listener & Delay Drawing Until Duration Elapses
125
+ content = activity.findViewById(android.R.id.content);
126
+
127
+ this.onPreDrawListener =
128
+ new ViewTreeObserver.OnPreDrawListener() {
129
+ @Override
130
+ public boolean onPreDraw() {
131
+ // Start Timer On First Run
132
+ if (!isVisible && !isHiding) {
133
+ isVisible = true;
134
+
135
+ new Handler(context.getMainLooper())
136
+ .postDelayed(
137
+ () -> {
138
+ // Splash screen is done... start drawing content.
139
+ if (settings.isAutoHide()) {
140
+ isVisible = false;
141
+ onPreDrawListener = null;
142
+ content.getViewTreeObserver().removeOnPreDrawListener(this);
143
+ }
144
+ },
145
+ settings.getShowDuration()
146
+ );
147
+ }
148
+
149
+ // Not ready to dismiss splash screen
150
+ return false;
151
+ }
152
+ };
153
+
154
+ content.getViewTreeObserver().addOnPreDrawListener(this.onPreDrawListener);
155
+ }
156
+ );
157
+ }
158
+
62
159
  /**
63
160
  * Show the Splash Screen
64
161
  *
@@ -400,7 +497,21 @@ public class SplashScreen {
400
497
  );
401
498
  }
402
499
 
403
- if (isHiding || splashImage == null || splashImage.getParent() == null) {
500
+ if (isHiding) {
501
+ return;
502
+ }
503
+
504
+ // Hide with Android 12 API
505
+ if (null != this.onPreDrawListener) {
506
+ this.isVisible = false;
507
+ if (null != content) {
508
+ content.getViewTreeObserver().removeOnPreDrawListener(this.onPreDrawListener);
509
+ }
510
+ this.onPreDrawListener = null;
511
+ return;
512
+ }
513
+
514
+ if (splashImage == null || splashImage.getParent() == null) {
404
515
  return;
405
516
  }
406
517
 
@@ -462,6 +573,16 @@ public class SplashScreen {
462
573
  return;
463
574
  }
464
575
 
576
+ // Hide with Android 12 API
577
+ if (null != this.onPreDrawListener) {
578
+ this.isVisible = false;
579
+ if (null != content) {
580
+ content.getViewTreeObserver().removeOnPreDrawListener(this.onPreDrawListener);
581
+ }
582
+ this.onPreDrawListener = null;
583
+ return;
584
+ }
585
+
465
586
  isHiding = true;
466
587
 
467
588
  activity.runOnUiThread(
@@ -471,6 +592,7 @@ public class SplashScreen {
471
592
  dialog.dismiss();
472
593
  }
473
594
  dialog = null;
595
+ isHiding = false;
474
596
  isVisible = false;
475
597
  }
476
598
  }
package/dist/docs.json CHANGED
@@ -209,7 +209,7 @@
209
209
  "name": "example"
210
210
  }
211
211
  ],
212
- "docs": "Color of the background of the Splash Screen in hex format, #RRGGBB or #RRGGBBAA.\nDoesn't work if `useDialog` is true.",
212
+ "docs": "Color of the background of the Splash Screen in hex format, #RRGGBB or #RRGGBBAA.\nDoesn't work if `useDialog` is true or on launch when using the Android 12 API.",
213
213
  "complexTypes": [],
214
214
  "type": "string | undefined"
215
215
  },
@@ -229,7 +229,7 @@
229
229
  "name": "example"
230
230
  }
231
231
  ],
232
- "docs": "Name of the resource to be used as Splash Screen.\n\nOnly available on Android.",
232
+ "docs": "Name of the resource to be used as Splash Screen.\n\nDoesn't work on launch when using the Android 12 API.\n\nOnly available on Android.",
233
233
  "complexTypes": [],
234
234
  "type": "string | undefined"
235
235
  },
@@ -249,7 +249,7 @@
249
249
  "name": "example"
250
250
  }
251
251
  ],
252
- "docs": "The [ImageView.ScaleType](https://developer.android.com/reference/android/widget/ImageView.ScaleType) used to scale\nthe Splash Screen image.\nDoesn't work if `useDialog` is true.\n\nOnly available on Android.",
252
+ "docs": "The [ImageView.ScaleType](https://developer.android.com/reference/android/widget/ImageView.ScaleType) used to scale\nthe Splash Screen image.\nDoesn't work if `useDialog` is true or on launch when using the Android 12 API.\n\nOnly available on Android.",
253
253
  "complexTypes": [],
254
254
  "type": "'CENTER' | 'CENTER_CROP' | 'CENTER_INSIDE' | 'FIT_CENTER' | 'FIT_END' | 'FIT_START' | 'FIT_XY' | 'MATRIX' | undefined"
255
255
  },
@@ -265,7 +265,7 @@
265
265
  "name": "example"
266
266
  }
267
267
  ],
268
- "docs": "Show a loading spinner on the Splash Screen.\nDoesn't work if `useDialog` is true.",
268
+ "docs": "Show a loading spinner on the Splash Screen.\nDoesn't work if `useDialog` is true on launch when using the Android 12 API.",
269
269
  "complexTypes": [],
270
270
  "type": "boolean | undefined"
271
271
  },
@@ -285,7 +285,7 @@
285
285
  "name": "example"
286
286
  }
287
287
  ],
288
- "docs": "Style of the Android spinner.\nDoesn't work if `useDialog` is true.",
288
+ "docs": "Style of the Android spinner.\nDoesn't work if `useDialog` is true on launch when using the Android 12 API.",
289
289
  "complexTypes": [],
290
290
  "type": "'horizontal' | 'small' | 'large' | 'inverse' | 'smallInverse' | 'largeInverse' | undefined"
291
291
  },
@@ -321,7 +321,7 @@
321
321
  "name": "example"
322
322
  }
323
323
  ],
324
- "docs": "Color of the spinner in hex format, #RRGGBB or #RRGGBBAA.\nDoesn't work if `useDialog` is true.",
324
+ "docs": "Color of the spinner in hex format, #RRGGBB or #RRGGBBAA.\nDoesn't work if `useDialog` is true on launch when using the Android 12 API.",
325
325
  "complexTypes": [],
326
326
  "type": "string | undefined"
327
327
  },
@@ -337,7 +337,7 @@
337
337
  "name": "example"
338
338
  }
339
339
  ],
340
- "docs": "Hide the status bar on the Splash Screen.\n\nOnly available on Android.",
340
+ "docs": "Hide the status bar on the Splash Screen.\n\nDoesn't work on launch when using the Android 12 API.\n\nOnly available on Android.",
341
341
  "complexTypes": [],
342
342
  "type": "boolean | undefined"
343
343
  },
@@ -353,7 +353,7 @@
353
353
  "name": "example"
354
354
  }
355
355
  ],
356
- "docs": "Hide the status bar and the software navigation buttons on the Splash Screen.\n\nOnly available on Android.",
356
+ "docs": "Hide the status bar and the software navigation buttons on the Splash Screen.\n\nDoesn't work on launch when using the Android 12 API.\n\nOnly available on Android.",
357
357
  "complexTypes": [],
358
358
  "type": "boolean | undefined"
359
359
  },
@@ -369,7 +369,7 @@
369
369
  "name": "example"
370
370
  }
371
371
  ],
372
- "docs": "If `useDialog` is set to true, configure the Dialog layout.\nIf `useDialog` is not set or false, use a layout instead of the ImageView.\n\nOnly available on Android.",
372
+ "docs": "If `useDialog` is set to true, configure the Dialog layout.\nIf `useDialog` is not set or false, use a layout instead of the ImageView.\n\nDoesn't work on launch when using the Android 12 API.\n\nOnly available on Android.",
373
373
  "complexTypes": [],
374
374
  "type": "string | undefined"
375
375
  },
@@ -385,7 +385,7 @@
385
385
  "name": "example"
386
386
  }
387
387
  ],
388
- "docs": "Use a Dialog instead of an ImageView.\nIf `layoutName` is not configured, it will use\na layout that uses the splash image as background.\n\nOnly available on Android.",
388
+ "docs": "Use a Dialog instead of an ImageView.\nIf `layoutName` is not configured, it will use\na layout that uses the splash image as background.\n\nDoesn't work on launch when using the Android 12 API.\n\nOnly available on Android.",
389
389
  "complexTypes": [],
390
390
  "type": "boolean | undefined"
391
391
  }
@@ -22,7 +22,7 @@ declare module '@capacitor/cli' {
22
22
  launchAutoHide?: boolean;
23
23
  /**
24
24
  * Color of the background of the Splash Screen in hex format, #RRGGBB or #RRGGBBAA.
25
- * Doesn't work if `useDialog` is true.
25
+ * Doesn't work if `useDialog` is true or on launch when using the Android 12 API.
26
26
  *
27
27
  * @since 1.0.0
28
28
  * @example "#ffffffff"
@@ -31,6 +31,8 @@ declare module '@capacitor/cli' {
31
31
  /**
32
32
  * Name of the resource to be used as Splash Screen.
33
33
  *
34
+ * Doesn't work on launch when using the Android 12 API.
35
+ *
34
36
  * Only available on Android.
35
37
  *
36
38
  * @since 1.0.0
@@ -41,7 +43,7 @@ declare module '@capacitor/cli' {
41
43
  /**
42
44
  * The [ImageView.ScaleType](https://developer.android.com/reference/android/widget/ImageView.ScaleType) used to scale
43
45
  * the Splash Screen image.
44
- * Doesn't work if `useDialog` is true.
46
+ * Doesn't work if `useDialog` is true or on launch when using the Android 12 API.
45
47
  *
46
48
  * Only available on Android.
47
49
  *
@@ -52,7 +54,7 @@ declare module '@capacitor/cli' {
52
54
  androidScaleType?: 'CENTER' | 'CENTER_CROP' | 'CENTER_INSIDE' | 'FIT_CENTER' | 'FIT_END' | 'FIT_START' | 'FIT_XY' | 'MATRIX';
53
55
  /**
54
56
  * Show a loading spinner on the Splash Screen.
55
- * Doesn't work if `useDialog` is true.
57
+ * Doesn't work if `useDialog` is true on launch when using the Android 12 API.
56
58
  *
57
59
  * @since 1.0.0
58
60
  * @example true
@@ -60,7 +62,7 @@ declare module '@capacitor/cli' {
60
62
  showSpinner?: boolean;
61
63
  /**
62
64
  * Style of the Android spinner.
63
- * Doesn't work if `useDialog` is true.
65
+ * Doesn't work if `useDialog` is true on launch when using the Android 12 API.
64
66
  *
65
67
  * @since 1.0.0
66
68
  * @default large
@@ -80,7 +82,7 @@ declare module '@capacitor/cli' {
80
82
  iosSpinnerStyle?: 'large' | 'small';
81
83
  /**
82
84
  * Color of the spinner in hex format, #RRGGBB or #RRGGBBAA.
83
- * Doesn't work if `useDialog` is true.
85
+ * Doesn't work if `useDialog` is true on launch when using the Android 12 API.
84
86
  *
85
87
  * @since 1.0.0
86
88
  * @example "#999999"
@@ -89,6 +91,8 @@ declare module '@capacitor/cli' {
89
91
  /**
90
92
  * Hide the status bar on the Splash Screen.
91
93
  *
94
+ * Doesn't work on launch when using the Android 12 API.
95
+ *
92
96
  * Only available on Android.
93
97
  *
94
98
  * @since 1.0.0
@@ -98,6 +102,8 @@ declare module '@capacitor/cli' {
98
102
  /**
99
103
  * Hide the status bar and the software navigation buttons on the Splash Screen.
100
104
  *
105
+ * Doesn't work on launch when using the Android 12 API.
106
+ *
101
107
  * Only available on Android.
102
108
  *
103
109
  * @since 1.0.0
@@ -108,6 +114,8 @@ declare module '@capacitor/cli' {
108
114
  * If `useDialog` is set to true, configure the Dialog layout.
109
115
  * If `useDialog` is not set or false, use a layout instead of the ImageView.
110
116
  *
117
+ * Doesn't work on launch when using the Android 12 API.
118
+ *
111
119
  * Only available on Android.
112
120
  *
113
121
  * @since 1.1.0
@@ -119,6 +127,8 @@ declare module '@capacitor/cli' {
119
127
  * If `layoutName` is not configured, it will use
120
128
  * a layout that uses the splash image as background.
121
129
  *
130
+ * Doesn't work on launch when using the Android 12 API.
131
+ *
122
132
  * Only available on Android.
123
133
  *
124
134
  * @since 1.1.0
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC","sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n /**\n * These config values are available:\n */\n SplashScreen?: {\n /**\n * How long to show the launch splash screen when autoHide is enabled (in ms)\n *\n * @since 1.0.0\n * @default 500\n * @example 3000\n */\n launchShowDuration?: number;\n\n /**\n * Whether to auto hide the splash after launchShowDuration.\n *\n * @since 1.0.0\n * @default true\n * @example true\n */\n launchAutoHide?: boolean;\n\n /**\n * Color of the background of the Splash Screen in hex format, #RRGGBB or #RRGGBBAA.\n * Doesn't work if `useDialog` is true.\n *\n * @since 1.0.0\n * @example \"#ffffffff\"\n */\n backgroundColor?: string;\n\n /**\n * Name of the resource to be used as Splash Screen.\n *\n * Only available on Android.\n *\n * @since 1.0.0\n * @default splash\n * @example \"splash\"\n */\n androidSplashResourceName?: string;\n\n /**\n * The [ImageView.ScaleType](https://developer.android.com/reference/android/widget/ImageView.ScaleType) used to scale\n * the Splash Screen image.\n * Doesn't work if `useDialog` is true.\n *\n * Only available on Android.\n *\n * @since 1.0.0\n * @default FIT_XY\n * @example \"CENTER_CROP\"\n */\n androidScaleType?:\n | 'CENTER'\n | 'CENTER_CROP'\n | 'CENTER_INSIDE'\n | 'FIT_CENTER'\n | 'FIT_END'\n | 'FIT_START'\n | 'FIT_XY'\n | 'MATRIX';\n\n /**\n * Show a loading spinner on the Splash Screen.\n * Doesn't work if `useDialog` is true.\n *\n * @since 1.0.0\n * @example true\n */\n showSpinner?: boolean;\n\n /**\n * Style of the Android spinner.\n * Doesn't work if `useDialog` is true.\n *\n * @since 1.0.0\n * @default large\n * @example \"large\"\n */\n androidSpinnerStyle?:\n | 'horizontal'\n | 'small'\n | 'large'\n | 'inverse'\n | 'smallInverse'\n | 'largeInverse';\n\n /**\n * Style of the iOS spinner.\n * Doesn't work if `useDialog` is true.\n *\n * Only available on iOS.\n *\n * @since 1.0.0\n * @default large\n * @example \"small\"\n */\n iosSpinnerStyle?: 'large' | 'small';\n\n /**\n * Color of the spinner in hex format, #RRGGBB or #RRGGBBAA.\n * Doesn't work if `useDialog` is true.\n *\n * @since 1.0.0\n * @example \"#999999\"\n */\n spinnerColor?: string;\n\n /**\n * Hide the status bar on the Splash Screen.\n *\n * Only available on Android.\n *\n * @since 1.0.0\n * @example true\n */\n splashFullScreen?: boolean;\n\n /**\n * Hide the status bar and the software navigation buttons on the Splash Screen.\n *\n * Only available on Android.\n *\n * @since 1.0.0\n * @example true\n */\n splashImmersive?: boolean;\n\n /**\n * If `useDialog` is set to true, configure the Dialog layout.\n * If `useDialog` is not set or false, use a layout instead of the ImageView.\n *\n * Only available on Android.\n *\n * @since 1.1.0\n * @example \"launch_screen\"\n */\n layoutName?: string;\n\n /**\n * Use a Dialog instead of an ImageView.\n * If `layoutName` is not configured, it will use\n * a layout that uses the splash image as background.\n *\n * Only available on Android.\n *\n * @since 1.1.0\n * @example true\n */\n useDialog?: boolean;\n };\n }\n}\n\nexport interface ShowOptions {\n /**\n * Whether to auto hide the splash after showDuration\n *\n * @since 1.0.0\n */\n autoHide?: boolean;\n /**\n * How long (in ms) to fade in.\n *\n * @since 1.0.0\n * @default 200\n */\n fadeInDuration?: number;\n /**\n * How long (in ms) to fade out.\n *\n * @since 1.0.0\n * @default 200\n */\n fadeOutDuration?: number;\n /**\n * How long to show the splash screen when autoHide is enabled (in ms)\n *\n * @since 1.0.0\n * @default 3000\n */\n showDuration?: number;\n}\n\nexport interface HideOptions {\n /**\n * How long (in ms) to fade out.\n *\n * @since 1.0.0\n * @default 200\n */\n fadeOutDuration?: number;\n}\n\nexport interface SplashScreenPlugin {\n /**\n * Show the splash screen\n *\n * @since 1.0.0\n */\n show(options?: ShowOptions): Promise<void>;\n /**\n * Hide the splash screen\n *\n * @since 1.0.0\n */\n hide(options?: HideOptions): Promise<void>;\n}\n\n/**\n * @deprecated Use `ShowOptions`.\n * @since 1.0.0\n */\nexport type SplashScreenShowOptions = ShowOptions;\n\n/**\n * @deprecated Use `HideOptions`.\n * @since 1.0.0\n */\nexport type SplashScreenHideOptions = HideOptions;\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC","sourcesContent":["/// <reference types=\"@capacitor/cli\" />\n\ndeclare module '@capacitor/cli' {\n export interface PluginsConfig {\n /**\n * These config values are available:\n */\n SplashScreen?: {\n /**\n * How long to show the launch splash screen when autoHide is enabled (in ms)\n *\n * @since 1.0.0\n * @default 500\n * @example 3000\n */\n launchShowDuration?: number;\n\n /**\n * Whether to auto hide the splash after launchShowDuration.\n *\n * @since 1.0.0\n * @default true\n * @example true\n */\n launchAutoHide?: boolean;\n\n /**\n * Color of the background of the Splash Screen in hex format, #RRGGBB or #RRGGBBAA.\n * Doesn't work if `useDialog` is true or on launch when using the Android 12 API.\n *\n * @since 1.0.0\n * @example \"#ffffffff\"\n */\n backgroundColor?: string;\n\n /**\n * Name of the resource to be used as Splash Screen.\n *\n * Doesn't work on launch when using the Android 12 API.\n *\n * Only available on Android.\n *\n * @since 1.0.0\n * @default splash\n * @example \"splash\"\n */\n androidSplashResourceName?: string;\n\n /**\n * The [ImageView.ScaleType](https://developer.android.com/reference/android/widget/ImageView.ScaleType) used to scale\n * the Splash Screen image.\n * Doesn't work if `useDialog` is true or on launch when using the Android 12 API.\n *\n * Only available on Android.\n *\n * @since 1.0.0\n * @default FIT_XY\n * @example \"CENTER_CROP\"\n */\n androidScaleType?:\n | 'CENTER'\n | 'CENTER_CROP'\n | 'CENTER_INSIDE'\n | 'FIT_CENTER'\n | 'FIT_END'\n | 'FIT_START'\n | 'FIT_XY'\n | 'MATRIX';\n\n /**\n * Show a loading spinner on the Splash Screen.\n * Doesn't work if `useDialog` is true on launch when using the Android 12 API.\n *\n * @since 1.0.0\n * @example true\n */\n showSpinner?: boolean;\n\n /**\n * Style of the Android spinner.\n * Doesn't work if `useDialog` is true on launch when using the Android 12 API.\n *\n * @since 1.0.0\n * @default large\n * @example \"large\"\n */\n androidSpinnerStyle?:\n | 'horizontal'\n | 'small'\n | 'large'\n | 'inverse'\n | 'smallInverse'\n | 'largeInverse';\n\n /**\n * Style of the iOS spinner.\n * Doesn't work if `useDialog` is true.\n *\n * Only available on iOS.\n *\n * @since 1.0.0\n * @default large\n * @example \"small\"\n */\n iosSpinnerStyle?: 'large' | 'small';\n\n /**\n * Color of the spinner in hex format, #RRGGBB or #RRGGBBAA.\n * Doesn't work if `useDialog` is true on launch when using the Android 12 API.\n *\n * @since 1.0.0\n * @example \"#999999\"\n */\n spinnerColor?: string;\n\n /**\n * Hide the status bar on the Splash Screen.\n *\n * Doesn't work on launch when using the Android 12 API.\n *\n * Only available on Android.\n *\n * @since 1.0.0\n * @example true\n */\n splashFullScreen?: boolean;\n\n /**\n * Hide the status bar and the software navigation buttons on the Splash Screen.\n *\n * Doesn't work on launch when using the Android 12 API.\n *\n * Only available on Android.\n *\n * @since 1.0.0\n * @example true\n */\n splashImmersive?: boolean;\n\n /**\n * If `useDialog` is set to true, configure the Dialog layout.\n * If `useDialog` is not set or false, use a layout instead of the ImageView.\n *\n * Doesn't work on launch when using the Android 12 API.\n *\n * Only available on Android.\n *\n * @since 1.1.0\n * @example \"launch_screen\"\n */\n layoutName?: string;\n\n /**\n * Use a Dialog instead of an ImageView.\n * If `layoutName` is not configured, it will use\n * a layout that uses the splash image as background.\n *\n * Doesn't work on launch when using the Android 12 API.\n *\n * Only available on Android.\n *\n * @since 1.1.0\n * @example true\n */\n useDialog?: boolean;\n };\n }\n}\n\nexport interface ShowOptions {\n /**\n * Whether to auto hide the splash after showDuration\n *\n * @since 1.0.0\n */\n autoHide?: boolean;\n /**\n * How long (in ms) to fade in.\n *\n * @since 1.0.0\n * @default 200\n */\n fadeInDuration?: number;\n /**\n * How long (in ms) to fade out.\n *\n * @since 1.0.0\n * @default 200\n */\n fadeOutDuration?: number;\n /**\n * How long to show the splash screen when autoHide is enabled (in ms)\n *\n * @since 1.0.0\n * @default 3000\n */\n showDuration?: number;\n}\n\nexport interface HideOptions {\n /**\n * How long (in ms) to fade out.\n *\n * @since 1.0.0\n * @default 200\n */\n fadeOutDuration?: number;\n}\n\nexport interface SplashScreenPlugin {\n /**\n * Show the splash screen\n *\n * @since 1.0.0\n */\n show(options?: ShowOptions): Promise<void>;\n /**\n * Hide the splash screen\n *\n * @since 1.0.0\n */\n hide(options?: HideOptions): Promise<void>;\n}\n\n/**\n * @deprecated Use `ShowOptions`.\n * @since 1.0.0\n */\nexport type SplashScreenShowOptions = ShowOptions;\n\n/**\n * @deprecated Use `HideOptions`.\n * @since 1.0.0\n */\nexport type SplashScreenHideOptions = HideOptions;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor/splash-screen",
3
- "version": "4.0.0-beta.2",
3
+ "version": "4.0.0",
4
4
  "description": "The Splash Screen API provides methods for showing or hiding a Splash image.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -80,5 +80,5 @@
80
80
  "publishConfig": {
81
81
  "access": "public"
82
82
  },
83
- "gitHead": "32240b675c12a774920c07a86b4483ecec7a9c8d"
83
+ "gitHead": "27bd016fc57850ae151ae06017bb1e9ee0d62975"
84
84
  }