Skip to content

Commit

Permalink
feat!: upgrade to capacitor 6
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Apr 30, 2024
1 parent a4b4c5d commit f38d80c
Show file tree
Hide file tree
Showing 14 changed files with 544 additions and 388 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ npx cap sync
### addListener('shake', ...)

```typescript
addListener(eventName: "shake", listenerFunc: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle
addListener(eventName: "shake", listenerFunc: () => void) => any
```

| Param | Type |
Expand Down
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.2'
classpath 'com.android.tools.build:gradle:8.2.1'
}
}

apply plugin: 'com.android.library'

android {
namespace "ee.forgr.capacitor.shake"
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
defaultConfig {
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Binary file modified android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
17 changes: 8 additions & 9 deletions android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -145,15 +144,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -202,11 +201,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry
.getInstrumentation()
Context appContext = InstrumentationRegistry.getInstrumentation()
.getTargetContext();

assertEquals("com.getcapacitor.android", appContext.getPackageName());
Expand Down
5 changes: 5 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
extends: "@ionic/eslint-config/recommended",
files: ["src/**/*.tss"],
ignore: ["build", "dist", "example"],
};
2 changes: 1 addition & 1 deletion example/src/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8" />
Expand Down
4 changes: 2 additions & 2 deletions example/src/js/capacitor-welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ window.customElements.define(
}
});
}
}
},
);

window.customElements.define(
Expand Down Expand Up @@ -140,5 +140,5 @@ window.customElements.define(
<slot></slot>
`;
}
}
},
);
9 changes: 0 additions & 9 deletions ios/PluginTests/CapacitorShakeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@ import XCTest
@testable import Plugin

class CapacitorShakeTests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}

override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}

func testEcho() {
// This is an example of a functional test case for a plugin.
Expand Down
33 changes: 15 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@capgo/capacitor-shake",
"version": "5.0.29",
"version": "5.0.0",
"description": "Detect shake gesture in device",
"main": "dist/plugin.cjs.js",
"module": "dist/esm/index.js",
Expand Down Expand Up @@ -39,7 +39,7 @@
"verify:web": "npm run build",
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --autocorrect --format",
"eslint": "eslint . --ext ts",
"eslint": "eslint .",
"prettier": "prettier --config .prettierrc.js \"**/*.{css,html,ts,js,java}\"",
"swiftlint": "node-swiftlint",
"docgen": "docgen --api CapacitorShakePlugin --output-readme README.md --output-json dist/docs.json",
Expand All @@ -49,31 +49,28 @@
"prepublishOnly": "npm run build"
},
"devDependencies": {
"@capacitor/android": "^5.0.3",
"@capacitor/core": "^5.0.3",
"@capacitor/android": "^6.0.0",
"@capacitor/core": "^6.0.0",
"@capacitor/docgen": "^0.2.1",
"@capacitor/ios": "^5.0.3",
"@capacitor/ios": "^6.0.0",
"@ionic/eslint-config": "^0.3.0",
"@ionic/prettier-config": "^3.0.0",
"@ionic/prettier-config": "^4.0.0",
"@ionic/swiftlint-config": "^1.1.2",
"@typescript-eslint/eslint-plugin": "^5.59.7",
"@typescript-eslint/parser": "^5.59.7",
"eslint": "^8.41.0",
"prettier": "~2.8.8",
"prettier-plugin-java": "~1.6.0",
"rimraf": "^5.0.1",
"rollup": "^3.23.0",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"eslint": "^9.1.1",
"prettier": "~3.2.5",
"prettier-plugin-java": "~2.6.0",
"rimraf": "^5.0.5",
"rollup": "^4.17.1",
"swiftlint": "^1.0.2",
"typescript": "~5.0.4"
"typescript": "~5.4.5"
},
"peerDependencies": {
"@capacitor/core": "^5.0.0"
"@capacitor/core": "^6.0.0"
},
"prettier": "@ionic/prettier-config",
"swiftlint": "@ionic/swiftlint-config",
"eslintConfig": {
"extends": "@ionic/eslint-config/recommended"
},
"capacitor": {
"ios": {
"src": "ios"
Expand Down
Loading

0 comments on commit f38d80c

Please sign in to comment.