Skip to content

Commit

Permalink
Merge pull request #12 from robsonos/dev
Browse files Browse the repository at this point in the history
Merge dev into main 🔀
  • Loading branch information
robsonos authored May 25, 2024
2 parents 50dd154 + b7341b5 commit 9a9af66
Show file tree
Hide file tree
Showing 25 changed files with 4,906 additions and 5,265 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions:

jobs:
cd:
runs-on: macos-12
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
Expand All @@ -24,7 +24,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version-file: '.nvmrc'
cache: 'yarn'

- name: Install dependencies
Expand Down
35 changes: 21 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,26 @@ env:

jobs:
lint:
runs-on: macos-13
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Install SwiftLint
run: |
brew install swiftlint
- name: Lint
run: yarn lint

Expand All @@ -33,7 +43,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version-file: '.nvmrc'
cache: 'yarn'

- name: Install plugin dependencies
Expand Down Expand Up @@ -61,44 +71,41 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version-file: '.nvmrc'
cache: 'yarn'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'zulu'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Verify
run: yarn verify:android

verify-ios:
runs-on: macos-13
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Set up Xcode
run: sudo xcode-select --switch /Applications/Xcode_15.4.app

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version-file: '.nvmrc'
cache: 'yarn'

- name: Set up Xcode
run: sudo xcode-select --switch /Applications/Xcode_14.2.app

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Lint
run: yarn lint

- name: Verify
run: yarn verify:ios

Expand Down
2 changes: 1 addition & 1 deletion .java-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
17.0
17
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
20
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.8
3.3.1
2 changes: 1 addition & 1 deletion CapacitorCommunityNordicDfu.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '13.0'
s.dependency 'Capacitor'
s.swift_version = '5.1'
s.dependency 'iOSDFULibrary', '~> 4.15.0'
s.dependency 'iOSDFULibrary', '~> 4.15.3'
end
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</p>

<p align="center">
<img src="https://img.shields.io/maintenance/yes/2023?style=flat-square" />
<img src="https://img.shields.io/maintenance/yes/2024?style=flat-square" />
<a href="https://github.com/robsonos/nordic-dfu/actions/workflows/ci.yaml"
><img
alt="GitHub Workflow Status (with event)"
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ dependencies {
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
implementation "no.nordicsemi.android:dfu:2.4.2"
implementation "no.nordicsemi.android:dfu:2.5.0"
}
2 changes: 2 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ yarn-error.log
/.angular
/.angular/cache
.sass-cache/
/.nx
/.nx/cache
/connect.lock
/coverage
/libpeerconnection.log
Expand Down
2 changes: 1 addition & 1 deletion example/.java-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
17.0
17
2 changes: 1 addition & 1 deletion example/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
20
2 changes: 1 addition & 1 deletion example/.ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.8
3.3.1
8 changes: 4 additions & 4 deletions example/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"options": {
"outputPath": "www",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": ["src/polyfills.ts"],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
Expand All @@ -30,9 +31,8 @@
"output": "assets"
}
],
"styles": ["src/theme/variables.scss", "src/global.scss"],
"scripts": [],
"browser": "src/main.ts"
"styles": ["src/global.scss", "src/theme/variables.scss"],
"scripts": []
},
"configurations": {
"production": {
Expand Down Expand Up @@ -104,7 +104,7 @@
"output": "assets"
}
],
"styles": ["src/theme/variables.scss", "src/global.scss"],
"styles": ["src/global.scss", "src/theme/variables.scss"],
"scripts": []
},
"configurations": {
Expand Down
29 changes: 14 additions & 15 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"test": "ng test"
},
"engines": {
"node": ">=18.0.0"
"node": ">=20.0.0"
},
"dependencies": {
"@angular/animations": "^17.0.2",
Expand All @@ -27,13 +27,13 @@
"@angular/platform-browser": "^17.0.2",
"@angular/platform-browser-dynamic": "^17.0.2",
"@angular/router": "^17.0.2",
"@capacitor-community/bluetooth-le": "^3.1.1",
"@capacitor/android": "5.6.0",
"@capacitor/core": "5.6.0",
"@capacitor/filesystem": "^5.2.0",
"@capacitor/ios": "5.6.0",
"@capawesome/capacitor-file-picker": "^5.1.1",
"@ionic/angular": "^7.5.0",
"@capacitor-community/bluetooth-le": "^6.0.0",
"@capacitor/android": "^6.0.0",
"@capacitor/core": "^6.0.0",
"@capacitor/filesystem": "^6.0.0",
"@capacitor/ios": "^6.0.0",
"@capawesome/capacitor-file-picker": "^6.0.0",
"@ionic/angular": "^8.2.0",
"capacitor-community-nordic-dfu": "file:..",
"ionicons": "^7.2.1",
"rxjs": "~7.8.0",
Expand All @@ -50,14 +50,14 @@
"@angular/cli": "^17.0.0",
"@angular/compiler-cli": "^17.0.2",
"@angular/language-service": "^17.0.2",
"@capacitor/cli": "5.6.0",
"@ionic/angular-toolkit": "^9.0.0",
"@capacitor/cli": "^6.0.0",
"@ionic/angular-toolkit": "^11.0.1",
"@types/jasmine": "~5.1.0",
"@typescript-eslint/eslint-plugin": "^6.16.0",
"@typescript-eslint/parser": "^6.16.0",
"eslint": "^7.26.0",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"eslint": "^8.57.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "30.7.6",
"eslint-plugin-jsdoc": "^48.2.1",
"eslint-plugin-prefer-arrow": "1.2.2",
"jasmine-core": "~5.1.0",
"jasmine-spec-reporter": "~5.0.0",
Expand All @@ -66,7 +66,6 @@
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"ts-node": "^8.3.0",
"typescript": "~5.2.2"
},
"browserslist": [
Expand Down
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
Loading

0 comments on commit 9a9af66

Please sign in to comment.