Skip to content

Commit c5f44be

Browse files
authored
feat: SplashScreen plugin (#149)
1 parent 4864928 commit c5f44be

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2708
-0
lines changed

lerna.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"network",
1717
"screen-reader",
1818
"share",
19+
"splash-screen",
1920
"status-bar",
2021
"storage",
2122
"text-zoom",

splash-screen/.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build
2+
dist

splash-screen/.gitignore

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# node files
2+
dist
3+
node_modules
4+
5+
# iOS files
6+
Pods
7+
Podfile.lock
8+
Build
9+
xcuserdata
10+
11+
# macOS files
12+
.DS_Store
13+
14+
15+
16+
# Based on Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore
17+
18+
# Built application files
19+
*.apk
20+
*.ap_
21+
22+
# Files for the ART/Dalvik VM
23+
*.dex
24+
25+
# Java class files
26+
*.class
27+
28+
# Generated files
29+
bin
30+
gen
31+
out
32+
33+
# Gradle files
34+
.gradle
35+
build
36+
37+
# Local configuration file (sdk path, etc)
38+
local.properties
39+
40+
# Proguard folder generated by Eclipse
41+
proguard
42+
43+
# Log Files
44+
*.log
45+
46+
# Android Studio Navigation editor temp files
47+
.navigation
48+
49+
# Android Studio captures folder
50+
captures
51+
52+
# IntelliJ
53+
*.iml
54+
.idea
55+
56+
# Keystore files
57+
# Uncomment the following line if you do not want to check your keystore files in.
58+
#*.jks
59+
60+
# External native build folder generated in Android Studio 2.2 and later
61+
.externalNativeBuild

splash-screen/.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build
2+
dist
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
require 'json'
2+
3+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4+
5+
Pod::Spec.new do |s|
6+
s.name = 'CapacitorSplashScreen'
7+
s.version = package['version']
8+
s.summary = package['description']
9+
s.license = package['license']
10+
s.homepage = package['repository']['url']
11+
s.author = package['author']
12+
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13+
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14+
s.ios.deployment_target = '11.0'
15+
s.dependency 'Capacitor'
16+
s.swift_version = '5.1'
17+
end

splash-screen/LICENSE

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Copyright 2020-present Ionic
2+
https://ionic.io
3+
4+
MIT License
5+
6+
Permission is hereby granted, free of charge, to any person obtaining
7+
a copy of this software and associated documentation files (the
8+
"Software"), to deal in the Software without restriction, including
9+
without limitation the rights to use, copy, modify, merge, publish,
10+
distribute, sublicense, and/or sell copies of the Software, and to
11+
permit persons to whom the Software is furnished to do so, subject to
12+
the following conditions:
13+
14+
The above copyright notice and this permission notice shall be
15+
included in all copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

splash-screen/README.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# @capacitor/splash-screen
2+
3+
The Splash Screen API provides methods for showing or hiding a Splash image.
4+
5+
## Install
6+
7+
```bash
8+
npm install @capacitor/splash-screen
9+
npx cap sync
10+
```
11+
12+
## API
13+
14+
<docgen-index>
15+
16+
* [`show(...)`](#show)
17+
* [`hide(...)`](#hide)
18+
* [Interfaces](#interfaces)
19+
20+
</docgen-index>
21+
22+
<docgen-api>
23+
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
24+
25+
### show(...)
26+
27+
```typescript
28+
show(options?: SplashScreenShowOptions | undefined) => Promise<void>
29+
```
30+
31+
Show the splash screen
32+
33+
| Param | Type |
34+
| ------------- | --------------------------------------------------------------------------- |
35+
| **`options`** | <code><a href="#splashscreenshowoptions">SplashScreenShowOptions</a></code> |
36+
37+
**Since:** 1.0.0
38+
39+
--------------------
40+
41+
42+
### hide(...)
43+
44+
```typescript
45+
hide(options?: SplashScreenHideOptions | undefined) => Promise<void>
46+
```
47+
48+
Hide the splash screen
49+
50+
| Param | Type |
51+
| ------------- | --------------------------------------------------------------------------- |
52+
| **`options`** | <code><a href="#splashscreenhideoptions">SplashScreenHideOptions</a></code> |
53+
54+
**Since:** 1.0.0
55+
56+
--------------------
57+
58+
59+
### Interfaces
60+
61+
62+
#### SplashScreenShowOptions
63+
64+
| Prop | Type | Description | Default | Since |
65+
| --------------------- | -------------------- | ------------------------------------------------------------------- | ----------------- | ----- |
66+
| **`autoHide`** | <code>boolean</code> | Whether to auto hide the splash after showDuration | | 1.0.0 |
67+
| **`fadeInDuration`** | <code>number</code> | How long (in ms) to fade in. | <code>200</code> | 1.0.0 |
68+
| **`fadeOutDuration`** | <code>number</code> | How long (in ms) to fade out. | <code>200</code> | 1.0.0 |
69+
| **`showDuration`** | <code>number</code> | How long to show the splash screen when autoHide is enabled (in ms) | <code>3000</code> | 1.0.0 |
70+
71+
72+
#### SplashScreenHideOptions
73+
74+
| Prop | Type | Description | Default | Since |
75+
| --------------------- | ------------------- | ----------------------------- | ---------------- | ----- |
76+
| **`fadeOutDuration`** | <code>number</code> | How long (in ms) to fade out. | <code>200</code> | 1.0.0 |
77+
78+
</docgen-api>

splash-screen/android/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

splash-screen/android/build.gradle

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
ext {
2+
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.12'
3+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.1.0'
4+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.1'
5+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.2.0'
6+
}
7+
8+
buildscript {
9+
repositories {
10+
google()
11+
jcenter()
12+
}
13+
dependencies {
14+
classpath 'com.android.tools.build:gradle:4.1.1'
15+
}
16+
}
17+
18+
apply plugin: 'com.android.library'
19+
20+
android {
21+
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 29
22+
defaultConfig {
23+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21
24+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 29
25+
versionCode 1
26+
versionName "1.0"
27+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
28+
}
29+
buildTypes {
30+
release {
31+
minifyEnabled false
32+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
33+
}
34+
}
35+
lintOptions {
36+
abortOnError false
37+
}
38+
compileOptions {
39+
sourceCompatibility JavaVersion.VERSION_1_8
40+
targetCompatibility JavaVersion.VERSION_1_8
41+
}
42+
}
43+
44+
repositories {
45+
google()
46+
jcenter()
47+
mavenCentral()
48+
}
49+
50+
51+
dependencies {
52+
implementation fileTree(dir: 'libs', include: ['*.jar'])
53+
implementation project(':capacitor-android')
54+
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
55+
testImplementation "junit:junit:$junitVersion"
56+
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
57+
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
58+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Project-wide Gradle settings.
2+
3+
# IDE (e.g. Android Studio) users:
4+
# Gradle settings configured through the IDE *will override*
5+
# any settings specified in this file.
6+
7+
# For more details on how to configure your build environment visit
8+
# http://www.gradle.org/docs/current/userguide/build_environment.html
9+
10+
# Specifies the JVM arguments used for the daemon process.
11+
# The setting is particularly useful for tweaking memory settings.
12+
org.gradle.jvmargs=-Xmx1536m
13+
14+
# When configured, Gradle will run in incubating parallel mode.
15+
# This option should only be used with decoupled projects. More details, visit
16+
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17+
# org.gradle.parallel=true
18+
19+
# AndroidX package structure to make it clearer which packages are bundled with the
20+
# Android operating system, and which are packaged with your app's APK
21+
# https://developer.android.com/topic/libraries/support-library/androidx-rn
22+
android.useAndroidX=true
23+
# Automatically convert third-party libraries to use AndroidX
24+
android.enableJetifier=true

0 commit comments

Comments
 (0)