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

test flashlight fix #3

Merged
merged 3 commits into from
Aug 28, 2024
Merged
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: 0 additions & 3 deletions src/app/home/home.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@
<ion-grid>
<ion-row>
<ion-col size="auto">
<ion-button size="large" (click)="toggleTorch()">
<ion-icon slot="icon-only" name="flashlight-outline"></ion-icon>
</ion-button>
</ion-col>
<ion-col></ion-col>
<ion-col size="auto">
Expand Down
9 changes: 3 additions & 6 deletions src/app/home/home.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { LogoService } from '../services/logo.service';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { NgxScannerQrcodeComponent, ScannerQRCodeConfig, ScannerQRCodeResult } from 'ngx-scanner-qrcode';
import { LocalStorageService } from '../services/local-storage.service';
import { GlobalUtils } from '../utils/global-utils';

@Component({
selector: 'app-home',
Expand Down Expand Up @@ -353,13 +354,9 @@ export class HomePage implements OnInit {
this.qrscanner.playDevice(nextDevice.deviceId)
}

async toggleTorch() {
const currentState = await firstValueFrom(this.qrscanner.torcher())
this.qrscanner.isTorch = !currentState
}

private processQRCode(evt: string) {
// otpauth://totp/Google:My%20Account?secret=JBSWY3D&issuer=Google&algorithm=SHA1&digits=6&period=30
// The URI format and params is described in https://github.com/google/google-authenticator/wiki/Key-Uri-Format
// otpauth://totp/ACME%20Co:john.doe@email.com?secret=HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ&issuer=ACME%20Co&algorithm=SHA1&digits=6&period=30
try {
const account = Account2FA.fromOTPAuthURL(evt)
console.log({account})
Expand Down
2 changes: 1 addition & 1 deletion src/app/utils/global-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ export class GlobalUtils {
static isMobile() {
return window.innerWidth <= 768;
}
}
}