Skip to content

Commit

Permalink
#26: fix Tesla useragent detection for fullscreen snackbar
Browse files Browse the repository at this point in the history
closes #26
  • Loading branch information
JaxonWright committed Apr 28, 2022
1 parent 31ea346 commit f7c7f0b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { MatSnackBar } from '@angular/material/snack-bar';
})
export class AppComponent {
title = 'testube';
teslaUserAgentRegEx = /Tesla\/([0-9]{4}.[0-9]{1,2}.?[0-9]{0,2}.?[0-9]{0,2})-(.*)/g;
teslaUserAgentRegEx = /Tesla\/(develop-)*([0-9]{4}.[0-9]{1,2}.?[0-9]{0,2}.?[0-9]{0,2})-(.*)/g;
isFullscreen : boolean;
theaterZoomLevel : number = 0.64; // make size 64% of original size to account for ViewPort oddness in Tesla Theater Mode.

Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/debug/debug.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class DebugComponent implements OnInit {
zoom: number;
maxZoom: number;
minZoom: number;
teslaUserAgentRegEx = /Tesla\/([0-9]{4}.[0-9]{1,2}.?[0-9]{0,2}.?[0-9]{0,2})-(.*)/g;
teslaUserAgentRegEx = /Tesla\/(?:develop-)*([0-9]{4}.[0-9]{1,2}.?[0-9]{0,2}.?[0-9]{0,2})-(.*)/g;

constructor() {}

Expand All @@ -41,7 +41,7 @@ export class DebugComponent implements OnInit {

getTeslaFirmware(): string {
console.log(this.userAgent.match(this.teslaUserAgentRegEx))
return this.userAgent.match(this.teslaUserAgentRegEx)[0].split('/')[1];
return this.teslaUserAgentRegEx.exec(this.userAgent)[1];
}

getViewport(width: boolean): string {
Expand Down

0 comments on commit f7c7f0b

Please sign in to comment.