Skip to content

Commit

Permalink
chore: set status bar color to red
Browse files Browse the repository at this point in the history
  • Loading branch information
robingenz committed Feb 6, 2025
1 parent 7fd75be commit 2e4f999
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component } from '@angular/core';
import { Capacitor } from '@capacitor/core';
import { SplashScreen } from '@capacitor/splash-screen';
import { StatusBar, Style } from '@capacitor/status-bar';
import { EdgeToEdge } from '@capawesome/capacitor-android-edge-to-edge-support';
import { MenuController } from '@ionic/angular';
import { CapacitorAppService, TimeoutService } from './core';

Expand Down Expand Up @@ -31,20 +32,15 @@ export class AppComponent {
private async initializeApp(): Promise<void> {
const isNativePlatform = Capacitor.isNativePlatform();
if (isNativePlatform) {
await this.hideSplashScreen();
await SplashScreen.hide();
await EdgeToEdge.setBackgroundColor({ color: '#e2001a' });
// We need to add a timeout since `SplashScreen.hide()` resolves
// before the splash screen is actually hidden.
await this.timeoutService.timeout(500);
await this.configureStatusBar();
const isAndroid = Capacitor.getPlatform() === 'android';
if (isAndroid) {
await StatusBar.setStyle({ style: Style.Dark });
}
}
}

private async configureStatusBar(): Promise<void> {
const isAndroid = Capacitor.getPlatform() === 'android';
if (isAndroid) {
await StatusBar.setStyle({ style: Style.Light });
}
}

private hideSplashScreen(): Promise<void> {
return SplashScreen.hide();
}
}

0 comments on commit 2e4f999

Please sign in to comment.