mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-31 19:50:44 +00:00
feat(reminders): also focus electron window on reminder
This commit is contained in:
parent
fc90fa4b5c
commit
10fb83e644
2 changed files with 9 additions and 0 deletions
|
|
@ -15,6 +15,9 @@ import { FormsModule } from '@angular/forms';
|
|||
import { ReminderService } from '../reminder/reminder.service';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { DialogViewNoteReminderComponent } from './dialog-view-note-reminder/dialog-view-note-reminder.component';
|
||||
import { ElectronService } from 'ngx-electron';
|
||||
import { IPC_SHOW_OR_FOCUS } from '../../ipc-events.const';
|
||||
import { IS_ELECTRON } from '../app.constants';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
|
|
@ -42,10 +45,15 @@ export class NoteModule {
|
|||
constructor(
|
||||
private readonly _reminderService: ReminderService,
|
||||
private readonly _matDialog: MatDialog,
|
||||
private readonly _electronService: ElectronService,
|
||||
) {
|
||||
let isDialogOpen = false;
|
||||
|
||||
this._reminderService.onReminderActive$.subscribe(reminder => {
|
||||
if (IS_ELECTRON) {
|
||||
this._electronService.ipcRenderer.send(IPC_SHOW_OR_FOCUS);
|
||||
}
|
||||
|
||||
if (!isDialogOpen && reminder && reminder.type === 'NOTE') {
|
||||
isDialogOpen = true;
|
||||
this._matDialog.open(DialogViewNoteReminderComponent, {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ export const IPC_REGISTER_GLOBAL_SHORTCUT_EVENT = 'REGISTER_GLOBAL_SHORTCUT';
|
|||
export const IPC_IDLE_TIME = 'IDLE_TIME';
|
||||
|
||||
export const IPC_NOTIFY = 'NOTIFY';
|
||||
export const IPC_SHOW_OR_FOCUS = 'SHOW_OR_FOCUS';
|
||||
|
||||
export const IPC_APP_READY = 'APP_READY';
|
||||
export const IPC_ERROR = 'ELECTRON_ERROR';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue