Skip to content

Commit

Permalink
Fix Android fullscreen mode based on screen orientation.
Browse files Browse the repository at this point in the history
  • Loading branch information
tkem committed Jan 7, 2024
1 parent 500213e commit bcaa8d1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ export class AppComponent implements AfterViewInit, OnInit, OnDestroy {
private translate: TranslateService,
private updates: SwUpdate)
{
// enable/disable fullscreen mode based on screen orientation, *not* WebView orientation
window.addEventListener("orientationchange", () => {
app.enableFullScreen(window.screen.orientation.type.startsWith('landscape'));
});
if (window.screen.orientation && window.screen.orientation.type) {
app.enableFullScreen(window.screen.orientation.type.startsWith('landscape'));
if (window.screen) {
window.screen.orientation.addEventListener('change', () => {
app.enableFullScreen(window.screen.orientation.type.startsWith('landscape'));
});
if (window.screen.orientation && window.screen.orientation.type) {
app.enableFullScreen(window.screen.orientation.type.startsWith('landscape'));
}
}
app.keepAwake(true);
translate.setDefaultLang('en');
Expand Down

0 comments on commit bcaa8d1

Please sign in to comment.