Skip to content

Commit 8f6aef8

Browse files
feat!: Update to Capacitor v5 (#80)
Co-authored-by: jcesarmobile <jcesarmobile@gmail.com>
1 parent e2fd5d1 commit 8f6aef8

File tree

11 files changed

+90
-72
lines changed

11 files changed

+90
-72
lines changed

.github/workflows/test-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ jobs:
2525
# run: yarn test
2626

2727
- name: Run build
28-
run: yarn build
28+
run: yarn build

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<h3 align="center">Native Audio</h3>
33
<p align="center"><strong><code>@capacitor-community/native-audio</code></strong></p>
44
<p align="center">
5-
Capacitor community plugin for playing sounds.
5+
Capacitor community plugin for playing sounds natively.
66
</p>
77

88
<p align="center">
@@ -20,7 +20,7 @@
2020
# Capacitor Native Audio Plugin
2121

2222
Capacitor plugin for native audio engine.
23-
Capacitor v3 - ✅ Support!
23+
Capacitor v5 - ✅ Support!
2424

2525
Click on video to see example 💥
2626

@@ -375,10 +375,10 @@ isPlaying(options: { assetId: string; }) => Promise<{ isPlaying: boolean; }>
375375

376376
#### ConfigureOptions
377377

378-
| Prop | Type |
379-
| ----------- | -------------------- |
380-
| **`fade`** | <code>boolean</code> |
381-
| **`focus`** | <code>boolean</code> |
378+
| Prop | Type | Description | Default |
379+
| ----------- | -------------------- | ------------------------------------------------- | ----------------- |
380+
| **`fade`** | <code>boolean</code> | indicating whether or not to fade audio. | <code>true</code> |
381+
| **`focus`** | <code>boolean</code> | indicating whether or not to disable mixed audio. | <code>true</code> |
382382

383383

384384
#### PreloadOptions

android/build.gradle

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
ext {
2-
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3-
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
4-
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
2+
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
4+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
5+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
56
}
67

78
buildscript {
@@ -10,17 +11,18 @@ buildscript {
1011
mavenCentral()
1112
}
1213
dependencies {
13-
classpath 'com.android.tools.build:gradle:7.2.1'
14+
classpath 'com.android.tools.build:gradle:8.0.0'
1415
}
1516
}
1617

1718
apply plugin: 'com.android.library'
1819

1920
android {
20-
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
21+
namespace "com.getcapacitor.community.audio.nativeaudio"
22+
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
2123
defaultConfig {
2224
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
23-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
25+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
2426
versionCode 1
2527
versionName "1.0"
2628
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -40,13 +42,12 @@ android {
4042

4143
repositories {
4244
google()
43-
mavenCentral()
4445
mavenCentral()
4546
}
4647

4748

4849
dependencies {
49-
implementation 'com.android.support:appcompat-v7:XX.X.+'
50+
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
5051
implementation fileTree(dir: 'libs', include: ['*.jar'])
5152
implementation project(':capacitor-android')
5253
testImplementation "junit:junit:$junitVersion"

android/gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,3 @@ org.gradle.jvmargs=-Xmx1536m
1818

1919
# Supports AndroidX
2020
android.useAndroidX=true
21-
android.enableJetifier=true
1.75 KB
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Fri Dec 01 12:41:00 CST 2017
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
4+
networkTimeout=10000
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

android/gradlew

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
# Darwin, MinGW, and NonStop.
5656
#
5757
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58+
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5959
# within the Gradle project.
6060
#
6161
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,10 +80,10 @@ do
8080
esac
8181
done
8282

83-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84-
85-
APP_NAME="Gradle"
83+
# This is normally unused
84+
# shellcheck disable=SC2034
8685
APP_BASE_NAME=${0##*/}
86+
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
8787

8888
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
8989
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
@@ -143,12 +143,16 @@ fi
143143
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144144
case $MAX_FD in #(
145145
max*)
146+
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147+
# shellcheck disable=SC3045
146148
MAX_FD=$( ulimit -H -n ) ||
147149
warn "Could not query maximum file descriptor limit"
148150
esac
149151
case $MAX_FD in #(
150152
'' | soft) :;; #(
151153
*)
154+
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155+
# shellcheck disable=SC3045
152156
ulimit -n "$MAX_FD" ||
153157
warn "Could not set maximum file descriptor limit to $MAX_FD"
154158
esac
@@ -205,6 +209,12 @@ set -- \
205209
org.gradle.wrapper.GradleWrapperMain \
206210
"$@"
207211

212+
# Stop when "xargs" is not available.
213+
if ! command -v xargs >/dev/null 2>&1
214+
then
215+
die "xargs is not available"
216+
fi
217+
208218
# Use "xargs" to parse quoted args.
209219
#
210220
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.

android/gradlew.bat

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
@if "%DEBUG%" == "" @echo off
1+
@rem
2+
@rem Copyright 2015 the original author or authors.
3+
@rem
4+
@rem Licensed under the Apache License, Version 2.0 (the "License");
5+
@rem you may not use this file except in compliance with the License.
6+
@rem You may obtain a copy of the License at
7+
@rem
8+
@rem https://www.apache.org/licenses/LICENSE-2.0
9+
@rem
10+
@rem Unless required by applicable law or agreed to in writing, software
11+
@rem distributed under the License is distributed on an "AS IS" BASIS,
12+
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
@rem See the License for the specific language governing permissions and
14+
@rem limitations under the License.
15+
@rem
16+
17+
@if "%DEBUG%"=="" @echo off
218
@rem ##########################################################################
319
@rem
420
@rem Gradle startup script for Windows
@@ -8,20 +24,24 @@
824
@rem Set local scope for the variables with windows NT shell
925
if "%OS%"=="Windows_NT" setlocal
1026

11-
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12-
set DEFAULT_JVM_OPTS=
13-
1427
set DIRNAME=%~dp0
15-
if "%DIRNAME%" == "" set DIRNAME=.
28+
if "%DIRNAME%"=="" set DIRNAME=.
29+
@rem This is normally unused
1630
set APP_BASE_NAME=%~n0
1731
set APP_HOME=%DIRNAME%
1832

33+
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
34+
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35+
36+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37+
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38+
1939
@rem Find java.exe
2040
if defined JAVA_HOME goto findJavaFromJavaHome
2141

2242
set JAVA_EXE=java.exe
2343
%JAVA_EXE% -version >NUL 2>&1
24-
if "%ERRORLEVEL%" == "0" goto init
44+
if %ERRORLEVEL% equ 0 goto execute
2545

2646
echo.
2747
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -35,7 +55,7 @@ goto fail
3555
set JAVA_HOME=%JAVA_HOME:"=%
3656
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
3757

38-
if exist "%JAVA_EXE%" goto init
58+
if exist "%JAVA_EXE%" goto execute
3959

4060
echo.
4161
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -45,44 +65,26 @@ echo location of your Java installation.
4565

4666
goto fail
4767

48-
:init
49-
@rem Get command-line arguments, handling Windowz variants
50-
51-
if not "%OS%" == "Windows_NT" goto win9xME_args
52-
if "%@eval[2+2]" == "4" goto 4NT_args
53-
54-
:win9xME_args
55-
@rem Slurp the command line arguments.
56-
set CMD_LINE_ARGS=
57-
set _SKIP=2
58-
59-
:win9xME_args_slurp
60-
if "x%~1" == "x" goto execute
61-
62-
set CMD_LINE_ARGS=%*
63-
goto execute
64-
65-
:4NT_args
66-
@rem Get arguments from the 4NT Shell from JP Software
67-
set CMD_LINE_ARGS=%$
68-
6968
:execute
7069
@rem Setup the command line
7170

7271
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
7372

73+
7474
@rem Execute Gradle
75-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
75+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
7676

7777
:end
7878
@rem End local scope for the variables with windows NT shell
79-
if "%ERRORLEVEL%"=="0" goto mainEnd
79+
if %ERRORLEVEL% equ 0 goto mainEnd
8080

8181
:fail
8282
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
8383
rem the _cmd.exe /c_ return code!
84-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85-
exit /b 1
84+
set EXIT_CODE=%ERRORLEVEL%
85+
if %EXIT_CODE% equ 0 set EXIT_CODE=1
86+
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87+
exit /b %EXIT_CODE%
8688

8789
:mainEnd
8890
if "%OS%"=="Windows_NT" endlocal
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11

2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="com.getcapacitor.community.audio.nativeaudio">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
43
</manifest>
54

package.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@capacitor-community/native-audio",
3-
"version": "4.0.0",
3+
"version": "5.0.0",
44
"description": "A native plugin for native audio engine",
55
"main": "dist/plugin.js",
66
"module": "dist/esm/index.js",
@@ -41,25 +41,25 @@
4141
"license": "MIT",
4242
"dependencies": {},
4343
"devDependencies": {
44-
"@capacitor/android": "^4.0.0",
45-
"@capacitor/ios": "^4.0.0",
46-
"@capacitor/cli": "^3.0.0",
47-
"@capacitor/core": "^4.0.0",
48-
"@capacitor/docgen": "0.0.17",
44+
"@capacitor/android": "^5.0.0",
45+
"@capacitor/ios": "^5.0.0",
46+
"@capacitor/cli": "^5.0.0",
47+
"@capacitor/core": "^5.0.0",
48+
"@capacitor/docgen": "0.2.1",
4949
"@ionic/eslint-config": "^0.3.0",
50-
"@ionic/prettier-config": "~1.0.1",
50+
"@ionic/prettier-config": "~3.0.0",
5151
"@ionic/swiftlint-config": "^1.1.2",
52-
"eslint": "^7.11.0",
53-
"prettier": "~2.3.0",
54-
"prettier-plugin-java": "~1.0.2",
55-
"rimraf": "^3.0.0",
56-
"rollup": "^2.29.0",
57-
"swiftlint": "^1.0.1",
58-
"typescript": "~4.1.5",
59-
"husky": "^5.1.3"
52+
"eslint": "^8.43.0",
53+
"prettier": "~2.8.8",
54+
"prettier-plugin-java": "~2.1.0",
55+
"rimraf": "^5.0.1",
56+
"rollup": "^2.79.1",
57+
"swiftlint": "^1.0.2",
58+
"typescript": "~4.8.4",
59+
"husky": "^8.0.3"
6060
},
6161
"peerDependencies": {
62-
"@capacitor/core": "^4.0.0"
62+
"@capacitor/core": "^5.0.0"
6363
},
6464
"husky": {
6565
"hooks": {

0 commit comments

Comments
 (0)