대화 뱃지가 남아 있을 경우 계속 taskbar 에 blink 하도록 수정.

This commit is contained in:
leejinho 2020-03-30 15:28:20 +09:00
parent 020f905e93
commit ca9e8942e7
8 changed files with 70 additions and 10 deletions

View File

@ -89,7 +89,7 @@ export class AppWindow {
// windows Focus or Blur state detacted. // windows Focus or Blur state detacted.
this.window.on(ElectronBrowserWindowChannel.Focus, () => { this.window.on(ElectronBrowserWindowChannel.Focus, () => {
if (__WIN32__) { if (__WIN32__) {
this.window.flashFrame(false); // this.window.flashFrame(false);
} }
this.window.webContents.send( this.window.webContents.send(

View File

@ -8,7 +8,8 @@ import {
dialog, dialog,
BrowserWindow, BrowserWindow,
clipboard, clipboard,
crashReporter crashReporter,
nativeImage
} from 'electron'; } from 'electron';
import path from 'path'; import path from 'path';
import fse from 'fs-extra'; import fse from 'fs-extra';
@ -35,7 +36,8 @@ import {
MessageChannel, MessageChannel,
AppChannel, AppChannel,
ClipboardChannel, ClipboardChannel,
ExternalChannel ExternalChannel,
WindowStateChannel
} from '@ucap-webmessenger/native-electron'; } from '@ucap-webmessenger/native-electron';
import { ElectronNotificationService } from '@ucap-webmessenger/electron-notification'; import { ElectronNotificationService } from '@ucap-webmessenger/electron-notification';
import { ElectronUpdateWindowService } from '@ucap-webmessenger/electron-update-window'; import { ElectronUpdateWindowService } from '@ucap-webmessenger/electron-update-window';
@ -800,7 +802,7 @@ ipcMain.on(
: '', : '',
displayTime: !!noti.displayTime ? noti.displayTime : undefined, displayTime: !!noti.displayTime ? noti.displayTime : undefined,
onClick: e => { onClick: e => {
appWindow.browserWindow.flashFrame(false); // appWindow.browserWindow.flashFrame(false);
if (noti.type === NotificationType.Event) { if (noti.type === NotificationType.Event) {
appWindow.browserWindow.webContents.send( appWindow.browserWindow.webContents.send(
ChatChannel.OpenRoom, ChatChannel.OpenRoom,
@ -820,13 +822,37 @@ ipcMain.on(
if (!appWindow.isVisible()) { if (!appWindow.isVisible()) {
appWindow.browserWindow.minimize(); appWindow.browserWindow.minimize();
} }
// const img = nativeImage.createFromPath(
// path.join(__dirname, 'assets/notification/images/img_nophoto_50.png')
// );
// console.log(img);
// appWindow.browserWindow.setOverlayIcon(img, 'discription');
// setTimeout(() => {
// appWindow.browserWindow.setOverlayIcon(null, '');
// }, 3000);
appWindow.browserWindow.flashFrame(true); appWindow.browserWindow.flashFrame(true);
} }
); );
ipcMain.on( ipcMain.on(
NotificationChannel.CloseAllNotify, NotificationChannel.CloseAllNotify,
(event: IpcMainEvent, ...args: any[]) => {
// appWindow.browserWindow.flashFrame(false);
}
);
ipcMain.on(
WindowStateChannel.OnFlashFrame,
(event: IpcMainEvent, ...args: any[]) => {
appWindow.browserWindow.flashFrame(false);
if (!appWindow.isVisible() && !appWindow.browserWindow.isMinimized()) {
appWindow.browserWindow.minimize();
}
appWindow.browserWindow.flashFrame(true);
}
);
ipcMain.on(
WindowStateChannel.OffFlashFrame,
(event: IpcMainEvent, ...args: any[]) => { (event: IpcMainEvent, ...args: any[]) => {
appWindow.browserWindow.flashFrame(false); appWindow.browserWindow.flashFrame(false);
} }

View File

@ -1,4 +1,4 @@
import { Component, OnInit, OnDestroy } from '@angular/core'; import { Component, OnInit, OnDestroy, Inject } from '@angular/core';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
import { ucapAnimations } from '@ucap-webmessenger/ui'; import { ucapAnimations } from '@ucap-webmessenger/ui';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
@ -9,6 +9,8 @@ import * as MessageStore from '@app/store/messenger/message';
import * as SettingsStore from '@app/store/messenger/settings'; import * as SettingsStore from '@app/store/messenger/settings';
import { MatTabChangeEvent } from '@angular/material/tabs'; import { MatTabChangeEvent } from '@angular/material/tabs';
import { MainMenu } from '@app/types'; import { MainMenu } from '@app/types';
import { tap } from 'rxjs/operators';
import { UCAP_NATIVE_SERVICE, NativeService } from '@ucap-webmessenger/native';
@Component({ @Component({
selector: 'app-layout-messenger-left-nav', selector: 'app-layout-messenger-left-nav',
@ -22,13 +24,34 @@ export class LeftNaviComponent implements OnInit, OnDestroy {
badgeMessageInterval: any; badgeMessageInterval: any;
MainMenu = MainMenu; MainMenu = MainMenu;
intervalFlashFrame: any;
constructor(private store: Store<any>, private logger: NGXLogger) {} constructor(
private store: Store<any>,
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
private logger: NGXLogger
) {}
ngOnInit() { ngOnInit() {
/** About Chat Badge */ /** About Chat Badge */
this.badgeChatUnReadCount$ = this.store.pipe( this.badgeChatUnReadCount$ = this.store.pipe(
select(AppStore.MessengerSelector.SyncSelector.selectChatUnreadCount) select(AppStore.MessengerSelector.SyncSelector.selectChatUnreadCount),
tap(count => {
// windows taskbar blinking unread count exist.
if (!!count && count > 0) {
if (!this.intervalFlashFrame) {
this.intervalFlashFrame = setInterval(() => {
this.nativeService.onFlashFlame();
}, 1000);
}
} else {
this.nativeService.offFlashFlame();
if (!!this.intervalFlashFrame) {
clearInterval(this.intervalFlashFrame);
this.intervalFlashFrame = undefined;
}
}
})
); );
/** About Message Badge */ /** About Message Badge */

View File

@ -380,7 +380,6 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
} }
}); });
} }
console.log(this.offLineUsers);
}) })
) )
.subscribe(); .subscribe();

View File

@ -213,6 +213,8 @@ export class BrowserNativeService extends NativeService {
}); });
} }
onFlashFlame(): void {}
offFlashFlame(): void {}
windowStateChanged(): Observable<WindowState> { windowStateChanged(): Observable<WindowState> {
return new Observable<WindowState>(subscriber => { return new Observable<WindowState>(subscriber => {
try { try {

View File

@ -352,6 +352,12 @@ export class ElectronNativeService implements NativeService {
}); });
} }
onFlashFlame(): void {
this.ipcRenderer.send(WindowStateChannel.OnFlashFrame);
}
offFlashFlame(): void {
this.ipcRenderer.send(WindowStateChannel.OffFlashFrame);
}
windowStateChanged(): Observable<WindowState> { windowStateChanged(): Observable<WindowState> {
if (!this.windowStateChangedSubject) { if (!this.windowStateChangedSubject) {
this.windowStateChangedSubject = new Subject<WindowState>(); this.windowStateChangedSubject = new Subject<WindowState>();

View File

@ -47,7 +47,9 @@ export enum ProcessChannel {
export enum WindowStateChannel { export enum WindowStateChannel {
Changed = 'UCAP::windowState::windowStateChanged', Changed = 'UCAP::windowState::windowStateChanged',
FocuseChanged = 'UCAP::windowState::windowFocusStateChanged' FocuseChanged = 'UCAP::windowState::windowFocusStateChanged',
OnFlashFrame = 'UCAP::windowState::OnFlashFrame',
OffFlashFrame = 'UCAP::windowState::OffFlashFrame'
} }
export enum IdleStateChannel { export enum IdleStateChannel {

View File

@ -70,6 +70,8 @@ export abstract class NativeService {
abstract executeProcess(executableName: string): Promise<number>; abstract executeProcess(executableName: string): Promise<number>;
abstract onFlashFlame(): void;
abstract offFlashFlame(): void;
abstract windowStateChanged(): Observable<WindowState>; abstract windowStateChanged(): Observable<WindowState>;
abstract windowClose(): void; abstract windowClose(): void;
abstract windowMinimize(): void; abstract windowMinimize(): void;