Skip to content

Commit

Permalink
build: update plugin node dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
robsonos committed May 24, 2024
1 parent fe6d3ce commit d9ae875
Show file tree
Hide file tree
Showing 10 changed files with 849 additions and 1,195 deletions.
10 changes: 7 additions & 3 deletions example/src/app/scan/dfu/dfu.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ export class DfuPage {
public file!: PickedFile | undefined;
public update: DfuUpdate | undefined;

constructor(@Inject(NgZone) private ngZone: NgZone, private router: Router, private toastService: ToastService) {
constructor(
@Inject(NgZone) private ngZone: NgZone,
private router: Router,
private toastService: ToastService,
) {
const navigation = this.router.getCurrentNavigation();

if (!navigation) {
Expand Down Expand Up @@ -112,7 +116,7 @@ export class DfuPage {
}

async updateFirmware(): Promise<void> {
if (!this.file || !this.file.path) {
if (!this.file?.path) {
this.toastService.presentErrorToast('Pick a file first!');
return;
}
Expand Down Expand Up @@ -145,7 +149,7 @@ export class DfuPage {
(error: PluginResultError) => {
console.error(error);
this.toastService.presentErrorToast(`Error starting DFU: ${JSON.stringify(error)}`);
}
},
);
}

Expand Down
9 changes: 6 additions & 3 deletions example/src/app/scan/scan.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,13 @@ export class ScanPage implements OnDestroy, OnInit {
scan((acc: ScanResult[], curr: ScanResult | null) => {
if (curr === null) return [];
return [...acc, curr];
}, [])
}, []),
);

constructor(@Inject(NgZone) private ngZone: NgZone, @Inject(ToastService) private toastService: ToastService) {}
constructor(
@Inject(NgZone) private ngZone: NgZone,
@Inject(ToastService) private toastService: ToastService,
) {}

async ngOnInit(): Promise<void> {
try {
Expand Down Expand Up @@ -111,7 +114,7 @@ export class ScanPage implements OnDestroy, OnInit {
services: [CONSTANTS.UUID128_SVC_NORDIC_UART],
scanMode: ScanMode.SCAN_MODE_LOW_LATENCY,
},
this.onBluetoothDeviceFound.bind(this)
this.onBluetoothDeviceFound.bind(this),
);

this.scanInterval = setInterval(() => {
Expand Down
4 changes: 2 additions & 2 deletions example/src/app/services/loading.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ export class LoadingService {

constructor(private loadingController: LoadingController) {}

async presentLoading(message: string) {
async presentLoading(message: string): Promise<void> {
this.loading = await this.loadingController.create({
message,
});
await this.loading.present();
}

async dismissLoading() {
async dismissLoading(): Promise<void> {
if (this.loading) {
await this.loading.dismiss();
this.loading = null;
Expand Down
8 changes: 4 additions & 4 deletions example/src/app/services/toast.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ToastController } from '@ionic/angular';
export class ToastService {
constructor(private toastController: ToastController) {}

async presentToast(message: string, color = 'primary', header = '') {
async presentToast(message: string, color = 'primary', header = ''): Promise<void> {
const toast = await this.toastController.create({
header,
message,
Expand All @@ -19,15 +19,15 @@ export class ToastService {
toast.present();
}

async presentSuccessToast(message: string) {
async presentSuccessToast(message: string): Promise<void> {
await this.presentToast(message, 'success', 'Success');
}

async presentErrorToast(message: string) {
async presentErrorToast(message: string): Promise<void> {
await this.presentToast(message, 'danger', 'Error');
}

async presentInfoToast(message: string) {
async presentInfoToast(message: string): Promise<void> {
await this.presentToast(message, 'warning', '');
}
}
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">
<head>
<meta charset="utf-8" />
Expand Down
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
"lint": "yarn eslint && yarn prettier --check && yarn swiftlint lint",
"fmt": "yarn eslint --fix && yarn prettier --write && yarn swiftlint --fix --format",
"eslint": "eslint . --ext ts",
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
"prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin ./node_modules/prettier-plugin-java/dist/index.js",
"swiftlint": "swiftlint",
"docgen": "docgen --api NordicDfuPlugin --output-readme README.md --output-json dist/docs.json",
"build": "yarn clean && yarn docgen && tsc && rollup -c rollup.config.js",
"build": "yarn clean && yarn docgen && tsc && rollup -c rollup.config.mjs",
"clean": "rimraf ./dist",
"watch": "tsc --watch",
"test": "echo \"No test specified\"",
Expand All @@ -61,22 +61,22 @@
"@capacitor/core": "^6.0.0",
"@capacitor/docgen": "^0.2.0",
"@capacitor/ios": "^6.0.0",
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@ionic/eslint-config": "^0.3.0",
"@ionic/prettier-config": "^2.0.0",
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@ionic/eslint-config": "^0.4.0",
"@ionic/prettier-config": "^4.0.0",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@semantic-release/npm": "^11.0.1",
"@semantic-release/npm": "^12.0.1",
"eslint": "^7.26.0",
"husky": "^8.0.3",
"np": "^8.0.4",
"prettier": "^2.8.1",
"prettier-plugin-java": "^2.0.0",
"pretty-quick": "^3.1.3",
"rimraf": "^3.0.2",
"rollup": "^2.79.1",
"semantic-release": "^22.0.8",
"husky": "^9.0.11",
"np": "^10.0.5",
"prettier": "^3.2.5",
"prettier-plugin-java": "^2.6.0",
"pretty-quick": "^4.0.0",
"rimraf": "^5.0.7",
"rollup": "^4.18.0",
"semantic-release": "^23.1.1",
"typescript": "~4.9.4"
},
"peerDependencies": {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ export interface NordicDfuPlugin {
*/
addListener(
eventName: 'DFUStateChanged',
handler: (update: DfuUpdate) => void
handler: (update: DfuUpdate) => void,
): Promise<PluginListenerHandle> & PluginListenerHandle;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class NordicDfuWeb extends WebPlugin implements NordicDfuPlugin {
}
addListener(
_eventName: string,

Check warning on line 17 in src/web.ts

View workflow job for this annotation

GitHub Actions / verify-ios

'_eventName' is defined but never used
_listenerFunc: ListenerCallback
_listenerFunc: ListenerCallback,

Check warning on line 18 in src/web.ts

View workflow job for this annotation

GitHub Actions / verify-ios

'_listenerFunc' is defined but never used
): Promise<PluginListenerHandle> & PluginListenerHandle {
throw this.unavailable('Method not available in this browser.');
}
Expand Down
Loading

0 comments on commit d9ae875

Please sign in to comment.