Skip to content

Commit

Permalink
feat!: capacitor 5
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed May 22, 2023
1 parent c7696e4 commit 677d54e
Show file tree
Hide file tree
Showing 19 changed files with 640 additions and 305 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'pnpm'
node-version: 18
cache: "pnpm"
- name: Install dependencies
id: install_code
run: pnpm install --frozen-lockfile
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
distribution: "zulu"
java-version: "17"
- name: Build
id: build_code
run: npm run verify:android
Expand All @@ -41,8 +41,8 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'pnpm'
node-version: 18
cache: "pnpm"
- name: Install dependencies
id: install_code
run: pnpm install --frozen-lockfile
Expand All @@ -62,8 +62,8 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'pnpm'
node-version: 18
cache: "pnpm"
- name: Install dependencies
id: install_code
run: pnpm install --frozen-lockfile
Expand Down
37 changes: 29 additions & 8 deletions .github/workflows/bump_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
bump-version:
if: "!startsWith(github.event.head_commit.message, 'chore(release):')"
runs-on: ubuntu-latest
name: "Bump version and create changelog with standard version"
name: 'Bump version and create changelog with standard version'
steps:
- name: Check out
uses: actions/checkout@v3
Expand All @@ -23,7 +23,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: 'pnpm'
- name: Install dependencies
id: install_code
Expand All @@ -32,19 +32,40 @@ jobs:
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
- name: Update Readme
run: pnpm docgen
- name: Add readme
run: git add README.md
- name: Create bump and changelog main
if: github.ref == 'refs/heads/main'
run: npx standard-version
run: pnpm dlx capacitor-plugin-standard-version@latest
- name: Create bump and changelog development
if: github.ref != 'refs/heads/main'
run: npx standard-version --prerelease alpha
run: pnpm dlx capacitor-plugin-standard-version@latest --prerelease alpha
- name: Update Doc
run: pnpm docgen
- name: Add doc to github
run: |
git add README.md
git commit --amend --no-edit
- name: Push to origin
run: |
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
remote_repo="https://${GITHUB_ACTOR}:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
git pull $remote_repo $CURRENT_BRANCH
git push $remote_repo HEAD:$CURRENT_BRANCH --follow-tags --tags
create-cache:
if: "!startsWith(github.event.head_commit.message, 'chore(release):')"
runs-on: ubuntu-latest
name: 'Create global cache on main branch'
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 7
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'pnpm'
- name: Install dependencies
id: install_code
run: pnpm install --frozen-lockfile
- name: CLI capacitor-standard-version install
run: pnpm dlx capacitor-standard-version@latest --version
18 changes: 9 additions & 9 deletions .github/workflows/text.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'pnpm'
node-version: 18
cache: "pnpm"
- name: Install dependencies
id: install_code
run: pnpm install --frozen-lockfile
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
distribution: "zulu"
java-version: "17"
- name: Build
id: build_code
run: npm run verify:android
Expand All @@ -41,8 +41,8 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'pnpm'
node-version: 18
cache: "pnpm"
- name: Install dependencies
id: install_code
run: pnpm install --frozen-lockfile
Expand All @@ -51,7 +51,7 @@ jobs:
run: pnpm verify:ios
web:
runs-on: ubuntu-latest
name: 'Build code and test'
name: "Build code and test"
steps:
- name: Check out
uses: actions/checkout@v3
Expand All @@ -61,8 +61,8 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'pnpm'
node-version: 18
cache: "pnpm"
- name: Install dependencies
id: install_code
run: pnpm install --frozen-lockfile
Expand Down
3 changes: 3 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
plugins: [require.resolve("prettier-plugin-java")],
};
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,26 @@ No configuration required for this plugin.
### start()

```typescript
start() => Promise<void>
start() => any
```

start the recording

**Returns:** <code>any</code>

--------------------


### stop()

```typescript
stop() => Promise<void>
stop() => any
```

stop the recording

**Returns:** <code>any</code>

--------------------

</docgen-api>
26 changes: 13 additions & 13 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
buildscript {
ext {
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.4'
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.0'
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
androidxCoreVersion = project.hasProperty('androidxCoreVersion') ? rootProject.ext.androidxCoreVersion : '1.8.0'
kotlinVersion = project.hasProperty('kotlinVersion') ? rootProject.ext.kotlinVersion : '1.7.21'
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
androidxCoreVersion = project.hasProperty('androidxCoreVersion') ? rootProject.ext.androidxCoreVersion : '1.10.0'
kotlin_version = project.hasProperty('kotlin_version') ? rootProject.ext.kotlin_version : '1.7.21'
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath 'com.android.tools.build:gradle:8.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

Expand All @@ -22,10 +22,10 @@ apply plugin: 'kotlin-android'

android {
namespace "ee.forgr.plugin.screenrecorder"
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
defaultConfig {
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -40,8 +40,8 @@ android {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '11'
Expand All @@ -61,6 +61,6 @@ dependencies {
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
implementation "androidx.core:core-ktx:$androidxCoreVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation ("dev.bmcreations:scrcast:0.3.0")
}
3 changes: 1 addition & 2 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ org.gradle.jvmargs=-Xmx1536m
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

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-7.6.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -144,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=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=SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {

@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry
.getInstrumentation()
.getTargetContext();

assertEquals("com.getcapacitor.android", appContext.getPackageName());
}
assertEquals("com.getcapacitor.android", appContext.getPackageName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@
@CapacitorPlugin(name = "ScreenRecorder")
public class ScreenRecorderPlugin extends Plugin {

private ScrCast recorder;
private ScrCast recorder;

@Override
public void load() {
recorder = ScrCast.use(this.bridge.getActivity());
Options options = new Options();
recorder.updateOptions(options);
}
@Override
public void load() {
recorder = ScrCast.use(this.bridge.getActivity());
Options options = new Options();
recorder.updateOptions(options);
}

@PluginMethod
public void start(PluginCall call) {
recorder.record();
call.resolve();
}
@PluginMethod
public void start(PluginCall call) {
recorder.record();
call.resolve();
}

@PluginMethod
public void stop(PluginCall call) {
recorder.stopRecording();
call.resolve();
}
@PluginMethod
public void stop(PluginCall call) {
recorder.stopRecording();
call.resolve();
}
}
8 changes: 4 additions & 4 deletions android/src/test/java/com/getcapacitor/ExampleUnitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
*/
public class ExampleUnitTest {

@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
4 changes: 2 additions & 2 deletions example/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import './style.css';
import "./style.css";

const app = document.querySelector<HTMLDivElement>('#app')!;
const app = document.querySelector<HTMLDivElement>("#app")!;

app.innerHTML = `
<h1>Hello Vite!</h1>
Expand Down
24 changes: 24 additions & 0 deletions java_code_style.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="FieldMayBeFinal" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="GroovyVariableCanBeFinal" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="IOResource" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredTypesString" value="java.io.ByteArrayOutputStream,java.io.ByteArrayInputStream,java.io.StringBufferInputStream,java.io.CharArrayWriter,java.io.CharArrayReader,java.io.StringWriter,java.io.StringReader" />
<option name="insideTryAllowed" value="false" />
</inspection_tool>
<inspection_tool class="LocalCanBeFinal" enabled="true" level="ERROR" enabled_by_default="true">
<option name="REPORT_VARIABLES" value="true" />
<option name="REPORT_PARAMETERS" value="true" />
</inspection_tool>
<inspection_tool class="PublicField" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoreEnums" value="false" />
<option name="ignorableAnnotations">
<value />
</option>
</inspection_tool>
<inspection_tool class="UnqualifiedFieldAccess" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="UnqualifiedMethodAccess" enabled="true" level="ERROR" enabled_by_default="true" />
</profile>
</component>
Loading

0 comments on commit 677d54e

Please sign in to comment.