Disallow any types
This commit is contained in:
@@ -26,6 +26,16 @@ import { PlatformService } from '../../core/services/platform.service';
|
||||
import { STORAGE_KEY_CURRENT_USER_ID } from '../../core/constants';
|
||||
import { LeaveServerDialogComponent } from '../../shared';
|
||||
|
||||
interface WindowControlsAPI {
|
||||
minimizeWindow?: () => void;
|
||||
maximizeWindow?: () => void;
|
||||
closeWindow?: () => void;
|
||||
}
|
||||
|
||||
type ElectronWindow = Window & {
|
||||
electronAPI?: WindowControlsAPI;
|
||||
};
|
||||
|
||||
@Component({
|
||||
selector: 'app-title-bar',
|
||||
standalone: true,
|
||||
@@ -54,6 +64,10 @@ export class TitleBarComponent {
|
||||
private webrtc = inject(WebRTCService);
|
||||
private platform = inject(PlatformService);
|
||||
|
||||
private getWindowControlsApi(): WindowControlsAPI | undefined {
|
||||
return (window as ElectronWindow).electronAPI;
|
||||
}
|
||||
|
||||
isElectron = computed(() => this.platform.isElectron);
|
||||
showMenuState = computed(() => false);
|
||||
|
||||
@@ -73,26 +87,23 @@ export class TitleBarComponent {
|
||||
|
||||
/** Minimize the Electron window. */
|
||||
minimize() {
|
||||
const api = (window as any).electronAPI;
|
||||
const api = this.getWindowControlsApi();
|
||||
|
||||
if (api?.minimizeWindow)
|
||||
api.minimizeWindow();
|
||||
api?.minimizeWindow?.();
|
||||
}
|
||||
|
||||
/** Maximize or restore the Electron window. */
|
||||
maximize() {
|
||||
const api = (window as any).electronAPI;
|
||||
const api = this.getWindowControlsApi();
|
||||
|
||||
if (api?.maximizeWindow)
|
||||
api.maximizeWindow();
|
||||
api?.maximizeWindow?.();
|
||||
}
|
||||
|
||||
/** Close the Electron window. */
|
||||
close() {
|
||||
const api = (window as any).electronAPI;
|
||||
const api = this.getWindowControlsApi();
|
||||
|
||||
if (api?.closeWindow)
|
||||
api.closeWindow();
|
||||
api?.closeWindow?.();
|
||||
}
|
||||
|
||||
/** Navigate to the login page. */
|
||||
|
||||
Reference in New Issue
Block a user