Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ dist/
!.ionic/e2e.env
!.ionic/wdio.config.ts
xcuserdata
.turbo
.turbo
.nx
56 changes: 28 additions & 28 deletions apps/example-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,38 @@
"@capacitor/ios": "^7.0.0",
"@capacitor/keyboard": "^7.0.0",
"@capacitor/status-bar": "^7.0.0",
"@ionic/react": "^6.7.5",
"@ionic/react-router": "^6.7.5",
"@testing-library/dom": "^9.3.4",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"@types/jest": "^26.0.24",
"@types/node": "^12.20.55",
"@types/react": "^16.14.62",
"@types/react-dom": "^16.9.25",
"@ionic/react": "^8.7.9",
"@ionic/react-router": "^8.7.9",
"@testing-library/dom": "^10.4.1",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.0",
"@testing-library/user-event": "^14.6.1",
"@types/jest": "^30.0.0",
"@types/node": "^24.10.1",
"@types/react": "^19.2.6",
"@types/react-dom": "^19.2.3",
"@types/react-router": "^5.1.20",
"@types/react-router-dom": "^5.3.3",
"ionicons": "^5.5.4",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"ionicons": "^8.0.13",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"react-router": "^5.3.4",
"react-router-dom": "^5.3.4",
"react-scripts": "^5.0.1",
"typescript": "^4.9.5",
"web-vitals": "^0.2.4",
"workbox-background-sync": "^5.1.4",
"workbox-broadcast-update": "^5.1.4",
"workbox-cacheable-response": "^5.1.4",
"workbox-core": "^5.1.4",
"workbox-expiration": "^5.1.4",
"workbox-google-analytics": "^5.1.4",
"workbox-navigation-preload": "^5.1.4",
"workbox-precaching": "^5.1.4",
"workbox-range-requests": "^5.1.4",
"workbox-routing": "^5.1.4",
"workbox-strategies": "^5.1.4",
"workbox-streams": "^5.1.4"
"typescript": "^5.9.3",
"web-vitals": "^5.1.0",
"workbox-background-sync": "^7.3.0",
"workbox-broadcast-update": "^7.3.0",
"workbox-cacheable-response": "^7.3.0",
"workbox-core": "^7.3.0",
"workbox-expiration": "^7.3.0",
"workbox-google-analytics": "^7.3.0",
"workbox-navigation-preload": "^7.3.0",
"workbox-precaching": "^7.3.0",
"workbox-range-requests": "^7.3.0",
"workbox-routing": "^7.3.0",
"workbox-strategies": "^7.3.0",
"workbox-streams": "^7.3.0"
},
"scripts": {
"start": "react-scripts start",
Expand Down Expand Up @@ -74,4 +74,4 @@
"@capacitor/cli": "next"
},
"description": "An Ionic project"
}
}
17 changes: 10 additions & 7 deletions apps/example-app/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';
import App from './App';
import * as serviceWorkerRegistration from './serviceWorkerRegistration';
import reportWebVitals from './reportWebVitals';

ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
const container = document.getElementById('root');
if (container) {
const root = createRoot(container);
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
}

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
Expand Down
16 changes: 7 additions & 9 deletions apps/example-app/src/reportWebVitals.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { ReportHandler } from 'web-vitals';
import { onCLS, onINP, onFCP, onLCP, onTTFB, Metric } from 'web-vitals';

const reportWebVitals = (onPerfEntry?: ReportHandler) => {
const reportWebVitals = (onPerfEntry?: (metric: Metric) => void) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
onCLS(onPerfEntry);
onINP(onPerfEntry);
onFCP(onPerfEntry);
onLCP(onPerfEntry);
onTTFB(onPerfEntry);
}
};

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"packages/*"
],
"dependencies": {
"nx": "^16.5.5"
"nx": "^22.0.4"
},
"devDependencies": {
"@changesets/cli": "^2.26.2",
"lerna": "^7.1.4"
"lerna": "^9.0.1"
},
"engines": {
"node": ">=18",
Expand All @@ -25,4 +25,4 @@
"publish:latest": "lerna publish from-package --dist-tag latest --force-publish --no-verify-access --yes",
"version": "changeset version && cp -R packages/capacitor-plugin/CHANGELOG.md CHANGELOG.md"
}
}
}
8 changes: 4 additions & 4 deletions packages/android-js-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
"dependencies": {
"@naturalcycles/ktlint": "1.9.0",
"clang-format": "^1.8.0",
"prettier": "~2.3.2",
"prettier-plugin-java": "~1.0.2"
"prettier": "^3.6.2",
"prettier-plugin-java": "^2.7.7"
},
"devDependencies": {
"@ionic/prettier-config": "^1.0.1"
"@ionic/prettier-config": "^4.0.0"
},
"prettier": "@ionic/prettier-config",
"scripts": {
"lint": "pnpm run-clang-format --dry-run && ktlint 'AndroidJSEngine/src/**/*.kt'",
"fmt": "pnpm run-clang-format -i && ktlint --format 'AndroidJSEngine/src/**/*.kt'",
"prettier": "prettier --plugin-search-dir=. \"**/*.{css,html,ts,js,java}\"",
"prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
"run-clang-format": "pnpm clang-format --glob=AndroidJSEngine/src/main/cpp/**/*.{cpp,h}"
},
"version": "1.1.0"
Expand Down
4 changes: 0 additions & 4 deletions packages/capacitor-plugin/.prettierignore

This file was deleted.

24 changes: 12 additions & 12 deletions packages/capacitor-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
"eslint": "eslint . --ext ts",
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
"prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
"swiftlint": "node-swiftlint",
"docgen": "docgen --api BackgroundRunnerPlugin --output-readme README.md --output-json dist/docs.json",
"docgen-api": "docgen --api CapacitorAPI --output-readme API.md --output-json dist/docs-api.json && node ./scripts/combine_docs.js",
Expand All @@ -52,18 +52,18 @@
"@capacitor/android": "^6.0.0",
"@capacitor/cli": "^6.0.0",
"@capacitor/core": "^6.0.0",
"@capacitor/docgen": "^0.2.2",
"@capacitor/docgen": "0.3.0",
"@capacitor/ios": "^6.0.0",
"@ionic/eslint-config": "^0.3.0",
"@ionic/prettier-config": "^1.0.1",
"@ionic/swiftlint-config": "^1.1.2",
"eslint": "^7.32.0",
"prettier": "~2.3.2",
"prettier-plugin-java": "~2.1.0",
"rimraf": "^3.0.2",
"rollup": "^2.79.1",
"swiftlint": "^1.0.2",
"typescript": "^5.1.6"
"@ionic/eslint-config": "^0.4.0",
"@ionic/prettier-config": "^4.0.0",
"@ionic/swiftlint-config": "^2.0.0",
"eslint": "^8.57.1",
"prettier": "^3.6.2",
"prettier-plugin-java": "^2.7.7",
"rimraf": "^6.1.0",
"rollup": "^4.53.2",
"swiftlint": "^2.0.0",
"typescript": "^5.9.3"
},
"peerDependencies": {
"@capacitor/core": ">=6.0.0"
Expand Down
16 changes: 4 additions & 12 deletions packages/capacitor-plugin/scripts/install_libs.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,21 @@ if (!fs.existsSync(androidGradlePath)) {
return;
}

const searchText =
"dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'";
const insertText =
"\n\t\tdirs '../../node_modules/@capacitor/background-runner/android/src/main/libs', 'libs'";
const searchText = "dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'";
const insertText = "\n\t\tdirs '../../node_modules/@capacitor/background-runner/android/src/main/libs', 'libs'";

let gradleFile = fs.readFileSync(androidGradlePath).toString('utf-8');
if (gradleFile.indexOf(insertText) != -1) {
return;
}

let insertIndex = gradleFile.indexOf(searchText) + searchText.length;
gradleFile =
gradleFile.substring(0, insertIndex) +
insertText +
gradleFile.substring(insertIndex);
gradleFile = gradleFile.substring(0, insertIndex) + insertText + gradleFile.substring(insertIndex);

fs.writeFileSync(androidGradlePath, gradleFile);

// remove old version of aar
const oldReleaseAARPath = path.join(
workingDir,
'android/src/main/libs/android-js-engine-release.aar',
);
const oldReleaseAARPath = path.join(workingDir, 'android/src/main/libs/android-js-engine-release.aar');
if (fs.existsSync(oldReleaseAARPath)) {
fs.rmSync(oldReleaseAARPath);
}
Expand Down
4 changes: 1 addition & 3 deletions packages/capacitor-plugin/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,7 @@ export interface BackgroundRunnerPlugin {
*
* @since 1.0.0
*/
requestPermissions(
options: RequestPermissionOptions,
): Promise<PermissionStatus>;
requestPermissions(options: RequestPermissionOptions): Promise<PermissionStatus>;
/**
* Dispatches an event to the configured runner.
* @param options
Expand Down
9 changes: 3 additions & 6 deletions packages/capacitor-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ import { registerPlugin } from '@capacitor/core';

import type { BackgroundRunnerPlugin } from './definitions';

const BackgroundRunner = registerPlugin<BackgroundRunnerPlugin>(
'BackgroundRunner',
{
web: () => import('./web').then(m => new m.BackgroundRunnerWeb()),
},
);
const BackgroundRunner = registerPlugin<BackgroundRunnerPlugin>('BackgroundRunner', {
web: () => import('./web').then((m) => new m.BackgroundRunnerWeb()),
});

export * from './definitions';
export * from './apis';
Expand Down
5 changes: 1 addition & 4 deletions packages/capacitor-plugin/src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ import type {
NotificationActionEvent,
} from './definitions';

export class BackgroundRunnerWeb
extends WebPlugin
implements BackgroundRunnerPlugin
{
export class BackgroundRunnerWeb extends WebPlugin implements BackgroundRunnerPlugin {
checkPermissions(): Promise<PermissionStatus> {
throw new Error('not available on web');
}
Expand Down
6 changes: 3 additions & 3 deletions packages/ios-engine/Sources/RunnerEngine/JSCrypto.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ class JSCrypto: NSObject, JSCryptoExports {
var rnd = [UInt8](repeating: 0, count: size)
_ = SecRandomCopyBytes(kSecRandomDefault, size, &rnd)

if arr.toArray() as? [UInt8] != nil {
if arr.toArray() is [UInt8] {
for i in 0...(size - 1) {
arr.setObject(rnd[i], atIndexedSubscript: i)
}
}
if arr.toArray() as? [UInt16] != nil {
if arr.toArray() is [UInt16] {
for i in 0...(size - 1) {
arr.setObject(UInt16(rnd[i]), atIndexedSubscript: i)
}
}
if arr.toArray() as? [UInt32] != nil {
if arr.toArray() is [UInt32] {
for i in 0...(size - 1) {
arr.setObject(UInt32(rnd[i]), forKeyedSubscript: i)
}
Expand Down
Loading
Loading