Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(private actions$: Actions, private store: Store) {
this.actions$
.pipe(ofActionSuccessful(ConnectWebSocket))
.subscribe(action => console.log('ConnectWebSocket', action));
this.actions$
.pipe(ofActionSuccessful(DisconnectWebSocket))
.subscribe(action => console.log('DisconnectWebSocket', action));
this.actions$.pipe(ofActionSuccessful(WebSocketConnected)).subscribe(action => {
console.log('WebSocketConnected', action);
this.store.dispatch(new AuthenticateWebSocket());
});
this.actions$
.pipe(ofActionSuccessful(WebSocketDisconnected))
.subscribe(action => console.log('WebSocketDisconnected', action));
}
}
ngOnInit() {
this.actions
.pipe(ofActionSuccessful(StartLoader, StopLoader), filter(this.filter), takeUntilDestroy(this))
.subscribe((/**
* @param {?} action
* @return {?}
*/
action => {
if (action instanceof StartLoader)
this.startLoading();
else
this.stopLoading();
}));
this.router.events
.pipe(filter((/**
* @param {?} event
* @return {?}
*/
event => event instanceof NavigationStart || event instanceof NavigationEnd || event instanceof NavigationError)), takeUntilDestroy(this))
this.isShowChatBox = true
}
)
)
this.sup.add(this.chatState$.pipe(
filter(state => ObjectUtils.isNotNull(state.currentUser)),
tap(
res => {
if(!this.isShowChatHead) this.isShowChatHead = true
}
)
).subscribe())
this.sup.add(
this.actions$.pipe(
ofActionSuccessful(NotifyIncomingVideoCall)
).subscribe(
() => {
if(!this.isOpennedDialog){
this.isOpennedDialog = true
const inviter = this.store.selectSnapshot(CHAT_STATE_TOKEN).inviterVideoCall
const participant = this.store.selectSnapshot(CHAT_STATE_TOKEN).incomingVideoCall
let dialogRef = this.dialog.open(VideoCallDialogComponent, {
disableClose: true,
data: {
invitee: inviter,
isRinging: true,
participant: participant
}
});
dialogRef.afterClosed().subscribe(result => {
if (result) {
pageEnter() {
super.pageEnter();
this.subscriptions.push(
this.currentMeasure$.subscribe(measure => this.updateHitsAccuracy(measure)),
this.actions$.pipe(ofActionSuccessful(StopMeasureScan)).subscribe(() =>
this.navController.navigateForward(['measure', 'report'], true, {
queryParams: { reportScan: true }
})
)
);
this.connectedDevice$.pipe(take(1)).subscribe(connectedDevice => {
if (connectedDevice) {
this.store.dispatch(new StartMeasureScan(connectedDevice)).subscribe();
}
});
this.actions$.pipe(ofActionSuccessful(CancelMeasure)).subscribe(() =>
this.navController.navigateRoot([
'tabs',
{
outlets: {
home: 'home',
private discoverDevices() {
this.diagnostic.registerBluetoothStateChangeHandler((state: string) => {
switch (state) {
case this.diagnostic.bluetoothState.POWERED_OFF:
this.onBLEError();
this.store.dispatch(new BLEConnectionLost());
break;
}
});
const time = timer(this.scanPeriod, this.scanPeriod).pipe(
takeUntil(this.actions$.pipe(ofActionSuccessful(StopDiscoverDevices, BLEConnectionLost)))
);
merge(
this.ble.scan([], this.scanDuration).pipe(
scan((devices, newDevice) => [...devices, newDevice], []),
throttleTime(100)
),
time.pipe(
switchMap(() => this.ble.scan([], this.scanDuration)),
buffer(time),
skip(1)
)
)
.pipe(
map((rawDevices: RawBLEDevice[]) => {
const res: RawBLEDevice[] = [];
rawDevices.forEach(rawDevice => {
this.actions$.pipe(ofActionErrored(PublishMeasure)).subscribe(({ measure }: PublishMeasure) => {
this.measureBeingSentMap[measure.id] = false;
this.toastController
.create({
message: this.translateService.instant('HISTORY.SEND_ERROR'),
showCloseButton: true,
duration: 3000,
closeButtonText: this.translateService.instant('GENERAL.OK')
})
.then(toast => toast.present());
}),
this.actions$.pipe(ofActionDispatched(PublishMeasure)).subscribe(({ measure }: PublishMeasure) => {
this.measureBeingSentMap[measure.id] = true;
}),
this.actions$
.pipe(ofActionSuccessful(PublishMeasure))
.subscribe(({ measure }: PublishMeasure) => (this.measureBeingSentMap[measure.id] = false)),
this.actions$.pipe(ofActionSuccessful(ShowMeasure)).subscribe(action => {
this.navigationService.navigateForward(
['measure', action.measure.type === MeasureType.Measure ? 'report' : 'report-series'],
{
animated: true,
queryParams: { goBackHistory: true }
}
);
})
);
}
constructor(actions, router, ngZone, store, confirmationService, appRef, cfRes, rendererFactory, injector) {
this.actions = actions;
this.router = router;
this.ngZone = ngZone;
this.store = store;
this.confirmationService = confirmationService;
this.appRef = appRef;
this.cfRes = cfRes;
this.rendererFactory = rendererFactory;
this.injector = injector;
actions.pipe(ofActionSuccessful(RestOccurError)).subscribe((/**
* @param {?} res
* @return {?}
*/
res => {
const { payload: err = (/** @type {?} */ ({})) } = res;
/** @type {?} */
const body = snq((/**
* @return {?}
*/
() => ((/** @type {?} */ (err))).error.error), DEFAULT_ERROR_MESSAGES.defaultError.title);
if (err instanceof HttpErrorResponse && err.headers.get('_AbpErrorFormat')) {
/** @type {?} */
const confirmation$ = this.showError(null, null, body);
if (err.status === 401) {
confirmation$.subscribe((/**
* @return {?}
constructor(
private actions: Actions,
private router: Router,
private ngZone: NgZone,
private store: Store,
private confirmationService: ConfirmationService,
private appRef: ApplicationRef,
private cfRes: ComponentFactoryResolver,
private rendererFactory: RendererFactory2,
private injector: Injector,
) {
actions.pipe(ofActionSuccessful(RestOccurError)).subscribe(res => {
const { payload: err = {} as HttpErrorResponse | any } = res;
const body = snq(() => (err as HttpErrorResponse).error.error, DEFAULT_ERROR_MESSAGES.defaultError.title);
if (err instanceof HttpErrorResponse && err.headers.get('_AbpErrorFormat')) {
const confirmation$ = this.showError(null, null, body);
if (err.status === 401) {
confirmation$.subscribe(() => {
this.navigateToLogin();
});
}
} else {
switch ((err as HttpErrorResponse).status) {
case 401:
this.showError(
DEFAULT_ERROR_MESSAGES.defaultError401.details,
constructor(
private router: Router,
private actions$: Actions,
private analytics: GoogleAnalyticsService,
private pageTitle: PageTitleService,
) {
this.actions$
.pipe(
ofActionSuccessful(RouterNavigation),
map((action: RouterNavigation) => action.routerState as any),
distinctUntilChanged((previous: RouterStateData, current: RouterStateData) => {
return previous.url === current.url;
}),
)
.subscribe(data => {
this.pageTitle.setTitle(data.breadcrumbs);
this.analytics.setPage(data.url);
});
}
}
startMeasureScan(device: AbstractDevice): Observable {
const stopSignal = this.actions$.pipe(
ofActionSuccessful(StopMeasureScan, CancelMeasure),
take(1)
);
this.actions$
.pipe(
ofActionSuccessful(DeviceConnectionLost),
take(1)
)
.subscribe(() => {
const canEndCurrentScan = this.store.selectSnapshot(
({ measures }: { measures: MeasuresStateModel }) => measures.canEndCurrentScan
);
if (canEndCurrentScan) {
this.store.dispatch(new StopMeasureScan(device));
} else {
this.store.dispatch(new CancelMeasure());
}
});
return this.detectHits(device, stopSignal).pipe(take(1));
}