Merge branch 'master' of https://git.loafle.net/ucap-web/next-ucap-messenger
This commit is contained in:
commit
1ed7a2402d
|
@ -652,18 +652,32 @@ ipcMain.on(
|
|||
idle.destoryChecker();
|
||||
idle = null;
|
||||
}
|
||||
|
||||
idle = new IdleChecker(appWindow.browserWindow); // default 10min
|
||||
idle.startChecker();
|
||||
}
|
||||
);
|
||||
ipcMain.on(
|
||||
IdleStateChannel.StopCheck,
|
||||
(event: IpcMainEvent, ...args: any[]) => {
|
||||
if (!!idle) {
|
||||
idle.destoryChecker();
|
||||
idle = null;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
ipcMain.on(
|
||||
IdleStateChannel.ChangeLimitTime,
|
||||
(event: IpcMainEvent, ...args: any[]) => {
|
||||
const limitTime: number = args[0];
|
||||
if (!!idle) {
|
||||
idle.resetIdleTime(limitTime);
|
||||
idle.destoryChecker();
|
||||
idle = null;
|
||||
}
|
||||
|
||||
idle = new IdleChecker(appWindow.browserWindow);
|
||||
idle.resetIdleTime(limitTime);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -44,26 +44,23 @@ export class IdleChecker {
|
|||
|
||||
if (!!this.intervalObject) {
|
||||
clearInterval(this.intervalObject);
|
||||
this.intervalObject = undefined;
|
||||
}
|
||||
this.limitSec = limitedMin * 60;
|
||||
|
||||
// storage.setIdleTimeLimit(limitedMin);
|
||||
// global.opt_idleTimeLimit = limitedMin;
|
||||
|
||||
this.startChecker();
|
||||
}
|
||||
|
||||
public startChecker() {
|
||||
if (!this.intervalObject) {
|
||||
this.intervalObject = setInterval(() => {
|
||||
this.doCheckIdle();
|
||||
}, 1000);
|
||||
this.intervalObject = setInterval(() => this.doCheckIdle(), 1000);
|
||||
}
|
||||
}
|
||||
|
||||
public destoryChecker() {
|
||||
if (!!this.intervalObject) {
|
||||
clearInterval(this.intervalObject);
|
||||
this.intervalObject = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { Component, OnInit, OnDestroy, Inject } from '@angular/core';
|
||||
|
||||
import { Store, select } from '@ngrx/store';
|
||||
|
||||
|
@ -34,6 +34,7 @@ import { LogoutInfo, KEY_LOGOUT_INFO } from '@app/types';
|
|||
import { AppAuthenticationService } from '@app/services/authentication.service';
|
||||
import { logoutInitialize } from '@app/store/account/authentication';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-account-login',
|
||||
|
@ -84,6 +85,7 @@ export class LoginPageComponent implements OnInit, OnDestroy {
|
|||
];
|
||||
|
||||
constructor(
|
||||
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
|
||||
private store: Store<any>,
|
||||
private router: Router,
|
||||
private translateService: TranslateService,
|
||||
|
@ -190,6 +192,11 @@ export class LoginPageComponent implements OnInit, OnDestroy {
|
|||
KEY_LOGOUT_INFO
|
||||
);
|
||||
|
||||
if (!!personLogout) {
|
||||
// if self logout clear idle check.
|
||||
this.nativeService.idleStateStop();
|
||||
}
|
||||
|
||||
if (!!personLogout && !!personLogout.reasonCode) {
|
||||
let msg = this.translateService.instant('accounts.results.doLogout');
|
||||
switch (personLogout.reasonCode) {
|
||||
|
|
|
@ -234,13 +234,13 @@ export const reducer = createReducer(
|
|||
const roomUserList: RoomUserDetailData[] = [];
|
||||
const roomUserShortList: RoomUserData[] = [];
|
||||
|
||||
if (action.userInfoList) {
|
||||
if (!!action.userInfoList && action.userInfoList.length > 0) {
|
||||
roomUserList.push({
|
||||
roomSeq: action.roomInfo.roomSeq,
|
||||
userInfos: action.userInfoList
|
||||
});
|
||||
}
|
||||
if (action.userInfoShortList) {
|
||||
if (!!action.userInfoShortList && action.userInfoShortList.length > 0) {
|
||||
roomUserShortList.push({
|
||||
roomSeq: action.roomInfo.roomSeq,
|
||||
userInfos: action.userInfoShortList
|
||||
|
@ -252,12 +252,18 @@ export const reducer = createReducer(
|
|||
room: adapterRoom.upsertOne(action.roomInfo, {
|
||||
...state.room
|
||||
}),
|
||||
roomUser: adapterRoomUser.upsertMany(roomUserList, {
|
||||
roomUser:
|
||||
roomUserList.length > 0
|
||||
? adapterRoomUser.upsertMany(roomUserList, {
|
||||
...state.roomUser
|
||||
}),
|
||||
roomUserShort: adapterRoomUserShort.upsertMany(roomUserShortList, {
|
||||
})
|
||||
: state.roomUser,
|
||||
roomUserShort:
|
||||
roomUserShortList.length > 0
|
||||
? adapterRoomUserShort.upsertMany(roomUserShortList, {
|
||||
...state.roomUserShort
|
||||
})
|
||||
: state.roomUserShort
|
||||
};
|
||||
}),
|
||||
|
||||
|
|
|
@ -187,13 +187,15 @@ export class BrowserNativeService extends NativeService {
|
|||
});
|
||||
}
|
||||
|
||||
selectSaveFilePath(defaultPath?: string): Promise<{
|
||||
canceled: boolean,
|
||||
filePath: string
|
||||
selectSaveFilePath(
|
||||
defaultPath?: string
|
||||
): Promise<{
|
||||
canceled: boolean;
|
||||
filePath: string;
|
||||
}> {
|
||||
return new Promise<{
|
||||
canceled: boolean,
|
||||
filePath: string
|
||||
canceled: boolean;
|
||||
filePath: string;
|
||||
}>((resolve, reject) => {
|
||||
resolve({
|
||||
canceled: false,
|
||||
|
@ -245,6 +247,8 @@ export class BrowserNativeService extends NativeService {
|
|||
});
|
||||
}
|
||||
|
||||
idleStateStop(): void {}
|
||||
|
||||
changeLimitOfIdleState(limitTime: number): void {}
|
||||
|
||||
chatOpenRoom(): Observable<string> {
|
||||
|
|
|
@ -309,13 +309,15 @@ export class ElectronNativeService implements NativeService {
|
|||
});
|
||||
}
|
||||
|
||||
selectSaveFilePath(defaultPath?: string): Promise<{
|
||||
canceled: boolean,
|
||||
filePath: string
|
||||
selectSaveFilePath(
|
||||
defaultPath?: string
|
||||
): Promise<{
|
||||
canceled: boolean;
|
||||
filePath: string;
|
||||
}> {
|
||||
return new Promise<{
|
||||
canceled: boolean,
|
||||
filePath: string
|
||||
canceled: boolean;
|
||||
filePath: string;
|
||||
}>((resolve, reject) => {
|
||||
try {
|
||||
resolve(
|
||||
|
@ -409,7 +411,7 @@ export class ElectronNativeService implements NativeService {
|
|||
.asObservable()
|
||||
.pipe(share());
|
||||
}
|
||||
|
||||
console.log('idleStateChanged');
|
||||
this.ipcRenderer.send(IdleStateChannel.StartCheck);
|
||||
|
||||
this.ipcRenderer.on(
|
||||
|
@ -421,6 +423,10 @@ export class ElectronNativeService implements NativeService {
|
|||
return this.idleStateChanged$;
|
||||
}
|
||||
|
||||
idleStateStop(): void {
|
||||
this.ipcRenderer.send(IdleStateChannel.StopCheck);
|
||||
}
|
||||
|
||||
changeLimitOfIdleState(limitTime: number): void {
|
||||
this.ipcRenderer.send(IdleStateChannel.ChangeLimitTime, limitTime);
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ export enum WindowStateChannel {
|
|||
export enum IdleStateChannel {
|
||||
Changed = 'UCAP::idleState::changed',
|
||||
StartCheck = 'UCAP::idleState::startCheck',
|
||||
StopCheck = 'UCAP::idleState::stopCheck',
|
||||
ChangeLimitTime = 'UCAP::idleState::changeLimitTime'
|
||||
}
|
||||
|
||||
|
|
|
@ -59,9 +59,11 @@ export abstract class NativeService {
|
|||
abstract openTargetItem(filePath?: string): Promise<boolean>;
|
||||
abstract getPath(name: NativePathName): Promise<string>;
|
||||
abstract selectDirectory(): Promise<string>;
|
||||
abstract selectSaveFilePath(defaultPath?: string): Promise<{
|
||||
canceled: boolean,
|
||||
filePath: string
|
||||
abstract selectSaveFilePath(
|
||||
defaultPath?: string
|
||||
): Promise<{
|
||||
canceled: boolean;
|
||||
filePath: string;
|
||||
}>;
|
||||
|
||||
abstract executeProcess(executableName: string): Promise<number>;
|
||||
|
@ -74,6 +76,7 @@ export abstract class NativeService {
|
|||
abstract appExit(): void;
|
||||
|
||||
abstract idleStateChanged(): Observable<WindowIdle>;
|
||||
abstract idleStateStop(): void;
|
||||
abstract changeLimitOfIdleState(limitTime: number): void;
|
||||
|
||||
abstract chatOpenRoom(): Observable<string>;
|
||||
|
|
|
@ -42,7 +42,13 @@ export function isForwardable(
|
|||
event: Info,
|
||||
eventInfoStatus: InfoResponse
|
||||
): boolean {
|
||||
if (event.type === EventType.File) {
|
||||
if (
|
||||
event.type === EventType.Plan ||
|
||||
event.type === EventType.AllimTms ||
|
||||
event.type === EventType.AllimElephant
|
||||
) {
|
||||
return false;
|
||||
} else if (event.type === EventType.File) {
|
||||
if (
|
||||
!!eventInfoStatus &&
|
||||
!!eventInfoStatus.validFileBaseSeq &&
|
||||
|
|
Loading…
Reference in New Issue
Block a user