Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep screen unlocked during update #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@angular/platform-browser-dynamic": "^16.2.8",
"@angular/router": "^16.2.8",
"@awesome-cordova-plugins/sqlite": "^6.4.0",
"@capacitor-community/keep-awake": "^4.0.0",
"@capacitor/android": "^5.4.2",
"@capacitor/assets": "^3.0.0",
"@capacitor/core": "^5.4.2",
Expand Down
2 changes: 1 addition & 1 deletion rclone.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rclone copy --max-age 24h --no-traverse www vServer:/var/www/vhosts/thank-the-maker.org/httpdocs/rescue/
rclone copy --max-age 24h --no-traverse www 'vServer SFTP:/var/www/vhosts/thank-the-maker.org/httpdocs/rescue/'
5 changes: 4 additions & 1 deletion src/app/update/update.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { AppSettings } from '../models/AppSettings';
import { ListpickerComponent } from '../components/listpicker/listpicker.component';
import { NGXLogger } from 'ngx-logger';
import * as CryptoJS from 'crypto-js';
import { KeepAwake } from '@capacitor-community/keep-awake';

const part = 19000;
const mtu = 250;
Expand Down Expand Up @@ -177,7 +178,8 @@ onFirmwareFileSelected(event: Event): void {

await this.bleService.disconnect(false);
await this.bleService.reconnect();

await KeepAwake.keepAwake();

const timer = setInterval(() => {
this.logger.info("Starting update now")
this.sendFile();
Expand All @@ -197,6 +199,7 @@ onFirmwareFileSelected(event: Event): void {
role: 'ok'
}]
});
await KeepAwake.allowSleep();
await toast.present();
const { role } = await toast.onDidDismiss();
this.router.navigate(['']);
Expand Down