0403 sync

This commit is contained in:
Park Byung Eun 2020-04-03 17:37:51 +09:00
parent 800d518611
commit 05bb9afa19
8 changed files with 82 additions and 1 deletions

View File

@ -1,2 +1,10 @@
웹소켓 disconnect 감지 웹소켓 disconnect 감지
retry innerprotocol ping subscription 연결 감지
socket request timer
pending request 일정 시간동안 응답 없을 경우
TimeError throw
socket close 이벤트에 대한 effect 추가
화상알리미 프로필 이미지 변경 x

View File

@ -0,0 +1,6 @@
프로필 이미지 변경 동기화 버그 수정
네트워크 타임아웃 처리
맥 사이즈 변경 드래그 문제 강희경 책임님께 문의
Cannot connect to the LFTalk server. Please check your internet connection.
Retrying. Please wait.

View File

@ -0,0 +1,12 @@
import { TestBed } from '@angular/core/testing';
import { OveraySpinnerService } from './overay-spinner.service';
describe('OveraySpinnerService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: OveraySpinnerService = TestBed.get(OveraySpinnerService);
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,55 @@
import { Injectable } from '@angular/core';
import { Overlay, OverlayRef } from '@angular/cdk/overlay';
import { ComponentPortal } from '@angular/cdk/portal';
import { MatSpinner } from '@angular/material/progress-spinner';
import { Observable, Subject } from 'rxjs';
import { mapTo, scan, map, mergeMap } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class OveraySpinnerService {
private spinnerTopRef = this.cdkSpinnerCreate();
spin$: Subject<boolean> = new Subject();
constructor(private overlay: Overlay) {
this.spin$
.asObservable()
.pipe(
map(val => (val ? 1 : -1)),
scan((acc, one) => (acc + one >= 0 ? acc + one : 0), 0)
)
.subscribe(res => {
if (res === 1) {
this.showSpinner();
} else if (res === 0) {
this.spinnerTopRef.hasAttached() ? this.stopSpinner() : null;
}
});
}
private cdkSpinnerCreate() {
return this.overlay.create({
hasBackdrop: true,
backdropClass: 'dark-backdrop',
positionStrategy: this.overlay
.position()
.global()
.centerHorizontally()
.centerVertically()
});
}
private showSpinner() {
console.log('attach');
this.spinnerTopRef.attach(new ComponentPortal(MatSpinner));
}
private stopSpinner() {
console.log('dispose');
this.spinnerTopRef.detach();
}
}